Merge pull request #73 from SethBurkart123/fix-chrome-ts

Fix chrome ts
This commit is contained in:
Seth Burkart
2023-12-05 16:01:34 +11:00
committed by GitHub
2 changed files with 12 additions and 13 deletions
@@ -23,7 +23,6 @@ const ThemeSelector = ({ selectedType, setSelectedType, isEditMode }: ThemeSelec
useEffect(() => { useEffect(() => {
const initializeThemes = async () => { const initializeThemes = async () => {
const downloaded = (await listThemes()); const downloaded = (await listThemes());
const initializedThemes = themesList.map(theme => ({ const initializedThemes = themesList.map(theme => ({
...theme, ...theme,
isDownloaded: downloaded.themes.includes(theme.name), isDownloaded: downloaded.themes.includes(theme.name),
+12 -12
View File
@@ -438,11 +438,13 @@ function CheckiFrameItems() {
'iframe.css', 'iframe.css',
) )
) { ) {
innerHTMLNode.appendChild( innerHTMLNode.append(
fileref, 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 ( if (
childNode.style childNode.style
.color != 'white' .color != 'white'
@@ -455,7 +457,7 @@ function CheckiFrameItems() {
'iframe.css', 'iframe.css',
) )
) { ) {
innerHTMLNode.appendChild( innerHTMLNode.append(
fileref, fileref,
); );
} }
@@ -638,11 +640,14 @@ function CheckNoticeTextColour(notice: any) {
DarkMode = result.DarkMode; DarkMode = result.DarkMode;
if (node.classList.contains('notice')) { if (node.classList.contains('notice')) {
var hex = node.style.cssText.split(' ')[1]; 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) { if (DarkMode && threshold < 100) {
node.style.cssText = '--color: undefined;'; node.style.cssText = '--color: undefined;';
} }
} }
}
} }
result.then(open, onError) result.then(open, onError)
}); });
@@ -683,7 +688,7 @@ export function tryLoad() {
true, true,
); );
const observer = new MutationObserver(() => { documentTextColor() }) 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) { function ChangeMenuItemPositions(storage: any) {
@@ -773,16 +778,11 @@ function main(storedSetting: any) {
if (onoff) { if (onoff) {
console.log('[BetterSEQTA+] Enabled'); console.log('[BetterSEQTA+] Enabled');
initialize(); initialize();
tryLoad();
if (!isChrome || isChrome === 'undefined') {
tryLoad();
}
window.addEventListener('load', tryLoad); window.addEventListener('load', tryLoad);
} else { } else {
if (!isChrome || isChrome === 'undefined') { handleDisabled()
handleDisabled();
}
window.addEventListener('load', handleDisabled); window.addEventListener('load', handleDisabled);
} }
} }