more work for #179.

Due to changed display of the portal image it now doesn’t flicker anymore,
which simplifies code a lot.
This commit is contained in:
Stefan Breunig
2013-02-16 10:02:18 +01:00
parent 43d9251c57
commit 2023e33567
5 changed files with 120 additions and 124 deletions

View File

@ -77,18 +77,18 @@ window.getAvgResoDistText = function(d) {
}
window.getResonatorDetails = function(d) {
var resoDetails = '';
var resoDetails = [];
// octant=slot: 0=E, 1=NE, 2=N, 3=NW, 4=W, 5=SW, 6=S, SE=7
// resos in the display should be ordered like this:
// N NE Since the view is displayed in columns, they
// NW E need to be ordered like this: N, NW, W, SW, NE,
// W SE E, SE, S, i.e. 2 3 4 5 1 0 7 6
// SW S
$.each([2, 3, 4, 5, 1, 0, 7, 6], function(ind, slot) {
var isLeft = slot >= 2 && slot <= 5;
$.each([2, 1, 3, 0, 4, 7, 5, 6], function(ind, slot) {
var reso = d.resonatorArray.resonators[slot];
if(!reso) {
resoDetails += renderResonatorDetails(slot, 0, 0, null, null, isLeft);
resoDetails.push(renderResonatorDetails(slot, 0, 0, null, null));
return true;
}
@ -100,16 +100,16 @@ window.getResonatorDetails = function(d) {
// naming will still be correct.
slot = parseInt(reso.slot);
resoDetails += renderResonatorDetails(slot, l, v, dist, nick, isLeft);
resoDetails.push(renderResonatorDetails(slot, l, v, dist, nick));
});
return resoDetails;
return genFourColumnTable(resoDetails);
}
// helper function that renders the HTML for a given resonator. Does
// not work with raw details-hash. Needs digested infos instead:
// slot: which slot this resonator occupies. Starts with 0 (east) and
// rotates clockwise. So, last one is 7 (southeast).
window.renderResonatorDetails = function(slot, level, nrg, dist, nick, isLeft) {
window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
if(level === 0) {
var meter = '<span class="meter" title="octant:\t' + OCTANTS[slot] + '"></span>';
} else {
@ -130,11 +130,9 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick, isLeft) {
var fill = '<span style="'+style+'"></span>';
var meter = '<span class="meter meter-rel" title="'+inf+'">' + fill + lbar + '</span>';
var meter = '<span class="meter" title="'+inf+'">' + fill + lbar + '</span>';
}
var cls = isLeft ? 'left' : 'right';
var text = '<span class="meter-text '+cls+'">'+(nick||'')+'</span>';
return (isLeft ? text+meter : meter+text) + '<br/>';
return [meter, nick || ''];
}
// calculate AP gain from destroying portal