From 40e894e851cebfc54e3ff6a315cd95f21e2cbfc4 Mon Sep 17 00:00:00 2001 From: SmAsHeD <6071159+smashedr@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:40:44 -0700 Subject: [PATCH] Fix Filter Delete (#96) * Fix Filter Delete Button * Cleanup Logging --- src/js/options.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/options.js b/src/js/options.js index 3b24c2c..f0ce4b4 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -154,22 +154,22 @@ async function addFilter(event) { * Delete Filter * @function deleteFilter * @param {MouseEvent} event - * @param {String} index + * @param {String} [index] */ async function deleteFilter(event, index = undefined) { - console.debug('deleteFilter:', event) + console.debug('deleteFilter:', index, event) event.preventDefault() + const filter = event.currentTarget?.dataset?.value + console.debug('filter:', filter) const { patterns } = await chrome.storage.sync.get(['patterns']) // console.debug('patterns:', patterns) if (!index) { // const anchor = event.target.closest('a') - const filter = event.currentTarget?.dataset?.value - console.log(`filter: ${filter}`) if (filter && patterns.includes(filter)) { index = patterns.indexOf(filter) } } - console.debug(`index: ${index}`) + console.debug('index:', index) if (index !== undefined) { const name = patterns[index] patterns.splice(index, 1)