aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/js/nms-map.js
diff options
context:
space:
mode:
authorNicolai Tellefsen <niccofyren@gmail.com>2016-03-17 22:38:32 +0100
committerNicolai Tellefsen <niccofyren@gmail.com>2016-03-17 22:38:32 +0100
commita24f3520a43cf59d0ac88270ba956c9aa67de469 (patch)
treefa0c91f605ccedd9cb946fb37d6686560b5ded3b /web/nms.gathering.org/js/nms-map.js
parentb7887d4b7181e057d77a5f5d093de0400052bd0b (diff)
NMS: Add live highlight to search
Original search only worked with exact matches. Added a simple highlight interface to nms-map.js to enable live highlights while typing.
Diffstat (limited to 'web/nms.gathering.org/js/nms-map.js')
-rw-r--r--web/nms.gathering.org/js/nms-map.js30
1 files changed, 26 insertions, 4 deletions
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js
index d855320..9bba1bf 100644
--- a/web/nms.gathering.org/js/nms-map.js
+++ b/web/nms.gathering.org/js/nms-map.js
@@ -9,20 +9,23 @@
* nmsMap.init() - start things up
* nmsMap.setSwitchColor(switch,color)
* nmsMap.setSwitchInfo(switch,info)
+ * nmsMap.setSwitchHighlight(switch,true/false)
+ * nmsMap.removeAllSwitchHighlights()
*/
var nmsMap = nmsMap || {
_moveInProgress: false,
stats: {
- earlyDrawAll:0,
colorChange:0,
colorSame:0,
+ earlyDrawAll:0,
+ nowDups:0,
+ nows:0,
resizeEvents:0,
- switchInfoUpdate:0,
switchInfoSame:0,
- nowDups:0,
- nows:0
+ switchInfoUpdate:0,
+ highlightChange:0
},
contexts: ["bg","link","blur","switch","text","textInfo","top","input","hidden"],
_info: {},
@@ -43,6 +46,7 @@ var nmsMap = nmsMap || {
},
_color: { },
+ _highlight: { },
_c: {}
}
@@ -68,6 +72,21 @@ nmsMap.setSwitchColor = function(sw, color) {
}
}
+nmsMap.setSwitchHighlight = function(sw, highlight) {
+ if(highlight)
+ highlight == true;
+ if (this._highlight[sw] != highlight) {
+ this._highlight[sw] = highlight;
+ this._drawSwitch(sw);
+ this.stats.highlightChange++;
+ }
+}
+
+nmsMap.removeAllSwitchHighlights = function() {
+ for(var sw in this._highlight)
+ this.setSwitchHighlight(sw,false);
+}
+
nmsMap.reset = function() {
for (var sw in this._color) {
nmsMap.setSwitchColor(sw, undefined);
@@ -226,6 +245,9 @@ nmsMap._drawSwitch = function(sw)
return;
var box = this._getBox(sw);
var color = nmsMap._color[sw];
+ if(nmsMap._highlight[sw]) {
+ color = red;
+ }
if (color == undefined) {
color = blue;
}