From a150d54dd76430f51274f4927b1a7ef0dfc75a3f Mon Sep 17 00:00:00 2001 From: hastarin Date: Sun, 12 May 2013 14:14:58 +1000 Subject: [PATCH] Smaller status bar to suit mobile and further tweaked scale bar position for small mobile displays. --- code/boot.js | 11 ++++------- code/request_handling.js | 38 ++++++++++++++++++++------------------ plugins/scale-bar.user.js | 2 +- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/code/boot.js b/code/boot.js index d38a30b2..4aba2da4 100644 --- a/code/boot.js +++ b/code/boot.js @@ -232,13 +232,10 @@ window.setupMap = function() { localStorage['ingress.intelmap.type']=selInd; }); - // map update status handling - map.on('movestart zoomstart', function() { window.mapRunsUserAction = true }); - map.on('moveend zoomend', function() { window.mapRunsUserAction = false }); - - // update map hooks - map.on('movestart zoomstart', function() { window.requests.abort(); window.startRefreshTimeout(-1); }); - map.on('moveend zoomend', function() { window.startRefreshTimeout(ON_MOVE_REFRESH*1000) }); + // map update status handling & update map hooks + // ensures order of calls + map.on('movestart zoomstart', function() { window.mapRunsUserAction = true; window.requests.abort(); window.startRefreshTimeout(-1); }); + map.on('moveend zoomend', function() { window.mapRunsUserAction = false; window.startRefreshTimeout(ON_MOVE_REFRESH*1000); }); window.addResumeFunction(window.requestData); window.requests.addRefreshFunction(window.requestData); diff --git a/code/request_handling.js b/code/request_handling.js index 8b6c3ce7..37e11bad 100644 --- a/code/request_handling.js +++ b/code/request_handling.js @@ -39,17 +39,24 @@ window.requests.abort = function() { // to website. Updates info in layer chooser. window.renderUpdateStatus = function() { - var t = 'map status: '; - if(mapRunsUserAction) - t += 'paused during interaction'; - else if(isIdle()) - t += 'Idle, not updating.'; - else if(window.activeRequests.length > 0) - t += window.activeRequests.length + ' requests running.'; - else if(window.requests._quickRefreshPending) - t += 'refreshing...'; + var t = '
portals: '; + var minlvl = getMinPortalLevel(); + if(minlvl === 0) + t += 'all'; else - t += 'Up to date. '; + t+= 'L'+minlvl+'+'; + + t += ' map: '; + if(mapRunsUserAction) + t += 'paused'; + else if(isIdle()) + t += 'Idle'; + else if(window.activeRequests.length > 0) + t += window.activeRequests.length + ' updates'; + else if(window.requests._quickRefreshPending) + t += 'refreshing'; + else + t += 'Up to date'; if(renderLimitReached()) t += ' RENDER LIMIT ' @@ -57,20 +64,15 @@ window.renderUpdateStatus = function() { if(window.failedRequestCount > 0) t += ' ' + window.failedRequestCount + ' failed.' - t += '
('; - var minlvl = getMinPortalLevel(); - if(minlvl === 0) - t += 'loading all portals'; - else - t+= 'only loading portals with level '+minlvl+' and up'; - t += ')'; - + t += '
'; var portalSelection = $('.leaflet-control-layers-overlays label'); portalSelection.slice(0, minlvl+1).addClass('disabled').attr('title', 'Zoom in to show those.'); portalSelection.slice(minlvl, 8).removeClass('disabled').attr('title', ''); $('#updatestatus').html(t); + //$('#updatestatus').click(function() { startRefreshTimeout(10); }); + //. '; } diff --git a/plugins/scale-bar.user.js b/plugins/scale-bar.user.js index 6ab71f98..e1667f87 100644 --- a/plugins/scale-bar.user.js +++ b/plugins/scale-bar.user.js @@ -28,7 +28,7 @@ window.plugin.scaleBar.setup = function() { // are worse than Internet Explorer 6 whirring fans combined. Upgrade to the metric // system already. if (window.isSmartphone()) { - $('head').append(''); + $('head').append(''); window.map.addControl(new L.Control.Scale({position: 'bottomleft', imperial: false, maxWidth: 200})); } else { $('head').append('');