fixed code review bugs noted by breunigs

This commit is contained in:
Dave Frame 2013-02-22 11:22:36 -07:00
parent 4d374ac7ad
commit 8517e128d1

View File

@ -22,28 +22,22 @@ window.plugin.compAPStats = function() {};
window.plugin.compAPStats.setupCallback = function() { window.plugin.compAPStats.setupCallback = function() {
// add a new div to the bottom of the sidebar and style it // add a new div to the bottom of the sidebar and style it
$('#sidebar').append("<div id='available_ap_display'></div>"); $('#sidebar').append('<div id="available_ap_display"></div>');
$('#available_ap_display').css({'color':'yellow', 'font-size':'90%', 'padding':'4px 2px'}); $('#available_ap_display').css({'color':'#ffce00', 'font-size':'90%', 'padding':'4px 2px'});
// do an initial calc for sizing purposes // do an initial calc for sidebar sizing purposes
window.plugin.compAPStats.onPositionMove(); window.plugin.compAPStats.onPositionMove();
//redefine the max size of the sidebar so its actually visible // make the value update on map position changes
$('#scrollwrapper').css('max-height', ($('#sidebar').get(0).scrollHeight+3) + 'px');
//make the value update on map position changes
map.on('moveend zoomend', window.plugin.compAPStats.onPositionMove); map.on('moveend zoomend', window.plugin.compAPStats.onPositionMove);
} }
window.plugin.compAPStats.onPositionMove = function() { window.plugin.compAPStats.onPositionMove = function() {
$('#available_ap_display').empty();
$('#available_ap_display').append('Available AP in this area:<br/>');
var result = window.plugin.compAPStats.compAPStats(); var result = window.plugin.compAPStats.compAPStats();
$('#available_ap_display').append('&nbsp;Enlightened:\t' + digits(result[1]) + '<br/>'); $('#available_ap_display').html("Available AP in this area:<br/>&nbsp;Enlightened:\t" +
$('#available_ap_display').append('&nbsp;Resistance:\t' + digits(result[0])); digits(result[1]) + "<br/>&nbsp;Resistance:\t" + digits(result[0]));
} }
window.plugin.compAPStats.compAPStats = function() { window.plugin.compAPStats.compAPStats = function() {
var totalAP_RES = 0; var totalAP_RES = 0;