in between state for mcp implementation

This commit is contained in:
Joren de Graaf
2026-10-07 15:49:38 +02:00
parent 4f8c3272aa
commit c825cd474e
17 changed files with 735 additions and 5 deletions
+28
View File
@@ -78,6 +78,34 @@ function initialiseMobileNavigation() {
document.addEventListener('DOMContentLoaded', initialiseMobileNavigation);
function initialiseMcpHelper() {
const helper = document.querySelector('[data-mcp-helper]');
if (!helper) return;
const token = helper.querySelector('[data-mcp-token]');
const url = helper.querySelector('[data-mcp-url]');
const status = helper.querySelector('[data-mcp-status]');
const show = helper.querySelector('[data-mcp-show]');
const clear = () => { token.value = ''; token.type = 'password'; show.textContent = 'Show token'; show.setAttribute('aria-pressed', 'false'); };
window.addEventListener('pageshow', clear);
window.addEventListener('pagehide', clear);
show.addEventListener('click', () => {
const visible = token.type === 'password';
token.type = visible ? 'text' : 'password';
show.textContent = visible ? 'Hide token' : 'Show token';
show.setAttribute('aria-pressed', String(visible));
token.focus();
});
async function copy(value, success) {
if (!value) { status.textContent = 'Paste a token first.'; token.focus(); return; }
try { await navigator.clipboard.writeText(value); status.textContent = success; }
catch { status.textContent = 'Copy was unavailable. Select and copy the field instead.'; }
}
helper.querySelector('[data-mcp-copy-url]').addEventListener('click', () => copy(url.value, 'Copied URL'));
helper.querySelector('[data-mcp-copy-token]').addEventListener('click', () => copy(token.value, 'Copied bearer token'));
}
document.addEventListener('DOMContentLoaded', initialiseMcpHelper);
let fastingTimerInterval;