First, the widget code:
Basic Widget
This widget will return the 50 most recent tweets with the word "gustav" occuring in them.Insert the following code into your HTML.
<div id=gw_div> <script src="http://jazzychad.com/twitter/gustav/guswidget.js" type="text/javascript"></script> </div>Requirements:
You must give the div an id, in this case it is gw_div (short for "gustav widget div").
Options:
The following are options you can pass to guswidget.js.
type
The following types are allowed:
- all - displays all tweets with the word "gustav" in them. This is the default is no type is specified
- links - display all tweets with the word "gustav" and a link to a website in them.
- tag - display all tweets with the hashtag "#gustav" in them.
- news - display all tweets with the word "gustav" coming from major news agencies with twitter accounts
<div id=gw_div> <script src="http://jazzychad.com/twitter/gustav/guswidget.js?type=links" type="text/javascript"></script> </div>
rpp
This determines the number of tweets to display in the widget. You can specifiy any number from 1 to 100. The default is 50 if left unspecified.
Example:
<div id=gw_div> <script src="http://jazzychad.com/twitter/gustav/guswidget.js?rpp=25" type="text/javascript"></script> </div>
divname
This specifies the id of the div in which the tweets will appear. This is useful for having multiple widgets on one page. Each widget must have a different divname. The default divname is "gw_div" if left unspecified.
Example:
<div id=gus_widget_2> <script src="http://jazzychad.com/twitter/gustav/guswidget.js?divname=gus_widget_2" type="text/javascript"></script> </div>
Combining options: You can combine options, as in the following example:
<div id=gus_hashtag> <script src="http://jazzychad.com/twitter/gustav/guswidget.js?type=tag&rpp=30&divname=gus_hashtag"
type="text/javascript"></script> </div>
CSS Styling
There are 3 id's that can be styled in the widget:
gw_div (or a the id specified by divname)
This is the containing div id for the widget. You control the size of the widget by setting the size attributes for this div id. It is highly recommended that you set overflow: auto; for this id so that the tweets will scroll within the widget.
gw_results
This is the containing div id for all of the tweets.
gw_tweet
This is the containing div id for each individual tweet.
This is a minimum set of CSS styling for these 3 id's to give you a basic widget:
#gw_tweet {
}
#gw_results {
margin: 0px;
padding: 0px;
}
#gw_div{
border: 1px solid #000;
width: 300px;
height: 400px;
overflow: auto;
padding: 10px;
}
Misc
You can put text/html inside of the widget to appear before and after all of the tweets, but the tweets will appear precisely where you put the <script> tag.Exmaple:
<div id=gw_div> Text to appear inside the widget, but before the tweets goes here... like a title or something. <script src="http://jazzychad.com/twitter/gustav/guswidget.js" type="text/javascript"></script> Text to appear inside the widget, but after the tweets goes here... like a link, or footer, or something </div>