* Table or not is now autodetected, removed data-tooltip attributes * Empty table cells are now possible * Removed duplicated \t's on some titles * Some tooltip code cleanup
22 lines
872 B
JavaScript
22 lines
872 B
JavaScript
|
|
// GAME STATUS ///////////////////////////////////////////////////////
|
|
// MindUnit display
|
|
window.updateGameScore = function(data) {
|
|
if(!data) {
|
|
window.postAjax('getGameScore', {}, window.updateGameScore);
|
|
return;
|
|
}
|
|
|
|
var r = parseInt(data.result.resistanceScore), e = parseInt(data.result.alienScore);
|
|
var s = r+e;
|
|
var rp = r/s*100, ep = e/s*100;
|
|
r = digits(r), e = digits(e);
|
|
var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'% </span>';
|
|
var es = '<span class="enl" style="width:'+ep+'%;"> '+Math.round(ep)+'%</span>';
|
|
$('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() });
|
|
// help cursor via “#gamestat span”
|
|
$('#gamestat').attr('title', 'Resistance:\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits');
|
|
|
|
window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000);
|
|
}
|