diff options
| author | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-25 23:21:12 +0200 | 
|---|---|---|
| committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-25 23:21:12 +0200 | 
| commit | eb6b95252acfabf21ac3a30b97b334473c246dff (patch) | |
| tree | 8ce5e207cd829516f2905d7f8d9678d052d200d3 | |
| parent | 3833403178a83c5174295d945edabfe749d001af (diff) | |
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.
| -rw-r--r-- | web/js/nms-search.js | 11 | 
1 files changed, 4 insertions, 7 deletions
| 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;  	}  } | 
