diff --git a/video/ard_download_button.user.js b/video/ard_download_button.user.js index 3449715..5660975 100644 --- a/video/ard_download_button.user.js +++ b/video/ard_download_button.user.js @@ -2,7 +2,7 @@ // @name ARD download button // @description Adds a download-button for every video on ardmediathek.de. // @description:de Fügt einen download-button für jedes video auf ardmediathek.de hinzu. -// @version 2019.06.22.9 +// @version 2019.06.22.10 // @author tastytea // @copyright 2019, tastytea (https://tastytea.de/) // @license GPL-3.0-only @@ -16,19 +16,13 @@ // @inject-into content // ==/UserScript== -let interval; -let counter = 0; - function main() { - // Stop if button is already there or after 10 tries. - if (document.getElementById("tastytea_downloadbutton") !== null - || counter >= 10) + // Stop if button is already there. + if (document.getElementById("tastytea_downloadbutton") !== null) { - clearInterval(interval); return; } - ++counter; const url = get_url(); if (url === null) @@ -82,4 +76,4 @@ function add_button(url) root.appendChild(div); } -interval = setInterval(main, 2000); +setInterval(main, 2000); // The script is not restarted when clicking on a link.