module Origen::Generator::Compiler::DocHelpers::Disqus
Public Instance Methods
disqus_comments(options = {})
click to toggle source
# File lib/origen_doc_helpers/helpers.rb, line 55 def disqus_comments(options = {}) options = { disqus_shortname: Origen.app.config.disqus_shortname || 'origen-sdk' }.merge(options) # Created this other channel in error, don't use it if options[:disqus_shortname].to_s == 'origensdk' options[:disqus_shortname] = 'origen-sdk' end <<END <div style="position: relative"> <hr> <h4>Comments</h4> </div> <div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES * * */ var disqus_shortname = '#{options[:disqus_shortname]}'; var disqus_title; var disqus_url = 'http://' + window.location.hostname + window.location.pathname; disqus_title = $("h1").text(); if (disqus_title.length == 0) { disqus_title = $("h2").text(); } if (disqus_title.length == 0) { disqus_title = $("h3").text(); } if (disqus_title.length == 0) { disqus_title = $("title").text(); } else { disqus_title = disqus_title + ' (' + $("title").text() + ')'; } /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> END end