gengx
This commit is contained in:
@@ -1,7 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Build console-app.js from the original mock script plus live-data hooks."""
|
||||
"""一次性的构建脚本,已经作废——**不要运行它**。
|
||||
|
||||
当初它的用途是:拿设计稿导出的 `_orig_script.js`,套上接真实数据的补丁,
|
||||
生成 `console-app.js`。那之后 `console-app.js` 被直接手改了很多轮,包括
|
||||
|
||||
* 侧边球体的启动/暂停开关(`data-action="toggle-listen"`)
|
||||
* 面板溢出与活动条横向滚动的布局修复
|
||||
* 可编辑字段的悬停/聚焦样式和 `annotateEditableFields()`
|
||||
* 审核后发送的「通过并发送」放行按钮
|
||||
|
||||
这些改动一条都没有回流到本文件里的模板字符串。现在再跑一次,等于把
|
||||
`console-app.js` 整个退回到几个版本之前——而且是静悄悄地退,不报任何错,
|
||||
下次有人打开界面才发现按钮没了。
|
||||
|
||||
留着它是为了保存当初的生成逻辑,**不是**为了再次执行。真要重新生成,先把
|
||||
上面那些改动逐条同步进来,再删掉这个拦截。
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
raise SystemExit(
|
||||
"_patch_console.py 已作废:再跑一次会把 console-app.js 覆盖回旧版本,"
|
||||
"丢掉球体开关、布局修复、可编辑字段样式和审核放行按钮。详见文件开头说明。"
|
||||
)
|
||||
|
||||
root = Path(__file__).resolve().parent
|
||||
script = (root / "_orig_script.js").read_text(encoding="utf-8")
|
||||
for old, new in [
|
||||
@@ -237,8 +259,28 @@ render = function(name){
|
||||
const label = document.getElementById("orb-label");
|
||||
if (orb) orb.classList.toggle("paused", !STATE.listening);
|
||||
if (label) label.textContent = STATE.statusLabel || (STATE.listening ? "监听中" : "已停止");
|
||||
const listener = document.getElementById("listener");
|
||||
if (listener) listener.title = STATE.listening ? "点击暂停监听" : "点击开始监听";
|
||||
annotateEditableFields();
|
||||
};
|
||||
|
||||
// 数字框只写着一个数,允许范围藏在 min/max 里,谁也看不见。补成 tooltip。
|
||||
function annotateEditableFields(){
|
||||
const main = document.getElementById("main");
|
||||
if (!main) return;
|
||||
main.querySelectorAll('input[type="number"]').forEach(el => {
|
||||
const min = el.getAttribute("min"), max = el.getAttribute("max");
|
||||
if (min === null || max === null) return;
|
||||
const unit = (el.parentElement && el.parentElement.textContent || "")
|
||||
.replace(/\s+/g, "").match(/(秒|轮|天|次|tokens|个)/);
|
||||
const range = `可修改:${min} ~ ${max}${unit ? " " + unit[1] : ""}`;
|
||||
if (!el.title) el.title = range;
|
||||
if (!el.getAttribute("aria-label")) el.setAttribute("aria-label", range);
|
||||
});
|
||||
main.querySelectorAll("select").forEach(el => { if (!el.title) el.title = "点击选择"; });
|
||||
main.querySelectorAll('input[type="range"]').forEach(el => { if (!el.title) el.title = "拖动调整"; });
|
||||
}
|
||||
|
||||
window.applyState = function(payload){
|
||||
const data = typeof payload === "string" ? JSON.parse(payload) : (payload || {});
|
||||
const prev = STATE.view;
|
||||
|
||||
Reference in New Issue
Block a user