Spaces:
Running
Running
Download override.js from AstraOS/iframe.src-blobUrl: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/AstraOS/iframe.src-blobUrl/resolve/main/override.js
- Command line
-
hf download hf://spaces/AstraOS/iframe.src-blobUrl/override.js
-
curl -L -o override.js https://huggingface.co/spaces/AstraOS/iframe.src-blobUrl/resolve/main/override.js
770 Bytes
| (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); | |
| } | |
| })(); | |