mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
refactor: addbetterseqtaelements function reducing complexity
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import browser from "webextension-polyfill";
|
|
||||||
import { GetThresholdOfColor, SendNewsPage, addExtensionSettings, enableAnimatedBackground, loadHomePage, setupSettingsButton } from "../../SEQTA";
|
import { GetThresholdOfColor, SendNewsPage, addExtensionSettings, enableAnimatedBackground, loadHomePage, setupSettingsButton } from "../../SEQTA";
|
||||||
import { updateBgDurations } from "./Animation";
|
import { updateBgDurations } from "./Animation";
|
||||||
import { appendBackgroundToUI } from "./ImageBackgrounds";
|
import { appendBackgroundToUI } from "./ImageBackgrounds";
|
||||||
@@ -6,10 +5,12 @@ import stringToHTML from "../utils/stringToHTML";
|
|||||||
import { settingsState } from "../utils/listeners/SettingsState";
|
import { settingsState } from "../utils/listeners/SettingsState";
|
||||||
import { updateAllColors } from "./colors/Manager";
|
import { updateAllColors } from "./colors/Manager";
|
||||||
|
|
||||||
export async function AddBetterSEQTAElements(toggle: any) {
|
export async function AddBetterSEQTAElements() {
|
||||||
if (toggle) {
|
if (settingsState.onoff) {
|
||||||
initializeSettings();
|
initializeSettings();
|
||||||
addDarkMode(settingsState.DarkMode);
|
if (settingsState.DarkMode) {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
createHomeButton();
|
createHomeButton();
|
||||||
await handleUserInfo();
|
await handleUserInfo();
|
||||||
handleStudentData();
|
handleStudentData();
|
||||||
@@ -19,7 +20,7 @@ export async function AddBetterSEQTAElements(toggle: any) {
|
|||||||
|
|
||||||
appendBackgroundToUI();
|
appendBackgroundToUI();
|
||||||
addExtensionSettings();
|
addExtensionSettings();
|
||||||
if (toggle) {
|
if (settingsState.onoff) {
|
||||||
await createSettingsButton();
|
await createSettingsButton();
|
||||||
await addDarkLightToggle();
|
await addDarkLightToggle();
|
||||||
customizeMenuToggle();
|
customizeMenuToggle();
|
||||||
@@ -35,12 +36,6 @@ function initializeSettings() {
|
|||||||
updateBgDurations();
|
updateBgDurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDarkMode(DarkMode: boolean) {
|
|
||||||
if (DarkMode) {
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function createHomeButton() {
|
function createHomeButton() {
|
||||||
const container = document.getElementById('content')!;
|
const container = document.getElementById('content')!;
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
Reference in New Issue
Block a user