Template:Home/NowPlaying2: Difference between revisions

Template page
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
 
(16 intermediate revisions by the same user not shown)
Line 14: Line 14:
<!-- Put Your javascript here-->
<!-- Put Your javascript here-->
<script>
<script>
var videoIdList = [
</html>
</html>
var videoIdList = [
{{#for_external_table:
{{#for_external_table:
"{{{video_id2}}}",
"{{{video_id2}}}",
}}
}}
];
<html>
<html>
];
var shuffledList = videoIdList.sort(() => Math.random() - 0.5);
var shuffledList = videoIdList.sort(() => Math.random() - 0.5);
var button = document.querySelector("#ytButton");
var button = document.querySelector("#ytButton");
var player = document.querySelector("#video-source");
var player = document.querySelector("#video-source");
var video = document.getElementById('content-video');
button.addEventListener("click", playNext);
button.addEventListener("click", playNext);


Line 29: Line 30:
   var justPlayedVideo = shuffledList.shift();
   var justPlayedVideo = shuffledList.shift();
   shuffledList.push(justPlayedVideo);
   shuffledList.push(justPlayedVideo);
   player.src = shuffledList[0];
   player.src = shuffledList[0];
  video.load()
  video.play()
}
}



Latest revision as of 10:39, 13 September 2023

Now Playing