MCPcopy
hub / github.com/Alanrk/LazyCat-Bookmark-Cleaner / updateSelectAllButtonState

Function updateSelectAllButtonState

index.js:89–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87
88// 添加更新全选按钮状态的函数
89function updateSelectAllButtonState() {
90 const selectAllBtn = document.getElementById('select-all');
91 // 只获取当前可见的复选框
92 const visibleCheckboxes = Array.from(document.querySelectorAll('.result-item'))
93 .filter(item => item.style.display !== 'none')
94 .map(item => item.querySelector('.bookmark-checkbox'));
95
96 if (selectAllBtn && visibleCheckboxes.length > 0) {
97 const isAllSelected = visibleCheckboxes.every(cb => cb.checked);
98
99 let span = selectAllBtn.querySelector('span[data-i18n]');
100
101 if (!span) {
102 span = document.createElement('span');
103 span.setAttribute('data-i18n', 'selectAll');
104 selectAllBtn.textContent = '';
105 selectAllBtn.appendChild(span);
106 }
107
108 const messageKey = isAllSelected ? 'deselectAll' : 'selectAll';
109 span.setAttribute('data-i18n', messageKey);
110 span.textContent = chrome.i18n.getMessage(messageKey);
111
112 // 只有当有可见项目时才启用按钮
113 selectAllBtn.disabled = visibleCheckboxes.length === 0;
114 }
115}
116
117// 添加更新删除按钮状态的函数
118function updateDeleteButtonState() {

Callers 4

addInvalidBookmarkFunction · 0.85
addEmptyFolderFunction · 0.85
initBatchActionsFunction · 0.85
applyFilterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected