Fix first run
This commit is contained in:
6
index.js
6
index.js
@@ -102,6 +102,7 @@ const createVidList = () => {
|
|||||||
|
|
||||||
var hls = null;
|
var hls = null;
|
||||||
var currentVideoIndex = 0;
|
var currentVideoIndex = 0;
|
||||||
|
var firstRun = true;
|
||||||
if(window.location.hash) {
|
if(window.location.hash) {
|
||||||
let hash = window.location.hash;
|
let hash = window.location.hash;
|
||||||
if(hash.startsWith('#playlistEntry')) {
|
if(hash.startsWith('#playlistEntry')) {
|
||||||
@@ -113,9 +114,12 @@ if(window.location.hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const changeVid = index => {
|
const changeVid = index => {
|
||||||
if (index === currentVideoIndex){
|
if (index === currentVideoIndex && !firstRun){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(firstRun) {
|
||||||
|
firstRun = false;
|
||||||
|
}
|
||||||
let oldSelectedVideo = document.querySelector(`#playlistEntry${currentVideoIndex}`);
|
let oldSelectedVideo = document.querySelector(`#playlistEntry${currentVideoIndex}`);
|
||||||
oldSelectedVideo.classList.remove("bg-dark");
|
oldSelectedVideo.classList.remove("bg-dark");
|
||||||
oldSelectedVideo.classList.remove("text-light");
|
oldSelectedVideo.classList.remove("text-light");
|
||||||
|
|||||||
Reference in New Issue
Block a user