libredirect/src/assets/javascripts/general.js

29 lines
565 B
JavaScript
Raw Normal View History

"use strict"
import utils from "./utils.js"
window.browser = window.browser || window.chrome
2022-02-12 20:28:36 +01:00
2022-09-25 16:10:38 +02:00
let exceptions
function isException(url) {
2023-01-22 18:44:36 +01:00
for (const item of exceptions.url) if (item == url.href) return true
for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
return false
}
function init() {
return new Promise(async resolve => {
const options = await utils.getOptions()
if (options) exceptions = options.exceptions
resolve()
})
}
init()
browser.storage.onChanged.addListener(init)
export default {
isException,
}