mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-09-29 14:17:26 +02:00
Simplified component-creation, dropping IE8 compatibility.
This commit is contained in:
parent
6eface57ae
commit
6622db1b2c
@ -7,9 +7,7 @@ $.ajax({
|
||||
});
|
||||
|
||||
componentconstructors['chat'] = function(dynmap, configuration) {
|
||||
return {
|
||||
dynmap: dynmap,
|
||||
initialize: function() {
|
||||
var me = this;
|
||||
// Provides 'chat'-events by monitoring the world-updates.
|
||||
$(dynmap).bind('worldupdate', function(event, update) {
|
||||
swtch(update.type, {
|
||||
@ -40,6 +38,4 @@ componentconstructors['chat'] = function(dynmap, configuration) {
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,10 +1,6 @@
|
||||
componentconstructors['chatballoon'] = function(dynmap, configuration) {
|
||||
return {
|
||||
dynmap: dynmap,
|
||||
options: configuration,
|
||||
chatpopups: {},
|
||||
initialize: function() {
|
||||
var me = this;
|
||||
me.chatpopups = {};
|
||||
$(dynmap).bind('chat', function(event, message) {
|
||||
if (message.source != 'player') {
|
||||
return;
|
||||
@ -48,6 +44,4 @@ componentconstructors['chatballoon'] = function(dynmap, configuration) {
|
||||
delete me.chatpopups[message.name];
|
||||
}, 8000);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
@ -1,7 +1,5 @@
|
||||
componentconstructors['chatbox'] = function(dynmap, configuration) {
|
||||
return {
|
||||
dynmap: dynmap,
|
||||
initialize: function() {
|
||||
var me = this;
|
||||
var chat = $('<div/>')
|
||||
.addClass('chat')
|
||||
.appendTo(dynmap.options.container);
|
||||
@ -69,6 +67,4 @@ componentconstructors['chatbox'] = function(dynmap, configuration) {
|
||||
//var scrollHeight = jQuery(me.messagelist).attr('scrollHeight');
|
||||
messagelist.scrollTop(messagelist.scrollHeight());
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
@ -280,10 +280,8 @@ DynMap.prototype = {
|
||||
me.selectMap(me.defaultworld.defaultmap);
|
||||
|
||||
$.each(me.options.components, function(index, configuration) {
|
||||
me.components.push(componentconstructors[configuration.type](me, configuration));
|
||||
});
|
||||
$.each(me.components, function(index, component) {
|
||||
component.initialize();
|
||||
var componentconstructor = componentconstructors[configuration.type];
|
||||
me.components.push(new componentconstructor(me, configuration));
|
||||
});
|
||||
|
||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||
|
@ -1,6 +1,5 @@
|
||||
componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
||||
return {
|
||||
initialize: function() {
|
||||
var me = this;
|
||||
$(dynmap).bind('playeradded', function(event, player) {
|
||||
// Create the player-marker.
|
||||
var markerPosition = dynmap.map.getProjection().fromWorldToLatLng(player.location.x, player.location.y, player.location.z);
|
||||
@ -35,6 +34,4 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
||||
player.marker.toggle(dynmap.world === player.location.world);
|
||||
player.marker.setPosition(markerPosition);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user