CoolFace
Apppublic

AstraOS/iframe.src-blobUrl

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
override.js24 linesDownload Raw Back to root
1(function () {
2  function overrideContent() {
3    // Style overrides
4    document.querySelectorAll('h1').forEach(h => h.style.color = 'red');
5    document.querySelectorAll('p').forEach(p => p.style.color = 'coral');
6    document.body.style.backgroundColor = 'green';
7
8    // Intercept <a> tag clicks to trigger dynamic loading
9    document.querySelectorAll('a').forEach(a => {
10      a.addEventListener('click', function (e) {
11        e.preventDefault();
12        const targetUrl = this.href;
13        window.parent.postMessage({ type: 'navigate', url: targetUrl }, '*');
14      });
15    });
16  }
17
18  if (document.readyState !== 'loading') {
19    overrideContent();
20  } else {
21    document.addEventListener('DOMContentLoaded', overrideContent);
22  }
23})();
24