Skip to content

Commit 54d38d6

Browse files
author
Mauve Signweaver
committed
fix: Force default color scheme more effectively
1 parent ac061bf commit 54d38d6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/window.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const DEFAULT_SAVE_INTERVAL = 30 * 1000
3434
const HAS_SHEET = `
3535
[...document.styleSheets].filter((sheet) => {
3636
try {sheet.cssRules; return true} catch {return false}
37-
}).length || !!document.querySelector('[style]')
37+
}).length || !!(document.querySelectorAll('[style]').length > 1)
3838
`
3939

4040
const WINDOW_METHODS = [
@@ -335,11 +335,14 @@ export class Window extends EventEmitter {
335335
if (this.web.getURL() === 'agregore://settings') {
336336
this.web.executeJavaScript(`window.onSettings(${JSON.stringify(Config)})`)
337337
}
338-
const hasStyles = await this.web.executeJavaScript(HAS_SHEET)
338+
const hasStyles = await this.web.executeJavaScript(HAS_SHEET, true)
339+
.catch(() => false) // If we error out checking styles, try it anyway
339340
console.log({ hasStyles })
340341
if (!hasStyles) {
341342
const style = await getDefaultStylesheet(this.web)
342-
await this.web.insertCSS(style)
343+
await this.web.insertCSS(style, {
344+
cssOrigin: 'user'
345+
})
343346
}
344347
})
345348

0 commit comments

Comments
 (0)