(whitelist)
| 158 | // ============================================================================ |
| 159 | |
| 160 | function renderWhitelist(whitelist) { |
| 161 | const container = document.getElementById('whitelistItems'); |
| 162 | if (!container) return; |
| 163 | |
| 164 | container.innerHTML = ''; |
| 165 | |
| 166 | if (!whitelist || whitelist.length === 0) { |
| 167 | container.innerHTML = '<div style="color: var(--text-muted); font-size: 12px; padding: 12px; text-align: center;">No whitelisted domains</div>'; |
| 168 | return; |
| 169 | } |
| 170 | |
| 171 | whitelist.forEach(domain => { |
| 172 | const item = document.createElement('div'); |
| 173 | item.className = 'whitelist-item'; |
| 174 | item.innerHTML = ` |
| 175 | <span>${domain}</span> |
| 176 | <button data-domain="${domain}" title="Remove"><i class="fas fa-times"></i></button> |
| 177 | `; |
| 178 | container.appendChild(item); |
| 179 | }); |
| 180 | |
| 181 | // Add remove handlers |
| 182 | container.querySelectorAll('button').forEach(btn => { |
| 183 | btn.addEventListener('click', () => { |
| 184 | const domain = btn.dataset.domain; |
| 185 | removeFromWhitelist(domain); |
| 186 | }); |
| 187 | }); |
| 188 | } |
| 189 | |
| 190 | function removeFromWhitelist(domain) { |
| 191 | chrome.storage.sync.get('whitelist', (data) => { |
no test coverage detected