Added compass and TimeOfDay
This commit is contained in:
parent
b729f28df4
commit
7241b2be81
11 changed files with 95 additions and 6 deletions
54
web/map.js
54
web/map.js
|
|
@ -69,6 +69,44 @@ MinecraftClock.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
function MinecraftTimeOfDay(element) { this.element = element; }
|
||||
MinecraftTimeOfDay.prototype = {
|
||||
element: null,
|
||||
create: function(element) {
|
||||
if (!element) element = $('<div/>');
|
||||
this.element = element;
|
||||
return element;
|
||||
},
|
||||
setTime: function(time) {
|
||||
this.element
|
||||
.removeClass('time1')
|
||||
.removeClass('time2')
|
||||
.removeClass('time3')
|
||||
.removeClass('time4')
|
||||
.removeClass('time5')
|
||||
.removeClass('time6')
|
||||
.removeClass('time7')
|
||||
.removeClass('time8')
|
||||
.addClass('time' + time.day)
|
||||
.html(" ‏ ")
|
||||
.height(60);
|
||||
}
|
||||
};
|
||||
|
||||
function MinecraftCompass(element) { this.element = element; }
|
||||
MinecraftCompass.prototype = {
|
||||
element: null,
|
||||
create: function(element) {
|
||||
if (!element) element = $('<div/>');
|
||||
this.element = element;
|
||||
return element;
|
||||
},
|
||||
initialize: function() {
|
||||
this.element.html(" ‏ ");
|
||||
this.element.height(120);
|
||||
}
|
||||
};
|
||||
|
||||
function DynMap(options) {
|
||||
var me = this;
|
||||
me.options = options;
|
||||
|
|
@ -217,6 +255,21 @@ DynMap.prototype = {
|
|||
.appendTo(sidebar)
|
||||
);
|
||||
|
||||
// The TimeOfDay
|
||||
var timeofday = me.timeofday = new MinecraftTimeOfDay(
|
||||
$('<div/>')
|
||||
.addClass('timeofday')
|
||||
.appendTo(sidebar)
|
||||
);
|
||||
|
||||
// The Compass
|
||||
var compass = me.compass = new MinecraftCompass(
|
||||
$('<div/>')
|
||||
.addClass('compass')
|
||||
.appendTo(sidebar)
|
||||
);
|
||||
compass.initialize();
|
||||
|
||||
// TODO: Enable hash-links.
|
||||
/*
|
||||
var link;
|
||||
|
|
@ -243,6 +296,7 @@ DynMap.prototype = {
|
|||
|
||||
me.lasttimestamp = update.timestamp;
|
||||
me.clock.setTime(getMinecraftTime(update.servertime));
|
||||
me.timeofday.setTime(me.clock.time);
|
||||
|
||||
var typeVisibleMap = {};
|
||||
var newmarkers = {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue