text: function parseBockedSiteList(inputValue) {
    let blockedSitesArray = [];
    inputValue.split("\n").forEach((s) => {
      const noWhitespace = s.replace(/\s/g, "");
      if (noWhitespace === "") return;
      blockedSitesArray.push(noWhitespace);
    });
  
    return blockedSitesArray;
  }
  
  function loadSettings() {
    browser.storage.sync.get("blockedSites").then((settings) => {
      const blockedSitesInput = document.querySelector(".blocked-sites-input");
  
      //Load text of sites into text area
      settings.blockedSites.forEach((site, index) => {
        blockedSitesInput.value += site;
  
        if (index !== settings.blockedSites.length - 1) {
          blockedSitesInput.value += "\n";
        }
      });
    });
  }
  
  async function saveSettings() {
    const inputStr = document.querySelector(".blocked-sites-input").value;
  
    const blockedSitesArr = parseBockedSiteList(inputStr);
  
    await browser.storage.sync.set({
      blockedSites: blockedSitesArr
    });
  
    document.querySelector(".saved-text").hidden = false;
    setTimeout(() => {
      document.querySelector(".saved-text").hidden = true;
    }, 2000);
  }
  
  document.addEventListener("DOMContentLoaded", loadSettings);
  document.querySelector(".save-btn").addEventListener("click", saveSettings);
  