mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Make finder actually jump to things
This commit is contained in:
@@ -3051,14 +3051,33 @@ function highlightEl(element) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let settingArea = $(element).closest(".settings_category_area")[0];
|
||||||
|
|
||||||
|
// HACK: This really sucks, we should probably have an easier way to select tabs.
|
||||||
|
if (settingArea) {
|
||||||
|
let tabName = settingArea.id.replace("setting_menu_", "");
|
||||||
|
for (const tab of $(".setting_menu_button")) {
|
||||||
|
if (tab.innerText.toLowerCase() === tabName) {
|
||||||
|
tab.click();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.scrollIntoView();
|
||||||
|
}
|
||||||
|
|
||||||
console.log("uhoh", element);
|
console.log("uhoh", element);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSearchListing(action, highlight) {
|
function addSearchListing(action, highlight) {
|
||||||
|
const finderContainer = document.getElementById("finder-container");
|
||||||
const finder = document.getElementById("finder");
|
const finder = document.getElementById("finder");
|
||||||
|
|
||||||
let result = document.createElement("div");
|
let result = document.createElement("div");
|
||||||
result.classList.add("finder-result");
|
result.classList.add("finder-result");
|
||||||
|
result.addEventListener("click", function(event) {
|
||||||
|
finderContainer.classList.add("hidden");
|
||||||
|
action.func();
|
||||||
|
});
|
||||||
|
|
||||||
let textblock = document.createElement("div");
|
let textblock = document.createElement("div");
|
||||||
textblock.classList.add("result-textbox");
|
textblock.classList.add("result-textbox");
|
||||||
@@ -3271,8 +3290,12 @@ $(document).ready(function(){
|
|||||||
finderInput.addEventListener("keyup", updateSearchListings);
|
finderInput.addEventListener("keyup", updateSearchListings);
|
||||||
finderInput.addEventListener("keydown", function(event) {
|
finderInput.addEventListener("keydown", function(event) {
|
||||||
let delta = 0;
|
let delta = 0;
|
||||||
|
const actions = document.getElementsByClassName("finder-result");
|
||||||
|
|
||||||
if (event.key === "ArrowUp") {
|
if (event.key === "Enter") {
|
||||||
|
let index = finder_selection_index >= 0 ? finder_selection_index : 0;
|
||||||
|
actions[index].click();
|
||||||
|
} else if (event.key === "ArrowUp") {
|
||||||
delta = -1;
|
delta = -1;
|
||||||
} else if (event.key === "ArrowDown") {
|
} else if (event.key === "ArrowDown") {
|
||||||
delta = 1
|
delta = 1
|
||||||
@@ -3282,7 +3305,7 @@ $(document).ready(function(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionsCount = document.getElementsByClassName("finder-result").length;
|
const actionsCount = actions.length;
|
||||||
let future = finder_selection_index + delta;
|
let future = finder_selection_index + delta;
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Reference in New Issue
Block a user