Skip to content

Commit

Permalink
disqus comments implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
tcurdt committed Oct 12, 2010
1 parent dc548d7 commit 673dd91
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions lib/awestruct/extensions/disqus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,44 @@ def execute(site)

module Disqus
def disqus_comments()
'comments'
html = %Q{
<div id="disqus_thread"></div>
<script type="text/javascript">
}
if site.disqus_developer
html += %Q{
var disqus_developer = 1;
}
end
html += %Q{
var disqus_url = "#{self.url}";
(function() {
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
dsq.src = "http://#{site.disqus}.disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=#{site.disqus}">comments powered by Disqus.</a></noscript>
}
html
end

def disqus_comments_link()
'comments link'
%Q{ <a href="#{self.url}#disqus_thread">Comments</a> }
end

# http://bakery.cakephp.org/articles/view/disqus-comment-system-integration-helper

# <div id="disqus_thread"></div>
# <script type="text/javascript">
# /**
# * var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread]
# */
# (function() {
# var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
# dsq.src = 'http://vafer.disqus.com/embed.js';
# (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
# })();
# </script>
# <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=vafer">comments powered by Disqus.</a></noscript>
# <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

# <script type="text/javascript">
# var disqus_shortname = 'vafer';
# (function () {
# var s = document.createElement('script'); s.async = true;
# s.src = 'http://disqus.com/forums/vafer/count.js';
# (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
# }());
# </script>

# <a href="http://example.com/my_article.html#disqus_thread">Comments</a>

# post_id = self.post_id ? self.post_id : Digest::SHA1.hexdigest( self.url )

def disqus_comments_link_loader()
%Q{
<script type="text/javascript">
var disqus_shortname = "#{site.disqus}";
(function () {
var s = document.createElement('script'); s.async = true;
s.src = "http://disqus.com/forums/#{site.disqus}/count.js";
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
}
end
end
end
end
Expand Down

0 comments on commit 673dd91

Please sign in to comment.