add initial bugfixes

This commit is contained in:
Alphons
2023-12-02 17:44:48 +08:00
parent 5d8b3bf04d
commit 4fe759b5bb
6 changed files with 4795 additions and 27 deletions
+2280
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -11,7 +11,7 @@
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "MIT",
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1", "css-loader": "^6.8.1",
+2451
View File
File diff suppressed because it is too large Load Diff
+29 -23
View File
@@ -44,10 +44,7 @@ document.addEventListener(
IsSEQTAPage = true; IsSEQTAPage = true;
console.log('[BetterSEQTA+] Verified SEQTA Page'); console.log('[BetterSEQTA+] Verified SEQTA Page');
let link = document.createElement('link'); const link = GetCSSElement('css/documentload.css');
link.href = chrome.runtime.getURL('css/documentload.css');
link.type = 'text/css';
link.rel = 'stylesheet';
document.getElementsByTagName('html')[0].appendChild(link); document.getElementsByTagName('html')[0].appendChild(link);
enableCurrentTheme(); enableCurrentTheme();
@@ -366,19 +363,34 @@ async function RunColourCheck(element) {
} }
} }
export function GetiFrameCSSElement() { export function GetCSSElement (file) {
var cssFile = chrome.runtime.getURL('css/iframe.css'); const cssFile = chrome.runtime.getURL(file)
var fileref = document.createElement('link'); const fileref = document.createElement('link')
fileref.setAttribute('rel', 'stylesheet'); fileref.setAttribute('rel', 'stylesheet')
fileref.setAttribute('type', 'text/css'); fileref.setAttribute('type', 'text/css')
fileref.setAttribute('href', cssFile); fileref.setAttribute('href', cssFile)
return fileref; return fileref
}
function removeThemeTagsFromNotices () {
// Grabs an array of the notice iFrames
const userHTMLArray = document.getElementsByClassName('userHTML')
// Iterates through the array, applying the iFrame css
for (const item of userHTMLArray) {
// Grabs the HTML of the body tag
const body = item.contentWindow.document.querySelectorAll('body')[0]
if (body) {
// Replaces the theme tag with nothing
const bodyText = body.innerHTML
body.innerhtml = bodyText.replace(/\[\[[\w]+[:][\w]+[\]\]]+/g, '').replace(/ +/, ' ')
}
}
} }
function CheckiFrameItems() { function CheckiFrameItems() {
// Injecting CSS File to the webpage to overwrite iFrame default CSS // Injecting CSS File to the webpage to overwrite iFrame default CSS
let fileref = GetiFrameCSSElement(); let fileref = GetCSSElement('css/iframe.css');
const observer = new MutationObserver(function (mutations_list) { const observer = new MutationObserver(function (mutations_list) {
mutations_list.forEach(function (mutation) { mutations_list.forEach(function (mutation) {
@@ -626,6 +638,7 @@ export function tryLoad() {
'load', 'load',
function () { function () {
CheckiFrameItems(); CheckiFrameItems();
removeThemeTagsFromNotices();
}, },
true, true,
); );
@@ -727,13 +740,9 @@ function main(storedSetting) {
} }
function InjectStyles() { function InjectStyles() {
var cssFile = chrome.runtime.getURL('css/injected.css'); const inject = GetCSSElement('css/injected.css');
var fileref = document.createElement('link'); document.head.appendChild(inject);
fileref.setAttribute('rel', 'stylesheet'); document.getElementsByTagName('html')[0].appendChild(inject);
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', cssFile);
document.head.appendChild(fileref);
document.getElementsByTagName('html')[0].appendChild(fileref);
} }
function InjectCustomIcons() { function InjectCustomIcons() {
@@ -820,10 +829,7 @@ export function closeSettings() {
} }
function addExtensionSettings() { function addExtensionSettings() {
const link = document.createElement('link'); const link = GetCSSElement('interface/popup.css');
link.href = chrome.runtime.getURL('interface/popup.css');
link.type = 'text/css';
link.rel = 'stylesheet';
document.querySelector('html').appendChild(link); document.querySelector('html').appendChild(link);
const extensionPopup = document.createElement('div'); const extensionPopup = document.createElement('div');
+31
View File
@@ -66,3 +66,34 @@ table th {
border-top-left-radius: 1rem; border-top-left-radius: 1rem;
border-top-right-radius: 1rem; border-top-right-radius: 1rem;
} }
html, p, div, span {
color: white !important;
background-color: #232323;
}
body {
background-color: #232323;
}
blockquote.forward > .preamble {
color: rgba(255, 255, 255, 0.7) !important;
}
blockquote.forward > .preamble > .date > .value,
blockquote.forward > .preamble > .sender > .value {
color: rgba(255, 255, 255, 0.7) !important;
}
blockquote.forward > .preamble > .date > .label,
blockquote.forward > .preamble > .sender > .label {
color: rgba(255, 255, 255, 0.7) !important;
}
#backgroundTable > * {
background-color: #161616;
border: none;
}
.userHTML>div>a:not(.resource) {
color: #06b4fc;
text-decoration: underline;
transition: text-shadow 0.5s;
}
+3 -3
View File
@@ -1,5 +1,5 @@
/* global chrome */ /* global chrome */
import { GetThresholdOfColor, GetiFrameCSSElement } from '../../../SEQTA.js'; import { GetThresholdOfColor, GetCSSElement } from '../../../SEQTA.js';
import { lightenAndPaleColor } from './lightenAndPaleColor.js'; import { lightenAndPaleColor } from './lightenAndPaleColor.js';
import ColorLuminance from './ColorLuminance.js'; import ColorLuminance from './ColorLuminance.js';
@@ -66,7 +66,7 @@ export function updateAllColors(storedSetting, newColor = null) {
} }
let alliframes = document.getElementsByTagName('iframe'); let alliframes = document.getElementsByTagName('iframe');
let fileref = GetiFrameCSSElement(); let fileref = GetCSSElement('css/iframe.css');
for (let i = 0; i < alliframes.length; i++) { for (let i = 0; i < alliframes.length; i++) {
const element = alliframes[i]; const element = alliframes[i];
@@ -79,7 +79,7 @@ export function updateAllColors(storedSetting, newColor = null) {
console.log(element.contentDocument.documentElement); console.log(element.contentDocument.documentElement);
element.contentDocument.documentElement.childNodes[1].style.color = element.contentDocument.documentElement.childNodes[1].style.color =
DarkMode ? 'black' : 'white'; DarkMode ? 'white' : 'black';
element.contentDocument.documentElement.firstChild.appendChild( element.contentDocument.documentElement.firstChild.appendChild(
fileref, fileref,
); );