DISQUS

Community Page on DISQUS

what is this?

DISQUS Blog

The official Disqus forum. This is the place to receive beta support and offer suggestions.
« Back
Author

embed.js too limiting

Started by Benjamin Golub · 5 months ago

I just added Disqus comments to RSSmeme (http://www.rssmeme.com/). It works pretty well but what I really wanted to do was have the embed.js work on an arbitrary div. Currently it works on a div with id "disqus_thread" which is fine for most blogs but I wanted to have a link on every story that would slide down the thread and comment form.

In order for that to work I need to be able to tell embed.js two things. 1) what div to work it's magic on so I can have a different id for each div and 2) the corresponding url for this thread.

I might be missing something, but I'm not sure that this is possible at the moment.

12 comments

  • Hi Brian,

    You're not missing anything. Unfortunately this isn't configurable at the moment. This would make a nice documented option for developers.

    We'll talk it over a bit and see what we can do. Please feel free to shoot us any suggestions or needs you may have.
  • It's actually Ben, but thanks! I tried doing something like this:

    var disqus_url = 'set_to_something';
    var disqus_container_id = 'set_to_something';
    $.getScript('http://disqus.com/forums/rssmeme/embed.js'); <-- that's jQuery

    But it didn't work :(
  • Making those variables global got me a little bit further but still no dice.
  • [edit]

    We do allow you to set the container id, I stand corrected. My mistake.
  • It looks like that should have worked. What issue are you seeing?
  • http://www.rssmeme.com/ <-- try it out by clicking a comment link (under the Contribute section of each story).

    That should load the Disqus thread into thread_NUM but as you can see it doesn't. It just blanks the screen and starts loading something. Firebug shows no errors.

    The relevant javascript can be seen at http://media.benjamingolub.com/rssmeme/js/rssme... under the numComments function. Any help would be really appreciated; I think Disqus is great (and also built using Django, a big plus in my book!)
  • Nearly there! I copied embed.js locally and removed the document.write where you put the style in. Now it doesn't blank the page or anything.

    But it is quirky. If you click the comment link for a story it will correctly load it. Then go to click on one ABOVE that story and again it will work fine. Go try to load the comments for a story BELOW a story that has already loaded and it loads the comments on the FIRST one it sees.

    I looked at thread.js and found that it is ONLY searching for the div with id dsq-content. I could copy this locally and fix things but I'm feeling like I'm monkey patching way too much here. Could you modify thread.js so that it looks for dsq-content WITHIN the div with id disqus_container_id instead?
  • Got it working by searching for the div with id dsq-content and changing it to dsq-content-old when you click to load the next set of comments.

    Now we're talking!
  • Edit: nevermind this post
  • Excellent. I'm still following your progress.
  • Excellent, thanks!

Add New Comment

Returning? Login