diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index c3ba306b..cdb81664 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -129,5 +129,6 @@ window.unselectOldPortal = function() { if(oldPortal) portalResetColor(oldPortal); selectedPortal = null; $('#portaldetails').html(''); + if(isSmartphone()) $('.fullimg').remove(); clearPortalIndicators(); } diff --git a/code/request_handling.js b/code/request_handling.js index 3a5c02d3..457be5df 100644 --- a/code/request_handling.js +++ b/code/request_handling.js @@ -39,7 +39,7 @@ window.requests.abort = function() { // to website. Updates info in layer chooser. window.renderUpdateStatus = function() { - var t = '
portals: '; + var t = 'portals: '; var minlvl = getMinPortalLevel(); if(minlvl === 0) t += 'all'; @@ -66,8 +66,6 @@ window.renderUpdateStatus = function() { if(window.failedRequestCount > 0) t += ' ' + window.failedRequestCount + ' failed' - t += '
'; - var portalSelection = $('.leaflet-control-layers-overlays label'); //it's an array - 0=unclaimed, 1=lvl 1, 2=lvl 2, ..., 8=lvl 8 - 9 relevant entries //mark all levels below (but not at) minlvl as disabled @@ -76,7 +74,7 @@ window.renderUpdateStatus = function() { portalSelection.slice(minlvl, 8+1).removeClass('disabled').attr('title', ''); - $('#updatestatus').html(t); + $('#innerstatus').html(t); //$('#updatestatus').click(function() { startRefreshTimeout(10); }); //. '; } diff --git a/code/smartphone.js b/code/smartphone.js index f02aa395..9d913c22 100644 --- a/code/smartphone.js +++ b/code/smartphone.js @@ -68,12 +68,30 @@ window.runOnSmartphonesBeforeBoot = function() { }); } +window.smartphoneInfo = function(data) { + var d = data.portalDetails; + var t = 'L' + Math.floor(getPortalLevel(d)); + var percentage = '0%'; + var totalEnergy = getTotalPortalEnergy(d); + if(getTotalPortalEnergy(d) > 0) { + percentage = Math.floor((getCurrentPortalEnergy(d) / getTotalPortalEnergy(d) * 100)) + '%'; + } + t += ' ' + percentage + ' '; + t += d.portalV2.descriptiveText.TITLE; + + $('#mobileinfo').html(t); +} + window.runOnSmartphonesAfterBoot = function() { if(!isSmartphone()) return; console.warn('running smartphone post boot stuff'); smartphone.mapButton.click(); + // add a div/hook for updating mobile info + $('#updatestatus').prepend('
'); + window.addHook('portalDetailsUpdated', window.smartphoneInfo); + // disable img full view $('#portaldetails').off('click', '**'); diff --git a/main.js b/main.js index f3ee42e1..527367de 100644 --- a/main.js +++ b/main.js @@ -100,7 +100,7 @@ document.getElementsByTagName('body')[0].innerHTML = '' + ' ' + ' ' + '' - + '
'; + + '
'; // putting everything in a wrapper function that in turn is placed in a // script tag on the website allows us to execute in the site’s context diff --git a/mobile/smartphone.css b/mobile/smartphone.css index 3edc3121..3b792050 100644 --- a/mobile/smartphone.css +++ b/mobile/smartphone.css @@ -3,8 +3,32 @@ body { color: #fff; } -#sidebar, #updatestatus, #chatcontrols, #chat, #chatinput { - background: #0B3351 !important +#updatestatus { + background: #262c32; + width: 100%; + color: #d4d5d6; + border: 0; +} + +#innerstatus { + float: right; + max-width: 50%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +#mobileinfo { + float: left; + margin-right: 1em; + max-width: 50%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +#sidebar, #chatcontrols, #chat, #chatinput { + background: #0B3351 !important; } .leaflet-top .leaflet-control {