mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
Re-init download button in case of error
This commit is contained in:
@ -19,6 +19,14 @@ const observer = new MutationObserver((mutations, observer) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const reinit = () => {
|
||||||
|
if (!progress) {
|
||||||
|
console.warn("Cannot update progress");
|
||||||
|
} else {
|
||||||
|
progress.innerHTML = "Download";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
global.download = () => {
|
global.download = () => {
|
||||||
const videoUrl = window.location.href;
|
const videoUrl = window.location.href;
|
||||||
|
|
||||||
@ -33,14 +41,9 @@ global.download = () => {
|
|||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
triggerAction(CHANNEL, ACTIONS.ERROR, error);
|
triggerAction(CHANNEL, ACTIONS.ERROR, error);
|
||||||
|
reinit();
|
||||||
},
|
},
|
||||||
() => {
|
reinit
|
||||||
if (!progress) {
|
|
||||||
console.warn("Cannot update progress");
|
|
||||||
} else {
|
|
||||||
progress.innerHTML = "Download";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user