Skip to content

Commit

Permalink
Change comments script code to use polymorphism
Browse files Browse the repository at this point in the history
Update #63
  • Loading branch information
talha131 committed Nov 28, 2013
1 parent 7083eea commit 5c1ecc9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ <h4>Tags</h4>

{% block script %}
{{ super() }}
{% include 'disqus_script_count.html' %}
{% include 'disqus_comments_uncollapse.html' %}
{% from 'comments.html' import comments_script with context %}
{{ comments_script(article) }}
{% endblock script %}
7 changes: 7 additions & 0 deletions templates/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@
</section>
{% endif %}
{% endmacro %}

{% macro comments_script(article) %}
{% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
{% include 'disqus_script_count.html' %}
{% include 'disqus_comments_uncollapse.html' %}
{% endif %}
{% endmacro %}
2 changes: 0 additions & 2 deletions templates/disqus_comments_uncollapse.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
<script language="javascript" type="text/javascript">
function uncollapse() {
if (window.location.hash.match(/^#comment-\d+$/)) {
Expand All @@ -13,4 +12,3 @@
window.location.reload(true);
}
</script>
{% endif %}
2 changes: 0 additions & 2 deletions templates/disqus_script_count.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
<script type="text/javascript">
var disqus_shortname = '{{ DISQUS_SITENAME }}';

Expand All @@ -9,4 +8,3 @@
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
{% endif %}

0 comments on commit 5c1ecc9

Please sign in to comment.