实例表格展示 Token/路径,Token 默认打码编辑时明文,页宽上限 1800,统一右上按钮尺寸。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-04 08:02:48 +08:00
parent ea24149a55
commit 5e7f1050a0
4 changed files with 72 additions and 26 deletions
+25 -3
View File
@@ -32,6 +32,12 @@
}
}
function setTokenVisible(input, toggleBtn, visible) {
if (!input) return;
input.type = visible ? "text" : "password";
if (toggleBtn) toggleBtn.textContent = visible ? "隐藏" : "显示";
}
function bindTokenToggles(root) {
(root || document).querySelectorAll(".inst-token-toggle").forEach(function (btn) {
if (btn.dataset.bound) return;
@@ -40,15 +46,31 @@
const wrap = btn.closest(".inst-token-wrap");
const input = wrap && wrap.querySelector(".inst-token-input");
if (!input) return;
const show = input.type === "password";
input.type = show ? "text" : "password";
btn.textContent = show ? "隐藏" : "显示";
setTokenVisible(input, btn, input.type === "password");
});
});
}
function bindEditReveal() {
document.querySelectorAll(".inst-edit-check[data-reveal-token]").forEach(function (cb) {
if (cb.dataset.bound) return;
cb.dataset.bound = "1";
const sync = function () {
const panel = cb.nextElementSibling;
if (!panel) return;
const input = panel.querySelector("[data-edit-token]");
const toggle = panel.querySelector(".inst-token-toggle");
// 展开编辑时明文显示 Token;收起后恢复打码
setTokenVisible(input, toggle, !!cb.checked);
};
cb.addEventListener("change", sync);
sync();
});
}
function boot() {
bindTokenToggles(document);
bindEditReveal();
document.querySelectorAll("tr.inst-row[data-id]").forEach(function (row) {
refreshVersion(row);
const btn = row.querySelector("[data-inst-refresh-ver]");