transproof-dsh-plugin 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +21 -2
- package/app/config.js +157 -0
- package/app/index.html +1843 -0
- package/app/js/01-core.js +247 -0
- package/app/js/02-prompts-reverse.js +504 -0
- package/app/js/03-translate.js +429 -0
- package/app/js/04-settings-data.js +410 -0
- package/app/js/05-files-docx.js +842 -0
- package/app/js/06-track-scan.js +652 -0
- package/app/js/07-run-features.js +701 -0
- package/app/js/08-render-audit.js +2050 -0
- package/app/js/09-gloss.js +774 -0
- package/app/js/10-app-init.js +220 -0
- package/app/js/11-feedback.js +199 -0
- package/app/js/12-editbox.js +75 -0
- package/app/js/13-pipeline.js +206 -0
- package/app/js/14-noun-verify.js +251 -0
- package/app/js/15-delivery-report.js +151 -0
- package/app/js/16-wiki-verify.js +115 -0
- package/client.js +69 -0
- package/cordis.patch.yml +9 -0
- package/host/index.js +189 -0
- package/icon.svg +32 -0
- package/locale/en.json +1 -0
- package/locale/zh.json +1 -0
- package/package.json +32 -4
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/* ═══════════ 三段流水线(翻译 → 批评 → 精修)· T-002 + T-009/T-010 ═══════════
|
|
2
|
+
一次操作串三次 callModel:①出初稿 ②批评者挑毛病 ③按批评精修。
|
|
3
|
+
工序纪律(伊里因科夫三权分立单人版):
|
|
4
|
+
· Owner=你(人),Operator=AI;每段产物停下给你过目,不自动跳段(T-009/T-013)。
|
|
5
|
+
· 批评段输入白名单 = 原文 + 译稿 + 术语表,禁带任何翻译段的「自辩/理由」(T-010)。
|
|
6
|
+
· 批评段只产问题清单,不直接改译文;改译永远在第三段精修。
|
|
7
|
+
· 任一段失败给可读提示,不静默吞。 */
|
|
8
|
+
const PL = { stage: 0, draft: '', critique: '', final: '', running: false, cancel: false, ctrl: null };
|
|
9
|
+
|
|
10
|
+
/* 术语表(白名单要件,供批评/精修段锁定一致) */
|
|
11
|
+
function plTerms(){
|
|
12
|
+
const a = [];
|
|
13
|
+
if(TERMS.length) a.push(TERMS.slice(0,80).map(t => t.src + ' → ' + t.dst + (t.note?'('+t.note+')':'')).join('\n'));
|
|
14
|
+
if(GLOSS && GLOSS.terms && GLOSS.terms.length){
|
|
15
|
+
const g = GLOSS.terms.filter(t => t.status === 'confirmed' && t.foreign && t.zh).slice(0,60)
|
|
16
|
+
.map(t => t.foreign + ' → ' + t.zh).join('\n');
|
|
17
|
+
if(g) a.push(g);
|
|
18
|
+
}
|
|
19
|
+
return a.filter(Boolean).join('\n') || '(未设术语库)';
|
|
20
|
+
}
|
|
21
|
+
function plSrc(){ return ($('#ts-src').value || '').trim(); }
|
|
22
|
+
function plLang(){ const l = $('#ts-lang').value; return l === 'auto' ? '外文' : l; }
|
|
23
|
+
|
|
24
|
+
/* ── 第 1 段:翻译初稿(复用现有翻译提示词装配) ── */
|
|
25
|
+
function plSysDraft(){
|
|
26
|
+
try{ return buildTransSystem(); }
|
|
27
|
+
catch(e){ return '你是专业学术翻译家,把【' + plLang() + '原文】译成【中文】。译文通顺忠实,术语首次出现附原文括注。'; }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* ── 第 2 段:批评(只产清单,不改译文;输入白名单=原文+译稿+术语表) ── */
|
|
31
|
+
function plSysCritique(){
|
|
32
|
+
return [
|
|
33
|
+
'你是一位极其挑剔的资深译审,任务是**只找出问题、列出清单**,**绝对不要重写或修改译文**。',
|
|
34
|
+
'你只依据下方【外文原文】【译稿】【术语表】三样来判断;不要臆测译者的意图或理由,不要替译者辩解。',
|
|
35
|
+
'',
|
|
36
|
+
'【输出格式 — 只输出一个问题清单,每条一行,不要写总结、不要写客套话】',
|
|
37
|
+
'- 每条格式:[类型] 原文片段 → 译稿片段:问题说明 + 建议改法',
|
|
38
|
+
'- 类型只能是:误译 / 漏译 / 增译 / 术语不一致 / 歧义 / 逻辑关系 / 中式英语 / 标点格式 / 语体不当',
|
|
39
|
+
'- 优先抓硬伤(漏译、误译、术语不一致、数字日期错误),再谈文风。',
|
|
40
|
+
'- 专有名词(人名、地名、历史事件、学派、书名)必须与术语表一致;不一致要点名。',
|
|
41
|
+
'- 若整体无明显问题,只输出一行:未发现明显问题。',
|
|
42
|
+
'- 不要输出与问题无关的评论。'
|
|
43
|
+
].join('\n');
|
|
44
|
+
}
|
|
45
|
+
function plUserCritique(){
|
|
46
|
+
const s = plSrc().slice(0,12000);
|
|
47
|
+
return '【外文原文】\n' + s + '\n\n【译稿】\n' + PL.draft.slice(0,16000) + '\n\n【术语表】\n' + plTerms();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ── 第 3 段:精修(输入=原文+译稿+批评清单+术语表,产出最终译文) ── */
|
|
51
|
+
function plSysRefine(){
|
|
52
|
+
return [
|
|
53
|
+
'你是一位资深翻译家,正在按审稿意见精修一份译稿。',
|
|
54
|
+
'【任务】依据下面的「批评清单」逐条修正译稿中的问题,产出**完整、可直接使用的最终译文**。',
|
|
55
|
+
'',
|
|
56
|
+
'【硬性要求】',
|
|
57
|
+
'- 只输出最终译文本身,不要输出修订说明、不要加前言后语、不要用 markdown 代码块包裹。',
|
|
58
|
+
'- 逐条落实批评清单;清单里没提到的地方保持原译稿不动(不要顺手改写)。',
|
|
59
|
+
'- 专有名词严格遵循术语表;清单指出的术语不一致必须统一。',
|
|
60
|
+
'- 保持原译稿的段落划分;中文通顺,不加机器腔填充语。'
|
|
61
|
+
].join('\n');
|
|
62
|
+
}
|
|
63
|
+
function plUserRefine(){
|
|
64
|
+
return '【外文原文】\n' + plSrc().slice(0,12000) +
|
|
65
|
+
'\n\n【原译稿】\n' + PL.draft.slice(0,14000) +
|
|
66
|
+
'\n\n【批评清单(须逐条落实)】\n' + (PL.critique || '(无,按原译稿直接输出)') +
|
|
67
|
+
'\n\n【术语表】\n' + plTerms();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ── 弹窗骨架 ── */
|
|
71
|
+
function plHtml(){
|
|
72
|
+
return [
|
|
73
|
+
'<div class="pl-steps" style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px">',
|
|
74
|
+
' <span class="ef-chip" data-pls="1">① 翻译初稿</span>',
|
|
75
|
+
' <span class="ef-chip" data-pls="2">② 批评清单</span>',
|
|
76
|
+
' <span class="ef-chip" data-pls="3">③ 精修译文</span>',
|
|
77
|
+
'</div>',
|
|
78
|
+
'<div id="pl-status" style="font-size:12px;color:var(--tx3);margin-bottom:8px">准备就绪:点「开始第 1 段」出初稿。</div>',
|
|
79
|
+
'<div id="pl-box" style="min-height:120px;max-height:46vh;overflow:auto;padding:12px;background:var(--bg2);border:1px solid var(--bd);border-radius:6px;font-size:14px;line-height:1.8;white-space:pre-wrap"></div>',
|
|
80
|
+
'<div style="display:flex;gap:8px;margin-top:12px;flex-wrap:wrap">',
|
|
81
|
+
' <button class="btn pri sm" id="pl-next">▶ 开始第 1 段(翻译初稿)</button>',
|
|
82
|
+
' <button class="btn gray sm" id="pl-copy" disabled>📋 复制当前产物</button>',
|
|
83
|
+
' <button class="btn pri sm" id="pl-send" disabled style="background:rgba(63,185,80,.12);border-color:var(--ok)">→ 把精修译文送去校对</button>',
|
|
84
|
+
' <button class="btn gray sm" id="pl-stop" disabled>■ 中断</button>',
|
|
85
|
+
' <button class="btn gray sm" id="pl-close">关闭</button>',
|
|
86
|
+
'</div>',
|
|
87
|
+
'<div class="alert" style="margin-top:10px">工序说明:每段产物都停下给你过目,你点了下一段才继续(AI 不自动跳段)。批评段只挑毛病、不改译文;改译永远在第 3 段。最后采纳哪一版,由你拍板。</div>'
|
|
88
|
+
].join('');
|
|
89
|
+
}
|
|
90
|
+
function plStep(n){
|
|
91
|
+
document.querySelectorAll('#mBody .pl-steps .ef-chip').forEach(c => {
|
|
92
|
+
const i = +c.dataset.pls;
|
|
93
|
+
c.classList.toggle('on', i === n);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function plCur(){
|
|
97
|
+
if(PL.stage === 3) return PL.final;
|
|
98
|
+
if(PL.stage === 2) return PL.critique;
|
|
99
|
+
if(PL.stage === 1) return PL.draft;
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
function plSetBox(t){ $('#pl-box').textContent = t; }
|
|
103
|
+
function plStatus(t){ $('#pl-status').textContent = t; }
|
|
104
|
+
|
|
105
|
+
/* ── 主流程:跑第 n 段(n=1,2,3) ── */
|
|
106
|
+
async function plRun(n){
|
|
107
|
+
if(PL.running) return;
|
|
108
|
+
const src = plSrc();
|
|
109
|
+
if(!src){ toast('请先在第 1 步输入或上传原文', 'e'); closeModal(); return; }
|
|
110
|
+
if(n > 1 && !PL.draft){ toast('请先完成第 1 段(翻译初稿)', 'w'); return; }
|
|
111
|
+
if(n > 2 && !PL.critique){ toast('请先完成第 2 段(批评清单)', 'w'); return; }
|
|
112
|
+
|
|
113
|
+
PL.running = true; PL.cancel = false;
|
|
114
|
+
const ctrl = new AbortController(); /* 运行凭证 + 可立即中断 */
|
|
115
|
+
PL.ctrl = ctrl;
|
|
116
|
+
const nx = $('#pl-next'); nx.disabled = true;
|
|
117
|
+
const stop = $('#pl-stop'); stop.disabled = false;
|
|
118
|
+
const label = ['','翻译初稿','批评清单','精修译文'][n];
|
|
119
|
+
plStatus('⏳ 第 ' + n + ' 段「' + label + '」生成中…(可随时中断)');
|
|
120
|
+
plSetBox('');
|
|
121
|
+
plStep(n);
|
|
122
|
+
|
|
123
|
+
let sys, user, maxTok;
|
|
124
|
+
if(n === 1){ sys = plSysDraft(); user = '【外文原文】\n' + src.slice(0, (CFG.maxInChars||80000)); maxTok = 8000; }
|
|
125
|
+
else if(n === 2){ sys = plSysCritique(); user = plUserCritique(); maxTok = 3000; }
|
|
126
|
+
else { sys = plSysRefine(); user = plUserRefine(); maxTok = 8000; }
|
|
127
|
+
|
|
128
|
+
try{
|
|
129
|
+
const r = await callModelSimple(sys, user, maxTok, ctrl.signal);
|
|
130
|
+
if(PL.ctrl !== ctrl) return; /* 弹窗被关/重开过:丢弃过期结果,别覆盖新一轮状态 */
|
|
131
|
+
if(PL.cancel || ctrl.signal.aborted){ plStatus('⏹ 已中断第 ' + n + ' 段,点下方按钮可重试本段。'); nx.disabled = false; nx.textContent = '↻ 重试第 ' + n + ' 段'; return; }
|
|
132
|
+
let t = String((r && r.text) || '').trim();
|
|
133
|
+
t = t.replace(/^```[a-z]*\n?/i, '').replace(/\n?```$/,'').trim(); // 剥代码围栏
|
|
134
|
+
if(!t){ throw new Error('模型返回为空'); }
|
|
135
|
+
if(n === 1) PL.draft = t;
|
|
136
|
+
else if(n === 2) PL.critique = t;
|
|
137
|
+
else PL.final = t;
|
|
138
|
+
PL.stage = n; /* v4.34.0:只有真正跑完才推进段号——失败/中断永远重跑同一段 */
|
|
139
|
+
|
|
140
|
+
plSetBox(t);
|
|
141
|
+
plStatus('✓ 第 ' + n + ' 段「' + label + '」完成 · ' + new Date().toLocaleTimeString('zh-CN'));
|
|
142
|
+
$('#pl-copy').disabled = false;
|
|
143
|
+
|
|
144
|
+
if(n === 1){ nx.textContent = '▶ 下一段:第 2 段(批评挑毛病)'; nx.disabled = false; }
|
|
145
|
+
else if(n === 2){ nx.textContent = '▶ 下一段:第 3 段(按批评精修)'; nx.disabled = false; }
|
|
146
|
+
else { nx.textContent = '✓ 三段全部完成'; nx.disabled = true; $('#pl-send').disabled = false; }
|
|
147
|
+
}catch(err){
|
|
148
|
+
if(PL.ctrl !== ctrl) return; /* 弹窗被关/重开过:旧报错别打扰新一轮 */
|
|
149
|
+
if(PL.cancel || ctrl.signal.aborted){ /* 主动中断不算失败 */
|
|
150
|
+
plStatus('⏹ 已中断第 ' + n + ' 段,点下方按钮可重试本段。');
|
|
151
|
+
nx.disabled = false; nx.textContent = '↻ 重试第 ' + n + ' 段'; stop.disabled = true;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const msg = errMsg(err);
|
|
155
|
+
plStatus('✗ 第 ' + n + ' 段「' + label + '」失败:' + msg);
|
|
156
|
+
plSetBox('【第 ' + n + ' 段失败】' + msg + '\n\n点下方按钮重试本段,或先检查「设置」页的接口地址 / 模型 / API Key。');
|
|
157
|
+
nx.disabled = false; nx.textContent = '↻ 重试第 ' + n + ' 段';
|
|
158
|
+
toast('第 ' + n + ' 段失败:' + msg, 'e');
|
|
159
|
+
if(typeof fbAutoReport === 'function') fbAutoReport('三段流水线第 ' + n + ' 段失败', msg); /* v4.34.0 自动上报 */
|
|
160
|
+
}finally{
|
|
161
|
+
if(PL.ctrl === ctrl){ PL.running = false; stop.disabled = true; PL.ctrl = null; }
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function plOpen(){
|
|
166
|
+
if(PL_RUNNING_GUARD()) return;
|
|
167
|
+
/* v4.34.0:重开弹窗先掐掉上次残留的调用并清 running,否则整块功能卡死 */
|
|
168
|
+
if(PL.ctrl){ PL.cancel = true; try{ PL.ctrl.abort(); }catch(_){} }
|
|
169
|
+
PL.running = false; PL.ctrl = null; PL.cancel = false;
|
|
170
|
+
PL.stage = 0; PL.draft = ''; PL.critique = ''; PL.final = '';
|
|
171
|
+
modal('⚙ 三段流水线 · 翻译 → 批评 → 精修', plHtml());
|
|
172
|
+
plStep(0);
|
|
173
|
+
$('#pl-next').onclick = () => {
|
|
174
|
+
if(PL.running) return;
|
|
175
|
+
/* v4.34.0:段号由「已完成的内容」推导——失败/中断后重试永远重跑同一段,绝不会越位卡死;
|
|
176
|
+
PL.stage 只在 plRun 真正跑完后才推进(stage = 已完成到第几段,失败不前进) */
|
|
177
|
+
const n = !PL.draft ? 1 : (!PL.critique ? 2 : 3);
|
|
178
|
+
plRun(n);
|
|
179
|
+
};
|
|
180
|
+
$('#pl-copy').onclick = () => { const t = plCur(); if(t){ navigator.clipboard.writeText(t).then(() => toast('已复制当前产物')).catch(() => toast('复制失败,请手动选中', 'e')); } };
|
|
181
|
+
$('#pl-send').onclick = () => {
|
|
182
|
+
if(!PL.final){ toast('还没有精修译文', 'w'); return; }
|
|
183
|
+
$('#dst').value = PL.final; closeModal(); toast('精修译文已填入校对页,可点「开始校对」');
|
|
184
|
+
document.querySelector('nav button[data-page="p-work"]').click();
|
|
185
|
+
};
|
|
186
|
+
$('#pl-stop').onclick = () => { /* v4.34.0:立刻掐断网络请求,不再干等超时 */
|
|
187
|
+
PL.cancel = true;
|
|
188
|
+
if(PL.ctrl){ try{ PL.ctrl.abort(); }catch(_){} }
|
|
189
|
+
plStatus('⏹ 正在中断…');
|
|
190
|
+
};
|
|
191
|
+
$('#pl-close').onclick = () => { /* v4.34.0:关闭=取消本段,后台不再偷偷跑,重开能重新开始 */
|
|
192
|
+
PL.cancel = true;
|
|
193
|
+
if(PL.ctrl){ try{ PL.ctrl.abort(); }catch(_){} }
|
|
194
|
+
PL.running = false; PL.ctrl = null;
|
|
195
|
+
closeModal();
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function PL_RUNNING_GUARD(){ return false; } /* 预留:与主翻译互斥的守卫位 */
|
|
199
|
+
|
|
200
|
+
/* 绑定入口 */
|
|
201
|
+
$('#btn-pipeline') && ($('#btn-pipeline').onclick = () => {
|
|
202
|
+
if(!CFG.apiKey){ toast('请先到「设置」页填写 API Key', 'e'); document.querySelector('nav button[data-page="p-set"]').click(); return; }
|
|
203
|
+
if(TS_RUNNING){ toast('翻译正在进行中,请等它结束再用流水线', 'w'); return; }
|
|
204
|
+
plOpen();
|
|
205
|
+
});
|
|
206
|
+
window.PL = PL;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/* ═══════════ T-022 专名核验 + 术语表回填(v4.39.0)═══════════
|
|
2
|
+
前半:翻译页勾选「翻译后抽专名」→ 译完自动抽专名 + 建议译名 → 回填专有译词库(待审核)。
|
|
3
|
+
后半:专有译词库「🔎 专名核验」面板 → AI 核验 / 人工回填真 URL / 批准 / 一键统一全文。
|
|
4
|
+
衔接:proNounAudit 的同名异译思路、GLOSS、approvedGloss、verifyEntries。 */
|
|
5
|
+
|
|
6
|
+
/* ── 专名收集(AI 抽取 + 建议译名,回填词库 pending)── */
|
|
7
|
+
const TS_COLLECT_SYS = '你是翻译项目的专名收集助手。从原文里抽专有名词(人名、地名、机构、著作、事件、重要概念术语),给一个通行的中文译名建议。宁可漏,不瞎编;不确定译名的条目不要输出。只输出 JSON 数组:[{"foreign":"外文原词","zh":"建议译名","type":"人物|概念|著作|学派|机构|事件|其他","note":"≤30字依据"}],没有就输出 []。';
|
|
8
|
+
|
|
9
|
+
async function tsCollectNouns(src){
|
|
10
|
+
src = String(src || '').trim();
|
|
11
|
+
if(!src){ return null; }
|
|
12
|
+
if(!CFG.apiKey){ toast('已跳过专名收集:设置里还没填模型 Key', 'w'); return null; }
|
|
13
|
+
const MAX = 12000;
|
|
14
|
+
const snippet = src.length > MAX ? src.slice(0, MAX) : src;
|
|
15
|
+
try{
|
|
16
|
+
const r = await callModelSimple(TS_COLLECT_SYS, '【原文】' + String.fromCharCode(10) + snippet, 1600);
|
|
17
|
+
const arr = extractJsonArray(r && r.text ? r.text : '');
|
|
18
|
+
if(!Array.isArray(arr) || !arr.length){ toast('专名收集:模型没有抽到专名', 'w'); return null; }
|
|
19
|
+
let sid = 's-trans-noun';
|
|
20
|
+
if(!GLOSS.sources.find(s => s.id === sid)){
|
|
21
|
+
GLOSS.sources.push({ id: sid, name: '翻译专名收集', kind: 'trans', date: new Date().toISOString(), count: 0 });
|
|
22
|
+
}
|
|
23
|
+
let added = 0, skipped = 0;
|
|
24
|
+
for(const x of arr){
|
|
25
|
+
const foreign = normText(x.foreign || '');
|
|
26
|
+
const zh = normText(x.zh || '');
|
|
27
|
+
if(!foreign || !zh) continue;
|
|
28
|
+
if(GLOSS.terms.some(t => t.foreign && fKey(t.foreign) === fKey(foreign))){ skipped++; continue; }
|
|
29
|
+
GLOSS.terms.push({
|
|
30
|
+
id: GID++, zh: zh, foreign: foreign, aliases: [], type: guessType(zh, foreign),
|
|
31
|
+
tags: ['专名收集'], note: normText(x.note || ''), sources: [sid],
|
|
32
|
+
occurrences: [], collections: [], status: 'pending', recommend: '', url: '',
|
|
33
|
+
created: Date.now(), updated: Date.now()
|
|
34
|
+
});
|
|
35
|
+
added++;
|
|
36
|
+
}
|
|
37
|
+
const srcObj = GLOSS.sources.find(s => s.id === sid);
|
|
38
|
+
if(srcObj) srcObj.count += added;
|
|
39
|
+
saveGloss();
|
|
40
|
+
glossLog('collect', 'trans', null, { added: added, skipped: skipped });
|
|
41
|
+
if(typeof renderGloss === 'function') renderGloss();
|
|
42
|
+
toast('专名收集:新增 ' + added + ' 条到专有译词库(待审核)' + (skipped ? ',跳过重复 ' + skipped : '') + ' → 去「专有译词库 → 专名核验」拍板');
|
|
43
|
+
return { added: added, skipped: skipped };
|
|
44
|
+
}catch(e){
|
|
45
|
+
toast('专名收集失败:' + errMsg(e), 'w');
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ── 专名核验面板 ── */
|
|
51
|
+
function gvPendingTerms(){
|
|
52
|
+
return GLOSS.terms.filter(t => t && t.status === 'pending' && t.foreign && t.zh)
|
|
53
|
+
.sort((a, b) => (b.updated || 0) - (a.updated || 0));
|
|
54
|
+
}
|
|
55
|
+
function renderGvPanel(){
|
|
56
|
+
const box = $('#gv-list');
|
|
57
|
+
if(!box) return;
|
|
58
|
+
const list = gvPendingTerms();
|
|
59
|
+
const MAXN = 20;
|
|
60
|
+
const shown = list.slice(0, MAXN);
|
|
61
|
+
if(!shown.length){
|
|
62
|
+
box.innerHTML = '<div class="alert i">没有待核验的词条。翻译页勾选「翻译后抽专名」译完自动收集,或到词条管理把词条打回「待审核」,这里就会出现核验清单。</div>';
|
|
63
|
+
} else {
|
|
64
|
+
box.innerHTML = shown.map(t => {
|
|
65
|
+
const urlBtn = t.url
|
|
66
|
+
? '<a class="btn gray sm" href="' + esc(t.url) + '" target="_blank" rel="noopener" title="打开依据 URL">🔗 依据</a>'
|
|
67
|
+
: '<button class="btn gray sm" data-gv-url="' + t.id + '" title="人工回填证明这条译法的真 URL">🔗 回填依据</button>';
|
|
68
|
+
return '<div class="gv-row" data-id="' + t.id + '" style="display:flex;gap:10px;justify-content:space-between;align-items:center;padding:8px 10px;border:1px solid var(--bd);border-radius:8px;margin-bottom:6px">' +
|
|
69
|
+
'<div style="flex:1;min-width:0">' +
|
|
70
|
+
'<div style="font-size:13.5px;font-weight:600">' + esc(t.zh) + (t.type ? ' <span class="g-tag">' + esc(t.type) + '</span>' : '') + (t.url ? ' <span style="font-size:11px;color:var(--ok)">有依据</span>' : '') + '</div>' +
|
|
71
|
+
'<div style="font-size:12.5px;color:var(--tx2)">' + esc(t.foreign) + '</div>' +
|
|
72
|
+
(t.note ? '<div style="font-size:11.5px;color:var(--tx3)">' + esc(t.note) + '</div>' : '') +
|
|
73
|
+
'</div>' +
|
|
74
|
+
'<div style="display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end">' +
|
|
75
|
+
'<button class="btn sm" data-gv-wiki="' + t.id + '">🔎 查维基</button>' +
|
|
76
|
+
'<button class="btn sm" data-gv-verify="' + t.id + '">🤖 核验</button>' +
|
|
77
|
+
urlBtn +
|
|
78
|
+
'<button class="btn sm" data-gv-approve="' + t.id + '">✓ 批准</button>' +
|
|
79
|
+
'<button class="btn gray sm" data-gv-reject="' + t.id + '">✕ 拒绝</button>' +
|
|
80
|
+
'</div>' +
|
|
81
|
+
'</div>';
|
|
82
|
+
}).join('') + (list.length > MAXN ? '<div class="muted sm" style="margin-top:8px">还有 ' + (list.length - MAXN) + ' 条待核验,请到「词条管理」按状态筛「待审核」。</div>' : '');
|
|
83
|
+
}
|
|
84
|
+
const batchBtn = $('#btn-gv-batch');
|
|
85
|
+
if(batchBtn){
|
|
86
|
+
batchBtn.disabled = !list.length;
|
|
87
|
+
batchBtn.textContent = '🤖 AI 批量核验' + (list.length ? '(' + list.length + ' 条)' : '');
|
|
88
|
+
}
|
|
89
|
+
const unifyBtn = $('#btn-gv-unify');
|
|
90
|
+
if(unifyBtn) unifyBtn.disabled = !approvedGloss().length;
|
|
91
|
+
|
|
92
|
+
box.querySelectorAll('[data-gv-verify]').forEach(b => {
|
|
93
|
+
b.onclick = async () => {
|
|
94
|
+
const t = GLOSS.terms.find(x => String(x.id) === String(b.dataset.gvVerify));
|
|
95
|
+
if(!t) return;
|
|
96
|
+
const items = [{ src: t.foreign || '', dst: t.zh || '', extra: t.type || '' }];
|
|
97
|
+
const vs = await verifyEntries(items, b);
|
|
98
|
+
if(!vs) return;
|
|
99
|
+
showVerifyResults(items, vs, {
|
|
100
|
+
onApprove: () => { glossSetStatus(t.id, 'confirmed'); renderGvPanel(); },
|
|
101
|
+
onAdopt: (k, v) => {
|
|
102
|
+
if(!v.suggest) return false;
|
|
103
|
+
t.zh = v.suggest; t.status = 'pending';
|
|
104
|
+
saveGloss(); glossLog('status', 'term:' + t.id, 'adopt', 'pending');
|
|
105
|
+
if(typeof renderGlossTable === 'function') renderGlossTable();
|
|
106
|
+
renderGvPanel();
|
|
107
|
+
toast('已改为建议译法,状态仍是「待审核」');
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
box.querySelectorAll('[data-gv-wiki]').forEach(b => {
|
|
114
|
+
b.onclick = () => {
|
|
115
|
+
const t = GLOSS.terms.find(x => String(x.id) === String(b.dataset.gvWiki));
|
|
116
|
+
if(t && typeof gvWikiLookup === 'function') gvWikiLookup(t);
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
box.querySelectorAll('[data-gv-url]').forEach(b => {
|
|
120
|
+
b.onclick = () => {
|
|
121
|
+
const t = GLOSS.terms.find(x => String(x.id) === String(b.dataset.gvUrl));
|
|
122
|
+
if(t) gvSetUrl(t);
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
box.querySelectorAll('[data-gv-approve]').forEach(b => {
|
|
126
|
+
b.onclick = () => {
|
|
127
|
+
const t = GLOSS.terms.find(x => String(x.id) === String(b.dataset.gvApprove));
|
|
128
|
+
if(t && glossSetStatus(t.id, 'confirmed')) renderGvPanel();
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
box.querySelectorAll('[data-gv-reject]').forEach(b => {
|
|
132
|
+
b.onclick = () => {
|
|
133
|
+
const t = GLOSS.terms.find(x => String(x.id) === String(b.dataset.gvReject));
|
|
134
|
+
if(t && glossSetStatus(t.id, 'rejected')) renderGvPanel();
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function gvSetUrl(t){
|
|
140
|
+
const cur = t.url || '';
|
|
141
|
+
modal('🔗 回填依据 URL', [
|
|
142
|
+
'<div style="font-size:13.5px;margin-bottom:6px"><b>' + esc(t.zh || '—') + '</b> <span style="color:var(--tx2)">' + esc(t.foreign || '') + '</span></div>',
|
|
143
|
+
'<p style="font-size:12.5px;color:var(--tx2);margin-bottom:8px">把证明这条译法的<b>真 URL</b>贴进来(学术库 / 维基 / 出版社页面都行)。AI 核验给的是建议,真 URL 才是你拍板的依据;留空并保存 = 清空依据。</p>',
|
|
144
|
+
'<input id="gv-url-input" value="' + esc(cur) + '" placeholder="https://…" style="width:100%">',
|
|
145
|
+
'<div style="display:flex;gap:8px;margin-top:12px"><button class="btn pri sm" id="gv-url-save">保存</button><button class="btn gray sm" id="gv-url-cancel">取消</button></div>'
|
|
146
|
+
].join(''));
|
|
147
|
+
$('#gv-url-save').onclick = () => {
|
|
148
|
+
const v = normText($('#gv-url-input').value);
|
|
149
|
+
if(v && (v.indexOf('http://') !== 0 && v.indexOf('https://') !== 0)){ toast('URL 需以 http(s):// 开头', 'w'); return; }
|
|
150
|
+
t.url = v; t.updated = Date.now();
|
|
151
|
+
saveGloss(); glossLog('url', 'term:' + t.id, cur, v);
|
|
152
|
+
closeModal(); renderGvPanel();
|
|
153
|
+
if(typeof renderGlossTable === 'function') renderGlossTable();
|
|
154
|
+
toast(v ? '依据 URL 已保存' : '已清空依据 URL');
|
|
155
|
+
};
|
|
156
|
+
$('#gv-url-cancel').onclick = closeModal;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* ── AI 批量核验待审核词条(一次最多 20 条)── */
|
|
160
|
+
async function gvBatchVerify(){
|
|
161
|
+
const list = gvPendingTerms().slice(0, 20);
|
|
162
|
+
if(!list.length){ toast('没有待核验的词条', 'w'); return; }
|
|
163
|
+
const items = list.map(t => ({ src: t.foreign || '', dst: t.zh || '', extra: t.type || '' }));
|
|
164
|
+
const vs = await verifyEntries(items, $('#btn-gv-batch'));
|
|
165
|
+
if(!vs) return;
|
|
166
|
+
showVerifyResults(items, vs, {
|
|
167
|
+
note: '共 ' + items.length + ' 条待审核词条。采纳建议 = 改成建议译法(仍待审核);批准 = 设为「已批准」开始全文锁定。',
|
|
168
|
+
onApprove: (i) => { glossSetStatus(list[i].id, 'confirmed'); },
|
|
169
|
+
onAdopt: (i, v) => {
|
|
170
|
+
if(!v.suggest) return false;
|
|
171
|
+
const t = list[i];
|
|
172
|
+
t.zh = v.suggest; t.status = 'pending';
|
|
173
|
+
saveGloss(); glossLog('status', 'term:' + t.id, 'adopt', 'pending');
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
renderGvPanel();
|
|
178
|
+
if(typeof renderGlossTable === 'function') renderGlossTable();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ── 一键统一全文:按已批准词条,把「其他译法(外文)」统一成批准译法 ── */
|
|
182
|
+
function gvUnifyInText(text, terms){
|
|
183
|
+
let out = String(text || ''), n = 0;
|
|
184
|
+
const nz = s => String(s || '').split('').filter(c => c.charCodeAt(0) > 32).join('').toLowerCase();
|
|
185
|
+
for(const t of terms){
|
|
186
|
+
const foreign = normText(t.foreign || '');
|
|
187
|
+
if(!foreign) continue;
|
|
188
|
+
const fk = nz(foreign);
|
|
189
|
+
const zh = normText(t.zh || '');
|
|
190
|
+
if(!zh) continue;
|
|
191
|
+
const aliases = (t.aliases || []).map(x => normText(x)).filter(Boolean);
|
|
192
|
+
const opens = ['(', '('];
|
|
193
|
+
for(let oi = 0; oi < opens.length; oi++){
|
|
194
|
+
const open = opens[oi];
|
|
195
|
+
const close = open === '(' ? ')' : ')';
|
|
196
|
+
let idx = 0;
|
|
197
|
+
while((idx = out.indexOf(open, idx)) !== -1){
|
|
198
|
+
const closeIdx = out.indexOf(close, idx + 1);
|
|
199
|
+
if(closeIdx === -1 || closeIdx - idx - 1 > 60){ idx++; continue; }
|
|
200
|
+
const fn = out.slice(idx + 1, closeIdx);
|
|
201
|
+
if(nz(fn) !== fk){ idx = closeIdx + 1; continue; }
|
|
202
|
+
let j = idx - 1, zhPart = '';
|
|
203
|
+
while(j >= 0 && zhPart.length < 14){
|
|
204
|
+
const ch = out[j];
|
|
205
|
+
if(/[一-龥·]/.test(ch)){ zhPart = ch + zhPart; j--; }
|
|
206
|
+
else break;
|
|
207
|
+
}
|
|
208
|
+
zhPart = normText(zhPart);
|
|
209
|
+
if(zhPart && zhPart !== zh && aliases.indexOf(zhPart) !== -1){
|
|
210
|
+
out = out.slice(0, j + 1) + zh + out.slice(j + 1 + zhPart.length);
|
|
211
|
+
n++;
|
|
212
|
+
idx = j + 1 + zh.length;
|
|
213
|
+
} else {
|
|
214
|
+
idx = closeIdx + 1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { out: out, n: n };
|
|
220
|
+
}
|
|
221
|
+
function gvUnifyAll(){
|
|
222
|
+
const terms = approvedGloss();
|
|
223
|
+
if(!terms.length){ toast('没有「已批准」的词条可统一', 'w'); return; }
|
|
224
|
+
const r1 = gvUnifyInText(LAST_OUT, terms);
|
|
225
|
+
const r2 = gvUnifyInText(TS_LAST_OUT, terms);
|
|
226
|
+
let total = r1.n + r2.n;
|
|
227
|
+
if(!total){ toast('全文没有发现与已批准译名不一致的写法(只统一「中文(外文)」括号绑定形式)', 'w'); return; }
|
|
228
|
+
if(r1.n){
|
|
229
|
+
LAST_OUT = r1.out;
|
|
230
|
+
$('#out').innerHTML = md(LAST_OUT);
|
|
231
|
+
collapseSections(); markErrorLines(); renderAuditControls(); paintErrFixSpans();
|
|
232
|
+
}
|
|
233
|
+
if(r2.n){
|
|
234
|
+
TS_LAST_OUT = r2.out;
|
|
235
|
+
$('#ts-out').innerHTML = md(TS_LAST_OUT);
|
|
236
|
+
}
|
|
237
|
+
saveTask();
|
|
238
|
+
toast('一键统一完成:替换 ' + total + ' 处(校对结果 ' + r1.n + ',译文 ' + r2.n + ')');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* ── 事件绑定 ── */
|
|
242
|
+
$('#btn-gv-batch') && ($('#btn-gv-batch').onclick = gvBatchVerify);
|
|
243
|
+
$('#btn-gv-unify') && ($('#btn-gv-unify').onclick = gvUnifyAll);
|
|
244
|
+
|
|
245
|
+
/* 页面初始化时先渲染一次(此后由 renderGloss 负责刷新) */
|
|
246
|
+
if($('#gv-list')) renderGvPanel();
|
|
247
|
+
|
|
248
|
+
/* 测试与外部调用出口 */
|
|
249
|
+
window.gvUnifyInText = gvUnifyInText;
|
|
250
|
+
window.tsCollectNouns = tsCollectNouns;
|
|
251
|
+
window.renderGvPanel = renderGvPanel;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
交付质检报告(T-016 · P0 · v4.40.0)
|
|
3
|
+
把已有数据汇总成一张可复制 / 导出的交付报告:
|
|
4
|
+
错误分类(v4.9.0)+ 已修进度(v4.26.0)+ 质量评分(v4.36.0)
|
|
5
|
+
+ 三栏段落统计(v4.30.0)+ 校对前 AI 预估(v4.18.0,若跑过)
|
|
6
|
+
纯本地组装,不调 AI、不花 token。
|
|
7
|
+
============================================================ */
|
|
8
|
+
const NL = String.fromCharCode(10);
|
|
9
|
+
|
|
10
|
+
/* 从校对结果里抽出「一、修订后译文」正文(无正则反斜杠,纯 indexOf 切分) */
|
|
11
|
+
function reportRevisedText(outText){
|
|
12
|
+
const t = String(outText || '');
|
|
13
|
+
const lines = t.split(NL);
|
|
14
|
+
let start = -1;
|
|
15
|
+
for(let i = 0; i < lines.length; i++){
|
|
16
|
+
if(lines[i].indexOf('修订后译文') >= 0){ start = i; break; }
|
|
17
|
+
}
|
|
18
|
+
if(start < 0) return t.trim();
|
|
19
|
+
const out = [];
|
|
20
|
+
for(let i = start + 1; i < lines.length; i++){
|
|
21
|
+
if(lines[i].indexOf('## 二') === 0 && lines[i].indexOf('批注') >= 0) break;
|
|
22
|
+
out.push(lines[i]);
|
|
23
|
+
}
|
|
24
|
+
const r = out.join(NL).trim();
|
|
25
|
+
return r || t.trim();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* 汇总数据(纯函数,测试可直接调用) */
|
|
29
|
+
function reportBuildData(outText, srcText, fixedDone, fixedTotal){
|
|
30
|
+
const rev = reportRevisedText(outText);
|
|
31
|
+
const src = String(srcText || '');
|
|
32
|
+
const cats = (typeof parseErrorCategories === 'function') ? parseErrorCategories(outText) : {};
|
|
33
|
+
const catRows = Object.keys(cats).sort(function(a, b){ return cats[b] - cats[a]; });
|
|
34
|
+
const totalAnn = catRows.reduce(function(a, k){ return a + cats[k]; }, 0);
|
|
35
|
+
let q = null;
|
|
36
|
+
if(typeof qualityScore === 'function' && src.trim() && rev.trim()){
|
|
37
|
+
q = qualityScore(src, rev);
|
|
38
|
+
}
|
|
39
|
+
const srcParas = (typeof triSplitParas === 'function') ? triSplitParas(src).length : 0;
|
|
40
|
+
const dstParas = (typeof triSplitParas === 'function') ? triSplitParas(rev).length : 0;
|
|
41
|
+
const taskName = (typeof currentTask === 'function' && currentTask()) ? currentTask().name : '未挂接任务';
|
|
42
|
+
const aiEst = (window.TP_EST && Number(window.TP_EST.score)) ? window.TP_EST : null;
|
|
43
|
+
return {
|
|
44
|
+
rev: rev, src: src, cats: cats, catRows: catRows, totalAnn: totalAnn, q: q,
|
|
45
|
+
srcParas: srcParas, dstParas: dstParas, taskName: taskName, aiEst: aiEst,
|
|
46
|
+
fixedDone: Number(fixedDone) || 0, fixedTotal: Number(fixedTotal) || 0,
|
|
47
|
+
ts: new Date()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* 组装 Markdown 报告 */
|
|
52
|
+
function reportMarkdown(d){
|
|
53
|
+
const L = [];
|
|
54
|
+
L.push('# 交付质检报告');
|
|
55
|
+
L.push('');
|
|
56
|
+
L.push('| 项目 | 内容 |');
|
|
57
|
+
L.push('|---|---|');
|
|
58
|
+
L.push('| 任务 | ' + d.taskName + ' |');
|
|
59
|
+
L.push('| 生成时间 | ' + d.ts.getFullYear() + '-' + String(d.ts.getMonth()+1).padStart(2,'0') + '-' + String(d.ts.getDate()).padStart(2,'0') + ' ' + String(d.ts.getHours()).padStart(2,'0') + ':' + String(d.ts.getMinutes()).padStart(2,'0') + ' |');
|
|
60
|
+
L.push('| 原文规模 | ' + d.srcParas + ' 段 / ' + d.src.length + ' 字 |');
|
|
61
|
+
L.push('| 译文规模 | ' + d.dstParas + ' 段 / ' + d.rev.length + ' 字 |');
|
|
62
|
+
L.push('');
|
|
63
|
+
if(d.q && d.q.ok){
|
|
64
|
+
L.push('## 质量评分');
|
|
65
|
+
L.push('');
|
|
66
|
+
L.push('**' + d.q.score + ' 分(' + d.q.level + ')** · 忠实度 ' + d.q.fidelity + '/60 · 流畅度 ' + d.q.fluency + '/40');
|
|
67
|
+
if(d.aiEst){
|
|
68
|
+
L.push('');
|
|
69
|
+
L.push('校对前 AI 预估:' + d.aiEst.score + ' 分(' + d.aiEst.level + ')· 建议阶段 ' + (d.aiEst.suggestStage || '—') + ' · 预计工作量 ' + (d.aiEst.effort || '—'));
|
|
70
|
+
}
|
|
71
|
+
if(d.q.items && d.q.items.length){
|
|
72
|
+
L.push('');
|
|
73
|
+
L.push('### 主要扣分项');
|
|
74
|
+
L.push('');
|
|
75
|
+
d.q.items.slice(0, 5).forEach(function(it){
|
|
76
|
+
L.push('- ' + it.cat + ':' + it.detail + '(-' + it.pen + ')');
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
L.push('');
|
|
80
|
+
}
|
|
81
|
+
L.push('## 错误分类');
|
|
82
|
+
L.push('');
|
|
83
|
+
if(d.catRows.length){
|
|
84
|
+
L.push('| 类型 | 条数 |');
|
|
85
|
+
L.push('|---|---|');
|
|
86
|
+
d.catRows.forEach(function(k){ L.push('| ' + k + ' | ' + d.cats[k] + ' |'); });
|
|
87
|
+
}else{
|
|
88
|
+
L.push('未解析到带类型标签的批注。');
|
|
89
|
+
}
|
|
90
|
+
L.push('');
|
|
91
|
+
L.push('## 已修进度');
|
|
92
|
+
L.push('');
|
|
93
|
+
const pct = d.fixedTotal ? Math.round(d.fixedDone * 100 / d.fixedTotal) : 0;
|
|
94
|
+
L.push('批注 ' + d.fixedTotal + ' 条 · 已修 ' + d.fixedDone + ' 条 · 未修 ' + (d.fixedTotal - d.fixedDone) + ' 条(完成 ' + pct + '%)');
|
|
95
|
+
L.push('');
|
|
96
|
+
L.push('## 剩余风险');
|
|
97
|
+
L.push('');
|
|
98
|
+
const risks = [];
|
|
99
|
+
if(d.fixedTotal - d.fixedDone > 0) risks.push('还有 ' + (d.fixedTotal - d.fixedDone) + ' 条批注未标记已修');
|
|
100
|
+
if(d.q && d.q.ok && d.q.items && d.q.items.length){
|
|
101
|
+
d.q.items.slice(0, 5).forEach(function(it){ risks.push(it.cat + ':' + it.detail); });
|
|
102
|
+
}
|
|
103
|
+
if(risks.length){
|
|
104
|
+
risks.forEach(function(r){ L.push('- ' + r); });
|
|
105
|
+
}else{
|
|
106
|
+
L.push('- 本次未发现明显遗留项。');
|
|
107
|
+
}
|
|
108
|
+
L.push('');
|
|
109
|
+
L.push('## 检查覆盖');
|
|
110
|
+
L.push('');
|
|
111
|
+
L.push('- 术语一致(专名体检)· 段落对齐 · 数字格式 · 标点对账 · 翻译腔 · 风格简报 · 错误分类 · 已修/未修流转');
|
|
112
|
+
L.push('- 质量评分 = 忠实度 60 + 流畅度 40,本地计算,不花 token');
|
|
113
|
+
L.push('');
|
|
114
|
+
L.push('---');
|
|
115
|
+
L.push('');
|
|
116
|
+
L.push('本报告由 TransProof 生成 · https://transproof.pages.dev · v' + APP_VERSION);
|
|
117
|
+
return L.join(NL);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* 打开交付报告弹窗 */
|
|
121
|
+
function deliveryReport(){
|
|
122
|
+
if(!LAST_OUT){ toast('还没有校对结果。先跑一次校对,再生成交付报告', 'w'); return; }
|
|
123
|
+
const src = $('#src') ? $('#src').value.trim() : '';
|
|
124
|
+
const fpLis = Array.from(document.querySelectorAll('#out li[data-fp]')).filter(function(li){ return li.dataset.err; });
|
|
125
|
+
const done = fpLis.filter(function(li){ return AUDIT_FIX[li.dataset.fp]; }).length;
|
|
126
|
+
const d = reportBuildData(LAST_OUT, src, done, fpLis.length);
|
|
127
|
+
const md = reportMarkdown(d);
|
|
128
|
+
modal('📋 交付质检报告', [
|
|
129
|
+
'<div style="max-height:60vh;overflow:auto;background:var(--bg2);border:1px solid var(--bd);border-radius:8px;padding:14px;font-size:13px;line-height:1.7">',
|
|
130
|
+
'<pre style="white-space:pre-wrap;font-family:inherit;margin:0;color:var(--tx1)">' + esc(md) + '</pre>',
|
|
131
|
+
'</div>',
|
|
132
|
+
'<div style="display:flex;gap:8px;margin-top:12px;flex-wrap:wrap">',
|
|
133
|
+
'<button class="btn pri" id="rp-copy-md">📋 复制 Markdown</button>',
|
|
134
|
+
'<button class="btn gray" id="rp-copy-txt">复制纯文本</button>',
|
|
135
|
+
'<button class="btn gray" id="rp-close">关闭</button>',
|
|
136
|
+
'</div>'
|
|
137
|
+
].join(''));
|
|
138
|
+
$('#rp-copy-md').onclick = function(){
|
|
139
|
+
navigator.clipboard.writeText(md).then(function(){ toast('已复制 Markdown 报告'); }).catch(function(){ toast('复制失败,请手动选中', 'e'); });
|
|
140
|
+
};
|
|
141
|
+
$('#rp-copy-txt').onclick = function(){
|
|
142
|
+
navigator.clipboard.writeText(md).then(function(){ toast('已复制报告'); }).catch(function(){ toast('复制失败,请手动选中', 'e'); });
|
|
143
|
+
};
|
|
144
|
+
$('#rp-close').onclick = closeModal;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
$('#btn-report') && ($('#btn-report').onclick = deliveryReport);
|
|
148
|
+
window.deliveryReport = deliveryReport;
|
|
149
|
+
window.reportBuildData = reportBuildData;
|
|
150
|
+
window.reportMarkdown = reportMarkdown;
|
|
151
|
+
window.reportRevisedText = reportRevisedText;
|