From 2876cb24b34e18470c297043c56e915aae2cea7c Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 6 Feb 2022 05:58:42 +0300 Subject: Cleaning code --- src/pages/options/general/general.html | 59 ---------- src/pages/options/general/general.js | 25 ---- src/pages/options/instagram/instagram.html | 16 --- src/pages/options/medium/medium.html | 15 --- src/pages/options/reddit/reddit.html | 17 --- src/pages/options/search/search.html | 17 --- src/pages/options/twitter/twitter.html | 16 --- src/pages/options/wikipedia/wikipedia.html | 14 --- src/pages/options/youtube/youtube.html | 21 +--- src/pages/options/youtube/youtube.js | 75 +++++------- src/pages/stylesheets/styles.css | 177 +---------------------------- 11 files changed, 36 insertions(+), 416 deletions(-) (limited to 'src/pages') diff --git a/src/pages/options/general/general.html b/src/pages/options/general/general.html index 3a7e8cf2..92cd48c5 100644 --- a/src/pages/options/general/general.html +++ b/src/pages/options/general/general.html @@ -38,65 +38,6 @@ Update Instances - - - diff --git a/src/pages/options/general/general.js b/src/pages/options/general/general.js index 23c739aa..17b7a843 100644 --- a/src/pages/options/general/general.js +++ b/src/pages/options/general/general.js @@ -47,31 +47,6 @@ browser.storage.sync.get( } ); -// function addToExceptions() { -// const input = document.getElementById("new-exceptions-item"); -// const type = document.querySelector('input[name="type"]:checked').value; -// if (input.value) { -// try { -// let value = input.value; -// new RegExp(input.value); -// if (type === "URL") -// value = value.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); - -// exceptions.push(value); -// browser.storage.sync.set({ -// exceptions: exceptions, -// }); -// prependExceptionsItem(value, exceptions.indexOf(value)); -// input.value = ""; -// } catch (error) { -// input.setCustomValidity("Invalid RegExp"); -// } -// } else { -// input.setCustomValidity("Invalid RegExp"); -// } -// } -// document.getElementById("add-to-exceptions").addEventListener("click", addToExceptions); - themeElement.addEventListener("change", (event) => { const value = event.target.options[theme.selectedIndex].value; switch (value) { diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html index 1f09cab7..98e296f8 100644 --- a/src/pages/options/instagram/instagram.html +++ b/src/pages/options/instagram/instagram.html @@ -28,22 +28,6 @@

Enable

- - - - diff --git a/src/pages/options/medium/medium.html b/src/pages/options/medium/medium.html index abf149c0..1c978d82 100644 --- a/src/pages/options/medium/medium.html +++ b/src/pages/options/medium/medium.html @@ -28,21 +28,6 @@

Enable

- diff --git a/src/pages/options/reddit/reddit.html b/src/pages/options/reddit/reddit.html index 9dd59d73..c968b954 100644 --- a/src/pages/options/reddit/reddit.html +++ b/src/pages/options/reddit/reddit.html @@ -45,23 +45,6 @@ - - - diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html index af7d3946..489ed38a 100644 --- a/src/pages/options/search/search.html +++ b/src/pages/options/search/search.html @@ -44,23 +44,6 @@ - - diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html index b13d02dd..8e189856 100644 --- a/src/pages/options/twitter/twitter.html +++ b/src/pages/options/twitter/twitter.html @@ -30,22 +30,6 @@

Enable

- - -

Proactively remove Twitter service worker

diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html index a68f36a6..ed811e94 100644 --- a/src/pages/options/wikipedia/wikipedia.html +++ b/src/pages/options/wikipedia/wikipedia.html @@ -28,20 +28,6 @@

Enable

- diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index a9bb6c63..0778b794 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -30,23 +30,6 @@ - - - -

Frontend

@@ -108,7 +90,7 @@
-

Always proxy videos

+

Always proxy videos

