jTweetsAnywhere

Demo

Auto-refreshing Realtime Ticker and More Tweets

 
<div id="jTweetsAnywhereSample">
</div>

<script type="text/javascript">
$('#jTweetsAnywhereSample').jTweetsAnywhere({
    searchParams: ['q=html5'],
    count: 10,
    showTweetFeed: {
    	autoConformToTwitterStyleguide: true,
        showTimestamp: {
            refreshInterval: 15
        },
        autorefresh: {
            mode: 'trigger-insert',
            interval: 30
        },
        paging: { mode: 'more' }
    },
    onDataRequestHandler: function(stats, options) {
        if (stats.dataRequestCount < 11) {
            return true;
        }
        else {
            stopAutorefresh(options);
            alert("To avoid struggling with Twitter's rate limit, we stop loading data after 10 API calls.");
        }
    }
});
</script>

Here's the code to create the tweet feed.

The autorefresh.mode 'trigger-insert' causes the plugin to show and update a button (trigger) on top of the tweet feed, if new tweets are available - displaying the number of new tweets. Click on the button to view these tweets.

The paging.mode 'more' brings up a 'more' button at the end of the tweet feed. Click on the button to show earlier tweets.

The showTimestamp.refreshInterval makes sure that all tweet timestamps will be refreshed every 15 seconds.

The supplied onDataRequestHandler event handler is used to limit the number of Twitter API calls to a maximum of 10, to avoid the exhaustion of remaining Twitter API calls, before the rate limit is reached.

HINT: If you don't see the trigger button after 30 seconds, this might have several causes:

  • - There are no new tweets available
  • - Your rate limit (150 calls per hour) has been reached
Current Release: V1.3.1