diff options
author | Nicolai Tellefsen <niccofyren@gmail.com> | 2016-03-21 20:26:58 +0100 |
---|---|---|
committer | Nicolai Tellefsen <niccofyren@gmail.com> | 2016-03-21 20:26:58 +0100 |
commit | d528cad67897dd2c3b98ec15a82868ac2764e2c7 (patch) | |
tree | e22c00a1274e934352754e99b3cfce3619af2bf3 /web/nms.gathering.org/js/nms-map.js | |
parent | 4eedfbd1a9cbb447690f86fece8b2ff5a5fc2626 (diff) |
NMS: Tweak search highlight and hotkeys
Diffstat (limited to 'web/nms.gathering.org/js/nms-map.js')
-rw-r--r-- | web/nms.gathering.org/js/nms-map.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js index b74626a..11ee142 100644 --- a/web/nms.gathering.org/js/nms-map.js +++ b/web/nms.gathering.org/js/nms-map.js @@ -10,7 +10,8 @@ * nmsMap.setSwitchColor(switch,color) * nmsMap.setSwitchInfo(switch,info) * nmsMap.setSwitchHighlight(switch,true/false) - * nmsMap.removeAllSwitchHighlights() + * nmsMap.enableHighlights() + * nmsMap.disableHighlights() */ @@ -47,6 +48,7 @@ var nmsMap = nmsMap || { _color: { }, _highlight: { }, + _highlightActive: false, _c: {} } @@ -76,15 +78,19 @@ nmsMap.setSwitchHighlight = function(sw, highlight) { if(highlight) highlight == true; if (this._highlight[sw] != highlight) { - this._highlight[sw] = highlight; - this._drawSwitch(sw); this.stats.highlightChange++; + this._highlight[sw] = highlight; } + this._drawSwitch(sw); } -nmsMap.removeAllSwitchHighlights = function() { - for(var sw in this._highlight) - this.setSwitchHighlight(sw,false); +nmsMap.enableHighlights = function() { + this._highlightActive = true; +} + +nmsMap.disableHighlights = function() { + this._highlightActive = false; + this._drawAllSwitches(); } nmsMap.reset = function() { @@ -247,8 +253,12 @@ nmsMap._drawSwitch = function(sw) return; var box = this._getBox(sw); var color = nmsMap._color[sw]; - if(nmsMap._highlight[sw]) { - color = red; + if(this._highlightActive) { + if(nmsMap._highlight[sw]) { + color = green; + } else { + color = white; + } } if (color == undefined) { color = blue; |