Created
June 23, 2014 19:49
-
-
Save goliatone/09cef5fd2262e0392c86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var D = { | |
digitize: function(obj) { | |
var data = []; | |
$.each(obj, function(i, value) { | |
value = value.toString(); | |
if (value.length == 1) { | |
value = '0' + value; | |
} | |
for (var x = 0; x < value.length; x++) { | |
data.push(value.charAt(x)); | |
} | |
}); | |
if (data.length > this.minimumDigits) { | |
this.minimumDigits = data.length; | |
} | |
if (this.minimumDigits > data.length) { | |
data.unshift('0'); | |
} | |
return data; | |
}, | |
getMinuteCounter: function() { | |
var obj = this.digitize([ | |
this.getMinutes(), | |
this.getSeconds(true) | |
]); | |
return obj; | |
}, | |
getSeconds: function(mod) { | |
var seconds = this.time; | |
if (mod) { | |
if (seconds == 60) { | |
seconds = 0; | |
} else { | |
seconds = seconds % 60; | |
} | |
} | |
return Math.ceil(seconds); | |
}, | |
getMinutes: function(mod) { | |
var minutes = this.time / 60; | |
if (mod) { | |
minutes = minutes % 60; | |
} | |
return Math.floor(minutes); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment