mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
refactor: rename pascalcase functions to camelcase
This commit is contained in:
38 files changed
+135
-136
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ import { build } from "esbuild";
|
|||||||
import { resolve } from "node:path";
|
import { resolve } from "node:path";
|
||||||
|
|
||||||
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
|
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
|
||||||
export default function InlineWorkerDevPlugin(): Plugin {
|
export default function inlineWorkerDevPlugin(): Plugin {
|
||||||
return {
|
return {
|
||||||
name: "vite:inline-worker-dev",
|
name: "vite:inline-worker-dev",
|
||||||
async load(id) {
|
async load(id) {
|
||||||
|
|||||||
@@ -110,8 +110,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const openStorePage = async () => {
|
const openStorePage = async () => {
|
||||||
const { OpenStorePage } = await import("@/seqta/ui/renderStore");
|
await (await import("@/seqta/ui/renderStore")).openStorePage();
|
||||||
await OpenStorePage();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openThemeCreator = async (themeId?: string) => {
|
const openThemeCreator = async (themeId?: string) => {
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||||
|
|
||||||
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
||||||
import { OpenAboutPage } from "@/seqta/utils/openers/openAboutPage";
|
import { openAboutPage } from "@/seqta/utils/openers/openAboutPage";
|
||||||
import { OpenWhatsNewPopup } from "@/seqta/utils/openers/openWhatsNewPopup";
|
import { openWhatsNewPopup } from "@/seqta/utils/openers/openWhatsNewPopup";
|
||||||
|
|
||||||
import type { Component } from "svelte";
|
import type { Component } from "svelte";
|
||||||
import SidebarNav from "../components/SidebarNav.svelte";
|
import SidebarNav from "../components/SidebarNav.svelte";
|
||||||
@@ -228,12 +228,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const openChangelog = () => {
|
const openChangelog = () => {
|
||||||
OpenWhatsNewPopup();
|
openWhatsNewPopup();
|
||||||
closeExtensionPopup();
|
closeExtensionPopup();
|
||||||
};
|
};
|
||||||
|
|
||||||
const openAbout = () => {
|
const openAbout = () => {
|
||||||
OpenAboutPage();
|
openAboutPage();
|
||||||
closeExtensionPopup();
|
closeExtensionPopup();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
} from "../utils/themeImageHandlers";
|
} from "../utils/themeImageHandlers";
|
||||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||||
import { themeUpdates } from "../hooks/themeUpdates";
|
import { themeUpdates } from "../hooks/themeUpdates";
|
||||||
import { CloseThemeCreator } from "@/plugins/built-in/themes/themeCreator";
|
import { closeThemeCreator } from "@/plugins/built-in/themes/themeCreator";
|
||||||
import { submitLocalThemeToCommunity } from "@/seqta/utils/customThemes/submitLocalTheme";
|
import { submitLocalThemeToCommunity } from "@/seqta/utils/customThemes/submitLocalTheme";
|
||||||
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
import { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
await themeManager.saveTheme(themeClone);
|
await themeManager.saveTheme(themeClone);
|
||||||
await themeManager.setTheme(themeClone.id);
|
await themeManager.setTheme(themeClone.id);
|
||||||
themeUpdates.triggerUpdate();
|
themeUpdates.triggerUpdate();
|
||||||
await CloseThemeCreator({ restoreTheme: false });
|
await closeThemeCreator({ restoreTheme: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitThemeToCommunity() {
|
async function submitThemeToCommunity() {
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
await themeManager.setTheme(themeClone.id);
|
await themeManager.setTheme(themeClone.id);
|
||||||
await submitLocalThemeToCommunity(themeClone, theme.description?.trim() || undefined);
|
await submitLocalThemeToCommunity(themeClone, theme.description?.trim() || undefined);
|
||||||
themeUpdates.triggerUpdate();
|
themeUpdates.triggerUpdate();
|
||||||
await CloseThemeCreator({ restoreTheme: false });
|
await closeThemeCreator({ restoreTheme: false });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
communityError = formatCustomThemeApiError(err);
|
communityError = formatCustomThemeApiError(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -517,7 +517,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg p-2 text-zinc-500 transition hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
class="rounded-lg p-2 text-zinc-500 transition hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
||||||
aria-label="Close theme creator"
|
aria-label="Close theme creator"
|
||||||
onclick={() => void CloseThemeCreator()}
|
onclick={() => void closeThemeCreator()}
|
||||||
>
|
>
|
||||||
<XIcon size="1em" />
|
<XIcon size="1em" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
insertMenuItemAfterKey,
|
insertMenuItemAfterKey,
|
||||||
} from "@/seqta/utils/openers/analyticsMenuOrder";
|
} from "@/seqta/utils/openers/analyticsMenuOrder";
|
||||||
import { processMenuItemNode } from "@/seqta/utils/sidebarMenuIcons";
|
import { processMenuItemNode } from "@/seqta/utils/sidebarMenuIcons";
|
||||||
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||||
@@ -72,7 +72,7 @@ export async function injectAnalyticsMenuItem(): Promise<() => void> {
|
|||||||
|
|
||||||
ensureAnalyticsMenuOrder();
|
ensureAnalyticsMenuOrder();
|
||||||
if (settingsState.menuorder.length > 0) {
|
if (settingsState.menuorder.length > 0) {
|
||||||
ChangeMenuItemPositions(settingsState.menuorder);
|
changeMenuItemPositions(settingsState.menuorder);
|
||||||
}
|
}
|
||||||
processMenuItemNode(analyticsItem);
|
processMenuItemNode(analyticsItem);
|
||||||
applyMenuItemVisibility();
|
applyMenuItemVisibility();
|
||||||
|
|||||||
@@ -234,10 +234,10 @@ export class ThemeManager {
|
|||||||
const creatorSession = readThemeCreatorSession();
|
const creatorSession = readThemeCreatorSession();
|
||||||
if (creatorSession.open) {
|
if (creatorSession.open) {
|
||||||
verboseDebug("[BetterSEQTA+] ThemeManager: Restoring theme creator after navigation");
|
verboseDebug("[BetterSEQTA+] ThemeManager: Restoring theme creator after navigation");
|
||||||
const { OpenThemeCreator, isThemeCreatorOpen } =
|
const { openThemeCreator, isThemeCreatorOpen } =
|
||||||
await import("@/plugins/built-in/themes/themeCreator");
|
await import("@/plugins/built-in/themes/themeCreator");
|
||||||
if (!isThemeCreatorOpen()) {
|
if (!isThemeCreatorOpen()) {
|
||||||
void OpenThemeCreator(creatorSession.editingThemeId);
|
void openThemeCreator(creatorSession.editingThemeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ let currentWidthPx = 400;
|
|||||||
/**
|
/**
|
||||||
* Open the interactive theme builder docked to the right of the SEQTA page (not inside settings).
|
* Open the interactive theme builder docked to the right of the SEQTA page (not inside settings).
|
||||||
*/
|
*/
|
||||||
export async function OpenThemeCreator(themeID: string = "") {
|
export async function openThemeCreator(themeID: string = "") {
|
||||||
await CloseThemeCreator();
|
await closeThemeCreator();
|
||||||
|
|
||||||
themeBuilderPanel.open(themeID || null);
|
themeBuilderPanel.open(themeID || null);
|
||||||
persistThemeCreatorSession(themeID || null);
|
persistThemeCreatorSession(themeID || null);
|
||||||
@@ -96,7 +96,7 @@ function positionResizeBar(widthPx: number, resizeBar: HTMLDivElement) {
|
|||||||
resizeBar.style.right = `${widthPx - 2.5}px`;
|
resizeBar.style.right = `${widthPx - 2.5}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function CloseThemeCreator(options?: { restoreTheme?: boolean }) {
|
export async function closeThemeCreator(options?: { restoreTheme?: boolean }) {
|
||||||
const themeManager = ThemeManager.getInstance();
|
const themeManager = ThemeManager.getInstance();
|
||||||
if (options?.restoreTheme === false) {
|
if (options?.restoreTheme === false) {
|
||||||
themeManager.discardThemeCreatorRestore();
|
themeManager.discardThemeCreatorRestore();
|
||||||
|
|||||||
+22
-22
@@ -1,5 +1,5 @@
|
|||||||
import { getCkeditorGlobal } from "@/seqta/utils/ckeditorGlobal";
|
import { getCkeditorGlobal } from "@/seqta/utils/ckeditorGlobal";
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
import { delay } from "@/seqta/utils/delay";
|
import { delay } from "@/seqta/utils/delay";
|
||||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||||
@@ -17,13 +17,13 @@ import { eventManager } from "@/seqta/utils/listeners/eventManager";
|
|||||||
import debounce from "@/seqta/utils/debounce";
|
import debounce from "@/seqta/utils/debounce";
|
||||||
|
|
||||||
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
||||||
import RegisterClickListeners from "@/seqta/utils/listeners/clickListeners";
|
import registerClickListeners from "@/seqta/utils/listeners/clickListeners";
|
||||||
import { AddBetterSEQTAElements } from "@/seqta/ui/addBetterSEQTAElements";
|
import { addBetterSEQTAElements } from "@/seqta/ui/addBetterSEQTAElements";
|
||||||
import { updateAllColors } from "@/seqta/ui/colors/colorManager";
|
import { updateAllColors } from "@/seqta/ui/colors/colorManager";
|
||||||
import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
||||||
import { verboseInfo, verboseLog } from "@/utils/verboseLog";
|
import { verboseInfo, verboseLog } from "@/utils/verboseLog";
|
||||||
import loading, { stopLoadingAnimation } from "@/seqta/ui/loading";
|
import loading, { stopLoadingAnimation } from "@/seqta/ui/loading";
|
||||||
import { SendNewsPage } from "@/seqta/utils/sendNewsPage";
|
import { sendNewsPage } from "@/seqta/utils/sendNewsPage";
|
||||||
import { getEngageRoutePage } from "@/seqta/utils/engageRoute";
|
import { getEngageRoutePage } from "@/seqta/utils/engageRoute";
|
||||||
import {
|
import {
|
||||||
loadEngageHomePage,
|
loadEngageHomePage,
|
||||||
@@ -32,7 +32,7 @@ import {
|
|||||||
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
||||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||||
import { runStartupPopupQueue } from "@/seqta/utils/openers/startupPopupQueue";
|
import { runStartupPopupQueue } from "@/seqta/utils/openers/startupPopupQueue";
|
||||||
import { OpenCoursesAssessmentsFixPopup } from "@/seqta/utils/openers/openCoursesAssessmentsFixPopup";
|
import { openCoursesAssessmentsFixPopup } from "@/seqta/utils/openers/openCoursesAssessmentsFixPopup";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
syncTimetableUrlMonitoring,
|
syncTimetableUrlMonitoring,
|
||||||
@@ -108,7 +108,7 @@ export async function finishLoad() {
|
|||||||
void runStartupPopupQueue();
|
void runStartupPopupQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetCSSElement(file: string) {
|
export function getCSSElement(file: string) {
|
||||||
const cssFile = resolveExtensionAssetUrl(file);
|
const cssFile = resolveExtensionAssetUrl(file);
|
||||||
const fileref = document.createElement("link");
|
const fileref = document.createElement("link");
|
||||||
fileref.setAttribute("rel", "stylesheet");
|
fileref.setAttribute("rel", "stylesheet");
|
||||||
@@ -182,7 +182,7 @@ function applyDarkModeToIframe(iframe: HTMLIFrameElement, cssLink: HTMLStyleElem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SortMessagePageItems() {
|
function sortMessagePageItems() {
|
||||||
try {
|
try {
|
||||||
const filterbutton = document.createElement("div");
|
const filterbutton = document.createElement("div");
|
||||||
filterbutton.classList.add("messages-filterbutton");
|
filterbutton.classList.add("messages-filterbutton");
|
||||||
@@ -195,8 +195,8 @@ function SortMessagePageItems() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function LoadPageElements(): Promise<void> {
|
async function loadPageElements(): Promise<void> {
|
||||||
await AddBetterSEQTAElements();
|
await addBetterSEQTAElements();
|
||||||
if (!isFeatureDisabled("ui.sidebar.styled")) {
|
if (!isFeatureDisabled("ui.sidebar.styled")) {
|
||||||
void import("@/seqta/ui/sidebar/applyNativeSidebar").then((mod) => {
|
void import("@/seqta/ui/sidebar/applyNativeSidebar").then((mod) => {
|
||||||
void mod.applyNativeSidebar();
|
void mod.applyNativeSidebar();
|
||||||
@@ -222,7 +222,7 @@ async function LoadPageElements(): Promise<void> {
|
|||||||
|
|
||||||
eventManager.register("messagesAdded", { selector: "div.messages" }, handleMessages);
|
eventManager.register("messagesAdded", { selector: "div.messages" }, handleMessages);
|
||||||
|
|
||||||
eventManager.register("noticesAdded", { selector: "div.notices" }, CheckNoticeTextColour);
|
eventManager.register("noticesAdded", { selector: "div.notices" }, checkNoticeTextColour);
|
||||||
|
|
||||||
eventManager.register("dashboardAdded", { selector: "div.dashboard" }, handleDashboard);
|
eventManager.register("dashboardAdded", { selector: "div.dashboard" }, handleDashboard);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ async function LoadPageElements(): Promise<void> {
|
|||||||
|
|
||||||
eventManager.register("noticesAdded", { selector: "div.notice" }, handleNotices);
|
eventManager.register("noticesAdded", { selector: "div.notice" }, handleNotices);
|
||||||
|
|
||||||
RegisterClickListeners();
|
registerClickListeners();
|
||||||
|
|
||||||
await handleSublink(sublink);
|
await handleSublink(sublink);
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ async function handleNewsPage(): Promise<void> {
|
|||||||
|
|
||||||
verboseInfo("[BetterSEQTA+] Started Init");
|
verboseInfo("[BetterSEQTA+] Started Init");
|
||||||
try {
|
try {
|
||||||
await SendNewsPage();
|
await sendNewsPage();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[BetterSEQTA+] Failed to load news page:", error);
|
console.error("[BetterSEQTA+] Failed to load news page:", error);
|
||||||
}
|
}
|
||||||
@@ -365,7 +365,7 @@ async function handleMessages(node: Element): Promise<void> {
|
|||||||
if (legacy instanceof HTMLElement) legacy.innerText = titleText;
|
if (legacy instanceof HTMLElement) legacy.innerText = titleText;
|
||||||
}
|
}
|
||||||
document.title = "Direct Messages ― SEQTA Learn";
|
document.title = "Direct Messages ― SEQTA Learn";
|
||||||
SortMessagePageItems();
|
sortMessagePageItems();
|
||||||
|
|
||||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||||
|
|
||||||
@@ -476,7 +476,7 @@ let noticeColourObserver: MutationObserver | null = null;
|
|||||||
|
|
||||||
const adjustNoticeColor = (node: Element) => {
|
const adjustNoticeColor = (node: Element) => {
|
||||||
const hex = (node as HTMLElement).style.cssText.split(" ")[1];
|
const hex = (node as HTMLElement).style.cssText.split(" ")[1];
|
||||||
if (!hex || !settingsState.DarkMode || GetThresholdOfColor(hex.slice(0, -1)) >= 100) return;
|
if (!hex || !settingsState.DarkMode || getThresholdOfColor(hex.slice(0, -1)) >= 100) return;
|
||||||
(node as HTMLElement).style.cssText = "--color: undefined;";
|
(node as HTMLElement).style.cssText = "--color: undefined;";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ const scanAddedNotices = debounce((mutations: MutationRecord[]) => {
|
|||||||
for (const node of m.addedNodes) if (node instanceof Element) scanNotices(node);
|
for (const node of m.addedNodes) if (node instanceof Element) scanNotices(node);
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
function CheckNoticeTextColour(notice: Element) {
|
function checkNoticeTextColour(notice: Element) {
|
||||||
scanNotices(notice);
|
scanNotices(notice);
|
||||||
if (noticeContainers.has(notice)) return;
|
if (noticeContainers.has(notice)) return;
|
||||||
if (!noticeColourObserver) {
|
if (!noticeColourObserver) {
|
||||||
@@ -571,10 +571,10 @@ export function tryLoad() {
|
|||||||
}
|
}
|
||||||
if (mode === "timeout") {
|
if (mode === "timeout") {
|
||||||
finishLoad();
|
finishLoad();
|
||||||
void waitForElm("#content").then(() => void LoadPageElements());
|
void waitForElm("#content").then(() => void loadPageElements());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await LoadPageElements();
|
await loadPageElements();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (document.readyState === "complete") {
|
if (document.readyState === "complete") {
|
||||||
@@ -605,7 +605,7 @@ export function tryLoad() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
waitForElm(".code", true, 50).then((elm: Element) => {
|
waitForElm(".code", true, 50).then((elm: Element) => {
|
||||||
if (!(elm as HTMLElement).innerText.includes("BetterSEQTA")) LoadPageElements();
|
if (!(elm as HTMLElement).innerText.includes("BetterSEQTA")) loadPageElements();
|
||||||
});
|
});
|
||||||
|
|
||||||
updateIframesWithDarkMode();
|
updateIframesWithDarkMode();
|
||||||
@@ -696,8 +696,8 @@ export function init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendElementsToDisabledPage();
|
appendElementsToDisabledPage();
|
||||||
OpenCoursesAssessmentsFixPopup();
|
openCoursesAssessmentsFixPopup();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDisabled = () => {
|
const handleDisabled = () => {
|
||||||
@@ -859,11 +859,11 @@ export function init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AppendElementsToDisabledPage() {
|
export function appendElementsToDisabledPage() {
|
||||||
if (document.getElementById("AddedSettings")) return;
|
if (document.getElementById("AddedSettings")) return;
|
||||||
|
|
||||||
verboseInfo("[BetterSEQTA+] Appending elements to disabled page");
|
verboseInfo("[BetterSEQTA+] Appending elements to disabled page");
|
||||||
AddBetterSEQTAElements();
|
addBetterSEQTAElements();
|
||||||
|
|
||||||
const settingsStyle = document.createElement("style");
|
const settingsStyle = document.createElement("style");
|
||||||
settingsStyle.innerHTML = /* css */ `
|
settingsStyle.innerHTML = /* css */ `
|
||||||
|
|||||||
+2
-2
@@ -107,8 +107,8 @@ async function init() {
|
|||||||
if (settingsState.onoff !== false && !isPaused()) {
|
if (settingsState.onoff !== false && !isPaused()) {
|
||||||
await main();
|
await main();
|
||||||
|
|
||||||
const { init: Monofile } = await import("@/plugins/monofile");
|
const { init: initMonofile } = await import("@/plugins/monofile");
|
||||||
Monofile();
|
initMonofile();
|
||||||
|
|
||||||
if (settingsState.onoff) {
|
if (settingsState.onoff) {
|
||||||
const { initializePlugins } = await import("@/plugins/index");
|
const { initializePlugins } = await import("@/plugins/index");
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings"
|
|||||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||||
import { loadEngageHomePage } from "@/seqta/utils/loaders/loadEngageHomePage";
|
import { loadEngageHomePage } from "@/seqta/utils/loaders/loadEngageHomePage";
|
||||||
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
||||||
import { SendNewsPage } from "@/seqta/utils/sendNewsPage";
|
import { sendNewsPage } from "@/seqta/utils/sendNewsPage";
|
||||||
import { attachNotificationsPanelAnimation } from "@/seqta/utils/attachNotificationsPanelAnimation";
|
import { attachNotificationsPanelAnimation } from "@/seqta/utils/attachNotificationsPanelAnimation";
|
||||||
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
|
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
|
||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
|
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { appendBackgroundToUI } from "./imageBackgrounds";
|
import { appendBackgroundToUI } from "./imageBackgrounds";
|
||||||
import { attachTooltip } from "@/seqta/utils/tooltip";
|
import { attachTooltip } from "@/seqta/utils/tooltip";
|
||||||
import { pageIcon } from "@/seqta/utils/pageIcons";
|
import { pageIcon } from "@/seqta/utils/pageIcons";
|
||||||
@@ -47,7 +47,7 @@ let sidebarAccessibilityListenersAttached = false;
|
|||||||
/** Marks menu rows that are off-screen in the drill stack (CSS blocks clicks). */
|
/** Marks menu rows that are off-screen in the drill stack (CSS blocks clicks). */
|
||||||
const BSPLUS_SIDEBAR_OFFSCREEN = "bsplus-sidebar-offscreen";
|
const BSPLUS_SIDEBAR_OFFSCREEN = "bsplus-sidebar-offscreen";
|
||||||
|
|
||||||
export async function AddBetterSEQTAElements() {
|
export async function addBetterSEQTAElements() {
|
||||||
if (isSeqtaEngageExperience()) {
|
if (isSeqtaEngageExperience()) {
|
||||||
await waitForElm("#content");
|
await waitForElm("#content");
|
||||||
addExtensionSettings();
|
addExtensionSettings();
|
||||||
@@ -217,7 +217,7 @@ async function updateStudentInfo(
|
|||||||
if (student.house_colour) {
|
if (student.house_colour) {
|
||||||
houseelement.style.background = student.house_colour;
|
houseelement.style.background = student.house_colour;
|
||||||
try {
|
try {
|
||||||
const colorresult = GetThresholdOfColor(student.house_colour);
|
const colorresult = getThresholdOfColor(student.house_colour);
|
||||||
houseelement.style.color = colorresult && colorresult > 300 ? "black" : "white";
|
houseelement.style.color = colorresult && colorresult > 300 ? "black" : "white";
|
||||||
} catch {
|
} catch {
|
||||||
// Invalid color format, leave text color as default
|
// Invalid color format, leave text color as default
|
||||||
@@ -263,7 +263,7 @@ function setupEventListeners() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
newsbutton?.addEventListener("click", () => {
|
newsbutton?.addEventListener("click", () => {
|
||||||
activateMenuAction(newsbutton, SendNewsPage);
|
activateMenuAction(newsbutton, sendNewsPage);
|
||||||
});
|
});
|
||||||
|
|
||||||
menuCover?.addEventListener("click", () => {
|
menuCover?.addEventListener("click", () => {
|
||||||
@@ -448,7 +448,7 @@ async function setupEngageSettingsButton() {
|
|||||||
observer.observe(content, { childList: true, subtree: !isPerformanceMode() });
|
observer.observe(content, { childList: true, subtree: !isPerformanceMode() });
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetLightDarkModeString() {
|
function getLightDarkModeString() {
|
||||||
return settingsState.DarkMode ? "Switch to light theme" : "Switch to dark theme";
|
return settingsState.DarkMode ? "Switch to light theme" : "Switch to dark theme";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ async function addDarkLightToggle(parent?: Element) {
|
|||||||
const toggleTarget = parent ?? document.getElementById("content")!;
|
const toggleTarget = parent ?? document.getElementById("content")!;
|
||||||
toggleTarget.append(
|
toggleTarget.append(
|
||||||
stringToHTML(/* html */ `
|
stringToHTML(/* html */ `
|
||||||
<button class="addedButton DarkLightButton" id="LightDarkModeButton" type="button" aria-label="${GetLightDarkModeString()}">
|
<button class="addedButton DarkLightButton" id="LightDarkModeButton" type="button" aria-label="${getLightDarkModeString()}">
|
||||||
${icon(settingsState.DarkMode ? Sun : Moon)}
|
${icon(settingsState.DarkMode ? Sun : Moon)}
|
||||||
</button>
|
</button>
|
||||||
`).firstChild!,
|
`).firstChild!,
|
||||||
@@ -485,7 +485,7 @@ async function addDarkLightToggle(parent?: Element) {
|
|||||||
updateAllColors();
|
updateAllColors();
|
||||||
|
|
||||||
lightDarkModeButtonElement.innerHTML = icon(settingsState.DarkMode ? Sun : Moon);
|
lightDarkModeButtonElement.innerHTML = icon(settingsState.DarkMode ? Sun : Moon);
|
||||||
lightDarkModeButtonElement.setAttribute("aria-label", GetLightDarkModeString());
|
lightDarkModeButtonElement.setAttribute("aria-label", getLightDarkModeString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function adjustLuminance(color: string, lum: number) {
|
|||||||
return adjustedColor.string();
|
return adjustedColor.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ColorLuminance(color: string, lum = 0) {
|
export default function colorLuminance(color: string, lum = 0) {
|
||||||
if (color == "" || color == null) {
|
if (color == "" || color == null) {
|
||||||
// light cyan blue
|
// light cyan blue
|
||||||
return "#00bfff";
|
return "#00bfff";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Color from "color";
|
import Color from "color";
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { lightenAndPaleColor } from "./lightenAndPaleColor";
|
import { lightenAndPaleColor } from "./lightenAndPaleColor";
|
||||||
import ColorLuminance from "./colorLuminance";
|
import colorLuminance from "./colorLuminance";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||||
import { getAdaptiveColour } from "@/seqta/utils/adaptiveThemeColour";
|
import { getAdaptiveColour } from "@/seqta/utils/adaptiveThemeColour";
|
||||||
import { adaptiveThemeTransitionEnabled, transparencyEnabled } from "@/seqta/utils/performanceMode";
|
import { adaptiveThemeTransitionEnabled, transparencyEnabled } from "@/seqta/utils/performanceMode";
|
||||||
@@ -153,11 +153,11 @@ function applyColorsWith(selectedColor: string) {
|
|||||||
applyBetterseqtaLogoBackground(settingsState.DarkMode);
|
applyBetterseqtaLogoBackground(settingsState.DarkMode);
|
||||||
|
|
||||||
// Dynamic properties, always applied
|
// Dynamic properties, always applied
|
||||||
const rgbThreshold = GetThresholdOfColor(selectedColor);
|
const rgbThreshold = getThresholdOfColor(selectedColor);
|
||||||
const isBright = rgbThreshold > 210;
|
const isBright = rgbThreshold > 210;
|
||||||
const dynamicProps = {
|
const dynamicProps = {
|
||||||
"--text-color": isBright ? "black" : "white",
|
"--text-color": isBright ? "black" : "white",
|
||||||
"--better-light": selectedColor === "#ffffff" ? "#b7b7b7" : ColorLuminance(selectedColor, 0.95),
|
"--better-light": selectedColor === "#ffffff" ? "#b7b7b7" : colorLuminance(selectedColor, 0.95),
|
||||||
};
|
};
|
||||||
|
|
||||||
const cssVars: Record<string, string> = { ...commonProps, ...dynamicProps };
|
const cssVars: Record<string, string> = { ...commonProps, ...dynamicProps };
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Color from "color";
|
import Color from "color";
|
||||||
export function GetThresholdOfColor(color: string) {
|
export function getThresholdOfColor(color: string) {
|
||||||
if (!color) return 0;
|
if (!color) return 0;
|
||||||
// Case-insensitive regular expression for matching RGBA colors
|
// Case-insensitive regular expression for matching RGBA colors
|
||||||
const rgbaRegex = /rgba?\(([^)]+)\)/gi;
|
const rgbaRegex = /rgba?\(([^)]+)\)/gi;
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ function startCanvasForRoot(host: HTMLElement, shadow: ShadowRoot, variant: Load
|
|||||||
stopCanvas = canvas ? startLoadingCanvas(canvas, host, variant) : null;
|
stopCanvas = canvas ? startLoadingCanvas(canvas, host, variant) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AppendLoadingSymbol(givenID: string, position: string) {
|
export function appendLoadingSymbol(givenID: string, position: string) {
|
||||||
const loadingsymbol = stringToHTML(/* html */ `
|
const loadingsymbol = stringToHTML(/* html */ `
|
||||||
<div id="${givenID}" class="bkloading-inline">
|
<div id="${givenID}" class="bkloading-inline">
|
||||||
${loadingSpinner}
|
${loadingSpinner}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ async function openThemesDestination(view: "store" | "community"): Promise<void>
|
|||||||
await openSettingsPopup();
|
await openSettingsPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function OpenStorePage(): Promise<void> {
|
export async function openStorePage(): Promise<void> {
|
||||||
await openThemesDestination("store");
|
await openThemesDestination("store");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function OpenCommunityThemesPage(): Promise<void> {
|
export async function openCommunityThemesPage(): Promise<void> {
|
||||||
await openThemesDestination("community");
|
await openThemesDestination("community");
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,9 @@ export function addShortcuts(shortcuts: Shortcut[]) {
|
|||||||
const currentShortcut = shortcuts[i];
|
const currentShortcut = shortcuts[i];
|
||||||
|
|
||||||
if (currentShortcut?.enabled) {
|
if (currentShortcut?.enabled) {
|
||||||
const Itemname = (currentShortcut?.name ?? "").replace(/\s/g, "");
|
const itemName = (currentShortcut?.name ?? "").replace(/\s/g, "");
|
||||||
|
|
||||||
const linkDetails = ShortcutLinks?.[Itemname as keyof typeof ShortcutLinks];
|
const linkDetails = ShortcutLinks?.[itemName as keyof typeof ShortcutLinks];
|
||||||
if (linkDetails) {
|
if (linkDetails) {
|
||||||
createNewShortcut(
|
createNewShortcut(
|
||||||
linkDetails.link,
|
linkDetails.link,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function isSafeShortcutHref(url: string): boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CreateCustomShortcutDiv(element: CustomShortcut) {
|
export function createCustomShortcutDiv(element: CustomShortcut) {
|
||||||
const container = document.getElementById("shortcuts");
|
const container = document.getElementById("shortcuts");
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function CreateElement(
|
export function createElement(
|
||||||
type: string,
|
type: string,
|
||||||
class_?: string,
|
class_?: string,
|
||||||
id?: string,
|
id?: string,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/** Close settings (if open) and mount the theme builder on the SEQTA page body. */
|
/** Close settings (if open) and mount the theme builder on the SEQTA page body. */
|
||||||
export async function launchPageThemeBuilder(themeId?: string): Promise<void> {
|
export async function launchPageThemeBuilder(themeId?: string): Promise<void> {
|
||||||
const { closeExtensionPopup } = await import("@/seqta/utils/closers/closeExtensionPopup");
|
const { closeExtensionPopup } = await import("@/seqta/utils/closers/closeExtensionPopup");
|
||||||
const { OpenThemeCreator } = await import("@/plugins/built-in/themes/themeCreator");
|
const { openThemeCreator } = await import("@/plugins/built-in/themes/themeCreator");
|
||||||
|
|
||||||
closeExtensionPopup();
|
closeExtensionPopup();
|
||||||
await OpenThemeCreator(themeId ?? "");
|
await openThemeCreator(themeId ?? "");
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import browser from "@/lib/browser";
|
import browser from "@/lib/browser";
|
||||||
|
|
||||||
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
||||||
import { OpenMenuOptions } from "@/seqta/utils/openers/openMenuOptions";
|
import { openMenuOptions } from "@/seqta/utils/openers/openMenuOptions";
|
||||||
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||||
|
|
||||||
import sendThemeUpdate from "@/seqta/utils/sendThemeUpdate";
|
import sendThemeUpdate from "@/seqta/utils/sendThemeUpdate";
|
||||||
@@ -119,8 +119,8 @@ export class MessageHandler {
|
|||||||
|
|
||||||
case "OpenThemeCreator": {
|
case "OpenThemeCreator": {
|
||||||
const themeID = request?.body?.themeID;
|
const themeID = request?.body?.themeID;
|
||||||
void import("@/plugins/built-in/themes/themeCreator").then(({ OpenThemeCreator }) => {
|
void import("@/plugins/built-in/themes/themeCreator").then(({ openThemeCreator }) => {
|
||||||
void OpenThemeCreator(themeID ? String(themeID) : "");
|
void openThemeCreator(themeID ? String(themeID) : "");
|
||||||
});
|
});
|
||||||
closeExtensionPopup();
|
closeExtensionPopup();
|
||||||
sendResponse({ status: "success" });
|
sendResponse({ status: "success" });
|
||||||
@@ -136,9 +136,9 @@ export class MessageHandler {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "CloseThemeCreator":
|
case "CloseThemeCreator":
|
||||||
void import("@/plugins/built-in/themes/themeCreator").then(({ CloseThemeCreator }) => {
|
void import("@/plugins/built-in/themes/themeCreator").then(({ closeThemeCreator }) => {
|
||||||
try {
|
try {
|
||||||
CloseThemeCreator();
|
closeThemeCreator();
|
||||||
sendResponse({ status: "success" });
|
sendResponse({ status: "success" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error closing theme creator:", error);
|
console.error("Error closing theme creator:", error);
|
||||||
@@ -159,7 +159,7 @@ export class MessageHandler {
|
|||||||
|
|
||||||
editSidebar() {
|
editSidebar() {
|
||||||
if (!isMenuOptionsOpen()) {
|
if (!isMenuOptionsOpen()) {
|
||||||
OpenMenuOptions();
|
openMenuOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ jest.mock("@/seqta/utils/menuItemVisibility", () => ({
|
|||||||
scheduleMenuItemVisibility: jest.fn(),
|
scheduleMenuItemVisibility: jest.fn(),
|
||||||
}));
|
}));
|
||||||
jest.mock("@/seqta/utils/openers/menuOrder", () => ({
|
jest.mock("@/seqta/utils/openers/menuOrder", () => ({
|
||||||
ChangeMenuItemPositions: jest.fn(),
|
changeMenuItemPositions: jest.fn(),
|
||||||
}));
|
}));
|
||||||
jest.mock("@/seqta/utils/performanceMode", () => ({
|
jest.mock("@/seqta/utils/performanceMode", () => ({
|
||||||
syncPerformanceModeEffects: jest.fn(),
|
syncPerformanceModeEffects: jest.fn(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
|||||||
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
||||||
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/loadHomePage";
|
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/loadHomePage";
|
||||||
import { scheduleMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
import { scheduleMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
||||||
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
import { syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
|
import { syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
|
||||||
|
|
||||||
import type { CustomShortcut } from "@/types/storage";
|
import type { CustomShortcut } from "@/types/storage";
|
||||||
@@ -41,7 +41,7 @@ export class StorageChangeHandler {
|
|||||||
settingsState.register("menuitems", () => scheduleMenuItemVisibility());
|
settingsState.register("menuitems", () => scheduleMenuItemVisibility());
|
||||||
settingsState.register("menuorder", (order) => {
|
settingsState.register("menuorder", (order) => {
|
||||||
if (Array.isArray(order) && order.length > 0) {
|
if (Array.isArray(order) && order.length > 0) {
|
||||||
ChangeMenuItemPositions(order);
|
changeMenuItemPositions(order);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { BookOpen, ChevronLeft, ChevronRight, ClipboardList } from "lucide-stati
|
|||||||
import { animate, stagger } from "motion";
|
import { animate, stagger } from "motion";
|
||||||
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { convertTo12HourFormat } from "../convertTo12HourFormat";
|
import { convertTo12HourFormat } from "../convertTo12HourFormat";
|
||||||
import { delay } from "../delay";
|
import { delay } from "../delay";
|
||||||
import { settingsState } from "../listeners/settingsState";
|
import { settingsState } from "../listeners/settingsState";
|
||||||
import stringToHTML from "../stringToHTML";
|
import stringToHTML from "../stringToHTML";
|
||||||
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
||||||
import { CreateElement } from "@/seqta/utils/createEnable/createElement";
|
import { createElement } from "@/seqta/utils/createEnable/createElement";
|
||||||
import { setupTooltips } from "@/seqta/utils/tooltip";
|
import { setupTooltips } from "@/seqta/utils/tooltip";
|
||||||
import { verboseInfo } from "@/utils/verboseLog";
|
import { verboseInfo } from "@/utils/verboseLog";
|
||||||
import { getUserInfo } from "@/seqta/utils/userInfo";
|
import { getUserInfo } from "@/seqta/utils/userInfo";
|
||||||
@@ -126,8 +126,8 @@ export async function loadHomePage() {
|
|||||||
const TodayFormatted = formatDate(new Date());
|
const TodayFormatted = formatDate(new Date());
|
||||||
|
|
||||||
const [assessments, classes, prefs] = await Promise.all([
|
const [assessments, classes, prefs] = await Promise.all([
|
||||||
GetUpcomingAssessments(),
|
getUpcomingAssessments(),
|
||||||
GetActiveClasses(),
|
getActiveClasses(),
|
||||||
fetch(`${location.origin}/seqta/student/load/prefs?`, {
|
fetch(`${location.origin}/seqta/student/load/prefs?`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
@@ -144,7 +144,7 @@ export async function loadHomePage() {
|
|||||||
|
|
||||||
const upcomingItems = document.getElementById("upcoming-items");
|
const upcomingItems = document.getElementById("upcoming-items");
|
||||||
if (upcomingItems) {
|
if (upcomingItems) {
|
||||||
await CreateUpcomingSection(currentAssessments, activeSubjects);
|
await createUpcomingSection(currentAssessments, activeSubjects);
|
||||||
upcomingItems.classList.remove("loading");
|
upcomingItems.classList.remove("loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,14 +185,14 @@ async function renderHomeUpcomingAssessments() {
|
|||||||
upcomingItems.classList.add("loading");
|
upcomingItems.classList.add("loading");
|
||||||
upcomingItems.innerHTML = "";
|
upcomingItems.innerHTML = "";
|
||||||
|
|
||||||
const [assessments, classes] = await Promise.all([GetUpcomingAssessments(), GetActiveClasses()]);
|
const [assessments, classes] = await Promise.all([getUpcomingAssessments(), getActiveClasses()]);
|
||||||
|
|
||||||
const activeSubjects = activeSubjectsFromLearnPayload(classes);
|
const activeSubjects = activeSubjectsFromLearnPayload(classes);
|
||||||
const currentAssessments = filterAssessmentsForActiveSubjects(assessments, activeSubjects).sort(
|
const currentAssessments = filterAssessmentsForActiveSubjects(assessments, activeSubjects).sort(
|
||||||
comparedate,
|
comparedate,
|
||||||
) as HomeUpcomingAssessment[];
|
) as HomeUpcomingAssessment[];
|
||||||
|
|
||||||
await CreateUpcomingSection(currentAssessments, activeSubjects);
|
await createUpcomingSection(currentAssessments, activeSubjects);
|
||||||
upcomingItems.classList.remove("loading");
|
upcomingItems.classList.remove("loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ export function registerHomeUpcomingSettingsListeners() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetUpcomingAssessments() {
|
async function getUpcomingAssessments() {
|
||||||
try {
|
try {
|
||||||
const { id: student } = await getUserInfo();
|
const { id: student } = await getUserInfo();
|
||||||
const response = await fetch(`${location.origin}/seqta/student/assessment/list/upcoming?`, {
|
const response = await fetch(`${location.origin}/seqta/student/assessment/list/upcoming?`, {
|
||||||
@@ -244,7 +244,7 @@ function setupTimetableListeners() {
|
|||||||
currentSelectedDate.setDate(currentSelectedDate.getDate() + value);
|
currentSelectedDate.setDate(currentSelectedDate.getDate() + value);
|
||||||
const formattedDate = formatDate(currentSelectedDate);
|
const formattedDate = formatDate(currentSelectedDate);
|
||||||
callHomeTimetable(formattedDate, true);
|
callHomeTimetable(formattedDate, true);
|
||||||
SetTimetableSubtitle();
|
setTimetableSubtitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
const backHandler = () => changeTimetable(-1);
|
const backHandler = () => changeTimetable(-1);
|
||||||
@@ -268,7 +268,7 @@ function formatDate(date: Date): string {
|
|||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetActiveClasses() {
|
async function getActiveClasses() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${location.origin}/seqta/student/load/subjects?`, {
|
const response = await fetch(`${location.origin}/seqta/student/load/subjects?`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -314,7 +314,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
|||||||
a.from.localeCompare(b.from),
|
a.from.localeCompare(b.from),
|
||||||
);
|
);
|
||||||
|
|
||||||
GetLessonColours().then((colours) => {
|
getLessonColours().then((colours) => {
|
||||||
for (let i = 0; i < lessonArray.length; i++) {
|
for (let i = 0; i < lessonArray.length; i++) {
|
||||||
const subjectname =
|
const subjectname =
|
||||||
lessonArray[i].type == "tutorial"
|
lessonArray[i].type == "tutorial"
|
||||||
@@ -326,7 +326,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
|||||||
lessonArray[i].colour = "--item-colour: #8e8e8e;";
|
lessonArray[i].colour = "--item-colour: #8e8e8e;";
|
||||||
} else {
|
} else {
|
||||||
lessonArray[i].colour = `--item-colour: ${subject.value};`;
|
lessonArray[i].colour = `--item-colour: ${subject.value};`;
|
||||||
if (GetThresholdOfColor(subject.value) > 300) {
|
if (getThresholdOfColor(subject.value) > 300) {
|
||||||
lessonArray[i].invert = true;
|
lessonArray[i].invert = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
|||||||
lessonArray[i].until = convertTo12HourFormat(lessonArray[i].until);
|
lessonArray[i].until = convertTo12HourFormat(lessonArray[i].until);
|
||||||
}
|
}
|
||||||
|
|
||||||
lessonArray[i].attendanceTitle = CheckUnmarkedAttendance(lessonArray[i].attendance);
|
lessonArray[i].attendanceTitle = checkUnmarkedAttendance(lessonArray[i].attendance);
|
||||||
}
|
}
|
||||||
|
|
||||||
DayContainer.innerText = "";
|
DayContainer.innerText = "";
|
||||||
@@ -356,9 +356,9 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
|||||||
const today = new Date();
|
const today = new Date();
|
||||||
if (currentSelectedDate.getDate() == today.getDate()) {
|
if (currentSelectedDate.getDate() == today.getDate()) {
|
||||||
for (let i = 0; i < lessonArray.length; i++) {
|
for (let i = 0; i < lessonArray.length; i++) {
|
||||||
CheckCurrentLesson(lessonArray[i], i + 1);
|
checkCurrentLesson(lessonArray[i], i + 1);
|
||||||
}
|
}
|
||||||
CheckCurrentLessonAll(lessonArray);
|
checkCurrentLessonAll(lessonArray);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -376,16 +376,16 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckCurrentLessonAll(lessons: HomeTimetableLesson[]) {
|
function checkCurrentLessonAll(lessons: HomeTimetableLesson[]) {
|
||||||
clearLessonInterval();
|
clearLessonInterval();
|
||||||
lessonInterval = setInterval(() => {
|
lessonInterval = setInterval(() => {
|
||||||
for (let i = 0; i < lessons.length; i++) {
|
for (let i = 0; i < lessons.length; i++) {
|
||||||
CheckCurrentLesson(lessons[i], i + 1);
|
checkCurrentLesson(lessons[i], i + 1);
|
||||||
}
|
}
|
||||||
}, 60000);
|
}, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function CheckCurrentLesson(lesson: HomeTimetableLesson, num: number) {
|
async function checkCurrentLesson(lesson: HomeTimetableLesson, num: number) {
|
||||||
const { from: startTime, until: endTime, code, description, room, staff } = lesson;
|
const { from: startTime, until: endTime, code, description, room, staff } = lesson;
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ function buildAssessmentURL(
|
|||||||
: `${base}${programmeID}:${metaID}`;
|
: `${base}${programmeID}:${metaID}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckUnmarkedAttendance(lessonattendance: { label?: string } | null | undefined) {
|
function checkUnmarkedAttendance(lessonattendance: { label?: string } | null | undefined) {
|
||||||
return lessonattendance ? lessonattendance.label : " ";
|
return lessonattendance ? lessonattendance.label : " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +559,7 @@ function applyHomeUpcomingLimits(
|
|||||||
assessments.splice(0, assessments.length, ...limited);
|
assessments.splice(0, assessments.length, ...limited);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function CreateUpcomingSection(
|
async function createUpcomingSection(
|
||||||
assessments: HomeUpcomingAssessment[],
|
assessments: HomeUpcomingAssessment[],
|
||||||
activeSubjects: ActiveSubjectLike[],
|
activeSubjects: ActiveSubjectLike[],
|
||||||
) {
|
) {
|
||||||
@@ -580,7 +580,7 @@ async function CreateUpcomingSection(
|
|||||||
|
|
||||||
applyHomeUpcomingLimits(assessments, activeSubjects);
|
applyHomeUpcomingLimits(assessments, activeSubjects);
|
||||||
|
|
||||||
const colours = await GetLessonColours();
|
const colours = await getLessonColours();
|
||||||
|
|
||||||
for (let i = 0; i < assessments.length; i++) {
|
for (let i = 0; i < assessments.length; i++) {
|
||||||
const subject = colours.find(
|
const subject = colours.find(
|
||||||
@@ -598,7 +598,7 @@ async function CreateUpcomingSection(
|
|||||||
const element = assessments[i];
|
const element = assessments[i];
|
||||||
if (!upcomingDates[element.due]) {
|
if (!upcomingDates[element.due]) {
|
||||||
const dateObj: UpcomingDateBucket = {
|
const dateObj: UpcomingDateBucket = {
|
||||||
div: CreateElement("div", "upcoming-date-container") as HTMLElement,
|
div: createElement("div", "upcoming-date-container") as HTMLElement,
|
||||||
assessments: [],
|
assessments: [],
|
||||||
};
|
};
|
||||||
upcomingDates[element.due] = dateObj;
|
upcomingDates[element.due] = dateObj;
|
||||||
@@ -609,7 +609,7 @@ async function CreateUpcomingSection(
|
|||||||
|
|
||||||
for (const date in upcomingDates) {
|
for (const date in upcomingDates) {
|
||||||
const assessmentdue = new Date(upcomingDates[date].assessments[0].due);
|
const assessmentdue = new Date(upcomingDates[date].assessments[0].due);
|
||||||
const specialcase = CheckSpecialDay(Today, assessmentdue);
|
const specialcase = checkSpecialDay(Today, assessmentdue);
|
||||||
const assessmentDate = createAssessmentDateDiv(
|
const assessmentDate = createAssessmentDateDiv(
|
||||||
date,
|
date,
|
||||||
upcomingDates[date],
|
upcomingDates[date],
|
||||||
@@ -721,7 +721,7 @@ function createAssessmentDateDiv(
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckSpecialDay(date1: Date, date2: Date) {
|
function checkSpecialDay(date1: Date, date2: Date) {
|
||||||
if (
|
if (
|
||||||
date1.getFullYear() === date2.getFullYear() &&
|
date1.getFullYear() === date2.getFullYear() &&
|
||||||
date1.getMonth() === date2.getMonth() &&
|
date1.getMonth() === date2.getMonth() &&
|
||||||
@@ -745,7 +745,7 @@ function CheckSpecialDay(date1: Date, date2: Date) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetLessonColours() {
|
async function getLessonColours() {
|
||||||
try {
|
try {
|
||||||
const { id: user } = await getUserInfo();
|
const { id: user } = await getUserInfo();
|
||||||
const response = await fetch(`${location.origin}/seqta/student/load/prefs?`, {
|
const response = await fetch(`${location.origin}/seqta/student/load/prefs?`, {
|
||||||
@@ -760,7 +760,7 @@ async function GetLessonColours() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetTimetableSubtitle() {
|
function setTimetableSubtitle() {
|
||||||
const homelessonsubtitle = document.getElementById("home-lesson-subtitle");
|
const homelessonsubtitle = document.getElementById("home-lesson-subtitle");
|
||||||
if (!homelessonsubtitle) return;
|
if (!homelessonsubtitle) return;
|
||||||
homelessonsubtitle.innerText = lessonsSubtitleForViewDate(currentSelectedDate);
|
homelessonsubtitle.innerText = lessonsSubtitleForViewDate(currentSelectedDate);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { animate } from "motion";
|
import { animate } from "motion";
|
||||||
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { getMockNotices } from "@/seqta/ui/dev/hideSensitiveContent";
|
import { getMockNotices } from "@/seqta/ui/dev/hideSensitiveContent";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||||
import { noticeMatchesLabelFilter } from "@/seqta/utils/notices/noticeLabelFilters";
|
import { noticeMatchesLabelFilter } from "@/seqta/utils/notices/noticeLabelFilters";
|
||||||
@@ -109,7 +109,7 @@ function elementScale(el: HTMLElement) {
|
|||||||
|
|
||||||
export function processNoticeColor(colour: unknown): string | undefined {
|
export function processNoticeColor(colour: unknown): string | undefined {
|
||||||
if (typeof colour !== "string") return undefined;
|
if (typeof colour !== "string") return undefined;
|
||||||
const rgb = GetThresholdOfColor(colour);
|
const rgb = getThresholdOfColor(colour);
|
||||||
if (rgb < 100 && settingsState.DarkMode) return undefined;
|
if (rgb < 100 && settingsState.DarkMode) return undefined;
|
||||||
return colour;
|
return colour;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function consumePendingHighlightThemeId(): string | null {
|
|||||||
|
|
||||||
export async function openThemeStoreWithHighlight(themeId: string): Promise<void> {
|
export async function openThemeStoreWithHighlight(themeId: string): Promise<void> {
|
||||||
pendingHighlightThemeId = themeId;
|
pendingHighlightThemeId = themeId;
|
||||||
const { OpenStorePage } = await import("@/seqta/ui/renderStore");
|
const { openStorePage } = await import("@/seqta/ui/renderStore");
|
||||||
await OpenStorePage();
|
await openStorePage();
|
||||||
window.dispatchEvent(new CustomEvent("bsplus:highlight-theme", { detail: { themeId } }));
|
window.dispatchEvent(new CustomEvent("bsplus:highlight-theme", { detail: { themeId } }));
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Tiny flag module with no imports — breaks the OpenMenuOptions ↔ sidebarMenuIcons
|
* Tiny flag module with no imports — breaks the openMenuOptions ↔ sidebarMenuIcons
|
||||||
* cycle that caused Vite HMR: "does not provide an export named 'MenuOptionsOpen'".
|
* cycle that caused Vite HMR: "does not provide an export named 'MenuOptionsOpen'".
|
||||||
*/
|
*/
|
||||||
export let MenuOptionsOpen = false;
|
export let MenuOptionsOpen = false;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { SettingsState } from "@/types/storage";
|
import type { SettingsState } from "@/types/storage";
|
||||||
|
|
||||||
/** Reorder `#menu > ul` children to match a saved `menuorder` key list. */
|
/** Reorder `#menu > ul` children to match a saved `menuorder` key list. */
|
||||||
export function ChangeMenuItemPositions(menuorder: SettingsState["menuorder"]) {
|
export function changeMenuItemPositions(menuorder: SettingsState["menuorder"]) {
|
||||||
const menuRoot = document.querySelector("#menu")?.firstChild;
|
const menuRoot = document.querySelector("#menu")?.firstChild;
|
||||||
if (!menuRoot) return;
|
if (!menuRoot) return;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
|||||||
import brandingDark from "@/resources/branding/dark.jpg";
|
import brandingDark from "@/resources/branding/dark.jpg";
|
||||||
import brandingLight from "@/resources/branding/light.jpg";
|
import brandingLight from "@/resources/branding/light.jpg";
|
||||||
|
|
||||||
export function OpenAboutPage() {
|
export function openAboutPage() {
|
||||||
const header = stringToHTML(
|
const header = stringToHTML(
|
||||||
/* html */
|
/* html */
|
||||||
`<div class="whatsnewHeader">
|
`<div class="whatsnewHeader">
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ function setPopupButtonsDisabled(disabled: boolean) {
|
|||||||
if (dismiss) dismiss.disabled = disabled;
|
if (dismiss) dismiss.disabled = disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function OpenCoursesAssessmentsFixPopup(onDismissed?: () => void) {
|
export function openCoursesAssessmentsFixPopup(onDismissed?: () => void) {
|
||||||
if (document.getElementById("whatsnewbk")) {
|
if (document.getElementById("whatsnewbk")) {
|
||||||
onDismissed?.();
|
onDismissed?.();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function esc(value: string): string {
|
|||||||
.replace(/"/g, """);
|
.replace(/"/g, """);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function OpenFeedbackReplyPopup(
|
export function openFeedbackReplyPopup(
|
||||||
items: FeedbackStatusItem[],
|
items: FeedbackStatusItem[],
|
||||||
onDismissed?: () => void,
|
onDismissed?: () => void,
|
||||||
): void {
|
): void {
|
||||||
@@ -75,7 +75,7 @@ export async function maybeQueueFeedbackReplyPopup(): Promise<
|
|||||||
try {
|
try {
|
||||||
const items = await findPendingFeedbackWithReplies();
|
const items = await findPendingFeedbackWithReplies();
|
||||||
if (!items.length) return null;
|
if (!items.length) return null;
|
||||||
return (goNext) => OpenFeedbackReplyPopup(items, goNext);
|
return (goNext) => openFeedbackReplyPopup(items, goNext);
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { settingsState } from "../listeners/settingsState";
|
|||||||
import { applyMenuItemVisibility } from "../menuItemVisibility";
|
import { applyMenuItemVisibility } from "../menuItemVisibility";
|
||||||
import { ensureAnalyticsMenuOrder } from "@/seqta/utils/openers/analyticsMenuOrder";
|
import { ensureAnalyticsMenuOrder } from "@/seqta/utils/openers/analyticsMenuOrder";
|
||||||
import { isMenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
import { isMenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||||
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
import stringToHTML from "../stringToHTML";
|
import stringToHTML from "../stringToHTML";
|
||||||
import Sortable from "sortablejs";
|
import Sortable from "sortablejs";
|
||||||
|
|
||||||
export { MenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
export { MenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||||
export { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
export { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
|
|
||||||
function escapeHtmlAttr(value: string): string {
|
function escapeHtmlAttr(value: string): string {
|
||||||
return value
|
return value
|
||||||
@@ -179,7 +179,7 @@ function restoreMenuItemsFromEditMode(menu: HTMLElement, listItems: NodeListOf<C
|
|||||||
menu.querySelectorAll(".onoffswitch").forEach((toggle) => toggle.remove());
|
menu.querySelectorAll(".onoffswitch").forEach((toggle) => toggle.remove());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function OpenMenuOptions() {
|
export function openMenuOptions() {
|
||||||
if (isMenuOptionsOpen()) return;
|
if (isMenuOptionsOpen()) return;
|
||||||
|
|
||||||
const container = document.getElementById("container");
|
const container = document.getElementById("container");
|
||||||
@@ -232,7 +232,7 @@ export function OpenMenuOptions() {
|
|||||||
|
|
||||||
defaultbutton.addEventListener("click", () => {
|
defaultbutton.addEventListener("click", () => {
|
||||||
settingsState.menuorder = settingsState.defaultmenuorder;
|
settingsState.menuorder = settingsState.defaultmenuorder;
|
||||||
ChangeMenuItemPositions(settingsState.defaultmenuorder);
|
changeMenuItemPositions(settingsState.defaultmenuorder);
|
||||||
|
|
||||||
const restored: Record<string, { toggle: boolean }> = {};
|
const restored: Record<string, { toggle: boolean }> = {};
|
||||||
for (let i = 0; i < menubuttons.length; i++) {
|
for (let i = 0; i < menubuttons.length; i++) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** @jest-environment jsdom */
|
/** @jest-environment jsdom */
|
||||||
import { OpenThemeOfTheMonthPopup } from "./openThemeOfTheMonthPopup";
|
import { openThemeOfTheMonthPopup } from "./openThemeOfTheMonthPopup";
|
||||||
import { settingsState } from "../listeners/settingsState";
|
import { settingsState } from "../listeners/settingsState";
|
||||||
|
|
||||||
jest.mock("./popupManager", () => ({ closePopup: jest.fn() }));
|
jest.mock("./popupManager", () => ({ closePopup: jest.fn() }));
|
||||||
@@ -35,7 +35,7 @@ it.each([false, true])(
|
|||||||
"click-away dismisses and records the month once (expanded: %s)",
|
"click-away dismisses and records the month once (expanded: %s)",
|
||||||
async (expanded) => {
|
async (expanded) => {
|
||||||
const onDismissed = jest.fn();
|
const onDismissed = jest.fn();
|
||||||
await OpenThemeOfTheMonthPopup(entry, onDismissed);
|
await openThemeOfTheMonthPopup(entry, onDismissed);
|
||||||
if (expanded) document.querySelector<HTMLButtonElement>(".themeOfTheMonthCardPopout")!.click();
|
if (expanded) document.querySelector<HTMLButtonElement>(".themeOfTheMonthCardPopout")!.click();
|
||||||
const outside = expanded
|
const outside = expanded
|
||||||
? document.getElementById("theme-of-the-month-backdrop")!
|
? document.getElementById("theme-of-the-month-backdrop")!
|
||||||
@@ -51,7 +51,7 @@ it.each([false, true])(
|
|||||||
);
|
);
|
||||||
|
|
||||||
it("keeps the card open while interacting with it and its fullscreen preview", async () => {
|
it("keeps the card open while interacting with it and its fullscreen preview", async () => {
|
||||||
await OpenThemeOfTheMonthPopup(entry);
|
await openThemeOfTheMonthPopup(entry);
|
||||||
document.querySelector<HTMLElement>(".themeOfTheMonthCardBody")!.click();
|
document.querySelector<HTMLElement>(".themeOfTheMonthCardBody")!.click();
|
||||||
document.querySelector<HTMLImageElement>(".themeOfTheMonthCardImage")!.click();
|
document.querySelector<HTMLImageElement>(".themeOfTheMonthCardImage")!.click();
|
||||||
const overlay = document.getElementById("bsplus-popup-media-overlay")!;
|
const overlay = document.getElementById("bsplus-popup-media-overlay")!;
|
||||||
@@ -70,11 +70,11 @@ it("ignores the opening click and cleans up an existing card when replaced", asy
|
|||||||
const opener = document.createElement("button");
|
const opener = document.createElement("button");
|
||||||
document.body.append(opener);
|
document.body.append(opener);
|
||||||
const oldDismissed = jest.fn();
|
const oldDismissed = jest.fn();
|
||||||
opener.addEventListener("click", () => void OpenThemeOfTheMonthPopup(entry, oldDismissed));
|
opener.addEventListener("click", () => void openThemeOfTheMonthPopup(entry, oldDismissed));
|
||||||
opener.click();
|
opener.click();
|
||||||
expect(document.getElementById("theme-of-the-month-card")).not.toBeNull();
|
expect(document.getElementById("theme-of-the-month-card")).not.toBeNull();
|
||||||
const newDismissed = jest.fn();
|
const newDismissed = jest.fn();
|
||||||
await OpenThemeOfTheMonthPopup({ ...entry, month: "2026-11" }, newDismissed);
|
await openThemeOfTheMonthPopup({ ...entry, month: "2026-11" }, newDismissed);
|
||||||
document.body.click();
|
document.body.click();
|
||||||
jest.advanceTimersByTime(30_000);
|
jest.advanceTimersByTime(30_000);
|
||||||
expect(settingsState.themeOfTheMonthDismissedMonth).toBe("2026-11");
|
expect(settingsState.themeOfTheMonthDismissedMonth).toBe("2026-11");
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ function attachPopupImages(root: ParentNode): void {
|
|||||||
// Main entry point
|
// Main entry point
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
export async function OpenThemeOfTheMonthPopup(
|
export async function openThemeOfTheMonthPopup(
|
||||||
entry: ThemeOfTheMonthEntry,
|
entry: ThemeOfTheMonthEntry,
|
||||||
onDismissed?: () => void,
|
onDismissed?: () => void,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -879,5 +879,5 @@ export async function showThemeOfTheMonthPopupNow(): Promise<void> {
|
|||||||
await delay(150);
|
await delay(150);
|
||||||
}
|
}
|
||||||
|
|
||||||
await OpenThemeOfTheMonthPopup(entry);
|
await openThemeOfTheMonthPopup(entry);
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import { renderWhatsNewChangelogHtml } from "./whatsNewChangelog";
|
|||||||
const UPDATE_VIDEO_URL =
|
const UPDATE_VIDEO_URL =
|
||||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/update-video.webm";
|
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/update-video.webm";
|
||||||
|
|
||||||
export function OpenWhatsNewPopup(onDismissed?: () => void) {
|
export function openWhatsNewPopup(onDismissed?: () => void) {
|
||||||
const header = stringToHTML(
|
const header = stringToHTML(
|
||||||
/* html */
|
/* html */
|
||||||
`<div class="whatsnewHeader">
|
`<div class="whatsnewHeader">
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { settingsState } from "../listeners/settingsState";
|
import { settingsState } from "../listeners/settingsState";
|
||||||
import { OpenWhatsNewPopup } from "./openWhatsNewPopup";
|
import { openWhatsNewPopup } from "./openWhatsNewPopup";
|
||||||
import {
|
import {
|
||||||
fetchThemeOfTheMonth,
|
fetchThemeOfTheMonth,
|
||||||
OpenThemeOfTheMonthPopup,
|
openThemeOfTheMonthPopup,
|
||||||
shouldShowThemeOfTheMonth,
|
shouldShowThemeOfTheMonth,
|
||||||
} from "./openThemeOfTheMonthPopup";
|
} from "./openThemeOfTheMonthPopup";
|
||||||
import { maybeQueueFeedbackReplyPopup } from "./openFeedbackReplyPopup";
|
import { maybeQueueFeedbackReplyPopup } from "./openFeedbackReplyPopup";
|
||||||
import {
|
import {
|
||||||
OpenCoursesAssessmentsFixPopup,
|
openCoursesAssessmentsFixPopup,
|
||||||
shouldShowCoursesAssessmentsFixPopup,
|
shouldShowCoursesAssessmentsFixPopup,
|
||||||
} from "./openCoursesAssessmentsFixPopup";
|
} from "./openCoursesAssessmentsFixPopup";
|
||||||
import { cloudAuth } from "../cloudAuth";
|
import { cloudAuth } from "../cloudAuth";
|
||||||
@@ -23,17 +23,17 @@ export async function runStartupPopupQueue() {
|
|||||||
const steps: QueueStep[] = [];
|
const steps: QueueStep[] = [];
|
||||||
|
|
||||||
if (settingsState.justupdated) {
|
if (settingsState.justupdated) {
|
||||||
steps.push((goNext) => OpenWhatsNewPopup(goNext));
|
steps.push((goNext) => openWhatsNewPopup(goNext));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldShowCoursesAssessmentsFixPopup(settingsState)) {
|
if (shouldShowCoursesAssessmentsFixPopup(settingsState)) {
|
||||||
steps.push((goNext) => OpenCoursesAssessmentsFixPopup(goNext));
|
steps.push((goNext) => openCoursesAssessmentsFixPopup(goNext));
|
||||||
}
|
}
|
||||||
|
|
||||||
const themeOfTheMonth = await fetchThemeOfTheMonth();
|
const themeOfTheMonth = await fetchThemeOfTheMonth();
|
||||||
if (shouldShowThemeOfTheMonth(themeOfTheMonth)) {
|
if (shouldShowThemeOfTheMonth(themeOfTheMonth)) {
|
||||||
steps.push((goNext) => {
|
steps.push((goNext) => {
|
||||||
void OpenThemeOfTheMonthPopup(themeOfTheMonth!, goNext);
|
void openThemeOfTheMonthPopup(themeOfTheMonth!, goNext);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||||
import { addShortcuts } from "@/seqta/utils/adders/addShortcuts";
|
import { addShortcuts } from "@/seqta/utils/adders/addShortcuts";
|
||||||
import { CreateCustomShortcutDiv } from "@/seqta/utils/createEnable/createCustomShortcutDiv";
|
import { createCustomShortcutDiv } from "@/seqta/utils/createEnable/createCustomShortcutDiv";
|
||||||
|
|
||||||
export function renderShortcuts() {
|
export function renderShortcuts() {
|
||||||
const container = document.getElementById("shortcuts");
|
const container = document.getElementById("shortcuts");
|
||||||
@@ -20,7 +20,7 @@ export function renderShortcuts() {
|
|||||||
const custom = settingsState.customshortcuts || [];
|
const custom = settingsState.customshortcuts || [];
|
||||||
for (const element of custom) {
|
for (const element of custom) {
|
||||||
try {
|
try {
|
||||||
CreateCustomShortcutDiv(element);
|
createCustomShortcutDiv(element);
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
console.error(
|
console.error(
|
||||||
"[BetterSEQTA+] Error adding custom shortcut:",
|
"[BetterSEQTA+] Error adding custom shortcut:",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AppendLoadingSymbol } from "@/seqta/ui/loading";
|
import { appendLoadingSymbol } from "@/seqta/ui/loading";
|
||||||
import stringToHTML from "./stringToHTML";
|
import stringToHTML from "./stringToHTML";
|
||||||
import { delay } from "./delay";
|
import { delay } from "./delay";
|
||||||
import { settingsState } from "./listeners/settingsState";
|
import { settingsState } from "./listeners/settingsState";
|
||||||
@@ -11,7 +11,7 @@ import { verboseInfo } from "@/utils/verboseLog";
|
|||||||
import { toNewsArticles, type NewsPayload } from "@/seqta/utils/newsFeed";
|
import { toNewsArticles, type NewsPayload } from "@/seqta/utils/newsFeed";
|
||||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||||
|
|
||||||
export async function SendNewsPage() {
|
export async function sendNewsPage() {
|
||||||
if (isFeatureDisabled("page.news")) return;
|
if (isFeatureDisabled("page.news")) return;
|
||||||
|
|
||||||
verboseInfo("[BetterSEQTA+] Started Loading News Page");
|
verboseInfo("[BetterSEQTA+] Started Loading News Page");
|
||||||
@@ -63,7 +63,7 @@ export async function SendNewsPage() {
|
|||||||
const titleBar = document.getElementById("title")?.firstChild;
|
const titleBar = document.getElementById("title")?.firstChild;
|
||||||
if (titleBar instanceof HTMLElement) titleBar.innerText = "News";
|
if (titleBar instanceof HTMLElement) titleBar.innerText = "News";
|
||||||
}
|
}
|
||||||
AppendLoadingSymbol("newsloading", "#news-container");
|
appendLoadingSymbol("newsloading", "#news-container");
|
||||||
|
|
||||||
const response = (await browser.runtime.sendMessage({
|
const response = (await browser.runtime.sendMessage({
|
||||||
type: "sendNews",
|
type: "sendNews",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { pageIcon } from "@/seqta/utils/pageIcons";
|
import { pageIcon } from "@/seqta/utils/pageIcons";
|
||||||
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
import { changeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
|
||||||
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
|
||||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||||
@@ -83,7 +83,7 @@ function processTopLevelMenuItems(reorder = !isSeqtaEngageExperience()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reorder) {
|
if (reorder) {
|
||||||
ChangeMenuItemPositions(settingsState.menuorder);
|
changeMenuItemPositions(settingsState.menuorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ export async function observeMenuItemPosition() {
|
|||||||
|
|
||||||
if (!isMenuOptionsOpen()) {
|
if (!isMenuOptionsOpen()) {
|
||||||
processMenuItemNode(node);
|
processMenuItemNode(node);
|
||||||
ChangeMenuItemPositions(settingsState.menuorder);
|
changeMenuItemPositions(settingsState.menuorder);
|
||||||
(element as Element & Record<symbol, boolean>)[processedSymbol] = true;
|
(element as Element & Record<symbol, boolean>)[processedSymbol] = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user