45 var hours = Math.abs(parseInt( secs / 3600 ) % 24); |
45 var hours = Math.abs(parseInt( secs / 3600 ) % 24); |
46 var minutes = Math.abs(parseInt( secs / 60 ) % 60); |
46 var minutes = Math.abs(parseInt( secs / 60 ) % 60); |
47 var seconds = parseFloat(Math.abs(secs % 60).toFixed(0)); |
47 var seconds = parseFloat(Math.abs(secs % 60).toFixed(0)); |
48 |
48 |
49 return {"hours" : hours, "minutes" : minutes, "seconds" : seconds}; |
49 return {"hours" : hours, "minutes" : minutes, "seconds" : seconds}; |
50 } |
50 }; |
|
51 |
|
52 /* format a tweet - replaces @name by a link to the profile, #hashtag, etc. */ |
|
53 IriSP.formatTweet = function(tweet) { |
|
54 var rNickname = /@(\w+)/; // matches a @handle |
|
55 var rHashtag = /#(\w+)/; // matches a hashtag |
|
56 var i1 = tweet.replace(rNickname, "<a href='http://twitter.com/$1'>@$1</a>"); |
|
57 var i2 = i1.replace(rHashtag, "<a href='http://twitter.com/search?q=%23$1'>#$1</a>"); |
|
58 |
|
59 return i2; |
|
60 }; |
|
61 |
51 /* for ie compatibility |
62 /* for ie compatibility |
52 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
63 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
53 Object.defineProperty=function(obj,prop,desc) { |
64 Object.defineProperty=function(obj,prop,desc) { |
54 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
65 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
55 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |
66 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |