mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
fix: use window instead of (global as any)
This commit is contained in:
@ -40,11 +40,7 @@ const menuObserver = new MutationObserver(() => {
|
|||||||
setTimeout(() => doneFirstLoad ||= true, 500);
|
setTimeout(() => doneFirstLoad ||= true, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: re-enable once contextIsolation is set to true
|
window.download = () => {
|
||||||
// contextBridge.exposeInMainWorld("downloader", {
|
|
||||||
// download: () => {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
|
||||||
(global as any).download = () => {
|
|
||||||
let videoUrl = getSongMenu()
|
let videoUrl = getSongMenu()
|
||||||
// Selector of first button which is always "Start Radio"
|
// Selector of first button which is always "Start Radio"
|
||||||
?.querySelector('ytmusic-menu-navigation-item-renderer[tabindex="-1"] #navigation-endpoint')
|
?.querySelector('ytmusic-menu-navigation-item-renderer[tabindex="-1"] #navigation-endpoint')
|
||||||
|
|||||||
@ -89,8 +89,7 @@ const togglePictureInPicture = async () => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// For UI (HTML)
|
// For UI (HTML)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
window.togglePictureInPicture = togglePictureInPicture;
|
||||||
(global as any).togglePictureInPicture = togglePictureInPicture;
|
|
||||||
|
|
||||||
const listenForToggle = () => {
|
const listenForToggle = () => {
|
||||||
const originalExitButton = $<HTMLButtonElement>('.exit-fullscreen-button');
|
const originalExitButton = $<HTMLButtonElement>('.exit-fullscreen-button');
|
||||||
|
|||||||
@ -111,8 +111,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
setupSongControls();
|
setupSongControls();
|
||||||
|
|
||||||
// Add action for reloading
|
// Add action for reloading
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any
|
window.reload = () => ipcRenderer.send('reload');
|
||||||
(global as any).reload = () => ipcRenderer.send('reload');
|
|
||||||
|
|
||||||
// Blocks the "Are You Still There?" popup by setting the last active time to Date.now every 15min
|
// Blocks the "Are You Still There?" popup by setting the last active time to Date.now every 15min
|
||||||
setInterval(() => window._lact = Date.now(), 900_000);
|
setInterval(() => window._lact = Date.now(), 900_000);
|
||||||
|
|||||||
3
src/reset.d.ts
vendored
3
src/reset.d.ts
vendored
@ -18,6 +18,9 @@ declare global {
|
|||||||
*/
|
*/
|
||||||
_lact: number;
|
_lact: number;
|
||||||
navigation: Navigation;
|
navigation: Navigation;
|
||||||
|
download: () => void;
|
||||||
|
togglePictureInPicture: () => void;
|
||||||
|
reload: () => void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user