in between state for mcp implementation
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -588,3 +588,10 @@ body[data-theme="dark"] .gitea-activity__cell--future { background: transparent;
|
||||
.token-scope-field > div { display: grid; gap: 6px; }
|
||||
.token-scope-field label { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 600; cursor: pointer; }
|
||||
.token-scope-field input[type='checkbox'] { width: 16px; height: 16px; margin: 0; flex: none; }
|
||||
.mcp-helper__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
|
||||
.mcp-helper__clients { display: grid; gap: 14px; margin: 18px 0; }
|
||||
.mcp-helper__clients section { border-top: 1px solid rgba(128, 150, 135, .3); padding-top: 12px; }
|
||||
.mcp-helper__clients h3 { margin: 0 0 6px; }
|
||||
.mcp-helper__clients p { margin: 0; }
|
||||
.mcp-helper__hint { font-size: .85rem; }
|
||||
.mcp-helper [data-mcp-status] { min-height: 1.5em; font-weight: 700; }
|
||||
|
||||
Reference in New Issue
Block a user