From 09a9b97774d63bd3ab538e8bede0a8de3f1fccc3 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Fri, 15 Dec 2017 14:56:13 +0300 Subject: [PATCH] =?UTF-8?q?KSPlayer:=20=D0=A3=D0=B1=D0=B8=D1=80=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B2=D1=81=D1=91=20=D0=BB=D0=B8=D1=88=D0=BD?= =?UTF-8?q?=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kinosearch/webapp/static/js/ksplayer.js | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) 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; - } - } - } }