Skip to content

Commit 5df5bc1

Browse files
committed
fix: auto close continue confirm
1 parent 7c75d24 commit 5df5bc1

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/plugins/youtube-music-background-play/userscript.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,22 @@ export function nonStop() {
6767
}
6868

6969
// console.log('[Youtube Music] Setting up observer for video element')
70-
observe(document.documentElement, 'video', {
71-
onMatch([video]) {
72-
if (video instanceof HTMLVideoElement) {
73-
watchMediaElement(video)
74-
}
70+
observe(
71+
document.documentElement,
72+
'video,ytmusic-you-there-renderer:not([aria-hidden="true"]) button[aria-label="Yes"]',
73+
{
74+
onMatch([element]) {
75+
if (element instanceof HTMLVideoElement) {
76+
watchMediaElement(element)
77+
}
78+
if (element instanceof HTMLButtonElement) {
79+
console.log('Auto-closing "Are you there?" dialog via observer')
80+
setTimeout(() => {
81+
element.click()
82+
console.log('Clicked "Yes" button')
83+
}, 100)
84+
}
85+
},
7586
},
76-
})
87+
)
7788
}

0 commit comments

Comments
 (0)