Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fire332 committed Apr 1, 2024
2 parents c506a8d + 302df04 commit 7826adf
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]
## [0.3.3] - 2024/03/31

### Added

- [#142](https://github.com/webosbrew/youtube-webos/pull/141): Blocked some additional ads (@throwaway96)
- [#144](https://github.com/webosbrew/youtube-webos/pull/144): Added support for config change listeners (@throwaway96)
- [#149](https://github.com/webosbrew/youtube-webos/pull/149): Added ability to hide YouTube logo (@throwaway96; thanks to @fire332 and @tomikaka22)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion assets/appinfo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "youtube.leanback.v4",
"version": "0.3.2",
"version": "0.3.3",
"vendor": "webosbrew.org",
"type": "web",
"main": "index.html",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "youtube-webos",
"version": "0.3.2",
"version": "0.3.3",
"description": "Ad-free YouTube app for webOS",
"type": "module",
"main": "index.js",
Expand Down
7 changes: 7 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ const configOptions = new Map([
default: true,
desc: 'Skip music and off-topic segments'
}
],
[
'hideLogo',
{
default: false,
desc: 'Hide YouTube logo'
}
]
]);

Expand Down
35 changes: 31 additions & 4 deletions src/ui.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/*global navigate*/
import './spatial-navigation-polyfill.js';
import {
configAddChangeListener,
configRead,
configWrite,
configGetDesc
} from './config.js';
import './ui.css';
import { configRead, configWrite, configGetDesc } from './config.js';

// We handle key events ourselves.
window.__spatialNavigation__.keyMode = 'NONE';
Expand Down Expand Up @@ -115,6 +120,7 @@ function createOptionsPanel() {
elmContainer.appendChild(elmHeading);

elmContainer.appendChild(createConfigCheckbox('enableAdBlock'));
elmContainer.appendChild(createConfigCheckbox('hideLogo'));
elmContainer.appendChild(createConfigCheckbox('enableSponsorBlock'));

const elmBlock = document.createElement('blockquote');
Expand Down Expand Up @@ -218,9 +224,25 @@ export function showNotification(text, time = 3000) {
}, time);
}

setTimeout(() => {
showNotification('Press [GREEN] to open YTAF configuration screen');
}, 2000);
/**
* Initialize ability to hide YouTube logo in top right corner.
*/
function initHideLogo() {
const style = document.createElement('style');
document.head.appendChild(style);

/** @type {(hide: boolean) => void} */
const setHidden = (hide) => {
const visibility = hide ? 'hidden' : 'visible';
style.textContent = `ytlr-redux-connect-ytlr-logo-entity { visibility: ${visibility}; }`;
};

setHidden(configRead('hideLogo'));

configAddChangeListener('hideLogo', (evt) => {
setHidden(evt.detail.newValue);
});
}

function applyUIFixes() {
try {
Expand Down Expand Up @@ -252,3 +274,8 @@ function applyUIFixes() {
}

applyUIFixes();
initHideLogo();

setTimeout(() => {
showNotification('Press [GREEN] to open YTAF configuration screen');
}, 2000);

0 comments on commit 7826adf

Please sign in to comment.