diff --git a/src/pages/options/youtube/youtube.js b/src/pages/options/youtube/youtube.js index 595006fd..dcd8c22d 100644 --- a/src/pages/options/youtube/youtube.js +++ b/src/pages/options/youtube/youtube.js @@ -69,10 +69,8 @@ invidiousPlayerStyleElement.addEventListener("change", ); let invidiousSubtitlesElement = document.getElementById("invidious-subtitles"); -invidiousSubtitlesElement.addEventListener("input", - commonHelper.debounce(() => { - youtubeHelper.setInvidiousSubtitles(invidiousSubtitlesElement.value) - }, 500) +invidiousSubtitlesElement.addEventListener("change", + () => youtubeHelper.setInvidiousSubtitles(invidiousSubtitlesElement.value) ); let invidiousAutoplayElement = document.getElementById("invidious-autoplay"); @@ -124,62 +122,51 @@ youtubeHelper.init().then(() => { let myMightyList = youtubeHelper.getInvidiousRedirectsChecks(); - function checkToggleAll() { - console.log("CheckToggleAll") - let isTrue = true; - for (const item of youtubeHelper.getRedirects().invidious.normal) - if (!myMightyList.includes(item)) { - isTrue = false; - break; - } - document.getElementById('invidious-toogle-all').checked = isTrue; - } - - let checklistList = invidiousCheckListElement.getElementsByTagName('input') for (let element of checklistList) { - element.checked = myMightyList.includes(element.id); - if (element.id == 'invidious-toogle-all') - document.getElementById('invidious-toogle-all').addEventListener("change", - (event) => { - if (event.target.checked) { - for (let item of checklistList) { - myMightyList.push(item.id) - item.checked = true; - } - } - else { - myMightyList = []; - for (let item of checklistList) item.checked = false; + document.getElementById('invidious-toogle-all').addEventListener("change", (event) => { + if (event.target.checked) + for (let item of checklistList) { + myMightyList.push(item.id); + item.checked = true; } - youtubeHelper.setInvidiousRedirectsChecks(myMightyList); + else { + myMightyList = []; + for (let item of checklistList) item.checked = false; } - ); + youtubeHelper.setInvidiousRedirectsChecks(myMightyList); + }); else - document.getElementById(element.id).addEventListener("change", - (event) => { - if (event.target.checked) - myMightyList.push(element.id) - else { - let index = myMightyList.indexOf(element.id); - if (index > -1) myMightyList.splice(index, 1); - } - - youtubeHelper.setInvidiousRedirectsChecks(myMightyList); - checkToggleAll(); + document.getElementById(element.id).addEventListener("change", (event) => { + if (event.target.checked) + myMightyList.push(element.id) + else { + let index = myMightyList.indexOf(element.id); + if (index > -1) myMightyList.splice(index, 1); } - ); + youtubeHelper.setInvidiousRedirectsChecks(myMightyList); + checkToggleAll(); + }); } checkToggleAll(); - mightyInvidiousCustomInstances = youtubeHelper.getInvidiousCustomRedirects(); calcCustom(); }); +function checkToggleAll() { + let isTrue = true; + for (const item of youtubeHelper.getRedirects().invidious.normal) + if (!myMightyList.includes(item)) { + isTrue = false; + break; + } + document.getElementById('invidious-toogle-all').checked = isTrue; +} + let invidiousCustomInstanceElement = document.getElementById("invidious-custom-instance") let mightyInvidiousCustomInstances = [] diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index 9046ce26..1d2e9428 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -19,7 +19,6 @@ body.light-theme { body { margin: auto; padding: 0; - min-height: 572px; font-family: Sans-Serif; background-color: var(--bg-main); color: var(--text); @@ -31,23 +30,11 @@ div.some-block input[type="checkbox"] { -webkit-appearance: none; } -h2 { - clear: both; - font-size: 12px; - font-weight: normal; - margin: 0; -} - -h1, -h2 { - color: var(--text); -} - input[type="url"], input[type="text"], select { padding: 5px 10px; - width: 400px; + width: 350px; border-radius: 3px; box-sizing: border-box; margin-bottom: var(--space); @@ -63,37 +50,11 @@ select { padding: 8px; background-color: var(--bg-secondary); border: none; - ; margin: 0; width: auto; border-radius: 3px; } -input[type="radio"] { - appearance: radio; - -moz-appearance: radio; - -webkit-appearance: radio; -} - -input[type="radio"]:checked+label { - background: transparent; -} - -input:checked+label { - background: var(--active); -} - -input:checked+label:after { - left: calc(100% - var(--space)); - transform: translateX(-100%); -} - -.settings-block { - display: block; - margin: 30px 0; - padding: 5px 15px; -} - a.button * { vertical-align: middle; } @@ -113,62 +74,6 @@ a.button:active { input:invalid { color: var(--danger); border-color: var(--danger); - background-color: var(--danger-light); -} - -.margin-bottom { - margin-bottom: 20px; -} - -div.exceptions { - clear: left; -} - -div.exceptions>input { - width: 240px; - float: left; -} - -#add-to-exceptions { - float: right; - border: var(--active) solid 1px; - background-color: var(--active); - color: var(--text); - font-weight: bold; - cursor: pointer; - border-radius: 50%; - padding: 1px 1px 0px 1px; - margin-right: 5px; -} - -#add-to-exceptions svg { - height: 20px; - width: 20px; -} - -ul { - padding: 0; - list-style-type: none; - color: var(--text); - margin: 20px 20px 0 20px; -} - -li { - white-space: nowrap; - border-bottom: solid 0.5px var(--bg-secondary); - padding: 20px 0px 20px 20px; -} - -#exceptions-items button { - float: right; - margin-right: -5px; - border: var(--active) solid 1px; - background-color: var(--active); - color: var(--text); - font-weight: bold; - cursor: pointer; - border-radius: 50%; - padding: 2px 2px 0px 2px; } .button svg { @@ -176,48 +81,6 @@ li { width: 18px; } -.autocomplete { - position: relative; - display: inline-block; - width: 100%; -} - -.autocomplete input { - background: url(../../assets/images/chevron-down.svg) right no-repeat; -} - -.autocomplete-items { - position: absolute; - border: 1px solid var(--bg-main); - border-bottom: none; - border-top: none; - z-index: 99; - top: 85%; - left: 0; - right: 0; - overflow-y: auto; - max-height: 175px; - color: var(--text); - overflow-x: hidden; - max-width: 380px; -} - -.autocomplete-items div { - padding: 10px; - cursor: pointer; - background-color: var(--bg-secondary); - border-bottom: 1px solid var(--bg-main); -} - -.autocomplete-items div:hover { - background-color: var(--active); -} - -.autocomplete-active { - background-color: var(--active); - color: var(--text); -} - section.option-block { width: 50%; margin: 0 50px; @@ -229,10 +92,6 @@ body.option { padding: 40px; } -section.links { - margin: 00px 0; -} - section.links a { display: flex; align-items: center; @@ -244,20 +103,13 @@ section.links a { transition: 0.1s; } -section.links a:hover { - color: var(--active); -} - +section.links a:hover, section.links a.selected { color: var(--active); } -.option td { - vertical-align: middle; -} - input[type="range"] { - width: 50%; + width: 350px; } ::placeholder { @@ -265,11 +117,6 @@ input[type="range"] { opacity: 0.7; } -input[type="text"]:focus, -input[type="url"]:focus { - outline: none; -} - #volume-value { color: var(--active); } @@ -328,7 +175,6 @@ h4 { div.some-block h4 { margin: 0; - /* width: 70%; */ } div.option-block h4 { @@ -356,10 +202,6 @@ div.some-block input[type="checkbox"]:checked { background-color: var(--active); } -div.some-block input[type="checkbox"]:focus { - outline: none; -} - div.some-block input[type="checkbox"]::before { content: ""; display: inline-block; @@ -372,7 +214,7 @@ div.some-block input[type="checkbox"]::before { height: 20px; background-color: white; border-radius: 50%; - transition: .4s; + transition: .3s; } div.some-block input[type="checkbox"]:checked::before { @@ -422,15 +264,6 @@ a.button:active { transform: translateY(1px); } -textarea { - line-height: 21px; - background-color: var(--bg-secondary); - color: white; - border: none; - resize: none; - width: 100%; -} - button.default { margin-left: 30px; background-color: transparent; @@ -455,11 +288,9 @@ div.checklist div { justify-content: space-between; margin: 5px 15px; padding: 10px 0; - /* border-bottom: 2px solid rgb(77, 77, 77); */ display: flex; } - button.add { background-color: transparent; border: none; -- cgit 1.4.1