()
| 226 | } |
| 227 | |
| 228 | async function updateStorageModeButton() { |
| 229 | const buttons = Array.from(document.querySelectorAll('#storage-mode-btn, [data-storage-mode-btn]')); |
| 230 | if (!buttons.length) return; |
| 231 | buttons.forEach((btn) => { |
| 232 | btn.textContent = '...'; |
| 233 | btn.title = '存储模式'; |
| 234 | btn.classList.remove('storage-ready'); |
| 235 | }); |
| 236 | const storageType = await fetchStorageType(); |
| 237 | const label = formatStorageLabel(storageType); |
| 238 | buttons.forEach((btn) => { |
| 239 | btn.textContent = label === '-' ? label : label.toUpperCase(); |
| 240 | btn.title = '存储模式'; |
| 241 | if (label !== '-') btn.classList.add('storage-ready'); |
| 242 | }); |
| 243 | } |
| 244 | |
| 245 | if (document.readyState === 'loading') { |
| 246 | document.addEventListener('DOMContentLoaded', updateStorageModeButton); |
no test coverage detected