| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

javascript

Page history last edited by Burt 13 years, 10 months ago

Javascript Widget

 

Once your Twitter feed is activated by emailing api (at) publitweet.com you can use the following code:

 

<script src="http://beta.publitweet.com/widgets/javascript.js"></script>
<script>
new Publitweet({
feed : 'nytimes/staff',
filters : {'keywords':'','blacklist':''},
title :  'Liste @nytimes/staff',
description : 'Latest tweets',
headerBackground : '#E7EFF8',
borderColor : '#323232',
width : 500,
height : 600        
}).show();    
</script>
        

Options

 

feed

the twitter feed to display (could be a single user 'nytimes' or a twitter list 'nytimes/staff')

filters

you can filter the tweets that will be displayed in the widget by specifying keywords and blacklisted words.

E.g. {'keywords':'iphone or ipad','blacklist':'microsoft'} => only tweets containing iPhone or iPad (case insensitive) and which do not contain the word Microsoft will be displayed

title
title of the widget (optional)
description
description of the widget (optional)
headerBackground
Color in HTML of the background of the header and footer of the widget
borderColor

Color in HTML of the borders of the widget (including tweets separator and tabs if displayed)

headerTextColor

Color in HTML of the header and footer text of the widget

width 

Width in pixels of the widget (can be 100% to match the widget container's size)
height

Height in pixels of the widget (can be 'auto' to automatically adjust height based on the tweets displayed, useful if you don't want to have a vertical scrollbar)

 

limit Integer between 1 and 200: number of tweets to display in the widget
language default: 'en', could be 'fr' to have the widget in French
tabs default: false, if true clicks on avatar and people's name will open the person's latest tweets in a tab within the widget. It is recommended to use this only if the widget fills the entire page (at least 450 pixels wide)
profilePage You can specify a different URL to open when a user clicks on someone's avatar or name. By default it will open that person's profile on Twitter.com (default value: 'http://twitter.com/' - $screen_name is automatically appended). This only works if the tabs argument is set to false.
morePage You may want to have a small version of the widget in your sidebar or on your homepage which displays a very limited number of tweets and offer the possibility to click to see more on another page where the Publitweet widget has more room. To do that just specify the URL of the page. The footer of the widget will show a link "More tweets".
signature default: '/via @publitweet'. The signature is appended to the tweets shared by the users only if the length of the original tweet plus the signature does not exceed 140 characters.
showUrlDescription If the widget is very small, you may want not to display the full description of attached links. To do that, just set the value of showUrlDescription to false.
showUrlMetadata
If this is set to false, then none of the shortened links in the widget will be expanded.

 

 

Performance

 

The Publitweet widget was designed for big publishers with millions of page requests. It is very efficient in terms of load.

 

For example, the javascript code is separated in two parts. One cached by the browser that never needs to be refreshed and another containing tweets that is continuously updated. The former is loaded with the page. As it is cached by the client it is not a problem for performance. The latter is loaded on demand when the widget starts loading so it doesn't penalize the loading time of your page. In fact, if the Publitweet widget never appears (for example if you put the widget at the bottom of your page and the user doesn't scroll down), it will never get loaded.

Comments (0)

You don't have permission to comment on this page.