forked from lopezs/ableplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.js
More file actions
34 lines (31 loc) · 850 Bytes
/
misc.js
File metadata and controls
34 lines (31 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function ($) {
AblePlayer.prototype.countProperties = function(obj) {
// returns the number of properties in an object
var count, prop;
count = 0;
for (prop in obj) {
if (obj.hasOwnProperty(prop)) {
++count;
}
}
return count;
};
// Takes seconds and converts to string of form hh:mm:ss
AblePlayer.prototype.formatSecondsAsColonTime = function (seconds) {
var dHours = Math.floor(seconds / 3600);
var dMinutes = Math.floor(seconds / 60) % 60;
var dSeconds = Math.floor(seconds % 60);
if (dSeconds < 10) {
dSeconds = '0' + dSeconds;
}
if (dHours > 0) {
if (dMinutes < 10) {
dMinutes = '0' + dMinutes;
}
return dHours + ':' + dMinutes + ':' + dSeconds;
}
else {
return dMinutes + ':' + dSeconds;
}
};
})(jQuery);