Skip to content

Commit 2e64ec7

Browse files
committed
feat(ui): add clear-all button to history panel with red background
1 parent 905b1ae commit 2e64ec7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

worker.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,19 @@ function getHTML() {
873873
' cursor: pointer;',
874874
' z-index: 1001;',
875875
' }',
876+
877+
' .clear-all-btn {',
878+
' position: fixed;',
879+
' left: 300px;',
880+
' top: 20px;',
881+
' background: red;',
882+
' color: white;',
883+
' border: none;',
884+
' padding: 10px 15px;',
885+
' border-radius: 5px;',
886+
' cursor: pointer;',
887+
' z-index: 1001;',
888+
' }',
876889

877890
' /* 添加复制按钮样式 */',
878891
' .result-header {',
@@ -1342,7 +1355,10 @@ function getHTML() {
13421355
'</div>',
13431356
'<button class="history-toggle" id="historyToggle">📋 识别历史</button>',
13441357
'<div class="history-sidebar" id="historySidebar">',
1358+
'<div class="history-header">',
13451359
'<h2>识别历史</h2>',
1360+
'<button class="clear-all-btn" id="clearAllHistory">清空全部</button>',
1361+
'</div>',
13461362
'<div id="historyList"></div>',
13471363
'</div>',
13481364
'<div class="footer-content">',
@@ -1473,6 +1489,7 @@ function getHTML() {
14731489
' const tokenList = document.getElementById(\'tokenList\');',
14741490
' const historySidebar = document.getElementById(\'historySidebar\');',
14751491
' const historyToggle = document.getElementById(\'historyToggle\');',
1492+
' const clearAllHistoryBtn = document.getElementById(\'clearAllHistory\');',
14761493

14771494
' let currentToken = \'\';',
14781495
' let tokens = [];',
@@ -1878,6 +1895,14 @@ function getHTML() {
18781895
' }',
18791896
' }',
18801897

1898+
' // 清空所有历史记录',
1899+
' clearAllHistoryBtn.addEventListener(\'click\', () => {',
1900+
' if (confirm(\'确定要清空所有历史记录吗?\')) {',
1901+
' localStorage.removeItem(historyManager.getHistoryKey(currentToken));',
1902+
' historyManager.displayHistory(currentToken);',
1903+
' }',
1904+
' });',
1905+
18811906
' // URL输入相关功能',
18821907
' const urlInput = document.getElementById(\'urlInput\');',
18831908
' const toggleUrl = document.getElementById(\'toggleUrl\');',

0 commit comments

Comments
 (0)