Made most redirects work as expected
This commit is contained in:
parent
f87eb20cee
commit
df5e7f9b07
|
@ -27,19 +27,19 @@ function init() {
|
|||
})
|
||||
for (const service in config.services) {
|
||||
options[service] = {}
|
||||
browser.storage.local.get([`${utils.camelCase(service)}Enable`, `${service}RedirectType`, `${service}Frontend`], r => {
|
||||
options[service].enabled = r[utils.camelCase(service) + "Enable"]
|
||||
browser.storage.local.get([`${service}Enabled`, `${service}RedirectType`, `${service}Frontend`], r => {
|
||||
options[service].enabled = r[service + "Enabled"]
|
||||
options[service].frontend = r[service + "Frontend"]
|
||||
options[service].redirectType = r[service + "RedirectType"]
|
||||
})
|
||||
for (const frontend in config.services[service].frontends) {
|
||||
options[frontend] = {}
|
||||
options[frontend].checks = []
|
||||
options[frontend].custom = []
|
||||
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 => {
|
||||
options[frontend].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"]
|
||||
options[frontend].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"]
|
||||
options[frontend][network].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"]
|
||||
options[frontend][network].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,22 @@ function all(service) {
|
|||
for (const network in config.networks) {
|
||||
tmp.push(...redirects[frontend][network])
|
||||
}
|
||||
}
|
||||
} else if (config.services[service].frontends[frontend].singleInstance != undefined) tmp.push(config.services[service].frontends[frontend].singleInstance)
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
function regexArray(service, url) {
|
||||
for (const targetString in config.services[service].targets) {
|
||||
const target = new RegExp(config.services[service].targets[targetString])
|
||||
let targets
|
||||
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
|
||||
}
|
||||
return false
|
||||
|
@ -76,32 +84,30 @@ function redirect(url, type, initiator) {
|
|||
let randomInstance
|
||||
let frontend
|
||||
let network = options.network
|
||||
let networkFallback = options.networkFallback
|
||||
let redirectType
|
||||
if (url.pathname == "/") return
|
||||
for (const service in config.services) {
|
||||
if (!options[service].enabled) continue
|
||||
let targets = config.services[service].targets
|
||||
if (targets == "datajson") {
|
||||
browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"]))
|
||||
}
|
||||
if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue
|
||||
if (!config.services[service].embeddable && type != "main_frame") continue
|
||||
let targets = new RegExp(config.services[service].targets.join("|"), "i")
|
||||
|
||||
if (initiator && (all(service).includes(initiator.origin) || targets.includes(initiator.host))) continue
|
||||
if (!targets.some(rx => rx.test(url.href))) continue
|
||||
if (type != redirectType && type != "both") continue
|
||||
if (initiator && (all(service).includes(initiator.origin) || targets.test(initiator.host))) continue
|
||||
if (!regexArray(service, url)) continue
|
||||
|
||||
if (Object.keys(config.services[service].frontends).length > 1) {
|
||||
frontend = options[service].frontend
|
||||
redirectType = options[service].redirectType
|
||||
|
||||
// browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"]))
|
||||
} else {
|
||||
frontend = Object.keys(config.services[service].frontends)[0]
|
||||
}
|
||||
|
||||
if (config.services[service].frontends[frontend].instanceList) {
|
||||
let instanceList = [...[frontend + utils.camelCase(network) + "RedirectsChecks"], ...[frontend + utils.camelCase(network) + "CustomRedirects"]]
|
||||
if (instanceList.length === 0 && networkFallback) instanceList = [...[frontend + "ClearnetRedirectsChecks"], ...[frontend + "ClearnetCustomRedirects"]]
|
||||
if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return
|
||||
let instanceList = [...options[frontend][network].checks, ...options[frontend][network].custom]
|
||||
if (instanceList.length === 0 && options.networkFallback) instanceList = [...options[frontend].clearnet.checks, ...options[frontend].clearnet.custom]
|
||||
if (instanceList.length === 0) return
|
||||
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.
|
||||
// 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 placeRegex = /\/place\/(.*)\//
|
||||
function convertMapCentre() {
|
||||
let [, lat, lon, zoom] = 0
|
||||
let [lat, lon, zoom] = [null, null, null]
|
||||
if (url.pathname.match(mapCentreRegex)) {
|
||||
// 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")) {
|
||||
;[lat, lon] = url.searchParams.get("center").split(",")
|
||||
zoom = url.searchParams.get("zoom") ?? "17"
|
||||
|
@ -149,7 +155,7 @@ function redirect(url, type, initiator) {
|
|||
case "whoogle":
|
||||
return `${randomInstance}/search${encodeURIComponent(url.searchParams.get("q"))}`
|
||||
case "librex":
|
||||
return `${randomInstance}/search.php${encodeURIComponent(url.searchParams.get("q"))}`
|
||||
return `${randomInstance}/search.php?q=${encodeURIComponent(url.searchParams.get("q"))}`
|
||||
case "send":
|
||||
return randomInstance
|
||||
case "nitter":
|
||||
|
@ -168,7 +174,7 @@ function redirect(url, type, initiator) {
|
|||
return `${randomInstance}/${url.search}`
|
||||
case "osm": {
|
||||
if (initiator && initiator.host === "earth.google.com") return
|
||||
travelModes = {
|
||||
const travelModes = {
|
||||
driving: "fossgis_osrm_car",
|
||||
walking: "fossgis_osrm_foot",
|
||||
bicycling: "fossgis_osrm_bike",
|
||||
|
@ -227,10 +233,8 @@ function redirect(url, type, initiator) {
|
|||
let orgVal = url.searchParams.get("origin")
|
||||
let destVal = url.searchParams.get("destination")
|
||||
|
||||
let org
|
||||
addressToLatLng(orgVal, a => (org = a))
|
||||
let dest
|
||||
addressToLatLng(destVal, a => (dest = a))
|
||||
let org = addressToLatLng(orgVal)
|
||||
let dest = addressToLatLng(destVal)
|
||||
prefs.route = `${org};${dest}`
|
||||
|
||||
let prefsEncoded = new URLSearchParams(prefs).toString()
|
||||
|
@ -280,7 +284,7 @@ function redirect(url, type, initiator) {
|
|||
}
|
||||
case "facil": {
|
||||
if (initiator && initiator.host === "earth.google.com") return
|
||||
let travelModes = {
|
||||
const travelModes = {
|
||||
driving: "car",
|
||||
walking: "pedestrian",
|
||||
bicycling: "bicycle",
|
||||
|
@ -443,17 +447,12 @@ function initDefaults() {
|
|||
|
||||
function computeService(url) {
|
||||
for (const service in config.services) {
|
||||
const regex = config.services[service].targets
|
||||
console.log(regex)
|
||||
if (regexArray(service, url)) {
|
||||
console.log(service + "gi")
|
||||
return service
|
||||
} else if (all(service).includes(utils.protocolHost(url))) {
|
||||
console.log(service)
|
||||
return service
|
||||
}
|
||||
}
|
||||
console.log("moment")
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
@ -85,9 +85,8 @@
|
|||
"instanceList": false
|
||||
}
|
||||
},
|
||||
"singleInstanceFrontends": ["freetube", "yatte"],
|
||||
"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}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*",
|
||||
"^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*",
|
||||
|
@ -253,7 +252,6 @@
|
|||
"imgur": {
|
||||
"frontends": {
|
||||
"rimgo": {
|
||||
"preferences": {},
|
||||
"name": "rimgo",
|
||||
"instanceList": true
|
||||
}
|
||||
|
@ -285,7 +283,6 @@
|
|||
"medium": {
|
||||
"frontends": {
|
||||
"scribe": {
|
||||
"preferences": {},
|
||||
"name": "Scribe",
|
||||
"instanceList": true
|
||||
}
|
||||
|
@ -301,14 +298,14 @@
|
|||
"^psiloveyou\\.xyz",
|
||||
"^entrepreneurshandbook\\.co",
|
||||
"^blog\\.coinbase\\.com",
|
||||
"^levelup\\.gitconnected\\.com ",
|
||||
"^javascript\\.plainenglish\\.io ",
|
||||
"^blog\\.bitsrc\\.io ",
|
||||
"^itnext\\.io ",
|
||||
"^codeburst\\.io ",
|
||||
"^infosecwriteups\\.com ",
|
||||
"^blog\\.devgenius\\.io ",
|
||||
"^writingcooperative\\.com "
|
||||
"^levelup\\.gitconnected\\.com",
|
||||
"^javascript\\.plainenglish\\.io",
|
||||
"^blog\\.bitsrc\\.io",
|
||||
"^itnext\\.io",
|
||||
"^codeburst\\.io",
|
||||
"^infosecwriteups\\.com",
|
||||
"^blog\\.devgenius\\.io",
|
||||
"^writingcooperative\\.com"
|
||||
],
|
||||
"name": "Medium",
|
||||
"options": { "enabled": true },
|
||||
|
@ -353,7 +350,6 @@
|
|||
"reuters": {
|
||||
"frontends": {
|
||||
"neuters": {
|
||||
"preferences": {},
|
||||
"name": "Neuters",
|
||||
"instanceList": true
|
||||
}
|
||||
|
@ -368,7 +364,6 @@
|
|||
"peertube": {
|
||||
"frontends": {
|
||||
"simpleertube": {
|
||||
"preferences": {},
|
||||
"name": "SimpleerTube",
|
||||
"instanceList": true
|
||||
}
|
||||
|
@ -464,13 +459,12 @@
|
|||
"instanceList": true
|
||||
},
|
||||
"whoogle": {
|
||||
"preferences": {},
|
||||
"name": "Whoogle",
|
||||
"instanceList": true
|
||||
},
|
||||
"librex": {
|
||||
"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",
|
||||
"instanceList": true
|
||||
|
@ -516,13 +510,13 @@
|
|||
"maps": {
|
||||
"frontends": {
|
||||
"facil": {
|
||||
"preferences": {},
|
||||
"name": "FacilMap",
|
||||
"instanceList": true
|
||||
},
|
||||
"osm": {
|
||||
"name": "OpenStreetMap",
|
||||
"instanceList": false
|
||||
"instanceList": false,
|
||||
"singleInstance": "https://www.openstreetmap.org"
|
||||
}
|
||||
},
|
||||
"targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"],
|
||||
|
@ -538,7 +532,6 @@
|
|||
"sendTargets": {
|
||||
"frontends": {
|
||||
"send": {
|
||||
"preferences": {},
|
||||
"name": "Send",
|
||||
"instanceList": "true"
|
||||
}
|
||||
|
|
|
@ -180,110 +180,145 @@
|
|||
</div>
|
||||
<div class="checklist-popup" id="popup-frontends-checklist">
|
||||
<div>
|
||||
<div><img src="../../../assets/images/youtube-icon.png">
|
||||
<x data-localise="__MSG_youtube__">youtube</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/youtube-icon.png">
|
||||
<x data-localise="__MSG_youtube__">Youtube</x>
|
||||
</div>
|
||||
<input id="youtube" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/youtubeMusic-icon.png">
|
||||
<x data-localise="__MSG_youtubeMusic__">youtubeMusic</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/youtubeMusic-icon.png">
|
||||
<x data-localise="__MSG_youtubeMusic__">YT Music</x>
|
||||
</div>
|
||||
<input id="youtubeMusic" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/twitter-icon.png">
|
||||
<x data-localise="__MSG_twitter__">twitter</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/twitter-icon.png">
|
||||
<x data-localise="__MSG_twitter__">Twitter</x>
|
||||
</div>
|
||||
<input id="twitter" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/instagram-icon.png">
|
||||
<x data-localise="__MSG_instagram__">instagram</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/instagram-icon.png">
|
||||
<x data-localise="__MSG_instagram__">Instagram</x>
|
||||
</div>
|
||||
<input id="instagram" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/tiktok-icon.png">
|
||||
<x data-localise="__MSG_tiktok__">tiktok</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/tiktok-icon.png">
|
||||
<x data-localise="__MSG_tiktok__">TikTok</x>
|
||||
</div>
|
||||
<input id="tiktok" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/reddit-icon.png">
|
||||
<x data-localise="__MSG_reddit__">reddit</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/reddit-icon.png">
|
||||
<x data-localise="__MSG_reddit__">Reddit</x>
|
||||
</div>
|
||||
<input id="reddit" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/imgur-icon.png">
|
||||
<x data-localise="__MSG_imgur__">imgur</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/imgur-icon.png">
|
||||
<x data-localise="__MSG_imgur__">Imgur</x>
|
||||
</div>
|
||||
<input id="imgur" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/wikipedia-icon.svg">
|
||||
<x data-localise="__MSG_wikipedia__">wikipedia</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/wikipedia-icon.svg">
|
||||
<x data-localise="__MSG_wikipedia__">Wikipedia</x>
|
||||
</div>
|
||||
<input id="wikipedia" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/medium-icon.svgMono">
|
||||
<x data-localise="__MSG_medium__">medium</x>
|
||||
<div>
|
||||
<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>
|
||||
<input id="medium" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/quora-icon.png">
|
||||
<x data-localise="__MSG_quora__">quora</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/quora-icon.png">
|
||||
<x data-localise="__MSG_quora__">Quora</x>
|
||||
</div>
|
||||
<input id="quora" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/imdb-icon.svg">
|
||||
<x data-localise="__MSG_imdb__">imdb</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/imdb-icon.svg">
|
||||
<x data-localise="__MSG_imdb__">IMDb</x>
|
||||
</div>
|
||||
<input id="imdb" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/reuters-icon.svg">
|
||||
<x data-localise="__MSG_reuters__">reuters</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/reuters-icon.svg">
|
||||
<x data-localise="__MSG_reuters__">Reuters</x>
|
||||
</div>
|
||||
<input id="reuters" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/peertube-icon.svg">
|
||||
<x data-localise="__MSG_peertube__">peertube</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/peertube-icon.svg">
|
||||
<x data-localise="__MSG_peertube__">PeerTube</x>
|
||||
</div>
|
||||
<input id="peertube" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/lbry-icon.png">
|
||||
<x data-localise="__MSG_lbry__">lbry</x>
|
||||
<div>
|
||||
<img src="../../../assets/images/lbry-icon.png">
|
||||
<x data-localise="__MSG_lbry__">LBRY</x>
|
||||
</div>
|
||||
<input id="lbry" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/search-icon.svgMono">
|
||||
<x data-localise="__MSG_search__">search</x>
|
||||
<div>
|
||||
<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>
|
||||
<input id="search" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/translate-icon.svgMono">
|
||||
<x data-localise="__MSG_translate__">translate</x>
|
||||
<div>
|
||||
<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>
|
||||
<input id="translate" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/maps-icon.svgMono">
|
||||
<x data-localise="__MSG_maps__">maps</x>
|
||||
<div>
|
||||
<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>
|
||||
<input id="maps" type="checkbox">
|
||||
</div>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/sendTargets-icon.svgMono">
|
||||
<x data-localise="__MSG_sendTargets__">sendTargets</x>
|
||||
<div>
|
||||
<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>
|
||||
<input id="sendTargets" type="checkbox">
|
||||
</div>
|
||||
|
|
|
@ -86,8 +86,13 @@
|
|||
<div class="checklist-popup" id="popup-frontends-checklist">
|
||||
<% for (const service in config.services) { -%>
|
||||
<div>
|
||||
<div><img src="../../../assets/images/<%= service %>-icon.<%= config.services[service].imageType %>">
|
||||
<x data-localise="__MSG_<%= service %>__"><%= service %></x>
|
||||
<div>
|
||||
<% 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>
|
||||
<input id="<%= service %>" type="checkbox">
|
||||
</div>
|
||||
|
|
|
@ -77,22 +77,22 @@ browser.storage.local.get("popupFrontends", r => {
|
|||
currSite.getElementsByClassName(frontend)[0].classList.add("hide")
|
||||
}
|
||||
|
||||
await getEnabled()
|
||||
|
||||
let url
|
||||
try {
|
||||
url = new URL(tabs[0].url)
|
||||
console.log(url.href)
|
||||
} catch {
|
||||
currentSiteIsFrontend.classList.add("hide")
|
||||
document.getElementById("unify_div").style.display = "none"
|
||||
return
|
||||
}
|
||||
|
||||
await getEnabled()
|
||||
|
||||
const currentService = serviceHelper.computeService(url)
|
||||
if (currentService != null) {
|
||||
divs[currentService].current.classList.remove("hide")
|
||||
divs[currentService].all.classList.add("hide")
|
||||
if (config.services[currentService].preferences != {}) {
|
||||
if (config.services[currentService].preferences != undefined) {
|
||||
const unify = document.getElementById("unify")
|
||||
const textElement = document.getElementById("unify").getElementsByTagName("h4")[0]
|
||||
unify.addEventListener("click", () => {
|
||||
|
|
Loading…
Reference in New Issue