Restore robust window.parent theme detection for instant iframe styling
This commit is contained in:
@@ -207,8 +207,14 @@
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
window.isLightTheme = p.get('theme') === 'light';
|
||||
let isLight = false;
|
||||
try {
|
||||
isLight = !window.parent.document.documentElement.classList.contains('dark');
|
||||
} catch (e) {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
isLight = p.get('theme') === 'light';
|
||||
}
|
||||
window.isLightTheme = isLight;
|
||||
})();
|
||||
|
||||
const stage=document.getElementById('stage');
|
||||
@@ -403,9 +409,14 @@
|
||||
<script>
|
||||
(function(){
|
||||
setInterval(() => {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
window.isLightTheme = p.get('theme') === 'light';
|
||||
const isLight = window.isLightTheme;
|
||||
let isLight = false;
|
||||
try {
|
||||
isLight = !window.parent.document.documentElement.classList.contains('dark');
|
||||
} catch (e) {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
isLight = p.get('theme') === 'light';
|
||||
}
|
||||
window.isLightTheme = isLight;
|
||||
|
||||
if (isLight) {
|
||||
document.body.style.setProperty('background', '#ffffff', 'important');
|
||||
|
||||
Reference in New Issue
Block a user