diff --git a/src/main/resources/kinosearch/webapp/static/js/ksplayer.js b/src/main/resources/kinosearch/webapp/static/js/ksplayer.js index 3091951..3596747 100644 --- a/src/main/resources/kinosearch/webapp/static/js/ksplayer.js +++ b/src/main/resources/kinosearch/webapp/static/js/ksplayer.js @@ -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; - } - } - } }