MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / updateButtonTexts

Function updateButtonTexts

notes.js:354–386  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

352
353 // 全局更新按钮文本函数
354 function updateButtonTexts() {
355 // 更新回收站按钮
356 const trashBtn = document.querySelector('.nsn-btn[title="回收站"]');
357 if (trashBtn) {
358 const trashData = readJSON(LS_KEYS.trash, []);
359 const trashCount = trashData.length;
360 trashBtn.textContent = trashCount > 0 ? `回收站 (${trashCount})` : '回收站';
361 }
362
363 const historyBtn = document.querySelector('.nsn-btn[title="历史记录"]');
364
365 if (!window.currentNoteId) {
366 if (historyBtn) historyBtn.textContent = '历史记录';
367 return;
368 }
369
370 const map = readJSON(LS_KEYS.notes, {});
371 const list = map[window.currentCategoryId] || [];
372 const note = list.find(n => n.id === window.currentNoteId);
373
374 if (note) {
375 // 更新历史记录按钮
376 if (historyBtn) {
377 const historyCount = (note.history && note.history.length > 0) ? note.history.length : 0;
378 historyBtn.textContent = historyCount > 0 ? `历史记录 (${historyCount})` : '历史记录';
379 }
380
381
382 } else {
383 if (historyBtn) historyBtn.textContent = '历史记录';
384
385 }
386 }
387
388 function buildToolbar(cmd) {
389 const bar = createElement('div', { className: 'nsn-toolbar' });

Callers 8

renderNotesFunction · 0.85
clearEditorFunction · 0.85
saveCurrentFunction · 0.85
deleteCurrentNoteFunction · 0.85
restoreToVersionFunction · 0.85
buildDialogFunction · 0.85
showTrashDialogFunction · 0.85
permanentDeleteNoteFunction · 0.85

Calls 1

readJSONFunction · 0.85

Tested by

no test coverage detected