Skip to content

Commit

Permalink
Fix Filter Delete (#96)
Browse files Browse the repository at this point in the history
* Fix Filter Delete Button

* Cleanup Logging
  • Loading branch information
smashedr authored Aug 16, 2024
1 parent 5cb9f24 commit 40e894e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 40e894e

Please sign in to comment.