mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
feat: run prettier
This commit is contained in:
@ -13,11 +13,12 @@ function overrideAddEventListener() {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
Element.prototype._addEventListener = Element.prototype.addEventListener;
|
||||
// Override addEventListener to Ignore specific events in volume-slider
|
||||
Element.prototype.addEventListener = function(type: string, listener: (event: Event) => void, useCapture = false) {
|
||||
if (!(
|
||||
ignored.id.includes(this.id)
|
||||
&& ignored.types.includes(type)
|
||||
)) {
|
||||
Element.prototype.addEventListener = function (
|
||||
type: string,
|
||||
listener: (event: Event) => void,
|
||||
useCapture = false,
|
||||
) {
|
||||
if (!(ignored.id.includes(this.id) && ignored.types.includes(type))) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
(this as any)._addEventListener(type, listener, useCapture);
|
||||
} else if (window.electronIs.dev()) {
|
||||
@ -29,11 +30,16 @@ function overrideAddEventListener() {
|
||||
export const overrideListener = () => {
|
||||
overrideAddEventListener();
|
||||
// Restore original function after finished loading to avoid keeping Element.prototype altered
|
||||
window.addEventListener('load', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
||||
Element.prototype.addEventListener = (Element.prototype as any)._addEventListener;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
||||
(Element.prototype as any)._addEventListener = undefined;
|
||||
|
||||
}, { once: true });
|
||||
window.addEventListener(
|
||||
'load',
|
||||
() => {
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access */
|
||||
Element.prototype.addEventListener = (
|
||||
Element.prototype as any
|
||||
)._addEventListener;
|
||||
(Element.prototype as any)._addEventListener = undefined;
|
||||
/* eslint-enable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access */
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user