Made most redirects work as expected

This commit is contained in:
Hygna 2022-09-24 11:44:18 +01:00
parent f87eb20cee
commit df5e7f9b07
5 changed files with 135 additions and 103 deletions

View File

@ -27,19 +27,19 @@ function init() {
}) })
for (const service in config.services) { for (const service in config.services) {
options[service] = {} options[service] = {}
browser.storage.local.get([`${utils.camelCase(service)}Enable`, `${service}RedirectType`, `${service}Frontend`], r => { browser.storage.local.get([`${service}Enabled`, `${service}RedirectType`, `${service}Frontend`], r => {
options[service].enabled = r[utils.camelCase(service) + "Enable"] options[service].enabled = r[service + "Enabled"]
options[service].frontend = r[service + "Frontend"] options[service].frontend = r[service + "Frontend"]
options[service].redirectType = r[service + "RedirectType"] options[service].redirectType = r[service + "RedirectType"]
}) })
for (const frontend in config.services[service].frontends) { for (const frontend in config.services[service].frontends) {
options[frontend] = {} options[frontend] = {}
options[frontend].checks = []
options[frontend].custom = []
for (const network in config.networks) { for (const network in config.networks) {
options[frontend][network] = {}
options[frontend][network] = {}
browser.storage.local.get([`${frontend}${utils.camelCase(network)}RedirectsChecks`, `${frontend}${utils.camelCase(network)}CustomRedirects`], r => { browser.storage.local.get([`${frontend}${utils.camelCase(network)}RedirectsChecks`, `${frontend}${utils.camelCase(network)}CustomRedirects`], r => {
options[frontend].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"] options[frontend][network].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"]
options[frontend].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"] options[frontend][network].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"]
}) })
} }
} }
@ -55,14 +55,22 @@ function all(service) {
for (const network in config.networks) { for (const network in config.networks) {
tmp.push(...redirects[frontend][network]) tmp.push(...redirects[frontend][network])
} }
} } else if (config.services[service].frontends[frontend].singleInstance != undefined) tmp.push(config.services[service].frontends[frontend].singleInstance)
} }
return tmp return tmp
} }
function regexArray(service, url) { function regexArray(service, url) {
for (const targetString in config.services[service].targets) { let targets
const target = new RegExp(config.services[service].targets[targetString]) if (config.services[service].targets == "datajson") {
browser.storage.local.get(`${service}Targets`, r => {
targets = r[service + "Targets"]
})
} else {
targets = config.services[service].targets
}
for (const targetString in targets) {
const target = new RegExp(targets[targetString])
if (target.test(url.href)) return true if (target.test(url.href)) return true
} }
return false return false
@ -76,32 +84,30 @@ function redirect(url, type, initiator) {
let randomInstance let randomInstance
let frontend let frontend
let network = options.network let network = options.network
let networkFallback = options.networkFallback
let redirectType
if (url.pathname == "/") return
for (const service in config.services) { for (const service in config.services) {
if (!options[service].enabled) continue if (!options[service].enabled) continue
let targets = config.services[service].targets if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue
if (targets == "datajson") { if (!config.services[service].embeddable && type != "main_frame") continue
browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) let targets = new RegExp(config.services[service].targets.join("|"), "i")
}
if (initiator && (all(service).includes(initiator.origin) || targets.includes(initiator.host))) continue if (initiator && (all(service).includes(initiator.origin) || targets.test(initiator.host))) continue
if (!targets.some(rx => rx.test(url.href))) continue if (!regexArray(service, url)) continue
if (type != redirectType && type != "both") continue
if (Object.keys(config.services[service].frontends).length > 1) {
frontend = options[service].frontend frontend = options[service].frontend
redirectType = options[service].redirectType } else {
frontend = Object.keys(config.services[service].frontends)[0]
// browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) }
if (config.services[service].frontends[frontend].instanceList) { if (config.services[service].frontends[frontend].instanceList) {
let instanceList = [...[frontend + utils.camelCase(network) + "RedirectsChecks"], ...[frontend + utils.camelCase(network) + "CustomRedirects"]] let instanceList = [...options[frontend][network].checks, ...options[frontend][network].custom]
if (instanceList.length === 0 && networkFallback) instanceList = [...[frontend + "ClearnetRedirectsChecks"], ...[frontend + "ClearnetCustomRedirects"]] if (instanceList.length === 0 && options.networkFallback) instanceList = [...options[frontend].clearnet.checks, ...options[frontend].clearnet.custom]
if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return if (instanceList.length === 0) return
randomInstance = utils.getRandomInstance(instanceList) randomInstance = utils.getRandomInstance(instanceList)
} else if (config.services[service].frontends[frontend].singleInstance) randomInstance = config.services[service].frontends[frontend].singleInstance
break
} }
} if (frontend == null) return
// Here is a (temperory) space for defining constants required in 2 or more switch cases. // Here is a (temperory) space for defining constants required in 2 or more switch cases.
// When possible, try have the two switch cases share all their code as done with searx and searxng. // When possible, try have the two switch cases share all their code as done with searx and searxng.
@ -111,10 +117,10 @@ function redirect(url, type, initiator) {
const dataLatLngRegex = /!3d(-?[0-9]{1,}.[0-9]{1,})!4d(-?[0-9]{1,}.[0-9]{1,})/ const dataLatLngRegex = /!3d(-?[0-9]{1,}.[0-9]{1,})!4d(-?[0-9]{1,}.[0-9]{1,})/
const placeRegex = /\/place\/(.*)\// const placeRegex = /\/place\/(.*)\//
function convertMapCentre() { function convertMapCentre() {
let [, lat, lon, zoom] = 0 let [lat, lon, zoom] = [null, null, null]
if (url.pathname.match(mapCentreRegex)) { if (url.pathname.match(mapCentreRegex)) {
// Set map centre if present // Set map centre if present
;[, lat, lon, zoom] = url.pathname.match(mapCentreRegex) ;[lat, lon, zoom] = url.pathname.match(mapCentreRegex)
} else if (url.searchParams.has("center")) { } else if (url.searchParams.has("center")) {
;[lat, lon] = url.searchParams.get("center").split(",") ;[lat, lon] = url.searchParams.get("center").split(",")
zoom = url.searchParams.get("zoom") ?? "17" zoom = url.searchParams.get("zoom") ?? "17"
@ -149,7 +155,7 @@ function redirect(url, type, initiator) {
case "whoogle": case "whoogle":
return `${randomInstance}/search${encodeURIComponent(url.searchParams.get("q"))}` return `${randomInstance}/search${encodeURIComponent(url.searchParams.get("q"))}`
case "librex": case "librex":
return `${randomInstance}/search.php${encodeURIComponent(url.searchParams.get("q"))}` return `${randomInstance}/search.php?q=${encodeURIComponent(url.searchParams.get("q"))}`
case "send": case "send":
return randomInstance return randomInstance
case "nitter": case "nitter":
@ -168,7 +174,7 @@ function redirect(url, type, initiator) {
return `${randomInstance}/${url.search}` return `${randomInstance}/${url.search}`
case "osm": { case "osm": {
if (initiator && initiator.host === "earth.google.com") return if (initiator && initiator.host === "earth.google.com") return
travelModes = { const travelModes = {
driving: "fossgis_osrm_car", driving: "fossgis_osrm_car",
walking: "fossgis_osrm_foot", walking: "fossgis_osrm_foot",
bicycling: "fossgis_osrm_bike", bicycling: "fossgis_osrm_bike",
@ -227,10 +233,8 @@ function redirect(url, type, initiator) {
let orgVal = url.searchParams.get("origin") let orgVal = url.searchParams.get("origin")
let destVal = url.searchParams.get("destination") let destVal = url.searchParams.get("destination")
let org let org = addressToLatLng(orgVal)
addressToLatLng(orgVal, a => (org = a)) let dest = addressToLatLng(destVal)
let dest
addressToLatLng(destVal, a => (dest = a))
prefs.route = `${org};${dest}` prefs.route = `${org};${dest}`
let prefsEncoded = new URLSearchParams(prefs).toString() let prefsEncoded = new URLSearchParams(prefs).toString()
@ -280,7 +284,7 @@ function redirect(url, type, initiator) {
} }
case "facil": { case "facil": {
if (initiator && initiator.host === "earth.google.com") return if (initiator && initiator.host === "earth.google.com") return
let travelModes = { const travelModes = {
driving: "car", driving: "car",
walking: "pedestrian", walking: "pedestrian",
bicycling: "bicycle", bicycling: "bicycle",
@ -443,17 +447,12 @@ function initDefaults() {
function computeService(url) { function computeService(url) {
for (const service in config.services) { for (const service in config.services) {
const regex = config.services[service].targets
console.log(regex)
if (regexArray(service, url)) { if (regexArray(service, url)) {
console.log(service + "gi")
return service return service
} else if (all(service).includes(utils.protocolHost(url))) { } else if (all(service).includes(utils.protocolHost(url))) {
console.log(service)
return service return service
} }
} }
console.log("moment")
return null return null
} }

View File

@ -85,9 +85,8 @@
"instanceList": false "instanceList": false
} }
}, },
"singleInstanceFrontends": ["freetube", "yatte"],
"targets": [ "targets": [
"^https?:\\/{2}(?:www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api/.*|$)", "^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(?!iframe_api\\/.*)",
"^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*",
"^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*",
"^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*", "^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*",
@ -253,7 +252,6 @@
"imgur": { "imgur": {
"frontends": { "frontends": {
"rimgo": { "rimgo": {
"preferences": {},
"name": "rimgo", "name": "rimgo",
"instanceList": true "instanceList": true
} }
@ -285,7 +283,6 @@
"medium": { "medium": {
"frontends": { "frontends": {
"scribe": { "scribe": {
"preferences": {},
"name": "Scribe", "name": "Scribe",
"instanceList": true "instanceList": true
} }
@ -301,14 +298,14 @@
"^psiloveyou\\.xyz", "^psiloveyou\\.xyz",
"^entrepreneurshandbook\\.co", "^entrepreneurshandbook\\.co",
"^blog\\.coinbase\\.com", "^blog\\.coinbase\\.com",
"^levelup\\.gitconnected\\.com ", "^levelup\\.gitconnected\\.com",
"^javascript\\.plainenglish\\.io ", "^javascript\\.plainenglish\\.io",
"^blog\\.bitsrc\\.io ", "^blog\\.bitsrc\\.io",
"^itnext\\.io ", "^itnext\\.io",
"^codeburst\\.io ", "^codeburst\\.io",
"^infosecwriteups\\.com ", "^infosecwriteups\\.com",
"^blog\\.devgenius\\.io ", "^blog\\.devgenius\\.io",
"^writingcooperative\\.com " "^writingcooperative\\.com"
], ],
"name": "Medium", "name": "Medium",
"options": { "enabled": true }, "options": { "enabled": true },
@ -353,7 +350,6 @@
"reuters": { "reuters": {
"frontends": { "frontends": {
"neuters": { "neuters": {
"preferences": {},
"name": "Neuters", "name": "Neuters",
"instanceList": true "instanceList": true
} }
@ -368,7 +364,6 @@
"peertube": { "peertube": {
"frontends": { "frontends": {
"simpleertube": { "simpleertube": {
"preferences": {},
"name": "SimpleerTube", "name": "SimpleerTube",
"instanceList": true "instanceList": true
} }
@ -464,13 +459,12 @@
"instanceList": true "instanceList": true
}, },
"whoogle": { "whoogle": {
"preferences": {},
"name": "Whoogle", "name": "Whoogle",
"instanceList": true "instanceList": true
}, },
"librex": { "librex": {
"preferences": { "preferences": {
"cookies": ["bibliogram", "disable_special", "invidious", "libreddit", "nitter", "proxitok", "theme", "wikiless"] "cookies": ["bibliogram", "disable_frontends", " disable_special", "invidious", "libreddit", "nitter", "proxitok", "save", "theme", "wikiless"]
}, },
"name": "LibreX", "name": "LibreX",
"instanceList": true "instanceList": true
@ -516,13 +510,13 @@
"maps": { "maps": {
"frontends": { "frontends": {
"facil": { "facil": {
"preferences": {},
"name": "FacilMap", "name": "FacilMap",
"instanceList": true "instanceList": true
}, },
"osm": { "osm": {
"name": "OpenStreetMap", "name": "OpenStreetMap",
"instanceList": false "instanceList": false,
"singleInstance": "https://www.openstreetmap.org"
} }
}, },
"targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"],
@ -538,7 +532,6 @@
"sendTargets": { "sendTargets": {
"frontends": { "frontends": {
"send": { "send": {
"preferences": {},
"name": "Send", "name": "Send",
"instanceList": "true" "instanceList": "true"
} }

View File

@ -180,110 +180,145 @@
</div> </div>
<div class="checklist-popup" id="popup-frontends-checklist"> <div class="checklist-popup" id="popup-frontends-checklist">
<div> <div>
<div><img src="../../../assets/images/youtube-icon.png"> <div>
<x data-localise="__MSG_youtube__">youtube</x> <img src="../../../assets/images/youtube-icon.png">
<x data-localise="__MSG_youtube__">Youtube</x>
</div> </div>
<input id="youtube" type="checkbox"> <input id="youtube" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/youtubeMusic-icon.png"> <div>
<x data-localise="__MSG_youtubeMusic__">youtubeMusic</x> <img src="../../../assets/images/youtubeMusic-icon.png">
<x data-localise="__MSG_youtubeMusic__">YT Music</x>
</div> </div>
<input id="youtubeMusic" type="checkbox"> <input id="youtubeMusic" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/twitter-icon.png"> <div>
<x data-localise="__MSG_twitter__">twitter</x> <img src="../../../assets/images/twitter-icon.png">
<x data-localise="__MSG_twitter__">Twitter</x>
</div> </div>
<input id="twitter" type="checkbox"> <input id="twitter" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/instagram-icon.png"> <div>
<x data-localise="__MSG_instagram__">instagram</x> <img src="../../../assets/images/instagram-icon.png">
<x data-localise="__MSG_instagram__">Instagram</x>
</div> </div>
<input id="instagram" type="checkbox"> <input id="instagram" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/tiktok-icon.png"> <div>
<x data-localise="__MSG_tiktok__">tiktok</x> <img src="../../../assets/images/tiktok-icon.png">
<x data-localise="__MSG_tiktok__">TikTok</x>
</div> </div>
<input id="tiktok" type="checkbox"> <input id="tiktok" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/reddit-icon.png"> <div>
<x data-localise="__MSG_reddit__">reddit</x> <img src="../../../assets/images/reddit-icon.png">
<x data-localise="__MSG_reddit__">Reddit</x>
</div> </div>
<input id="reddit" type="checkbox"> <input id="reddit" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/imgur-icon.png"> <div>
<x data-localise="__MSG_imgur__">imgur</x> <img src="../../../assets/images/imgur-icon.png">
<x data-localise="__MSG_imgur__">Imgur</x>
</div> </div>
<input id="imgur" type="checkbox"> <input id="imgur" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/wikipedia-icon.svg"> <div>
<x data-localise="__MSG_wikipedia__">wikipedia</x> <img src="../../../assets/images/wikipedia-icon.svg">
<x data-localise="__MSG_wikipedia__">Wikipedia</x>
</div> </div>
<input id="wikipedia" type="checkbox"> <input id="wikipedia" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/medium-icon.svgMono"> <div>
<x data-localise="__MSG_medium__">medium</x> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor">
<circle cx="500" cy="500" r="500"></circle>
<ellipse ry="475" rx="250" cy="501" cx="1296"></ellipse>
<ellipse cx="1682" cy="502" rx="88" ry="424"></ellipse>
</svg>
<x data-localise="__MSG_medium__">Medium</x>
</div> </div>
<input id="medium" type="checkbox"> <input id="medium" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/quora-icon.png"> <div>
<x data-localise="__MSG_quora__">quora</x> <img src="../../../assets/images/quora-icon.png">
<x data-localise="__MSG_quora__">Quora</x>
</div> </div>
<input id="quora" type="checkbox"> <input id="quora" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/imdb-icon.svg"> <div>
<x data-localise="__MSG_imdb__">imdb</x> <img src="../../../assets/images/imdb-icon.svg">
<x data-localise="__MSG_imdb__">IMDb</x>
</div> </div>
<input id="imdb" type="checkbox"> <input id="imdb" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/reuters-icon.svg"> <div>
<x data-localise="__MSG_reuters__">reuters</x> <img src="../../../assets/images/reuters-icon.svg">
<x data-localise="__MSG_reuters__">Reuters</x>
</div> </div>
<input id="reuters" type="checkbox"> <input id="reuters" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/peertube-icon.svg"> <div>
<x data-localise="__MSG_peertube__">peertube</x> <img src="../../../assets/images/peertube-icon.svg">
<x data-localise="__MSG_peertube__">PeerTube</x>
</div> </div>
<input id="peertube" type="checkbox"> <input id="peertube" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/lbry-icon.png"> <div>
<x data-localise="__MSG_lbry__">lbry</x> <img src="../../../assets/images/lbry-icon.png">
<x data-localise="__MSG_lbry__">LBRY</x>
</div> </div>
<input id="lbry" type="checkbox"> <input id="lbry" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/search-icon.svgMono"> <div>
<x data-localise="__MSG_search__">search</x> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
</svg>
<x data-localise="__MSG_search__">Search</x>
</div> </div>
<input id="search" type="checkbox"> <input id="search" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/translate-icon.svgMono"> <div>
<x data-localise="__MSG_translate__">translate</x> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path>
</svg>
<x data-localise="__MSG_translate__">Translate</x>
</div> </div>
<input id="translate" type="checkbox"> <input id="translate" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/maps-icon.svgMono"> <div>
<x data-localise="__MSG_maps__">maps</x> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path>
</svg>
<x data-localise="__MSG_maps__">Maps</x>
</div> </div>
<input id="maps" type="checkbox"> <input id="maps" type="checkbox">
</div> </div>
<div> <div>
<div><img src="../../../assets/images/sendTargets-icon.svgMono"> <div>
<x data-localise="__MSG_sendTargets__">sendTargets</x> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path>
</svg>
<x data-localise="__MSG_sendTargets__">Send Files</x>
</div> </div>
<input id="sendTargets" type="checkbox"> <input id="sendTargets" type="checkbox">
</div> </div>

View File

@ -86,8 +86,13 @@
<div class="checklist-popup" id="popup-frontends-checklist"> <div class="checklist-popup" id="popup-frontends-checklist">
<% for (const service in config.services) { -%> <% for (const service in config.services) { -%>
<div> <div>
<div><img src="../../../assets/images/<%= service %>-icon.<%= config.services[service].imageType %>"> <div>
<x data-localise="__MSG_<%= service %>__"><%= service %></x> <% if (config.services[service].imageType != "svgMono") { _%>
<img src="../../../assets/images/<%= service %>-icon.<%= config.services[service].imageType %>">
<% } else { _%>
<%- include ('src/assets/images/' + service + '-icon.svg') %>
<% } _%>
<x data-localise="__MSG_<%= service %>__"><%= config.services[service].name %></x>
</div> </div>
<input id="<%= service %>" type="checkbox"> <input id="<%= service %>" type="checkbox">
</div> </div>

View File

@ -77,22 +77,22 @@ browser.storage.local.get("popupFrontends", r => {
currSite.getElementsByClassName(frontend)[0].classList.add("hide") currSite.getElementsByClassName(frontend)[0].classList.add("hide")
} }
await getEnabled()
let url let url
try { try {
url = new URL(tabs[0].url) url = new URL(tabs[0].url)
console.log(url.href)
} catch { } catch {
currentSiteIsFrontend.classList.add("hide") currentSiteIsFrontend.classList.add("hide")
document.getElementById("unify_div").style.display = "none"
return return
} }
await getEnabled()
const currentService = serviceHelper.computeService(url) const currentService = serviceHelper.computeService(url)
if (currentService != null) { if (currentService != null) {
divs[currentService].current.classList.remove("hide") divs[currentService].current.classList.remove("hide")
divs[currentService].all.classList.add("hide") divs[currentService].all.classList.add("hide")
if (config.services[currentService].preferences != {}) { if (config.services[currentService].preferences != undefined) {
const unify = document.getElementById("unify") const unify = document.getElementById("unify")
const textElement = document.getElementById("unify").getElementsByTagName("h4")[0] const textElement = document.getElementById("unify").getElementsByTagName("h4")[0]
unify.addEventListener("click", () => { unify.addEventListener("click", () => {