feat(browser-extension): apply #287 suggestions
This commit is contained in:
parent
2f151c0c0a
commit
8817aa57b9
@ -102,11 +102,12 @@ async function handleContentLoaded() {
|
|||||||
async function handleDeleteClick(event) {
|
async function handleDeleteClick(event) {
|
||||||
const filterInputElement = document.getElementById('filter-input');
|
const filterInputElement = document.getElementById('filter-input');
|
||||||
const { value } = event.currentTarget.parentElement.dataset;
|
const { value } = event.currentTarget.parentElement.dataset;
|
||||||
|
const itemElement = document.querySelector(`[data-value="${value}"]`);
|
||||||
const state = { enabled: true };
|
const state = { enabled: true };
|
||||||
|
|
||||||
await dispatch({ hostname: value, state, type: 'SET_HOSTNAME_STATE' });
|
await dispatch({ hostname: value, state, type: 'SET_HOSTNAME_STATE' });
|
||||||
exclusionList = exclusionList.filter((exclusionValue) => exclusionValue !== value);
|
exclusionList = exclusionList.filter((exclusionValue) => exclusionValue !== value);
|
||||||
itemElement.remove();
|
itemElement?.remove();
|
||||||
updateList(filterInputElement.value.trim());
|
updateList(filterInputElement.value.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,12 +118,16 @@ async function handleDeleteClick(event) {
|
|||||||
|
|
||||||
function handleExportClick() {
|
function handleExportClick() {
|
||||||
const anchor = document.createElement('a');
|
const anchor = document.createElement('a');
|
||||||
|
const now = new Date();
|
||||||
|
const day = now.getUTCDay().toString().padStart(2, '0');
|
||||||
|
const month = now.getUTCMonth().toString().padStart(2, '0');
|
||||||
|
const year = now.getUTCFullYear();
|
||||||
const text = exclusionList.join('\n');
|
const text = exclusionList.join('\n');
|
||||||
const blob = new Blob([text], { type: 'octet/stream' });
|
const blob = new Blob([text], { type: 'octet/stream' });
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
|
||||||
anchor.href = url;
|
anchor.href = url;
|
||||||
anchor.download = `${new Date().valueOf()}.cdm`;
|
anchor.download = `${year}${month}${day}.cdm`;
|
||||||
anchor.click();
|
anchor.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user