From c2a743840ae431fd6c5540beeaaf480fb9953080 Mon Sep 17 00:00:00 2001 From: tomikaka22 Date: Sat, 2 Mar 2024 00:02:13 +0100 Subject: [PATCH] More performant YouTube Logo hide option. --- src/config.js | 1 + src/ui.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/config.js b/src/config.js index a93ffe28..e57dcde2 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,6 @@ const CONFIG_KEY = 'ytaf-configuration'; const defaultConfig = { + hideLogo: false, enableAdBlock: true, enableSponsorBlock: true, enableSponsorBlockSponsor: true, diff --git a/src/ui.js b/src/ui.js index 4bce127e..a01bd529 100644 --- a/src/ui.js +++ b/src/ui.js @@ -47,6 +47,7 @@ uiContainer.addEventListener( uiContainer.innerHTML = `

webOS YouTube Extended

+
@@ -62,6 +63,12 @@ uiContainer.innerHTML = ` document.querySelector('body').appendChild(uiContainer); +uiContainer.querySelector('#__hide_logo').checked = configRead('hideLogo'); +uiContainer.querySelector('#__hide_logo').addEventListener('change', (evt) => { + configWrite('hideLogo', evt.target.checked); + logoHideShow(); +}); + uiContainer.querySelector('#__adblock').checked = configRead('enableAdBlock'); uiContainer.querySelector('#__adblock').addEventListener('change', (evt) => { configWrite('enableAdBlock', evt.target.checked); @@ -190,6 +197,18 @@ export function showNotification(text, time = 3000) { }, time); } +// Hide youtube logo from the top right +function logoHideShow() { + document.querySelector('ytlr-redux-connect-ytlr-logo-entity').style.opacity = + configRead('hideLogo') ? '0' : '1'; +} + setTimeout(() => { showNotification('Press [GREEN] to open YTAF configuration screen'); + logoHideShow(); }, 2000); + +logoHideShow(); +setTimeout(() => { + logoHideShow(); +}, 4000);