Spaces:
Running
Running
| (function () { | |
| function overrideContent() { | |
| // Style overrides | |
| document.querySelectorAll('h1').forEach(h => h.style.color = 'red'); | |
| document.querySelectorAll('p').forEach(p => p.style.color = 'coral'); | |
| document.body.style.backgroundColor = 'green'; | |
| // Intercept <a> tag clicks to trigger dynamic loading | |
| document.querySelectorAll('a').forEach(a => { | |
| a.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| const targetUrl = this.href; | |
| window.parent.postMessage({ type: 'navigate', url: targetUrl }, '*'); | |
| }); | |
| }); | |
| } | |
| if (document.readyState !== 'loading') { | |
| overrideContent(); | |
| } else { | |
| document.addEventListener('DOMContentLoaded', overrideContent); | |
| } | |
| })(); | |