diff options
author | Kristian Lyngstol <kly@kly.no> | 2019-01-11 22:18:33 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2019-01-11 22:18:33 +0100 |
commit | e5db805157b2c7118ddfd3916e0427b2156e6e49 (patch) | |
tree | bdf57012c0e8224cdeb2467969e89b6fc348158e /web/js/nms-info-box.js | |
parent | a4919da3a91236131f7b4e084761ff6a5f73b94f (diff) |
Move the info summary in the info-box into nmsBox-logic
Also some other random drive-by fixes :D
Fixes #180
References #181
Diffstat (limited to 'web/js/nms-info-box.js')
-rw-r--r-- | web/js/nms-info-box.js | 31 |
1 files changed, 5 insertions, 26 deletions
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 = "<div class=\"clickable\" onclick='nmsInfoBox.setLegendPick(\""+ handlers[h].tag + "\", " + x + ");'>" + tmp.data[x].value + '</div>'; - 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) { |