src/js/utils.js
branchpopcorn-port
changeset 308 495ef0f3e483
parent 297 ed4a459c9290
child 354 002c314cabbf
--- a/src/js/utils.js	Wed Nov 23 11:49:02 2011 +0100
+++ b/src/js/utils.js	Wed Nov 23 12:23:47 2011 +0100
@@ -46,9 +46,19 @@
   var minutes = Math.abs(parseInt( secs / 60 ) % 60);
   var seconds = parseFloat(Math.abs(secs % 60).toFixed(0));
   
-  return {"hours" : hours, "minutes" : minutes, "seconds" : seconds};
+  var toString_fn = function() {
+    var ret = "";
+    if (hours > 0)
+       ret = IriSP.padWithZeros(this.hours) + ":";
+    ret += IriSP.padWithZeros(this.minutes) + ":" + IriSP.padWithZeros(this.seconds);
+
+    return ret;
+  }
+  return {"hours" : hours, "minutes" : minutes, "seconds" : seconds, toString: toString_fn};
 };
 
+IriSP.secondsToString
+
 /* format a tweet - replaces @name by a link to the profile, #hashtag, etc. */
 IriSP.formatTweet = function(tweet) {
   var rNickname = /@(\w+)/gi; // matches a @handle
@@ -69,4 +79,4 @@
       if ("set" in desc) obj.__defineSetter__(prop,desc.set);
    }
 }
-*/
\ No newline at end of file
+*/