60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
// Add v2 banner inside content-container with negative margins
|
|
(function() {
|
|
if (typeof window === 'undefined') return;
|
|
|
|
function addBanner() {
|
|
const isV2 = window.location.pathname.includes('/v2/');
|
|
const container = document.getElementById('content-container');
|
|
let banner = document.getElementById('v2-banner');
|
|
|
|
if (isV2 && container) {
|
|
if (!banner) {
|
|
banner = document.createElement('div');
|
|
banner.id = 'v2-banner';
|
|
banner.innerHTML = 'These are the docs for FastMCP 2.0. <a href="/getting-started/welcome" style="color: white; text-decoration: underline; font-weight: 700;">FastMCP 3.0</a> is now available.';
|
|
container.insertBefore(banner, container.firstChild);
|
|
}
|
|
} else if (!isV2 && banner) {
|
|
banner.remove();
|
|
}
|
|
}
|
|
|
|
function run() {
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', addBanner);
|
|
} else {
|
|
addBanner();
|
|
}
|
|
}
|
|
|
|
run();
|
|
|
|
let lastUrl = location.href;
|
|
new MutationObserver(() => {
|
|
if (location.href !== lastUrl) {
|
|
lastUrl = location.href;
|
|
setTimeout(addBanner, 100);
|
|
}
|
|
}).observe(document.body, {subtree: true, childList: true});
|
|
})();
|