From: Jérémy Fabre Date: Fri, 10 Feb 2017 09:38:52 +0000 (+0100) Subject: Video overlay now stop when closed. Added a spinner. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d0cdf7d1553269c9085f277bc4309eae0bd4939a;p=mezzo.git Video overlay now stop when closed. Added a spinner. --- diff --git a/app/static/src/js/modules/video-overlay.js b/app/static/src/js/modules/video-overlay.js index 15eb72f8..ab99782d 100644 --- a/app/static/src/js/modules/video-overlay.js +++ b/app/static/src/js/modules/video-overlay.js @@ -2,6 +2,8 @@ var VideoOverlay = function() { this.$overlay = $('#overlay'); this.$overlayContent = $('#overlayContent'); + this.$overlayClose = $('#overlayClose'); + this.$overlayLoader = $('#overlayLoader'); // // Init @@ -14,9 +16,30 @@ VideoOverlay.prototype.init = function() { var that = this; + $(document).keyup(function(e) { + + if(e.keyCode === 27) { + + that.closeOverlay(); + + } + + }); + + that.$overlayClose.bind('click', function(e) { + + e.preventDefault(); + + that.closeOverlay(); + + return false; + + }); + $('[data-video-overlay]').click(function(e) { e.preventDefault(); + that.$overlayLoader.show(); that.openOverlay(this.href); return false; @@ -34,6 +57,7 @@ VideoOverlay.prototype.openOverlay = function(url) { window['Video'].init(); setTimeout(function() { + that.$overlayLoader.hide(); that.$overlayContent.addClass('loaded'); }, 2000); @@ -41,4 +65,16 @@ VideoOverlay.prototype.openOverlay = function(url) { }; +VideoOverlay.prototype.closeOverlay = function(url) { + + var that = this; + + that.$overlayContent.removeClass('loaded'); + setTimeout(function() { + that.$overlayContent.html(''); + that.$overlay.removeClass('open'); + }, 1000); + +}; + module.exports = VideoOverlay; diff --git a/app/static/src/sass/modules/_overlay.scss b/app/static/src/sass/modules/_overlay.scss index e53752bb..6f8b794f 100644 --- a/app/static/src/sass/modules/_overlay.scss +++ b/app/static/src/sass/modules/_overlay.scss @@ -107,4 +107,34 @@ $module: ".overlay"; } + &__loader { + + position: absolute; + top: 50%; + left: 50%; + z-index: 10; + margin-left: -30px; + margin-top: -30px; + + .loading { + + height: 60px; + width: 60px; + display: block; + animation: rotation 1s infinite linear; + border: 1px solid rgba(255, 255, 255, 0.2); + border-top-color: rgba(255, 255, 255, 0.7); + border-radius: 50%; + margin: auto; + + } + + } + +} + +@keyframes rotation { + to { + transform: rotate(360deg); + } } diff --git a/app/templates/base.html b/app/templates/base.html index bc89735c..57cd77b4 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -96,14 +96,17 @@ -
- +
+
+
+ +
diff --git a/app/templates/media/overlay_detail.html b/app/templates/media/overlay_detail.html index fa065db3..97a2e907 100644 --- a/app/templates/media/overlay_detail.html +++ b/app/templates/media/overlay_detail.html @@ -36,7 +36,17 @@ {% with media as object %}
- {% include "includes/share_buttons.html" %} +
{% endwith %}