From 413e80ed3e2402ef268084a423155106508a86d8 Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 15 May 2019 16:03:18 +0100 Subject: [PATCH] Add clicking on output search result --- src/web/Manager.mjs | 2 +- src/web/OutputWaiter.mjs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 23a035af..1f32665e 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -210,7 +210,7 @@ class Manager { document.getElementById("output-num-results").addEventListener("change", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-num-results").addEventListener("keyup", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-filter-refresh").addEventListener("click", this.output.filterTabSearch.bind(this.output)); - // this.addDynamicListener(".output-filter-result", "click", this.output.filterItemClick, this.output); + this.addDynamicListener(".output-filter-result", "click", this.output.filterItemClick, this.output); // Options diff --git a/src/web/OutputWaiter.mjs b/src/web/OutputWaiter.mjs index fffcc4fd..5f8d44ee 100755 --- a/src/web/OutputWaiter.mjs +++ b/src/web/OutputWaiter.mjs @@ -1333,6 +1333,21 @@ class OutputWaiter { resultsList.appendChild(newListItem); } } + + /** + * Handler for clicking on a filter result. + * Changes to the clicked output + * + * @param {event} e + */ + filterItemClick(e) { + if (!e.target) return; + const inputNum = parseInt(e.target.getAttribute("inputNum"), 10); + if (inputNum <= 0) return; + + $("#output-tab-modal").modal("hide"); + this.changeTab(inputNum, this.app.options.syncTabs); + } } export default OutputWaiter;