/*
* Twitter Application
*/
Application = {};
Application.Tweets = {
init: function () {
var a = {
q: "#envato",
rpp: 10
};
jQuery("#lasttweet #status").append("
Loading tweets for #envato...").find(".loading").remove()
jQuery.get("http://search.twitter.com/search.json", a, function (c) {
if (c.results.length > 0) {
var b = "";
jQuery("#lasttweet #status").remove();
jQuery.each(c.results, function (d, e) {
e.from_user = e.from_user.replace(/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return ''+url+'';
});
// if (e.text.length > 150) {
e.text = e.text.substring(0,100) + '...';
// }
e.text = e.text.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return ''+url+'';
}).
replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+''+reply.substring(1)+'';
});
b += "@" + e.from_user + " → " + e.text + "
"
});
jQuery("#lasttweet .page-inner").append(b).find(".loading").remove();
jQuery("#lasttweet .page-inner").cycle({
fx: "scrollUp",
easing: "easeInOutCirc",
prev: '.twitter-prev',
next: '.twitter-next'
})
} else {
jQuery("#lasttweet .page-inner").append("No tweets for #envato account found.").find(".loading").remove()
}
}, "jsonp")
}
};