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";
|
||||
|
||||
/** Bundle worker entry points imported with `?inlineWorker` as Blob-backed Workers in dev. */
|
||||
export default function InlineWorkerDevPlugin(): Plugin {
|
||||
export default function inlineWorkerDevPlugin(): Plugin {
|
||||
return {
|
||||
name: "vite:inline-worker-dev",
|
||||
async load(id) {
|
||||
|
||||
@@ -110,8 +110,7 @@
|
||||
};
|
||||
|
||||
const openStorePage = async () => {
|
||||
const { OpenStorePage } = await import("@/seqta/ui/renderStore");
|
||||
await OpenStorePage();
|
||||
await (await import("@/seqta/ui/renderStore")).openStorePage();
|
||||
};
|
||||
|
||||
const openThemeCreator = async (themeId?: string) => {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
|
||||
|
||||
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
|
||||
import { OpenAboutPage } from "@/seqta/utils/openers/openAboutPage";
|
||||
import { OpenWhatsNewPopup } from "@/seqta/utils/openers/openWhatsNewPopup";
|
||||
import { openAboutPage } from "@/seqta/utils/openers/openAboutPage";
|
||||
import { openWhatsNewPopup } from "@/seqta/utils/openers/openWhatsNewPopup";
|
||||
|
||||
import type { Component } from "svelte";
|
||||
import SidebarNav from "../components/SidebarNav.svelte";
|
||||
@@ -228,12 +228,12 @@
|
||||
};
|
||||
|
||||
const openChangelog = () => {
|
||||
OpenWhatsNewPopup();
|
||||
openWhatsNewPopup();
|
||||
closeExtensionPopup();
|
||||
};
|
||||
|
||||
const openAbout = () => {
|
||||
OpenAboutPage();
|
||||
openAboutPage();
|
||||
closeExtensionPopup();
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
} from "../utils/themeImageHandlers";
|
||||
import { ThemeManager } from "@/plugins/built-in/themes/theme-manager";
|
||||
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 { formatCustomThemeApiError } from "@/seqta/utils/customThemes/apiErrors";
|
||||
import { cloudAuth } from "@/seqta/utils/cloudAuth";
|
||||
@@ -243,7 +243,7 @@
|
||||
await themeManager.saveTheme(themeClone);
|
||||
await themeManager.setTheme(themeClone.id);
|
||||
themeUpdates.triggerUpdate();
|
||||
await CloseThemeCreator({ restoreTheme: false });
|
||||
await closeThemeCreator({ restoreTheme: false });
|
||||
}
|
||||
|
||||
async function submitThemeToCommunity() {
|
||||
@@ -264,7 +264,7 @@
|
||||
await themeManager.setTheme(themeClone.id);
|
||||
await submitLocalThemeToCommunity(themeClone, theme.description?.trim() || undefined);
|
||||
themeUpdates.triggerUpdate();
|
||||
await CloseThemeCreator({ restoreTheme: false });
|
||||
await closeThemeCreator({ restoreTheme: false });
|
||||
} catch (err) {
|
||||
communityError = formatCustomThemeApiError(err);
|
||||
} finally {
|
||||
@@ -517,7 +517,7 @@
|
||||
type="button"
|
||||
class="rounded-lg p-2 text-zinc-500 transition hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
||||
aria-label="Close theme creator"
|
||||
onclick={() => void CloseThemeCreator()}
|
||||
onclick={() => void closeThemeCreator()}
|
||||
>
|
||||
<XIcon size="1em" />
|
||||
</button>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
insertMenuItemAfterKey,
|
||||
} from "@/seqta/utils/openers/analyticsMenuOrder";
|
||||
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 { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||
@@ -72,7 +72,7 @@ export async function injectAnalyticsMenuItem(): Promise<() => void> {
|
||||
|
||||
ensureAnalyticsMenuOrder();
|
||||
if (settingsState.menuorder.length > 0) {
|
||||
ChangeMenuItemPositions(settingsState.menuorder);
|
||||
changeMenuItemPositions(settingsState.menuorder);
|
||||
}
|
||||
processMenuItemNode(analyticsItem);
|
||||
applyMenuItemVisibility();
|
||||
|
||||
@@ -234,10 +234,10 @@ export class ThemeManager {
|
||||
const creatorSession = readThemeCreatorSession();
|
||||
if (creatorSession.open) {
|
||||
verboseDebug("[BetterSEQTA+] ThemeManager: Restoring theme creator after navigation");
|
||||
const { OpenThemeCreator, isThemeCreatorOpen } =
|
||||
const { openThemeCreator, isThemeCreatorOpen } =
|
||||
await import("@/plugins/built-in/themes/themeCreator");
|
||||
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).
|
||||
*/
|
||||
export async function OpenThemeCreator(themeID: string = "") {
|
||||
await CloseThemeCreator();
|
||||
export async function openThemeCreator(themeID: string = "") {
|
||||
await closeThemeCreator();
|
||||
|
||||
themeBuilderPanel.open(themeID || null);
|
||||
persistThemeCreatorSession(themeID || null);
|
||||
@@ -96,7 +96,7 @@ function positionResizeBar(widthPx: number, resizeBar: HTMLDivElement) {
|
||||
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();
|
||||
if (options?.restoreTheme === false) {
|
||||
themeManager.discardThemeCreatorRestore();
|
||||
|
||||
+22
-22
@@ -1,5 +1,5 @@
|
||||
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 { delay } from "@/seqta/utils/delay";
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
@@ -17,13 +17,13 @@ import { eventManager } from "@/seqta/utils/listeners/eventManager";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
|
||||
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
||||
import RegisterClickListeners from "@/seqta/utils/listeners/clickListeners";
|
||||
import { AddBetterSEQTAElements } from "@/seqta/ui/addBetterSEQTAElements";
|
||||
import registerClickListeners from "@/seqta/utils/listeners/clickListeners";
|
||||
import { addBetterSEQTAElements } from "@/seqta/ui/addBetterSEQTAElements";
|
||||
import { updateAllColors } from "@/seqta/ui/colors/colorManager";
|
||||
import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
||||
import { verboseInfo, verboseLog } from "@/utils/verboseLog";
|
||||
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 {
|
||||
loadEngageHomePage,
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
import { loadHomePage } from "@/seqta/utils/loaders/loadHomePage";
|
||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||
import { runStartupPopupQueue } from "@/seqta/utils/openers/startupPopupQueue";
|
||||
import { OpenCoursesAssessmentsFixPopup } from "@/seqta/utils/openers/openCoursesAssessmentsFixPopup";
|
||||
import { openCoursesAssessmentsFixPopup } from "@/seqta/utils/openers/openCoursesAssessmentsFixPopup";
|
||||
|
||||
import {
|
||||
syncTimetableUrlMonitoring,
|
||||
@@ -108,7 +108,7 @@ export async function finishLoad() {
|
||||
void runStartupPopupQueue();
|
||||
}
|
||||
|
||||
export function GetCSSElement(file: string) {
|
||||
export function getCSSElement(file: string) {
|
||||
const cssFile = resolveExtensionAssetUrl(file);
|
||||
const fileref = document.createElement("link");
|
||||
fileref.setAttribute("rel", "stylesheet");
|
||||
@@ -182,7 +182,7 @@ function applyDarkModeToIframe(iframe: HTMLIFrameElement, cssLink: HTMLStyleElem
|
||||
}
|
||||
}
|
||||
|
||||
function SortMessagePageItems() {
|
||||
function sortMessagePageItems() {
|
||||
try {
|
||||
const filterbutton = document.createElement("div");
|
||||
filterbutton.classList.add("messages-filterbutton");
|
||||
@@ -195,8 +195,8 @@ function SortMessagePageItems() {
|
||||
}
|
||||
}
|
||||
|
||||
async function LoadPageElements(): Promise<void> {
|
||||
await AddBetterSEQTAElements();
|
||||
async function loadPageElements(): Promise<void> {
|
||||
await addBetterSEQTAElements();
|
||||
if (!isFeatureDisabled("ui.sidebar.styled")) {
|
||||
void import("@/seqta/ui/sidebar/applyNativeSidebar").then((mod) => {
|
||||
void mod.applyNativeSidebar();
|
||||
@@ -222,7 +222,7 @@ async function LoadPageElements(): Promise<void> {
|
||||
|
||||
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);
|
||||
|
||||
@@ -237,7 +237,7 @@ async function LoadPageElements(): Promise<void> {
|
||||
|
||||
eventManager.register("noticesAdded", { selector: "div.notice" }, handleNotices);
|
||||
|
||||
RegisterClickListeners();
|
||||
registerClickListeners();
|
||||
|
||||
await handleSublink(sublink);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ async function handleNewsPage(): Promise<void> {
|
||||
|
||||
verboseInfo("[BetterSEQTA+] Started Init");
|
||||
try {
|
||||
await SendNewsPage();
|
||||
await sendNewsPage();
|
||||
} catch (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;
|
||||
}
|
||||
document.title = "Direct Messages ― SEQTA Learn";
|
||||
SortMessagePageItems();
|
||||
sortMessagePageItems();
|
||||
|
||||
if (!animationsEnabled() || !fullMotionEffectsEnabled()) return;
|
||||
|
||||
@@ -476,7 +476,7 @@ let noticeColourObserver: MutationObserver | null = null;
|
||||
|
||||
const adjustNoticeColor = (node: Element) => {
|
||||
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;";
|
||||
};
|
||||
|
||||
@@ -490,7 +490,7 @@ const scanAddedNotices = debounce((mutations: MutationRecord[]) => {
|
||||
for (const node of m.addedNodes) if (node instanceof Element) scanNotices(node);
|
||||
}, 50);
|
||||
|
||||
function CheckNoticeTextColour(notice: Element) {
|
||||
function checkNoticeTextColour(notice: Element) {
|
||||
scanNotices(notice);
|
||||
if (noticeContainers.has(notice)) return;
|
||||
if (!noticeColourObserver) {
|
||||
@@ -571,10 +571,10 @@ export function tryLoad() {
|
||||
}
|
||||
if (mode === "timeout") {
|
||||
finishLoad();
|
||||
void waitForElm("#content").then(() => void LoadPageElements());
|
||||
void waitForElm("#content").then(() => void loadPageElements());
|
||||
return;
|
||||
}
|
||||
await LoadPageElements();
|
||||
await loadPageElements();
|
||||
};
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
@@ -605,7 +605,7 @@ export function tryLoad() {
|
||||
});
|
||||
|
||||
waitForElm(".code", true, 50).then((elm: Element) => {
|
||||
if (!(elm as HTMLElement).innerText.includes("BetterSEQTA")) LoadPageElements();
|
||||
if (!(elm as HTMLElement).innerText.includes("BetterSEQTA")) loadPageElements();
|
||||
});
|
||||
|
||||
updateIframesWithDarkMode();
|
||||
@@ -696,8 +696,8 @@ export function init() {
|
||||
}
|
||||
}
|
||||
|
||||
AppendElementsToDisabledPage();
|
||||
OpenCoursesAssessmentsFixPopup();
|
||||
appendElementsToDisabledPage();
|
||||
openCoursesAssessmentsFixPopup();
|
||||
};
|
||||
|
||||
const handleDisabled = () => {
|
||||
@@ -859,11 +859,11 @@ export function init() {
|
||||
}
|
||||
}
|
||||
|
||||
export function AppendElementsToDisabledPage() {
|
||||
export function appendElementsToDisabledPage() {
|
||||
if (document.getElementById("AddedSettings")) return;
|
||||
|
||||
verboseInfo("[BetterSEQTA+] Appending elements to disabled page");
|
||||
AddBetterSEQTAElements();
|
||||
addBetterSEQTAElements();
|
||||
|
||||
const settingsStyle = document.createElement("style");
|
||||
settingsStyle.innerHTML = /* css */ `
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ async function init() {
|
||||
if (settingsState.onoff !== false && !isPaused()) {
|
||||
await main();
|
||||
|
||||
const { init: Monofile } = await import("@/plugins/monofile");
|
||||
Monofile();
|
||||
const { init: initMonofile } = await import("@/plugins/monofile");
|
||||
initMonofile();
|
||||
|
||||
if (settingsState.onoff) {
|
||||
const { initializePlugins } = await import("@/plugins/index");
|
||||
|
||||
@@ -5,12 +5,12 @@ import { addExtensionSettings } from "@/seqta/utils/adders/addExtensionSettings"
|
||||
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
|
||||
import { loadEngageHomePage } from "@/seqta/utils/loaders/loadEngageHomePage";
|
||||
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 { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
|
||||
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 { attachTooltip } from "@/seqta/utils/tooltip";
|
||||
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). */
|
||||
const BSPLUS_SIDEBAR_OFFSCREEN = "bsplus-sidebar-offscreen";
|
||||
|
||||
export async function AddBetterSEQTAElements() {
|
||||
export async function addBetterSEQTAElements() {
|
||||
if (isSeqtaEngageExperience()) {
|
||||
await waitForElm("#content");
|
||||
addExtensionSettings();
|
||||
@@ -217,7 +217,7 @@ async function updateStudentInfo(
|
||||
if (student.house_colour) {
|
||||
houseelement.style.background = student.house_colour;
|
||||
try {
|
||||
const colorresult = GetThresholdOfColor(student.house_colour);
|
||||
const colorresult = getThresholdOfColor(student.house_colour);
|
||||
houseelement.style.color = colorresult && colorresult > 300 ? "black" : "white";
|
||||
} catch {
|
||||
// Invalid color format, leave text color as default
|
||||
@@ -263,7 +263,7 @@ function setupEventListeners() {
|
||||
});
|
||||
|
||||
newsbutton?.addEventListener("click", () => {
|
||||
activateMenuAction(newsbutton, SendNewsPage);
|
||||
activateMenuAction(newsbutton, sendNewsPage);
|
||||
});
|
||||
|
||||
menuCover?.addEventListener("click", () => {
|
||||
@@ -448,7 +448,7 @@ async function setupEngageSettingsButton() {
|
||||
observer.observe(content, { childList: true, subtree: !isPerformanceMode() });
|
||||
}
|
||||
|
||||
function GetLightDarkModeString() {
|
||||
function getLightDarkModeString() {
|
||||
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")!;
|
||||
toggleTarget.append(
|
||||
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)}
|
||||
</button>
|
||||
`).firstChild!,
|
||||
@@ -485,7 +485,7 @@ async function addDarkLightToggle(parent?: Element) {
|
||||
updateAllColors();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
export default function ColorLuminance(color: string, lum = 0) {
|
||||
export default function colorLuminance(color: string, lum = 0) {
|
||||
if (color == "" || color == null) {
|
||||
// light cyan blue
|
||||
return "#00bfff";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Color from "color";
|
||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||
import { lightenAndPaleColor } from "./lightenAndPaleColor";
|
||||
import ColorLuminance from "./colorLuminance";
|
||||
import colorLuminance from "./colorLuminance";
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { getAdaptiveColour } from "@/seqta/utils/adaptiveThemeColour";
|
||||
import { adaptiveThemeTransitionEnabled, transparencyEnabled } from "@/seqta/utils/performanceMode";
|
||||
@@ -153,11 +153,11 @@ function applyColorsWith(selectedColor: string) {
|
||||
applyBetterseqtaLogoBackground(settingsState.DarkMode);
|
||||
|
||||
// Dynamic properties, always applied
|
||||
const rgbThreshold = GetThresholdOfColor(selectedColor);
|
||||
const rgbThreshold = getThresholdOfColor(selectedColor);
|
||||
const isBright = rgbThreshold > 210;
|
||||
const dynamicProps = {
|
||||
"--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 };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Color from "color";
|
||||
export function GetThresholdOfColor(color: string) {
|
||||
export function getThresholdOfColor(color: string) {
|
||||
if (!color) return 0;
|
||||
// Case-insensitive regular expression for matching RGBA colors
|
||||
const rgbaRegex = /rgba?\(([^)]+)\)/gi;
|
||||
|
||||
@@ -274,7 +274,7 @@ function startCanvasForRoot(host: HTMLElement, shadow: ShadowRoot, variant: Load
|
||||
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 */ `
|
||||
<div id="${givenID}" class="bkloading-inline">
|
||||
${loadingSpinner}
|
||||
|
||||
@@ -7,10 +7,10 @@ async function openThemesDestination(view: "store" | "community"): Promise<void>
|
||||
await openSettingsPopup();
|
||||
}
|
||||
|
||||
export async function OpenStorePage(): Promise<void> {
|
||||
export async function openStorePage(): Promise<void> {
|
||||
await openThemesDestination("store");
|
||||
}
|
||||
|
||||
export async function OpenCommunityThemesPage(): Promise<void> {
|
||||
export async function openCommunityThemesPage(): Promise<void> {
|
||||
await openThemesDestination("community");
|
||||
}
|
||||
@@ -7,9 +7,9 @@ export function addShortcuts(shortcuts: Shortcut[]) {
|
||||
const currentShortcut = shortcuts[i];
|
||||
|
||||
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) {
|
||||
createNewShortcut(
|
||||
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");
|
||||
if (!container) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export function CreateElement(
|
||||
export function createElement(
|
||||
type: string,
|
||||
class_?: string,
|
||||
id?: string,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Close settings (if open) and mount the theme builder on the SEQTA page body. */
|
||||
export async function launchPageThemeBuilder(themeId?: string): Promise<void> {
|
||||
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();
|
||||
await OpenThemeCreator(themeId ?? "");
|
||||
await openThemeCreator(themeId ?? "");
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import browser from "@/lib/browser";
|
||||
|
||||
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 sendThemeUpdate from "@/seqta/utils/sendThemeUpdate";
|
||||
@@ -119,8 +119,8 @@ export class MessageHandler {
|
||||
|
||||
case "OpenThemeCreator": {
|
||||
const themeID = request?.body?.themeID;
|
||||
void import("@/plugins/built-in/themes/themeCreator").then(({ OpenThemeCreator }) => {
|
||||
void OpenThemeCreator(themeID ? String(themeID) : "");
|
||||
void import("@/plugins/built-in/themes/themeCreator").then(({ openThemeCreator }) => {
|
||||
void openThemeCreator(themeID ? String(themeID) : "");
|
||||
});
|
||||
closeExtensionPopup();
|
||||
sendResponse({ status: "success" });
|
||||
@@ -136,9 +136,9 @@ export class MessageHandler {
|
||||
return true;
|
||||
|
||||
case "CloseThemeCreator":
|
||||
void import("@/plugins/built-in/themes/themeCreator").then(({ CloseThemeCreator }) => {
|
||||
void import("@/plugins/built-in/themes/themeCreator").then(({ closeThemeCreator }) => {
|
||||
try {
|
||||
CloseThemeCreator();
|
||||
closeThemeCreator();
|
||||
sendResponse({ status: "success" });
|
||||
} catch (error) {
|
||||
console.error("Error closing theme creator:", error);
|
||||
@@ -159,7 +159,7 @@ export class MessageHandler {
|
||||
|
||||
editSidebar() {
|
||||
if (!isMenuOptionsOpen()) {
|
||||
OpenMenuOptions();
|
||||
openMenuOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ jest.mock("@/seqta/utils/menuItemVisibility", () => ({
|
||||
scheduleMenuItemVisibility: jest.fn(),
|
||||
}));
|
||||
jest.mock("@/seqta/utils/openers/menuOrder", () => ({
|
||||
ChangeMenuItemPositions: jest.fn(),
|
||||
changeMenuItemPositions: jest.fn(),
|
||||
}));
|
||||
jest.mock("@/seqta/utils/performanceMode", () => ({
|
||||
syncPerformanceModeEffects: jest.fn(),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { applySelectedFont } from "@/seqta/ui/fonts/fontManager";
|
||||
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
|
||||
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/loadHomePage";
|
||||
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 type { CustomShortcut } from "@/types/storage";
|
||||
@@ -41,7 +41,7 @@ export class StorageChangeHandler {
|
||||
settingsState.register("menuitems", () => scheduleMenuItemVisibility());
|
||||
settingsState.register("menuorder", (order) => {
|
||||
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 LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||
import { getThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||
import { convertTo12HourFormat } from "../convertTo12HourFormat";
|
||||
import { delay } from "../delay";
|
||||
import { settingsState } from "../listeners/settingsState";
|
||||
import stringToHTML from "../stringToHTML";
|
||||
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 { verboseInfo } from "@/utils/verboseLog";
|
||||
import { getUserInfo } from "@/seqta/utils/userInfo";
|
||||
@@ -126,8 +126,8 @@ export async function loadHomePage() {
|
||||
const TodayFormatted = formatDate(new Date());
|
||||
|
||||
const [assessments, classes, prefs] = await Promise.all([
|
||||
GetUpcomingAssessments(),
|
||||
GetActiveClasses(),
|
||||
getUpcomingAssessments(),
|
||||
getActiveClasses(),
|
||||
fetch(`${location.origin}/seqta/student/load/prefs?`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -144,7 +144,7 @@ export async function loadHomePage() {
|
||||
|
||||
const upcomingItems = document.getElementById("upcoming-items");
|
||||
if (upcomingItems) {
|
||||
await CreateUpcomingSection(currentAssessments, activeSubjects);
|
||||
await createUpcomingSection(currentAssessments, activeSubjects);
|
||||
upcomingItems.classList.remove("loading");
|
||||
}
|
||||
|
||||
@@ -185,14 +185,14 @@ async function renderHomeUpcomingAssessments() {
|
||||
upcomingItems.classList.add("loading");
|
||||
upcomingItems.innerHTML = "";
|
||||
|
||||
const [assessments, classes] = await Promise.all([GetUpcomingAssessments(), GetActiveClasses()]);
|
||||
const [assessments, classes] = await Promise.all([getUpcomingAssessments(), getActiveClasses()]);
|
||||
|
||||
const activeSubjects = activeSubjectsFromLearnPayload(classes);
|
||||
const currentAssessments = filterAssessmentsForActiveSubjects(assessments, activeSubjects).sort(
|
||||
comparedate,
|
||||
) as HomeUpcomingAssessment[];
|
||||
|
||||
await CreateUpcomingSection(currentAssessments, activeSubjects);
|
||||
await createUpcomingSection(currentAssessments, activeSubjects);
|
||||
upcomingItems.classList.remove("loading");
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ export function registerHomeUpcomingSettingsListeners() {
|
||||
}
|
||||
}
|
||||
|
||||
async function GetUpcomingAssessments() {
|
||||
async function getUpcomingAssessments() {
|
||||
try {
|
||||
const { id: student } = await getUserInfo();
|
||||
const response = await fetch(`${location.origin}/seqta/student/assessment/list/upcoming?`, {
|
||||
@@ -244,7 +244,7 @@ function setupTimetableListeners() {
|
||||
currentSelectedDate.setDate(currentSelectedDate.getDate() + value);
|
||||
const formattedDate = formatDate(currentSelectedDate);
|
||||
callHomeTimetable(formattedDate, true);
|
||||
SetTimetableSubtitle();
|
||||
setTimetableSubtitle();
|
||||
}
|
||||
|
||||
const backHandler = () => changeTimetable(-1);
|
||||
@@ -268,7 +268,7 @@ function formatDate(date: Date): string {
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
async function GetActiveClasses() {
|
||||
async function getActiveClasses() {
|
||||
try {
|
||||
const response = await fetch(`${location.origin}/seqta/student/load/subjects?`, {
|
||||
method: "POST",
|
||||
@@ -314,7 +314,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
||||
a.from.localeCompare(b.from),
|
||||
);
|
||||
|
||||
GetLessonColours().then((colours) => {
|
||||
getLessonColours().then((colours) => {
|
||||
for (let i = 0; i < lessonArray.length; i++) {
|
||||
const subjectname =
|
||||
lessonArray[i].type == "tutorial"
|
||||
@@ -326,7 +326,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
||||
lessonArray[i].colour = "--item-colour: #8e8e8e;";
|
||||
} else {
|
||||
lessonArray[i].colour = `--item-colour: ${subject.value};`;
|
||||
if (GetThresholdOfColor(subject.value) > 300) {
|
||||
if (getThresholdOfColor(subject.value) > 300) {
|
||||
lessonArray[i].invert = true;
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
||||
lessonArray[i].until = convertTo12HourFormat(lessonArray[i].until);
|
||||
}
|
||||
|
||||
lessonArray[i].attendanceTitle = CheckUnmarkedAttendance(lessonArray[i].attendance);
|
||||
lessonArray[i].attendanceTitle = checkUnmarkedAttendance(lessonArray[i].attendance);
|
||||
}
|
||||
|
||||
DayContainer.innerText = "";
|
||||
@@ -356,9 +356,9 @@ async function callHomeTimetable(date: string, change?: boolean) {
|
||||
const today = new Date();
|
||||
if (currentSelectedDate.getDate() == today.getDate()) {
|
||||
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();
|
||||
lessonInterval = setInterval(() => {
|
||||
for (let i = 0; i < lessons.length; i++) {
|
||||
CheckCurrentLesson(lessons[i], i + 1);
|
||||
checkCurrentLesson(lessons[i], i + 1);
|
||||
}
|
||||
}, 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 currentDate = new Date();
|
||||
|
||||
@@ -506,7 +506,7 @@ function buildAssessmentURL(
|
||||
: `${base}${programmeID}:${metaID}`;
|
||||
}
|
||||
|
||||
function CheckUnmarkedAttendance(lessonattendance: { label?: string } | null | undefined) {
|
||||
function checkUnmarkedAttendance(lessonattendance: { label?: string } | null | undefined) {
|
||||
return lessonattendance ? lessonattendance.label : " ";
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ function applyHomeUpcomingLimits(
|
||||
assessments.splice(0, assessments.length, ...limited);
|
||||
}
|
||||
|
||||
async function CreateUpcomingSection(
|
||||
async function createUpcomingSection(
|
||||
assessments: HomeUpcomingAssessment[],
|
||||
activeSubjects: ActiveSubjectLike[],
|
||||
) {
|
||||
@@ -580,7 +580,7 @@ async function CreateUpcomingSection(
|
||||
|
||||
applyHomeUpcomingLimits(assessments, activeSubjects);
|
||||
|
||||
const colours = await GetLessonColours();
|
||||
const colours = await getLessonColours();
|
||||
|
||||
for (let i = 0; i < assessments.length; i++) {
|
||||
const subject = colours.find(
|
||||
@@ -598,7 +598,7 @@ async function CreateUpcomingSection(
|
||||
const element = assessments[i];
|
||||
if (!upcomingDates[element.due]) {
|
||||
const dateObj: UpcomingDateBucket = {
|
||||
div: CreateElement("div", "upcoming-date-container") as HTMLElement,
|
||||
div: createElement("div", "upcoming-date-container") as HTMLElement,
|
||||
assessments: [],
|
||||
};
|
||||
upcomingDates[element.due] = dateObj;
|
||||
@@ -609,7 +609,7 @@ async function CreateUpcomingSection(
|
||||
|
||||
for (const date in upcomingDates) {
|
||||
const assessmentdue = new Date(upcomingDates[date].assessments[0].due);
|
||||
const specialcase = CheckSpecialDay(Today, assessmentdue);
|
||||
const specialcase = checkSpecialDay(Today, assessmentdue);
|
||||
const assessmentDate = createAssessmentDateDiv(
|
||||
date,
|
||||
upcomingDates[date],
|
||||
@@ -721,7 +721,7 @@ function createAssessmentDateDiv(
|
||||
return container;
|
||||
}
|
||||
|
||||
function CheckSpecialDay(date1: Date, date2: Date) {
|
||||
function checkSpecialDay(date1: Date, date2: Date) {
|
||||
if (
|
||||
date1.getFullYear() === date2.getFullYear() &&
|
||||
date1.getMonth() === date2.getMonth() &&
|
||||
@@ -745,7 +745,7 @@ function CheckSpecialDay(date1: Date, date2: Date) {
|
||||
}
|
||||
}
|
||||
|
||||
async function GetLessonColours() {
|
||||
async function getLessonColours() {
|
||||
try {
|
||||
const { id: user } = await getUserInfo();
|
||||
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");
|
||||
if (!homelessonsubtitle) return;
|
||||
homelessonsubtitle.innerText = lessonsSubtitleForViewDate(currentSelectedDate);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { animate } from "motion";
|
||||
import LogoLight from "@/resources/icons/betterseqta-light-icon.png";
|
||||
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 { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { noticeMatchesLabelFilter } from "@/seqta/utils/notices/noticeLabelFilters";
|
||||
@@ -109,7 +109,7 @@ function elementScale(el: HTMLElement) {
|
||||
|
||||
export function processNoticeColor(colour: unknown): string | undefined {
|
||||
if (typeof colour !== "string") return undefined;
|
||||
const rgb = GetThresholdOfColor(colour);
|
||||
const rgb = getThresholdOfColor(colour);
|
||||
if (rgb < 100 && settingsState.DarkMode) return undefined;
|
||||
return colour;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export function consumePendingHighlightThemeId(): string | null {
|
||||
|
||||
export async function openThemeStoreWithHighlight(themeId: string): Promise<void> {
|
||||
pendingHighlightThemeId = themeId;
|
||||
const { OpenStorePage } = await import("@/seqta/ui/renderStore");
|
||||
await OpenStorePage();
|
||||
const { openStorePage } = await import("@/seqta/ui/renderStore");
|
||||
await openStorePage();
|
||||
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'".
|
||||
*/
|
||||
export let MenuOptionsOpen = false;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { SettingsState } from "@/types/storage";
|
||||
|
||||
/** 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;
|
||||
if (!menuRoot) return;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||
import brandingDark from "@/resources/branding/dark.jpg";
|
||||
import brandingLight from "@/resources/branding/light.jpg";
|
||||
|
||||
export function OpenAboutPage() {
|
||||
export function openAboutPage() {
|
||||
const header = stringToHTML(
|
||||
/* html */
|
||||
`<div class="whatsnewHeader">
|
||||
|
||||
@@ -221,7 +221,7 @@ function setPopupButtonsDisabled(disabled: boolean) {
|
||||
if (dismiss) dismiss.disabled = disabled;
|
||||
}
|
||||
|
||||
export function OpenCoursesAssessmentsFixPopup(onDismissed?: () => void) {
|
||||
export function openCoursesAssessmentsFixPopup(onDismissed?: () => void) {
|
||||
if (document.getElementById("whatsnewbk")) {
|
||||
onDismissed?.();
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,7 @@ function esc(value: string): string {
|
||||
.replace(/"/g, """);
|
||||
}
|
||||
|
||||
export function OpenFeedbackReplyPopup(
|
||||
export function openFeedbackReplyPopup(
|
||||
items: FeedbackStatusItem[],
|
||||
onDismissed?: () => void,
|
||||
): void {
|
||||
@@ -75,7 +75,7 @@ export async function maybeQueueFeedbackReplyPopup(): Promise<
|
||||
try {
|
||||
const items = await findPendingFeedbackWithReplies();
|
||||
if (!items.length) return null;
|
||||
return (goNext) => OpenFeedbackReplyPopup(items, goNext);
|
||||
return (goNext) => openFeedbackReplyPopup(items, goNext);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ import { settingsState } from "../listeners/settingsState";
|
||||
import { applyMenuItemVisibility } from "../menuItemVisibility";
|
||||
import { ensureAnalyticsMenuOrder } from "@/seqta/utils/openers/analyticsMenuOrder";
|
||||
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 Sortable from "sortablejs";
|
||||
|
||||
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 {
|
||||
return value
|
||||
@@ -179,7 +179,7 @@ function restoreMenuItemsFromEditMode(menu: HTMLElement, listItems: NodeListOf<C
|
||||
menu.querySelectorAll(".onoffswitch").forEach((toggle) => toggle.remove());
|
||||
}
|
||||
|
||||
export function OpenMenuOptions() {
|
||||
export function openMenuOptions() {
|
||||
if (isMenuOptionsOpen()) return;
|
||||
|
||||
const container = document.getElementById("container");
|
||||
@@ -232,7 +232,7 @@ export function OpenMenuOptions() {
|
||||
|
||||
defaultbutton.addEventListener("click", () => {
|
||||
settingsState.menuorder = settingsState.defaultmenuorder;
|
||||
ChangeMenuItemPositions(settingsState.defaultmenuorder);
|
||||
changeMenuItemPositions(settingsState.defaultmenuorder);
|
||||
|
||||
const restored: Record<string, { toggle: boolean }> = {};
|
||||
for (let i = 0; i < menubuttons.length; i++) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @jest-environment jsdom */
|
||||
import { OpenThemeOfTheMonthPopup } from "./openThemeOfTheMonthPopup";
|
||||
import { openThemeOfTheMonthPopup } from "./openThemeOfTheMonthPopup";
|
||||
import { settingsState } from "../listeners/settingsState";
|
||||
|
||||
jest.mock("./popupManager", () => ({ closePopup: jest.fn() }));
|
||||
@@ -35,7 +35,7 @@ it.each([false, true])(
|
||||
"click-away dismisses and records the month once (expanded: %s)",
|
||||
async (expanded) => {
|
||||
const onDismissed = jest.fn();
|
||||
await OpenThemeOfTheMonthPopup(entry, onDismissed);
|
||||
await openThemeOfTheMonthPopup(entry, onDismissed);
|
||||
if (expanded) document.querySelector<HTMLButtonElement>(".themeOfTheMonthCardPopout")!.click();
|
||||
const outside = expanded
|
||||
? 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 () => {
|
||||
await OpenThemeOfTheMonthPopup(entry);
|
||||
await openThemeOfTheMonthPopup(entry);
|
||||
document.querySelector<HTMLElement>(".themeOfTheMonthCardBody")!.click();
|
||||
document.querySelector<HTMLImageElement>(".themeOfTheMonthCardImage")!.click();
|
||||
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");
|
||||
document.body.append(opener);
|
||||
const oldDismissed = jest.fn();
|
||||
opener.addEventListener("click", () => void OpenThemeOfTheMonthPopup(entry, oldDismissed));
|
||||
opener.addEventListener("click", () => void openThemeOfTheMonthPopup(entry, oldDismissed));
|
||||
opener.click();
|
||||
expect(document.getElementById("theme-of-the-month-card")).not.toBeNull();
|
||||
const newDismissed = jest.fn();
|
||||
await OpenThemeOfTheMonthPopup({ ...entry, month: "2026-11" }, newDismissed);
|
||||
await openThemeOfTheMonthPopup({ ...entry, month: "2026-11" }, newDismissed);
|
||||
document.body.click();
|
||||
jest.advanceTimersByTime(30_000);
|
||||
expect(settingsState.themeOfTheMonthDismissedMonth).toBe("2026-11");
|
||||
|
||||
@@ -653,7 +653,7 @@ function attachPopupImages(root: ParentNode): void {
|
||||
// Main entry point
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function OpenThemeOfTheMonthPopup(
|
||||
export async function openThemeOfTheMonthPopup(
|
||||
entry: ThemeOfTheMonthEntry,
|
||||
onDismissed?: () => void,
|
||||
): Promise<void> {
|
||||
@@ -879,5 +879,5 @@ export async function showThemeOfTheMonthPopupNow(): Promise<void> {
|
||||
await delay(150);
|
||||
}
|
||||
|
||||
await OpenThemeOfTheMonthPopup(entry);
|
||||
await openThemeOfTheMonthPopup(entry);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { renderWhatsNewChangelogHtml } from "./whatsNewChangelog";
|
||||
const UPDATE_VIDEO_URL =
|
||||
"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(
|
||||
/* html */
|
||||
`<div class="whatsnewHeader">
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { settingsState } from "../listeners/settingsState";
|
||||
import { OpenWhatsNewPopup } from "./openWhatsNewPopup";
|
||||
import { openWhatsNewPopup } from "./openWhatsNewPopup";
|
||||
import {
|
||||
fetchThemeOfTheMonth,
|
||||
OpenThemeOfTheMonthPopup,
|
||||
openThemeOfTheMonthPopup,
|
||||
shouldShowThemeOfTheMonth,
|
||||
} from "./openThemeOfTheMonthPopup";
|
||||
import { maybeQueueFeedbackReplyPopup } from "./openFeedbackReplyPopup";
|
||||
import {
|
||||
OpenCoursesAssessmentsFixPopup,
|
||||
openCoursesAssessmentsFixPopup,
|
||||
shouldShowCoursesAssessmentsFixPopup,
|
||||
} from "./openCoursesAssessmentsFixPopup";
|
||||
import { cloudAuth } from "../cloudAuth";
|
||||
@@ -23,17 +23,17 @@ export async function runStartupPopupQueue() {
|
||||
const steps: QueueStep[] = [];
|
||||
|
||||
if (settingsState.justupdated) {
|
||||
steps.push((goNext) => OpenWhatsNewPopup(goNext));
|
||||
steps.push((goNext) => openWhatsNewPopup(goNext));
|
||||
}
|
||||
|
||||
if (shouldShowCoursesAssessmentsFixPopup(settingsState)) {
|
||||
steps.push((goNext) => OpenCoursesAssessmentsFixPopup(goNext));
|
||||
steps.push((goNext) => openCoursesAssessmentsFixPopup(goNext));
|
||||
}
|
||||
|
||||
const themeOfTheMonth = await fetchThemeOfTheMonth();
|
||||
if (shouldShowThemeOfTheMonth(themeOfTheMonth)) {
|
||||
steps.push((goNext) => {
|
||||
void OpenThemeOfTheMonthPopup(themeOfTheMonth!, goNext);
|
||||
void openThemeOfTheMonthPopup(themeOfTheMonth!, goNext);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import { addShortcuts } from "@/seqta/utils/adders/addShortcuts";
|
||||
import { CreateCustomShortcutDiv } from "@/seqta/utils/createEnable/createCustomShortcutDiv";
|
||||
import { createCustomShortcutDiv } from "@/seqta/utils/createEnable/createCustomShortcutDiv";
|
||||
|
||||
export function renderShortcuts() {
|
||||
const container = document.getElementById("shortcuts");
|
||||
@@ -20,7 +20,7 @@ export function renderShortcuts() {
|
||||
const custom = settingsState.customshortcuts || [];
|
||||
for (const element of custom) {
|
||||
try {
|
||||
CreateCustomShortcutDiv(element);
|
||||
createCustomShortcutDiv(element);
|
||||
} catch (err: unknown) {
|
||||
console.error(
|
||||
"[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 { delay } from "./delay";
|
||||
import { settingsState } from "./listeners/settingsState";
|
||||
@@ -11,7 +11,7 @@ import { verboseInfo } from "@/utils/verboseLog";
|
||||
import { toNewsArticles, type NewsPayload } from "@/seqta/utils/newsFeed";
|
||||
import { isFeatureDisabled } from "@/seqta/utils/remoteStatus";
|
||||
|
||||
export async function SendNewsPage() {
|
||||
export async function sendNewsPage() {
|
||||
if (isFeatureDisabled("page.news")) return;
|
||||
|
||||
verboseInfo("[BetterSEQTA+] Started Loading News Page");
|
||||
@@ -63,7 +63,7 @@ export async function SendNewsPage() {
|
||||
const titleBar = document.getElementById("title")?.firstChild;
|
||||
if (titleBar instanceof HTMLElement) titleBar.innerText = "News";
|
||||
}
|
||||
AppendLoadingSymbol("newsloading", "#news-container");
|
||||
appendLoadingSymbol("newsloading", "#news-container");
|
||||
|
||||
const response = (await browser.runtime.sendMessage({
|
||||
type: "sendNews",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 { settingsState } from "@/seqta/utils/listeners/settingsState";
|
||||
import stringToHTML from "@/seqta/utils/stringToHTML";
|
||||
@@ -83,7 +83,7 @@ function processTopLevelMenuItems(reorder = !isSeqtaEngageExperience()) {
|
||||
}
|
||||
|
||||
if (reorder) {
|
||||
ChangeMenuItemPositions(settingsState.menuorder);
|
||||
changeMenuItemPositions(settingsState.menuorder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ export async function observeMenuItemPosition() {
|
||||
|
||||
if (!isMenuOptionsOpen()) {
|
||||
processMenuItemNode(node);
|
||||
ChangeMenuItemPositions(settingsState.menuorder);
|
||||
changeMenuItemPositions(settingsState.menuorder);
|
||||
(element as Element & Record<symbol, boolean>)[processedSymbol] = true;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user