From d4bdea2f3b1b6bf9c739a88556143b64a2f7e437 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 22 Jun 2019 05:15:58 +0200 Subject: [PATCH] ard_download_button: Run forever. --- video/ard_download_button.user.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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.