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