From 8d214ff6a332eead47c7bea8cc923a5251b16b47 Mon Sep 17 00:00:00 2001 From: StroepWafel Date: Wed, 18 Mar 2026 08:41:17 +1030 Subject: [PATCH 1/3] Revert "Update monofile.ts" This reverts commit 725d2b29879df83a7e0ac317e257ce0aada49490. --- src/plugins/monofile.ts | 76 ++++------------------------------------- 1 file changed, 7 insertions(+), 69 deletions(-) diff --git a/src/plugins/monofile.ts b/src/plugins/monofile.ts index da33fef6..874ef526 100644 --- a/src/plugins/monofile.ts +++ b/src/plugins/monofile.ts @@ -612,6 +612,7 @@ export function init() { if (settingsState.onoff) { console.info("[BetterSEQTA+] Enabled"); if (settingsState.DarkMode) document.documentElement.classList.add("dark"); + if (settingsState.iconOnlySidebar) document.body.classList.add("icon-only-sidebar"); document.querySelector(".legacy-root")?.classList.add("hidden"); ObserveMenuItemPosition(); @@ -619,79 +620,16 @@ export function init() { new StorageChangeHandler(); new MessageHandler(); - updateAllColors(); + void updateAllColors(); + + window.addEventListener("hashchange", () => { + if (settingsState.adaptiveThemeColour) void updateAllColors(); + }); loading(); InjectCustomIcons(); HideMenuItems(); tryLoad(); - // Auto-focus WISP direct online submission editor when pane opens - eventManager.register( - "wispassessmentAdded", - { - customCheck: (el) => - el.classList.contains("wispassessment") || - el.querySelector(".wispassessment") !== null, - }, - (element) => { - const wispassessment = element.classList.contains("wispassessment") - ? (element as Element) - : element.querySelector(".wispassessment"); - if (!wispassessment) return; - - const focusEditableBody = (iframe: HTMLIFrameElement) => { - try { - const doc = iframe.contentDocument; - const win = iframe.contentWindow; - if (doc?.body && win) { - const editable = - doc.body.querySelector(".cke_editable") || doc.body; - const el = editable as HTMLElement; - el.focus(); - const range = doc.createRange(); - range.selectNodeContents(el); - range.collapse(true); - const sel = win.getSelection(); - if (sel) { - sel.removeAllRanges(); - sel.addRange(range); - } - return true; - } - } catch (_) {} - return false; - }; - - const focusEditor = () => { - const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); - if (iframe instanceof HTMLIFrameElement) { - if (focusEditableBody(iframe)) return; - iframe.focus(); - return; - } - const ckeditor = (window as any).CKEDITOR; - if (ckeditor?.instances?.editor1) { - try { - ckeditor.instances.editor1.focus(); - } catch (_) {} - } - }; - - const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); - if (iframe instanceof HTMLIFrameElement) { - iframe.addEventListener( - "load", - () => focusEditableBody(iframe), - { once: true }, - ); - } - - [1000, 1200, 1500].forEach((delay) => - setTimeout(focusEditor, delay), - ); - }, - ); - setTimeout(() => { const legacyElement = document.querySelector( ".outside-container .bottom-container", @@ -754,4 +692,4 @@ export function AppendElementsToDisabledPage() { } `; document.head.append(settingsStyle); -} \ No newline at end of file +} From ec0dd70a4bd39e3520899025ad5c40dae0c5850a Mon Sep 17 00:00:00 2001 From: StroepWafel Date: Wed, 18 Mar 2026 08:42:02 +1030 Subject: [PATCH 2/3] ok ONL:Y wisp content this time --- src/plugins/monofile.ts | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/plugins/monofile.ts b/src/plugins/monofile.ts index 874ef526..62a1a0bf 100644 --- a/src/plugins/monofile.ts +++ b/src/plugins/monofile.ts @@ -630,6 +630,73 @@ export function init() { HideMenuItems(); tryLoad(); + // Auto-focus WISP direct online submission editor when pane opens + eventManager.register( + "wispassessmentAdded", + { + customCheck: (el) => + el.classList.contains("wispassessment") || + el.querySelector(".wispassessment") !== null, + }, + (element) => { + const wispassessment = element.classList.contains("wispassessment") + ? (element as Element) + : element.querySelector(".wispassessment"); + if (!wispassessment) return; + + const focusEditableBody = (iframe: HTMLIFrameElement) => { + try { + const doc = iframe.contentDocument; + const win = iframe.contentWindow; + if (doc?.body && win) { + const editable = + doc.body.querySelector(".cke_editable") || doc.body; + const el = editable as HTMLElement; + el.focus(); + const range = doc.createRange(); + range.selectNodeContents(el); + range.collapse(true); + const sel = win.getSelection(); + if (sel) { + sel.removeAllRanges(); + sel.addRange(range); + } + return true; + } + } catch (_) {} + return false; + }; + + const focusEditor = () => { + const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); + if (iframe instanceof HTMLIFrameElement) { + if (focusEditableBody(iframe)) return; + iframe.focus(); + return; + } + const ckeditor = (window as any).CKEDITOR; + if (ckeditor?.instances?.editor1) { + try { + ckeditor.instances.editor1.focus(); + } catch (_) {} + } + }; + + const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); + if (iframe instanceof HTMLIFrameElement) { + iframe.addEventListener( + "load", + () => focusEditableBody(iframe), + { once: true }, + ); + } + + [1000, 1200, 1500].forEach((delay) => + setTimeout(focusEditor, delay), + ); + }, + ); + setTimeout(() => { const legacyElement = document.querySelector( ".outside-container .bottom-container", From 9a9885066f8307cf03bcde5672119823bc74284c Mon Sep 17 00:00:00 2001 From: StroepWafel Date: Wed, 18 Mar 2026 08:44:49 +1030 Subject: [PATCH 3/3] actually do WISP correctly --- src/plugins/monofile.ts | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/plugins/monofile.ts b/src/plugins/monofile.ts index 874ef526..62a1a0bf 100644 --- a/src/plugins/monofile.ts +++ b/src/plugins/monofile.ts @@ -630,6 +630,73 @@ export function init() { HideMenuItems(); tryLoad(); + // Auto-focus WISP direct online submission editor when pane opens + eventManager.register( + "wispassessmentAdded", + { + customCheck: (el) => + el.classList.contains("wispassessment") || + el.querySelector(".wispassessment") !== null, + }, + (element) => { + const wispassessment = element.classList.contains("wispassessment") + ? (element as Element) + : element.querySelector(".wispassessment"); + if (!wispassessment) return; + + const focusEditableBody = (iframe: HTMLIFrameElement) => { + try { + const doc = iframe.contentDocument; + const win = iframe.contentWindow; + if (doc?.body && win) { + const editable = + doc.body.querySelector(".cke_editable") || doc.body; + const el = editable as HTMLElement; + el.focus(); + const range = doc.createRange(); + range.selectNodeContents(el); + range.collapse(true); + const sel = win.getSelection(); + if (sel) { + sel.removeAllRanges(); + sel.addRange(range); + } + return true; + } + } catch (_) {} + return false; + }; + + const focusEditor = () => { + const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); + if (iframe instanceof HTMLIFrameElement) { + if (focusEditableBody(iframe)) return; + iframe.focus(); + return; + } + const ckeditor = (window as any).CKEDITOR; + if (ckeditor?.instances?.editor1) { + try { + ckeditor.instances.editor1.focus(); + } catch (_) {} + } + }; + + const iframe = wispassessment.querySelector(".cke_wysiwyg_frame"); + if (iframe instanceof HTMLIFrameElement) { + iframe.addEventListener( + "load", + () => focusEditableBody(iframe), + { once: true }, + ); + } + + [1000, 1200, 1500].forEach((delay) => + setTimeout(focusEditor, delay), + ); + }, + ); + setTimeout(() => { const legacyElement = document.querySelector( ".outside-container .bottom-container",