mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b3c3e5006 | |||
| c205a52f03 | |||
| a6d95f27ed | |||
| f05cd66e88 | |||
| a151e7a07e |
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "betterseqtaplus",
|
"name": "betterseqtaplus",
|
||||||
"version": "3.4.12",
|
"version": "3.4.13",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development add add heaps more features!",
|
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development add add heaps more features!",
|
||||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
"mime-types": "^3.0.1",
|
"mime-types": "^3.0.1",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"publish-browser-extension": "^3.0.1",
|
"publish-browser-extension": "^4.0.0",
|
||||||
"sass": "^1.85.1",
|
"sass": "^1.85.1",
|
||||||
"sass-loader": "^16.0.5",
|
"sass-loader": "^16.0.5",
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
|
|||||||
+6
-4
@@ -50,10 +50,12 @@ async function init() {
|
|||||||
documentLoadStyle.textContent = documentLoadCSS;
|
documentLoadStyle.textContent = documentLoadCSS;
|
||||||
document.head.appendChild(documentLoadStyle);
|
document.head.appendChild(documentLoadStyle);
|
||||||
|
|
||||||
const icon = document.querySelector(
|
const icons =
|
||||||
'link[rel*="icon"]',
|
document.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]');
|
||||||
)! as HTMLLinkElement;
|
|
||||||
icon.href = icon48; // Change the icon
|
icons.forEach((link) => {
|
||||||
|
link.href = icon48;
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await initializeSettingsState();
|
await initializeSettingsState();
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ div > ol:has(.uiFileHandlerWrapper) {
|
|||||||
[aria-labelledby="lixycoxs-tab-1"] [minlength="0"] {
|
[aria-labelledby="lixycoxs-tab-1"] [minlength="0"] {
|
||||||
min-height: 128px !important;
|
min-height: 128px !important;
|
||||||
}
|
}
|
||||||
.student #menu > ul::before {
|
body.student #menu > ul::before {
|
||||||
background-image: var(--betterseqta-logo) !important;
|
background-image: var(--betterseqta-logo) !important;
|
||||||
position: -webkit-sticky;
|
position: -webkit-sticky;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|||||||
@@ -147,14 +147,21 @@ export class ThemeManager {
|
|||||||
public async initialize(): Promise<void> {
|
public async initialize(): Promise<void> {
|
||||||
console.debug("[ThemeManager] Starting initialization");
|
console.debug("[ThemeManager] Starting initialization");
|
||||||
try {
|
try {
|
||||||
// Check if theme creator was open during reload
|
const neumorphicThemeId = "9a9786d1-b5fc-4a91-8c7a-f8bf7f7679ad";
|
||||||
|
const migrationCSS = "#title {\nbackground: transparent !important;\n}";
|
||||||
|
|
||||||
|
const theme = (await localforage.getItem(neumorphicThemeId)) as CustomTheme | null;
|
||||||
|
if (theme && theme.CustomCSS && !theme.CustomCSS.includes("#title {\nbackground: transparent !important;\n}")) {
|
||||||
|
theme.CustomCSS = theme.CustomCSS + "\n" + migrationCSS;
|
||||||
|
await localforage.setItem(neumorphicThemeId, theme);
|
||||||
|
}
|
||||||
|
|
||||||
const themeCreatorOpen = localStorage.getItem("themeCreatorOpen");
|
const themeCreatorOpen = localStorage.getItem("themeCreatorOpen");
|
||||||
if (themeCreatorOpen === "true") {
|
if (themeCreatorOpen === "true") {
|
||||||
console.debug(
|
console.debug(
|
||||||
"[ThemeManager] Theme creator was open, clearing preview state",
|
"[ThemeManager] Theme creator was open, clearing preview state",
|
||||||
);
|
);
|
||||||
this.clearPreview();
|
this.clearPreview();
|
||||||
// Clean up the flag
|
|
||||||
localStorage.removeItem("themeCreatorOpen");
|
localStorage.removeItem("themeCreatorOpen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import { OpenWhatsNewPopup } from "@/seqta/utils/Openers/OpenWhatsNewPopup";
|
|||||||
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
|
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
|
||||||
|
|
||||||
import { updateTimetableTimes } from "@/seqta/utils/updateTimetableTimes";
|
import { updateTimetableTimes } from "@/seqta/utils/updateTimetableTimes";
|
||||||
|
import { fixTimetableColours } from "@/seqta/utils/fixTimetableColours";
|
||||||
|
|
||||||
// JSON content
|
// JSON content
|
||||||
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
|
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
|
||||||
@@ -99,7 +100,11 @@ export async function finishLoad() {
|
|||||||
await showPrivacyNotification();
|
await showPrivacyNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsState.justupdated && !document.getElementById("whatsnewbk") && !document.getElementById("privacy-notification")) {
|
if (
|
||||||
|
settingsState.justupdated &&
|
||||||
|
!document.getElementById("whatsnewbk") &&
|
||||||
|
!document.getElementById("privacy-notification")
|
||||||
|
) {
|
||||||
OpenWhatsNewPopup();
|
OpenWhatsNewPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,6 +262,7 @@ async function LoadPageElements(): Promise<void> {
|
|||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
await updateTimetableTimes();
|
await updateTimetableTimes();
|
||||||
|
await fixTimetableColours();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ export function OpenWhatsNewPopup() {
|
|||||||
const text = stringToHTML(/* html */ `
|
const text = stringToHTML(/* html */ `
|
||||||
<div class="whatsnewTextContainer" style="height: 50%;overflow-y: auto;">
|
<div class="whatsnewTextContainer" style="height: 50%;overflow-y: auto;">
|
||||||
|
|
||||||
|
<h1>3.4.13 - Bug Fixes & Styling Improvements</h1>
|
||||||
|
<li>Fixed house/year box hard failing when house_colour does not exist</li>
|
||||||
|
<li>Fixed message of the day being unreadable in light mode</li>
|
||||||
|
<li>Fixed global font styling issues due to SEQTA updates</li>
|
||||||
|
<li>Fixed styling issues with title bar and other elements</li>
|
||||||
|
<li>Other minor bug fixes and improvements</li>
|
||||||
|
|
||||||
<h1>3.4.12 - Privacy Updates & Bug Fixes</h1>
|
<h1>3.4.12 - Privacy Updates & Bug Fixes</h1>
|
||||||
<li>Added privacy statement</li>
|
<li>Added privacy statement</li>
|
||||||
<li>Added disclaimer modal to assessment averages switch</li>
|
<li>Added disclaimer modal to assessment averages switch</li>
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
import { waitForElm } from "./waitForElm";
|
||||||
|
|
||||||
|
let timetableObserver: MutationObserver | null = null;
|
||||||
|
let isOnTimetablePage = false;
|
||||||
|
let isInitialized = false;
|
||||||
|
let abortController: AbortController | null = null;
|
||||||
|
|
||||||
|
let lastSnapshot: String = "";
|
||||||
|
|
||||||
|
function checkIfOnTimetablePage(): boolean {
|
||||||
|
return window.location.hash.includes("page=/timetable");
|
||||||
|
}
|
||||||
|
|
||||||
|
function startTimetableMonitoring(): void {
|
||||||
|
if (timetableObserver) return;
|
||||||
|
|
||||||
|
const timetablePage = document.querySelector(".timetablepage");
|
||||||
|
if (!timetablePage) return;
|
||||||
|
|
||||||
|
lastSnapshot = Array.from(
|
||||||
|
timetablePage.querySelectorAll("*"),
|
||||||
|
(el) => getComputedStyle(el).color,
|
||||||
|
).join("|");
|
||||||
|
|
||||||
|
// Create observer for timetable content changes
|
||||||
|
timetableObserver = new MutationObserver((mutations) => {
|
||||||
|
const snapshot = Array.from(
|
||||||
|
timetablePage.querySelectorAll("*"),
|
||||||
|
(el) => getComputedStyle(el).color,
|
||||||
|
).join("|");
|
||||||
|
|
||||||
|
if (snapshot !== lastSnapshot) {
|
||||||
|
// implement colour fix code here
|
||||||
|
lastSnapshot = snapshot;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
timetableObserver.observe(timetablePage, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUrlChange(): void {
|
||||||
|
const currentlyOnTimetable = checkIfOnTimetablePage();
|
||||||
|
|
||||||
|
if (currentlyOnTimetable !== isOnTimetablePage) {
|
||||||
|
isOnTimetablePage = currentlyOnTimetable;
|
||||||
|
|
||||||
|
if (isOnTimetablePage) {
|
||||||
|
// Wait a bit for the page to load, then start monitoring
|
||||||
|
setTimeout(() => {
|
||||||
|
startTimetableMonitoring();
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
|
stopTimetableMonitoring();
|
||||||
|
}
|
||||||
|
} else if (isOnTimetablePage) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startUrlMonitoring(): void {
|
||||||
|
if (isInitialized) return;
|
||||||
|
isInitialized = true;
|
||||||
|
|
||||||
|
// Create abort controller for cleanup
|
||||||
|
abortController = new AbortController();
|
||||||
|
const signal = abortController.signal;
|
||||||
|
|
||||||
|
// Listen for hash changes (more efficient than polling)
|
||||||
|
window.addEventListener("hashchange", handleUrlChange, { signal });
|
||||||
|
window.addEventListener("popstate", handleUrlChange, { signal });
|
||||||
|
|
||||||
|
// Initial check
|
||||||
|
handleUrlChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopTimetableMonitoring(): void {
|
||||||
|
if (timetableObserver) {
|
||||||
|
timetableObserver.disconnect();
|
||||||
|
timetableObserver = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopUrlMonitoring(): void {
|
||||||
|
if (!isInitialized) return;
|
||||||
|
isInitialized = false;
|
||||||
|
|
||||||
|
// Abort all event listeners at once
|
||||||
|
if (abortController) {
|
||||||
|
abortController.abort();
|
||||||
|
abortController = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
stopTimetableMonitoring();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize monitoring on page load
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
// Start URL monitoring immediately
|
||||||
|
startUrlMonitoring();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fixTimetableColours(): Promise<void> {
|
||||||
|
const timetablePage = document.querySelector(".timetablepage");
|
||||||
|
if (!timetablePage) return;
|
||||||
|
|
||||||
|
// Wait for time elements to exist if page is still loading
|
||||||
|
try {
|
||||||
|
await waitForElm(".timetablepage .time", true, 10);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start continuous monitoring when this function is called
|
||||||
|
isOnTimetablePage = checkIfOnTimetablePage();
|
||||||
|
if (isOnTimetablePage) {
|
||||||
|
startTimetableMonitoring();
|
||||||
|
startUrlMonitoring();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup function for when the module is unloaded
|
||||||
|
export function cleanup(): void {
|
||||||
|
stopUrlMonitoring();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user