(function($) { /* Modified version to trigger a caallback function when done loading https://github.com/ahmednuaman/tweet/commit/af9a64f1e0bda03e2847ddac8a4bb38f859d395c */ $.fn.tweet = function(o){ var s = $.extend({ username: ["seaofclouds"], // [string] required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"] list: null, // [string] optional name of list belonging to username favorites: false, // [boolean] display the user's favorites instead of his tweets avatar_size: null, // [integer] height and width of avatar if displayed (48px max) count: 3, // [integer] how many tweets to display? fetch: null, // [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option) intro_text: null, // [string] do you want text BEFORE your your tweets? outro_text: null, // [string] do you want text AFTER your tweets? join_text: null, // [string] optional text in between date and tweet, try setting to "auto" auto_join_text_default: "i said,", // [string] auto text for non verb: "i said" bullocks auto_join_text_ed: "i", // [string] auto text for past tense: "i" surfed auto_join_text_ing: "i am", // [string] auto tense for present tense: "i was" surfing auto_join_text_reply: "i replied to", // [string] auto tense for replies: "i replied to" @someone "with" auto_join_text_url: "i was looking at", // [string] auto tense for urls: "i was looking at" http:... loading_text: null, // [string] optional loading text, displayed while tweets load query: null, // [string] optional search query callback: null, // [function] optional callback fired when the data has loaded refresh_interval: null , // [integer] optional number of seconds after which to reload tweets twitter_url: "twitter.com", // [string] custom twitter url, if any (apigee, etc.) twitter_api_url: "api.twitter.com", // [string] custom twitter api url, if any (apigee, etc.) twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.) template: function(info) { // [function] template used to construct each tweet
'+s.intro_text+'
'; var outro = ''+s.outro_text+'
'; var loading = $(''+s.loading_text+'
'); if(typeof(s.username) == "string"){ s.username = [s.username]; } if (s.loading_text) $(widget).append(loading); $(widget).bind("load", function(){ $.getJSON(build_url(), function(data){ if (s.loading_text) loading.remove(); if (s.intro_text) list.before(intro); list.empty(); var tweets = $.map(data.results || data, function(item){ var join_text = s.join_text; // auto join text based on verb tense and content if (s.join_text == "auto") { if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) { join_text = s.auto_join_text_reply; } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) { join_text = s.auto_join_text_url; } else if (item.text.match(/^((\w+ed)|just) .*/im)) { join_text = s.auto_join_text_ed; } else if (item.text.match(/^(\w*ing) .*/i)) { join_text = s.auto_join_text_ing; } else { join_text = s.auto_join_text_default; } } // Basic building blocks for constructing tweet