Skip to content

Commit 4d4aadf

Browse files
committed
Re-init download button in case of error
1 parent 2937db3 commit 4d4aadf

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

plugins/downloader/front.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ const observer = new MutationObserver((mutations, observer) => {
1919
}
2020
});
2121

22+
const reinit = () => {
23+
if (!progress) {
24+
console.warn("Cannot update progress");
25+
} else {
26+
progress.innerHTML = "Download";
27+
}
28+
};
29+
2230
global.download = () => {
2331
const videoUrl = window.location.href;
2432

@@ -33,14 +41,9 @@ global.download = () => {
3341
},
3442
(error) => {
3543
triggerAction(CHANNEL, ACTIONS.ERROR, error);
44+
reinit();
3645
},
37-
() => {
38-
if (!progress) {
39-
console.warn("Cannot update progress");
40-
} else {
41-
progress.innerHTML = "Download";
42-
}
43-
}
46+
reinit
4447
);
4548
};
4649

0 commit comments

Comments
 (0)