sqlmap/javascripts/twitter.min.js
2013-07-01 11:09:34 +02:00

20 lines
4.9 KiB
JavaScript

/***
* Twitter JS v1.13.3
* http://code.google.com/p/twitterjs/
* Copyright (c) 2009 Remy Sharp / MIT License
* $Date$
*/
/*
MIT (MIT-LICENSE.txt)
*/
typeof renderTwitters!="function"&&function(){function v(a){var c;for(c in a.user)a["user_"+c]=a.user[c];a.time=s(a.created_at);return a}function w(a){t?a.call():u.push(a)}function q(){t=true;for(var a;a=u.shift();)a.call()}function x(){if(document.addEventListener&&!r.webkit)document.addEventListener("DOMContentLoaded",q,false);else if(r.msie){document.write("<script id=__ie_init defer=true src=//:><\/script>");var a=document.getElementById("__ie_init");if(a)a.onreadystatechange=function(){if(this.readyState==
"complete"){this.parentNode.removeChild(this);q.call()}};a=null}else if(r.webkit)var c=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(c);c=null;q.call()}},10)}function s(a){function c(d){var h=d.getHours();d=d.getMinutes()+"";var f="AM";if(h==0)h=12;else if(h==12)f="PM";else if(h>12){h-=12;f="PM"}if(d.length==1)d="0"+d;return h+":"+d+" "+f}function g(d){d.toDateString().split(/ /);var h=y[d.getMonth()],f=d.getDate()+"",i=parseInt(f);d=d.getFullYear();
var n=(new Date).getFullYear(),l="th";if(i%10==1&&f.substr(0,1)!="1")l="st";else if(i%10==2&&f.substr(0,1)!="1")l="nd";else if(i%10==3&&f.substr(0,1)!="1")l="rd";if(f.substr(0,1)=="0")f=f.substr(1);return h+" "+f+l+(n!=d?", "+d:"")}var b=a.split(" "),e=Date.parse(b[1]+" "+b[2]+", "+b[5]+" "+b[3]);b=new Date(e);var j=arguments.length>1?arguments[1]:new Date;e=parseInt((j.getTime()-e)/1E3);var m="";e+=j.getTimezoneOffset()*60;return m=e<5?"less than 5 seconds ago":e<30?"half a minute ago":e<60?"less than a minute ago":
e<120?"1 minute ago":e<2700?parseInt(e/60).toString()+" minutes ago":e<10800?"about 1 hour ago":e<86400?"about "+parseInt(e/3600).toString()+" hours ago":e<172800?c(b)+" yesterday":c(b)+" "+g(b)}var r=function(){var a=navigator.userAgent.toLowerCase();return{webkit:/(webkit|khtml)/.test(a),opera:/opera/.test(a),msie:/msie/.test(a)&&!/opera/.test(a),mozilla:/mozilla/.test(a)&&!/(compatible|webkit)/.test(a)}}(),o=0,u=[],t=false,y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
window.ify=function(){return{link:function(a){return a.replace(/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~%&\?#\/.=]+[^:\.,\)\s*$]/ig,function(c){return'<a href="'+c+'">'+(c.length>25?c.substr(0,24)+"...":c)+"</a>"})},at:function(a){return a.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15}(\/[a-zA-Z0-9-_]+)*)/g,function(c,g,b){return g+'@<a href="http://twitter.com/'+b+'">'+b+"</a>"})},hash:function(a){return a.replace(/(^|[^&\w'"]+)\#([a-zA-Z0-9_]+)/g,function(c,g,b){return g+'#<a href="http://search.twitter.com/search?q=%23'+
b+'">'+b+"</a>"})},clean:function(a){return this.hash(this.at(this.link(a)))}}}();window.renderTwitters=function(a,c){function g(k){return document.createElement(k)}function b(k){return document.createTextNode(k)}var e=document.getElementById(c.twitterTarget),j=null,m=g("ul"),d,h,f,i,n=a.length>c.count?c.count:a.length;for(i=0;i<n&&a[i];i++){j=v(a[i]);if(c.ignoreReplies&&a[i].text.substr(0,1)=="@")n++;else{d=g("li");if(c.template)d.innerHTML=c.template.replace(/%([a-z_\-\.]*)%/ig,function(k,p){k=
j[p]+""||"";if(p=="text"&&c.enableLinks)k=ify.clean(k);return k});else{h=g("span");h.className="twitterStatus";f=g("span");f.className="twitterTime";h.innerHTML=a[i].text;if(c.enableLinks==true)h.innerHTML=ify.clean(h.innerHTML);f.innerHTML=s(a[i].created_at);if(c.prefix){var l=g("span");l.className="twitterPrefix";l.innerHTML=c.prefix.replace(/%(.*?)%/g,function(k,p){return a[i].user[p]});d.appendChild(l);d.appendChild(b(" "))}d.appendChild(h);d.appendChild(b(" "));d.appendChild(f)}if(c.newwindow)d.innerHTML=
d.innerHTML.replace(/<a href/gi,'<a target="_blank" href');m.appendChild(d)}}if(c.clearContents)for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(m);typeof c.callback=="function"&&c.callback()};window.getTwitters=function(a,c,g,b){o++;if(typeof c=="object"){b=c;c=b.id;g=b.count}g||(g=1);if(b)b.count=g;else b={};if(!b.timeout&&typeof b.onTimeout=="function")b.timeout=10;if(typeof b.clearContents=="undefined")b.clearContents=true;if(b.withFriends)b.withFriends=false;b.twitterTarget=a;if(typeof b.enableLinks==
"undefined")b.enableLinks=true;window["twitterCallback"+o]=function(e){b.timeout&&clearTimeout(window["twitterTimeout"+o]);renderTwitters(e,b)};w(function(e,j){return function(){if(document.getElementById(e.twitterTarget)){var m="http://api.twitter.com/1.1/statuses/"+(e.withFriends?"friends_timeline":"user_timeline")+"/"+c+".json?callback=twitterCallback"+j+"&count=20&cb="+Math.random();if(e.timeout)window["twitterTimeout"+j]=setTimeout(function(){if(e.onTimeoutCancel)window["twitterCallback"+j]=function(){};
e.onTimeout.call(document.getElementById(e.twitterTarget))},e.timeout*1E3);var d=document.createElement("script");d.setAttribute("src",m);document.getElementsByTagName("head")[0].appendChild(d)}}}(b,o))};x()}();