Added seperated theme setting for Piped #147
This commit is contained in:
parent
1b6d6fa802
commit
d207ff2a34
|
@ -114,6 +114,9 @@ export const getPipedSelectedSkip = () => pipedSelectedSkip;
|
||||||
export let pipedSponsorblock;
|
export let pipedSponsorblock;
|
||||||
export const getPipedSponsorblock = () => pipedSponsorblock;
|
export const getPipedSponsorblock = () => pipedSponsorblock;
|
||||||
|
|
||||||
|
export let pipedDdlTheme;
|
||||||
|
export const getPipedDdlTheme = () => pipedDdlTheme;
|
||||||
|
|
||||||
export let pipedWatchHistory;
|
export let pipedWatchHistory;
|
||||||
export const getPipedWatchHistory = () => pipedWatchHistory;
|
export const getPipedWatchHistory = () => pipedWatchHistory;
|
||||||
|
|
||||||
|
@ -162,6 +165,7 @@ export async function initOptions() {
|
||||||
"pipedRegion",
|
"pipedRegion",
|
||||||
"pipedSelectedSkip",
|
"pipedSelectedSkip",
|
||||||
"pipedSponsorblock",
|
"pipedSponsorblock",
|
||||||
|
"pipedDdlTheme",
|
||||||
"pipedWatchHistory",
|
"pipedWatchHistory",
|
||||||
|
|
||||||
"pipedMaterialSkipToLastPoint",
|
"pipedMaterialSkipToLastPoint",
|
||||||
|
@ -206,6 +210,7 @@ export async function initOptions() {
|
||||||
|
|
||||||
pipedSelectedSkip = r.pipedSelectedSkip ?? ["sponsor", "interaction", "selfpromo", "music_offtopic"];
|
pipedSelectedSkip = r.pipedSelectedSkip ?? ["sponsor", "interaction", "selfpromo", "music_offtopic"];
|
||||||
pipedSponsorblock = r.pipedSponsorblock ?? true;
|
pipedSponsorblock = r.pipedSponsorblock ?? true;
|
||||||
|
pipedDdlTheme = r.pipedDdlTheme ?? 'auto';
|
||||||
pipedWatchHistory = r.pipedWatchHistory ?? false;
|
pipedWatchHistory = r.pipedWatchHistory ?? false;
|
||||||
|
|
||||||
pipedMaterialSkipToLastPoint = r.pipedMaterialSkipToLastPoint ?? true;
|
pipedMaterialSkipToLastPoint = r.pipedMaterialSkipToLastPoint ?? true;
|
||||||
|
|
|
@ -18,6 +18,7 @@ browser.storage.local.get(
|
||||||
"pipedRegion",
|
"pipedRegion",
|
||||||
"pipedSelectedSkip",
|
"pipedSelectedSkip",
|
||||||
"pipedSponsorblock",
|
"pipedSponsorblock",
|
||||||
|
"pipedDdlTheme",
|
||||||
"pipedWatchHistory",
|
"pipedWatchHistory",
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
|
@ -37,6 +38,7 @@ browser.storage.local.get(
|
||||||
let pipedRegion = r.pipedRegion ?? "US";
|
let pipedRegion = r.pipedRegion ?? "US";
|
||||||
let pipedSelectedSkip = r.pipedSelectedSkip ?? ["sponsor", "interaction", "selfpromo", "music_offtopic"];
|
let pipedSelectedSkip = r.pipedSelectedSkip ?? ["sponsor", "interaction", "selfpromo", "music_offtopic"];
|
||||||
let pipedSponsorblock = r.pipedSponsorblock ?? true;
|
let pipedSponsorblock = r.pipedSponsorblock ?? true;
|
||||||
|
let pipedDdlTheme = r.pipedDdlTheme ?? 'auto';
|
||||||
let pipedWatchHistory = r.pipedWatchHistory ?? false;
|
let pipedWatchHistory = r.pipedWatchHistory ?? false;
|
||||||
|
|
||||||
localStorage.setItem("bufferGoal", pipedBufferGoal.toString());
|
localStorage.setItem("bufferGoal", pipedBufferGoal.toString());
|
||||||
|
@ -52,7 +54,7 @@ browser.storage.local.get(
|
||||||
localStorage.setItem("region", pipedRegion);
|
localStorage.setItem("region", pipedRegion);
|
||||||
localStorage.setItem("selectedSkip", pipedSelectedSkip);
|
localStorage.setItem("selectedSkip", pipedSelectedSkip);
|
||||||
localStorage.setItem("sponsorblock", pipedSponsorblock);
|
localStorage.setItem("sponsorblock", pipedSponsorblock);
|
||||||
localStorage.setItem("theme", theme);
|
localStorage.setItem("theme", pipedDdlTheme);
|
||||||
localStorage.setItem("volume", youtubeVolume / 100);
|
localStorage.setItem("volume", youtubeVolume / 100);
|
||||||
localStorage.setItem("watchHistory", pipedWatchHistory);
|
localStorage.setItem("watchHistory", pipedWatchHistory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import {
|
||||||
getPipedRegion,
|
getPipedRegion,
|
||||||
getPipedSelectedSkip,
|
getPipedSelectedSkip,
|
||||||
getPipedSponsorblock,
|
getPipedSponsorblock,
|
||||||
|
getPipedDdlTheme,
|
||||||
getPipedWatchHistory,
|
getPipedWatchHistory,
|
||||||
volume, getVolume, setVolume,
|
volume, getVolume, setVolume,
|
||||||
youtubeAutoplay, getAutoplay, setAutoplay,
|
youtubeAutoplay, getAutoplay, setAutoplay,
|
||||||
|
@ -687,6 +688,7 @@ export default {
|
||||||
getPipedRegion,
|
getPipedRegion,
|
||||||
getPipedSelectedSkip,
|
getPipedSelectedSkip,
|
||||||
getPipedSponsorblock,
|
getPipedSponsorblock,
|
||||||
|
getPipedDdlTheme,
|
||||||
getPipedWatchHistory,
|
getPipedWatchHistory,
|
||||||
getPipedMaterialSkipToLastPoint,
|
getPipedMaterialSkipToLastPoint,
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,38 @@
|
||||||
import youtubeHelper from "../../../assets/javascripts/helpers/youtube/youtube.js";
|
import youtubeHelper from "../../../assets/javascripts/helpers/youtube/youtube.js";
|
||||||
import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
||||||
|
|
||||||
let pipedElement = document.getElementById('piped');
|
let piped = document.getElementById('piped');
|
||||||
|
|
||||||
let pipedListenElement = pipedElement.getElementsByClassName("listen")[0];
|
let pipedListen = piped.getElementsByClassName("listen")[0];
|
||||||
let pipedQualityElement = pipedElement.getElementsByClassName("quality")[0];
|
let pipedQuality = piped.getElementsByClassName("quality")[0];
|
||||||
let pipedBufferGoalElement = pipedElement.getElementsByClassName("bufferGoal")[0];
|
let pipedBufferGoal = piped.getElementsByClassName("bufferGoal")[0];
|
||||||
let pipedRegionElement = pipedElement.getElementsByClassName("region")[0];
|
let pipedRegion = piped.getElementsByClassName("region")[0];
|
||||||
let pipedHomepageElement = pipedElement.getElementsByClassName("homepage")[0];
|
let pipedHomepage = piped.getElementsByClassName("homepage")[0];
|
||||||
let pipedCommentsElement = pipedElement.getElementsByClassName("comments")[0];
|
let pipedComments = piped.getElementsByClassName("comments")[0];
|
||||||
let pipedMinimizeDescriptionElement = pipedElement.getElementsByClassName("minimizeDescription")[0];
|
let pipedMinimizeDescription = piped.getElementsByClassName("minimizeDescription")[0];
|
||||||
let pipedWatchHistoryElement = pipedElement.getElementsByClassName("watchHistory")[0];
|
let pipedWatchHistory = piped.getElementsByClassName("watchHistory")[0];
|
||||||
let pipedDisableLBRYElement = pipedElement.getElementsByClassName("disableLBRY")[0];
|
let pipedDisableLBRY = piped.getElementsByClassName("disableLBRY")[0];
|
||||||
let pipedProxyLBRYElement = pipedElement.getElementsByClassName("proxyLBRY")[0];
|
let pipedProxyLBRY = piped.getElementsByClassName("proxyLBRY")[0];
|
||||||
|
|
||||||
let pipedSelectedSkipSponsorElement = pipedElement.getElementsByClassName("selectedSkip-sponsor")[0];
|
let pipedSelectedSkipSponsor = piped.getElementsByClassName("selectedSkip-sponsor")[0];
|
||||||
let pipedSelectedSkipIntroElement = pipedElement.getElementsByClassName("selectedSkip-intro")[0];
|
let pipedSelectedSkipIntro = piped.getElementsByClassName("selectedSkip-intro")[0];
|
||||||
let pipedSelectedSkipOutroElement = pipedElement.getElementsByClassName("selectedSkip-outro")[0];
|
let pipedSelectedSkipOutro = piped.getElementsByClassName("selectedSkip-outro")[0];
|
||||||
let pipedSelectedSkipPreviewElement = pipedElement.getElementsByClassName("selectedSkip-preview")[0];
|
let pipedSelectedSkipPreview = piped.getElementsByClassName("selectedSkip-preview")[0];
|
||||||
let pipedSelectedSkipInteractionElement = pipedElement.getElementsByClassName("selectedSkip-interaction")[0];
|
let pipedSelectedSkipInteraction = piped.getElementsByClassName("selectedSkip-interaction")[0];
|
||||||
let pipedSelectedSkipSelfpromoElement = pipedElement.getElementsByClassName("selectedSkip-selfpromo")[0];
|
let pipedSelectedSkipSelfpromo = piped.getElementsByClassName("selectedSkip-selfpromo")[0];
|
||||||
let pipedSelectedSkipMusicOfftopicElement = pipedElement.getElementsByClassName("selectedSkip-music_offtopic")[0];
|
let pipedSelectedSkipMusicOfftopic = piped.getElementsByClassName("selectedSkip-music_offtopic")[0];
|
||||||
let pipedSelectedSkipPoiHighlightElement = pipedElement.getElementsByClassName("selectedSkip-poi_highlight")[0];
|
let pipedSelectedSkipPoiHighlight = piped.getElementsByClassName("selectedSkip-poi_highlight")[0];
|
||||||
let pipedSelectedSkipFillerElement = pipedElement.getElementsByClassName("selectedSkip-filler")[0];
|
let pipedSelectedSkipFiller = piped.getElementsByClassName("selectedSkip-filler")[0];
|
||||||
|
|
||||||
let pipedSponsorblockElement = pipedElement.getElementsByClassName("sponsorblock")[0];
|
let pipedDdlTheme = piped.getElementsByClassName("ddlTheme")[0];
|
||||||
let pipedEnabledCodecsElement = pipedElement.getElementsByClassName("enabledCodecs")[0];
|
let pipedSponsorblock = piped.getElementsByClassName("sponsorblock")[0];
|
||||||
let autoplayElement = pipedElement.getElementsByClassName("youtubeAutoplay")[0];
|
let pipedEnabledCodecs = piped.getElementsByClassName("enabledCodecs")[0];
|
||||||
|
let autoplay = piped.getElementsByClassName("youtubeAutoplay")[0];
|
||||||
|
|
||||||
let volumeElement = pipedElement.getElementsByClassName("volume")[0];
|
let volume = piped.getElementsByClassName("volume")[0];
|
||||||
let volumeValueElement = pipedElement.getElementsByClassName("volume-value")[0];
|
let volumeValue = piped.getElementsByClassName("volume-value")[0];
|
||||||
|
|
||||||
volumeElement.addEventListener("input", () => volumeValueElement.textContent = `${volumeElement.value}%`);
|
volume.addEventListener("input", () => volumeValue.textContent = `${volume.value}%`);
|
||||||
function selectSkipModify(value, boolean) {
|
function selectSkipModify(value, boolean) {
|
||||||
if (boolean && !selectSkip.includes(value)) {
|
if (boolean && !selectSkip.includes(value)) {
|
||||||
selectSkip.push(value);
|
selectSkip.push(value);
|
||||||
|
@ -42,37 +43,38 @@ function selectSkipModify(value, boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let selectSkip = [];
|
let selectSkip = [];
|
||||||
pipedElement.addEventListener("change", async () => {
|
piped.addEventListener("change", async () => {
|
||||||
console.log("changed piped settings");
|
console.log("changed piped settings");
|
||||||
let pipedEnabledCodecsResult = [];
|
let pipedEnabledCodecsResult = [];
|
||||||
for (const opt of pipedEnabledCodecsElement.options)
|
for (const opt of pipedEnabledCodecs.options)
|
||||||
if (opt.selected) pipedEnabledCodecsResult.push(opt.value);
|
if (opt.selected) pipedEnabledCodecsResult.push(opt.value);
|
||||||
|
|
||||||
selectSkipModify('sponsor', pipedSelectedSkipSponsorElement.checked);
|
selectSkipModify('sponsor', pipedSelectedSkipSponsor.checked);
|
||||||
selectSkipModify('intro', pipedSelectedSkipIntroElement.checked);
|
selectSkipModify('intro', pipedSelectedSkipIntro.checked);
|
||||||
selectSkipModify('outro', pipedSelectedSkipOutroElement.checked);
|
selectSkipModify('outro', pipedSelectedSkipOutro.checked);
|
||||||
selectSkipModify('preview', pipedSelectedSkipPreviewElement.checked);
|
selectSkipModify('preview', pipedSelectedSkipPreview.checked);
|
||||||
selectSkipModify('interaction', pipedSelectedSkipInteractionElement.checked);
|
selectSkipModify('interaction', pipedSelectedSkipInteraction.checked);
|
||||||
selectSkipModify('selfpromo', pipedSelectedSkipSelfpromoElement.checked);
|
selectSkipModify('selfpromo', pipedSelectedSkipSelfpromo.checked);
|
||||||
selectSkipModify('music_offtopic', pipedSelectedSkipMusicOfftopicElement.checked);
|
selectSkipModify('music_offtopic', pipedSelectedSkipMusicOfftopic.checked);
|
||||||
selectSkipModify('poi_highlight', pipedSelectedSkipPoiHighlightElement.checked);
|
selectSkipModify('poi_highlight', pipedSelectedSkipPoiHighlight.checked);
|
||||||
selectSkipModify('filler', pipedSelectedSkipFillerElement.checked);
|
selectSkipModify('filler', pipedSelectedSkipFiller.checked);
|
||||||
|
|
||||||
await youtubeHelper.setYoutubeSettings({
|
await youtubeHelper.setYoutubeSettings({
|
||||||
pipedQuality: pipedQualityElement.value,
|
pipedQuality: pipedQuality.value,
|
||||||
pipedBufferGoal: pipedBufferGoalElement.value,
|
pipedBufferGoal: pipedBufferGoal.value,
|
||||||
pipedRegion: pipedRegionElement.value,
|
pipedRegion: pipedRegion.value,
|
||||||
pipedHomepage: pipedHomepageElement.value,
|
pipedHomepage: pipedHomepage.value,
|
||||||
pipedComments: pipedCommentsElement.checked,
|
pipedComments: pipedComments.checked,
|
||||||
pipedMinimizeDescription: pipedMinimizeDescriptionElement.checked,
|
pipedMinimizeDescription: pipedMinimizeDescription.checked,
|
||||||
youtubeAutoplay: autoplayElement.checked,
|
youtubeAutoplay: autoplay.checked,
|
||||||
pipedWatchHistory: pipedWatchHistoryElement.checked,
|
pipedWatchHistory: pipedWatchHistory.checked,
|
||||||
pipedDisableLBRY: pipedDisableLBRYElement.checked,
|
pipedDisableLBRY: pipedDisableLBRY.checked,
|
||||||
pipedProxyLBRY: pipedProxyLBRYElement.checked,
|
pipedProxyLBRY: pipedProxyLBRY.checked,
|
||||||
youtubeVolume: volumeElement.value,
|
youtubeVolume: volume.value,
|
||||||
pipedSponsorblock: pipedSponsorblockElement.checked,
|
pipedSponsorblock: pipedSponsorblock.checked,
|
||||||
|
pipedDdlTheme: pipedDdlTheme.value,
|
||||||
pipedEnabledCodecs: pipedEnabledCodecsResult,
|
pipedEnabledCodecs: pipedEnabledCodecsResult,
|
||||||
youtubeListen: pipedListenElement.checked,
|
youtubeListen: pipedListen.checked,
|
||||||
pipedSelectedSkip: selectSkip,
|
pipedSelectedSkip: selectSkip,
|
||||||
});
|
});
|
||||||
init();
|
init();
|
||||||
|
@ -80,32 +82,33 @@ pipedElement.addEventListener("change", async () => {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
youtubeHelper.init().then(() => {
|
youtubeHelper.init().then(() => {
|
||||||
pipedSponsorblockElement.checked = youtubeHelper.getPipedSponsorblock();
|
pipedSponsorblock.checked = youtubeHelper.getPipedSponsorblock();
|
||||||
|
pipedDdlTheme.value = youtubeHelper.getPipedDdlTheme();
|
||||||
selectSkip = youtubeHelper.getPipedSelectedSkip();
|
selectSkip = youtubeHelper.getPipedSelectedSkip();
|
||||||
pipedSelectedSkipSponsorElement.checked = selectSkip.includes('sponsor');
|
pipedSelectedSkipSponsor.checked = selectSkip.includes('sponsor');
|
||||||
pipedSelectedSkipIntroElement.checked = selectSkip.includes('intro');
|
pipedSelectedSkipIntro.checked = selectSkip.includes('intro');
|
||||||
pipedSelectedSkipOutroElement.checked = selectSkip.includes('outro');
|
pipedSelectedSkipOutro.checked = selectSkip.includes('outro');
|
||||||
pipedSelectedSkipPreviewElement.checked = selectSkip.includes('preview');
|
pipedSelectedSkipPreview.checked = selectSkip.includes('preview');
|
||||||
autoplayElement.checked = youtubeHelper.getAutoplay();
|
autoplay.checked = youtubeHelper.getAutoplay();
|
||||||
pipedSelectedSkipInteractionElement.checked = selectSkip.includes('interaction');
|
pipedSelectedSkipInteraction.checked = selectSkip.includes('interaction');
|
||||||
pipedSelectedSkipSelfpromoElement.checked = selectSkip.includes('selfpromo');
|
pipedSelectedSkipSelfpromo.checked = selectSkip.includes('selfpromo');
|
||||||
pipedSelectedSkipMusicOfftopicElement.checked = selectSkip.includes('music_offtopic');
|
pipedSelectedSkipMusicOfftopic.checked = selectSkip.includes('music_offtopic');
|
||||||
pipedSelectedSkipPoiHighlightElement.checked = selectSkip.includes('poi_highlight');
|
pipedSelectedSkipPoiHighlight.checked = selectSkip.includes('poi_highlight');
|
||||||
pipedSelectedSkipFillerElement.checked = selectSkip.includes('filler');
|
pipedSelectedSkipFiller.checked = selectSkip.includes('filler');
|
||||||
pipedListenElement.checked = youtubeHelper.getYoutubeListen();
|
pipedListen.checked = youtubeHelper.getYoutubeListen();
|
||||||
pipedQualityElement.value = youtubeHelper.getPipedQuality();
|
pipedQuality.value = youtubeHelper.getPipedQuality();
|
||||||
pipedBufferGoalElement.value = youtubeHelper.getPipedBufferGoal();
|
pipedBufferGoal.value = youtubeHelper.getPipedBufferGoal();
|
||||||
pipedRegionElement.value = youtubeHelper.getPipedRegion();
|
pipedRegion.value = youtubeHelper.getPipedRegion();
|
||||||
pipedHomepageElement.value = youtubeHelper.getPipedHomepage();
|
pipedHomepage.value = youtubeHelper.getPipedHomepage();
|
||||||
pipedCommentsElement.checked = youtubeHelper.getPipedComments();
|
pipedComments.checked = youtubeHelper.getPipedComments();
|
||||||
pipedMinimizeDescriptionElement.checked = youtubeHelper.getPipedMinimizeDescription();
|
pipedMinimizeDescription.checked = youtubeHelper.getPipedMinimizeDescription();
|
||||||
pipedWatchHistoryElement.checked = youtubeHelper.getPipedWatchHistory();
|
pipedWatchHistory.checked = youtubeHelper.getPipedWatchHistory();
|
||||||
pipedEnabledCodecsElement.value = youtubeHelper.getPipedEnabledCodecs();
|
pipedEnabledCodecs.value = youtubeHelper.getPipedEnabledCodecs();
|
||||||
pipedDisableLBRYElement.checked = youtubeHelper.getPipedDisableLBRY();
|
pipedDisableLBRY.checked = youtubeHelper.getPipedDisableLBRY();
|
||||||
pipedProxyLBRYElement.checked = youtubeHelper.getPipedProxyLBRY();
|
pipedProxyLBRY.checked = youtubeHelper.getPipedProxyLBRY();
|
||||||
|
|
||||||
volumeElement.value = youtubeHelper.getVolume();
|
volume.value = youtubeHelper.getVolume();
|
||||||
volumeValueElement.textContent = `${youtubeHelper.getVolume()}%`;
|
volumeValue.textContent = `${youtubeHelper.getVolume()}%`;
|
||||||
|
|
||||||
commonHelper.processDefaultCustomInstances(
|
commonHelper.processDefaultCustomInstances(
|
||||||
'piped',
|
'piped',
|
||||||
|
|
|
@ -939,11 +939,6 @@
|
||||||
<div class="custom-settings">
|
<div class="custom-settings">
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="some-block option-block">
|
|
||||||
<h4 data-localise="__MSG_autoplayVid__">Autoplay Video</h4>
|
|
||||||
<input class="youtubeAutoplay" type="checkbox" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="some-block option-block">
|
<div class="some-block option-block">
|
||||||
<h4>
|
<h4>
|
||||||
<x data-localise="__MSG_volume__">Volume: </x><span class="volume-value">--%</span>
|
<x data-localise="__MSG_volume__">Volume: </x><span class="volume-value">--%</span>
|
||||||
|
@ -1001,6 +996,20 @@
|
||||||
<input class="selectedSkip-filler" type="checkbox" />
|
<input class="selectedSkip-filler" type="checkbox" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_theme__">Theme</h4>
|
||||||
|
<select class="ddlTheme">
|
||||||
|
<option value="auto">Auto</option>
|
||||||
|
<option value="dark">Dark</option>
|
||||||
|
<option value="light">Light</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_autoplayVid__">Autoplay Video</h4>
|
||||||
|
<input class="youtubeAutoplay" type="checkbox" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="some-block option-block">
|
<div class="some-block option-block">
|
||||||
<h4 data-localise="__MSG_audioOnly__">Audio Only</h4>
|
<h4 data-localise="__MSG_audioOnly__">Audio Only</h4>
|
||||||
<input class="listen" type="checkbox" />
|
<input class="listen" type="checkbox" />
|
||||||
|
|
Loading…
Reference in New Issue