critical bugfix

- don't assume jquery is available when initially processing JS - setupIdle function added
- don't detect portals from a 'turret' entry - use 'portalV2' as the stock site does
- don't try to display the field MU counts when not in the data
This commit is contained in:
Jon Atkins 2013-08-27 21:29:54 +01:00
parent 92aab3f328
commit 39faef2c4c
3 changed files with 9 additions and 5 deletions

View File

@ -456,6 +456,7 @@ function boot() {
shadowSize: new L.Point(41, 41) shadowSize: new L.Point(41, 41)
}}); }});
window.setupIdle();
window.setupTaphold(); window.setupTaphold();
window.setupStyles(); window.setupStyles();
window.setupDialogs(); window.setupDialogs();

View File

@ -44,8 +44,11 @@ var idleMouseMove = function(e) {
} }
} }
$('body').keypress(idleReset); window.setupIdle = function() {
$('body').mousemove(idleMouseMove); $('body').keypress(idleReset);
$('body').mousemove(idleMouseMove);
}
window.isIdle = function() { window.isIdle = function() {
return window.idleTime >= window._idleTimeLimit; return window.idleTime >= window._idleTimeLimit;

View File

@ -343,7 +343,7 @@ window.handleDataResponse = function(data, fromCache, tile_ids) {
if(ent[0] in window._deletedEntityGuid) return true; if(ent[0] in window._deletedEntityGuid) return true;
if(ent[2].turret !== undefined) { if(ent[2].portalV2 !== undefined) {
// TODO? remove any linkedEdges or linkedFields that have entries in window._deletedEntityGuid // TODO? remove any linkedEdges or linkedFields that have entries in window._deletedEntityGuid
var latlng = [ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6]; var latlng = [ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6];
@ -374,7 +374,7 @@ window.handleDataResponse = function(data, fromCache, tile_ids) {
}); });
renderField(ent); renderField(ent);
} else { } else {
throw('Unknown entity: ' + JSON.stringify(ent)); console.warn('Unknown entity: ' + JSON.stringify(ent));
} }
}); });
}); });
@ -906,7 +906,7 @@ window.renderField = function(ent) {
} }
// put both in one group, so they can be handled by the same logic. // put both in one group, so they can be handled by the same logic.
if (areaZoomRatio > FIELD_MU_DISPLAY_AREA_ZOOM_RATIO && countForMUDisplay > 2) { if ('entityScore' in ent[2] && areaZoomRatio > FIELD_MU_DISPLAY_AREA_ZOOM_RATIO && countForMUDisplay > 2) {
// centroid of field for placing MU count at // centroid of field for placing MU count at
var centroid = [ var centroid = [
(latlngs[0].lat + latlngs[1].lat + latlngs[2].lat)/3, (latlngs[0].lat + latlngs[1].lat + latlngs[2].lat)/3,