feat: simplify panel shortcut to Alt+Q
This commit is contained in:
Vendored
+6
-6
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name 华谊题库助手 · CSV导出与划词检索
|
||||
// @namespace local.huayi.question-bank
|
||||
// @version 1.2.9
|
||||
// @version 1.2.10
|
||||
// @description 全网页快捷键唤出、本地题库文字检索与自动选择答案,按库导入导出;每页默认完全隐藏。
|
||||
// @match http://*/*
|
||||
// @match https://*/*
|
||||
@@ -2377,7 +2377,7 @@ if (typeof module !== 'undefined' && module.exports) module.exports = QBCollecto
|
||||
// UI and persistence stay inside the userscript sandbox. Page data is rendered as text.
|
||||
(() => {
|
||||
const FRAME_SHORTCUT = 'huayi-qb.frame-shortcut.v1';
|
||||
const isToggleShortcut = event => event.altKey && event.shiftKey && !event.ctrlKey && !event.metaKey &&
|
||||
const isToggleShortcut = event => event.altKey && !event.ctrlKey && !event.metaKey &&
|
||||
(event.code === 'KeyQ' || (!event.code && String(event.key).toLowerCase() === 'q')) && !event.repeat;
|
||||
// Frames only forward the explicit shortcut. Keep one panel and one set of
|
||||
// storage/network handlers in the top page; never relay frame text or answers.
|
||||
@@ -3244,7 +3244,7 @@ if (typeof module !== 'undefined' && module.exports) module.exports = QBCollecto
|
||||
const ui = node('div');
|
||||
ui.innerHTML = `
|
||||
<section id="qb-panel" role="region" aria-label="华谊题库助手">
|
||||
<header class="header"><div><div class="brand">题库助手</div><div class="subtitle">HUAYI · 本地练习资料</div></div><div class="tools"><button type="button" data-action="collapse" title="收起或展开内容" aria-expanded="true">收起</button><button type="button" data-action="hide" title="隐藏面板,Alt + Shift + Q 恢复">隐藏</button></div></header>
|
||||
<header class="header"><div><div class="brand">题库助手</div><div class="subtitle">HUAYI · 本地练习资料</div></div><div class="tools"><button type="button" data-action="collapse" title="收起或展开内容" aria-expanded="true">收起</button><button type="button" data-action="hide" title="隐藏面板,Alt + Q 恢复">隐藏</button></div></header>
|
||||
<div class="body">
|
||||
<div class="context"><strong id="qb-context-name">正在识别题库…</strong><div class="context-count"><span id="qb-context-count"></span><span id="qb-page-total"></span></div></div>
|
||||
<nav class="tabs" role="tablist" aria-label="助手功能"><button type="button" data-tab="search" role="tab" aria-controls="qb-view-search">文字搜索</button><button type="button" data-tab="library" role="tab" aria-controls="qb-view-library">题库 / 导出</button><button type="button" data-tab="auto" role="tab" aria-controls="qb-view-auto">自动答题</button><button type="button" data-tab="settings" role="tab" aria-controls="qb-view-settings">设置</button></nav>
|
||||
@@ -3261,7 +3261,7 @@ if (typeof module !== 'undefined' && module.exports) module.exports = QBCollecto
|
||||
</div>
|
||||
<div class="view" id="qb-view-settings" data-view="settings" role="tabpanel" hidden>
|
||||
<div class="section"><h3>重置本地题库</h3><p>清空全部题库、答案、冲突及历史修复备份,同时暂停采集并关闭自动答题。重置前如需保留,请先导出 JSON;重置后重新导入可信题库。</p><button type="button" class="btn small" data-action="reset-library">重置全部题库</button></div>
|
||||
<div class="section"><h3>面板显示</h3><p>每次打开或刷新网页都默认完全隐藏,不显示悬浮按钮。</p><p>显示 / 隐藏快捷键:<kbd class="kbd">Shift + Alt + Q</kbd></p><p>面板隐藏时,划选文字仍可更新检索内容,面板保持隐藏。</p><button type="button" class="btn small" data-action="hide">立即隐藏</button></div>
|
||||
<div class="section"><h3>面板显示</h3><p>每次打开或刷新网页都默认完全隐藏,不显示悬浮按钮。</p><p>显示 / 隐藏快捷键:<kbd class="kbd">Alt + Q</kbd></p><p>原快捷键 Shift + Alt + Q 仍可使用。</p><p>面板隐藏时,划选文字仍可更新检索内容,面板保持隐藏。</p><button type="button" class="btn small" data-action="hide">立即隐藏</button></div>
|
||||
<div class="section"><h3>选择与复制</h3><label class="check"><input id="qb-copy-enabled" type="checkbox"><span>恢复题目区域的选择复制<small>换题后自动适配,关闭后恢复原有处理。</small></span></label></div>
|
||||
<div class="section"><h3>答案规则</h3><p>按标准答案内容保存,再对应当前页面的选项位置。没有标准答案就显示待补;不同答案会保留冲突。所有资料保存在当前浏览器,建议定期导出备份。</p></div>
|
||||
<div class="section"><h3>重复记录整理</h3><p>重复加载的题目按批次对应合并,保留原题库中的同文题和全部来源 ID。首次整理前会保留原始备份。</p><button type="button" class="btn small" data-action="export-dedup-backup">导出整理前备份</button></div>
|
||||
@@ -3271,7 +3271,7 @@ if (typeof module !== 'undefined' && module.exports) module.exports = QBCollecto
|
||||
</div>
|
||||
<footer class="footer"><div class="footline"><span class="dot"></span><span>本地题库 · 标准答案优先</span></div><div id="qb-status" role="status"></div></footer>
|
||||
</div>
|
||||
</section><button type="button" id="qb-launcher" data-action="restore" title="显示题库助手 · Alt + Shift + Q" aria-label="显示题库助手" hidden>题库</button>`;
|
||||
</section><button type="button" id="qb-launcher" data-action="restore" title="显示题库助手 · Alt + Q" aria-label="显示题库助手" hidden>题库</button>`;
|
||||
shadow.append(...ui.childNodes);
|
||||
(document.body || document.documentElement).append(root);
|
||||
panel = shadow.getElementById('qb-panel'); launcher = shadow.getElementById('qb-launcher');
|
||||
@@ -3385,7 +3385,7 @@ if (typeof module !== 'undefined' && module.exports) module.exports = QBCollecto
|
||||
window.addEventListener('focus', synchronizeReset);
|
||||
document.addEventListener('visibilitychange', () => { if (!document.hidden) synchronizeReset(); });
|
||||
if (typeof GM_registerMenuCommand === 'function') {
|
||||
GM_registerMenuCommand('显示题库助手(Alt+Shift+Q)', () => setMode('open'));
|
||||
GM_registerMenuCommand('显示题库助手(Alt+Q)', () => setMode('open'));
|
||||
GM_registerMenuCommand('隐藏题库助手', () => setMode('hidden'));
|
||||
GM_registerMenuCommand('重置全部本地题库', resetLibrary);
|
||||
GM_registerMenuCommand('导出整理前原始题库备份', exportCleanupBackup);
|
||||
|
||||
Reference in New Issue
Block a user