Restore robust window.parent theme detection for instant iframe styling

This commit is contained in:
2026-07-10 16:54:58 +05:30
parent 90700c0268
commit ead4942b6d
2 changed files with 32 additions and 10 deletions

View File

@@ -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');