fix settings

This commit is contained in:
SethBurkart123
2023-09-21 11:52:26 +10:00
parent 942e805668
commit 548bead17b
27 changed files with 271 additions and 125 deletions
BIN
View File
Binary file not shown.
+8
View File
@@ -15,4 +15,12 @@ module.exports = {
{ allowConstantExport: true }, { allowConstantExport: true },
], ],
}, },
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
} }
Binary file not shown.
+1
View File
@@ -10,6 +10,7 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@types/chrome": "^0.0.246",
"framer-motion": "^10.16.4", "framer-motion": "^10.16.4",
"react": "^18.2.0", "react": "^18.2.0",
"react-best-gradient-color-picker": "^2.2.22", "react-best-gradient-color-picker": "^2.2.22",
+6 -26
View File
@@ -7,45 +7,25 @@ import logoDark from './assets/betterseqta-light-full.png';
import Shortcuts from './pages/Shortcuts'; import Shortcuts from './pages/Shortcuts';
import About from './pages/About'; import About from './pages/About';
export interface SettingsState { import type { SettingsState } from './types/AppProps';
notificationCollector: boolean; import useSettingsState from './hooks/settingsState';
lessonAlerts: boolean;
animatedBackground: boolean;
animatedBackgroundSpeed: boolean;
customThemeColor: string;
betterSEQTAPlus: boolean;
}
const App: React.FC = () => { const App: React.FC = () => {
const [settingsState, setSettingsState] = useState<SettingsState>({ const [settingsState, setSettingsState] = useState<SettingsState>({
notificationCollector: false, notificationCollector: false,
lessonAlerts: false, lessonAlerts: false,
animatedBackground: false, animatedBackground: false,
animatedBackgroundSpeed: false, animatedBackgroundSpeed: "0",
customThemeColor: "#db6969", customThemeColor: "#db6969",
betterSEQTAPlus: true betterSEQTAPlus: true
}); });
// Handler for Switches useSettingsState({ settingsState, setSettingsState });
const switchChange = (key: string, isOn: boolean) => {
setSettingsState({
...settingsState,
[key]: isOn,
});
};
// Handler for ColorPicker
const colorChange = (color: string) => {
setSettingsState({
...settingsState,
customThemeColor: color,
});
};
const tabs = [ const tabs = [
{ {
title: 'Settings', title: 'Settings',
content: <Settings settingsState={settingsState} switchChange={switchChange} colorChange={colorChange} /> content: <Settings settingsState={settingsState} setSettingsState={setSettingsState} />
}, },
{ {
title: 'Shortcuts', title: 'Shortcuts',
@@ -59,7 +39,7 @@ const App: React.FC = () => {
{/* <div className="flex justify-center w-screen h-screen pt-4 overflow-hidden" style={{ background: settingsState.customThemeColor }}> */} {/* <div className="flex justify-center w-screen h-screen pt-4 overflow-hidden" style={{ background: settingsState.customThemeColor }}> */}
return ( return (
<div className="flex flex-col w-[24rem] shadow-2xl gap-2 bg-white rounded-xl h-[590px] dark:bg-zinc-800 dark:text-white"> <div className="flex flex-col w-[384px] shadow-2xl gap-2 bg-white rounded-xl h-[590px] dark:bg-zinc-800 dark:text-white">
<div className="grid border-b border-b-zinc-200/40 place-items-center"> <div className="grid border-b border-b-zinc-200/40 place-items-center">
<img src={logo} className="w-4/5 dark:hidden" /> <img src={logo} className="w-4/5 dark:hidden" />
<img src={logoDark} className="hidden w-4/5 dark:block" /> <img src={logoDark} className="hidden w-4/5 dark:block" />
-6
View File
@@ -1,6 +0,0 @@
interface ColorPickerProps {
color: string;
onChange: (color: string) => void;
}
declare const Picker: ({ color, onChange }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
export default Picker;
+3 -6
View File
@@ -1,10 +1,7 @@
// @ts-expect-error There aren't any types for the below library
import ColorPicker from 'react-best-gradient-color-picker'; import ColorPicker from 'react-best-gradient-color-picker';
import React, { useState, useRef, useEffect } from 'react'; import { useState, useRef, useEffect } from 'react';
import type { ColorPickerProps } from '../types/ColorPicker';
interface ColorPickerProps {
color: string;
onChange: (color: string) => void;
}
const Picker = ({ color, onChange }: ColorPickerProps) => { const Picker = ({ color, onChange }: ColorPickerProps) => {
const [showPicker, setShowPicker] = useState<boolean>(false); const [showPicker, setShowPicker] = useState<boolean>(false);
+1 -4
View File
@@ -1,9 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import "./Slider.css"; import "./Slider.css";
import type { Slider } from '../types/Slider';
interface Slider {
onValueChange: (value: number) => void;
}
const Slider: React.FC<Slider> = ({ onValueChange }) => { const Slider: React.FC<Slider> = ({ onValueChange }) => {
const [sliderValue, setSliderValue] = useState(0); const [sliderValue, setSliderValue] = useState(0);
-7
View File
@@ -1,7 +0,0 @@
import "./Switch.css";
interface SwitchProps {
onChange: (isOn: boolean) => void;
state: boolean;
}
export default function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
export {};
+1 -5
View File
@@ -1,10 +1,6 @@
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import "./Switch.css"; import "./Switch.css";
import type { SwitchProps } from "../types/Switch";
interface SwitchProps {
onChange: (isOn: boolean) => void;
state: boolean;
}
export default function Switch(props: SwitchProps) { export default function Switch(props: SwitchProps) {
const toggleSwitch = () => { const toggleSwitch = () => {
+1 -10
View File
@@ -1,15 +1,6 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import type { TabbedContainerProps } from '../types/TabbedContainer';
interface Tab {
title: string;
content: JSX.Element;
}
interface TabbedContainerProps {
tabs: Tab[];
themeColor: string;
}
const TabbedContainer: React.FC<TabbedContainerProps> = ({ tabs, themeColor }) => { const TabbedContainer: React.FC<TabbedContainerProps> = ({ tabs, themeColor }) => {
const [activeTab, setActiveTab] = useState(0); const [activeTab, setActiveTab] = useState(0);
+79
View File
@@ -0,0 +1,79 @@
/*global chrome*/
import { useEffect, useMemo } from "react";
import { SettingsProps } from "../types/SettingsProps";
import { MainConfig, SettingsState } from "../types/AppProps";
let RanOnce = false;
type StorageKeyToStateKeyMap = {
[key in keyof MainConfig]?: keyof SettingsState;
};
let previousSettingsState: SettingsState
const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) => {
// run the following code once
useEffect(() => {
if (RanOnce) return;
RanOnce = true;
// get the current settings state
chrome.storage.local.get(function(result: MainConfig) {
setSettingsState({
notificationCollector: result.notificationcollector,
lessonAlerts: result.lessonalert,
animatedBackground: result.animatedbk,
animatedBackgroundSpeed: result.bksliderinput,
customThemeColor: result.selectedColor,
betterSEQTAPlus: result.onoff
});
});
});
const keyToStateMap = useMemo(() => ({
"notificationcollector": "notificationCollector",
"lessonalert": "lessonAlerts",
"animatedbk": "animatedBackground",
"bksliderinput": "animatedBackgroundSpeed",
"selectedColor": "customThemeColor",
"onoff": "betterSEQTAPlus",
}), []);
const storageChangeListener = (changes: chrome.storage.StorageChange) => {
for (const [key, { newValue }] of Object.entries(changes)) {
const stateKey = keyToStateMap[key as keyof MainConfig];
if (stateKey) {
setSettingsState((prevState: SettingsState) => ({
...prevState,
[stateKey]: newValue
}));
}
}
};
useEffect(() => {
chrome.storage.onChanged.addListener(storageChangeListener);
return () => {
chrome.storage.onChanged.removeListener(storageChangeListener);
};
});
const setStorage = (key: keyof MainConfig, value: any) => {
console.log(chrome.storage.local.set({ [key]: value }));
}
useEffect(() => {
console.log("settingsState", settingsState)
console.log("previousSettingsState", previousSettingsState)
if (previousSettingsState) {
for (const [key, value] of Object.entries(settingsState)) {
const storageKey = Object.keys(keyToStateMap).find(k => keyToStateMap[k] === key);
if (storageKey && value !== previousSettingsState[key]) {
console.log("key", storageKey)
setStorage(storageKey as keyof MainConfig, value);
}
}
}
previousSettingsState = settingsState;
}, [settingsState, keyToStateMap])
}
export default useSettingsState;
+18 -15
View File
@@ -1,21 +1,24 @@
import Switch from '../components/Switch'; import Switch from '../components/Switch';
import ColorPicker from '../components/ColorPicker'; import ColorPicker from '../components/ColorPicker';
import { SettingsState } from '../../../src/popup/App'; import { SettingsProps, SettingsList } from '../types/SettingsProps';
interface ISetting { const Settings: React.FC<SettingsProps> = ({ settingsState, setSettingsState }) => {
title: string;
description: string;
modifyElement: JSX.Element;
}
interface SettingsProps { const switchChange = (key: string, isOn: boolean) => {
settingsState: SettingsState; setSettingsState({
switchChange: (key: string, isOn: boolean) => void; ...settingsState,
colorChange: (color: string) => void; [key]: isOn,
} });
};
const Settings: React.FC<SettingsProps> = ({ settingsState, switchChange, colorChange }) => { const colorChange = (color: string) => {
const settings: ISetting[] = [ setSettingsState({
...settingsState,
customThemeColor: color,
});
};
const settings: SettingsList[] = [
{ {
title: "Notification Collector", title: "Notification Collector",
description: "Uncaps the 9+ limit for notifications, showing the real number.", description: "Uncaps the 9+ limit for notifications, showing the real number.",
@@ -34,7 +37,7 @@ const Settings: React.FC<SettingsProps> = ({ settingsState, switchChange, colorC
{ {
title: "Animated Background Speed", title: "Animated Background Speed",
description: "Controls the speed of the animated background.", description: "Controls the speed of the animated background.",
modifyElement: <Switch state={settingsState.animatedBackgroundSpeed} onChange={(isOn: boolean) => switchChange('animatedBackgroundSpeed', isOn)} /> modifyElement: <div>Insert Slider Please</div>
}, },
{ {
title: "Custom Theme Colour", title: "Custom Theme Colour",
@@ -43,7 +46,7 @@ const Settings: React.FC<SettingsProps> = ({ settingsState, switchChange, colorC
}, },
{ {
title: "BetterSEQTA+", title: "BetterSEQTA+",
description: "Unlocks premium features.", description: "Enables BetterSEQTA+ features",
modifyElement: <Switch state={settingsState.betterSEQTAPlus} onChange={(isOn: boolean) => switchChange('betterSEQTAPlus', isOn)} /> modifyElement: <Switch state={settingsState.betterSEQTAPlus} onChange={(isOn: boolean) => switchChange('betterSEQTAPlus', isOn)} />
} }
]; ];
+53
View File
@@ -0,0 +1,53 @@
export interface SettingsState {
notificationCollector: boolean;
lessonAlerts: boolean;
animatedBackground: boolean;
animatedBackgroundSpeed: string;
customThemeColor: string;
betterSEQTAPlus: boolean;
}
// Define the ToggleItem interface for the nested objects in menuitems
interface ToggleItem {
toggle: boolean;
}
// Define the Shortcut interface for the objects in the shortcuts array
interface Shortcut {
enabled: boolean;
name: string;
}
// Define the MainConfig interface for the top-level object
export interface MainConfig {
DarkMode: boolean;
animatedbk: boolean;
bksliderinput: string;
customshortcuts: any[];
defaultmenuorder: any[];
lessonalert: boolean;
menuitems: {
assessments: ToggleItem;
courses: ToggleItem;
dashboard: ToggleItem;
documents: ToggleItem;
forums: ToggleItem;
goals: ToggleItem;
home: ToggleItem;
messages: ToggleItem;
myed: ToggleItem;
news: ToggleItem;
notices: ToggleItem;
portals: ToggleItem;
reports: ToggleItem;
settings: ToggleItem;
timetable: ToggleItem;
welcome: ToggleItem;
};
menuorder: any[];
notificationcollector: boolean;
onoff: boolean;
selectedColor: string;
shortcuts: Shortcut[];
subjectfilters: Record<string, any>; // Could be more specific based on what types are allowed
}
+4
View File
@@ -0,0 +1,4 @@
export interface ColorPickerProps {
color: string;
onChange: (color: string) => void;
}
+11
View File
@@ -0,0 +1,11 @@
import type { SettingsState } from './AppProps';
export interface SettingsList {
title: string;
description: string;
modifyElement: JSX.Element;
}
export interface SettingsProps {
settingsState: SettingsState;
setSettingsState: React.Dispatch<React.SetStateAction<SettingsState>>;
}
@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import "./Slider.css"; import "./Slider.css";
interface Slider { export interface Slider {
onValueChange: (value: number) => void; onValueChange: (value: number) => void;
} }
declare const Slider: React.FC<Slider>; declare const Slider: React.FC<Slider>;
+6
View File
@@ -0,0 +1,6 @@
import "./Switch.css";
export interface SwitchProps {
onChange: (isOn: boolean) => void;
state: boolean;
}
@@ -1,9 +1,9 @@
import React, { JSX } from 'react'; import React, { JSX } from 'react';
interface Tab { export interface Tab {
title: string; title: string;
content: JSX.Element; content: JSX.Element;
} }
interface TabbedContainerProps { export interface TabbedContainerProps {
tabs: Tab[]; tabs: Tab[];
themeColor: string; themeColor: string;
} }
+1 -1
View File
@@ -4,7 +4,7 @@
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
+8
View File
@@ -58,6 +58,14 @@
{ {
"resources": ["index.css"], "resources": ["index.css"],
"matches": ["*://*/*"] "matches": ["*://*/*"]
},
{
"resources": ["interface/*"],
"matches": ["*://*/*"]
},
{
"resources": ["client/*"],
"matches": ["*://*/*"]
} }
] ]
} }
+1 -2
View File
@@ -14,13 +14,12 @@
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600"); @import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600");
.outside-container { .outside-container {
width: 350px;
margin: 0; margin: 0;
background-color: #131313;
overflow: hidden; overflow: hidden;
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 80px; top: 80px;
height: 590px;
z-index: 20; z-index: 20;
} }
+55 -30
View File
@@ -13,7 +13,7 @@ let SettingsClicked = false;
let MenuOptionsOpen = false; let MenuOptionsOpen = false;
let UserInitalCode = ""; let UserInitalCode = "";
let currentSelectedDate = new Date(); let currentSelectedDate = new Date();
let WhatsNewOpen = false; //let WhatsNewOpen = false;
let LessonInterval; let LessonInterval;
let DarkMode; let DarkMode;
@@ -25,7 +25,7 @@ function SetDisplayNone(ElementName) {
return `li[data-key=${ElementName}]{display:var(--menuHidden) !important; transition: 1s;}`; return `li[data-key=${ElementName}]{display:var(--menuHidden) !important; transition: 1s;}`;
} }
function animbkEnable (item) { function animbkEnable(item) {
if (item.animatedbk) { if (item.animatedbk) {
CreateBackground(); CreateBackground();
} else { } else {
@@ -38,7 +38,9 @@ function bkValues (item) {
const bg = document.getElementsByClassName("bg"); const bg = document.getElementsByClassName("bg");
const bg2 = document.getElementsByClassName("bg2"); const bg2 = document.getElementsByClassName("bg2");
const bg3 = document.getElementsByClassName("bg3"); const bg3 = document.getElementsByClassName("bg3");
const value = 200 - item.bksliderinput; const value = 200 - item.bksliderinput; // reverse the slider direction to match the animation direction
if (bg.length == 0 || bg2.length == 0 || bg3.length == 0) return;
const minDuration = 1; // minimum duration in seconds const minDuration = 1; // minimum duration in seconds
const maxDuration = 10; // maximum duration in seconds const maxDuration = 10; // maximum duration in seconds
@@ -172,12 +174,12 @@ function OpenWhatsNewPopup() {
var bkelement = document.getElementById("whatsnewbk"); var bkelement = document.getElementById("whatsnewbk");
bkelement.addEventListener("click", function () { bkelement.addEventListener("click", function () {
DeleteWhatsNew(); DeleteWhatsNew();
WhatsNewOpen = false; //WhatsNewOpen = false;
}); });
var closeelement = document.getElementById("whatsnewclosebutton"); var closeelement = document.getElementById("whatsnewclosebutton");
closeelement.addEventListener("click", function () { closeelement.addEventListener("click", function () {
DeleteWhatsNew(); DeleteWhatsNew();
WhatsNewOpen = false; //WhatsNewOpen = false;
}); });
} }
@@ -193,7 +195,7 @@ async function finishLoad() {
chrome.storage.local.get(["justupdated"], function (result) { chrome.storage.local.get(["justupdated"], function (result) {
if (result.justupdated) { if (result.justupdated) {
WhatsNewOpen = true; //WhatsNewOpen = true;
OpenWhatsNewPopup(); OpenWhatsNewPopup();
} }
}); });
@@ -233,6 +235,9 @@ function RemoveBackground() {
var bk = document.getElementsByClassName("bg"); var bk = document.getElementsByClassName("bg");
var bk2 = document.getElementsByClassName("bg2"); var bk2 = document.getElementsByClassName("bg2");
var bk3 = document.getElementsByClassName("bg3"); var bk3 = document.getElementsByClassName("bg3");
if (bk.length == 0 || bk2.length == 0 || bk3.length == 0) return;
bk[0].remove(); bk[0].remove();
bk2[0].remove(); bk2[0].remove();
bk3[0].remove(); bk3[0].remove();
@@ -760,7 +765,6 @@ chrome.storage.onChanged.addListener(function (changes) {
"--better-main", "--better-main",
changes.selectedColor.newValue, changes.selectedColor.newValue,
); );
// document.documentElement.style.setProperty('--better-sub', ColorLuminance(changes.selectedColor.newValue, -0.15));
if (changes.selectedColor.newValue == "#ffffff") { if (changes.selectedColor.newValue == "#ffffff") {
document.documentElement.style.setProperty("--better-light", "#b7b7b7"); document.documentElement.style.setProperty("--better-light", "#b7b7b7");
@@ -801,7 +805,7 @@ async function CheckLoadOnPeriods() {
} }
} }
function RunFunctionOnTrue(storedSetting) { function main(storedSetting) {
DarkMode = storedSetting.DarkMode; DarkMode = storedSetting.DarkMode;
// If the option is 'on', open BetterSEQTA // If the option is 'on', open BetterSEQTA
if (typeof storedSetting.onoff == "undefined") { if (typeof storedSetting.onoff == "undefined") {
@@ -891,7 +895,6 @@ function RunFunctionOnTrue(storedSetting) {
"--better-main", "--better-main",
storedSetting.selectedColor, storedSetting.selectedColor,
); );
// document.documentElement.style.setProperty('--better-sub', ColorLuminance(storedSetting.selectedColor, -0.15));
if (storedSetting.selectedColor == "#ffffff") { if (storedSetting.selectedColor == "#ffffff") {
document.documentElement.style.setProperty("--better-light", "#b7b7b7"); document.documentElement.style.setProperty("--better-light", "#b7b7b7");
@@ -966,7 +969,7 @@ document.addEventListener(
document.getElementsByTagName("html")[0].appendChild(link); document.getElementsByTagName("html")[0].appendChild(link);
chrome.storage.local.get(null, function (items) { chrome.storage.local.get(null, function (items) {
RunFunctionOnTrue(items); main(items);
}); });
} }
if ( if (
@@ -978,7 +981,7 @@ document.addEventListener(
}, },
true, true,
); );
/*
function RunExtensionSettingsJS() { function RunExtensionSettingsJS() {
const whatsnewsettings = document.getElementById("whatsnewsettings"); const whatsnewsettings = document.getElementById("whatsnewsettings");
whatsnewsettings.addEventListener("click", function () { whatsnewsettings.addEventListener("click", function () {
@@ -1043,9 +1046,9 @@ function RunExtensionSettingsJS() {
function FindSEQTATab() { function FindSEQTATab() {
chrome.runtime.sendMessage({ type: "reloadTabs" }); chrome.runtime.sendMessage({ type: "reloadTabs" });
} }
/*
Store the currently selected settings using chrome.storage.local. // Store the currently selected settings using chrome.storage.local.
*/
function storeSettings() { function storeSettings() {
chrome.storage.local.set({ onoff: onoffselection.checked }, function () { chrome.storage.local.set({ onoff: onoffselection.checked }, function () {
FindSEQTATab(); FindSEQTATab();
@@ -1072,10 +1075,10 @@ function RunExtensionSettingsJS() {
FindSEQTATab(); FindSEQTATab();
} }
/*
Update the options UI with the settings values retrieved from storage, // Update the options UI with the settings values retrieved from storage,
or the default settings if the stored settings are empty. // or the default settings if the stored settings are empty.
*/
function updateUI(restoredSettings) { function updateUI(restoredSettings) {
if (typeof restoredSettings.onoff == "undefined") { if (typeof restoredSettings.onoff == "undefined") {
chrome.runtime.sendMessage({ type: "setDefaultStorage" }); chrome.runtime.sendMessage({ type: "setDefaultStorage" });
@@ -1310,7 +1313,7 @@ function RunExtensionSettingsJS() {
chrome.storage.local.set({ selectedColor: b }); chrome.storage.local.set({ selectedColor: b });
} }
}); });
} }*/
function CallExtensionSettings() { function CallExtensionSettings() {
// Injecting CSS File to the webpage to overwrite iFrame default CSS // Injecting CSS File to the webpage to overwrite iFrame default CSS
@@ -1333,7 +1336,7 @@ function CallExtensionSettings() {
fileref.setAttribute("href", cssFile); fileref.setAttribute("href", cssFile);
document.head.append(fileref); document.head.append(fileref);
let Settings = /*let Settings =
stringToHTML( stringToHTML(
String.raw` String.raw`
<div class="outside-container hidden" id="ExtensionPopup"><div class="logo-container"><img src=${chrome.runtime.getURL( <div class="outside-container hidden" id="ExtensionPopup"><div class="logo-container"><img src=${chrome.runtime.getURL(
@@ -1580,20 +1583,31 @@ function CallExtensionSettings() {
<p style="margin: 0; flex: 1; padding-left: 24px; margin-right: 5px; color: white;">By SethBurkart123</p> <p style="margin: 0; flex: 1; padding-left: 24px; margin-right: 5px; color: white;">By SethBurkart123</p>
<button style="margin: 0; margin-right: 20px; cursor:pointer; padding: 8px 10px; background: #ff5f5f; color:#1a1a1a;font-weight: 500; border-radius: 10px;" id="whatsnewsettings">Changelog v${chrome.runtime.getManifest().version}</button> <button style="margin: 0; margin-right: 20px; cursor:pointer; padding: 8px 10px; background: #ff5f5f; color:#1a1a1a;font-weight: 500; border-radius: 10px;" id="whatsnewsettings">Changelog v${chrome.runtime.getManifest().version}</button>
</div> </div>
</div></div>`); </div></div>`);*/
document.body.append(Settings.firstChild); let Settings2 =
stringToHTML(
String.raw`
<div class="outside-container hide" id="ExtensionPopup">
</div>
`);
document.body.append(Settings2.firstChild);
// override old popup with new (experimental) // add an iframe to the div: <iframe src="interface/index.html"></iframe>
const script = document.createElement("script"); let iframe = document.createElement("iframe");
script.type = "module"; iframe.src = chrome.runtime.getURL("interface/index.html");
script.src = chrome.runtime.getURL("client.js"); iframe.allowTransparency = "true";
(document.head||document.documentElement).appendChild(script); iframe.style.width = "384px";
iframe.style.height = "590px";
iframe.style.border = "none";
iframe.setAttribute("excludeDarkCheck", "true");
document.getElementById("ExtensionPopup").append(iframe);
var container = document.getElementById("container"); var container = document.getElementById("container");
var extensionsettings = document.getElementById("ExtensionPopup"); var extensionsettings = document.getElementById("ExtensionPopup");
container.onclick = function () { container.onclick = function () {
if (!SettingsClicked) { if (!SettingsClicked) {
extensionsettings.classList.add("hidden"); extensionsettings.classList.add("hide");
} }
SettingsClicked = false; SettingsClicked = false;
}; };
@@ -2056,8 +2070,9 @@ function AddBetterSEQTAElements(toggle) {
} }
CallExtensionSettings(); CallExtensionSettings();
RunExtensionSettingsJS(); //RunExtensionSettingsJS();
// If betterSEQTA+ is enabled, run the code
if (toggle) { if (toggle) {
// Creates settings and dashboard buttons next to alerts // Creates settings and dashboard buttons next to alerts
var SettingsButton = stringToHTML( var SettingsButton = stringToHTML(
@@ -2118,6 +2133,11 @@ function AddBetterSEQTAElements(toggle) {
for (let i = 0; i < alliframes.length; i++) { for (let i = 0; i < alliframes.length; i++) {
const element = alliframes[i]; const element = alliframes[i];
if (element.getAttribute("excludeDarkCheck") == "true") {
continue;
}
element.contentDocument.documentElement.childNodes[1].style.color = element.contentDocument.documentElement.childNodes[1].style.color =
"white"; "white";
element.contentDocument.documentElement.firstChild.appendChild( element.contentDocument.documentElement.firstChild.appendChild(
@@ -2151,6 +2171,11 @@ function AddBetterSEQTAElements(toggle) {
for (let i = 0; i < alliframes.length; i++) { for (let i = 0; i < alliframes.length; i++) {
const element = alliframes[i]; const element = alliframes[i];
if (element.getAttribute("excludeDarkCheck") == "true") {
continue;
}
element.contentDocument.documentElement.childNodes[1].style.color = element.contentDocument.documentElement.childNodes[1].style.color =
"black"; "black";
element.contentDocument.documentElement.firstChild.lastChild.remove(); element.contentDocument.documentElement.firstChild.lastChild.remove();
@@ -2174,7 +2199,7 @@ function AddBetterSEQTAElements(toggle) {
var AddedSettings = document.getElementById("AddedSettings"); var AddedSettings = document.getElementById("AddedSettings");
var extensionsettings = document.getElementById("ExtensionPopup"); var extensionsettings = document.getElementById("ExtensionPopup");
AddedSettings.addEventListener("click", function () { AddedSettings.addEventListener("click", function () {
extensionsettings.classList.toggle("hidden"); extensionsettings.classList.toggle("hide");
SettingsClicked = true; SettingsClicked = true;
}); });
} }
+5 -9
View File
@@ -1,6 +1,5 @@
@import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600"); @import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,600");
@import "./injected/popup.css"; @import "./injected/popup.css";
@import "./popup.css";
:root { :root {
background-color: var(--better-main) !important; background-color: var(--better-main) !important;
@@ -24,11 +23,6 @@ html {
--theme-fg-parts: white; --theme-fg-parts: white;
} }
#title {
color: var(--text-primary);
font-weight: 500 !important;
}
@media (min-width: 900px) { @media (min-width: 900px) {
#title > span { #title > span {
transform: translateY(2px); transform: translateY(2px);
@@ -611,10 +605,12 @@ div > ol:has(.uiFileHandlerWrapper) {
#title { #title {
background: var(--background-primary); background: var(--background-primary);
color: var(--text-primary);
height: 4rem; height: 4rem;
box-shadow: rgb(0 0 0 / 35%) 0px 0px 10px;
min-height: 48px; min-height: 48px;
box-shadow: rgb(0 0 0 / 35%) 0px 0px 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.1);
font-weight: 500 !important;
z-index: 1; z-index: 1;
} }
@@ -1085,7 +1081,7 @@ div > ol:has(.uiFileHandlerWrapper) {
#ExtensionPopup { #ExtensionPopup {
border-radius: 1rem; border-radius: 1rem;
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.4); box-shadow: 0px 0px 20px -2px rgba(0,0,0,0.6)
} }
#menu li.active { #menu li.active {
@@ -1676,7 +1672,7 @@ body {
} }
.MessageList__MessageList___3DxoC > ol > li.MessageList__unread___3imtO { .MessageList__MessageList___3DxoC > ol > li.MessageList__unread___3imtO {
box-shadow: inset 3px 0 rgb(255, 255, 255); box-shadow: inset 3px 0 var(--better-main);
} }
.connectedNotificationsWrapper > div > button { .connectedNotificationsWrapper > div > button {
+5
View File
@@ -5,3 +5,8 @@
.topmenu { .topmenu {
margin-top: 0; margin-top: 0;
} }
.hide {
opacity: 0;
pointer-events: none;
}
File diff suppressed because one or more lines are too long
+1
View File
@@ -64,6 +64,7 @@ export default {
{ from: "public", to: "." }, { from: "public", to: "." },
{ from: "src/inject/preview", to: "inject/preview" }, { from: "src/inject/preview", to: "inject/preview" },
{ from: "node_modules/webextension-polyfill/dist/browser-polyfill.js", to: "."}, { from: "node_modules/webextension-polyfill/dist/browser-polyfill.js", to: "."},
{ from: "interface/dist/client", to: "client" }
], ],
}), }),
], ],