()
| 137 | } |
| 138 | |
| 139 | function toggleHistory() { |
| 140 | const currentlyEnabled = isHistoryEnabled(); |
| 141 | const willEnable = !currentlyEnabled; |
| 142 | |
| 143 | const message = willEnable |
| 144 | ? 'Enable paste history? Your cleaned text will be stored locally on this device.' |
| 145 | : 'Disable paste history? This will permanently delete all existing history and stop saving new items.'; |
| 146 | |
| 147 | if (!confirm(message)) { |
| 148 | return; |
| 149 | } |
| 150 | |
| 151 | if (!willEnable) { |
| 152 | try { |
| 153 | localStorage.removeItem(HISTORY_KEY); |
| 154 | } catch (error) { |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | localStorage.setItem(HISTORY_ENABLED_KEY, willEnable.toString()); |
| 159 | updateHistoryUI(); |
| 160 | updateHistoryDisplay(); |
| 161 | updateHistoryVisibility(); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | function updateHistoryUI() { |
| 166 | const enabled = isHistoryEnabled(); |
nothing calls this directly
no test coverage detected