From e2e47fdc54b550c783c263c8b23fd9849b3bf8d8 Mon Sep 17 00:00:00 2001 From: Nishanth Date: Fri, 4 Mar 2016 13:56:22 +0100 Subject: [PATCH] styling subtitles options dropdown --- video-controlbar.html | 52 ++++++++++++++++++++++++++----------------- video-player.html | 17 ++++++++++++-- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/video-controlbar.html b/video-controlbar.html index 5678547..8c0f635 100755 --- a/video-controlbar.html +++ b/video-controlbar.html @@ -124,19 +124,25 @@ border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: white; + z-index: 9999; } .languageselectionentry { color: rgba(255, 255, 255, 0.3); } - + .languageselectionentry:hover{ + color: rgba(255, 255, 255, 0.6); + } #subtitlesButton { color: rgba(255, 255, 255, 0.3); } - + #subtitlesButton:hover { + color: rgba(255, 255, 255, 0.6); + } .video-dropdown-menu { color: rgba(255, 255, 255, 0.3); } + @@ -161,7 +167,7 @@ - + @@ -227,7 +233,7 @@ type: String, value: 'av:play-arrow', notify: true - } + }, }, listeners: { @@ -243,6 +249,7 @@ this.currentSubLang=''; this.showSubtitlesMenu=false; this.showSubtitlesChanged(); + this.timeoutTime=3000; }, // Called from video-player element @@ -352,27 +359,32 @@ this.isFullscreen = !this.isFullscreen; }, + showSubtitlesOptions: function() { this.showSubtitlesMenu=!this.showSubtitlesMenu; - if(this.showSubtitlesMenu) { - this.querySelector(".video-dropdown-menu").style.display="block"; + this.querySelector(".video-dropdown-menu").style.display="block"; + if(this.setDropdownTimer) { + window.clearTimeout(this.timeoutHandle); + this.timeoutHandle = window.setTimeout(this.func, this.timeoutTime); + this.dropClicked=false; + this.setDropdownTimer=true; } else { - this.querySelector(".video-dropdown-menu").style.display="none"; + this.timeoutHandle = setTimeout(this.func = function () { + if(!document.querySelector("video-controlbar").dropClicked) { + document.querySelector("video-controlbar").showSubtitlesMenu=!document.querySelector("video-controlbar").showSubtitlesMenu; + document.querySelector(".video-dropdown-menu").style.display="none"; + document.querySelector("video-controlbar").setDropdownTimer=false; + } else { + window.clearTimeout(this.timeoutHandle); + this.timeoutHandle = window.setTimeout( document.querySelector("video-controlbar").func, this.timeoutTime); + document.querySelector("video-controlbar").dropClicked=false; + document.querySelector("video-controlbar").setDropdownTimer=true; + } + }, this.timeoutTime); + this.dropClicked = false; + this.setDropdownTimer=true; } - var func; - - var timeoutHandle = setTimeout(func = function () { - if(!document.querySelector("video-controlbar").dropClicked) { - document.querySelector("video-controlbar").showSubtitlesMenu=!document.querySelector("video-controlbar").showSubtitlesMenu; - document.querySelector(".video-dropdown-menu").style.display="none"; - } else { - window.clearTimeout(timeoutHandle); - timeoutHandle = window.setTimeout(func, 3000); - document.querySelector("video-controlbar").dropClicked=false; - } - }, 3000); - this.dropClicked = false; }, changeSubtitles: function(event) { diff --git a/video-player.html b/video-player.html index 20eb3d9..7346106 100755 --- a/video-player.html +++ b/video-player.html @@ -273,18 +273,31 @@ subtitlesBindings: function() { //assuming the first video stream has the subs tracks var trackElements = (this.getEffectiveChildren()[0]).getEffectiveChildNodes(); - for (var i=0; i