mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
feat: optimisations
This commit is contained in:
@@ -304,7 +304,6 @@ const enhancedNavigationPlugin: Plugin<typeof settings> = {
|
||||
injectStyles();
|
||||
|
||||
window.addEventListener("resize", positionArrows);
|
||||
window.addEventListener("scroll", positionArrows, true);
|
||||
|
||||
const navObservers: MutationObserver[] = [];
|
||||
const courseObservers: MutationObserver[] = [];
|
||||
@@ -355,7 +354,6 @@ const enhancedNavigationPlugin: Plugin<typeof settings> = {
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("resize", positionArrows);
|
||||
window.removeEventListener("scroll", positionArrows, true);
|
||||
courseMount.unregister();
|
||||
navObservers.forEach((observer) => observer.disconnect());
|
||||
courseObservers.forEach((observer) => observer.disconnect());
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { defineLazyPlugin } from "../../core/dynamicLoader";
|
||||
import { booleanSetting, defineSettings } from "../../core/settingsHelpers";
|
||||
|
||||
const settings = defineSettings({
|
||||
autoScrollOnClick: booleanSetting({
|
||||
default: false,
|
||||
title: "Auto-scroll navigator on click",
|
||||
description:
|
||||
"When you click a lesson directly in the side panel, automatically scroll it to the centre. The prev/next arrows always centre the selected lesson regardless of this setting.",
|
||||
}),
|
||||
});
|
||||
|
||||
export default defineLazyPlugin({
|
||||
id: "enhanced-navigation",
|
||||
name: "Enhanced Navigation",
|
||||
description:
|
||||
"Keeps the course navigator focused on the current lesson and adds prev/next lesson arrows.",
|
||||
version: "1.0.0",
|
||||
disableToggle: true,
|
||||
settings,
|
||||
beta: false,
|
||||
loader: () => import("./index"),
|
||||
});
|
||||
Reference in New Issue
Block a user