Add clicking on output search result

This commit is contained in:
j433866 2019-05-15 16:03:18 +01:00
parent 5d52f4a760
commit 413e80ed3e
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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;