mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: add global theme toggle
This commit is contained in:
@@ -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+"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user