From e5db805157b2c7118ddfd3916e0427b2156e6e49 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Fri, 11 Jan 2019 22:18:33 +0100 Subject: Move the info summary in the info-box into nmsBox-logic Also some other random drive-by fixes :D Fixes #180 References #181 --- web/js/nms-info-box.js | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'web/js/nms-info-box.js') diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js index efb2d7b..6915b03 100644 --- a/web/js/nms-info-box.js +++ b/web/js/nms-info-box.js @@ -937,34 +937,13 @@ var switchSummaryPanel = function() { this.refresh(); }; this.refresh = function(reason) { - var content = []; - if (this.sw == false) { - console.log("ugh, cleanup failed?"); + if (this.box) { + this.box.refresh(); return; } - var topper = document.createElement("div"); - for ( var h in handlers ) { - if (handlers[h].getInfo != undefined) { - var tmp = handlers[h].getInfo(this.sw); - for (var x in tmp.data) { - if (tmp.data[x].value != undefined) { - var d = "
" + tmp.data[x].value + '
'; - content.push([tmp.data[x].description, d]); - } - } - } - } - - var contentCleaned = []; - for(var i in content) { - if(content[i][1] == '' || content[i][1] == null) - continue; - contentCleaned.push(content[i]); - } - var table = nmsInfoBox._makeTable(contentCleaned); - topper.appendChild(table); - - this._render(topper); + this.box = new nmsSwitchSummary(this.sw); + this.box.attach(this.me) + this.box.show() }; }; nmsInfoBox.setLegendPick = function(tag,id) { -- cgit v1.2.3