Skip to content

Commit

Permalink
fix quality settings applying
Browse files Browse the repository at this point in the history
  • Loading branch information
GooseOb committed May 13, 2024
1 parent d8ed995 commit c25bd57
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ const findInNodeList = <T extends HTMLElement>(
};

const ytMenu: YtMenu = {
updatePlayer(plr: HTMLElement) {
async updatePlayer(plr: HTMLElement) {
this.element = plr.querySelector('.ytp-settings-menu');
this._btn = plr.querySelector('.ytp-settings-button');
restoreFocusAfter(() => {
this._btn.click();
this._btn.click();
});
const clickBtn = this._btn.click.bind(this._btn);
restoreFocusAfter(clickBtn);
await delay(50);
restoreFocusAfter(clickBtn);
},
element: null,
_btn: null,
Expand Down Expand Up @@ -392,7 +392,7 @@ const onPageChange = async () => {
await delay(1_000);
const getAd = () => plr.querySelector('.ytp-ad-player-overlay');
if (getAd()) await until(getAd, (ad) => !ad, 200_000);
ytMenu.updatePlayer(plr);
await ytMenu.updatePlayer(plr);
const getMenuItems = () =>
ytMenu.element.querySelectorAll<YtSettingItem>(
'.ytp-menuitem[role="menuitem"]'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yt-defaulter",
"author": "GooseOb",
"version": "1.9.3",
"version": "1.9.4",
"repository": {
"type": "git",
"url": "git+https://github.com/GooseOb/YT-Defaulter.git"
Expand Down
2 changes: 1 addition & 1 deletion types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type YtSettingItem = HTMLDivElement & { role: 'menuitem' };
type YtMenu = {
element: HTMLElement & ParentNode;
_btn: HTMLElement;
updatePlayer(plr: HTMLElement): void;
updatePlayer(plr: HTMLElement): Promise<void>;
isOpen(): boolean;
setOpen(bool: boolean): void;
openItem(this: YtMenu, item: YtSettingItem): NodeListOf<HTMLElement>;
Expand Down

0 comments on commit c25bd57

Please sign in to comment.