Documentation
The Rebozo plugin contains a single, jQuery method, which requests tweet data from Twitter's search services, and displays them on-screen using
.rebozo(search, [options])
When the rebozo method is invoked, an asynchronous request is made to
Twitter's search API. When that request is completed, the resulting tweets are
formatted and inserted into the matched elements.
$(".tweet-container").rebozo("#boston")
The sample code above will search for tweets containing the trending topic
"#boston" and insert them into an element with
class="tweet-container".
Parameters
-
searchThe
searchparameter specifies the query that will be run against Twitter's search API. Common examples will be trending topics (e.g. "#olympics") and user names (e.g. "@wilw"). To display only tweets from or to a specific user, use the "from:username" and "to:username" formats, respectively. -
optionsA set of key/value pairs that specify the behavior of Rebozo. This parameter is not required. The default values for this parameter are exposed, globally, as
$.fn.rebozo.defaults. Updating the key/value pairs there will affect all subsequent calls to the.rebozomethod. -
options.tweetCountDefault: 20
The maximum number of tweet results to show on-screen at once.
-
options.autoLinkDefault: true
Indicates whether text in a tweet message should automatically be linked. If
true, usernames ("@username"), trending topics ("#topic"), and URLs ("http://some.url/here") will be converted into hyperlinks. -
options.localLinksDefault: true
Indicates whether embedded Twitter links (usernames and trending topics, as indicated by
options.autoLink) should load within the current Rebozo container or redirect the visitor to Twitter.com -
options.linkPhotoDefault: true
Indicates whether a tweet author's photo should be linked to that author's Twitter feed. If
options.localLinksis true, this link will load locally. -
options.linkUsernameDefault: true
Indicates whether a tweet author's name should be linked to that author's Twitter feed. If
options.localLinksis true, this link will load locally. -
options.photoSizeDefault: 48
The height and width (square) to use for tweet author photos, if they are displayed. Currently Twitter always supplies these photos at 48 pixels, so any resizing will be done by the browser.
-
options.frequencyDefault: 30,000 (30 seconds)
The frequency, in milliseconds, that Rebozo should re-query Twitter's search API for additional results. If this value is
null, Rebozo will never request additional results. -
options.autoUpdateDefault: false
Indicates whether Rebozo should automatically display new tweets whenever additional results are retrieved (see
options.frequency). If this options isfalse, Rebozo will queue new results, and prompt the visitor to display them manually (seeoptions.updateTemplate). -
options.tweetTemplateDefault: HTML
<div class="rebozo_tweet"> <div class="rebozo_photo"></div> <div class="rebozo_content"> <span class="rebozo_author"></span> <span class="rebozo_message"></span> <div class="rebozo_details"> <span class="rebozo_time"></span> from <span class="rebozo_client"></span> </div> </div> </div>The template that Rebozo should use for displaying entire tweets. This option can be a string of HTML, or a jQuery selector for an in-page element that should, itself, be used.
Within this template, Rebozo looks for elements with specific classes, and if found, fills them with the appropriate content:
rebozo_photo: Inserts an
<img>element, displaying the tweet's author's photo. This element will be hyperlinked ifoptions.linkPhotoistrue.rebozo_author: Inserts the tweet's author's name. The text will be hyperlinked if
options.linkUsernameis true.rebozo_message: Inserts the text of the tweet. If
options.autoLinkis true, this text will be hyperlinked where appropriate.rebozo_time: Inserts a relative date, indicating how long ago this tweet was originally posted.
rebozo_client: Inserts hyperlinked text, indicating the Twitter client that was used to post this tweet.
-
options.loadingTemplateDefault: HTML
<div class="rebozo_loading"> Loading... </div>The template that Rebozo should display when making an initial request to Twitter's search API, before any results have been displayed. This option can be a string of HTML, or a jQuery selector for an in-page element that should, itself, be used.
-
options.emptyTemplateDefault: HTML
<div class="rebozo_empty"> No Results </div>The template that Rebozo should display when no results are available for the specified search text. This option can be a string of HTML, or a jQuery selector for an in-page element that should, itself, be used.
-
options.allResultsTemplateDefault: HTML
<div class="rebozo_show_all"> <a href="#">Show All Results on Twitter</a> </div>The template that Rebozo should display, below results, when there are more, older results available from Twitter. Rebozo will look within this template for any
<a>elements, and set theirhrefattributes to the appropriate URL on Twitter.com. This option can be a string of HTML, or a jQuery selector for an in-page element that should, itself, be used. -
options.updateTemplateDefault: HTML
<div class="rebozo_update"> <a href="#">New Results Available</a> </div>The template that Rebozo should display, above results, when there are new results available from Twitter. Rebozo will look within this template for any
<a>elements, and set theironclickattributes to the appropriate update action. Ifoptions.autoUpdateistrue, this template will never be displayed. This option can be a string of HTML, or a jQuery selector for an in-page element that should, itself, be used.
