Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More performant YouTube Logo hide option. #135

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const CONFIG_KEY = 'ytaf-configuration';
const defaultConfig = {
hideLogo: false,
enableAdBlock: true,
enableSponsorBlock: true,
enableSponsorBlockSponsor: true,
Expand Down
19 changes: 19 additions & 0 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ uiContainer.addEventListener(

uiContainer.innerHTML = `
<h1>webOS YouTube Extended</h1>
<label for="__hide_logo"><input type="checkbox" id="__hide_logo" /> Hide YouTube Logo</label>
<label for="__adblock"><input type="checkbox" id="__adblock" /> Enable AdBlocking</label>
<label for="__sponsorblock"><input type="checkbox" id="__sponsorblock" /> Enable SponsorBlock</label>
<blockquote>
Expand All @@ -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);
Expand Down Expand Up @@ -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);