From eb6b95252acfabf21ac3a30b97b334473c246dff Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Wed, 25 May 2016 23:21:12 +0200 Subject: front: Search tweaks and twaks regex search on distro is mainly to include it in extended searches, e.g.: ^(distro0|row21-\d)$ This means "" is now, again, needed to match only one switch. --- web/js/nms-search.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'web/js') diff --git a/web/js/nms-search.js b/web/js/nms-search.js index 46c0571..6d61536 100644 --- a/web/js/nms-search.js +++ b/web/js/nms-search.js @@ -34,7 +34,7 @@ nmsSearch.searchTest = function(id, sw) { } } try { - if (nmsData.switches.switches[sw].distro_name.toLowerCase() == id) { + if (re.test(nmsData.switches.switches[sw].distro_name)) { return true; } } catch (e) {} @@ -90,8 +90,8 @@ nmsSearch.searchTest = function(id, sw) { }; nmsSearch.reset = function() { - var el = document.getElementById("searchbox"); - el.value = ""; + document.getElementById("searchbox").dataset.match = ''; + document.getElementById("searchbox").value = ''; nmsSearch.search(); } @@ -147,10 +147,7 @@ nmsSearch._searchKeyListener = function(e) { } break; case 27: - document.getElementById("searchbox").dataset.match = ''; - document.getElementById("searchbox").value = ''; - nmsInfoBox._search(); - nmsInfoBox.hide(); + nmsSearch.reset(); break; } } -- cgit v1.2.3