Cleanup Moved CSS and JS to matching folders
This commit is contained in:
parent
d4bc0863b8
commit
965686d44c
16 changed files with 13 additions and 13 deletions
|
|
@ -1,42 +0,0 @@
|
|||
function MinecraftDigitalClock(element) {
|
||||
this.create(element);
|
||||
}
|
||||
MinecraftDigitalClock.prototype = {
|
||||
element: null,
|
||||
timeout: null,
|
||||
time: null,
|
||||
create: function(element) {
|
||||
this.element = element;
|
||||
$(element).addClass('clock');
|
||||
},
|
||||
setTime: function(time) {
|
||||
if (this.timeout != null) {
|
||||
window.clearTimeout(this.timeout);
|
||||
this.timeout = null;
|
||||
}
|
||||
this.time = getMinecraftTime(time);
|
||||
this.element
|
||||
.addClass(this.time.day ? 'day' : 'night')
|
||||
.removeClass(this.time.night ? 'day' : 'night')
|
||||
.text(this.formatTime(this.time));
|
||||
|
||||
if (this.timeout == null) {
|
||||
var me = this;
|
||||
this.timeout = window.setTimeout(function() {
|
||||
me.timeout = null;
|
||||
me.setTime(me.time.servertime+(1000/60));
|
||||
}, 700);
|
||||
}
|
||||
},
|
||||
formatTime: function(time) {
|
||||
var formatDigits = function(n, digits) {
|
||||
var s = n.toString();
|
||||
while (s.length < digits) {
|
||||
s = '0' + s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
return formatDigits(time.hours, 2) + ':' + formatDigits(time.minutes, 2);
|
||||
}
|
||||
};
|
||||
clocks.digital = function(element) { return new MinecraftDigitalClock(element); };
|
||||
Loading…
Add table
Add a link
Reference in a new issue