From 605c347a7a9919bf741d24d80c27faded3971b85 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Mon, 7 Jan 2019 01:03:44 +0100 Subject: Auto-hilight systems on oplog-hover --- web/js/nms-oplog.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'web') diff --git a/web/js/nms-oplog.js b/web/js/nms-oplog.js index 0580d40..b9bf55a 100644 --- a/web/js/nms-oplog.js +++ b/web/js/nms-oplog.js @@ -212,11 +212,30 @@ class nmsOplogEntry extends nmsBox { } col2.searchbox = document.getElementById("searchbox") col2.entry = this; - col2.html.onclick = function(e) { - var x = document.getElementById("searchbox"); - var v = e.path[0].hiddenthing; - this.nmsBox.searchbox.value = this.nmsBox.entry.systems; - this.nmsBox.searchbox.oninput() + if (this.systems != undefined && this.systems != null && this.systems != "") { + col2.html.onclick = function(e) { + this.nmsBox.searchbox.value = this.nmsBox.entry.systems; + this.nmsBox.searchbox.oninput() + this.nmsBox.clicked = true; + setTimeout(function(e){e.clicked = false;},3000,this.nmsBox) + } + col2.html.onmouseover = function(e) { + this.nmsBox.searchbox.value = this.nmsBox.entry.systems; + this.nmsBox.searchbox.oninput() + } + col2.html.onmouseleave = function(e) { + if (this.nmsBox.clicked) { return; } + if (this.nmsBox.timer) { + clearTimeout(this.nmsBox.timer) + } + this.nmsBox.timer = setTimeout(function(e){ + if (e.entry.systems == e.searchbox.value) { + console.log(e) + e.searchbox.value = ""; + e.searchbox.oninput() + } + },2000,this.nmsBox) + } } this.add(td1) td2.add(col2) -- cgit v1.2.3