StanScates/Tweet.js-Mod

Tweets not embedded in designated DIV

Opened this issue · 6 comments

Hello! Great job! This is an amazing solution to deal with API 1 being deprecated (I imagine you are getting a lot of downloads).

We had been using seaofclouds / tweet on our site until now to simple grab the most recent 3 tweets from our own account. We installed your updated JS as well as associated PHP files. Initially the DIV where tweets were supposed to appear simply remained blank. No error on the console or in PHP log.

After some digging we found that the process was working, with the PHP proxy correctly responding and sending the JSON message back with the messages information. But for some reason the JS was not embedding the messages in the designated DIV.

We are not that experienced with JS so we couldn't completely understand your code. However, we added the following code in line 301:

$.empty().append(list);

And it started working.

However, one more issue remains: in our home page we have 2 DIVs with the same class that we want populated with the same output. This used to work, but now only the first DIV gets populated. We tried using the following with "each" but it didn't work:

jQuery('div.tweets').each(function(){ jQuery(this).tweet({stuffhere}); });

If you would like to check our code:

Home: http://www.lyquix.com/?ModPagespeed=off (the additional parameter is to show a non-minified output). The div,tweets are on line 159 and 435

JS with the added code on line 301: http://www.lyquix.com/templates/lyquixhome/twitter/jquery.tweet.js

And the JS where we execute things, starting on line 34: http://www.lyquix.com/templates/lyquixhome/js/scripts.js

The each loop at line 256 is already adding the same tweets to each instance of a div. I think your fix to get things showing up in the designated div has broken this functionality.

Remove your fix, and try:

jQuery("div.tweets").tweet({ 
        modpath: "/templates/lyquixhome/twitter/", 
        loading_text: "loading twitter feed...", 
        count: 3, 
        username: "lyquix", 
        template: '<span class="howrecent">{tweet_relative_time}</span><br />{text}' 
    });

The .each loop will happen within jquery.tweet.js.

If tweets still don't show up in the div, then something else is awry.

Thank you for the comment. Your suggestion was my initial setup, that' how I had it in the previous version of jquery.tweet.

I have reversed it to all "standard". Can someone take a look and see why it doesn't work?

Thank you!

I've been prying into it, but it's a tricky one to debug since taking a local copy leaves me without access to the twitter proxy. If I find the time I'll set up a little dev sandbox and tinker. I'm going to go out on a limb and guess it's either the jQuery version, or some obscure clash with mootools. For reference, I used jQuery 1.5.1.

I would recommend always using a current version of jQuery, or at least >= 1.9

The site is now updated to 1.9 and still the same problem :(

Hi Stan

I have made one more step towards a solution: I took the html and stripped it to the minimum and started testing any conflicts with other js. http://www.lyquix.com/tweets.html?ModPagespeed=off

I found that there is some conflict with Mootools. You can see in the following page that the twitter feeds are correctly loaded and that the Mootools library is commented. If I uncomment the line to allow for Mootools to load, the feeds are no loaded, but there is no error at all.

This is happening even as we use noConflict. I went a step forward and I changed all references to $ to jQuery in your code, but I still get the same problem.

:-(

Ruben