From 4d4aadfdfc597015db62e0e2e9948aa63d7ec2ff Mon Sep 17 00:00:00 2001 From: TC Date: Sun, 22 Nov 2020 10:23:20 +0100 Subject: [PATCH] Re-init download button in case of error --- plugins/downloader/front.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/downloader/front.js b/plugins/downloader/front.js index 37f28f8e..a342c77f 100644 --- a/plugins/downloader/front.js +++ b/plugins/downloader/front.js @@ -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 ); };