From 48567599c59d6e87e27b8afd2768979554c06b8f Mon Sep 17 00:00:00 2001 From: GrimReaper2654 <80506189+GrimReaper2654@users.noreply.github.com> Date: Tue, 24 Dec 2024 21:40:23 +0800 Subject: [PATCH] fix (maybe) --- script.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/script.js b/script.js index 0dafb83..90df32e 100644 --- a/script.js +++ b/script.js @@ -24,18 +24,16 @@ const data = { keyboard: {} }; -let path = window.location.pathname; -path = path.replace(/\/+$/, ''); -if (path.endsWith("dev.html")) { - // Load keybinds - window.onkeydown = function(e) { - const keyBinds = ['q', 'w', 'e']; // munti choice, short answer, extended - console.log(e.key); - if (data.activeQuestion && keyBinds.includes(e.key)) { - const tag = e.key == keyBinds[0]? 'Multiple-choice': e.key == keyBinds[1]? 'Short Answer' : 'Extended Response'; - updateTags(tag); +window.onkeydown = function(e) { + const keyBinds = ['q', 'w', 'e']; // munti choice, short answer, extended + console.log(e.key); + if (data.activeQuestion && keyBinds.includes(e.key)) { + const tag = e.key == keyBinds[0]? 'Multiple-choice': e.key == keyBinds[1]? 'Short Answer' : 'Extended Response'; + if (document.getElementById(`${tag}Modify`)) { document.getElementById(`${tag}Modify`).checked = !document.getElementById(`${tag}Modify`).checked; + updateTags(tag, document.getElementById(`${tag}Modify`).checked); } + } } window.addEventListener('resize', packTags);