ccc_media_player_down: Move above the share-widget.

because “Related” is not always there.
This commit is contained in:
tastytea 2019-08-10 17:33:08 +02:00
parent 480bf91811
commit a1104d5fdc
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@
// @name CCC-media video-player down-mover // @name CCC-media video-player down-mover
// @description Moves video-players on media.ccc.de below the download-hyperlinks. // @description Moves video-players on media.ccc.de below the download-hyperlinks.
// @description:de Verschiebt video-player auf media.ccc.de unter die download-hyperlinks. // @description:de Verschiebt video-player auf media.ccc.de unter die download-hyperlinks.
// @version 2019.06.18.1 // @version 2019.08.10.1
// @author tastytea // @author tastytea
// @copyright 2019, tastytea (https://tastytea.de/) // @copyright 2019, tastytea (https://tastytea.de/)
// @license GPL-3.0-only // @license GPL-3.0-only
@ -25,15 +25,15 @@ function main()
return; return;
} }
// Move player between “Download” and “Related”. const share = document.getElementsByClassName("share")[0];
for (let heading of document.getElementsByTagName("h3")) if (player === undefined)
{ {
if (heading.textContent === "Related") console.error("Share-widget not found.");
{ return;
heading.parentElement.insertBefore(player, heading);
break;
}
} }
// Move player just above the share-widget.
share.parentElement.insertBefore(player, share);
} }
main(); main();