From b0bad4999bd05eddc689eebd6cf8778f2be7841a Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 30 Oct 2022 11:16:16 -0500 Subject: [PATCH 1/2] Remove some debug code for the notifications Whoops --- static/koboldai.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index ff7341c5..ea544516 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -5499,8 +5499,6 @@ function reportError(title, text) { showNotification(title, text, "error"); } -showNotification("Be aware!", "Things are happening at an alarming pace!"); - //function to load more actions if nessisary function infinite_scroll() { if (scroll_trigger_element != undefined) { From 58aacf2cd87a940b0122634b8d5a2e2f831d3e5c Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 30 Oct 2022 11:23:59 -0500 Subject: [PATCH 2/2] Shortcut criteria for story history navigation --- static/koboldai.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index ea544516..9527349b 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -109,9 +109,9 @@ const context_menu_actions = [ const shortcuts = [ {key: "k", desc: "Finder", func: open_finder}, {key: "/", desc: "Help screen", func: () => openPopup("shortcuts-popup")}, - {key: "z", desc: "Undoes last story action", func: () => socket.emit("back", {})}, - {key: "y", desc: "Redoes last story action", func: () => socket.emit("redo", {})}, - {key: "e", desc: "Retries last story action", func: () => socket.emit("retry", {})}, + {key: "z", desc: "Undoes last story action", func: () => socket.emit("back", {}), criteria: canNavigateStoryHistory}, + {key: "y", desc: "Redoes last story action", func: () => socket.emit("redo", {}), criteria: canNavigateStoryHistory}, + {key: "e", desc: "Retries last story action", func: () => socket.emit("retry", {}), criteria: canNavigateStoryHistory}, {key: "m", desc: "Focuses Memory", func: () => focusEl("#memory")}, {key: "l", desc: "Focuses Author's Note", func: () => focusEl("#authors_notes")}, // CTRL-N is reserved :^( {key: "g", desc: "Focuses game text", func: () => focusEl("#input_text")}, @@ -5461,6 +5461,7 @@ function initalizeTooltips() { for (const shortcut of shortcuts) { if (shortcut.key !== event.key) continue; + if (shortcut.criteria && !shortcut.criteria()) continue; event.preventDefault(); shortcut.func(); } @@ -5499,6 +5500,10 @@ function reportError(title, text) { showNotification(title, text, "error"); } +function canNavigateStoryHistory() { + return !["TEXTAREA", "INPUT"].includes(document.activeElement.tagName); +} + //function to load more actions if nessisary function infinite_scroll() { if (scroll_trigger_element != undefined) {