0

KSPlayer: заполнение меню сезонов

This commit is contained in:
2017-12-13 21:52:27 +03:00
parent bbc891b83b
commit 3fb1d8fb62

View File

@@ -6,6 +6,7 @@ const KSPlayer = function(containerId, data) {
/* --- PRIVATE FIELDS ------ */ /* --- PRIVATE FIELDS ------ */
let titleElement; let titleElement;
let seasonSerials = [];
/* --- PRIVATE FUNCTIONS --- */ /* --- PRIVATE FUNCTIONS --- */
@@ -54,7 +55,7 @@ const KSPlayer = function(containerId, data) {
return div; return div;
} }
function createSeasonMenuElement() { function createSeasonMenuElement(seasons) {
let div = document.createElement('div'); let div = document.createElement('div');
div.id = 'pl-season'; div.id = 'pl-season';
div.className = 'dropdown'; div.className = 'dropdown';
@@ -79,13 +80,19 @@ const KSPlayer = function(containerId, data) {
ul.className = 'dropdown-menu'; ul.className = 'dropdown-menu';
ul.setAttribute('aria-labelledby', 'dropdownSeason'); ul.setAttribute('aria-labelledby', 'dropdownSeason');
seasons.forEach((item, idx) => {
let li = document.createElement('li'); let li = document.createElement('li');
let a = document.createElement('a'); let a = document.createElement('a');
a.href = '#'; a.href = '#';
a.innerText = 'Season'; a.innerText = item.title;
a.setAttribute('data-number', idx);
a.onclick = function() { return false; }
seasonSerials.push(createSerialMenuElement(item.serials));
li.appendChild(a); li.appendChild(a);
ul.appendChild(li); ul.appendChild(li);
});
button.appendChild(text); button.appendChild(text);
button.appendChild(span); button.appendChild(span);
div.appendChild(button); div.appendChild(button);
@@ -121,11 +128,13 @@ const KSPlayer = function(containerId, data) {
containerElement.appendChild(serialMenu); containerElement.appendChild(serialMenu);
containerElement.appendChild(document.createElement('br')); containerElement.appendChild(document.createElement('br'));
containerElement.appendChild(document.createElement('br')); containerElement.appendChild(document.createElement('br'));
} else if (data.type === 'seasons_serial') {
let seasonMenu = createSeasonMenuElement(data.seasons);
containerElement.appendChild(seasonMenu);
containerElement.appendChild(document.createElement('br'));
containerElement.appendChild(document.createElement('br'));
} }
// let seasonMenu = createSeasonMenuElement();
// containerElement.appendChild(seasonMenu);
containerElement.appendChild(videoElement); containerElement.appendChild(videoElement);
/* --- FUNCTIONS ----------- */ /* --- FUNCTIONS ----------- */