jQuery Twitter Plugin.

A jQuery plugin for working with the Twitter Search API and putting twitter searches on websites with a simple syntax that follows the Twitter Search API URL parameters. The jQuery fn twitter plugin fills each element in the collection it operates on with an unordered list of twitter statuses based on the options passed in.


$('#demoList').twitter({from: 'mediatemple', replies: false}) ← Click to run this code



Simple Syntax:

But there are lots of options, so you could do something more like:



Recommended starter styles



Documentation

The jQuery Twitter Plugin provides two methods and a public default options object:

$.twitter(options, callback)

options: the string or object used to configure the search

callback: the function to run when the results come back from twitter. Three arguments are passed to this callback(tweets, query, exclusionsExp)

This method allows you to get twitter results and work with the JSON response. Fore example:



$.fn.twitter(options)

options: the string or object used to configure the search

This method uses $.twitter() internally to go and get the tweets you ask for, and render them in a <ul> within each element in the jQuery collection you call it on. For example:



$.twitter.options

This is the publicly available object that $.twitter() and $.fn.twitter() use to configure twitter searches. You can override it at the beginning of your code to prevent yourself from repeating configurations unnecessarily. For example:



Standard Twitter Search API options

You can pass the default Twitter Search API Parameters to $.fn.twitter() as properties of the options object:

q

Default query

ands

All of these words

phrase

This exact phrase

ors

Any of these words

nots

None of these word

tag

This hashtag

lang

Written in language

from

From this person

to

To this person

ref

Referencing this person

near

Near this place

within

Within this distance

units

Distance unit (miles or kilometers)

since

Since this date

until

Until this date

tude

Attitude: '?' or ':)' or ':)'

filter

Containing: 'links'

include

Include retweet?: 'retweets'

rpp

Results per page

Non Standard Options

In addition to supporting the default Twitter Search API URL parameters, $.fn.twitter() also supports five options for filtering out mentions and retweets and for handling no results cases client side.

limit

Number of tweets to get. Maps to and supersedes rpp (results per page).

exclusions

Space delimited list of strings (eg: '_ s gr @b'). Use this to exclude tweets containing strings that are part of a word

avatar

Include user avatars? true by default. (Boolean)

notFoundText

Text to display if no results are found

replies

Include replies? (Boolean)

retweets

Include retweets (Boolean)





Usage Examples (the gist demo)





Source




Please send your questions to this address or call Bocoup at 617-379-2752.
This web page is proudly maintained by Bocoup and hosted by (mt) Media Temple.
All code on this website is Open Source. Want to work at Bocoup? Then Apply.
HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Graphics, 3D & Effects, Multimedia, Performance & Integration, Semantics, and Offline & Storage