From 099e347e15f87ca757f206c20f77b1fdeb8e887f Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 23 Apr 2015 09:20:34 +0200 Subject: [PATCH] gallery-view: preloading images, webm support --- js/gallery-view.js | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/js/gallery-view.js b/js/gallery-view.js index 65a1e967..2d7d85b4 100644 --- a/js/gallery-view.js +++ b/js/gallery-view.js @@ -95,7 +95,7 @@ $(function(){ $('#gallery_images img.active').removeClass('active'); - var thumb = $('#gallery_images img[data-galid-th="'+a+'"]'); + var thumb = $('#gallery_images [data-galid-th="'+a+'"]'); var elem = $('a[data-galid="'+a+'"]'); thumb.addClass('active'); @@ -107,16 +107,42 @@ $(function(){ var img = elem.attr('href'); - active.find('img').fadeOut(200, function() { $(this).remove(); }); + active.find('img, video').fadeOut(200, function() { $(this).remove(); }); - var i = $(''); - i.attr('src', img); - i.appendTo(active); - i.hide(); + var i; + if (img.match(/player\.php/)) { + img = img.replace(/.*player\.php\?v=|&t=.*/g, ''); + } + if (img.match(/\.webm$|\.mp4$|\.ogv$/i)) { // We are handling video nao + i = $('