kickoff - just something to look over for now
[tritium.git] / script / tritium4.min.js
blob17d9c5580c3d512d437b74aa734fc2259599b7b3
1 function json_request(b,e,d,a,c){new Ajax.Request("./?show="+b,{method:e,parameters:d,evalScripts:true,onSuccess:function(m){var q=m.responseText.evalJSON();var n='<ul class="comment-list">';for(i=0;i<q.length;++i){if(typeof q[i]["retweeted_status"]!="undefined"){var p="retweeted_status"}else{var p="user"}var k=q[i][p].screen_name;var o=q[i][p].profile_image_url;var j=relative_time(q[i].created_at);var h=q[i].id;var f=q[i][p].name;var g=parse_tweet(q[i].text);var l=q[i][p].id;n+='<li class="comment comment-parent" id="comment-'+h+'">';n+='<div class="comment-profile-wrapper left">';n+='<div class="comment-profile">';n+='<div class="comment-gravatar">';n+='<img src="'+o+'" height="30px" width="30px" alt="" />';n+="</div>";n+='<div class="comment-author">'+k+"</div>";n+="</div>";n+="</div>";n+='<div class="comment-content-wrapper right">';n+='<div class="comment-content-wrapper-2">';n+='<div class="comment-body">';n+='<div class="comment-arrow"></div>';n+='<div id="comment-'+h+'-date" class="post-date">';n+='<div class="left">wrote '+j+"</div>";n+='<div class="clearer">&nbsp;</div>';n+="</div>";n+='<div class="hr"></div>';n+='<div class="comment-text">';n+='<p id="comment-'+h+'-text">'+g+"</p>";n+="</div>";n+='<div class="clearer">&nbsp;</div>';n+="</div>";n+="</div>";n+="</div>";n+="</li>"}n+="</ul>";$(a).update(n)}})}var relative_time=function(r){var p=function(){var b=navigator.userAgent;return{ie:b.match(/MSIE\s([^;]*)/)}}();var q=new Date();var n=new Date(r);if(p.ie){n=Date.parse(r.replace(/( \+)/," UTC$1"))}var l=q-n;var k=1000,g=k*60,h=g*60,o=h*24,f=o*7,j=o*30,m=j*12;if(isNaN(l)||l<0){return""}if(l<k*7){return"just now"}if(l<g){return Math.floor(l/k)+" seconds ago"}if(l<g*2){return"about a minute ago"}if(l<h){return Math.floor(l/g)+" minutes ago"}if(l<h*2){return"about an hour ago"}if(l<o){return Math.floor(l/h)+" hours ago"}if(l>o&&l<o*2){return"yesterday"}if(l<f){return Math.floor(l/o)+" days ago"}if(l>f&&l<f*2){return"last week"}if(l>f&&l<j){return Math.floor(l/f)+" weeks ago"}if(l>j&&l<j*2){return"last month"}if(l>j){return Math.floor(l/j)+" months ago"}if(l>m&&l<m*2){return"last year"}if(l>m){return Math.floor(l/m)+" years ago"}};function parse_tweet(a){if(!a){return a}else{a=a.replace(/((https?\:\/\/)|(www\.))([^ ]+)/g,function(b){return'<a target="_blank" rel="nofollow" href="'+b+'">'+b.replace(/^www./i,"")+"</a>"});a=a.replace(/@([\w*]+)/g,function(b){return'<a target="_blank" rel="nofollow" href="http://twitter.com/'+b+'">'+b+"</a>"})+" ";a=a.replace(/#([\w*]+)/g,function(b){return'<a target="_blank" rel="nofollow" href="http://search.twitter.com/search?q='+b+'">'+b+"</a>"})+" ";return a}};