A very simple twitter search widget can be installed on your website by copying and pasting the following code into your site:
<script src="http://tweetgrid.com/widget/widget.js" type="text/javascript"></script>
<script language="javascript"> /* widget config */ var jtw_search = 'keyword'; /* keywords or phrase to send to search.twitter.com and display */ </script> <script src="http://tweetgrid.com/widget/widget.js" type="text/javascript"></script>
Advanced examples can be found by clicking here.
<script language="javascript"> /* widget config */ var jtw_divname = ''; /* unique id of the widget */ var jtw_search = ''; /* keywords or phrase to send to search.twitter.com and display */ var jtw_width = ''; /* width of widget in px, %, or auto */ var jtw_height = ''; /* height of widget in px, %, or auto */ var jtw_scroll = ''; /* add scroll bar to widget, 'yes' or 'no' */ var jtw_widget_background = ''; /* background style of whole widget */ var jtw_widget_border = ''; /* border style of whole widget */ var jtw_center_widget = ''; /* center widget horizontally in container if 'yes' */ /* tweet styling */ var jtw_tweet_textcolor = ''; /* text color of the tweets */ var jtw_tweet_linkcolor = ''; /* link color of the tweets */ var jtw_tweet_background = ''; /* background style of the tweets */ var jtw_tweet_newbackground = ''; /* background style of new tweets */ var jtw_tweet_border = ''; /* border style of the tweets */ var jtw_tweet_margin = ''; /* marin in px for each tweet */ var jtw_tweet_fontsize = ''; /* fontsize in px or em of each tweet */ var jtw_big_img = ''; /* display big avatar instead of small avatar */ var jtw_hide_img = ''; /* do not display twitter avatar if 'yes' */ /* display config */ var jtw_pre_html = ''; /* html code to display at the top of widget */ var jtw_post_html = ''; /* html code to display at the bottom of widget */ var jtw_mid_html = ''; /* html code to display inbetween each tweet */ var jtw_widget_style_misc = ''; /* misc css style for the widget */ var jtw_results_style_misc = ''; /* misc css style for the results */ var jtw_tweet_style_misc = ''; /* misc css style for each tweet */ var jtw_num_tweets = ''; /* number of tweets to display in widget (up to 100) */ var jtw_tweet_lang = ''; /* language of tweets to display (2 letter country code) */ var jtw_widget_refresh_interval= ''; /* the frequency (in seconds) to look for new tweets*/ </script> <script src="http://tweetgrid.com/widget/widget.js" type="text/javascript"></script>
jtw_divname
Unique identifier used to name the widget.
Default Value: If left unspecified, the default value is jtw_widget
Valid Values: Any combination of letters, numbers, and underscore. Must begin with a letter or underscore.
Examples:
- var jtw_divname = 'twidget';
- var jtw_divname = 'twidget2';
- var jtw_divname = '_my_search_widget_45';
jtw_search
Default Value: If left unspecified, the default value is twitter
Valid Values: Any valid search phrase accepted at http://search.twitter.com/
Examples:
- var jtw_search = 'google awesome';
- var jtw_search = 'google -chrome';
- var jtw_search = 'from:jazzychad';
- var jtw_search = 'to:jazzychad';
- var jtw_search = '"this exact phrase" OR "that exact phrase"';
jtw_width
Sets the width of the widget
Default Value: If left unspecified, the default value is 300px
Valid Values: A number of pixels, a percentage, or 'auto' to fill the container
Examples:
- var jtw_width = '250px';
- var jtw_width = '60%';
- var jtw_width = 'auto';
jtw_height
Sets the height of the widget
Default Value: If left unspecified, the default value is 400px
Valid Values: A number of pixels, a percentage, or 'auto' to fill the container
Examples:
- var jtw_height = '500px';
- var jtw_height = '75%';
- var jtw_height = 'auto';
jtw_scroll
Determins if the widget has a scrollbar for viewing the tweets
Default Value: If left unspecified, the default value is yes
Valid Values: 'yes' or 'no'
Examples:
- var jtw_scroll = 'yes';
- var jtw_scroll = 'no';
jtw_widget_background
Sets the background property for the widget
Default Value: If left unspecified, the default value is #fff
Valid Values: Any valid CSS background property value
Examples:
- var jtw_widget_background = '#3399ff';
- var jtw_widget_background = 'url(/img/bg_image.png) repeat-x #aaa';
jtw_widget_border
Sets the border property for the widget
Default Value: If left unspecified, the default value is 1px solid #aaa
Valid Values: Any valid CSS border property value
Examples:
- var jtw_widget_border = '1px solid #000';
- var jtw_widget_border = '3px dashed #39f';
- var jtw_widget_border = '0px';
jtw_center_widget
Setting to center the widget in its container
Default Value: If left unspecified, the default value is no
Valid Values: 'yes' or 'no'
Examples:
- var jtw_center_wdiget = 'yes';
- var jtw_center_wdiget = 'no';
jtw_tweet_textcolor
Set the text color for the tweets
Default Value: If left unspecified, the default value is #000
Valid Values: Any valid CSS color value
Examples:
- var jtw_tweet_textcolor = '#39f';
- var jtw_tweet_textcolor = 'rgb(0, 255, 0)';
jtw_tweet_linkcolor
Set the link color for the tweets
Default Value: If left unspecified, the default value is #00f
Valid Values: Any valid CSS color value
Examples:
- var jtw_tweet_linkcolor = '#fff';
- var jtw_tweet_linktcolor = 'rgb(0, 255, 0)';
jtw_tweet_background
Sets the background property for each tweet
Default Value: If left unspecified, the default value is #f8f8f8
Valid Values: Any valid CSS background value
Examples:
- var jtw_tweet_background = '#edeb91';
- var jtw_tweet_background = 'url(/img/silver_grad.png) repeat-x #fff';
jtw_tweet_newbackground
Sets the background property for new incoming tweets
Default Value: If left unspecified, the default value is the value of jtw_tweet_background
Valid Values: Any valid CSS background value
Examples:
- var jtw_tweet_newbackground = '#faeb91';
- var jtw_tweet_newbackground = 'url(/img/blue_grad.png) repeat-x #fff';
jtw_tweet_border
Sets the border property for each tweet
Default Value: If left unspecified, the default value is 1px solid #aaa
Valid Values: Any valid CSS border value
Examples:
- var jtw_tweet_border = '1px solid #000';
- var jtw_tweet_border = '3px dashed #39f';
- var jtw_tweet_border = '0px';
jtw_tweet_margin
Set the distance from the edge of the widget the tweets should appear
Default Value: If left unspecified, the default value is 1px
Valid Values: Any number of pixels, or set of pixels
Examples:
- var jtw_tweet_margin = '10px';
- var jtw_tweet_margin = '0px 20px 0px 20px';
jtw_tweet_fontsize
Sets the fontsize for each tweet
Default Value: If left unspecified, the default value is 14px
Valid Values: Any valid CSS font-size value
Examples:
- var jtw_tweet_fontsize = '12px';
- var jtw_tweet_fontsize = '2em';
jtw_big_img
Display a big avatar instead of a small avatar
Default Value: If left unspecified, the default value is no
Valid Values: 'yes' or 'no'
Examples:
- var jtw_big_img = 'yes';
- var jtw_big_img = 'no';
jtw_hide_img
Setting to hide the twitter avatar images in each tweet
Default Value: If left unspecified, the default value is no
Valid Values: 'yes' or 'no'
Examples:
- var jtw_hide_img = 'yes';
- var jtw_hide_img = 'no';
jtw_pre_html
HTML to display in the widget before displaying the tweets
Default Value: If left unspecified, the default value is <center><b>Twitter Search Widget</b></center>
Valid Values: Any HTML
Examples:
- var jtw_pre_html = '<h1>Cool Twitter Widget</h1>';
- var jtw_pre_html = '<img src="/img/widget_top.gif">';
- var jtw_pre_html = ' ';
jtw_post_html
HTML to display in the widget after displaying the tweets
Default Value: If left unspecified, the default value is nothing
Valid Values: Any HTML
Examples:
- var jtw_post_html = '<i>The End!</i>';
- var jtw_post_html = '<img src="/img/widget_bottom.gif">';
jtw_mid_html
HTML display between each tweet
Default Value: If left unspecified, the default value is nothing
Valid Values: Any HTML
Examples:
- var jtw_mid_html = 'and then someone said...';
- var jtw_mid_html = '<hr>';
- var jtw_mid_html = '<img src="/img/widget_middle.gif">';
jtw_widget_style_misc
Misc CSS Style properties to assign to the widget
Default Value: If left unspecified, the default value is nothing
Valid Values: Any valid CSS style attributes/properties
Examples:
- var jtw_widget_style_misc = 'font-family: verdana, arial, sans;';
jtw_results_style_misc
Misc CSS Style properties to assign to the part of the widget containing all of the tweets
Default Value: If left unspecified, the default value is nothing
Valid Values: Any valid CSS style attributes/properties
Examples:
- var jtw_results_style_misc = 'text-decoration: none;';
jtw_tweet_style_misc
Misc CSS Style properties to assign to the individual tweets
Default Value: If left unspecified, the default value is nothing
Valid Values: Any valid CSS style attributes/properties
Examples:
- var jtw_tweet_style_misc = 'padding-top: 20px; min-height: 35px;';
jtw_num_tweets
The number of tweets to display in the widget
Default Value: If left unspecified, the default value is 20
Valid Values: Any number between 1 and 100
Examples:
- var jtw_num_tweets = '5';
- var jtw_num_tweets = '73';
jtw_tweet_lang
Language of tweets to display
Default Value: If left unspecified, the default value is all languages
Valid Values: Any ISO_639-1 two-letter language code
Examples:
- var jtw_tweet_lang = 'en';
- var jtw_tweet_lang = 'de';
jtw_widget_refresh_interval
Frequency (in seconds) to look for new tweets
Default Value: If left unspecified, the default value is 10
Valid Values: Any non-negative integer (0, 1, 2, 3, ...)
Examples:
- var jtw_widget_refresh_interval = '10';
- var jtw_widget_refresh_interval = '30';
- var jtw_widget_refresh_interval = '0';