Fix first run

This commit is contained in:
2019-03-23 12:50:44 +00:00
parent 53f008136e
commit b0f64a2949

View File

@@ -102,6 +102,7 @@ const createVidList = () => {
var hls = null;
var currentVideoIndex = 0;
var firstRun = true;
if(window.location.hash) {
let hash = window.location.hash;
if(hash.startsWith('#playlistEntry')) {
@@ -113,9 +114,12 @@ if(window.location.hash) {
}
const changeVid = index => {
if (index === currentVideoIndex){
if (index === currentVideoIndex && !firstRun){
return;
}
if(firstRun) {
firstRun = false;
}
let oldSelectedVideo = document.querySelector(`#playlistEntry${currentVideoIndex}`);
oldSelectedVideo.classList.remove("bg-dark");
oldSelectedVideo.classList.remove("text-light");