ndr_download_button: Do not add button if there is one already.

This commit is contained in:
tastytea 2019-06-17 13:47:21 +02:00
parent a28fe215e3
commit 0c9abd4fb8
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@
// @name NDR download button
// @description Adds a download-button for every video and audio on ndr.de.
// @description:de Fügt einen download-button für jedes videos und audio auf ndr.de hinzu.
// @version 2019.06.17.2
// @version 2019.06.17.3
// @author tastytea
// @copyright 2019, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
@ -39,6 +39,14 @@ function add_button(parent, url)
{
buttontext += " HD";
}
else
{
// If there is already an equivalent download-button, do nothing.
if (document.getElementsByClassName("button download").length > 0)
{
return;
}
}
const button = document.createElement("a");
button.setAttribute("class", "button download");