Added a button for enabling cookies #104
This commit is contained in:
parent
2b53e6c59f
commit
fbbc82d0f2
|
@ -153,23 +153,22 @@ export async function invidiousInit() {
|
|||
"invidiousSavePlayerPos",
|
||||
],
|
||||
r => {
|
||||
invidiousQuality = r.invidiousQuality ?? 'DEFAULT';
|
||||
invidiousAlwaysProxy = r.invidiousAlwaysProxy ?? 'DEFAULT';
|
||||
invidiousPlayerStyle = r.invidiousPlayerStyle ?? 'DEFAULT';
|
||||
invidiousVideoLoop = r.invidiousVideoLoop ?? 'DEFAULT';
|
||||
invidiousContinueAutoplay = r.invidiousContinueAutoplay ?? 'DEFAULT';
|
||||
invidiousContinue = r.invidiousContinue ?? 'DEFAULT';
|
||||
invidiousListen = r.invidiousListen ?? 'DEFAULT';
|
||||
invidiousSpeed = r.invidiousSpeed ?? 'DEFAULT';
|
||||
invidiousQualityDash = r.invidiousQualityDash ?? 'DEFAULT';
|
||||
invidiousComments = r.invidiousComments ?? ['DEFAULT', 'DEFAULT'];
|
||||
invidiousCaptions = r.invidiousCaptions ?? ['DEFAULT', 'DEFAULT', 'DEFAULT'];
|
||||
invidiousRelatedVideos = r.invidiousRelatedVideos ?? 'DEFAULT';
|
||||
invidiousAnnotations = r.invidiousAnnotations ?? 'DEFAULT';
|
||||
invidiousExtendDesc = r.invidiousExtendDesc ?? 'DEFAULT';
|
||||
invidiousVrMode = r.invidiousVrMode ?? 'DEFAULT';
|
||||
invidiousSavePlayerPos = r.invidiousSavePlayerPos ?? 'DEFAULT';
|
||||
|
||||
invidiousVideoLoop = r.invidiousVideoLoop ?? false;
|
||||
invidiousAlwaysProxy = r.invidiousAlwaysProxy ?? false;
|
||||
invidiousPlayerStyle = r.invidiousPlayerStyle ?? 'invidious';
|
||||
invidiousQuality = r.invidiousQuality ?? 'hd720';
|
||||
invidiousContinueAutoplay = r.invidiousContinueAutoplay ?? true;
|
||||
invidiousContinue = r.invidiousContinue ?? false;
|
||||
invidiousListen = r.invidiousListen ?? false;
|
||||
invidiousSpeed = r.invidiousSpeed ?? '1.0';
|
||||
invidiousQualityDash = r.invidiousQualityDash ?? 'auto';
|
||||
invidiousComments = r.invidiousComments ?? ['youtube', ''];
|
||||
invidiousCaptions = r.invidiousCaptions ?? ['', '', ''];
|
||||
invidiousRelatedVideos = r.invidiousRelatedVideos ?? true;
|
||||
invidiousAnnotations = r.invidiousAnnotations ?? false;
|
||||
invidiousExtendDesc = r.invidiousExtendDesc ?? false;
|
||||
invidiousVrMode = r.invidiousVrMode ?? true;
|
||||
invidiousSavePlayerPos = r.invidiousSavePlayerPos ?? false;
|
||||
|
||||
resolve();
|
||||
}
|
||||
|
|
|
@ -3,37 +3,16 @@ window.browser = window.browser || window.chrome;
|
|||
browser.storage.local.get(
|
||||
[
|
||||
"theme",
|
||||
"applyThemeToSites",
|
||||
|
||||
"youtubeVolume",
|
||||
"youtubeAutoplay"
|
||||
],
|
||||
r => {
|
||||
let applyThemeToSites = r.applyThemeToSites ?? false;
|
||||
let theme = r.theme ?? "dark";
|
||||
let youtubeAutoplay = r.youtubeAutoplay ?? false;
|
||||
let youtubeVolume = r.youtubeVolume ?? 100;
|
||||
|
||||
if (
|
||||
applyThemeToSites &&
|
||||
r.theme != "DEFAULT" &&
|
||||
localStorage.getItem("theme") != r.theme
|
||||
)
|
||||
localStorage.setItem("theme", r.theme);
|
||||
|
||||
if (
|
||||
r.youtubeVolume != "--" &&
|
||||
localStorage.getItem("volume") != r.youtubeVolume
|
||||
)
|
||||
localStorage.setItem("volume", r.youtubeVolume / 100);
|
||||
|
||||
if (
|
||||
r.youtubeAutoplay != "DEFAULT" &&
|
||||
localStorage.getItem("playerAutoPlay") != r.youtubeAutoplay
|
||||
)
|
||||
localStorage.setItem("playerAutoPlay", r.youtubeAutoplay);
|
||||
localStorage.setItem("theme", theme);
|
||||
localStorage.setItem("volume", youtubeVolume / 100);
|
||||
localStorage.setItem("playerAutoPlay", youtubeAutoplay);
|
||||
}
|
||||
)
|
||||
|
||||
window.onunload = () => {
|
||||
localStorage.removeItem("theme");
|
||||
localStorage.removeItem("volume");
|
||||
localStorage.removeItem("playerAutoPlay");
|
||||
};
|
||||
)
|
|
@ -3,23 +3,22 @@ window.browser = window.browser || window.chrome;
|
|||
browser.storage.local.get(
|
||||
[
|
||||
"theme",
|
||||
"applyThemeToSites",
|
||||
"youtubeVolume",
|
||||
"youtubeAutoplay",
|
||||
],
|
||||
r => {
|
||||
let applyThemeToSites = r.applyThemeToSites ?? false;
|
||||
let theme = r.theme ?? "DEFAULT";
|
||||
let youtubeAutoplay = r.youtubeAutoplay ?? "DEFAULT";
|
||||
let theme = r.theme ?? "dark";
|
||||
let youtubeAutoplay = r.youtubeAutoplay ?? false;
|
||||
let youtubeVolume = r.youtubeVolume ?? 100;
|
||||
|
||||
let prefs = {};
|
||||
if (localStorage.getItem("PREFERENCES")) prefs = JSON.parse(localStorage.getItem("PREFERENCES"));
|
||||
|
||||
if (applyThemeToSites && theme == 'dark') prefs.darkMode = true;
|
||||
if (applyThemeToSites && theme == 'light') prefs.darkMode = false;
|
||||
if (theme == 'dark') prefs.darkMode = true;
|
||||
if (theme == 'light') prefs.darkMode = false;
|
||||
|
||||
if (youtubeAutoplay != "DEFAULT") prefs.playerAutoplay = youtubeAutoplay == 'true';
|
||||
|
||||
console.log("prefs", JSON.stringify(prefs));
|
||||
prefs.playerAutoplay = youtubeAutoplay == 'true';
|
||||
prefs.volume = youtubeVolume / 100;
|
||||
|
||||
localStorage.setItem("PREFERENCES", JSON.stringify(prefs));
|
||||
}
|
||||
|
|
|
@ -247,6 +247,14 @@ function setDisable(val) {
|
|||
console.log("disableYoutube: ", disable)
|
||||
}
|
||||
|
||||
let enableCustomSettings;
|
||||
const getEnableCustomSettings = () => enableCustomSettings;
|
||||
function setEnableCustomSettings(val) {
|
||||
enableCustomSettings = val;
|
||||
browser.storage.local.set({ enableYoutubeCustomSettings: enableCustomSettings })
|
||||
console.log("enableYoutubeCustomSettings: ", enableCustomSettings)
|
||||
}
|
||||
|
||||
let protocol;
|
||||
const getProtocol = () => protocol;
|
||||
function setProtocol(val) {
|
||||
|
@ -554,23 +562,25 @@ function isPipedorInvidious(url, type, frontend) {
|
|||
}
|
||||
|
||||
function initPipedLocalStorage(tabId) {
|
||||
browser.tabs.executeScript(
|
||||
tabId,
|
||||
{
|
||||
file: "/assets/javascripts/helpers/youtube/piped-preferences.js",
|
||||
runAt: "document_start"
|
||||
}
|
||||
);
|
||||
if (enableCustomSettings)
|
||||
browser.tabs.executeScript(
|
||||
tabId,
|
||||
{
|
||||
file: "/assets/javascripts/helpers/youtube/piped-preferences.js",
|
||||
runAt: "document_start"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initPipedMaterialLocalStorage(tabId) {
|
||||
browser.tabs.executeScript(
|
||||
tabId,
|
||||
{
|
||||
file: "/assets/javascripts/helpers/youtube/pipedMaterial-preferences.js",
|
||||
runAt: "document_start"
|
||||
}
|
||||
);
|
||||
if (enableCustomSettings)
|
||||
browser.tabs.executeScript(
|
||||
tabId,
|
||||
{
|
||||
file: "/assets/javascripts/helpers/youtube/pipedMaterial-preferences.js",
|
||||
runAt: "document_start"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initInvidiousCookies() {
|
||||
|
@ -582,64 +592,57 @@ function initInvidiousCookies() {
|
|||
...invidiousTorCustomRedirects,
|
||||
];
|
||||
|
||||
for (const instanceUrl of checkedInstances)
|
||||
browser.cookies.get(
|
||||
{
|
||||
url: instanceUrl,
|
||||
name: "PREFS",
|
||||
},
|
||||
cookie => {
|
||||
let prefs = {};
|
||||
if (cookie) {
|
||||
prefs = JSON.parse(decodeURIComponent(cookie.value));
|
||||
browser.cookies.remove({ url: instanceUrl, name: "PREFS" });
|
||||
}
|
||||
if (enableCustomSettings)
|
||||
for (const instanceUrl of checkedInstances)
|
||||
browser.cookies.get(
|
||||
{
|
||||
url: instanceUrl,
|
||||
name: "PREFS",
|
||||
},
|
||||
cookie => {
|
||||
let prefs = {};
|
||||
if (cookie) {
|
||||
prefs = JSON.parse(decodeURIComponent(cookie.value));
|
||||
browser.cookies.remove({ url: instanceUrl, name: "PREFS" });
|
||||
}
|
||||
|
||||
if (invidiousAlwaysProxy != "DEFAULT") prefs.local = invidiousAlwaysProxy == 'true';
|
||||
if (applyThemeToSites && theme != "DEFAULT") prefs.dark_mode = theme;
|
||||
if (invidiousVideoLoop != "DEFAULT") prefs.video_loop = invidiousVideoLoop == 'true';
|
||||
if (invidiousContinueAutoplay != "DEFAULT") prefs.continue_autoplay = invidiousContinueAutoplay == 'true';
|
||||
if (invidiousContinue != "DEFAULT") prefs.continue = invidiousContinue == 'true';
|
||||
if (invidiousListen != "DEFAULT") prefs.listen = invidiousListen == 'true';
|
||||
if (invidiousSpeed != "DEFAULT") prefs.speed = parseFloat(invidiousSpeed);
|
||||
if (invidiousQuality != "DEFAULT") prefs.quality = invidiousQuality;
|
||||
if (invidiousQualityDash != "DEFAULT") prefs.quality_dash = invidiousQualityDash;
|
||||
prefs.local = invidiousAlwaysProxy == 'true';
|
||||
prefs.dark_mode = theme;
|
||||
prefs.video_loop = invidiousVideoLoop == 'true';
|
||||
prefs.continue_autoplay = invidiousContinueAutoplay == 'true';
|
||||
prefs.continue = invidiousContinue == 'true';
|
||||
prefs.listen = invidiousListen == 'true';
|
||||
prefs.speed = parseFloat(invidiousSpeed);
|
||||
prefs.quality = invidiousQuality;
|
||||
prefs.quality_dash = invidiousQualityDash;
|
||||
|
||||
if (invidiousComments[0] != "DEFAULT" || invidiousComments[1] != "DEFAULT") prefs.comments = []
|
||||
prefs.comments = [];
|
||||
prefs.comments[0] = invidiousComments[0];
|
||||
prefs.comments[1] = invidiousComments[1];
|
||||
|
||||
if (invidiousComments[0] != "DEFAULT") prefs.comments[0] = invidiousComments[0];
|
||||
else if (invidiousComments[1] != "DEFAULT") prefs.comments[0] = ""
|
||||
if (invidiousComments[1] != "DEFAULT") prefs.comments[1] = invidiousComments[1];
|
||||
else if (invidiousComments[0] != "DEFAULT") prefs.comments[1] = ""
|
||||
|
||||
if (invidiousCaptions[0] != "DEFAULT" || invidiousCaptions[1] != "DEFAULT" || invidiousCaptions[2] != "DEFAULT") prefs.captions = [];
|
||||
prefs.captions = [];
|
||||
prefs.captions[0] = invidiousCaptions[0];
|
||||
prefs.captions[1] = invidiousCaptions[1];
|
||||
prefs.captions[2] = invidiousCaptions[2];
|
||||
|
||||
if (invidiousCaptions[0] != "DEFAULT") prefs.captions[0] = invidiousCaptions[0];
|
||||
else if (invidiousCaptions[1] != "DEFAULT" || invidiousCaptions[2] != "DEFAULT") prefs.captions[0] = "";
|
||||
prefs.related_videos = invidiousRelatedVideos == 'true';
|
||||
prefs.annotations = invidiousAnnotations == 'true'
|
||||
prefs.extend_desc = invidiousExtendDesc == 'true';
|
||||
prefs.vr_mode = invidiousVrMode == 'true';
|
||||
prefs.save_player_pos = invidiousSavePlayerPos == 'true';
|
||||
|
||||
if (invidiousCaptions[1] != "DEFAULT") prefs.captions[1] = invidiousCaptions[1];
|
||||
else if (invidiousCaptions[0] != "DEFAULT" || invidiousCaptions[2] != "DEFAULT") prefs.captions[1] = "";
|
||||
prefs.volume = parseInt(volume);
|
||||
prefs.player_style = invidiousPlayerStyle;
|
||||
prefs.autoplay = autoplay == 'true';
|
||||
|
||||
if (invidiousCaptions[2] != "DEFAULT") prefs.captions[2] = invidiousCaptions[2];
|
||||
else if (invidiousCaptions[0] != "DEFAULT" || invidiousCaptions[1] != "DEFAULT") prefs.captions[2] = "";
|
||||
|
||||
if (invidiousRelatedVideos != "DEFAULT") prefs.related_videos = invidiousRelatedVideos == 'true';
|
||||
if (invidiousAnnotations != "DEFAULT") prefs.annotations = invidiousAnnotations == 'true';
|
||||
if (invidiousExtendDesc != "DEFAULT") prefs.extend_desc = invidiousExtendDesc == 'true';
|
||||
if (invidiousVrMode != "DEFAULT") prefs.vr_mode = invidiousVrMode == 'true';
|
||||
if (invidiousSavePlayerPos != "DEFAULT") prefs.save_player_pos = invidiousSavePlayerPos == 'true';
|
||||
|
||||
if (volume != "--") prefs.volume = parseInt(volume);
|
||||
if (invidiousPlayerStyle != "DEFAULT") prefs.player_style = invidiousPlayerStyle;
|
||||
if (autoplay != "DEFAULT") prefs.autoplay = autoplay == 'true';
|
||||
|
||||
if (Object.entries(prefs).length !== 0)
|
||||
browser.cookies.set({
|
||||
url: instanceUrl,
|
||||
name: "PREFS",
|
||||
value: encodeURIComponent(JSON.stringify(prefs))
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
@ -651,8 +654,8 @@ async function init() {
|
|||
browser.storage.local.get(
|
||||
[
|
||||
"theme",
|
||||
"applyThemeToSites",
|
||||
"disableYoutube",
|
||||
"enableYoutubeCustomSettings",
|
||||
"OnlyEmbeddedVideo",
|
||||
"youtubeVolume",
|
||||
"youtubeAutoplay",
|
||||
|
@ -689,15 +692,15 @@ async function init() {
|
|||
if (r.youtubeRedirects) redirects = r.youtubeRedirects;
|
||||
|
||||
disable = r.disableYoutube ?? false;
|
||||
enableCustomSettings = r.enableYoutubeCustomSettings ?? false;
|
||||
protocol = r.youtubeProtocol ?? 'normal';
|
||||
frontend = r.youtubeFrontend ?? 'invidious';
|
||||
youtubeEmbedFrontend = r.youtubeEmbedFrontend ?? 'invidious';
|
||||
|
||||
theme = r.theme ?? 'DEFAULT';
|
||||
applyThemeToSites = r.applyThemeToSites ?? false;
|
||||
theme = r.theme ?? 'dark';
|
||||
|
||||
volume = r.youtubeVolume ?? '--';
|
||||
autoplay = r.youtubeAutoplay ?? 'DEFAULT';
|
||||
volume = r.youtubeVolume ?? 100;
|
||||
autoplay = r.youtubeAutoplay ?? false;
|
||||
|
||||
OnlyEmbeddedVideo = r.OnlyEmbeddedVideo ?? 'both';
|
||||
|
||||
|
@ -773,6 +776,9 @@ export default {
|
|||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getEnableCustomSettings,
|
||||
setEnableCustomSettings,
|
||||
|
||||
getProtocol,
|
||||
setProtocol,
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
|
||||
let invidiousAlwaysProxyElement = document.getElementById("invidious-local");
|
||||
invidiousAlwaysProxyElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousAlwaysProxy(event.target.options[invidiousAlwaysProxyElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousAlwaysProxy(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousPlayerStyleElement = document.getElementById("invidious-player_style");
|
||||
|
@ -18,22 +18,22 @@ invidiousQualityElement.addEventListener("change",
|
|||
|
||||
let invidiousVideoLoopElement = document.getElementById("invidious-video_loop");
|
||||
invidiousVideoLoopElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousVideoLoop(event.target.options[invidiousVideoLoopElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousVideoLoop(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousContinueAutoplayElement = document.getElementById("invidious-continue_autoplay");
|
||||
invidiousContinueAutoplayElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousContinueAutoplay(event.target.options[invidiousContinueAutoplayElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousContinueAutoplay(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousContinueElement = document.getElementById("invidious-continue");
|
||||
invidiousContinueElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousContinue(event.target.options[invidiousContinueElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousContinue(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousListenElement = document.getElementById("invidious-listen");
|
||||
invidiousListenElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousListen(event.target.options[invidiousListenElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousListen(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousSpeedElement = document.getElementById("invidious-speed");
|
||||
|
@ -90,28 +90,28 @@ invidiousCaptions2Element.addEventListener("change",
|
|||
|
||||
let invidiousRelatedVideoElement = document.getElementById("invidious-related_videos");
|
||||
invidiousRelatedVideoElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousRelatedVideos(event.target.options[invidiousRelatedVideoElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousRelatedVideos(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousAnnotationsElement = document.getElementById("invidious-annotations");
|
||||
invidiousAnnotationsElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousAnnotations(event.target.options[invidiousAnnotationsElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousAnnotations(event.target.checked)
|
||||
);
|
||||
|
||||
|
||||
let invidiousExtendDescElement = document.getElementById("invidious-extend_desc");
|
||||
invidiousExtendDescElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousExtendDesc(event.target.options[invidiousExtendDescElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousExtendDesc(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousVrModeElement = document.getElementById("invidious-vr_mode");
|
||||
invidiousVrModeElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousVrMode(event.target.options[invidiousVrModeElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousVrMode(event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousSavePlayerPosElement = document.getElementById("invidious-save_player_pos");
|
||||
invidiousSavePlayerPosElement.addEventListener("change",
|
||||
event => youtubeHelper.setInvidiousSavePlayerPos(event.target.options[invidiousSavePlayerPosElement.selectedIndex].value)
|
||||
event => youtubeHelper.setInvidiousSavePlayerPos(event.target.checked)
|
||||
);
|
||||
|
||||
youtubeHelper.init().then(() => {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
import youtubeHelper from "../../../assets/javascripts/helpers/youtube/youtube.js";
|
||||
|
||||
let disableYoutubeElement = document.getElementById("disable-invidious");
|
||||
|
||||
|
||||
let youtubeFrontendElement = document.getElementById("youtube-frontend");
|
||||
let invidiousDivElement = document.getElementById("invidious");
|
||||
|
@ -8,8 +8,20 @@ let pipedDivElement = document.getElementById("piped");
|
|||
let pipedMaterialDivElement = document.getElementById("pipedMaterial");
|
||||
let invidiousPipedPipedMaterialDivElement = document.getElementById("invidious-piped-pipedMaterial");
|
||||
let freetubeYatteeDivElement = document.getElementById("freetube-yatte");
|
||||
let customSettingsDivElement = document.getElementsByClassName("custom-settings");
|
||||
|
||||
function changeFrontendsSettings() {
|
||||
console.log('changeFrontendsSettings()');
|
||||
let frontend = youtubeFrontendElement.value;
|
||||
|
||||
console.log("customSettingsDivElement", customSettingsDivElement[0].style.display);
|
||||
if (enableYoutubeCustomSettingsElement.checked)
|
||||
for (const item of customSettingsDivElement) item.style.display = 'block';
|
||||
else {
|
||||
console.log("setting it to none");
|
||||
for (const item of customSettingsDivElement) item.style.display = 'none';
|
||||
}
|
||||
|
||||
function changeFrontendsSettings(frontend) {
|
||||
if (frontend == 'invidious') {
|
||||
invidiousPipedPipedMaterialDivElement.style.display = 'block'
|
||||
invidiousDivElement.style.display = 'block';
|
||||
|
@ -62,7 +74,7 @@ youtubeFrontendElement.addEventListener("change",
|
|||
event => {
|
||||
let frontend = event.target.options[youtubeFrontendElement.selectedIndex].value
|
||||
youtubeHelper.setFrontend(frontend);
|
||||
changeFrontendsSettings(frontend);
|
||||
changeFrontendsSettings();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -75,10 +87,20 @@ youtubeEmbedFrontendElement.addEventListener("change",
|
|||
}
|
||||
);
|
||||
|
||||
let disableYoutubeElement = document.getElementById("disable-invidious");
|
||||
disableYoutubeElement.addEventListener("change",
|
||||
event => youtubeHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
let enableYoutubeCustomSettingsElement = document.getElementById("enable-youtube-custom-settings");
|
||||
enableYoutubeCustomSettingsElement.addEventListener("change",
|
||||
event => {
|
||||
youtubeHelper.setEnableCustomSettings(event.target.checked)
|
||||
changeFrontendsSettings();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
let volumeElement = document.getElementById("invidious-volume");
|
||||
let volumeValueElement = document.getElementById("volume-value");
|
||||
volumeElement.addEventListener("input",
|
||||
|
@ -87,18 +109,10 @@ volumeElement.addEventListener("input",
|
|||
volumeValueElement.textContent = `${volumeElement.value}%`;
|
||||
}
|
||||
);
|
||||
let invidiousClearVolumeElement = document.getElementById("clear-invidious-volume");
|
||||
invidiousClearVolumeElement.addEventListener("click",
|
||||
(_) => {
|
||||
youtubeHelper.setVolume('--');
|
||||
volumeValueElement.textContent = `--%`;
|
||||
volumeElement.value = null;
|
||||
}
|
||||
);
|
||||
|
||||
let autoplayElement = document.getElementById("invidious-autoplay");
|
||||
autoplayElement.addEventListener("change",
|
||||
event => youtubeHelper.setAutoplay(event.target.options[autoplayElement.selectedIndex].value)
|
||||
event => youtubeHelper.setAutoplay(event.target.checked)
|
||||
);
|
||||
|
||||
let OnlyEmbeddedVideoElement = document.getElementById("only-embed");
|
||||
|
@ -154,6 +168,7 @@ function changeProtocolSettings(protocol) {
|
|||
|
||||
youtubeHelper.init().then(() => {
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisable();
|
||||
enableYoutubeCustomSettingsElement.checked = youtubeHelper.getEnableCustomSettings();
|
||||
volumeElement.value = youtubeHelper.getVolume();
|
||||
volumeValueElement.textContent = `${youtubeHelper.getVolume()}%`;
|
||||
OnlyEmbeddedVideoElement.value = youtubeHelper.getOnlyEmbeddedVideo();
|
||||
|
@ -161,7 +176,7 @@ youtubeHelper.init().then(() => {
|
|||
autoplayElement.value = youtubeHelper.getAutoplay();
|
||||
let frontend = youtubeHelper.getFrontend();
|
||||
youtubeFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
changeFrontendsSettings();
|
||||
|
||||
let protocol = youtubeHelper.getProtocol();
|
||||
protocolElement.value = protocol;
|
||||
|
|
|
@ -328,6 +328,15 @@ button.add {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.disabled {
|
||||
background-color: rgb(39, 39, 39);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.light-theme.popup,
|
||||
.light-theme .popup {
|
||||
background-color: var(--bg-secondary);
|
||||
|
|
Loading…
Reference in New Issue