27 IriSP.timeToPourcent = function(time, timetotal){ |
27 IriSP.timeToPourcent = function(time, timetotal){ |
28 // return (parseInt(Math.round(time/timetotal*100))); |
28 // return (parseInt(Math.round(time/timetotal*100))); |
29 return Math.floor((time/timetotal) * 100); |
29 return Math.floor((time/timetotal) * 100); |
30 }; |
30 }; |
31 |
31 |
|
32 /* convert a number of seconds to a tuple of the form |
|
33 [hours, minutes, seconds] |
|
34 */ |
|
35 IriSP.secondsToTime = function(secs) { |
|
36 var hours = Math.abs(parseInt( secs / 3600 ) % 24); |
|
37 var minutes = Math.abs(parseInt( secs / 60 ) % 60); |
|
38 var seconds = Math.abs(secs % 60); |
|
39 |
|
40 return [hours, minutes, seconds]; |
|
41 } |
32 /* for ie compatibility |
42 /* for ie compatibility |
33 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
43 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
34 Object.defineProperty=function(obj,prop,desc) { |
44 Object.defineProperty=function(obj,prop,desc) { |
35 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
45 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
36 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |
46 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |