From f64d0ac04246d936820e03f52a90b36bc5e762cd Mon Sep 17 00:00:00 2001 From: Crazypersonalph <93847055+Crazypersonalph@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:13:20 +0800 Subject: [PATCH 1/3] fix notice colour issue --- public/manifest.json | 76 ++++++++++++++------------------------------ src/SEQTA.ts | 13 +++++--- 2 files changed, 32 insertions(+), 57 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index 3b33a730..91c161e0 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,14 +1,12 @@ { - "manifest_version": 3, + "manifest_version": 2, "name": "BetterSEQTA+", "version": "3.2.2", "description": "Make SEQTA usable and beautiful! A fork of BetterSEQTA to continue development and add WAY more features!!!", "icons": { - "32": "icons/icon-32.png", - "48": "icons/icon-48.png", - "64": "icons/icon-64.png" + "48": "icons/icon-48.png" }, - "action": { + "browser_action": { "browser_style": true, "default_popup": "interface/index.html#settings", "default_icon": { @@ -17,11 +15,16 @@ "64": "icons/icon-64.png" } }, - "permissions": ["tabs", "notifications", "storage"], - "host_permissions": ["https://newsapi.org/", "*://*/*"], + "permissions": ["tabs", "notifications", "storage", "https://newsapi.org/"], "background": { - "service_worker": "background.js" - }, + "scripts": [ + "browser-polyfill.js", + "background.js" + ] +}, + "optional_permissions": [ + "*://*/*" + ], "content_scripts": [ { "matches": ["*://*/*"], @@ -30,49 +33,16 @@ } ], "web_accessible_resources": [ - { - "resources": ["icons/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["fonts/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["images/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["css/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["popup/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["client.js"], - "matches": ["*://*/*"] - }, - { - "resources": ["index.css"], - "matches": ["*://*/*"] - }, - { - "resources": ["interface/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["client/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["resources/*"], - "matches": ["*://*/*"] - }, - { - "resources": ["backgrounds/*"], - "matches": ["*://*/*"] - } + "icons/*", + "fonts/*", + "images/*", + "css/*", + "popup/*", + "client.js", + "index.css", + "interface/*", + "client/*", + "resources/*", + "backgrounds/*" ] } \ No newline at end of file diff --git a/src/SEQTA.ts b/src/SEQTA.ts index cc5c587c..4649c305 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -438,11 +438,13 @@ function CheckiFrameItems() { 'iframe.css', ) ) { - innerHTMLNode.appendChild( + innerHTMLNode.append( fileref, ); } - added_node.addEventListener('load', function () { + node.addEventListener('load', function () { + const childNode = node.contentDocument!.documentElement.childNodes[1] as HTMLElement + const innerHTMLNode = node.contentDocument!.documentElement.firstChild! as HTMLElement if ( childNode.style .color != 'white' @@ -455,7 +457,7 @@ function CheckiFrameItems() { 'iframe.css', ) ) { - innerHTMLNode.appendChild( + innerHTMLNode.append( fileref, ); } @@ -638,11 +640,14 @@ function CheckNoticeTextColour(notice: any) { DarkMode = result.DarkMode; if (node.classList.contains('notice')) { var hex = node.style.cssText.split(' ')[1]; - var threshold = GetThresholdOfColor(hex); + if (hex) { + const hex1 = hex.slice(0,-1) + var threshold = GetThresholdOfColor(hex1); if (DarkMode && threshold < 100) { node.style.cssText = '--color: undefined;'; } } + } } result.then(open, onError) }); From 8466d1e20d7452d8341b756438808fadb35f1db5 Mon Sep 17 00:00:00 2001 From: Crazypersonalph <93847055+Crazypersonalph@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:51:10 +0800 Subject: [PATCH 2/3] hacky solution deployed --- interface/src/components/ThemeSelector.tsx | 1 - src/SEQTA.ts | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/interface/src/components/ThemeSelector.tsx b/interface/src/components/ThemeSelector.tsx index dfee00cd..b9fdc5a9 100644 --- a/interface/src/components/ThemeSelector.tsx +++ b/interface/src/components/ThemeSelector.tsx @@ -23,7 +23,6 @@ const ThemeSelector = ({ selectedType, setSelectedType, isEditMode }: ThemeSelec useEffect(() => { const initializeThemes = async () => { const downloaded = (await listThemes()); - const initializedThemes = themesList.map(theme => ({ ...theme, isDownloaded: downloaded.themes.includes(theme.name), diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 4649c305..c692ecb8 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -688,7 +688,7 @@ export function tryLoad() { true, ); const observer = new MutationObserver(() => { documentTextColor() }) - observer.observe(document.getElementById('toolbar')!, { attributes: true, childList: true, subtree: true }) + observer.observe(document!, { attributes: true, childList: true, subtree: true, attributeFilter: ['td'], }) } function ChangeMenuItemPositions(storage: any) { @@ -778,16 +778,11 @@ function main(storedSetting: any) { if (onoff) { console.log('[BetterSEQTA+] Enabled'); initialize(); - - if (!isChrome || isChrome === 'undefined') { - tryLoad(); - } + tryLoad(); window.addEventListener('load', tryLoad); } else { - if (!isChrome || isChrome === 'undefined') { - handleDisabled(); - } + handleDisabled() window.addEventListener('load', handleDisabled); } } From 768e12d0ac1260b440567e520b13c2c191e891a9 Mon Sep 17 00:00:00 2001 From: Crazypersonalph <93847055+Crazypersonalph@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:53:10 +0800 Subject: [PATCH 3/3] change manifest --- public/manifest.json | 76 ++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index 91c161e0..3b33a730 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,12 +1,14 @@ { - "manifest_version": 2, + "manifest_version": 3, "name": "BetterSEQTA+", "version": "3.2.2", "description": "Make SEQTA usable and beautiful! A fork of BetterSEQTA to continue development and add WAY more features!!!", "icons": { - "48": "icons/icon-48.png" + "32": "icons/icon-32.png", + "48": "icons/icon-48.png", + "64": "icons/icon-64.png" }, - "browser_action": { + "action": { "browser_style": true, "default_popup": "interface/index.html#settings", "default_icon": { @@ -15,16 +17,11 @@ "64": "icons/icon-64.png" } }, - "permissions": ["tabs", "notifications", "storage", "https://newsapi.org/"], + "permissions": ["tabs", "notifications", "storage"], + "host_permissions": ["https://newsapi.org/", "*://*/*"], "background": { - "scripts": [ - "browser-polyfill.js", - "background.js" - ] -}, - "optional_permissions": [ - "*://*/*" - ], + "service_worker": "background.js" + }, "content_scripts": [ { "matches": ["*://*/*"], @@ -33,16 +30,49 @@ } ], "web_accessible_resources": [ - "icons/*", - "fonts/*", - "images/*", - "css/*", - "popup/*", - "client.js", - "index.css", - "interface/*", - "client/*", - "resources/*", - "backgrounds/*" + { + "resources": ["icons/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["fonts/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["images/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["css/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["popup/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["client.js"], + "matches": ["*://*/*"] + }, + { + "resources": ["index.css"], + "matches": ["*://*/*"] + }, + { + "resources": ["interface/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["client/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["resources/*"], + "matches": ["*://*/*"] + }, + { + "resources": ["backgrounds/*"], + "matches": ["*://*/*"] + } ] } \ No newline at end of file