diff --git a/assets/css/customizer.css b/assets/css/customizer.css index b60112e9..ee9adc8d 100644 --- a/assets/css/customizer.css +++ b/assets/css/customizer.css @@ -1,3 +1,12 @@ +li[id*="accordion-panel-onepress"] > .accordion-section-title{ + padding-left: 30px; +} +li#accordion-panel-onepress_options > .accordion-section-title, +li#accordion-panel-onepress_typo > .accordion-section-title +{ + padding-left: 14px; +} + .theme-action-count { padding: 0 6px; display: inline-block; diff --git a/assets/js/lightgallery.js b/assets/js/lightgallery.js index 4301fb3f..5c310d02 100755 --- a/assets/js/lightgallery.js +++ b/assets/js/lightgallery.js @@ -1,1337 +1,1648 @@ -/*! lightgallery - v1.3.3 - 2016-09-24 -* http://sachinchoolur.github.io/lightGallery/ -* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ +/*! lightgallery - v1.3.9 - 2017-02-05 + * http://sachinchoolur.github.io/lightGallery/ + * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ (function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module unless amdModuleId is set - define(["jquery"], function (a0) { - return (factory(a0)); - }); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - factory(jQuery); - } -}(this, function (jquery) { - - -(function( $ ){ - 'use strict'; - - var defaults = { - - mode: 'lg-slide', - - // Ex : 'ease' - cssEasing: 'ease', - - //'for jquery animation' - easing: 'linear', - speed: 600, - height: '100%', - width: '100%', - addClass: '', - startClass: 'lg-start-zoom', - backdropDuration: 150, - hideBarsDelay: 6000, - - useLeft: false, - - closable: true, - loop: true, - escKey: true, - keyPress: true, - controls: true, - slideEndAnimatoin: true, - hideControlOnEnd: false, - mousewheel: true, - - getCaptionFromTitleOrAlt: true, - - // .lg-item || '.lg-sub-html' - appendSubHtmlTo: '.lg-sub-html', - - subHtmlSelectorRelative: false, - - /** - * @desc number of preload slides - * will exicute only after the current slide is fully loaded. - * - * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th - * slide will be loaded in the background after the 4th slide is fully loaded.. - * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... - * - */ - preload: 1, - showAfterLoad: true, - selector: '', - selectWithin: '', - nextHtml: '', - prevHtml: '', - - // 0, 1 - index: false, - - iframeMaxWidth: '100%', - - download: true, - counter: true, - appendCounterTo: '.lg-toolbar', - - swipeThreshold: 50, - enableSwipe: true, - enableDrag: true, - - dynamic: false, - dynamicEl: [], - galleryId: 1 - }; + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(['jquery'], function (a0) { + return (factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require('jquery')); + } else { + factory(root["jQuery"]); + } +}(this, function ($) { + + (function() { + 'use strict'; + + var defaults = { + + mode: 'lg-slide', + + // Ex : 'ease' + cssEasing: 'ease', + + //'for jquery animation' + easing: 'linear', + speed: 600, + height: '100%', + width: '100%', + addClass: '', + startClass: 'lg-start-zoom', + backdropDuration: 150, + hideBarsDelay: 6000, + + useLeft: false, + + closable: true, + loop: true, + escKey: true, + keyPress: true, + controls: true, + slideEndAnimatoin: true, + hideControlOnEnd: false, + mousewheel: true, + + getCaptionFromTitleOrAlt: true, + + // .lg-item || '.lg-sub-html' + appendSubHtmlTo: '.lg-sub-html', + + subHtmlSelectorRelative: false, + + /** + * @desc number of preload slides + * will exicute only after the current slide is fully loaded. + * + * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th + * slide will be loaded in the background after the 4th slide is fully loaded.. + * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... + * + */ + preload: 1, + showAfterLoad: true, + selector: '', + selectWithin: '', + nextHtml: '', + prevHtml: '', + + // 0, 1 + index: false, + + iframeMaxWidth: '100%', + + download: true, + counter: true, + appendCounterTo: '.lg-toolbar', + + swipeThreshold: 50, + enableSwipe: true, + enableDrag: true, + + dynamic: false, + dynamicEl: [], + galleryId: 1 + }; - function Plugin(element, options) { + function Plugin(element, options) { - // Current lightGallery element - this.el = element; + // Current lightGallery element + this.el = element; - // Current jquery element - this.$el = $(element); + // Current jquery element + this.$el = $(element); - // lightGallery settings - this.s = $.extend({}, defaults, options); + // lightGallery settings + this.s = $.extend({}, defaults, options); - // When using dynamic mode, ensure dynamicEl is an array - if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { - throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); - } + // When using dynamic mode, ensure dynamicEl is an array + if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { + throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); + } - // lightGallery modules - this.modules = {}; + // lightGallery modules + this.modules = {}; - // false when lightgallery complete first slide; - this.lGalleryOn = false; + // false when lightgallery complete first slide; + this.lGalleryOn = false; - this.lgBusy = false; + this.lgBusy = false; - // Timeout function for hiding controls; - this.hideBartimeout = false; + // Timeout function for hiding controls; + this.hideBartimeout = false; - // To determine browser supports for touch events; - this.isTouch = ('ontouchstart' in document.documentElement); + // To determine browser supports for touch events; + this.isTouch = ('ontouchstart' in document.documentElement); - // Disable hideControlOnEnd if sildeEndAnimation is true - if (this.s.slideEndAnimatoin) { - this.s.hideControlOnEnd = false; - } + // Disable hideControlOnEnd if sildeEndAnimation is true + if (this.s.slideEndAnimatoin) { + this.s.hideControlOnEnd = false; + } - // Gallery items - if (this.s.dynamic) { - this.$items = this.s.dynamicEl; - } else { - if (this.s.selector === 'this') { - this.$items = this.$el; - } else if (this.s.selector !== '') { - if (this.s.selectWithin) { - this.$items = $(this.s.selectWithin).find(this.s.selector); + // Gallery items + if (this.s.dynamic) { + this.$items = this.s.dynamicEl; + } else { + if (this.s.selector === 'this') { + this.$items = this.$el; + } else if (this.s.selector !== '') { + if (this.s.selectWithin) { + this.$items = $(this.s.selectWithin).find(this.s.selector); + } else { + this.$items = this.$el.find($(this.s.selector)); + } } else { - this.$items = this.$el.find($(this.s.selector)); + this.$items = this.$el.children(); } - } else { - this.$items = this.$el.children(); } - } - - // .lg-item - this.$slide = ''; - - // .lg-outer - this.$outer = ''; - this.init(); - - return this; - } + // .lg-item + this.$slide = ''; - Plugin.prototype.init = function() { + // .lg-outer + this.$outer = ''; - var _this = this; + this.init(); - // s.preload should not be more than $item.length - if (_this.s.preload > _this.$items.length) { - _this.s.preload = _this.$items.length; + return this; } - // if dynamic option is enabled execute immediately - var _hash = window.location.hash; - if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { + Plugin.prototype.init = function() { - _this.index = parseInt(_hash.split('&slide=')[1], 10); + var _this = this; - $('body').addClass('lg-from-hash'); - if (!$('body').hasClass('lg-on')) { - setTimeout(function() { - _this.build(_this.index); - }); - $('body').addClass('lg-on'); + // s.preload should not be more than $item.length + if (_this.s.preload > _this.$items.length) { + _this.s.preload = _this.$items.length; } - } - if (_this.s.dynamic) { + // if dynamic option is enabled execute immediately + var _hash = window.location.hash; + if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { - _this.$el.trigger('onBeforeOpen.lg'); + _this.index = parseInt(_hash.split('&slide=')[1], 10); - _this.index = _this.s.index || 0; + $('body').addClass('lg-from-hash'); + if (!$('body').hasClass('lg-on')) { + setTimeout(function() { + _this.build(_this.index); + }); - // prevent accidental double execution - if (!$('body').hasClass('lg-on')) { - setTimeout(function() { - _this.build(_this.index); $('body').addClass('lg-on'); - }); + } } - } else { - - // Using different namespace for click because click event should not unbind if selector is same object('this') - _this.$items.on('click.lgcustom', function(event) { - // For IE8 - try { - event.preventDefault(); - event.preventDefault(); - } catch (er) { - event.returnValue = false; - } + if (_this.s.dynamic) { _this.$el.trigger('onBeforeOpen.lg'); - _this.index = _this.s.index || _this.$items.index(this); + _this.index = _this.s.index || 0; // prevent accidental double execution if (!$('body').hasClass('lg-on')) { - _this.build(_this.index); - $('body').addClass('lg-on'); + setTimeout(function() { + _this.build(_this.index); + $('body').addClass('lg-on'); + }); } - }); - } + } else { - }; + // Using different namespace for click because click event should not unbind if selector is same object('this') + _this.$items.on('click.lgcustom', function(event) { - Plugin.prototype.build = function(index) { + // For IE8 + try { + event.preventDefault(); + event.preventDefault(); + } catch (er) { + event.returnValue = false; + } - var _this = this; + _this.$el.trigger('onBeforeOpen.lg'); - _this.structure(); + _this.index = _this.s.index || _this.$items.index(this); - // module constructor - $.each($.fn.lightGallery.modules, function(key) { - _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); - }); + // prevent accidental double execution + if (!$('body').hasClass('lg-on')) { + _this.build(_this.index); + $('body').addClass('lg-on'); + } + }); + } + + }; - // initiate slide function - _this.slide(index, false, false); + Plugin.prototype.build = function(index) { - if (_this.s.keyPress) { - _this.keyPress(); - } + var _this = this; - if (_this.$items.length > 1) { + _this.structure(); - _this.arrow(); + // module constructor + $.each($.fn.lightGallery.modules, function(key) { + _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); + }); - setTimeout(function() { - _this.enableDrag(); - _this.enableSwipe(); - }, 50); + // initiate slide function + _this.slide(index, false, false, false); - if (_this.s.mousewheel) { - _this.mousewheel(); + if (_this.s.keyPress) { + _this.keyPress(); } - } - _this.counter(); + if (_this.$items.length > 1) { - _this.closeGallery(); + _this.arrow(); - _this.$el.trigger('onAfterOpen.lg'); + setTimeout(function() { + _this.enableDrag(); + _this.enableSwipe(); + }, 50); - // Hide controllers if mouse doesn't move for some period - _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() { + if (_this.s.mousewheel) { + _this.mousewheel(); + } + } - _this.$outer.removeClass('lg-hide-items'); + _this.counter(); - clearTimeout(_this.hideBartimeout); + _this.closeGallery(); - // Timeout will be cleared on each slide movement also - _this.hideBartimeout = setTimeout(function() { - _this.$outer.addClass('lg-hide-items'); - }, _this.s.hideBarsDelay); + _this.$el.trigger('onAfterOpen.lg'); - }); + // Hide controllers if mouse doesn't move for some period + _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() { - }; + _this.$outer.removeClass('lg-hide-items'); - Plugin.prototype.structure = function() { - var list = ''; - var controls = ''; - var i = 0; - var subHtmlCont = ''; - var template; - var _this = this; + clearTimeout(_this.hideBartimeout); - $('body').append('
'); - $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); + // Timeout will be cleared on each slide movement also + _this.hideBartimeout = setTimeout(function() { + _this.$outer.addClass('lg-hide-items'); + }, _this.s.hideBarsDelay); - // Create gallery items - for (i = 0; i < this.$items.length; i++) { - list += '
'; - } + }); - // Create controlls - if (this.s.controls && this.$items.length > 1) { - controls = '
' + - '
' + this.s.prevHtml + '
' + - '
' + this.s.nextHtml + '
' + - '
'; - } + _this.$outer.trigger('mousemove.lg'); - if (this.s.appendSubHtmlTo === '.lg-sub-html') { - subHtmlCont = '
'; - } + }; - template = '
' + - '
' + - '
' + list + '
' + - '
' + - '' + - '
' + - controls + - subHtmlCont + - '
' + - '
'; - - $('body').append(template); - this.$outer = $('.lg-outer'); - this.$slide = this.$outer.find('.lg-item'); - - if (this.s.useLeft) { - this.$outer.addClass('lg-use-left'); - - // Set mode lg-slide if use left is true; - this.s.mode = 'lg-slide'; - } else { - this.$outer.addClass('lg-use-css3'); - } + Plugin.prototype.structure = function() { + var list = ''; + var controls = ''; + var i = 0; + var subHtmlCont = ''; + var template; + var _this = this; - // For fixed height gallery - _this.setTop(); - $(window).on('resize.lg orientationchange.lg', function() { - setTimeout(function() { - _this.setTop(); - }, 100); - }); + $('body').append('
'); + $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); - // add class lg-current to remove initial transition - this.$slide.eq(this.index).addClass('lg-current'); + // Create gallery items + for (i = 0; i < this.$items.length; i++) { + list += '
'; + } - // add Class for css support and transition mode - if (this.doCss()) { - this.$outer.addClass('lg-css3'); - } else { - this.$outer.addClass('lg-css'); + // Create controlls + if (this.s.controls && this.$items.length > 1) { + controls = '
' + + '
' + this.s.prevHtml + '
' + + '
' + this.s.nextHtml + '
' + + '
'; + } - // Set speed 0 because no animation will happen if browser doesn't support css3 - this.s.speed = 0; - } + if (this.s.appendSubHtmlTo === '.lg-sub-html') { + subHtmlCont = '
'; + } - this.$outer.addClass(this.s.mode); + template = '
' + + '
' + + '
' + list + '
' + + '
' + + '' + + '
' + + controls + + subHtmlCont + + '
' + + '
'; - if (this.s.enableDrag && this.$items.length > 1) { - this.$outer.addClass('lg-grab'); - } + $('body').append(template); + this.$outer = $('.lg-outer'); + this.$slide = this.$outer.find('.lg-item'); - if (this.s.showAfterLoad) { - this.$outer.addClass('lg-show-after-load'); - } + if (this.s.useLeft) { + this.$outer.addClass('lg-use-left'); - if (this.doCss()) { - var $inner = this.$outer.find('.lg-inner'); - $inner.css('transition-timing-function', this.s.cssEasing); - $inner.css('transition-duration', this.s.speed + 'ms'); - } + // Set mode lg-slide if use left is true; + this.s.mode = 'lg-slide'; + } else { + this.$outer.addClass('lg-use-css3'); + } - $('.lg-backdrop').addClass('in'); + // For fixed height gallery + _this.setTop(); + $(window).on('resize.lg orientationchange.lg', function() { + setTimeout(function() { + _this.setTop(); + }, 100); + }); - setTimeout(function() { - _this.$outer.addClass('lg-visible'); - }, this.s.backdropDuration); + // add class lg-current to remove initial transition + this.$slide.eq(this.index).addClass('lg-current'); - if (this.s.download) { - this.$outer.find('.lg-toolbar').append(''); - } + // add Class for css support and transition mode + if (this.doCss()) { + this.$outer.addClass('lg-css3'); + } else { + this.$outer.addClass('lg-css'); - // Store the current scroll top value to scroll back after closing the gallery.. - this.prevScrollTop = $(window).scrollTop(); + // Set speed 0 because no animation will happen if browser doesn't support css3 + this.s.speed = 0; + } - }; + this.$outer.addClass(this.s.mode); - // For fixed height gallery - Plugin.prototype.setTop = function() { - if (this.s.height !== '100%') { - var wH = $(window).height(); - var top = (wH - parseInt(this.s.height, 10)) / 2; - var $lGallery = this.$outer.find('.lg'); - if (wH >= parseInt(this.s.height, 10)) { - $lGallery.css('top', top + 'px'); - } else { - $lGallery.css('top', '0px'); + if (this.s.enableDrag && this.$items.length > 1) { + this.$outer.addClass('lg-grab'); } - } - }; - // Find css3 support - Plugin.prototype.doCss = function() { - // check for css animation support - var support = function() { - var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; - var root = document.documentElement; - var i = 0; - for (i = 0; i < transition.length; i++) { - if (transition[i] in root.style) { - return true; - } + if (this.s.showAfterLoad) { + this.$outer.addClass('lg-show-after-load'); } - }; - - if (support()) { - return true; - } - return false; - }; + if (this.doCss()) { + var $inner = this.$outer.find('.lg-inner'); + $inner.css('transition-timing-function', this.s.cssEasing); + $inner.css('transition-duration', this.s.speed + 'ms'); + } - /** - * @desc Check the given src is video - * @param {String} src - * @return {Object} video type - * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } - */ - Plugin.prototype.isVideo = function(src, index) { - - var html; - if (this.s.dynamic) { - html = this.s.dynamicEl[index].html; - } else { - html = this.$items.eq(index).attr('data-html'); - } + setTimeout(function() { + $('.lg-backdrop').addClass('in'); + }); - if (!src && html) { - return { - html5: true - }; - } + setTimeout(function() { + _this.$outer.addClass('lg-visible'); + }, this.s.backdropDuration); - var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); - var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); - var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); - var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); + if (this.s.download) { + this.$outer.find('.lg-toolbar').append(''); + } - if (youtube) { - return { - youtube: youtube - }; - } else if (vimeo) { - return { - vimeo: vimeo - }; - } else if (dailymotion) { - return { - dailymotion: dailymotion - }; - } else if (vk) { - return { - vk: vk - }; - } - }; + // Store the current scroll top value to scroll back after closing the gallery.. + this.prevScrollTop = $(window).scrollTop(); - /** - * @desc Create image counter - * Ex: 1/10 - */ - Plugin.prototype.counter = function() { - if (this.s.counter) { - $(this.s.appendCounterTo).append('
' + (parseInt(this.index, 10) + 1) + ' / ' + this.$items.length + '
'); - } - }; + }; - /** - * @desc add sub-html into the slide - * @param {Number} index - index of the slide - */ - Plugin.prototype.addHtml = function(index) { - var subHtml = null; - var subHtmlUrl; - var $currentEle; - if (this.s.dynamic) { - if (this.s.dynamicEl[index].subHtmlUrl) { - subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; - } else { - subHtml = this.s.dynamicEl[index].subHtml; - } - } else { - $currentEle = this.$items.eq(index); - if ($currentEle.attr('data-sub-html-url')) { - subHtmlUrl = $currentEle.attr('data-sub-html-url'); - } else { - subHtml = $currentEle.attr('data-sub-html'); - if (this.s.getCaptionFromTitleOrAlt && !subHtml) { - subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); + // For fixed height gallery + Plugin.prototype.setTop = function() { + if (this.s.height !== '100%') { + var wH = $(window).height(); + var top = (wH - parseInt(this.s.height, 10)) / 2; + var $lGallery = this.$outer.find('.lg'); + if (wH >= parseInt(this.s.height, 10)) { + $lGallery.css('top', top + 'px'); + } else { + $lGallery.css('top', '0px'); } } - } - - if (!subHtmlUrl) { - if (typeof subHtml !== 'undefined' && subHtml !== null) { + }; - // get first letter of subhtml - // if first letter starts with . or # get the html form the jQuery object - var fL = subHtml.substring(0, 1); - if (fL === '.' || fL === '#') { - if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { - subHtml = $currentEle.find(subHtml).html(); - } else { - subHtml = $(subHtml).html(); + // Find css3 support + Plugin.prototype.doCss = function() { + // check for css animation support + var support = function() { + var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; + var root = document.documentElement; + var i = 0; + for (i = 0; i < transition.length; i++) { + if (transition[i] in root.style) { + return true; } } - } else { - subHtml = ''; - } - } - - if (this.s.appendSubHtmlTo === '.lg-sub-html') { + }; - if (subHtmlUrl) { - this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); - } else { - this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); + if (support()) { + return true; } - } else { + return false; + }; - if (subHtmlUrl) { - this.$slide.eq(index).load(subHtmlUrl); - } else { - this.$slide.eq(index).append(subHtml); - } - } + /** + * @desc Check the given src is video + * @param {String} src + * @return {Object} video type + * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } + */ + Plugin.prototype.isVideo = function(src, index) { - // Add lg-empty-html class if title doesn't exist - if (typeof subHtml !== 'undefined' && subHtml !== null) { - if (subHtml === '') { - this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); + var html; + if (this.s.dynamic) { + html = this.s.dynamicEl[index].html; } else { - this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); + html = this.$items.eq(index).attr('data-html'); } - } - this.$el.trigger('onAfterAppendSubHtml.lg', [index]); - }; + if (!src && html) { + return { + html5: true + }; + } - /** - * @desc Preload slides - * @param {Number} index - index of the slide - */ - Plugin.prototype.preload = function(index) { - var i = 1; - var j = 1; - for (i = 1; i <= this.s.preload; i++) { - if (i >= this.$items.length - index) { - break; + var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); + var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); + var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); + var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); + + if (youtube) { + return { + youtube: youtube + }; + } else if (vimeo) { + return { + vimeo: vimeo + }; + } else if (dailymotion) { + return { + dailymotion: dailymotion + }; + } else if (vk) { + return { + vk: vk + }; } + }; - this.loadContent(index + i, false, 0); - } + /** + * @desc Create image counter + * Ex: 1/10 + */ + Plugin.prototype.counter = function() { + if (this.s.counter) { + $(this.s.appendCounterTo).append('
' + (parseInt(this.index, 10) + 1) + ' / ' + this.$items.length + '
'); + } + }; - for (j = 1; j <= this.s.preload; j++) { - if (index - j < 0) { - break; + /** + * @desc add sub-html into the slide + * @param {Number} index - index of the slide + */ + Plugin.prototype.addHtml = function(index) { + var subHtml = null; + var subHtmlUrl; + var $currentEle; + if (this.s.dynamic) { + if (this.s.dynamicEl[index].subHtmlUrl) { + subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; + } else { + subHtml = this.s.dynamicEl[index].subHtml; + } + } else { + $currentEle = this.$items.eq(index); + if ($currentEle.attr('data-sub-html-url')) { + subHtmlUrl = $currentEle.attr('data-sub-html-url'); + } else { + subHtml = $currentEle.attr('data-sub-html'); + if (this.s.getCaptionFromTitleOrAlt && !subHtml) { + subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); + } + } } - this.loadContent(index - j, false, 0); - } - }; + if (!subHtmlUrl) { + if (typeof subHtml !== 'undefined' && subHtml !== null) { + + // get first letter of subhtml + // if first letter starts with . or # get the html form the jQuery object + var fL = subHtml.substring(0, 1); + if (fL === '.' || fL === '#') { + if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { + subHtml = $currentEle.find(subHtml).html(); + } else { + subHtml = $(subHtml).html(); + } + } + } else { + subHtml = ''; + } + } - /** - * @desc Load slide content into slide. - * @param {Number} index - index of the slide. - * @param {Boolean} rec - if true call loadcontent() function again. - * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. - */ - Plugin.prototype.loadContent = function(index, rec, delay) { + if (this.s.appendSubHtmlTo === '.lg-sub-html') { - var _this = this; - var _hasPoster = false; - var _$img; - var _src; - var _poster; - var _srcset; - var _sizes; - var _html; - var getResponsiveSrc = function(srcItms) { - var rsWidth = []; - var rsSrc = []; - for (var i = 0; i < srcItms.length; i++) { - var __src = srcItms[i].split(' '); - - // Manage empty space - if (__src[0] === '') { - __src.splice(0, 1); + if (subHtmlUrl) { + this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); + } else { + this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); } - rsSrc.push(__src[0]); - rsWidth.push(__src[1]); + } else { + + if (subHtmlUrl) { + this.$slide.eq(index).load(subHtmlUrl); + } else { + this.$slide.eq(index).append(subHtml); + } } - var wWidth = $(window).width(); - for (var j = 0; j < rsWidth.length; j++) { - if (parseInt(rsWidth[j], 10) > wWidth) { - _src = rsSrc[j]; - break; + // Add lg-empty-html class if title doesn't exist + if (typeof subHtml !== 'undefined' && subHtml !== null) { + if (subHtml === '') { + this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); + } else { + this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); } } + + this.$el.trigger('onAfterAppendSubHtml.lg', [index]); }; - if (_this.s.dynamic) { + /** + * @desc Preload slides + * @param {Number} index - index of the slide + */ + Plugin.prototype.preload = function(index) { + var i = 1; + var j = 1; + for (i = 1; i <= this.s.preload; i++) { + if (i >= this.$items.length - index) { + break; + } - if (_this.s.dynamicEl[index].poster) { - _hasPoster = true; - _poster = _this.s.dynamicEl[index].poster; + this.loadContent(index + i, false, 0); } - _html = _this.s.dynamicEl[index].html; - _src = _this.s.dynamicEl[index].src; + for (j = 1; j <= this.s.preload; j++) { + if (index - j < 0) { + break; + } - if (_this.s.dynamicEl[index].responsive) { - var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); - getResponsiveSrc(srcDyItms); + this.loadContent(index - j, false, 0); } + }; - _srcset = _this.s.dynamicEl[index].srcset; - _sizes = _this.s.dynamicEl[index].sizes; + /** + * @desc Load slide content into slide. + * @param {Number} index - index of the slide. + * @param {Boolean} rec - if true call loadcontent() function again. + * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. + */ + Plugin.prototype.loadContent = function(index, rec, delay) { + + var _this = this; + var _hasPoster = false; + var _$img; + var _src; + var _poster; + var _srcset; + var _sizes; + var _html; + var getResponsiveSrc = function(srcItms) { + var rsWidth = []; + var rsSrc = []; + for (var i = 0; i < srcItms.length; i++) { + var __src = srcItms[i].split(' '); + + // Manage empty space + if (__src[0] === '') { + __src.splice(0, 1); + } - } else { + rsSrc.push(__src[0]); + rsWidth.push(__src[1]); + } - if (_this.$items.eq(index).attr('data-poster')) { - _hasPoster = true; - _poster = _this.$items.eq(index).attr('data-poster'); - } + var wWidth = $(window).width(); + for (var j = 0; j < rsWidth.length; j++) { + if (parseInt(rsWidth[j], 10) > wWidth) { + _src = rsSrc[j]; + break; + } + } + }; - _html = _this.$items.eq(index).attr('data-html'); - _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); + if (_this.s.dynamic) { - if (_this.$items.eq(index).attr('data-responsive')) { - var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); - getResponsiveSrc(srcItms); - } + if (_this.s.dynamicEl[index].poster) { + _hasPoster = true; + _poster = _this.s.dynamicEl[index].poster; + } - _srcset = _this.$items.eq(index).attr('data-srcset'); - _sizes = _this.$items.eq(index).attr('data-sizes'); + _html = _this.s.dynamicEl[index].html; + _src = _this.s.dynamicEl[index].src; - } + if (_this.s.dynamicEl[index].responsive) { + var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); + getResponsiveSrc(srcDyItms); + } - //if (_src || _srcset || _sizes || _poster) { + _srcset = _this.s.dynamicEl[index].srcset; + _sizes = _this.s.dynamicEl[index].sizes; - var iframe = false; - if (_this.s.dynamic) { - if (_this.s.dynamicEl[index].iframe) { - iframe = true; - } - } else { - if (_this.$items.eq(index).attr('data-iframe') === 'true') { - iframe = true; - } - } + } else { - var _isVideo = _this.isVideo(_src, index); - if (!_this.$slide.eq(index).hasClass('lg-loaded')) { - if (iframe) { - _this.$slide.eq(index).prepend('
'); - } else if (_hasPoster) { - var videoClass = ''; - if (_isVideo && _isVideo.youtube) { - videoClass = 'lg-has-youtube'; - } else if (_isVideo && _isVideo.vimeo) { - videoClass = 'lg-has-vimeo'; - } else { - videoClass = 'lg-has-html5'; + if (_this.$items.eq(index).attr('data-poster')) { + _hasPoster = true; + _poster = _this.$items.eq(index).attr('data-poster'); } - _this.$slide.eq(index).prepend('
'); + _html = _this.$items.eq(index).attr('data-html'); + _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); - } else if (_isVideo) { - _this.$slide.eq(index).prepend('
'); - _this.$el.trigger('hasVideo.lg', [index, _src, _html]); - } else { - _this.$slide.eq(index).prepend('
'); - } + if (_this.$items.eq(index).attr('data-responsive')) { + var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); + getResponsiveSrc(srcItms); + } - _this.$el.trigger('onAferAppendSlide.lg', [index]); + _srcset = _this.$items.eq(index).attr('data-srcset'); + _sizes = _this.$items.eq(index).attr('data-sizes'); - _$img = _this.$slide.eq(index).find('.lg-object'); - if (_sizes) { - _$img.attr('sizes', _sizes); } - if (_srcset) { - _$img.attr('srcset', _srcset); - try { - picturefill({ - elements: [_$img[0]] - }); - } catch (e) { - console.error('Make sure you have included Picturefill version 2'); - } - } + //if (_src || _srcset || _sizes || _poster) { - if (this.s.appendSubHtmlTo !== '.lg-sub-html') { - _this.addHtml(index); + var iframe = false; + if (_this.s.dynamic) { + if (_this.s.dynamicEl[index].iframe) { + iframe = true; + } + } else { + if (_this.$items.eq(index).attr('data-iframe') === 'true') { + iframe = true; + } } - _this.$slide.eq(index).addClass('lg-loaded'); - } + var _isVideo = _this.isVideo(_src, index); + if (!_this.$slide.eq(index).hasClass('lg-loaded')) { + if (iframe) { + _this.$slide.eq(index).prepend('
'); + } else if (_hasPoster) { + var videoClass = ''; + if (_isVideo && _isVideo.youtube) { + videoClass = 'lg-has-youtube'; + } else if (_isVideo && _isVideo.vimeo) { + videoClass = 'lg-has-vimeo'; + } else { + videoClass = 'lg-has-html5'; + } - _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { + _this.$slide.eq(index).prepend('
'); - // For first time add some delay for displaying the start animation. - var _speed = 0; + } else if (_isVideo) { + _this.$slide.eq(index).prepend('
'); + _this.$el.trigger('hasVideo.lg', [index, _src, _html]); + } else { + _this.$slide.eq(index).prepend('
'); + } - // Do not change the delay value because it is required for zoom plugin. - // If gallery opened from direct url (hash) speed value should be 0 - if (delay && !$('body').hasClass('lg-from-hash')) { - _speed = delay; - } + _this.$el.trigger('onAferAppendSlide.lg', [index]); - setTimeout(function() { - _this.$slide.eq(index).addClass('lg-complete'); - _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); - }, _speed); + _$img = _this.$slide.eq(index).find('.lg-object'); + if (_sizes) { + _$img.attr('sizes', _sizes); + } - }); + if (_srcset) { + _$img.attr('srcset', _srcset); + try { + picturefill({ + elements: [_$img[0]] + }); + } catch (e) { + console.error('Make sure you have included Picturefill version 2'); + } + } - // @todo check load state for html5 videos - if (_isVideo && _isVideo.html5 && !_hasPoster) { - _this.$slide.eq(index).addClass('lg-complete'); - } + if (this.s.appendSubHtmlTo !== '.lg-sub-html') { + _this.addHtml(index); + } - if (rec === true) { - if (!_this.$slide.eq(index).hasClass('lg-complete')) { - _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { - _this.preload(index); - }); - } else { - _this.preload(index); + _this.$slide.eq(index).addClass('lg-loaded'); } - } - //} - }; + _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { - /** - * @desc slide function for lightgallery - ** Slide() gets call on start - ** ** Set lg.on true once slide() function gets called. - ** Call loadContent() on slide() function inside setTimeout - ** ** On first slide we do not want any animation like slide of fade - ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately - ** ** Else loadContent() should wait for the transition to complete. - ** ** So set timeout s.speed + 50 - <=> ** loadContent() will load slide content in to the particular slide - ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. - ** ** preload will execute only when the previous slide is fully loaded (images iframe) - ** ** avoid simultaneous image load - <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value - ** loadContent() <====> Preload(); - - * @param {Number} index - index of the slide - * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag - * @param {Boolean} fromThumb - true if slide function called via thumbnail click - */ - Plugin.prototype.slide = function(index, fromTouch, fromThumb) { - - var _prevIndex = this.$outer.find('.lg-current').index(); - var _this = this; - - // Prevent if multiple call - // Required for hsh plugin - if (_this.lGalleryOn && (_prevIndex === index)) { - return; - } + // For first time add some delay for displaying the start animation. + var _speed = 0; - var _length = this.$slide.length; - var _time = _this.lGalleryOn ? this.s.speed : 0; - var _next = false; - var _prev = false; + // Do not change the delay value because it is required for zoom plugin. + // If gallery opened from direct url (hash) speed value should be 0 + if (delay && !$('body').hasClass('lg-from-hash')) { + _speed = delay; + } - if (!_this.lgBusy) { + setTimeout(function() { + _this.$slide.eq(index).addClass('lg-complete'); + _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); + }, _speed); - if (this.s.download) { - var _src; - if (_this.s.dynamic) { - _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); - } else { - _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); + }); - } + // @todo check load state for html5 videos + if (_isVideo && _isVideo.html5 && !_hasPoster) { + _this.$slide.eq(index).addClass('lg-complete'); + } - if (_src) { - $('#lg-download').attr('href', _src); - _this.$outer.removeClass('lg-hide-download'); + if (rec === true) { + if (!_this.$slide.eq(index).hasClass('lg-complete')) { + _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { + _this.preload(index); + }); } else { - _this.$outer.addClass('lg-hide-download'); + _this.preload(index); } } - this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - - _this.lgBusy = true; + //} + }; - clearTimeout(_this.hideBartimeout); + /** + * @desc slide function for lightgallery + ** Slide() gets call on start + ** ** Set lg.on true once slide() function gets called. + ** Call loadContent() on slide() function inside setTimeout + ** ** On first slide we do not want any animation like slide of fade + ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately + ** ** Else loadContent() should wait for the transition to complete. + ** ** So set timeout s.speed + 50 + <=> ** loadContent() will load slide content in to the particular slide + ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. + ** ** preload will execute only when the previous slide is fully loaded (images iframe) + ** ** avoid simultaneous image load + <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value + ** loadContent() <====> Preload(); + + * @param {Number} index - index of the slide + * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag + * @param {Boolean} fromThumb - true if slide function called via thumbnail click + * @param {String} direction - Direction of the slide(next/prev) + */ + Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) { - // Add title if this.s.appendSubHtmlTo === lg-sub-html - if (this.s.appendSubHtmlTo === '.lg-sub-html') { + var _prevIndex = this.$outer.find('.lg-current').index(); + var _this = this; - // wait for slide animation to complete - setTimeout(function() { - _this.addHtml(index); - }, _time); + // Prevent if multiple call + // Required for hsh plugin + if (_this.lGalleryOn && (_prevIndex === index)) { + return; } - this.arrowDisable(index); + var _length = this.$slide.length; + var _time = _this.lGalleryOn ? this.s.speed : 0; - if (!fromTouch) { + if (!_this.lgBusy) { - // remove all transitions - _this.$outer.addClass('lg-no-trans'); - - this.$slide.removeClass('lg-prev-slide lg-next-slide'); + if (this.s.download) { + var _src; + if (_this.s.dynamic) { + _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); + } else { + _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); - if (index < _prevIndex) { - _prev = true; - if ((index === 0) && (_prevIndex === _length - 1) && !fromThumb) { - _prev = false; - _next = true; } - } else if (index > _prevIndex) { - _next = true; - if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) { - _prev = true; - _next = false; + + if (_src) { + $('#lg-download').attr('href', _src); + _this.$outer.removeClass('lg-hide-download'); + } else { + _this.$outer.addClass('lg-hide-download'); } } - if (_prev) { + this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); + + _this.lgBusy = true; + + clearTimeout(_this.hideBartimeout); - //prevslide - this.$slide.eq(index).addClass('lg-prev-slide'); - this.$slide.eq(_prevIndex).addClass('lg-next-slide'); - } else if (_next) { + // Add title if this.s.appendSubHtmlTo === lg-sub-html + if (this.s.appendSubHtmlTo === '.lg-sub-html') { - // next slide - this.$slide.eq(index).addClass('lg-next-slide'); - this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); + // wait for slide animation to complete + setTimeout(function() { + _this.addHtml(index); + }, _time); } - // give 50 ms for browser to add/remove class - setTimeout(function() { - _this.$slide.removeClass('lg-current'); + this.arrowDisable(index); - //_this.$slide.eq(_prevIndex).removeClass('lg-current'); - _this.$slide.eq(index).addClass('lg-current'); + if (!direction) { + if (index < _prevIndex) { + direction = 'prev'; + } else if (index > _prevIndex) { + direction = 'next'; + } + } - // reset all transitions - _this.$outer.removeClass('lg-no-trans'); - }, 50); - } else { + if (!fromTouch) { + + // remove all transitions + _this.$outer.addClass('lg-no-trans'); - var touchPrev = index - 1; - var touchNext = index + 1; + this.$slide.removeClass('lg-prev-slide lg-next-slide'); - if ((index === 0) && (_prevIndex === _length - 1)) { + if (direction === 'prev') { - // next slide - touchNext = 0; - touchPrev = _length - 1; - } else if ((index === _length - 1) && (_prevIndex === 0)) { + //prevslide + this.$slide.eq(index).addClass('lg-prev-slide'); + this.$slide.eq(_prevIndex).addClass('lg-next-slide'); + } else { + + // next slide + this.$slide.eq(index).addClass('lg-next-slide'); + this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); + } + + // give 50 ms for browser to add/remove class + setTimeout(function() { + _this.$slide.removeClass('lg-current'); + + //_this.$slide.eq(_prevIndex).removeClass('lg-current'); + _this.$slide.eq(index).addClass('lg-current'); + + // reset all transitions + _this.$outer.removeClass('lg-no-trans'); + }, 50); + } else { - // prev slide - touchNext = 0; - touchPrev = _length - 1; + this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); + var touchPrev; + var touchNext; + if (_length > 2) { + touchPrev = index - 1; + touchNext = index + 1; + + if ((index === 0) && (_prevIndex === _length - 1)) { + + // next slide + touchNext = 0; + touchPrev = _length - 1; + } else if ((index === _length - 1) && (_prevIndex === 0)) { + + // prev slide + touchNext = 0; + touchPrev = _length - 1; + } + + } else { + touchPrev = 0; + touchNext = 1; + } + + if (direction === 'prev') { + _this.$slide.eq(touchNext).addClass('lg-next-slide'); + } else { + _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); + } + + _this.$slide.eq(index).addClass('lg-current'); } - this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); - _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); - _this.$slide.eq(touchNext).addClass('lg-next-slide'); - _this.$slide.eq(index).addClass('lg-current'); - } + if (_this.lGalleryOn) { + setTimeout(function() { + _this.loadContent(index, true, 0); + }, this.s.speed + 50); - if (_this.lGalleryOn) { - setTimeout(function() { - _this.loadContent(index, true, 0); - }, this.s.speed + 50); + setTimeout(function() { + _this.lgBusy = false; + _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); + }, this.s.speed); + + } else { + _this.loadContent(index, true, _this.s.backdropDuration); - setTimeout(function() { _this.lgBusy = false; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - }, this.s.speed); + } - } else { - _this.loadContent(index, true, _this.s.backdropDuration); + _this.lGalleryOn = true; - _this.lgBusy = false; - _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - } - - _this.lGalleryOn = true; + if (this.s.counter) { + $('#lg-counter-current').text(index + 1); + } - if (this.s.counter) { - $('#lg-counter-current').text(index + 1); } - } + }; - }; + /** + * @desc Go to next slide + * @param {Boolean} fromTouch - true if slide function called via touch event + */ + Plugin.prototype.goToNextSlide = function(fromTouch) { + var _this = this; + var _loop = _this.s.loop; + if (fromTouch && _this.$slide.length < 3) { + _loop = false; + } - /** - * @desc Go to next slide - * @param {Boolean} fromTouch - true if slide function called via touch event - */ - Plugin.prototype.goToNextSlide = function(fromTouch) { - var _this = this; - if (!_this.lgBusy) { - if ((_this.index + 1) < _this.$slide.length) { - _this.index++; - _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); - _this.slide(_this.index, fromTouch, false); - } else { - if (_this.s.loop) { - _this.index = 0; + if (!_this.lgBusy) { + if ((_this.index + 1) < _this.$slide.length) { + _this.index++; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); - _this.slide(_this.index, fromTouch, false); - } else if (_this.s.slideEndAnimatoin) { - _this.$outer.addClass('lg-right-end'); - setTimeout(function() { - _this.$outer.removeClass('lg-right-end'); - }, 400); + _this.slide(_this.index, fromTouch, false, 'next'); + } else { + if (_loop) { + _this.index = 0; + _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); + _this.slide(_this.index, fromTouch, false, 'next'); + } else if (_this.s.slideEndAnimatoin && !fromTouch) { + _this.$outer.addClass('lg-right-end'); + setTimeout(function() { + _this.$outer.removeClass('lg-right-end'); + }, 400); + } } } - } - }; + }; - /** - * @desc Go to previous slide - * @param {Boolean} fromTouch - true if slide function called via touch event - */ - Plugin.prototype.goToPrevSlide = function(fromTouch) { - var _this = this; - if (!_this.lgBusy) { - if (_this.index > 0) { - _this.index--; - _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); - _this.slide(_this.index, fromTouch, false); - } else { - if (_this.s.loop) { - _this.index = _this.$items.length - 1; + /** + * @desc Go to previous slide + * @param {Boolean} fromTouch - true if slide function called via touch event + */ + Plugin.prototype.goToPrevSlide = function(fromTouch) { + var _this = this; + var _loop = _this.s.loop; + if (fromTouch && _this.$slide.length < 3) { + _loop = false; + } + + if (!_this.lgBusy) { + if (_this.index > 0) { + _this.index--; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); - _this.slide(_this.index, fromTouch, false); - } else if (_this.s.slideEndAnimatoin) { - _this.$outer.addClass('lg-left-end'); - setTimeout(function() { - _this.$outer.removeClass('lg-left-end'); - }, 400); + _this.slide(_this.index, fromTouch, false, 'prev'); + } else { + if (_loop) { + _this.index = _this.$items.length - 1; + _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); + _this.slide(_this.index, fromTouch, false, 'prev'); + } else if (_this.s.slideEndAnimatoin && !fromTouch) { + _this.$outer.addClass('lg-left-end'); + setTimeout(function() { + _this.$outer.removeClass('lg-left-end'); + }, 400); + } } } - } - }; + }; - Plugin.prototype.keyPress = function() { - var _this = this; - if (this.$items.length > 1) { - $(window).on('keyup.lg', function(e) { - if (_this.$items.length > 1) { - if (e.keyCode === 37) { - e.preventDefault(); - _this.goToPrevSlide(); + Plugin.prototype.keyPress = function() { + var _this = this; + if (this.$items.length > 1) { + $(window).on('keyup.lg', function(e) { + if (_this.$items.length > 1) { + if (e.keyCode === 37) { + e.preventDefault(); + _this.goToPrevSlide(); + } + + if (e.keyCode === 39) { + e.preventDefault(); + _this.goToNextSlide(); + } } + }); + } - if (e.keyCode === 39) { - e.preventDefault(); - _this.goToNextSlide(); + $(window).on('keydown.lg', function(e) { + if (_this.s.escKey === true && e.keyCode === 27) { + e.preventDefault(); + if (!_this.$outer.hasClass('lg-thumb-open')) { + _this.destroy(); + } else { + _this.$outer.removeClass('lg-thumb-open'); } } }); - } + }; - $(window).on('keydown.lg', function(e) { - if (_this.s.escKey === true && e.keyCode === 27) { - e.preventDefault(); - if (!_this.$outer.hasClass('lg-thumb-open')) { - _this.destroy(); + Plugin.prototype.arrow = function() { + var _this = this; + this.$outer.find('.lg-prev').on('click.lg', function() { + _this.goToPrevSlide(); + }); + + this.$outer.find('.lg-next').on('click.lg', function() { + _this.goToNextSlide(); + }); + }; + + Plugin.prototype.arrowDisable = function(index) { + + // Disable arrows if s.hideControlOnEnd is true + if (!this.s.loop && this.s.hideControlOnEnd) { + if ((index + 1) < this.$slide.length) { + this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); + } else { + this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); + } + + if (index > 0) { + this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); } else { - _this.$outer.removeClass('lg-thumb-open'); + this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); } } - }); - }; + }; - Plugin.prototype.arrow = function() { - var _this = this; - this.$outer.find('.lg-prev').on('click.lg', function() { - _this.goToPrevSlide(); - }); + Plugin.prototype.setTranslate = function($el, xValue, yValue) { + // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 + if (this.s.useLeft) { + $el.css('left', xValue); + } else { + $el.css({ + transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' + }); + } + }; - this.$outer.find('.lg-next').on('click.lg', function() { - _this.goToNextSlide(); - }); - }; + Plugin.prototype.touchMove = function(startCoords, endCoords) { - Plugin.prototype.arrowDisable = function(index) { + var distance = endCoords - startCoords; - // Disable arrows if s.hideControlOnEnd is true - if (!this.s.loop && this.s.hideControlOnEnd) { - if ((index + 1) < this.$slide.length) { - this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); - } else { - this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); - } + if (Math.abs(distance) > 15) { + // reset opacity and transition duration + this.$outer.addClass('lg-dragging'); - if (index > 0) { - this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); - } else { - this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); + // move current slide + this.setTranslate(this.$slide.eq(this.index), distance, 0); + + // move next and prev slide with current slide + this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); + this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); } - } - }; + }; - Plugin.prototype.setTranslate = function($el, xValue, yValue) { - // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 - if (this.s.useLeft) { - $el.css('left', xValue); - } else { - $el.css({ - transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' - }); - } - }; + Plugin.prototype.touchEnd = function(distance) { + var _this = this; - Plugin.prototype.touchMove = function(startCoords, endCoords) { + // keep slide animation for any mode while dragg/swipe + if (_this.s.mode !== 'lg-slide') { + _this.$outer.addClass('lg-slide'); + } - var distance = endCoords - startCoords; + this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); - if (Math.abs(distance) > 15) { - // reset opacity and transition duration - this.$outer.addClass('lg-dragging'); + // set transition duration + setTimeout(function() { + _this.$outer.removeClass('lg-dragging'); + if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { + _this.goToNextSlide(true); + } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { + _this.goToPrevSlide(true); + } else if (Math.abs(distance) < 5) { + + // Trigger click if distance is less than 5 pix + _this.$el.trigger('onSlideClick.lg'); + } - // move current slide - this.setTranslate(this.$slide.eq(this.index), distance, 0); + _this.$slide.removeAttr('style'); + }); - // move next and prev slide with current slide - this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); - this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); - } - }; + // remove slide class once drag/swipe is completed if mode is not slide + setTimeout(function() { + if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { + _this.$outer.removeClass('lg-slide'); + } + }, _this.s.speed + 100); - Plugin.prototype.touchEnd = function(distance) { - var _this = this; + }; - // keep slide animation for any mode while dragg/swipe - if (_this.s.mode !== 'lg-slide') { - _this.$outer.addClass('lg-slide'); - } + Plugin.prototype.enableSwipe = function() { + var _this = this; + var startCoords = 0; + var endCoords = 0; + var isMoved = false; - this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); + if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) { - // set transition duration - setTimeout(function() { - _this.$outer.removeClass('lg-dragging'); - if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { - _this.goToNextSlide(true); - } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { - _this.goToPrevSlide(true); - } else if (Math.abs(distance) < 5) { + _this.$slide.on('touchstart.lg', function(e) { + if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { + e.preventDefault(); + _this.manageSwipeClass(); + startCoords = e.originalEvent.targetTouches[0].pageX; + } + }); - // Trigger click if distance is less than 5 pix - _this.$el.trigger('onSlideClick.lg'); + _this.$slide.on('touchmove.lg', function(e) { + if (!_this.$outer.hasClass('lg-zoomed')) { + e.preventDefault(); + endCoords = e.originalEvent.targetTouches[0].pageX; + _this.touchMove(startCoords, endCoords); + isMoved = true; + } + }); + + _this.$slide.on('touchend.lg', function() { + if (!_this.$outer.hasClass('lg-zoomed')) { + if (isMoved) { + isMoved = false; + _this.touchEnd(endCoords - startCoords); + } else { + _this.$el.trigger('onSlideClick.lg'); + } + } + }); } - _this.$slide.removeAttr('style'); - }); + }; - // remove slide class once drag/swipe is completed if mode is not slide - setTimeout(function() { - if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { - _this.$outer.removeClass('lg-slide'); - } - }, _this.s.speed + 100); + Plugin.prototype.enableDrag = function() { + var _this = this; + var startCoords = 0; + var endCoords = 0; + var isDraging = false; + var isMoved = false; + if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) { + _this.$slide.on('mousedown.lg', function(e) { + // execute only on .lg-object + if (!_this.$outer.hasClass('lg-zoomed')) { + if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { + e.preventDefault(); - }; + if (!_this.lgBusy) { + _this.manageSwipeClass(); + startCoords = e.pageX; + isDraging = true; - Plugin.prototype.enableSwipe = function() { - var _this = this; - var startCoords = 0; - var endCoords = 0; - var isMoved = false; + // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 + _this.$outer.scrollLeft += 1; + _this.$outer.scrollLeft -= 1; - if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) { + // * - _this.$slide.on('touchstart.lg', function(e) { - if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { - e.preventDefault(); - _this.manageSwipeClass(); - startCoords = e.originalEvent.targetTouches[0].pageX; - } - }); + _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); - _this.$slide.on('touchmove.lg', function(e) { - if (!_this.$outer.hasClass('lg-zoomed')) { - e.preventDefault(); - endCoords = e.originalEvent.targetTouches[0].pageX; - _this.touchMove(startCoords, endCoords); - isMoved = true; - } - }); + _this.$el.trigger('onDragstart.lg'); + } + + } + } + }); - _this.$slide.on('touchend.lg', function() { - if (!_this.$outer.hasClass('lg-zoomed')) { + $(window).on('mousemove.lg', function(e) { + if (isDraging) { + isMoved = true; + endCoords = e.pageX; + _this.touchMove(startCoords, endCoords); + _this.$el.trigger('onDragmove.lg'); + } + }); + + $(window).on('mouseup.lg', function(e) { if (isMoved) { isMoved = false; _this.touchEnd(endCoords - startCoords); - } else { + _this.$el.trigger('onDragend.lg'); + } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { _this.$el.trigger('onSlideClick.lg'); } + + // Prevent execution on click + if (isDraging) { + isDraging = false; + _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); + } + }); + + } + }; + + Plugin.prototype.manageSwipeClass = function() { + var _touchNext = this.index + 1; + var _touchPrev = this.index - 1; + if (this.s.loop && this.$slide.length > 2) { + if (this.index === 0) { + _touchPrev = this.$slide.length - 1; + } else if (this.index === this.$slide.length - 1) { + _touchNext = 0; + } + } + + this.$slide.removeClass('lg-next-slide lg-prev-slide'); + if (_touchPrev > -1) { + this.$slide.eq(_touchPrev).addClass('lg-prev-slide'); + } + + this.$slide.eq(_touchNext).addClass('lg-next-slide'); + }; + + Plugin.prototype.mousewheel = function() { + var _this = this; + _this.$outer.on('mousewheel.lg', function(e) { + + if (!e.deltaY) { + return; + } + + if (e.deltaY > 0) { + _this.goToPrevSlide(); + } else { + _this.goToNextSlide(); } + + e.preventDefault(); }); - } - }; + }; - Plugin.prototype.enableDrag = function() { - var _this = this; - var startCoords = 0; - var endCoords = 0; - var isDraging = false; - var isMoved = false; - if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) { - _this.$slide.on('mousedown.lg', function(e) { - // execute only on .lg-object - if (!_this.$outer.hasClass('lg-zoomed')) { - if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { - e.preventDefault(); + Plugin.prototype.closeGallery = function() { - if (!_this.lgBusy) { - _this.manageSwipeClass(); - startCoords = e.pageX; - isDraging = true; + var _this = this; + var mousedown = false; + this.$outer.find('.lg-close').on('click.lg', function() { + _this.destroy(); + }); - // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 - _this.$outer.scrollLeft += 1; - _this.$outer.scrollLeft -= 1; + if (_this.s.closable) { - // * + // If you drag the slide and release outside gallery gets close on chrome + // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer + _this.$outer.on('mousedown.lg', function(e) { - _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); + if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { + mousedown = true; + } else { + mousedown = false; + } - _this.$el.trigger('onDragstart.lg'); - } + }); + + _this.$outer.on('mouseup.lg', function(e) { + if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { + if (!_this.$outer.hasClass('lg-dragging')) { + _this.destroy(); + } } + + }); + + } + + }; + + Plugin.prototype.destroy = function(d) { + + var _this = this; + + if (!d) { + _this.$el.trigger('onBeforeClose.lg'); + $(window).scrollTop(_this.prevScrollTop); + } + + + /** + * if d is false or undefined destroy will only close the gallery + * plugins instance remains with the element + * + * if d is true destroy will completely remove the plugin + */ + + if (d) { + if (!_this.s.dynamic) { + // only when not using dynamic mode is $items a jquery collection + this.$items.off('click.lg click.lgcustom'); } - }); - $(window).on('mousemove.lg', function(e) { - if (isDraging) { - isMoved = true; - endCoords = e.pageX; - _this.touchMove(startCoords, endCoords); - _this.$el.trigger('onDragmove.lg'); + $.removeData(_this.el, 'lightGallery'); + } + + // Unbind all events added by lightGallery + this.$el.off('.lg.tm'); + + // Distroy all lightGallery modules + $.each($.fn.lightGallery.modules, function(key) { + if (_this.modules[key]) { + _this.modules[key].destroy(); } }); - $(window).on('mouseup.lg', function(e) { - if (isMoved) { - isMoved = false; - _this.touchEnd(endCoords - startCoords); - _this.$el.trigger('onDragend.lg'); - } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { - _this.$el.trigger('onSlideClick.lg'); + this.lGalleryOn = false; + + clearTimeout(_this.hideBartimeout); + this.hideBartimeout = false; + $(window).off('.lg'); + $('body').removeClass('lg-on lg-from-hash'); + + if (_this.$outer) { + _this.$outer.removeClass('lg-visible'); + } + + $('.lg-backdrop').removeClass('in'); + + setTimeout(function() { + if (_this.$outer) { + _this.$outer.remove(); } - // Prevent execution on click - if (isDraging) { - isDraging = false; - _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); + $('.lg-backdrop').remove(); + + if (!d) { + _this.$el.trigger('onCloseAfter.lg'); + } + + }, _this.s.backdropDuration + 50); + }; + + $.fn.lightGallery = function(options) { + return this.each(function() { + if (!$.data(this, 'lightGallery')) { + $.data(this, 'lightGallery', new Plugin(this, options)); + } else { + try { + $(this).data('lightGallery').init(); + } catch (err) { + console.error('lightGallery has not initiated properly'); + } } }); + }; - } + $.fn.lightGallery.modules = {}; + + })(); + + +})); + + + + +(function($, window, document, undefined) { + + 'use strict'; + + var defaults = { + videoMaxWidth: '855px', + youtubePlayerParams: false, + vimeoPlayerParams: false, + dailymotionPlayerParams: false, + vkPlayerParams: false, + videojs: false, + videojsOptions: {} }; - Plugin.prototype.manageSwipeClass = function() { - var touchNext = this.index + 1; - var touchPrev = this.index - 1; - var length = this.$slide.length; - if (this.s.loop) { - if (this.index === 0) { - touchPrev = length - 1; - } else if (this.index === length - 1) { - touchNext = 0; - } - } + var Video = function(element) { - this.$slide.removeClass('lg-next-slide lg-prev-slide'); - if (touchPrev > -1) { - this.$slide.eq(touchPrev).addClass('lg-prev-slide'); - } + this.core = $(element).data('lightGallery'); - this.$slide.eq(touchNext).addClass('lg-next-slide'); + this.$el = $(element); + this.core.s = $.extend({}, defaults, this.core.s); + this.videoLoaded = false; + + this.init(); + + return this; }; - Plugin.prototype.mousewheel = function() { + Video.prototype.init = function() { var _this = this; - _this.$outer.on('mousewheel.lg', function(e) { - if (!e.deltaY) { - return; - } - - if (e.deltaY > 0) { - _this.goToPrevSlide(); - } else { - _this.goToNextSlide(); + // Event triggered when video url found without poster + _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) { + _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); + if (html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + if (!_this.videoLoaded) { + this.play(); + } + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); + } } + }); - e.preventDefault(); + // Set max width for video + _this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) { + _this.core.$slide.eq(index).find('.lg-video-cont').css('max-width', _this.core.s.videoMaxWidth); + _this.videoLoaded = true; }); - }; + var loadOnClick = function($el) { + // check slide has poster + if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { + + // check already video element present + if (!$el.hasClass('lg-has-video')) { + + $el.addClass('lg-video-playing lg-has-video'); + + var _src; + var _html; + var _loadVideo = function(_src, _html) { + + $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); + + if (_html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + this.play(); + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); + } + } - Plugin.prototype.closeGallery = function() { + }; - var _this = this; - var mousedown = false; - this.$outer.find('.lg-close').on('click.lg', function() { - _this.destroy(); - }); + if (_this.core.s.dynamic) { - if (_this.s.closable) { + _src = _this.core.s.dynamicEl[_this.core.index].src; + _html = _this.core.s.dynamicEl[_this.core.index].html; - // If you drag the slide and release outside gallery gets close on chrome - // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer - _this.$outer.on('mousedown.lg', function(e) { + _loadVideo(_src, _html); - if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { - mousedown = true; - } else { - mousedown = false; - } + } else { - }); + _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); + _html = _this.core.$items.eq(_this.core.index).attr('data-html'); - _this.$outer.on('mouseup.lg', function(e) { + _loadVideo(_src, _html); - if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { - if (!_this.$outer.hasClass('lg-dragging')) { - _this.destroy(); } + + var $tempImg = $el.find('.lg-object'); + $el.find('.lg-video').append($tempImg); + + // @todo loading icon for html5 videos also + // for showing the loading indicator while loading video + if (!$el.find('.lg-video-object').hasClass('lg-html5')) { + $el.removeClass('lg-complete'); + $el.find('.lg-video-object').on('load.lg error.lg', function() { + $el.addClass('lg-complete'); + }); + } + + } else { + + var youtubePlayer = $el.find('.lg-youtube').get(0); + var vimeoPlayer = $el.find('.lg-vimeo').get(0); + var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); + var html5Player = $el.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('play'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('play', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).play(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.play(); + } + } + + $el.addClass('lg-video-playing'); + } + } + }; + if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) { + _this.core.$el.on('onSlideClick.lg.tm', function() { + var $el = _this.core.$slide.eq(_this.core.index); + loadOnClick($el); }); + } else { + // For IE 9 and bellow + _this.core.$slide.on('click.lg', function() { + loadOnClick($(this)); + }); } - }; + _this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) { + + var $videoSlide = _this.core.$slide.eq(prevIndex); + var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); + var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); + var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); + var vkPlayer = $videoSlide.find('.lg-vk').get(0); + var html5Player = $videoSlide.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('pause'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('pause', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).pause(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.pause(); + } + } if (vkPlayer) { + $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); + } + + var _src; + if (_this.core.s.dynamic) { + _src = _this.core.s.dynamicEl[index].src; + } else { + _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); - Plugin.prototype.destroy = function(d) { + } - var _this = this; + var _isVideo = _this.core.isVideo(_src, index) || {}; + if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { + _this.core.$outer.addClass('lg-hide-download'); + } - if (!d) { - _this.$el.trigger('onBeforeClose.lg'); - } + //$videoSlide.addClass('lg-complete'); - $(window).scrollTop(_this.prevScrollTop); + }); - /** - * if d is false or undefined destroy will only close the gallery - * plugins instance remains with the element - * - * if d is true destroy will completely remove the plugin - */ + _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) { + _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); + }); + }; - if (d) { - if (!_this.s.dynamic) { - // only when not using dynamic mode is $items a jquery collection - this.$items.off('click.lg click.lgcustom'); - } + Video.prototype.loadVideo = function(src, addClass, noposter, index, html) { + var video = ''; + var autoplay = 1; + var a = ''; + var isVideo = this.core.isVideo(src, index) || {}; - $.removeData(_this.el, 'lightGallery'); + // Enable autoplay for first video if poster doesn't exist + if (noposter) { + if (this.videoLoaded) { + autoplay = 0; + } else { + autoplay = 1; + } } - // Unbind all events added by lightGallery - this.$el.off('.lg.tm'); + if (isVideo.youtube) { - // Distroy all lightGallery modules - $.each($.fn.lightGallery.modules, function(key) { - if (_this.modules[key]) { - _this.modules[key].destroy(); + a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; + if (this.core.s.youtubePlayerParams) { + a = a + '&' + $.param(this.core.s.youtubePlayerParams); } - }); - this.lGalleryOn = false; + video = ''; - clearTimeout(_this.hideBartimeout); - this.hideBartimeout = false; - $(window).off('.lg'); - $('body').removeClass('lg-on lg-from-hash'); + } else if (isVideo.vimeo) { - if (_this.$outer) { - _this.$outer.removeClass('lg-visible'); - } + a = '?autoplay=' + autoplay + '&api=1'; + if (this.core.s.vimeoPlayerParams) { + a = a + '&' + $.param(this.core.s.vimeoPlayerParams); + } - $('.lg-backdrop').removeClass('in'); + video = ''; - setTimeout(function() { - if (_this.$outer) { - _this.$outer.remove(); + } else if (isVideo.dailymotion) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; + if (this.core.s.dailymotionPlayerParams) { + a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); } - $('.lg-backdrop').remove(); + video = ''; - if (!d) { - _this.$el.trigger('onCloseAfter.lg'); + } else if (isVideo.html5) { + var fL = html.substring(0, 1); + if (fL === '.' || fL === '#') { + html = $(html).html(); } - }, _this.s.backdropDuration + 50); - }; + video = html; - $.fn.lightGallery = function(options) { - return this.each(function() { - if (!$.data(this, 'lightGallery')) { - $.data(this, 'lightGallery', new Plugin(this, options)); - } else { - try { - $(this).data('lightGallery').init(); - } catch (err) { - console.error('lightGallery has not initiated properly'); - } + } else if (isVideo.vk) { + + a = '&autoplay=' + autoplay; + if (this.core.s.vkPlayerParams) { + a = a + '&' + $.param(this.core.s.vkPlayerParams); } - }); - }; - $.fn.lightGallery.modules = {}; + video = ''; + + } -})( jQuery ); + return video; + }; + Video.prototype.destroy = function() { + this.videoLoaded = false; + }; -})); + $.fn.lightGallery.modules.video = Video; + +})(jQuery, window, document); diff --git a/assets/js/lightgallery.min.js b/assets/js/lightgallery.min.js deleted file mode 100755 index 8d32110a..00000000 --- a/assets/js/lightgallery.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! lightgallery - v1.3.3 - 2016-09-24 -* http://sachinchoolur.github.io/lightGallery/ -* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){!function(){"use strict";function a(a,c){if(this.el=a,this.$el=$(a),this.s=$.extend({},b,c),this.s.dynamic&&"undefined"!==this.s.dynamicEl&&this.s.dynamicEl.constructor===Array&&!this.s.dynamicEl.length)throw"When using dynamic mode, you must also define dynamicEl as an Array.";return this.modules={},this.lGalleryOn=!1,this.lgBusy=!1,this.hideBartimeout=!1,this.isTouch="ontouchstart"in document.documentElement,this.s.slideEndAnimatoin&&(this.s.hideControlOnEnd=!1),this.s.dynamic?this.$items=this.s.dynamicEl:"this"===this.s.selector?this.$items=this.$el:""!==this.s.selector?this.s.selectWithin?this.$items=$(this.s.selectWithin).find(this.s.selector):this.$items=this.$el.find($(this.s.selector)):this.$items=this.$el.children(),this.$slide="",this.$outer="",this.init(),this}var b={mode:"lg-slide",cssEasing:"ease",easing:"linear",speed:600,height:"100%",width:"100%",addClass:"",startClass:"lg-start-zoom",backdropDuration:150,hideBarsDelay:6e3,useLeft:!1,closable:!0,loop:!0,escKey:!0,keyPress:!0,controls:!0,slideEndAnimatoin:!0,hideControlOnEnd:!1,mousewheel:!0,getCaptionFromTitleOrAlt:!0,appendSubHtmlTo:".lg-sub-html",subHtmlSelectorRelative:!1,preload:1,showAfterLoad:!0,selector:"",selectWithin:"",nextHtml:"",prevHtml:"",index:!1,iframeMaxWidth:"100%",download:!0,counter:!0,appendCounterTo:".lg-toolbar",swipeThreshold:50,enableSwipe:!0,enableDrag:!0,dynamic:!1,dynamicEl:[],galleryId:1};a.prototype.init=function(){var a=this;a.s.preload>a.$items.length&&(a.s.preload=a.$items.length);var b=window.location.hash;b.indexOf("lg="+this.s.galleryId)>0&&(a.index=parseInt(b.split("&slide=")[1],10),$("body").addClass("lg-from-hash"),$("body").hasClass("lg-on")||(setTimeout(function(){a.build(a.index)}),$("body").addClass("lg-on"))),a.s.dynamic?(a.$el.trigger("onBeforeOpen.lg"),a.index=a.s.index||0,$("body").hasClass("lg-on")||setTimeout(function(){a.build(a.index),$("body").addClass("lg-on")})):a.$items.on("click.lgcustom",function(b){try{b.preventDefault(),b.preventDefault()}catch(c){b.returnValue=!1}a.$el.trigger("onBeforeOpen.lg"),a.index=a.s.index||a.$items.index(this),$("body").hasClass("lg-on")||(a.build(a.index),$("body").addClass("lg-on"))})},a.prototype.build=function(a){var b=this;b.structure(),$.each($.fn.lightGallery.modules,function(a){b.modules[a]=new $.fn.lightGallery.modules[a](b.el)}),b.slide(a,!1,!1),b.s.keyPress&&b.keyPress(),b.$items.length>1&&(b.arrow(),setTimeout(function(){b.enableDrag(),b.enableSwipe()},50),b.s.mousewheel&&b.mousewheel()),b.counter(),b.closeGallery(),b.$el.trigger("onAfterOpen.lg"),b.$outer.on("mousemove.lg click.lg touchstart.lg",function(){b.$outer.removeClass("lg-hide-items"),clearTimeout(b.hideBartimeout),b.hideBartimeout=setTimeout(function(){b.$outer.addClass("lg-hide-items")},b.s.hideBarsDelay)})},a.prototype.structure=function(){var a,b="",c="",d=0,e="",f=this;for($("body").append('
'),$(".lg-backdrop").css("transition-duration",this.s.backdropDuration+"ms"),d=0;d';if(this.s.controls&&this.$items.length>1&&(c='
'+this.s.prevHtml+'
'+this.s.nextHtml+"
"),".lg-sub-html"===this.s.appendSubHtmlTo&&(e='
'),a='
'+b+'
'+c+e+"
",$("body").append(a),this.$outer=$(".lg-outer"),this.$slide=this.$outer.find(".lg-item"),this.s.useLeft?(this.$outer.addClass("lg-use-left"),this.s.mode="lg-slide"):this.$outer.addClass("lg-use-css3"),f.setTop(),$(window).on("resize.lg orientationchange.lg",function(){setTimeout(function(){f.setTop()},100)}),this.$slide.eq(this.index).addClass("lg-current"),this.doCss()?this.$outer.addClass("lg-css3"):(this.$outer.addClass("lg-css"),this.s.speed=0),this.$outer.addClass(this.s.mode),this.s.enableDrag&&this.$items.length>1&&this.$outer.addClass("lg-grab"),this.s.showAfterLoad&&this.$outer.addClass("lg-show-after-load"),this.doCss()){var g=this.$outer.find(".lg-inner");g.css("transition-timing-function",this.s.cssEasing),g.css("transition-duration",this.s.speed+"ms")}$(".lg-backdrop").addClass("in"),setTimeout(function(){f.$outer.addClass("lg-visible")},this.s.backdropDuration),this.s.download&&this.$outer.find(".lg-toolbar").append(''),this.prevScrollTop=$(window).scrollTop()},a.prototype.setTop=function(){if("100%"!==this.s.height){var a=$(window).height(),b=(a-parseInt(this.s.height,10))/2,c=this.$outer.find(".lg");a>=parseInt(this.s.height,10)?c.css("top",b+"px"):c.css("top","0px")}},a.prototype.doCss=function(){var a=function(){var a=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],b=document.documentElement,c=0;for(c=0;c'+(parseInt(this.index,10)+1)+' / '+this.$items.length+"")},a.prototype.addHtml=function(a){var b,c,d=null;if(this.s.dynamic?this.s.dynamicEl[a].subHtmlUrl?b=this.s.dynamicEl[a].subHtmlUrl:d=this.s.dynamicEl[a].subHtml:(c=this.$items.eq(a),c.attr("data-sub-html-url")?b=c.attr("data-sub-html-url"):(d=c.attr("data-sub-html"),this.s.getCaptionFromTitleOrAlt&&!d&&(d=c.attr("title")||c.find("img").first().attr("alt")))),!b)if("undefined"!=typeof d&&null!==d){var e=d.substring(0,1);"."!==e&&"#"!==e||(d=this.s.subHtmlSelectorRelative&&!this.s.dynamic?c.find(d).html():$(d).html())}else d="";".lg-sub-html"===this.s.appendSubHtmlTo?b?this.$outer.find(this.s.appendSubHtmlTo).load(b):this.$outer.find(this.s.appendSubHtmlTo).html(d):b?this.$slide.eq(a).load(b):this.$slide.eq(a).append(d),"undefined"!=typeof d&&null!==d&&(""===d?this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"):this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html")),this.$el.trigger("onAfterAppendSubHtml.lg",[a])},a.prototype.preload=function(a){var b=1,c=1;for(b=1;b<=this.s.preload&&!(b>=this.$items.length-a);b++)this.loadContent(a+b,!1,0);for(c=1;c<=this.s.preload&&!(0>a-c);c++)this.loadContent(a-c,!1,0)},a.prototype.loadContent=function(a,b,c){var d,e,f,g,h,i,j=this,k=!1,l=function(a){for(var b=[],c=[],d=0;dg){e=c[h];break}};if(j.s.dynamic){if(j.s.dynamicEl[a].poster&&(k=!0,f=j.s.dynamicEl[a].poster),i=j.s.dynamicEl[a].html,e=j.s.dynamicEl[a].src,j.s.dynamicEl[a].responsive){var m=j.s.dynamicEl[a].responsive.split(",");l(m)}g=j.s.dynamicEl[a].srcset,h=j.s.dynamicEl[a].sizes}else{if(j.$items.eq(a).attr("data-poster")&&(k=!0,f=j.$items.eq(a).attr("data-poster")),i=j.$items.eq(a).attr("data-html"),e=j.$items.eq(a).attr("href")||j.$items.eq(a).attr("data-src"),j.$items.eq(a).attr("data-responsive")){var n=j.$items.eq(a).attr("data-responsive").split(",");l(n)}g=j.$items.eq(a).attr("data-srcset"),h=j.$items.eq(a).attr("data-sizes")}var o=!1;j.s.dynamic?j.s.dynamicEl[a].iframe&&(o=!0):"true"===j.$items.eq(a).attr("data-iframe")&&(o=!0);var p=j.isVideo(e,a);if(!j.$slide.eq(a).hasClass("lg-loaded")){if(o)j.$slide.eq(a).prepend('
');else if(k){var q="";q=p&&p.youtube?"lg-has-youtube":p&&p.vimeo?"lg-has-vimeo":"lg-has-html5",j.$slide.eq(a).prepend('
')}else p?(j.$slide.eq(a).prepend('
'),j.$el.trigger("hasVideo.lg",[a,e,i])):j.$slide.eq(a).prepend('
');if(j.$el.trigger("onAferAppendSlide.lg",[a]),d=j.$slide.eq(a).find(".lg-object"),h&&d.attr("sizes",h),g){d.attr("srcset",g);try{picturefill({elements:[d[0]]})}catch(r){console.error("Make sure you have included Picturefill version 2")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&j.addHtml(a),j.$slide.eq(a).addClass("lg-loaded")}j.$slide.eq(a).find(".lg-object").on("load.lg error.lg",function(){var b=0;c&&!$("body").hasClass("lg-from-hash")&&(b=c),setTimeout(function(){j.$slide.eq(a).addClass("lg-complete"),j.$el.trigger("onSlideItemLoad.lg",[a,c||0])},b)}),p&&p.html5&&!k&&j.$slide.eq(a).addClass("lg-complete"),b===!0&&(j.$slide.eq(a).hasClass("lg-complete")?j.preload(a):j.$slide.eq(a).find(".lg-object").on("load.lg error.lg",function(){j.preload(a)}))},a.prototype.slide=function(a,b,c){var d=this.$outer.find(".lg-current").index(),e=this;if(!e.lGalleryOn||d!==a){var f=this.$slide.length,g=e.lGalleryOn?this.s.speed:0,h=!1,i=!1;if(!e.lgBusy){if(this.s.download){var j;j=e.s.dynamic?e.s.dynamicEl[a].downloadUrl!==!1&&(e.s.dynamicEl[a].downloadUrl||e.s.dynamicEl[a].src):"false"!==e.$items.eq(a).attr("data-download-url")&&(e.$items.eq(a).attr("data-download-url")||e.$items.eq(a).attr("href")||e.$items.eq(a).attr("data-src")),j?($("#lg-download").attr("href",j),e.$outer.removeClass("lg-hide-download")):e.$outer.addClass("lg-hide-download")}if(this.$el.trigger("onBeforeSlide.lg",[d,a,b,c]),e.lgBusy=!0,clearTimeout(e.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){e.addHtml(a)},g),this.arrowDisable(a),b){var k=a-1,l=a+1;0===a&&d===f-1?(l=0,k=f-1):a===f-1&&0===d&&(l=0,k=f-1),this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide"),e.$slide.eq(k).addClass("lg-prev-slide"),e.$slide.eq(l).addClass("lg-next-slide"),e.$slide.eq(a).addClass("lg-current")}else e.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),d>a?(i=!0,0!==a||d!==f-1||c||(i=!1,h=!0)):a>d&&(h=!0,a!==f-1||0!==d||c||(i=!0,h=!1)),i?(this.$slide.eq(a).addClass("lg-prev-slide"),this.$slide.eq(d).addClass("lg-next-slide")):h&&(this.$slide.eq(a).addClass("lg-next-slide"),this.$slide.eq(d).addClass("lg-prev-slide")),setTimeout(function(){e.$slide.removeClass("lg-current"),e.$slide.eq(a).addClass("lg-current"),e.$outer.removeClass("lg-no-trans")},50);e.lGalleryOn?(setTimeout(function(){e.loadContent(a,!0,0)},this.s.speed+50),setTimeout(function(){e.lgBusy=!1,e.$el.trigger("onAfterSlide.lg",[d,a,b,c])},this.s.speed)):(e.loadContent(a,!0,e.s.backdropDuration),e.lgBusy=!1,e.$el.trigger("onAfterSlide.lg",[d,a,b,c])),e.lGalleryOn=!0,this.s.counter&&$("#lg-counter-current").text(a+1)}}},a.prototype.goToNextSlide=function(a){var b=this;b.lgBusy||(b.index+10?(b.index--,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1)):b.s.loop?(b.index=b.$items.length-1,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1)):b.s.slideEndAnimatoin&&(b.$outer.addClass("lg-left-end"),setTimeout(function(){b.$outer.removeClass("lg-left-end")},400)))},a.prototype.keyPress=function(){var a=this;this.$items.length>1&&$(window).on("keyup.lg",function(b){a.$items.length>1&&(37===b.keyCode&&(b.preventDefault(),a.goToPrevSlide()),39===b.keyCode&&(b.preventDefault(),a.goToNextSlide()))}),$(window).on("keydown.lg",function(b){a.s.escKey===!0&&27===b.keyCode&&(b.preventDefault(),a.$outer.hasClass("lg-thumb-open")?a.$outer.removeClass("lg-thumb-open"):a.destroy())})},a.prototype.arrow=function(){var a=this;this.$outer.find(".lg-prev").on("click.lg",function(){a.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){a.goToNextSlide()})},a.prototype.arrowDisable=function(a){!this.s.loop&&this.s.hideControlOnEnd&&(a+10?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},a.prototype.setTranslate=function(a,b,c){this.s.useLeft?a.css("left",b):a.css({transform:"translate3d("+b+"px, "+c+"px, 0px)"})},a.prototype.touchMove=function(a,b){var c=b-a;Math.abs(c)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),c,0),this.setTranslate($(".lg-prev-slide"),-this.$slide.eq(this.index).width()+c,0),this.setTranslate($(".lg-next-slide"),this.$slide.eq(this.index).width()+c,0))},a.prototype.touchEnd=function(a){var b=this;"lg-slide"!==b.s.mode&&b.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){b.$outer.removeClass("lg-dragging"),0>a&&Math.abs(a)>b.s.swipeThreshold?b.goToNextSlide(!0):a>0&&Math.abs(a)>b.s.swipeThreshold?b.goToPrevSlide(!0):Math.abs(a)<5&&b.$el.trigger("onSlideClick.lg"),b.$slide.removeAttr("style")}),setTimeout(function(){b.$outer.hasClass("lg-dragging")||"lg-slide"===b.s.mode||b.$outer.removeClass("lg-slide")},b.s.speed+100)},a.prototype.enableSwipe=function(){var a=this,b=0,c=0,d=!1;a.s.enableSwipe&&a.isTouch&&a.doCss()&&(a.$slide.on("touchstart.lg",function(c){a.$outer.hasClass("lg-zoomed")||a.lgBusy||(c.preventDefault(),a.manageSwipeClass(),b=c.originalEvent.targetTouches[0].pageX)}),a.$slide.on("touchmove.lg",function(e){a.$outer.hasClass("lg-zoomed")||(e.preventDefault(),c=e.originalEvent.targetTouches[0].pageX,a.touchMove(b,c),d=!0)}),a.$slide.on("touchend.lg",function(){a.$outer.hasClass("lg-zoomed")||(d?(d=!1,a.touchEnd(c-b)):a.$el.trigger("onSlideClick.lg"))}))},a.prototype.enableDrag=function(){var a=this,b=0,c=0,d=!1,e=!1;a.s.enableDrag&&!a.isTouch&&a.doCss()&&(a.$slide.on("mousedown.lg",function(c){a.$outer.hasClass("lg-zoomed")||($(c.target).hasClass("lg-object")||$(c.target).hasClass("lg-video-play"))&&(c.preventDefault(),a.lgBusy||(a.manageSwipeClass(),b=c.pageX,d=!0,a.$outer.scrollLeft+=1,a.$outer.scrollLeft-=1,a.$outer.removeClass("lg-grab").addClass("lg-grabbing"),a.$el.trigger("onDragstart.lg")))}),$(window).on("mousemove.lg",function(f){d&&(e=!0,c=f.pageX,a.touchMove(b,c),a.$el.trigger("onDragmove.lg"))}),$(window).on("mouseup.lg",function(f){e?(e=!1,a.touchEnd(c-b),a.$el.trigger("onDragend.lg")):($(f.target).hasClass("lg-object")||$(f.target).hasClass("lg-video-play"))&&a.$el.trigger("onSlideClick.lg"),d&&(d=!1,a.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},a.prototype.manageSwipeClass=function(){var a=this.index+1,b=this.index-1,c=this.$slide.length;this.s.loop&&(0===this.index?b=c-1:this.index===c-1&&(a=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),b>-1&&this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(a).addClass("lg-next-slide")},a.prototype.mousewheel=function(){var a=this;a.$outer.on("mousewheel.lg",function(b){b.deltaY&&(b.deltaY>0?a.goToPrevSlide():a.goToNextSlide(),b.preventDefault())})},a.prototype.closeGallery=function(){var a=this,b=!1;this.$outer.find(".lg-close").on("click.lg",function(){a.destroy()}),a.s.closable&&(a.$outer.on("mousedown.lg",function(a){b=!!($(a.target).is(".lg-outer")||$(a.target).is(".lg-item ")||$(a.target).is(".lg-img-wrap"))}),a.$outer.on("mouseup.lg",function(c){($(c.target).is(".lg-outer")||$(c.target).is(".lg-item ")||$(c.target).is(".lg-img-wrap")&&b)&&(a.$outer.hasClass("lg-dragging")||a.destroy())}))},a.prototype.destroy=function(a){var b=this;a||b.$el.trigger("onBeforeClose.lg"),$(window).scrollTop(b.prevScrollTop),a&&(b.s.dynamic||this.$items.off("click.lg click.lgcustom"),$.removeData(b.el,"lightGallery")),this.$el.off(".lg.tm"),$.each($.fn.lightGallery.modules,function(a){b.modules[a]&&b.modules[a].destroy()}),this.lGalleryOn=!1,clearTimeout(b.hideBartimeout),this.hideBartimeout=!1,$(window).off(".lg"),$("body").removeClass("lg-on lg-from-hash"),b.$outer&&b.$outer.removeClass("lg-visible"),$(".lg-backdrop").removeClass("in"),setTimeout(function(){b.$outer&&b.$outer.remove(),$(".lg-backdrop").remove(),a||b.$el.trigger("onCloseAfter.lg")},b.s.backdropDuration+50)},$.fn.lightGallery=function(b){return this.each(function(){if($.data(this,"lightGallery"))try{$(this).data("lightGallery").init()}catch(c){console.error("lightGallery has not initiated properly")}else $.data(this,"lightGallery",new a(this,b))})},$.fn.lightGallery.modules={}}()}); \ No newline at end of file diff --git a/assets/js/plugins.js b/assets/js/plugins.js index 08abe8f6..9b2ff37d 100644 --- a/assets/js/plugins.js +++ b/assets/js/plugins.js @@ -8,10 +8,8 @@ */ !function(a){a.fn.fitVids=function(b){var c={customSelector:null},d=document.createElement("div"),e=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];return d.className="fit-vids-style",d.innerHTML="­",e.parentNode.insertBefore(d,e),b&&a.extend(c,b),this.each(function(){var b=["iframe[src*='player.vimeo.com']","iframe[src*='www.youtube.com']","iframe[src*='www.kickstarter.com']","object","embed"];c.customSelector&&b.push(c.customSelector);var d=a(this).find(b.join(","));d.each(function(){var b=a(this);if(!("embed"==this.tagName.toLowerCase()&&b.parent("object").length||b.parent(".fluid-width-video-wrapper").length)){var c="object"==this.tagName.toLowerCase()?b.attr("height"):b.height(),d=c/b.width();if(!b.attr("id")){var e="fitvid"+Math.floor(999999*Math.random());b.attr("id",e)}b.wrap('
').parent(".fluid-width-video-wrapper").css("padding-top",100*d+"%"),b.removeAttr("height").removeAttr("width")}})})}}(jQuery); -/*! Magnific Popup - v1.0.0 - 2015-01-03 -* http://dimsemenov.com/plugins/magnific-popup/ -* Copyright (c) 2015 Dmitry Semenov; */ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=-1!==c.indexOf("MSIE 7."),b.isIE8=-1!==c.indexOf("MSIE 8."),b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith(''):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("
");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}); + + /*! @@ -159,424 +157,723 @@ +/*! lightgallery - v1.3.9 - 2017-02-05 + * http://sachinchoolur.github.io/lightGallery/ + * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(){"use strict";function b(b,d){if(this.el=b,this.$el=a(b),this.s=a.extend({},c,d),this.s.dynamic&&"undefined"!==this.s.dynamicEl&&this.s.dynamicEl.constructor===Array&&!this.s.dynamicEl.length)throw"When using dynamic mode, you must also define dynamicEl as an Array.";return this.modules={},this.lGalleryOn=!1,this.lgBusy=!1,this.hideBartimeout=!1,this.isTouch="ontouchstart"in document.documentElement,this.s.slideEndAnimatoin&&(this.s.hideControlOnEnd=!1),this.s.dynamic?this.$items=this.s.dynamicEl:"this"===this.s.selector?this.$items=this.$el:""!==this.s.selector?this.s.selectWithin?this.$items=a(this.s.selectWithin).find(this.s.selector):this.$items=this.$el.find(a(this.s.selector)):this.$items=this.$el.children(),this.$slide="",this.$outer="",this.init(),this}var c={mode:"lg-slide",cssEasing:"ease",easing:"linear",speed:600,height:"100%",width:"100%",addClass:"",startClass:"lg-start-zoom",backdropDuration:150,hideBarsDelay:6e3,useLeft:!1,closable:!0,loop:!0,escKey:!0,keyPress:!0,controls:!0,slideEndAnimatoin:!0,hideControlOnEnd:!1,mousewheel:!0,getCaptionFromTitleOrAlt:!0,appendSubHtmlTo:".lg-sub-html",subHtmlSelectorRelative:!1,preload:1,showAfterLoad:!0,selector:"",selectWithin:"",nextHtml:"",prevHtml:"",index:!1,iframeMaxWidth:"100%",download:!0,counter:!0,appendCounterTo:".lg-toolbar",swipeThreshold:50,enableSwipe:!0,enableDrag:!0,dynamic:!1,dynamicEl:[],galleryId:1};b.prototype.init=function(){var b=this;b.s.preload>b.$items.length&&(b.s.preload=b.$items.length);var c=window.location.hash;c.indexOf("lg="+this.s.galleryId)>0&&(b.index=parseInt(c.split("&slide=")[1],10),a("body").addClass("lg-from-hash"),a("body").hasClass("lg-on")||(setTimeout(function(){b.build(b.index)}),a("body").addClass("lg-on"))),b.s.dynamic?(b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||0,a("body").hasClass("lg-on")||setTimeout(function(){b.build(b.index),a("body").addClass("lg-on")})):b.$items.on("click.lgcustom",function(c){try{c.preventDefault(),c.preventDefault()}catch(a){c.returnValue=!1}b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||b.$items.index(this),a("body").hasClass("lg-on")||(b.build(b.index),a("body").addClass("lg-on"))})},b.prototype.build=function(b){var c=this;c.structure(),a.each(a.fn.lightGallery.modules,function(b){c.modules[b]=new a.fn.lightGallery.modules[b](c.el)}),c.slide(b,!1,!1,!1),c.s.keyPress&&c.keyPress(),c.$items.length>1&&(c.arrow(),setTimeout(function(){c.enableDrag(),c.enableSwipe()},50),c.s.mousewheel&&c.mousewheel()),c.counter(),c.closeGallery(),c.$el.trigger("onAfterOpen.lg"),c.$outer.on("mousemove.lg click.lg touchstart.lg",function(){c.$outer.removeClass("lg-hide-items"),clearTimeout(c.hideBartimeout),c.hideBartimeout=setTimeout(function(){c.$outer.addClass("lg-hide-items")},c.s.hideBarsDelay)}),c.$outer.trigger("mousemove.lg")},b.prototype.structure=function(){var b,c="",d="",e=0,f="",g=this;for(a("body").append('
'),a(".lg-backdrop").css("transition-duration",this.s.backdropDuration+"ms"),e=0;e
';if(this.s.controls&&this.$items.length>1&&(d='
'+this.s.prevHtml+'
'+this.s.nextHtml+"
"),".lg-sub-html"===this.s.appendSubHtmlTo&&(f='
'),b='
'+c+'
'+d+f+"
",a("body").append(b),this.$outer=a(".lg-outer"),this.$slide=this.$outer.find(".lg-item"),this.s.useLeft?(this.$outer.addClass("lg-use-left"),this.s.mode="lg-slide"):this.$outer.addClass("lg-use-css3"),g.setTop(),a(window).on("resize.lg orientationchange.lg",function(){setTimeout(function(){g.setTop()},100)}),this.$slide.eq(this.index).addClass("lg-current"),this.doCss()?this.$outer.addClass("lg-css3"):(this.$outer.addClass("lg-css"),this.s.speed=0),this.$outer.addClass(this.s.mode),this.s.enableDrag&&this.$items.length>1&&this.$outer.addClass("lg-grab"),this.s.showAfterLoad&&this.$outer.addClass("lg-show-after-load"),this.doCss()){var h=this.$outer.find(".lg-inner");h.css("transition-timing-function",this.s.cssEasing),h.css("transition-duration",this.s.speed+"ms")}setTimeout(function(){a(".lg-backdrop").addClass("in")}),setTimeout(function(){g.$outer.addClass("lg-visible")},this.s.backdropDuration),this.s.download&&this.$outer.find(".lg-toolbar").append(''),this.prevScrollTop=a(window).scrollTop()},b.prototype.setTop=function(){if("100%"!==this.s.height){var b=a(window).height(),c=(b-parseInt(this.s.height,10))/2,d=this.$outer.find(".lg");b>=parseInt(this.s.height,10)?d.css("top",c+"px"):d.css("top","0px")}},b.prototype.doCss=function(){var a=function(){var a=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],b=document.documentElement,c=0;for(c=0;c'+(parseInt(this.index,10)+1)+' / '+this.$items.length+"")},b.prototype.addHtml=function(b){var c,d,e=null;if(this.s.dynamic?this.s.dynamicEl[b].subHtmlUrl?c=this.s.dynamicEl[b].subHtmlUrl:e=this.s.dynamicEl[b].subHtml:(d=this.$items.eq(b),d.attr("data-sub-html-url")?c=d.attr("data-sub-html-url"):(e=d.attr("data-sub-html"),this.s.getCaptionFromTitleOrAlt&&!e&&(e=d.attr("title")||d.find("img").first().attr("alt")))),!c)if("undefined"!=typeof e&&null!==e){var f=e.substring(0,1);"."!==f&&"#"!==f||(e=this.s.subHtmlSelectorRelative&&!this.s.dynamic?d.find(e).html():a(e).html())}else e="";".lg-sub-html"===this.s.appendSubHtmlTo?c?this.$outer.find(this.s.appendSubHtmlTo).load(c):this.$outer.find(this.s.appendSubHtmlTo).html(e):c?this.$slide.eq(b).load(c):this.$slide.eq(b).append(e),"undefined"!=typeof e&&null!==e&&(""===e?this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"):this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html")),this.$el.trigger("onAfterAppendSubHtml.lg",[b])},b.prototype.preload=function(a){var b=1,c=1;for(b=1;b<=this.s.preload&&!(b>=this.$items.length-a);b++)this.loadContent(a+b,!1,0);for(c=1;c<=this.s.preload&&!(a-c<0);c++)this.loadContent(a-c,!1,0)},b.prototype.loadContent=function(b,c,d){var e,f,g,h,i,j,k=this,l=!1,m=function(b){for(var c=[],d=[],e=0;eh){f=d[i];break}};if(k.s.dynamic){if(k.s.dynamicEl[b].poster&&(l=!0,g=k.s.dynamicEl[b].poster),j=k.s.dynamicEl[b].html,f=k.s.dynamicEl[b].src,k.s.dynamicEl[b].responsive){var n=k.s.dynamicEl[b].responsive.split(",");m(n)}h=k.s.dynamicEl[b].srcset,i=k.s.dynamicEl[b].sizes}else{if(k.$items.eq(b).attr("data-poster")&&(l=!0,g=k.$items.eq(b).attr("data-poster")),j=k.$items.eq(b).attr("data-html"),f=k.$items.eq(b).attr("href")||k.$items.eq(b).attr("data-src"),k.$items.eq(b).attr("data-responsive")){var o=k.$items.eq(b).attr("data-responsive").split(",");m(o)}h=k.$items.eq(b).attr("data-srcset"),i=k.$items.eq(b).attr("data-sizes")}var p=!1;k.s.dynamic?k.s.dynamicEl[b].iframe&&(p=!0):"true"===k.$items.eq(b).attr("data-iframe")&&(p=!0);var q=k.isVideo(f,b);if(!k.$slide.eq(b).hasClass("lg-loaded")){if(p)k.$slide.eq(b).prepend('
');else if(l){var r="";r=q&&q.youtube?"lg-has-youtube":q&&q.vimeo?"lg-has-vimeo":"lg-has-html5",k.$slide.eq(b).prepend('
')}else q?(k.$slide.eq(b).prepend('
'),k.$el.trigger("hasVideo.lg",[b,f,j])):k.$slide.eq(b).prepend('
');if(k.$el.trigger("onAferAppendSlide.lg",[b]),e=k.$slide.eq(b).find(".lg-object"),i&&e.attr("sizes",i),h){e.attr("srcset",h);try{picturefill({elements:[e[0]]})}catch(a){console.error("Make sure you have included Picturefill version 2")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&k.addHtml(b),k.$slide.eq(b).addClass("lg-loaded")}k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){var c=0;d&&!a("body").hasClass("lg-from-hash")&&(c=d),setTimeout(function(){k.$slide.eq(b).addClass("lg-complete"),k.$el.trigger("onSlideItemLoad.lg",[b,d||0])},c)}),q&&q.html5&&!l&&k.$slide.eq(b).addClass("lg-complete"),c===!0&&(k.$slide.eq(b).hasClass("lg-complete")?k.preload(b):k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){k.preload(b)}))},b.prototype.slide=function(b,c,d,e){var f=this.$outer.find(".lg-current").index(),g=this;if(!g.lGalleryOn||f!==b){var h=this.$slide.length,i=g.lGalleryOn?this.s.speed:0;if(!g.lgBusy){if(this.s.download){var j;j=g.s.dynamic?g.s.dynamicEl[b].downloadUrl!==!1&&(g.s.dynamicEl[b].downloadUrl||g.s.dynamicEl[b].src):"false"!==g.$items.eq(b).attr("data-download-url")&&(g.$items.eq(b).attr("data-download-url")||g.$items.eq(b).attr("href")||g.$items.eq(b).attr("data-src")),j?(a("#lg-download").attr("href",j),g.$outer.removeClass("lg-hide-download")):g.$outer.addClass("lg-hide-download")}if(this.$el.trigger("onBeforeSlide.lg",[f,b,c,d]),g.lgBusy=!0,clearTimeout(g.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){g.addHtml(b)},i),this.arrowDisable(b),e||(bf&&(e="next")),c){this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide");var k,l;h>2?(k=b-1,l=b+1,0===b&&f===h-1?(l=0,k=h-1):b===h-1&&0===f&&(l=0,k=h-1)):(k=0,l=1),"prev"===e?g.$slide.eq(l).addClass("lg-next-slide"):g.$slide.eq(k).addClass("lg-prev-slide"),g.$slide.eq(b).addClass("lg-current")}else g.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),"prev"===e?(this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(f).addClass("lg-next-slide")):(this.$slide.eq(b).addClass("lg-next-slide"),this.$slide.eq(f).addClass("lg-prev-slide")),setTimeout(function(){g.$slide.removeClass("lg-current"),g.$slide.eq(b).addClass("lg-current"),g.$outer.removeClass("lg-no-trans")},50);g.lGalleryOn?(setTimeout(function(){g.loadContent(b,!0,0)},this.s.speed+50),setTimeout(function(){g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])},this.s.speed)):(g.loadContent(b,!0,g.s.backdropDuration),g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])),g.lGalleryOn=!0,this.s.counter&&a("#lg-counter-current").text(b+1)}}},b.prototype.goToNextSlide=function(a){var b=this,c=b.s.loop;a&&b.$slide.length<3&&(c=!1),b.lgBusy||(b.index+10?(b.index--,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):c?(b.index=b.$items.length-1,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):b.s.slideEndAnimatoin&&!a&&(b.$outer.addClass("lg-left-end"),setTimeout(function(){b.$outer.removeClass("lg-left-end")},400)))},b.prototype.keyPress=function(){var b=this;this.$items.length>1&&a(window).on("keyup.lg",function(a){b.$items.length>1&&(37===a.keyCode&&(a.preventDefault(),b.goToPrevSlide()),39===a.keyCode&&(a.preventDefault(),b.goToNextSlide()))}),a(window).on("keydown.lg",function(a){b.s.escKey===!0&&27===a.keyCode&&(a.preventDefault(),b.$outer.hasClass("lg-thumb-open")?b.$outer.removeClass("lg-thumb-open"):b.destroy())})},b.prototype.arrow=function(){var a=this;this.$outer.find(".lg-prev").on("click.lg",function(){a.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){a.goToNextSlide()})},b.prototype.arrowDisable=function(a){!this.s.loop&&this.s.hideControlOnEnd&&(a+10?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},b.prototype.setTranslate=function(a,b,c){this.s.useLeft?a.css("left",b):a.css({transform:"translate3d("+b+"px, "+c+"px, 0px)"})},b.prototype.touchMove=function(b,c){var d=c-b;Math.abs(d)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),d,0),this.setTranslate(a(".lg-prev-slide"),-this.$slide.eq(this.index).width()+d,0),this.setTranslate(a(".lg-next-slide"),this.$slide.eq(this.index).width()+d,0))},b.prototype.touchEnd=function(a){var b=this;"lg-slide"!==b.s.mode&&b.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){b.$outer.removeClass("lg-dragging"),a<0&&Math.abs(a)>b.s.swipeThreshold?b.goToNextSlide(!0):a>0&&Math.abs(a)>b.s.swipeThreshold?b.goToPrevSlide(!0):Math.abs(a)<5&&b.$el.trigger("onSlideClick.lg"),b.$slide.removeAttr("style")}),setTimeout(function(){b.$outer.hasClass("lg-dragging")||"lg-slide"===b.s.mode||b.$outer.removeClass("lg-slide")},b.s.speed+100)},b.prototype.enableSwipe=function(){var a=this,b=0,c=0,d=!1;a.s.enableSwipe&&a.isTouch&&a.doCss()&&(a.$slide.on("touchstart.lg",function(c){a.$outer.hasClass("lg-zoomed")||a.lgBusy||(c.preventDefault(),a.manageSwipeClass(),b=c.originalEvent.targetTouches[0].pageX)}),a.$slide.on("touchmove.lg",function(e){a.$outer.hasClass("lg-zoomed")||(e.preventDefault(),c=e.originalEvent.targetTouches[0].pageX,a.touchMove(b,c),d=!0)}),a.$slide.on("touchend.lg",function(){a.$outer.hasClass("lg-zoomed")||(d?(d=!1,a.touchEnd(c-b)):a.$el.trigger("onSlideClick.lg"))}))},b.prototype.enableDrag=function(){var b=this,c=0,d=0,e=!1,f=!1;b.s.enableDrag&&!b.isTouch&&b.doCss()&&(b.$slide.on("mousedown.lg",function(d){b.$outer.hasClass("lg-zoomed")||(a(d.target).hasClass("lg-object")||a(d.target).hasClass("lg-video-play"))&&(d.preventDefault(),b.lgBusy||(b.manageSwipeClass(),c=d.pageX,e=!0,b.$outer.scrollLeft+=1,b.$outer.scrollLeft-=1,b.$outer.removeClass("lg-grab").addClass("lg-grabbing"),b.$el.trigger("onDragstart.lg")))}),a(window).on("mousemove.lg",function(a){e&&(f=!0,d=a.pageX,b.touchMove(c,d),b.$el.trigger("onDragmove.lg"))}),a(window).on("mouseup.lg",function(g){f?(f=!1,b.touchEnd(d-c),b.$el.trigger("onDragend.lg")):(a(g.target).hasClass("lg-object")||a(g.target).hasClass("lg-video-play"))&&b.$el.trigger("onSlideClick.lg"),e&&(e=!1,b.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},b.prototype.manageSwipeClass=function(){var a=this.index+1,b=this.index-1;this.s.loop&&this.$slide.length>2&&(0===this.index?b=this.$slide.length-1:this.index===this.$slide.length-1&&(a=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),b>-1&&this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(a).addClass("lg-next-slide")},b.prototype.mousewheel=function(){var a=this;a.$outer.on("mousewheel.lg",function(b){b.deltaY&&(b.deltaY>0?a.goToPrevSlide():a.goToNextSlide(),b.preventDefault())})},b.prototype.closeGallery=function(){var b=this,c=!1;this.$outer.find(".lg-close").on("click.lg",function(){b.destroy()}),b.s.closable&&(b.$outer.on("mousedown.lg",function(b){c=!!(a(b.target).is(".lg-outer")||a(b.target).is(".lg-item ")||a(b.target).is(".lg-img-wrap"))}),b.$outer.on("mouseup.lg",function(d){(a(d.target).is(".lg-outer")||a(d.target).is(".lg-item ")||a(d.target).is(".lg-img-wrap")&&c)&&(b.$outer.hasClass("lg-dragging")||b.destroy())}))},b.prototype.destroy=function(b){var c=this;b||(c.$el.trigger("onBeforeClose.lg"),a(window).scrollTop(c.prevScrollTop)),b&&(c.s.dynamic||this.$items.off("click.lg click.lgcustom"),a.removeData(c.el,"lightGallery")),this.$el.off(".lg.tm"),a.each(a.fn.lightGallery.modules,function(a){c.modules[a]&&c.modules[a].destroy()}),this.lGalleryOn=!1,clearTimeout(c.hideBartimeout),this.hideBartimeout=!1,a(window).off(".lg"),a("body").removeClass("lg-on lg-from-hash"),c.$outer&&c.$outer.removeClass("lg-visible"),a(".lg-backdrop").removeClass("in"),setTimeout(function(){c.$outer&&c.$outer.remove(),a(".lg-backdrop").remove(),b||c.$el.trigger("onCloseAfter.lg")},c.s.backdropDuration+50)},a.fn.lightGallery=function(c){return this.each(function(){if(a.data(this,"lightGallery"))try{a(this).data("lightGallery").init()}catch(a){console.error("lightGallery has not initiated properly")}else a.data(this,"lightGallery",new b(this,c))})},a.fn.lightGallery.modules={}}()}); + + + +(function($, window, document, undefined) { + + 'use strict'; + + var defaults = { + videoMaxWidth: '855px', + youtubePlayerParams: false, + vimeoPlayerParams: false, + dailymotionPlayerParams: false, + vkPlayerParams: false, + videojs: false, + videojsOptions: {} + }; + + var Video = function(element) { + + this.core = $(element).data('lightGallery'); + + this.$el = $(element); + this.core.s = $.extend({}, defaults, this.core.s); + this.videoLoaded = false; + + this.init(); + + return this; + }; + + Video.prototype.init = function() { + var _this = this; + + // Event triggered when video url found without poster + _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) { + _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); + if (html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + if (!_this.videoLoaded) { + this.play(); + } + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); + } + } + }); + + // Set max width for video + _this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) { + _this.core.$slide.eq(index).find('.lg-video-cont').css('max-width', _this.core.s.videoMaxWidth); + _this.videoLoaded = true; + }); + + var loadOnClick = function($el) { + // check slide has poster + if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { + + // check already video element present + if (!$el.hasClass('lg-has-video')) { + + $el.addClass('lg-video-playing lg-has-video'); + + var _src; + var _html; + var _loadVideo = function(_src, _html) { + + $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); + + if (_html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + this.play(); + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); + } + } + + }; + + if (_this.core.s.dynamic) { + + _src = _this.core.s.dynamicEl[_this.core.index].src; + _html = _this.core.s.dynamicEl[_this.core.index].html; + + _loadVideo(_src, _html); + + } else { + + _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); + _html = _this.core.$items.eq(_this.core.index).attr('data-html'); + + _loadVideo(_src, _html); + + } + + var $tempImg = $el.find('.lg-object'); + $el.find('.lg-video').append($tempImg); + + // @todo loading icon for html5 videos also + // for showing the loading indicator while loading video + if (!$el.find('.lg-video-object').hasClass('lg-html5')) { + $el.removeClass('lg-complete'); + $el.find('.lg-video-object').on('load.lg error.lg', function() { + $el.addClass('lg-complete'); + }); + } + + } else { + + var youtubePlayer = $el.find('.lg-youtube').get(0); + var vimeoPlayer = $el.find('.lg-vimeo').get(0); + var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); + var html5Player = $el.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('play'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('play', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).play(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.play(); + } + } + + $el.addClass('lg-video-playing'); + + } + } + }; + + if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) { + _this.core.$el.on('onSlideClick.lg.tm', function() { + var $el = _this.core.$slide.eq(_this.core.index); + loadOnClick($el); + }); + } else { + + // For IE 9 and bellow + _this.core.$slide.on('click.lg', function() { + loadOnClick($(this)); + }); + } + + _this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) { + + var $videoSlide = _this.core.$slide.eq(prevIndex); + var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); + var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); + var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); + var vkPlayer = $videoSlide.find('.lg-vk').get(0); + var html5Player = $videoSlide.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('pause'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('pause', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).pause(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.pause(); + } + } if (vkPlayer) { + $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); + } + + var _src; + if (_this.core.s.dynamic) { + _src = _this.core.s.dynamicEl[index].src; + } else { + _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); + + } + + var _isVideo = _this.core.isVideo(_src, index) || {}; + if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { + _this.core.$outer.addClass('lg-hide-download'); + } + + //$videoSlide.addClass('lg-complete'); + + }); + + _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) { + _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); + }); + }; + + Video.prototype.loadVideo = function(src, addClass, noposter, index, html) { + var video = ''; + var autoplay = 1; + var a = ''; + var isVideo = this.core.isVideo(src, index) || {}; + + // Enable autoplay for first video if poster doesn't exist + if (noposter) { + if (this.videoLoaded) { + autoplay = 0; + } else { + autoplay = 1; + } + } + + if (isVideo.youtube) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; + if (this.core.s.youtubePlayerParams) { + a = a + '&' + $.param(this.core.s.youtubePlayerParams); + } + + video = ''; + + } else if (isVideo.vimeo) { + + a = '?autoplay=' + autoplay + '&api=1'; + if (this.core.s.vimeoPlayerParams) { + a = a + '&' + $.param(this.core.s.vimeoPlayerParams); + } + + video = ''; + + } else if (isVideo.dailymotion) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; + if (this.core.s.dailymotionPlayerParams) { + a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); + } + + video = ''; + + } else if (isVideo.html5) { + var fL = html.substring(0, 1); + if (fL === '.' || fL === '#') { + html = $(html).html(); + } + + video = html; + + } else if (isVideo.vk) { + + a = '&autoplay=' + autoplay; + if (this.core.s.vkPlayerParams) { + a = a + '&' + $.param(this.core.s.vkPlayerParams); + } + + video = ''; + + } + + return video; + }; + + Video.prototype.destroy = function() { + this.videoLoaded = false; + }; + + $.fn.lightGallery.modules.video = Video; + +})(jQuery, window, document); + + + + +/*! + * parallax.js v1.4.2 (http://pixelcog.github.io/parallax.js/) + * @copyright 2016 PixelCog, Inc. + * @license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE) + */ + +;(function ( $, window, document, undefined ) { + + // Polyfill for requestAnimationFrame + // via: https://gist.github.com/paulirish/1579671 + + (function() { + var lastTime = 0; + var vendors = ['ms', 'moz', 'webkit', 'o']; + for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; + window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] + || window[vendors[x]+'CancelRequestAnimationFrame']; + } + + if (!window.requestAnimationFrame) + window.requestAnimationFrame = function(callback) { + var currTime = new Date().getTime(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var id = window.setTimeout(function() { callback(currTime + timeToCall); }, + timeToCall); + lastTime = currTime + timeToCall; + return id; + }; + + if (!window.cancelAnimationFrame) + window.cancelAnimationFrame = function(id) { + clearTimeout(id); + }; + }()); + + + // Parallax Constructor + + function Parallax(element, options) { + var self = this; + + if (typeof options == 'object') { + delete options.refresh; + delete options.render; + $.extend(this, options); + } + + this.$element = $(element); + + if (!this.imageSrc && this.$element.is('img')) { + this.imageSrc = this.$element.attr('src'); + } + + var positions = (this.position + '').toLowerCase().match(/\S+/g) || []; + + if (positions.length < 1) { + positions.push('center'); + } + if (positions.length == 1) { + positions.push(positions[0]); + } + + if (positions[0] == 'top' || positions[0] == 'bottom' || positions[1] == 'left' || positions[1] == 'right') { + positions = [positions[1], positions[0]]; + } + + if (this.positionX != undefined) positions[0] = this.positionX.toLowerCase(); + if (this.positionY != undefined) positions[1] = this.positionY.toLowerCase(); + + self.positionX = positions[0]; + self.positionY = positions[1]; + + if (this.positionX != 'left' && this.positionX != 'right') { + if (isNaN(parseInt(this.positionX))) { + this.positionX = 'center'; + } else { + this.positionX = parseInt(this.positionX); + } + } + + if (this.positionY != 'top' && this.positionY != 'bottom') { + if (isNaN(parseInt(this.positionY))) { + this.positionY = 'center'; + } else { + this.positionY = parseInt(this.positionY); + } + } + + this.position = + this.positionX + (isNaN(this.positionX)? '' : 'px') + ' ' + + this.positionY + (isNaN(this.positionY)? '' : 'px'); + + if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { + if (this.imageSrc && this.iosFix && !this.$element.is('img')) { + this.$element.css({ + backgroundImage: 'url(' + this.imageSrc + ')', + backgroundSize: 'cover', + backgroundPosition: this.position + }); + } + return this; + } + + if (navigator.userAgent.match(/(Android)/)) { + if (this.imageSrc && this.androidFix && !this.$element.is('img')) { + this.$element.css({ + backgroundImage: 'url(' + this.imageSrc + ')', + backgroundSize: 'cover', + backgroundPosition: this.position + }); + } + return this; + } + + this.$mirror = $('
').prependTo('body'); + + /** + * add by sa shrimp2t + * @type {*|string} + */ + var el_id = this.$element.attr( 'id' ) || ''; + if ( typeof el_id === "undefined" || el_id === '' ){ + el_id = 'parallax-'+ ( new Date().getTime() ); + this.$element.attr( 'id', el_id ); + } + this.$mirror.attr( 'id', 'mirror-' + el_id ); + + + + + var slider = this.$element.find('>.parallax-slider'); + var sliderExisted = false; + + if (slider.length == 0) + this.$slider = $('').prependTo(this.$mirror); + else { + this.$slider = slider.prependTo(this.$mirror) + sliderExisted = true; + } + + this.$mirror.addClass('parallax-mirror').css({ + visibility: 'hidden', + zIndex: this.zIndex, + position: 'fixed', + top: 0, + left: 0, + overflow: 'hidden' + }); + + this.$slider.addClass('parallax-slider').one('load', function() { + if (!self.naturalHeight || !self.naturalWidth) { + self.naturalHeight = this.naturalHeight || this.height || 1; + self.naturalWidth = this.naturalWidth || this.width || 1; + } + self.aspectRatio = self.naturalWidth / self.naturalHeight; + + Parallax.isSetup || Parallax.setup(); + Parallax.sliders.push(self); + Parallax.isFresh = false; + Parallax.requestRender(); + }); + + if (!sliderExisted) + this.$slider[0].src = this.imageSrc; + + if (this.naturalHeight && this.naturalWidth || this.$slider[0].complete || slider.length > 0) { + this.$slider.trigger('load'); + } + + }; + + + // Parallax Instance Methods + + $.extend(Parallax.prototype, { + speed: 0.2, + bleed: 0, + zIndex: -100, + iosFix: true, + androidFix: true, + position: 'center', + overScrollFix: true, + + refresh: function() { + this.boxWidth = this.$element.outerWidth(); + this.boxHeight = this.$element.outerHeight() + this.bleed * 2; + this.boxOffsetTop = this.$element.offset().top - this.bleed; + this.boxOffsetLeft = this.$element.offset().left; + this.boxOffsetBottom = this.boxOffsetTop + this.boxHeight; + + var winHeight = Parallax.winHeight; + var docHeight = Parallax.docHeight; + var maxOffset = Math.min(this.boxOffsetTop, docHeight - winHeight); + var minOffset = Math.max(this.boxOffsetTop + this.boxHeight - winHeight, 0); + var imageHeightMin = this.boxHeight + (maxOffset - minOffset) * (1 - this.speed) | 0; + var imageOffsetMin = (this.boxOffsetTop - maxOffset) * (1 - this.speed) | 0; + + if (imageHeightMin * this.aspectRatio >= this.boxWidth) { + this.imageWidth = imageHeightMin * this.aspectRatio | 0; + this.imageHeight = imageHeightMin; + this.offsetBaseTop = imageOffsetMin; + + var margin = this.imageWidth - this.boxWidth; + + if (this.positionX == 'left') { + this.offsetLeft = 0; + } else if (this.positionX == 'right') { + this.offsetLeft = - margin; + } else if (!isNaN(this.positionX)) { + this.offsetLeft = Math.max(this.positionX, - margin); + } else { + this.offsetLeft = - margin / 2 | 0; + } + } else { + this.imageWidth = this.boxWidth; + this.imageHeight = this.boxWidth / this.aspectRatio | 0; + this.offsetLeft = 0; + + var margin = this.imageHeight - imageHeightMin; + + if (this.positionY == 'top') { + this.offsetBaseTop = imageOffsetMin; + } else if (this.positionY == 'bottom') { + this.offsetBaseTop = imageOffsetMin - margin; + } else if (!isNaN(this.positionY)) { + this.offsetBaseTop = imageOffsetMin + Math.max(this.positionY, - margin); + } else { + this.offsetBaseTop = imageOffsetMin - margin / 2 | 0; + } + } + }, + + render: function() { + var scrollTop = Parallax.scrollTop; + var scrollLeft = Parallax.scrollLeft; + var overScroll = this.overScrollFix ? Parallax.overScroll : 0; + var scrollBottom = scrollTop + Parallax.winHeight; + + if (this.boxOffsetBottom > scrollTop && this.boxOffsetTop <= scrollBottom) { + this.visibility = 'visible'; + this.mirrorTop = this.boxOffsetTop - scrollTop; + this.mirrorLeft = this.boxOffsetLeft - scrollLeft; + this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed); + } else { + this.visibility = 'hidden'; + } + + this.$mirror.css({ + transform: 'translate3d(0px, 0px, 0px)', + visibility: this.visibility, + top: this.mirrorTop - overScroll, + left: this.mirrorLeft, + height: this.boxHeight, + width: this.boxWidth + }); + + this.$slider.css({ + transform: 'translate3d(0px, 0px, 0px)', + position: 'absolute', + top: this.offsetTop, + left: this.offsetLeft, + height: this.imageHeight, + width: this.imageWidth, + maxWidth: 'none' + }); + } + }); + + + // Parallax Static Methods + + $.extend(Parallax, { + scrollTop: 0, + scrollLeft: 0, + winHeight: 0, + winWidth: 0, + docHeight: 1 << 30, + docWidth: 1 << 30, + sliders: [], + isReady: false, + isFresh: false, + isBusy: false, + + setup: function() { + if (this.isReady) return; + + var $doc = $(document), $win = $(window); + + var loadDimensions = function() { + Parallax.winHeight = $win.height(); + Parallax.winWidth = $win.width(); + Parallax.docHeight = $doc.height(); + Parallax.docWidth = $doc.width(); + }; + + var loadScrollPosition = function() { + var winScrollTop = $win.scrollTop(); + var scrollTopMax = Parallax.docHeight - Parallax.winHeight; + var scrollLeftMax = Parallax.docWidth - Parallax.winWidth; + Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, winScrollTop)); + Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft())); + Parallax.overScroll = Math.max(winScrollTop - scrollTopMax, Math.min(winScrollTop, 0)); + }; + + $win.on('resize.px.parallax load.px.parallax', function() { + loadDimensions(); + Parallax.isFresh = false; + Parallax.requestRender(); + }) + .on('scroll.px.parallax load.px.parallax', function() { + loadScrollPosition(); + Parallax.requestRender(); + }); + + loadDimensions(); + loadScrollPosition(); + + this.isReady = true; + }, + + configure: function(options) { + if (typeof options == 'object') { + delete options.refresh; + delete options.render; + $.extend(this.prototype, options); + } + }, + + refresh: function() { + $.each(this.sliders, function(){ this.refresh() }); + this.isFresh = true; + }, + + render: function() { + this.isFresh || this.refresh(); + $.each(this.sliders, function(){ this.render() }); + }, + + requestRender: function() { + var self = this; + + if (!this.isBusy) { + this.isBusy = true; + window.requestAnimationFrame(function() { + self.render(); + self.isBusy = false; + }); + } + }, + destroy: function(el){ + var i, + parallaxElement = $(el).data('px.parallax'); + parallaxElement.$mirror.remove(); + for(i=0; i < this.sliders.length; i+=1){ + if(this.sliders[i] == parallaxElement){ + this.sliders.splice(i, 1); + } + } + $(el).data('px.parallax', false); + if(this.sliders.length === 0){ + $(window).off('scroll.px.parallax resize.px.parallax load.px.parallax'); + this.isReady = false; + Parallax.isSetup = false; + } + } + }); + + + // Parallax Plugin Definition + + function Plugin(option) { + return this.each(function () { + var $this = $(this); + var options = typeof option == 'object' && option; + + if (this == window || this == document || $this.is('body')) { + Parallax.configure(options); + } + else if (!$this.data('px.parallax')) { + options = $.extend({}, $this.data(), options); + $this.data('px.parallax', new Parallax(this, options)); + } + else if (typeof option == 'object') + { + $.extend($this.data('px.parallax'), options); + } + if (typeof option == 'string') { + if(option == 'destroy'){ + Parallax['destroy'](this); + }else{ + Parallax[option](); + } + } + }) + }; + + var old = $.fn.parallax; + + $.fn.parallax = Plugin; + $.fn.parallax.Constructor = Parallax; + + + // Parallax No Conflict + + $.fn.parallax.noConflict = function () { + $.fn.parallax = old; + return this; + }; + + + // Parallax Data-API + + $(document).on('ready.px.parallax.data-api', function () { + $('[data-parallax="scroll"]').parallax(); + }); - /*! - * parallax.js v1.3.1 (http://pixelcog.github.io/parallax.js/) - * @copyright 2015 PixelCog, Inc. - * @license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE) - */ +}(jQuery, window, document)); - ;(function ( $, window, document, undefined ) { - // Polyfill for requestAnimationFrame - // via: https://gist.github.com/paulirish/1579671 - - (function() { - var lastTime = 0; - var vendors = ['ms', 'moz', 'webkit', 'o']; - for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] - || window[vendors[x]+'CancelRequestAnimationFrame']; - } - - if (!window.requestAnimationFrame) - window.requestAnimationFrame = function(callback) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function() { callback(currTime + timeToCall); }, - timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - - if (!window.cancelAnimationFrame) - window.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; - }()); - - - // Parallax Constructor - - function Parallax(element, options) { - var self = this; - - if (typeof options == 'object') { - delete options.refresh; - delete options.render; - $.extend(this, options); - } - - this.$element = $(element); - - - - if (!this.imageSrc && this.$element.is('img')) { - this.imageSrc = this.$element.attr('src'); - } - - var positions = (this.position + '').toLowerCase().match(/\S+/g) || []; - - if (positions.length < 1) { - positions.push('center'); - } - if (positions.length == 1) { - positions.push(positions[0]); - } - - if (positions[0] == 'top' || positions[0] == 'bottom' || positions[1] == 'left' || positions[1] == 'right') { - positions = [positions[1], positions[0]]; - } - - if (this.positionX != undefined) positions[0] = this.positionX.toLowerCase(); - if (this.positionY != undefined) positions[1] = this.positionY.toLowerCase(); - - self.positionX = positions[0]; - self.positionY = positions[1]; - - if (this.positionX != 'left' && this.positionX != 'right') { - if (isNaN(parseInt(this.positionX))) { - this.positionX = 'center'; - } else { - this.positionX = parseInt(this.positionX); - } - } - - if (this.positionY != 'top' && this.positionY != 'bottom') { - if (isNaN(parseInt(this.positionY))) { - this.positionY = 'center'; - } else { - this.positionY = parseInt(this.positionY); - } - } - - this.position = - this.positionX + (isNaN(this.positionX)? '' : 'px') + ' ' + - this.positionY + (isNaN(this.positionY)? '' : 'px'); - - if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { - if (this.imageSrc && this.iosFix && !this.$element.is('img')) { - this.$element.css({ - backgroundImage: 'url(' + this.imageSrc + ')', - backgroundSize: 'cover', - backgroundPosition: this.position - }); - } - return this; - } - - if (navigator.userAgent.match(/(Android)/)) { - if (this.imageSrc && this.androidFix && !this.$element.is('img')) { - this.$element.css({ - backgroundImage: 'url(' + this.imageSrc + ')', - backgroundSize: 'cover', - backgroundPosition: this.position - }); - } - return this; - } - - // this.$mirror = $('
').prependTo('body'); - this.$mirror = $('
').prependTo( this.$element ); - - /** - * add by sa shrimp2t - * @type {*|string} - */ - var el_id = this.$element.attr( 'id' ) || ''; - if ( typeof el_id === "undefined" || el_id === '' ){ - el_id = 'parallax-'+ ( new Date().getTime() ); - this.$element.attr( 'id', el_id ); - } - this.$mirror.attr( 'id', 'mirror-' + el_id ); - - - - var slider = this.$element.find('>.parallax-slider'); - var sliderExisted = false; - - if (slider.length == 0) - this.$slider = $('').prependTo(this.$mirror); - else { - this.$slider = slider.prependTo(this.$mirror) - sliderExisted = true; - } - - this.$mirror.addClass('parallax-mirror').css({ - visibility: 'hidden', - zIndex: this.zIndex, - position: 'fixed', - top: 0, - left: 0, - overflow: 'hidden' - }); - - this.$slider.addClass('parallax-slider').one('load', function() { - if (!self.naturalHeight || !self.naturalWidth) { - self.naturalHeight = this.naturalHeight || this.height || 1; - self.naturalWidth = this.naturalWidth || this.width || 1; - } - self.aspectRatio = self.naturalWidth / self.naturalHeight; - - Parallax.isSetup || Parallax.setup(); - Parallax.sliders.push(self); - Parallax.isFresh = false; - Parallax.requestRender(); - }); - - if (!sliderExisted) - this.$slider[0].src = this.imageSrc; - - if (this.naturalHeight && this.naturalWidth || this.$slider[0].complete || slider.length > 0) { - this.$slider.trigger('load'); - } - - }; - - - // Parallax Instance Methods - - $.extend(Parallax.prototype, { - speed: 0.2, - bleed: 0, - zIndex: -100, - iosFix: true, - androidFix: true, - position: 'center', - overScrollFix: false, - - refresh: function() { - this.boxWidth = this.$element.outerWidth(); - this.boxHeight = this.$element.outerHeight() + this.bleed * 2; - this.boxOffsetTop = this.$element.offset().top - this.bleed; - this.boxOffsetLeft = this.$element.offset().left; - this.boxOffsetBottom = this.boxOffsetTop + this.boxHeight; - - var winHeight = Parallax.winHeight; - var docHeight = Parallax.docHeight; - var maxOffset = Math.min(this.boxOffsetTop, docHeight - winHeight); - var minOffset = Math.max(this.boxOffsetTop + this.boxHeight - winHeight, 0); - var imageHeightMin = this.boxHeight + (maxOffset - minOffset) * (1 - this.speed) | 0; - var imageOffsetMin = (this.boxOffsetTop - maxOffset) * (1 - this.speed) | 0; - - if (imageHeightMin * this.aspectRatio >= this.boxWidth) { - this.imageWidth = imageHeightMin * this.aspectRatio | 0; - this.imageHeight = imageHeightMin; - this.offsetBaseTop = imageOffsetMin; - - var margin = this.imageWidth - this.boxWidth; - - if (this.positionX == 'left') { - this.offsetLeft = 0; - } else if (this.positionX == 'right') { - this.offsetLeft = - margin; - } else if (!isNaN(this.positionX)) { - this.offsetLeft = Math.max(this.positionX, - margin); - } else { - this.offsetLeft = - margin / 2 | 0; - } - } else { - this.imageWidth = this.boxWidth; - this.imageHeight = this.boxWidth / this.aspectRatio | 0; - this.offsetLeft = 0; - - var margin = this.imageHeight - imageHeightMin; - - if (this.positionY == 'top') { - this.offsetBaseTop = imageOffsetMin; - } else if (this.positionY == 'bottom') { - this.offsetBaseTop = imageOffsetMin - margin; - } else if (!isNaN(this.positionY)) { - this.offsetBaseTop = imageOffsetMin + Math.max(this.positionY, - margin); - } else { - this.offsetBaseTop = imageOffsetMin - margin / 2 | 0; - } - } - }, - - render: function() { - var scrollTop = Parallax.scrollTop; - var scrollLeft = Parallax.scrollLeft; - var overScroll = this.overScrollFix ? Parallax.overScroll : 0; - var scrollBottom = scrollTop + Parallax.winHeight; - - if (this.boxOffsetBottom > scrollTop && this.boxOffsetTop <= scrollBottom) { - this.visibility = 'visible'; - } else { - this.visibility = 'hidden'; - } - this.mirrorTop = this.boxOffsetTop - scrollTop; - this.mirrorLeft = this.boxOffsetLeft - scrollLeft; - this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed); - - this.$mirror.css({ - transform: 'translate3d(0px, 0px, 0px)', - visibility: this.visibility, - top: this.mirrorTop - overScroll, - left: this.mirrorLeft, - height: this.boxHeight, - width: this.boxWidth - }); - - this.$slider.css({ - transform: 'translate3d(0px, 0px, 0px)', - position: 'absolute', - top: this.offsetTop, - left: this.offsetLeft, - height: this.imageHeight, - width: this.imageWidth, - maxWidth: 'none' - }); - } - }); - - - // Parallax Static Methods - - $.extend(Parallax, { - scrollTop: 0, - scrollLeft: 0, - winHeight: 0, - winWidth: 0, - docHeight: 1 << 30, - docWidth: 1 << 30, - sliders: [], - isReady: false, - isFresh: false, - isBusy: false, - - setup: function() { - if (this.isReady) return; - - var $doc = $(document), $win = $(window); - - var loadDimensions = function() { - Parallax.winHeight = $win.height(); - Parallax.winWidth = $win.width(); - Parallax.docHeight = $doc.height(); - Parallax.docWidth = $doc.width(); - }; - - var loadScrollPosition = function() { - var winScrollTop = $win.scrollTop(); - var scrollTopMax = Parallax.docHeight - Parallax.winHeight; - var scrollLeftMax = Parallax.docWidth - Parallax.winWidth; - Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, winScrollTop)); - Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft())); - Parallax.overScroll = Math.max(winScrollTop - scrollTopMax, Math.min(winScrollTop, 0)); - }; - - $win.on('resize.px.parallax load.px.parallax', function() { - loadDimensions(); - Parallax.isFresh = false; - Parallax.requestRender(); - }) - .on('scroll.px.parallax load.px.parallax', function() { - loadScrollPosition(); - Parallax.requestRender(); - }); - - loadDimensions(); - loadScrollPosition(); - - this.isReady = true; - }, - - configure: function(options) { - if (typeof options == 'object') { - delete options.refresh; - delete options.render; - $.extend(this.prototype, options); - } - }, - - refresh: function() { - $.each(this.sliders, function(){ this.refresh() }); - this.isFresh = true; - }, - - render: function() { - this.isFresh || this.refresh(); - $.each(this.sliders, function(){ this.render() }); - }, - - requestRender: function() { - var self = this; - - if (!this.isBusy) { - this.isBusy = true; - window.requestAnimationFrame(function() { - self.render(); - self.isBusy = false; - }); - } - }, - destroy: function(el){ - var i, - parallaxElement = $(el).data('px.parallax'); - parallaxElement.$mirror.remove(); - for(i=0; i < this.sliders.length; i+=1){ - if(this.sliders[i] == parallaxElement){ - this.sliders.splice(i, 1); - } - } - $(el).data('px.parallax', false); - if(this.sliders.length === 0){ - $(window).off('scroll.px.parallax resize.px.parallax load.px.parallax'); - this.isReady = false; - Parallax.isSetup = false; - } - } - }); - - - // Parallax Plugin Definition - - function Plugin(option) { - return this.each(function () { - var $this = $(this); - var options = typeof option == 'object' && option; - - if (this == window || this == document || $this.is('body')) { - Parallax.configure(options); - } - else if (!$this.data('px.parallax')) { - options = $.extend({}, $this.data(), options); - $this.data('px.parallax', new Parallax(this, options)); - } - else if (typeof option == 'object') - { - $.extend($this.data('px.parallax'), options); - } - if (typeof option == 'string') { - if(option == 'destroy'){ - Parallax['destroy'](this); - }else{ - Parallax[option](); - } - } - }) - }; - - var old = $.fn.parallax; - - $.fn.parallax = Plugin; - $.fn.parallax.Constructor = Parallax; - - - // Parallax No Conflict - - $.fn.parallax.noConflict = function () { - $.fn.parallax = old; - return this; - }; - - // Parallax Data-API - - $(document).on('ready.px.parallax.data-api', function () { - $('[data-parallax="scroll"]').parallax(); - }); - - - }(jQuery, window, document)); diff --git a/assets/js/theme.js b/assets/js/theme.js index 396e1c45..59fbc1e7 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -420,19 +420,13 @@ jQuery(document).ready(function ( $ ) { /** - * Call magnificPopup when use + * Video lightbox */ - jQuery('.popup-video').magnificPopup({ - //disableOn: 700, - type: 'iframe', - mainClass: 'mfp-fade', - removalDelay: 160, - preloader: false, - fixedContentPos: false, - zoom: { - enabled:true - } - }); + + if ($.fn.lightGallery ) { + + $(".videolightbox-popup").lightGallery({}); + } // Counter Up $('.counter').counterUp({ @@ -449,37 +443,6 @@ jQuery(document).ready(function ( $ ) { } - /** - * Parallax Section - */ - jQuery(window).resize(function(){ - onepressParallax(); - }); - - function onepressParallax() { - var testMobile = isMobile.any(); - - jQuery('.section-has-parallax').each(function() { - var $this = jQuery(this); - var bg = $this.find('.parallax_bg'); - var img = $this.data('bg'); - - preload_images( [ img ], function(){ - jQuery(bg).css('backgroundImage', 'url(' + img + ')'); - if (testMobile == null) { - jQuery(bg).addClass('not-mobile'); - jQuery(bg).removeClass('is-mobile'); - jQuery(bg).parallax('50%', 0.4); - } else { - //jQuery(bg).css('backgroundAttachment', 'inherit'); - jQuery(bg).removeClass('not-mobile'); - jQuery(bg).addClass('is-mobile'); - } - }); - - }); - } - /** * Section: Hero Full Screen Slideshow @@ -515,20 +478,21 @@ jQuery(document).ready(function ( $ ) { if ( images ) { preload_images(images, function () { + console.log( _to_number( onepress_js_settings.hero_duration ) ); hero.backstretch(images, { - fade: 750, - duration: 5000 + fade: _to_number( onepress_js_settings.hero_fade ), + duration: _to_number( onepress_js_settings.hero_duration ) }); hero.addClass('loaded'); hero.removeClass( 'loading' ); setTimeout(function () { - hero.find('.sk-cube-grid').remove(); + hero.find('.slider-spinner').remove(); }, 600); }); } else { hero.addClass('loaded'); hero.removeClass( 'loading' ); - hero.find('.sk-cube-grid').remove(); + hero.find('.slider-spinner`').remove(); } } ); @@ -542,12 +506,12 @@ jQuery(document).ready(function ( $ ) { hero.find('.hero-slideshow-wrapper').addClass('loaded'); hero.removeClass( 'loading' ); setTimeout(function () { - hero.find('.hero-slideshow-wrapper').find('.sk-cube-grid').remove(); + hero.find('.hero-slideshow-wrapper').find('.slider-spinner').remove(); }, 600); }); } else { hero.removeClass( 'loading' ); - hero.find('.hero-slideshow-wrapper').find('.sk-cube-grid').remove(); + hero.find('.hero-slideshow-wrapper').find('.slider-spinner').remove(); hero.find('.hero-slideshow-wrapper').addClass('loaded').removeClass( 'loading' ); } } ); @@ -645,8 +609,6 @@ jQuery(document).ready(function ( $ ) { var gutter = m.attr('data-gutter') || 10; var columns = m.attr('data-col') || 5; - console.log( columns ); - gutter = _to_number(gutter); columns = _to_number(columns); diff --git a/assets/sass/_elements.scss b/assets/sass/_elements.scss index 2ba637ed..e1bf4e73 100644 --- a/assets/sass/_elements.scss +++ b/assets/sass/_elements.scss @@ -39,65 +39,44 @@ /* Loading ------------------------------*/ -.sk-cube-grid { +.slider-spinner { width: 40px; height: 40px; + position: relative; margin: 100px auto; } -.sk-cube-grid .sk-cube { - width: 33%; - height: 33%; +.double-bounce1, .double-bounce2 { + width: 100%; + height: 100%; + border-radius: 50%; background-color: #fff; - float: left; - -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; - animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; + opacity: 0.6; + position: absolute; + top: 0; + left: 0; + + -webkit-animation: sk-bounce 2.0s infinite ease-in-out; + animation: sk-bounce 2.0s infinite ease-in-out; } -.sk-cube-grid .sk-cube1 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; } -.sk-cube-grid .sk-cube2 { - -webkit-animation-delay: 0.3s; - animation-delay: 0.3s; } -.sk-cube-grid .sk-cube3 { - -webkit-animation-delay: 0.4s; - animation-delay: 0.4s; } -.sk-cube-grid .sk-cube4 { - -webkit-animation-delay: 0.1s; - animation-delay: 0.1s; } -.sk-cube-grid .sk-cube5 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; } -.sk-cube-grid .sk-cube6 { - -webkit-animation-delay: 0.3s; - animation-delay: 0.3s; } -.sk-cube-grid .sk-cube7 { - -webkit-animation-delay: 0s; - animation-delay: 0s; } -.sk-cube-grid .sk-cube8 { - -webkit-animation-delay: 0.1s; - animation-delay: 0.1s; } -.sk-cube-grid .sk-cube9 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; } -@-webkit-keyframes sk-cubeGridScaleDelay { - 0%, 70%, 100% { - -webkit-transform: scale3D(1, 1, 1); - transform: scale3D(1, 1, 1); - } 35% { - -webkit-transform: scale3D(0, 0, 1); - transform: scale3D(0, 0, 1); - } +.double-bounce2 { + -webkit-animation-delay: -1.0s; + animation-delay: -1.0s; +} + +@-webkit-keyframes sk-bounce { + 0%, 100% { -webkit-transform: scale(0.0) } + 50% { -webkit-transform: scale(1.0) } } -@keyframes sk-cubeGridScaleDelay { - 0%, 70%, 100% { - -webkit-transform: scale3D(1, 1, 1); - transform: scale3D(1, 1, 1); - } 35% { - -webkit-transform: scale3D(0, 0, 1); - transform: scale3D(0, 0, 1); +@keyframes sk-bounce { + 0%, 100% { + transform: scale(0.0); + -webkit-transform: scale(0.0); + } 50% { + transform: scale(1.0); + -webkit-transform: scale(1.0); } } diff --git a/assets/sass/_sections.scss b/assets/sass/_sections.scss index 98f97636..b4952d24 100644 --- a/assets/sass/_sections.scss +++ b/assets/sass/_sections.scss @@ -193,7 +193,7 @@ } /* Loading icon */ - .sk-cube-grid { + .slider-spinner { position: absolute; top: 50%; left: 50%; @@ -206,7 +206,7 @@ // DIsable text animation .is-customize-preview { - .sk-cube-grid { + .slider-spinner { display: none !important; } .hero-slideshow-wrapper { diff --git a/assets/sass/style.scss b/assets/sass/style.scss index 9dc369b1..c66bee14 100644 --- a/assets/sass/style.scss +++ b/assets/sass/style.scss @@ -4,7 +4,7 @@ Theme URI: https://www.famethemes.com/themes/onepress/ Author: FameThemes Author URI: http://www.famethemes.com Description: OnePress is an outstanding creative and flexible WordPress one page theme well suited for business website, portfolio, digital agency, product showcase, freelancers and everyone else who appreciate good design. The theme overall is an elegant and classic one, a fine example of Bootstrap 4 WordPress theme which compatibility with latest version of WooCommerce. (Live preview : http://www.famethemes.com/preview/?theme=OnePress) -Version: 1.3.0 +Version: 1.3.1 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: onepress diff --git a/changelog.md b/changelog.md index b5a89d16..e191f100 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,17 @@ ==================================================================== CHANGELOG ========= +## 1.3.1 +* Fix social icons. +* Make contact form label full width. +* Update images size for gallery masonry and justified. +* New slider speed option, move hero settings to hero sections. +* Update parallax version. +* Add custom section padding in Customizer. +* Change hero loading icon. +* Remove Magnific-Popup, update lightbox video. + + ## 1.3.0 * WP 4.7 compatible. * Support WP 4.7 customizer shortcut. diff --git a/functions.php b/functions.php index ebbb94c7..a742cd11 100644 --- a/functions.php +++ b/functions.php @@ -183,6 +183,8 @@ function onepress_scripts() { 'onepress_vertical_align_menu' => get_theme_mod( 'onepress_vertical_align_menu' ), 'hero_animation' => get_theme_mod( 'onepress_hero_option_animation', 'flipInX' ), 'hero_speed' => intval( get_theme_mod( 'onepress_hero_option_speed', 5000 ) ), + 'hero_fade' => intval( get_theme_mod( 'onepress_hero_slider_fade', 750 ) ), + 'hero_duration' => intval( get_theme_mod( 'onepress_hero_slider_duration', 5000 ) ), 'is_home' => '', 'gallery_enable' => '', ); @@ -212,10 +214,8 @@ function onepress_scripts() { wp_enqueue_script('onepress-gallery-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.min.js', array(), $version, true); } - if ( get_theme_mod( 'onepress_g_lightbox', 1 ) || is_customize_preview() ) { - wp_enqueue_script('onepress-gallery-lightgallery', get_template_directory_uri() . '/assets/js/lightgallery.js', array('jquery'), $version, true); - wp_enqueue_style( 'onepress-gallery-lightgallery', get_template_directory_uri().'/assets/css/lightgallery.css' ); - } + wp_enqueue_style( 'onepress-gallery-lightgallery', get_template_directory_uri().'/assets/css/lightgallery.css' ); + } wp_enqueue_script( 'onepress-theme', get_template_directory_uri() . '/assets/js/theme.js', array(), $version, true ); diff --git a/inc/customizer.php b/inc/customizer.php index 2f850c00..c061da08 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -541,68 +541,7 @@ function onepress_customize_register( $wp_customize ) { ) ); - /* Hero options - ----------------------------------------------------------------------*/ - $wp_customize->add_section( - 'onepress_hero_options', - array( - 'title' => __( 'Hero Options', 'onepress' ), - 'panel' => 'onepress_options', - ) - ); - - - $wp_customize->add_setting( - 'onepress_hero_option_animation', - array( - 'default' => 'flipInX', - 'sanitize_callback' => 'sanitize_text_field', - ) - ); - - /** - * @see https://github.com/daneden/animate.css - */ - $animations_css = 'bounce flash pulse rubberBand shake headShake swing tada wobble jello bounceIn bounceInDown bounceInLeft bounceInRight bounceInUp bounceOut bounceOutDown bounceOutLeft bounceOutRight bounceOutUp fadeIn fadeInDown fadeInDownBig fadeInLeft fadeInLeftBig fadeInRight fadeInRightBig fadeInUp fadeInUpBig fadeOut fadeOutDown fadeOutDownBig fadeOutLeft fadeOutLeftBig fadeOutRight fadeOutRightBig fadeOutUp fadeOutUpBig flipInX flipInY flipOutX flipOutY lightSpeedIn lightSpeedOut rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rotateOut rotateOutDownLeft rotateOutDownRight rotateOutUpLeft rotateOutUpRight hinge rollIn rollOut zoomIn zoomInDown zoomInLeft zoomInRight zoomInUp zoomOut zoomOutDown zoomOutLeft zoomOutRight zoomOutUp slideInDown slideInLeft slideInRight slideInUp slideOutDown slideOutLeft slideOutRight slideOutUp'; - - $animations_css = explode( ' ', $animations_css ); - $animations = array(); - foreach ( $animations_css as $v ) { - $v = trim( $v ); - if ( $v ){ - $animations[ $v ]= $v; - } - - } - - $wp_customize->add_control( - 'onepress_hero_option_animation', - array( - 'label' => __( 'Text animation', 'onepress' ), - 'section' => 'onepress_hero_options', - 'type' => 'select', - 'choices' => $animations, - ) - ); - - - $wp_customize->add_setting( - 'onepress_hero_option_speed', - array( - 'default' => '5000', - 'sanitize_callback' => 'sanitize_text_field', - ) - ); - - $wp_customize->add_control( - 'onepress_hero_option_speed', - array( - 'label' => __( 'Speed', 'onepress' ), - 'description' => esc_html__( 'The delay between the changing of each phrase in milliseconds.', 'onepress' ), - 'section' => 'onepress_hero_options', - ) - ); if ( ! function_exists( 'wp_get_custom_css' ) ) { // Back-compat for WordPress < 4.7. @@ -766,6 +705,99 @@ function onepress_customize_register( $wp_customize ) { ) ); + + /* Hero options + ----------------------------------------------------------------------*/ + + $wp_customize->add_setting( + 'onepress_hero_option_animation', + array( + 'default' => 'flipInX', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + /** + * @see https://github.com/daneden/animate.css + */ + + $animations_css = 'bounce flash pulse rubberBand shake headShake swing tada wobble jello bounceIn bounceInDown bounceInLeft bounceInRight bounceInUp bounceOut bounceOutDown bounceOutLeft bounceOutRight bounceOutUp fadeIn fadeInDown fadeInDownBig fadeInLeft fadeInLeftBig fadeInRight fadeInRightBig fadeInUp fadeInUpBig fadeOut fadeOutDown fadeOutDownBig fadeOutLeft fadeOutLeftBig fadeOutRight fadeOutRightBig fadeOutUp fadeOutUpBig flipInX flipInY flipOutX flipOutY lightSpeedIn lightSpeedOut rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rotateOut rotateOutDownLeft rotateOutDownRight rotateOutUpLeft rotateOutUpRight hinge rollIn rollOut zoomIn zoomInDown zoomInLeft zoomInRight zoomInUp zoomOut zoomOutDown zoomOutLeft zoomOutRight zoomOutUp slideInDown slideInLeft slideInRight slideInUp slideOutDown slideOutLeft slideOutRight slideOutUp'; + + $animations_css = explode( ' ', $animations_css ); + $animations = array(); + foreach ( $animations_css as $v ) { + $v = trim( $v ); + if ( $v ){ + $animations[ $v ]= $v; + } + + } + + $wp_customize->add_control( + 'onepress_hero_option_animation', + array( + 'label' => __( 'Text animation', 'onepress' ), + 'section' => 'onepress_hero_settings', + 'type' => 'select', + 'choices' => $animations, + ) + ); + + + $wp_customize->add_setting( + 'onepress_hero_option_speed', + array( + 'default' => '5000', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + $wp_customize->add_control( + 'onepress_hero_option_speed', + array( + 'label' => __( 'Text animation speed', 'onepress' ), + 'description' => esc_html__( 'The delay between the changing of each phrase in milliseconds.', 'onepress' ), + 'section' => 'onepress_hero_settings', + ) + ); + + + $wp_customize->add_setting( + 'onepress_hero_slider_fade', + array( + 'default' => '750', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + $wp_customize->add_control( + 'onepress_hero_slider_fade', + array( + 'label' => __( 'Slider animation speed', 'onepress' ), + 'description' => esc_html__( 'This is the speed at which the image will fade in. Integers in milliseconds are accepted.', 'onepress' ), + 'section' => 'onepress_hero_settings', + ) + ); + + $wp_customize->add_setting( + 'onepress_hero_slider_duration', + array( + 'default' => '5000', + 'sanitize_callback' => 'sanitize_text_field', + ) + ); + + $wp_customize->add_control( + 'onepress_hero_slider_duration', + array( + 'label' => __( 'Slider duration speed', 'onepress' ), + 'description' => esc_html__( 'The amount of time in between slides, expressed as the number of milliseconds.', 'onepress' ), + 'section' => 'onepress_hero_settings', + ) + ); + + + $wp_customize->add_section( 'onepress_hero_images' , array( 'priority' => 6, diff --git a/section-parts/section-hero.php b/section-parts/section-hero.php index e0592f60..b8e67dc1 100644 --- a/section-parts/section-hero.php +++ b/section-parts/section-hero.php @@ -48,16 +48,9 @@
data-images="" class="hero-slideshow-wrapper "> -
-
-
-
-
-
-
-
-
-
+
+
+
-
+
class=""> @@ -21,8 +21,8 @@ class="
-
- + diff --git a/style.css b/style.css index 1958ecfd..ad7f3881 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: https://www.famethemes.com/themes/onepress/ Author: FameThemes Author URI: http://www.famethemes.com Description: OnePress is an outstanding creative and flexible WordPress one page theme well suited for business website, portfolio, digital agency, product showcase, freelancers and everyone else who appreciate good design. The theme overall is an elegant and classic one, a fine example of Bootstrap 4 WordPress theme which compatibility with latest version of WooCommerce. (Live preview : http://www.famethemes.com/preview/?theme=OnePress) -Version: 1.3.0 +Version: 1.3.1 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: onepress @@ -1226,7 +1226,7 @@ h6, p, ul, ol, dl, blockquote, pre { .site-footer .footer-connect { padding: 90px 0px; padding: 80px 0px; - padding: 5rem 0rem; + padding: 5rem 0px; text-align: center; } @@ -1877,85 +1877,48 @@ h6, p, ul, ol, dl, blockquote, pre { /* Loading ------------------------------*/ -.sk-cube-grid { +.slider-spinner { width: 40px; height: 40px; + position: relative; margin: 100px auto; } -.sk-cube-grid .sk-cube { - width: 33%; - height: 33%; +.double-bounce1, .double-bounce2 { + width: 100%; + height: 100%; + border-radius: 50%; background-color: #fff; - float: left; - -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; - animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; -} - -.sk-cube-grid .sk-cube1 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; -} - -.sk-cube-grid .sk-cube2 { - -webkit-animation-delay: 0.3s; - animation-delay: 0.3s; -} - -.sk-cube-grid .sk-cube3 { - -webkit-animation-delay: 0.4s; - animation-delay: 0.4s; -} - -.sk-cube-grid .sk-cube4 { - -webkit-animation-delay: 0.1s; - animation-delay: 0.1s; -} - -.sk-cube-grid .sk-cube5 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; -} - -.sk-cube-grid .sk-cube6 { - -webkit-animation-delay: 0.3s; - animation-delay: 0.3s; -} - -.sk-cube-grid .sk-cube7 { - -webkit-animation-delay: 0s; - animation-delay: 0s; -} - -.sk-cube-grid .sk-cube8 { - -webkit-animation-delay: 0.1s; - animation-delay: 0.1s; + opacity: 0.6; + position: absolute; + top: 0; + left: 0; + -webkit-animation: sk-bounce 2.0s infinite ease-in-out; + animation: sk-bounce 2.0s infinite ease-in-out; } -.sk-cube-grid .sk-cube9 { - -webkit-animation-delay: 0.2s; - animation-delay: 0.2s; +.double-bounce2 { + -webkit-animation-delay: -1.0s; + animation-delay: -1.0s; } -@-webkit-keyframes sk-cubeGridScaleDelay { - 0%, 70%, 100% { - -webkit-transform: scale3D(1, 1, 1); - transform: scale3D(1, 1, 1); +@-webkit-keyframes sk-bounce { + 0%, 100% { + -webkit-transform: scale(0); } - 35% { - -webkit-transform: scale3D(0, 0, 1); - transform: scale3D(0, 0, 1); + 50% { + -webkit-transform: scale(1); } } -@keyframes sk-cubeGridScaleDelay { - 0%, 70%, 100% { - -webkit-transform: scale3D(1, 1, 1); - transform: scale3D(1, 1, 1); +@keyframes sk-bounce { + 0%, 100% { + transform: scale(0); + -webkit-transform: scale(0); } - 35% { - -webkit-transform: scale3D(0, 0, 1); - transform: scale3D(0, 0, 1); + 50% { + transform: scale(1); + -webkit-transform: scale(1); } } @@ -2081,17 +2044,17 @@ section > .customize-partial-edit-shortcut button { ------------------------------*/ .section-padding { padding: 70px 0px; - padding: 4.375rem 0rem; + padding: 4.375rem 0px; } .section-padding-lg { padding: 90px 0px; - padding: 5.625rem 0rem; + padding: 5.625rem 0px; } .section-padding-larger { padding: 140px 0px; - padding: 8.75rem 0rem; + padding: 8.75rem 0px; } .section-meta { @@ -2288,7 +2251,7 @@ section > .customize-partial-edit-shortcut button { transform: translateY(0); } -.hero-slideshow-wrapper .sk-cube-grid { +.hero-slideshow-wrapper .slider-spinner { position: absolute; top: 50%; left: 50%; @@ -2298,7 +2261,7 @@ section > .customize-partial-edit-shortcut button { transform: translate(-50%, -50%); } -.is-customize-preview .sk-cube-grid { +.is-customize-preview .slider-spinner { display: none !important; } @@ -2390,7 +2353,7 @@ section > .customize-partial-edit-shortcut button { .hero__content a.btn { margin: 10px 10px 20px 0px; - margin: 0.625rem 0.625rem 1.25rem 0rem; + margin: 0.625rem 0.625rem 1.25rem 0px; } .hero__content p { @@ -2419,7 +2382,7 @@ section > .customize-partial-edit-shortcut button { .hero-content-style2 .hcl2-content { padding: 50px 0px; - padding: 3.125rem 0rem; + padding: 3.125rem 0px; } .hero-content-style2 .hcl2-image {