From b4d206ccca03bbfa8f4030efe5d4178bfc02683a Mon Sep 17 00:00:00 2001 From: Set Hallstrom Date: Thu, 16 Jul 2020 15:49:05 +0200 Subject: [PATCH] make radio play open links in new tab --- index.html | 7 ++++++- radio.html | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index f737067..869373e 100644 --- a/index.html +++ b/index.html @@ -95,6 +95,7 @@ logo_image: /siteicon.png var mu = document.getElementsByTagName("audio")[0]; var pauseButton = document.getElementById("mu_pause"); var spincover = document.getElementById("coverart"); + var links = document.getElementsByTagName('a'); mu.addEventListener('ended', function () { // only functional if "loop" is removed @@ -108,6 +109,9 @@ logo_image: /siteicon.png pauseButton.classList.add("fa-pause"); spincover.classList.add("spinnit"); spincover.classList.remove("paused"); + for (var i=0, len=links.length; i < len; i++) { + links[i].target = '_blank'; + } }; pauseButton.addEventListener("click", function () { @@ -121,6 +125,7 @@ logo_image: /siteicon.png pauseButton.classList.add("fa-play"); pauseButton.classList.remove("fa-pause"); spincover.classList.add("paused"); + } }); @@ -229,7 +234,7 @@ logo_image: /siteicon.png
diff --git a/radio.html b/radio.html index 699f25e..bb436db 100644 --- a/radio.html +++ b/radio.html @@ -97,6 +97,7 @@ layout: default var mu = document.getElementsByTagName("audio")[0]; var pauseButton = document.getElementById("mu_pause"); var spincover = document.getElementById("coverart"); + var links = document.getElementsByTagName('a'); mu.addEventListener('ended', function () { // only functional if "loop" is removed @@ -110,6 +111,9 @@ layout: default pauseButton.classList.add("fa-pause"); spincover.classList.add("spinnit"); spincover.classList.remove("paused"); + for (var i=0, len=links.length; i < len; i++) { + links[i].target = '_blank'; + } }; pauseButton.addEventListener("click", function () {