Squashed a few bugs
Closes https://github.com/libredirect/libredirect/issues/392
This commit is contained in:
parent
ccfcccd53e
commit
a43f0a7e7f
|
@ -530,7 +530,7 @@ function switchInstance(url, disableOverride) {
|
|||
...librexLokiCustomRedirects
|
||||
].includes(protocolHost)) { resolve(); return; }
|
||||
|
||||
let instancesList;
|
||||
let instancesList = [];
|
||||
|
||||
if (protocol == 'loki') {
|
||||
if (searchFrontend == 'searx') instancesList = [...searxLokiCustomRedirects];
|
||||
|
|
|
@ -140,7 +140,7 @@ function init() {
|
|||
pipedMaterialNormalCustomRedirects = r.pipedMaterialNormalCustomRedirects;
|
||||
pipedMaterialTorRedirectsChecks = r.pipedMaterialTorRedirectsChecks;
|
||||
pipedMaterialTorCustomRedirects = r.pipedMaterialTorCustomRedirects;
|
||||
pipedMaterialI2pCustomRedirects - r.pipedMaterialI2pCustomRedirects;
|
||||
pipedMaterialI2pCustomRedirects = r.pipedMaterialI2pCustomRedirects;
|
||||
pipedMaterialLokiCustomRedirects = r.pipedMaterialLokiCustomRedirects;
|
||||
resolve();
|
||||
}
|
||||
|
@ -198,6 +198,7 @@ function redirect(url, type, initiator, disableOverride) {
|
|||
const main_frame = type === "main_frame";
|
||||
const sub_frame = type === "sub_frame";
|
||||
|
||||
if (!sub_frame && !main_frame) return;
|
||||
if (url.pathname.match(/iframe_api/) || url.pathname.match(/www-widgetapi/)) return; // Don't redirect YouTube Player API.
|
||||
if (onlyEmbeddedVideo == 'onlyEmbedded' && main_frame) return;
|
||||
if (onlyEmbeddedVideo == 'onlyNotEmbedded' && !main_frame) return;
|
||||
|
|
|
@ -87,6 +87,7 @@ youtube.addEventListener("change", () => {
|
|||
browser.storage.local.set({
|
||||
disableYoutube: !enable.checked,
|
||||
youtubeEmbedFrontend: youtubeEmbedFrontend.value,
|
||||
youtubeFrontend: frontend.value,
|
||||
onlyEmbeddedVideo: onlyEmbeddedVideo.value
|
||||
})
|
||||
changeFrontendsSettings();
|
||||
|
|
|
@ -97,7 +97,9 @@
|
|||
<h4 data-localise="__MSG_sendFiles__">Send Files</h4></a>
|
||||
<input class="disable-sendTargets" type="checkbox"/>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="current_site_divider">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="all_sites">
|
||||
<div class="youtube some-block"><a class="title" href="https://youtube.com"><img src="../../assets/images/youtube-icon.png"/>
|
||||
|
|
|
@ -110,6 +110,8 @@ const disableImgurAllSites = allSites.getElementsByClassName("disable-imgur")[0]
|
|||
const disableTiktokCurrentSite = currSite.getElementsByClassName("disable-tiktok")[0];
|
||||
const disableTiktokAllSites = allSites.getElementsByClassName("disable-tiktok")[0];
|
||||
|
||||
const currentSiteIsFrontend = document.getElementById('current_site_divider')
|
||||
|
||||
browser.storage.local.get(
|
||||
[
|
||||
"disableTwitter",
|
||||
|
@ -154,16 +156,19 @@ browser.storage.local.get(
|
|||
|
||||
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
|
||||
for (const frontend of generalHelper.allPopupFrontends) {
|
||||
if (!r.popupFrontends.includes(frontend))
|
||||
if (!r.popupFrontends.includes(frontend))
|
||||
allSites.getElementsByClassName(frontend)[0].classList.add("hide")
|
||||
else
|
||||
allSites.getElementsByClassName(frontend)[0].classList.remove("hide")
|
||||
currSite.getElementsByClassName(frontend)[0].classList.add("hide")
|
||||
currSite.getElementsByClassName(frontend)[0].classList.add("hide")
|
||||
}
|
||||
|
||||
let url;
|
||||
try { url = new URL(tabs[0].url); }
|
||||
catch { return; }
|
||||
catch {
|
||||
currentSiteIsFrontend.classList.add("hide")
|
||||
return;
|
||||
}
|
||||
|
||||
if (youtubeHelper.redirect(url, 'main_frame', false, true) || await youtubeHelper.switchInstance(url, 'main_frame', false, true)) {
|
||||
currSite.getElementsByClassName('youtube')[0].classList.remove("hide");
|
||||
|
@ -236,6 +241,9 @@ browser.storage.local.get(
|
|||
else if (youtubeMusicHelper.redirect(url, 'main_frame', false, true)) {
|
||||
currSite.getElementsByClassName('youtubeMusic')[0].classList.remove("hide");
|
||||
allSites.getElementsByClassName('youtubeMusic')[0].classList.add("hide");
|
||||
} else {
|
||||
currentSiteIsFrontend.classList.add("hide")
|
||||
console.log("This page is not an instance")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -119,7 +119,8 @@ html(lang="en")
|
|||
body(dir="auto")
|
||||
.current_site
|
||||
+services
|
||||
hr
|
||||
#current_site_divider
|
||||
hr
|
||||
.all_sites
|
||||
+services
|
||||
hr
|
||||
|
@ -151,4 +152,4 @@ html(lang="en")
|
|||
.space
|
||||
|
||||
script(type="module" src="../options/init.js")
|
||||
script(type="module" src="./popup.js")
|
||||
script(type="module" src="./popup.js")
|
||||
|
|
|
@ -20,4 +20,4 @@ html, body {
|
|||
|
||||
.space {
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue