generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom.js
More file actions
31 lines (27 loc) · 1.04 KB
/
custom.js
File metadata and controls
31 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function updateMintlifyLinks() {
const isIndex = location.pathname.endsWith('/') || location.pathname.endsWith('/index.html');
document.querySelectorAll('a').forEach(a => {
if (a.textContent.trim() === "Powered by Mintlify") {
if (!isIndex) {
a.style.fontSize = "0.7em";
a.style.fontWeight = "normal";
}
}
});
}
// Initial run
updateMintlifyLinks();
// Observe DOM changes
const observer = new MutationObserver(() => {
updateMintlifyLinks();
});
observer.observe(document.body, { childList: true, subtree: true });
// Optional: Listen for history navigation (for SPAs)
window.addEventListener('popstate', updateMintlifyLinks);
window.addEventListener('hashchange', updateMintlifyLinks);
// Inject Google AdSense script asynchronously
const adsenseScript = document.createElement('script');
adsenseScript.async = true;
adsenseScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1599021797146517';
adsenseScript.crossOrigin = 'anonymous';
document.head.appendChild(adsenseScript);