Added status bar for mobile version.

This commit is contained in:
hastarin 2013-06-21 14:46:08 +10:00
parent bf6e086131
commit e8c73f9f46
5 changed files with 48 additions and 7 deletions

View File

@ -129,5 +129,6 @@ window.unselectOldPortal = function() {
if(oldPortal) portalResetColor(oldPortal); if(oldPortal) portalResetColor(oldPortal);
selectedPortal = null; selectedPortal = null;
$('#portaldetails').html(''); $('#portaldetails').html('');
if(isSmartphone()) $('.fullimg').remove();
clearPortalIndicators(); clearPortalIndicators();
} }

View File

@ -39,7 +39,7 @@ window.requests.abort = function() {
// to website. Updates info in layer chooser. // to website. Updates info in layer chooser.
window.renderUpdateStatus = function() { window.renderUpdateStatus = function() {
var t = '<div><span class="help portallevel" title="Indicates portal levels displayed. Zoom in to display lower level portals."><b>portals</b>: '; var t = '<span class="help portallevel" title="Indicates portal levels displayed. Zoom in to display lower level portals."><b>portals</b>: ';
var minlvl = getMinPortalLevel(); var minlvl = getMinPortalLevel();
if(minlvl === 0) if(minlvl === 0)
t += 'all'; t += 'all';
@ -66,8 +66,6 @@ window.renderUpdateStatus = function() {
if(window.failedRequestCount > 0) if(window.failedRequestCount > 0)
t += ' <span style="color:#f66">' + window.failedRequestCount + ' failed</span>' t += ' <span style="color:#f66">' + window.failedRequestCount + ' failed</span>'
t += '</div>';
var portalSelection = $('.leaflet-control-layers-overlays label'); 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 //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 //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', ''); portalSelection.slice(minlvl, 8+1).removeClass('disabled').attr('title', '');
$('#updatestatus').html(t); $('#innerstatus').html(t);
//$('#updatestatus').click(function() { startRefreshTimeout(10); }); //$('#updatestatus').click(function() { startRefreshTimeout(10); });
//. <a style="cursor: pointer" onclick="startRefreshTimeout(10)" title="Refresh">⟳</a>'; //. <a style="cursor: pointer" onclick="startRefreshTimeout(10)" title="Refresh">⟳</a>';
} }

View File

@ -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() { window.runOnSmartphonesAfterBoot = function() {
if(!isSmartphone()) return; if(!isSmartphone()) return;
console.warn('running smartphone post boot stuff'); console.warn('running smartphone post boot stuff');
smartphone.mapButton.click(); smartphone.mapButton.click();
// add a div/hook for updating mobile info
$('#updatestatus').prepend('<div id="mobileinfo"></div>');
window.addHook('portalDetailsUpdated', window.smartphoneInfo);
// disable img full view // disable img full view
$('#portaldetails').off('click', '**'); $('#portaldetails').off('click', '**');

View File

@ -100,7 +100,7 @@ document.getElementsByTagName('body')[0].innerHTML = ''
+ ' </div>' + ' </div>'
+ ' </div>' + ' </div>'
+ '</div>' + '</div>'
+ '<div id="updatestatus"></div>'; + '<div id="updatestatus"><div id="innerstatus"></div></div>';
// putting everything in a wrapper function that in turn is placed in a // putting everything in a wrapper function that in turn is placed in a
// script tag on the website allows us to execute in the sites context // script tag on the website allows us to execute in the sites context

View File

@ -3,8 +3,32 @@ body {
color: #fff; color: #fff;
} }
#sidebar, #updatestatus, #chatcontrols, #chat, #chatinput { #updatestatus {
background: #0B3351 !important 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 { .leaflet-top .leaflet-control {