feat: add global theme toggle

This commit is contained in:
SethBurkart123
2025-03-30 08:49:13 +11:00
parent 6147e96cc9
commit 3ecd7205ed
14 changed files with 145 additions and 141 deletions
@@ -1,24 +0,0 @@
export function enableNotificationCollector() {
var xhr3 = new XMLHttpRequest()
xhr3.open("POST", `${location.origin}/seqta/student/heartbeat?`, true)
xhr3.setRequestHeader("Content-Type", "application/json; charset=utf-8")
xhr3.onreadystatechange = function () {
if (xhr3.readyState === 4) {
var Notifications = JSON.parse(xhr3.response)
var alertdiv = document.getElementsByClassName(
"notifications__bubble___1EkSQ",
)[0]
if (typeof alertdiv == "undefined") {
console.info("[BetterSEQTA+] No notifications currently")
} else {
alertdiv.textContent = Notifications.payload.notifications.length
}
}
}
xhr3.send(
JSON.stringify({
timestamp: "1970-01-01 00:00:00.0",
hash: "#?page=/home",
}),
)
}
@@ -1,13 +0,0 @@
export function disableNotificationCollector() {
var alertdiv = document.getElementsByClassName(
"notifications__bubble___1EkSQ",
)[0]
if (typeof alertdiv != "undefined") {
var currentNumber = parseInt(alertdiv.textContent!)
if (currentNumber < 9) {
alertdiv.textContent = currentNumber.toString()
} else {
alertdiv.textContent = "9+"
}
}
}
-6
View File
@@ -19,8 +19,6 @@ import { CreateElement } from "@/seqta/utils/CreateEnable/CreateElement"
import { convertTo12HourFormat } from "../convertTo12HourFormat"
import { enableNotificationCollector } from "@/seqta/utils/CreateEnable/EnableNotificationCollector"
let LessonInterval: any
let currentSelectedDate = new Date()
@@ -249,10 +247,6 @@ export async function loadHomePage() {
}
}
if (settingsState.notificationcollector) {
enableNotificationCollector()
}
return cleanup
}
@@ -5,8 +5,6 @@ import { updateAllColors } from '@/seqta/ui/colors/Manager';
import { addShortcuts } from "@/seqta/utils/Adders/AddShortcuts";
import { CreateBackground } from "@/seqta/utils/CreateEnable/CreateBackground";
import { CreateCustomShortcutDiv } from "@/seqta/utils/CreateEnable/CreateCustomShortcutDiv";
import { disableNotificationCollector } from "@/seqta/utils/DisableRemove/DisableNotificationCollector";
import { enableNotificationCollector } from "@/seqta/utils/CreateEnable/EnableNotificationCollector";
import { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
import { RemoveBackground } from "@/seqta/utils/DisableRemove/RemoveBackground";
import { RemoveShortcutDiv } from "@/seqta/utils/DisableRemove/RemoveShortcutDiv";
@@ -27,7 +25,6 @@ export class StorageChangeHandler {
settingsState.register('onoff', this.handleOnOffChange.bind(this));
settingsState.register('shortcuts', this.handleShortcutsChange.bind(this));
settingsState.register('customshortcuts', this.handleCustomShortcutsChange.bind(this));
settingsState.register('notificationcollector', this.handleNotificationCollectorChange.bind(this));
settingsState.register('bksliderinput', updateBgDurations.bind(this));
settingsState.register('animatedbk', this.handleAnimatedBkChange.bind(this));
settingsState.register('transparencyEffects', this.handleTransparencyEffectsChange.bind(this));
@@ -43,14 +40,6 @@ export class StorageChangeHandler {
browser.runtime.sendMessage({ type: 'reloadTabs' });
}
private handleNotificationCollectorChange(newValue: boolean) {
if (newValue) {
enableNotificationCollector();
} else {
disableNotificationCollector();
}
}
private handleCustomShortcutsChange(newValue: CustomShortcut[], oldValue: CustomShortcut[]) {
if (newValue) {
if (newValue.length > oldValue.length) {