YouShield - Remove Youtube Shorts
+36
-48
| (async () => { | ||
| const homepageStyle = `.gstl_50 { z-index: 100000 !important; } .gsfs { color: white !important; } .sbsb_a {background: #151515 !important; margin-top: 21px; } .sbsb_d { background: #131313 !important; } body { overflow: hidden; } #youshield-homepage { position: absolute; z-index: 99999; background-color: #121212; width: 100vw; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; } #homepage-logo { position: absolute; width: 20%; top: 2vh; left: 1.5vw; } .youshield-button { background-color: #202020; text-align: center; padding: 0.7vh 1.2vw; border-radius: 5px; color: white; font-size: 0.9vw; font-family: "Poppins"; margin: 0.7vw 0.4vw; cursor: pointer; transition: all 0.5s ease; } .youshield-button.selected { background-color: #fff; font-weight: 500; color: #000; } .youshield-button.selected.limitexceeded { background-color: #444; } #button-holder { width: fit-content; display: flex; } #search-form { width: 36%; } #youshield-homepage>form>div { border: 1px solid #252525; background-color: #151515; border-radius: 1000px; padding: 0.7vw; padding-left: 1vw; } #youshield-homepage #search-input input { background-color: transparent; border: none; outline: none; font-size: 1.1vw; color: #eee; width: 100%; } #time-spent-text { font-family: 'Poppins'; font-size: 1.3vw; position: absolute; bottom: 2%; color: #fff; opacity: 1; transition: opacity 0.3s ease; } #time-spent-text[shown="false"] { opacity: 0; } #pin-arrow-container { position: absolute; top: 0.5vw; right: 8.5vw; display: flex; flex-direction: column; align-items: center; } #pin-arrow-container>img { width: 4vw; transform: rotate(180deg); } #pin-arrow-container>p { color: white; font-family: Poppins; font-size: 1.2vw; margin-top: 0.5vw; } | ||
| const homepageStyle = `.gstl_50 { z-index: 100000 !important; } .gsfs { color: white !important; } .sbsb_a {background: #151515 !important; margin-top: 21px; } .sbsb_d { background: #131313 !important; } body { overflow: hidden; } #youshield-homepage { position: absolute; z-index: 99999; background-color: #121212; width: 100vw; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; } #homepage-logo { position: absolute; width: 20%; top: 2vh; left: 1.5vw; } .youshield-button { background-color: #202020; text-align: center; padding: 0.7vh 1.2vw; border-radius: 5px; color: white; font-size: 0.9vw; font-family: "Poppins"; margin: 0.7vw 0.4vw; cursor: pointer; transition: all 0.5s ease; } .youshield-button.selected { background-color: #fff; font-weight: 500; color: #000; } .youshield-button.selected.limitexceeded { background-color: #444; } #button-holder { width: fit-content; display: flex; } #search-form, .ytSearchboxComponentSearchForm { flex: none; display:block; width: 36%; } #youshield-homepage>form>div { border: 1px solid #252525; background-color: #151515; border-radius: 1000px; padding: 0.7vw; padding-left: 1vw; } #youshield-homepage #search-input input { background-color: transparent; border: none; outline: none; font-size: 1.1vw; color: #eee; width: 100%; } #time-spent-text { font-family: 'Poppins'; font-size: 1.3vw; position: absolute; bottom: 2%; color: #fff; opacity: 1; transition: opacity 0.3s ease; } #time-spent-text[shown="false"] { opacity: 0; } #pin-arrow-container { position: absolute; top: 0.5vw; right: 8.5vw; display: flex; flex-direction: column; align-items: center; } #pin-arrow-container>img { width: 4vw; transform: rotate(180deg); } #pin-arrow-container>p { color: white; font-family: Poppins; font-size: 1.2vw; margin-top: 0.5vw; } | ||
| :root { --grey: #272727; --light-grey: #3b3a3e; } #consume-limit-set-container h1 { font-size: 1.7vw; margin: 0.1vw; margin-left: 0.5vw; font-weight: 500; } .button { color: #fff; margin-top: 5vw; font-weight: 500; margin-bottom: 2vw; background-color: var(--grey); border-radius: 100px; outline: none; border: none; text-align: center; cursor: pointer; } #consume-limit-set-container #icon { position: absolute; left: 15px; top: 15px; } #consume-limit-set-container { flex-direction: column; font-family: "Poppins", sans-serif; background-color: #191919; position: relative; color: white; width: 26vw; height: 15vw; padding: 1vw; border-radius: 19px; box-shadow: 0px 0px 7px 10px #181818; } #consume-limit-set-background { display: flex; align-items: center; justify-content: center; position: absolute; display: none; top: 0px; width: 100%; height: 100%; margin: 0px; background: #00000090; } #consume-limit-set-background button { font-size: 20px; border: none; background: none; color: #ddd; font-size: 3vw; cursor: pointer; position: absolute; top: 29vh; left: 66vw; } div>img { position: absolute; width: 31px; right: 33px; top: 25px; } #consume-limit-set-btn, #upgrade-plan-btn { background-color: #e58500; color: #888; text-decoration: line-through; border-radius: 15px; font-size: 1.1vw; padding: 0.4vw; width: 40%; } #consume-limit-set-btn { text-decoration: none; color: white; margin: 0px auto; margin-top: 1.3vw; } #time-input-holder { margin: 3vw auto; margin-top: 1.5vw; width: fit-content; display: flex; align-items: baseline; } #hours-input, #minutes-input { display: inline-block; background-color: #282828; border-radius: 20px; border: none; margin-right: 0.3vw; color: white; font-size: 3.2vw; text-align: center; width: 3.8vw; height: 4vw; } #minutes-input { width: 5.6vw; } #time-input-holder>span { font-size: 1.2vw; } .arrow { font-size: 4vw; cursor: pointer; height: 0px; user-select: none; margin: 0px; color: #ff9800; } `; | ||
@@ -7,25 +7,23 @@ let madeHomepage = false; | ||
| chrome.runtime.onMessage.addListener(async (obj, _sender, _response) => { | ||
| if (obj.type == 'CONSUME_LIMIT_SET') { | ||
| setConsumeButtonClickability(); | ||
| return; | ||
| } | ||
| if (location.href != 'https://www.youtube.com/' || location.href == "https://m.youtube.com/") { | ||
| if (madeHomepage) { | ||
| const ys_homepage = document.getElementById('youshield-homepage'); | ||
| if (ys_homepage) ys_homepage.hidden = true; | ||
| if (ys_homepage && ys_homepage.hidden == false) { | ||
| ys_homepage.hidden = true; | ||
| window.removeEventListener('keydown', windowKeydown); | ||
| let yt_searchForm = document.querySelector('.ytd-searchbox#search-form'); | ||
| yt_searchForm.style = ''; | ||
| yt_searchForm.querySelector('#search-input').appendChild(document.querySelector('#search-input>input')); | ||
| document.querySelector('ytd-searchbox').prepend(yt_searchForm); | ||
| document.getElementById('youshield-style').disabled = true; | ||
| let yt_searchForm = document.querySelector('form.ytSearchboxComponentSearchForm'); | ||
| yt_searchForm.hidden = false; | ||
| yt_searchForm.appendChild(document.querySelector('form.ytSearchboxComponentSearchForm>div>input')); | ||
| document.querySelector('.ytSearchboxComponentInputBox').prepend(yt_searchForm); | ||
| document.getElementById('youshield-style').disabled = true; | ||
| } | ||
| } | ||
| document.activeElement.blur(); | ||
| setTimeout(() => document.activeElement.blur(), 200); | ||
| setTimeout(() => document.activeElement.blur(), 500); | ||
| setTimeout(() => document.activeElement.blur(), 1000); | ||
| setTimeout(() => document.activeElement.blur(), 2000); | ||
| setTimeout(() => document.activeElement.blur(), 5000); | ||
| // document.activeElement.blur(); | ||
| // setTimeout(() => document.activeElement.blur(), 200); | ||
| // setTimeout(() => document.activeElement.blur(), 500); | ||
| // setTimeout(() => document.activeElement.blur(), 1000); | ||
| // setTimeout(() => document.activeElement.blur(), 2000); | ||
| // setTimeout(() => document.activeElement.blur(), 5000); | ||
| } | ||
@@ -46,2 +44,9 @@ | ||
| function windowKeydown(e) { | ||
| window.removeEventListener('keydown', windowKeydown); | ||
| const x = document.querySelector('input[name="search_query"]'); | ||
| x.focus(); | ||
| x.dispatchEvent(new KeyboardEvent(e.type, e)); | ||
| } | ||
| async function initHomepage() { | ||
@@ -90,40 +95,23 @@ if (madeHomepage) { | ||
| youshieldContainer.id = 'youshield-homepage'; | ||
| youshieldContainer.innerHTML = `<img id="homepage-logo"> <div id="pin-arrow-container" hidden> <img> <p>Pin the extension!</p> </div> <form action="/results" id="search-form"> <div id="search-input"> </div> </form> <div id="button-holder"> <div class="youshield-button selected">Search</div> <div class="youshield-button" onmouseover="selectButton(this); showTimeSpent(localStorage.shieldForYouTime, false);" onmouseout="deselectButton(); hideTimeSpent();" onclick="const l = document.querySelector('#items > ytd-guide-entry-renderer:nth-child(3) > a'); if (l) l.click(); else document.location.href = 'https://www.youtube.com/feed/subscriptions'">Subscribed Channels</div> <div id="consume-btn" class="youshield-button" onmouseover="selectButton(this); if (document.getElementById('consume-limit-set-background').hidden == false) showTimeSpent(localStorage.shieldConsumeTime, true)" onmouseout="deselectButton(); hideTimeSpent();" onclick="consumeClick(this)">Homepage</div> </div> <div id="time-spent-text" shown="false"></div> <div id='consume-limit-set-background'> <button onclick="this.parentNode.style.display='none';">×</button> <div id='consume-limit-set-container'> <img id="clock-icon"> <h1>Consume limit</h1> <div id="time-input-holder"> <p class="arrow" id="decrease-time" style="padding-right: 1.5vw">‹</p> <input id="hours-input" min="0" max="5" placeholder="0"><span style="margin-right: 2vw">/hr</span> <input id="minutes-input" min="0" max="59" placeholder="00"><span>/min</span> <p class="arrow" id="increase-time" style="padding-left: 1.5vw">›</p> </div> <div hidden id="consume-limit-set-btn" class="button">Set time</div> </div> </div>`; | ||
| youshieldContainer.innerHTML = `<img id="homepage-logo"> <div id="pin-arrow-container" hidden> <img> <p>Pin the extension!</p> </div> <form action="/results" class="ytSearchboxComponentSearchForm" id="search-form"> <div id="search-input"> </div> </form> <div id="button-holder"> <div class="youshield-button selected">Search</div> <div class="youshield-button" onmouseover="selectButton(this); showTimeSpent(localStorage.shieldForYouTime, false);" onmouseout="deselectButton(); hideTimeSpent();" onclick="const l = document.querySelector('#items > ytd-guide-entry-renderer:nth-child(3) > a'); if (l) l.click(); else document.location.href = 'https://www.youtube.com/feed/subscriptions'">Subscribed Channels</div> <div id="consume-btn" class="youshield-button" onmouseover="selectButton(this); if (document.getElementById('consume-limit-set-background').hidden == false) showTimeSpent(localStorage.shieldConsumeTime, true)" onmouseout="deselectButton(); hideTimeSpent();" onclick="consumeClick(this)">Homepage</div> </div> <div id="time-spent-text" shown="false"></div> <div id='consume-limit-set-background'> <button onclick="this.parentNode.style.display='none';">×</button> <div id='consume-limit-set-container'> <img id="clock-icon"> <h1>Consume limit</h1> <div id="time-input-holder"> <p class="arrow" id="decrease-time" style="padding-right: 1.5vw">‹</p> <input id="hours-input" min="0" max="5" placeholder="0"><span style="margin-right: 2vw">/hr</span> <input id="minutes-input" min="0" max="59" placeholder="00"><span>/min</span> <p class="arrow" id="increase-time" style="padding-left: 1.5vw">›</p> </div> <div hidden id="consume-limit-set-btn" class="button">Set time</div> </div> </div>`; | ||
| document.body.appendChild(youshieldContainer); | ||
| setTimeout(setConsumeButtonClickability, 0); | ||
| const searchInput = youshieldContainer.querySelector('form>div'); | ||
| function submitForm() { searchInput.parentElement.submit(); } | ||
| function manageInput(e) { | ||
| alert(3) | ||
| if (e.key === 'Enter') { e.preventDefault(); document.querySelector('input#search'); } | ||
| let elements = document.querySelectorAll('.gsfs'); | ||
| elements.forEach(function(element) { element.addEventListener('click', submitForm); }); | ||
| } | ||
| setupSearch(youshieldContainer); | ||
| function setupSearch(homepageContainer) { | ||
| const yt_input = document.querySelector('input#search'); | ||
| const yt_input = document.querySelector('input[name="search_query"]'); | ||
| if (!yt_input) { setTimeout(() => setupSearch(homepageContainer), 100); return; } | ||
| yt_input.value = ''; | ||
| const yt_searchForm = document.querySelector('.ytd-searchbox#search-form'); | ||
| yt_searchForm.style = 'max-height: 0px; overflow: hidden;'; | ||
| homepageContainer.appendChild(yt_searchForm); | ||
| const yt_searchForm = document.querySelector('.ytSearchboxComponentInputBox>.ytSearchboxComponentSearchForm'); | ||
| yt_searchForm.hidden = true; | ||
| homepageContainer.prepend(yt_searchForm); | ||
| homepageContainer.querySelector('form>div').appendChild(yt_input); | ||
| yt_input.addEventListener('keydown', manageInput); | ||
| youshield_searchForm = homepageContainer.querySelector('form>div'); | ||
| youshield_searchForm.appendChild(yt_input); | ||
| youshield_searchForm.parentElement.hidden = false; | ||
| } | ||
| function windowKeydown(e) { | ||
| window.removeEventListener('keydown', windowKeydown); | ||
| const x = document.querySelector('input#search'); | ||
| x.focus(); | ||
| x.dispatchEvent(new KeyboardEvent(e.type, e)); | ||
| } | ||
| window.addEventListener('keydown', windowKeydown); | ||
| youshieldContainer.addEventListener('mouseout', () => { document.querySelector('input#search').removeEventListener('keydown', manageInput) }); | ||
@@ -187,3 +175,3 @@ const dateString = curDate.toDateString(); | ||
| } | ||
| async function managePlayer() { | ||
@@ -195,3 +183,3 @@ let prevTime = 0; | ||
| if (localStorage.shieldConsumeMode == 'true') { | ||
| $video.addEventListener('timeupdate', (_) => { | ||
| $video.ontimeupdate = (_) => { | ||
| const timePassed = $video.currentTime - prevTime; | ||
@@ -209,5 +197,5 @@ if (timePassed < 4 && timePassed > 0) { | ||
| prevTime = $video.currentTime; | ||
| }); | ||
| }; | ||
| } else { | ||
| $video.addEventListener('timeupdate', (_) => { | ||
| $video.ontimeupdate = (_) => { | ||
| const timePassed = $video.currentTime - prevTime; | ||
@@ -218,3 +206,3 @@ if (timePassed < 4 && timePassed > 0) { | ||
| prevTime = $video.currentTime; | ||
| }); | ||
| }; | ||
| } | ||
@@ -221,0 +209,0 @@ } |
+4
-4
@@ -18,6 +18,6 @@ let searchButton = document.querySelector('.youshield-button.selected'); | ||
| document.getElementById('youshield-homepage').hidden = true; | ||
| let x = document.querySelector('.ytd-searchbox#search-form'); | ||
| x.style = ''; | ||
| x.querySelector('#search-input').appendChild(document.querySelector('#search-input>input')); | ||
| document.querySelector('ytd-searchbox').prepend(x); | ||
| let x = document.querySelector('form.ytSearchboxComponentSearchForm'); | ||
| x.hidden = false; | ||
| x.appendChild(document.querySelector('input[name="search_query"]')); | ||
| document.querySelector('div.ytSearchboxComponentInputBox').prepend(x); | ||
| document.documentElement.setAttribute('consume_mode', 'true'); | ||
@@ -24,0 +24,0 @@ document.getElementById('youshield-style').disabled = true; |
+1
-1
| { | ||
| "name": "YouShield - Remove YouTube Recommendations", | ||
| "version": "3.6", | ||
| "version": "3.6.4", | ||
| "description": "Clear YouTube recommendations, suggestions, shorts, and homepage", | ||
@@ -5,0 +5,0 @@ "permissions": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet