mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +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 = () => {
|
||||
const videoUrl = window.location.href;
|
||||
|
||||
@ -33,14 +41,9 @@ global.download = () => {
|
||||
},
|
||||
(error) => {
|
||||
triggerAction(CHANNEL, ACTIONS.ERROR, error);
|
||||
reinit();
|
||||
},
|
||||
() => {
|
||||
if (!progress) {
|
||||
console.warn("Cannot update progress");
|
||||
} else {
|
||||
progress.innerHTML = "Download";
|
||||
}
|
||||
}
|
||||
reinit
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user