Skip to content
A jQuery plugin for the Tweets Node.js app.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Tweets Plugin

This is a jQuery plugin for use with the Tweets Node.js app.


This plugin requires a server-side component. It it designed to work with the Tweets Node.js app, as it relies on the presence of JSON data from the server. Ensure the server-side component is in place before setting up the jQuery plugin.

Set up the JS

This plugin requires jQuery and Handlebars. They can be called in from a CDN:

<script src=""></script>
<script src=""></script>

Download the jquery.tweets.js file and place it in your JavaScript folder. It would then be included something like this:

<script src="/javascripts/jquery.tweets.js"></script>

To make use of the functionality, it is necessary to connect to your Tweets server. This downloads the client side code automatically. Replace "YOUR_URL" with the URL of your Tweets server and add this script tag:

<script src="http://YOUR_URL/"></script>

Prepare the HTML

Your Tweets output will need a container to be displayed. If you wish to use the attached CSS, add the following to your HTML first:

<div class="tweets" id="tweet-container"></div>

The class tweets is used by the CSS to style the div. The id tweet-container is used by the plugin to identify where the tweets will be sent.

Prepare the CSS

Download the jquery.tweets.css file and place it in your CSS folder. It can then be called in the head of your document like so:

<link href="/stylesheets/jquery.tweets.css" media="screen, projection" rel="stylesheet" type="text/css" />

The SASS folder contains the SASS equivalent if you prefer your CSS pre-processed.

Call the plugin in JS

The plugin can be initialised as following:

  /* Initialise the Tweets plugin */
    searchPhrase: '',
    templateID: '',
    destinationID: 'tweet-container',
    tweetSource: 'http://YOUR-SERVER-URL'

Make sure and replace searchPhrase with a search relevant to your results. This can be a username (@username), a URL ( or anything you'd use to search Twitter.

Replace the tweetSource with the URL of your Node.js app. If testing locally, this would be http://localhost:5000

Creating your own template

Since this plugin uses Handlebars for the templating, you can specify your own template. Here's one to start with:

<script type="text/x-handlebars-template" id="tweet-template">
  <article class="tweet">
    <section class="user-details">
      <a href="{{from_user}}">
        <div class="user-image" style="background-image: url({{user.profile_image_url}})"></div>
    <p class="text">{{{text}}}</p>
    <p class="timing"><a href="{{from_user}}/statuses/{{id_str}}">{{created_at}}</a></p>

Specify the templateID in the above JavaScript to use your template in the views.

Current version

0.3 - Fixed for v1.1 of the API 0.2 - Streamin'



v1.1 update Update to the template content to reflect updated status content


Adding some streaming functionality.


Initial code

Pull requests

Pull requests are most welcome. If you have any questions, send me an email or tweet @donovanh.



You can’t perform that action at this time.