Disqus plugin adding code to JSON API feed
-
The JSON API plugin is working great but I ran into a problem when trying to combine with the Disqus plugin. When the plugin is activated, a block of HTML is added to the JSON feed and causing it to break the elements using this feed. Here’s what’s added:
<script type="text/javascript"> // <![CDATA[ var disqus_shortname = 'something'; var disqus_domain = 'disqus.com'; (function () { var nodes = document.getElementsByTagName('span'); for (var i = 0, url; i < nodes.length; i++) { if (nodes[i].className.indexOf('dsq-postid') != -1) { nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel')); url = nodes[i].parentNode.href.split('#', 1); if (url.length == 1) url = url[0]; else url = url[1] nodes[i].parentNode.href = url + '#disqus_thread'; } } var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = 'https://' + disqus_domain + '/forums/' + disqus_shortname + '/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); //]]> </script>
I’m already hacking the plugin a bit to remove body text so I don’t mind making changes to the code, just not sure where to start.
Also checking with Disqus but I figured modifying this plugin would be easier (with less downstream effects, likely).
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Disqus plugin adding code to JSON API feed’ is closed to new replies.