mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-30 22:24:06 +01:00
Fixed small browser incompatibilities
This commit is contained in:
parent
b5deec79be
commit
b22a48d5cb
14
web/map.js
14
web/map.js
@ -1,15 +1,15 @@
|
|||||||
if (!console) console = { log: function() {} };
|
//if (!console) console = { log: function() {} };
|
||||||
|
|
||||||
function splitArgs(s) {
|
function splitArgs(s) {
|
||||||
var r = s.split(' ');
|
var r = s.split(' ');
|
||||||
delete arguments[0];
|
delete arguments[0];
|
||||||
var obj = {};
|
var obj = {};
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for(var argumentIndex in arguments) {
|
$.each(arguments, function(argumentIndex, argument) {
|
||||||
var argument = arguments[argumentIndex];
|
if (!argumentIndex) return;
|
||||||
var value = r[argumentIndex-1];
|
var value = r[argumentIndex-1];
|
||||||
obj[argument] = value;
|
obj[argument] = value;
|
||||||
}
|
});
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,17 +272,21 @@ DynMap.prototype = {
|
|||||||
};
|
};
|
||||||
if (mi.type == 'player') {
|
if (mi.type == 'player') {
|
||||||
contentfun = function(div, mi) {
|
contentfun = function(div, mi) {
|
||||||
|
var playerImage;
|
||||||
$(div)
|
$(div)
|
||||||
.addClass('Marker')
|
.addClass('Marker')
|
||||||
.addClass('playerMarker')
|
.addClass('playerMarker')
|
||||||
|
.append(playerImage = $('<img/>')
|
||||||
|
.attr({ src: 'player.png' }))
|
||||||
.append($('<span/>')
|
.append($('<span/>')
|
||||||
.addClass('playerName')
|
.addClass('playerName')
|
||||||
.text(mi.text));
|
.text(mi.text))
|
||||||
|
|
||||||
getMinecraftHead(mi.text, 32, function(head) {
|
getMinecraftHead(mi.text, 32, function(head) {
|
||||||
$(head)
|
$(head)
|
||||||
.addClass('playerIcon')
|
.addClass('playerIcon')
|
||||||
.prependTo(div);
|
.prependTo(div);
|
||||||
|
playerImage.remove();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,9 @@ function getMinecraftHead(player,size,completed) {
|
|||||||
// Asynchronous
|
// Asynchronous
|
||||||
if (!head) {
|
if (!head) {
|
||||||
playerHeads[player] = { working: true, hooks: [{f:completed,s:size}] };
|
playerHeads[player] = { working: true, hooks: [{f:completed,s:size}] };
|
||||||
console.log('Creating head for ',player,'...');
|
//console.log('Creating head for ',player,'...');
|
||||||
createMinecraftHead(player, function(head) {
|
createMinecraftHead(player, function(head) {
|
||||||
console.log('Created head for ',player,': ', head);
|
//console.log('Created head for ',player,': ', head);
|
||||||
hooks = playerHeads[player].hooks;
|
hooks = playerHeads[player].hooks;
|
||||||
playerHeads[player] = head;
|
playerHeads[player] = head;
|
||||||
var i;
|
var i;
|
||||||
@ -62,7 +62,7 @@ function getMinecraftHead(player,size,completed) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (head.working) {
|
} else if (head.working) {
|
||||||
console.log('Other process working on head of ',player,', will add myself to hooks...');
|
//console.log('Other process working on head of ',player,', will add myself to hooks...');
|
||||||
head.hooks[head.hooks.length] = {f:completed,s:size};
|
head.hooks[head.hooks.length] = {f:completed,s:size};
|
||||||
} else {
|
} else {
|
||||||
completed(resizeImage(head,size));
|
completed(resizeImage(head,size));
|
||||||
|
Loading…
Reference in New Issue
Block a user