var browser = browser || chrome

const form = document.forms[0]
const filtersInput = form.elements[0]

browser.runtime.sendMessage({ type: 'get-filters' }, getFilters)

form.addEventListener('submit', submit)

function getFilters(filters) {
  filtersInput.value = filters.join(', ')
}

function submit(event) {
  event.preventDefault()

  const filters = getFiltersFromInputValue(filtersInput.value)
  browser.runtime.sendMessage({ type: 'set-filters', filters })

  function getFiltersFromInputValue(filtersString) {
    return filtersString.split(',').map(filterString => filterString.trim())
  }
}

@@ -393,16 +393,38 @@
 .value)%0A
+  getFilters(filters)%0A
   browse
@@ -557,16 +557,23 @@
 rsString
+%0A      
 .split('
@@ -575,16 +575,23 @@
 lit(',')
+%0A      
 .map(fil
@@ -624,14 +624,69 @@
 trim())%0A
+      .filter(filterString =%3E filterString.length %3E 0)%0A
   %7D%0A%7D%0A

Clear filters input on submit in popup