/* * MA5Gallery * v 1.6 * Copyright (c) 2015 Tomasz Kalinowski * http://galeria.ma5.pl * GitHub: https://github.com/ma-5/ma5-gallery */ ; jQuery.fn.ma5preload = function() { jQuery('body').append('
'); this.each(function(){ if (typeof jQuery(this).data('ma5pathtofull') !== "undefined") { jQuery(this).clone().attr('src', jQuery(this).data('ma5pathtofull')).appendTo('.ma5-preloadbox'); } else { jQuery(this).clone().attr('src', jQuery(this).attr('src').replace(/\-thumbnail./, '.')).appendTo('.ma5-preloadbox'); } }); } function ma5showActive() { jQuery('.ma5-imgbox').addClass('ma5-previous'); setTimeout(function() {jQuery('.ma5-imgbox.ma5-previous').remove();jQuery('body').removeClass('ma5-in');}, 1000); if (typeof jQuery('.ma5-active img').data('ma5pathtofull') !== "undefined") { var ma5clone = jQuery('.ma5-active img').clone().attr('src', jQuery('.ma5-active img').data('ma5pathtofull')).addClass('ma5-clone'); } else { var ma5clone = jQuery('.ma5-active img').clone().attr('src', jQuery('.ma5-active img').attr('src').replace(/\-thumbnail./, '.')).addClass('ma5-clone'); }; jQuery('body').addClass('ma5-in').append(''); ma5showFigcaption(); ma5hideFigcaption(); jQuery(ma5clone).appendTo(jQuery('.ma5-imgbox').last()); } function ma5exit() { jQuery('figure').removeClass('ma5-active'); jQuery('.ma5-imgbox').addClass('ma5-out'); jQuery('.ma5-tmp').addClass('ma5-out'); jQuery('.ma5-prev, .ma5-next').remove(); jQuery('.ma5-figcaption').addClass('ma5-out'); setTimeout(function() { jQuery('.ma5-tmp').remove(); jQuery('.ma5-imgbox').remove(); jQuery('body').removeClass('ma5-gallery-active'); jQuery('.ma5-figcaption').remove()}, 800); } function ma5hideActive() { jQuery('.ma5-imgbox').on('touch click', function() { ma5exit(); }); } function ma5goPrev() { if(jQuery('.ma5-tmp .ma5-active').prev().length) { jQuery('.ma5-tmp .ma5-active').removeClass('ma5-active').prev().addClass('ma5-active'); ma5showActive(); ma5hideActive(); } } function ma5goNext() { if(jQuery('.ma5-tmp .ma5-active').next().length) { jQuery('.ma5-tmp .ma5-active').removeClass('ma5-active').next().addClass('ma5-active'); ma5showActive(); ma5hideActive(); } } function ma5showFigcaption() { if( jQuery('.ma5-active').has('figcaption').length ) { jQuery('.ma5-figcaption').removeClass('ma5-figcaption').addClass('ma5-figcaption-old'); jQuery('body').append('