KSPlayer: выбор серий из меню
This commit is contained in:
@@ -7,6 +7,8 @@ const KSPlayer = function(containerId, data) {
|
|||||||
|
|
||||||
let titleElement;
|
let titleElement;
|
||||||
let seasonSerials = [];
|
let seasonSerials = [];
|
||||||
|
const _self = this;
|
||||||
|
let lastActiveSerialItem;
|
||||||
|
|
||||||
/* --- PRIVATE FUNCTIONS --- */
|
/* --- PRIVATE FUNCTIONS --- */
|
||||||
|
|
||||||
@@ -40,8 +42,21 @@ const KSPlayer = function(containerId, data) {
|
|||||||
let a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.href = '#';
|
a.href = '#';
|
||||||
a.innerText = item.title;
|
a.innerText = item.title;
|
||||||
a.setAttribute('data-file', item.file);
|
a.onclick = function() {
|
||||||
a.onclick = function() { return false; }
|
text.nodeValue = item.title;
|
||||||
|
console.log(text);
|
||||||
|
_self.setTitle(item.title);
|
||||||
|
|
||||||
|
if (lastActiveSerialItem) {
|
||||||
|
lastActiveSerialItem.classList.remove('active');
|
||||||
|
}
|
||||||
|
li.classList.add('active');
|
||||||
|
lastActiveSerialItem = li;
|
||||||
|
|
||||||
|
setSource(item.file);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
ul.appendChild(li);
|
ul.appendChild(li);
|
||||||
@@ -171,6 +186,10 @@ const KSPlayer = function(containerId, data) {
|
|||||||
return videoElement;
|
return videoElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSource(source) {
|
||||||
|
videoElement.src = source;
|
||||||
|
}
|
||||||
|
|
||||||
/* --- CONSTRUCTOR --------- */
|
/* --- CONSTRUCTOR --------- */
|
||||||
|
|
||||||
const containerElement = document.getElementById(containerId);
|
const containerElement = document.getElementById(containerId);
|
||||||
|
|||||||
Reference in New Issue
Block a user