KSPlayer: Убираем всё лишнее
This commit is contained in:
@@ -45,7 +45,7 @@ const KSPlayer = function(containerId, data) {
|
||||
a.innerText = item.title;
|
||||
a.onclick = function() {
|
||||
text.nodeValue = item.title;
|
||||
_self.setTitle(item.title);
|
||||
setTitle(item.title);
|
||||
|
||||
if (lastActiveSerialItem) {
|
||||
lastActiveSerialItem.classList.remove('active');
|
||||
@@ -207,6 +207,23 @@ const KSPlayer = function(containerId, data) {
|
||||
videoElement.src = source;
|
||||
}
|
||||
|
||||
function setTitle(text) {
|
||||
if (text) {
|
||||
if (!titleElement) initTitleElement();
|
||||
titleElement.innerText = text;
|
||||
|
||||
if (!isShowTitle) {
|
||||
containerElement.insertBefore(titleElement, videoElement);
|
||||
isShowTitle = true;
|
||||
}
|
||||
} else {
|
||||
if (isShowTitle && titleElement) {
|
||||
containerElement.removeChild(titleElement);
|
||||
isShowTitle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --- CONSTRUCTOR --------- */
|
||||
|
||||
const containerElement = document.getElementById(containerId);
|
||||
@@ -237,27 +254,4 @@ const KSPlayer = function(containerId, data) {
|
||||
}
|
||||
|
||||
containerElement.appendChild(videoElement);
|
||||
|
||||
/* --- FUNCTIONS ----------- */
|
||||
|
||||
this.getType = function() {
|
||||
return videoType;
|
||||
}
|
||||
|
||||
this.setTitle = function(text) {
|
||||
if (text) {
|
||||
if (!titleElement) initTitleElement();
|
||||
titleElement.innerText = text;
|
||||
|
||||
if (!isShowTitle) {
|
||||
containerElement.insertBefore(titleElement, videoElement);
|
||||
isShowTitle = true;
|
||||
}
|
||||
} else {
|
||||
if (isShowTitle && titleElement) {
|
||||
containerElement.removeChild(titleElement);
|
||||
isShowTitle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user