Fixed small browser incompatibilities

This commit is contained in:
FrozenCow 2011-01-15 02:11:31 +01:00
parent b5deec79be
commit b22a48d5cb
2 changed files with 12 additions and 8 deletions

View File

@ -1,15 +1,15 @@
if (!console) console = { log: function() {} };
//if (!console) console = { log: function() {} };
function splitArgs(s) {
var r = s.split(' ');
delete arguments[0];
var obj = {};
var index = 0;
for(var argumentIndex in arguments) {
var argument = arguments[argumentIndex];
$.each(arguments, function(argumentIndex, argument) {
if (!argumentIndex) return;
var value = r[argumentIndex-1];
obj[argument] = value;
}
});
return obj;
}
@ -272,17 +272,21 @@ DynMap.prototype = {
};
if (mi.type == 'player') {
contentfun = function(div, mi) {
var playerImage;
$(div)
.addClass('Marker')
.addClass('playerMarker')
.append(playerImage = $('<img/>')
.attr({ src: 'player.png' }))
.append($('<span/>')
.addClass('playerName')
.text(mi.text));
.text(mi.text))
getMinecraftHead(mi.text, 32, function(head) {
$(head)
.addClass('playerIcon')
.prependTo(div);
playerImage.remove();
});
};
}

View File

@ -51,9 +51,9 @@ function getMinecraftHead(player,size,completed) {
// Asynchronous
if (!head) {
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) {
console.log('Created head for ',player,': ', head);
//console.log('Created head for ',player,': ', head);
hooks = playerHeads[player].hooks;
playerHeads[player] = head;
var i;
@ -62,7 +62,7 @@ function getMinecraftHead(player,size,completed) {
}
});
} 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};
} else {
completed(resizeImage(head,size));