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

@ -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('<div id="mobileinfo"></div>');
window.addHook('portalDetailsUpdated', window.smartphoneInfo);
// disable img full view
$('#portaldetails').off('click', '**');