diff options
Diffstat (limited to 'web/nms.gathering.org/js/nms-info-box.js')
-rw-r--r-- | web/nms.gathering.org/js/nms-info-box.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index 545e62a..7975bae 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -250,6 +250,8 @@ nmsInfoBox._windowTypes.switchInfo = { content.push([v, html]); } + content.sort(); + var table = nmsInfoBox._makeTable(content, "edit"); domObj.appendChild(table); @@ -317,6 +319,7 @@ nmsInfoBox._windowTypes.switchInfo = { nmsInfoBox.click = function(sw) { this.showWindow("switchInfo",sw); + this._windowTypes.switchInfo.showComments(); } /* @@ -440,6 +443,7 @@ nmsInfoBox._search = function() { id = el.value; } if(id) { + nmsMap.enableHighlights(); for(var sw in nmsData.switches.switches) { if (id[0] == "/") { if (nmsInfoBox._searchSmart(id.slice(1),sw)) { @@ -458,23 +462,32 @@ nmsInfoBox._search = function() { } } } else { - nmsMap.removeAllSwitchHighlights(); + nmsMap.disableHighlights(); } if(matches.length == 1) { document.getElementById("searchbox-submit").classList.add("btn-primary"); document.getElementById("searchbox").dataset.match = matches[0]; - document.getElementById("searchbox").addEventListener("keydown",nmsInfoBox._searchKeyListener,false); } else { document.getElementById("searchbox-submit").classList.remove("btn-primary"); document.getElementById("searchbox").dataset.match = ''; - document.getElementById("searchbox").removeEventListener("keydown",nmsInfoBox._searchKeyListener,false); } } nmsInfoBox._searchKeyListener = function(e) { - if(e.keyCode == 13) { - var sw = document.getElementById("searchbox").dataset.match; - nmsInfoBox.showWindow("switchInfo",sw); + switch (e.keyCode) { + case 13: + var sw = document.getElementById("searchbox").dataset.match; + if(sw != '') { + nmsInfoBox.showWindow("switchInfo",sw); + this._windowTypes.switchInfo.showComments(); + } + break; + case 27: + document.getElementById("searchbox").dataset.match = ''; + document.getElementById("searchbox").value = ''; + nmsInfoBox._search(); + nmsInfoBox.hide(); + break; } } |