Initial website

This commit is contained in:
Deon George
2018-09-03 17:41:16 +10:00
commit fd1bd20c85
238 changed files with 20819 additions and 0 deletions

View File

@@ -0,0 +1,216 @@
/**!
* lg-autoplay.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-autoplay.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgAutoplay = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgAutoplay = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var autoplayDefaults = {
autoplay: false,
pause: 5000,
progressBar: true,
fourceAutoplay: false,
autoplayControls: true,
appendAutoplayControlsTo: '.lg-toolbar'
};
/**
* Creates the autoplay plugin.
* @param {object} element - lightGallery element
*/
var Autoplay = function Autoplay(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
// Execute only if items are above 1
if (this.core.items.length < 2) {
return false;
}
this.core.s = _extends({}, autoplayDefaults, this.core.s);
this.interval = false;
// Identify if slide happened from autoplay
this.fromAuto = true;
// Identify if autoplay canceled from touch/drag
this.canceledOnTouch = false;
// save fourceautoplay value
this.fourceAutoplayTemp = this.core.s.fourceAutoplay;
// do not allow progress bar if browser does not support css3 transitions
if (!this.core.doCss()) {
this.core.s.progressBar = false;
}
this.init();
return this;
};
Autoplay.prototype.init = function () {
var _this = this;
// append autoplay controls
if (_this.core.s.autoplayControls) {
_this.controls();
}
// Create progress bar
if (_this.core.s.progressBar) {
_this.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', '<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
}
// set progress
_this.progress();
// Start autoplay
if (_this.core.s.autoplay) {
_this.startlAuto();
}
// cancel interval on touchstart and dragstart
utils.on(_this.el, 'onDragstart.lgtm touchstart.lgtm', function () {
if (_this.interval) {
_this.cancelAuto();
_this.canceledOnTouch = true;
}
});
// restore autoplay if autoplay canceled from touchstart / dragstart
utils.on(_this.el, 'onDragend.lgtm touchend.lgtm onSlideClick.lgtm', function () {
if (!_this.interval && _this.canceledOnTouch) {
_this.startlAuto();
_this.canceledOnTouch = false;
}
});
};
Autoplay.prototype.progress = function () {
var _this = this;
var _progressBar;
var _progress;
utils.on(_this.el, 'onBeforeSlide.lgtm', function () {
// start progress bar animation
if (_this.core.s.progressBar && _this.fromAuto) {
_progressBar = _this.core.outer.querySelector('.lg-progress-bar');
_progress = _this.core.outer.querySelector('.lg-progress');
if (_this.interval) {
_progress.removeAttribute('style');
utils.removeClass(_progressBar, 'lg-start');
setTimeout(function () {
utils.setVendor(_progress, 'Transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
utils.addClass(_progressBar, 'lg-start');
}, 20);
}
}
// Remove setinterval if slide is triggered manually and fourceautoplay is false
if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
_this.cancelAuto();
}
_this.fromAuto = false;
});
};
// Manage autoplay via play/stop buttons
Autoplay.prototype.controls = function () {
var _this = this;
var _html = '<span class="lg-autoplay-button lg-icon"></span>';
// Append autoplay controls
_this.core.outer.querySelector(this.core.s.appendAutoplayControlsTo).insertAdjacentHTML('beforeend', _html);
utils.on(_this.core.outer.querySelector('.lg-autoplay-button'), 'click.lg', function () {
if (utils.hasClass(_this.core.outer, 'lg-show-autoplay')) {
_this.cancelAuto();
_this.core.s.fourceAutoplay = false;
} else {
if (!_this.interval) {
_this.startlAuto();
_this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
}
}
});
};
// Autostart gallery
Autoplay.prototype.startlAuto = function () {
var _this = this;
utils.setVendor(_this.core.outer.querySelector('.lg-progress'), 'Transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
utils.addClass(_this.core.outer, 'lg-show-autoplay');
utils.addClass(_this.core.outer.querySelector('.lg-progress-bar'), 'lg-start');
_this.interval = setInterval(function () {
if (_this.core.index + 1 < _this.core.items.length) {
_this.core.index++;
} else {
_this.core.index = 0;
}
_this.fromAuto = true;
_this.core.slide(_this.core.index, false, false);
}, _this.core.s.speed + _this.core.s.pause);
};
// cancel Autostart
Autoplay.prototype.cancelAuto = function () {
clearInterval(this.interval);
this.interval = false;
if (this.core.outer.querySelector('.lg-progress')) {
this.core.outer.querySelector('.lg-progress').removeAttribute('style');
}
utils.removeClass(this.core.outer, 'lg-show-autoplay');
utils.removeClass(this.core.outer.querySelector('.lg-progress-bar'), 'lg-start');
};
Autoplay.prototype.destroy = function () {
this.cancelAuto();
if (this.core.outer.querySelector('.lg-progress-bar')) {
this.core.outer.querySelector('.lg-progress-bar').parentNode.removeChild(this.core.outer.querySelector('.lg-progress-bar'));
}
};
window.lgModules.autoplay = Autoplay;
});
},{}]},{},[1])(1)
});

View File

@@ -0,0 +1,7 @@
/**!
* lg-autoplay.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-autoplay.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LgAutoplay=e()}}(function(){var e,t,o;return function e(t,o,r){function s(n,u){if(!o[n]){if(!t[n]){var i="function"==typeof require&&require;if(!u&&i)return i(n,!0);if(l)return l(n,!0);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}var a=o[n]={exports:{}};t[n][0].call(a.exports,function(e){var o=t[n][1][e];return s(o?o:e)},a,a.exports,e,t,o,r)}return o[n].exports}for(var l="function"==typeof require&&require,n=0;n<r.length;n++)s(r[n]);return s}({1:[function(t,o,r){!function(t,o){if("function"==typeof e&&e.amd)e([],o);else if("undefined"!=typeof r)o();else{var s={exports:{}};o(),t.lgAutoplay=s.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},t={autoplay:!1,pause:5e3,progressBar:!0,fourceAutoplay:!1,autoplayControls:!0,appendAutoplayControlsTo:".lg-toolbar"},o=function o(r){return this.el=r,this.core=window.lgData[this.el.getAttribute("lg-uid")],!(this.core.items.length<2)&&(this.core.s=e({},t,this.core.s),this.interval=!1,this.fromAuto=!0,this.canceledOnTouch=!1,this.fourceAutoplayTemp=this.core.s.fourceAutoplay,this.core.doCss()||(this.core.s.progressBar=!1),this.init(),this)};o.prototype.init=function(){var e=this;e.core.s.autoplayControls&&e.controls(),e.core.s.progressBar&&e.core.outer.querySelector(".lg").insertAdjacentHTML("beforeend",'<div class="lg-progress-bar"><div class="lg-progress"></div></div>'),e.progress(),e.core.s.autoplay&&e.startlAuto(),utils.on(e.el,"onDragstart.lgtm touchstart.lgtm",function(){e.interval&&(e.cancelAuto(),e.canceledOnTouch=!0)}),utils.on(e.el,"onDragend.lgtm touchend.lgtm onSlideClick.lgtm",function(){!e.interval&&e.canceledOnTouch&&(e.startlAuto(),e.canceledOnTouch=!1)})},o.prototype.progress=function(){var e=this,t,o;utils.on(e.el,"onBeforeSlide.lgtm",function(){e.core.s.progressBar&&e.fromAuto&&(t=e.core.outer.querySelector(".lg-progress-bar"),o=e.core.outer.querySelector(".lg-progress"),e.interval&&(o.removeAttribute("style"),utils.removeClass(t,"lg-start"),setTimeout(function(){utils.setVendor(o,"Transition","width "+(e.core.s.speed+e.core.s.pause)+"ms ease 0s"),utils.addClass(t,"lg-start")},20))),e.fromAuto||e.core.s.fourceAutoplay||e.cancelAuto(),e.fromAuto=!1})},o.prototype.controls=function(){var e=this,t='<span class="lg-autoplay-button lg-icon"></span>';e.core.outer.querySelector(this.core.s.appendAutoplayControlsTo).insertAdjacentHTML("beforeend",t),utils.on(e.core.outer.querySelector(".lg-autoplay-button"),"click.lg",function(){utils.hasClass(e.core.outer,"lg-show-autoplay")?(e.cancelAuto(),e.core.s.fourceAutoplay=!1):e.interval||(e.startlAuto(),e.core.s.fourceAutoplay=e.fourceAutoplayTemp)})},o.prototype.startlAuto=function(){var e=this;utils.setVendor(e.core.outer.querySelector(".lg-progress"),"Transition","width "+(e.core.s.speed+e.core.s.pause)+"ms ease 0s"),utils.addClass(e.core.outer,"lg-show-autoplay"),utils.addClass(e.core.outer.querySelector(".lg-progress-bar"),"lg-start"),e.interval=setInterval(function(){e.core.index+1<e.core.items.length?e.core.index++:e.core.index=0,e.fromAuto=!0,e.core.slide(e.core.index,!1,!1)},e.core.s.speed+e.core.s.pause)},o.prototype.cancelAuto=function(){clearInterval(this.interval),this.interval=!1,this.core.outer.querySelector(".lg-progress")&&this.core.outer.querySelector(".lg-progress").removeAttribute("style"),utils.removeClass(this.core.outer,"lg-show-autoplay"),utils.removeClass(this.core.outer.querySelector(".lg-progress-bar"),"lg-start")},o.prototype.destroy=function(){this.cancelAuto(),this.core.outer.querySelector(".lg-progress-bar")&&this.core.outer.querySelector(".lg-progress-bar").parentNode.removeChild(this.core.outer.querySelector(".lg-progress-bar"))},window.lgModules.autoplay=o})},{}]},{},[1])(1)});

View File

@@ -0,0 +1,125 @@
/**!
* lg-fullscreen.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-fullscreen.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgFullscreen = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgFullscreen = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var fullscreenDefaults = {
fullScreen: true
};
var Fullscreen = function Fullscreen(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, fullscreenDefaults, this.core.s);
this.init();
return this;
};
Fullscreen.prototype.init = function () {
var fullScreen = '';
if (this.core.s.fullScreen) {
// check for fullscreen browser support
if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
return;
} else {
fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', fullScreen);
this.fullScreen();
}
}
};
Fullscreen.prototype.requestFullscreen = function () {
var el = document.documentElement;
if (el.requestFullscreen) {
el.requestFullscreen();
} else if (el.msRequestFullscreen) {
el.msRequestFullscreen();
} else if (el.mozRequestFullScreen) {
el.mozRequestFullScreen();
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen();
}
};
Fullscreen.prototype.exitFullscreen = function () {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
};
// https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
Fullscreen.prototype.fullScreen = function () {
var _this = this;
utils.on(document, 'fullscreenchange.lgfullscreen webkitfullscreenchange.lgfullscreen mozfullscreenchange.lgfullscreen MSFullscreenChange.lgfullscreen', function () {
if (utils.hasClass(_this.core.outer, 'lg-fullscreen-on')) {
utils.removeClass(_this.core.outer, 'lg-fullscreen-on');
} else {
utils.addClass(_this.core.outer, 'lg-fullscreen-on');
}
});
utils.on(this.core.outer.querySelector('.lg-fullscreen'), 'click.lg', function () {
if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
_this.requestFullscreen();
} else {
_this.exitFullscreen();
}
});
};
Fullscreen.prototype.destroy = function () {
// exit from fullscreen if activated
this.exitFullscreen();
utils.off(document, '.lgfullscreen');
};
window.lgModules.fullscreen = Fullscreen;
});
},{}]},{},[1])(1)
});

View File

@@ -0,0 +1,7 @@
/**!
* lg-fullscreen.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-fullscreen.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.LgFullscreen=e()}}(function(){var e,n,l;return function e(n,l,t){function r(o,c){if(!l[o]){if(!n[o]){var s="function"==typeof require&&require;if(!c&&s)return s(o,!0);if(u)return u(o,!0);var i=new Error("Cannot find module '"+o+"'");throw i.code="MODULE_NOT_FOUND",i}var f=l[o]={exports:{}};n[o][0].call(f.exports,function(e){var l=n[o][1][e];return r(l?l:e)},f,f.exports,e,n,l,t)}return l[o].exports}for(var u="function"==typeof require&&require,o=0;o<t.length;o++)r(t[o]);return r}({1:[function(n,l,t){!function(n,l){if("function"==typeof e&&e.amd)e([],l);else if("undefined"!=typeof t)l();else{var r={exports:{}};l(),n.lgFullscreen=r.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var l=arguments[n];for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&(e[t]=l[t])}return e},n={fullScreen:!0},l=function l(t){return this.el=t,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},n,this.core.s),this.init(),this};l.prototype.init=function(){var e="";if(this.core.s.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;e='<span class="lg-fullscreen lg-icon"></span>',this.core.outer.querySelector(".lg-toolbar").insertAdjacentHTML("beforeend",e),this.fullScreen()}},l.prototype.requestFullscreen=function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()},l.prototype.exitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},l.prototype.fullScreen=function(){var e=this;utils.on(document,"fullscreenchange.lgfullscreen webkitfullscreenchange.lgfullscreen mozfullscreenchange.lgfullscreen MSFullscreenChange.lgfullscreen",function(){utils.hasClass(e.core.outer,"lg-fullscreen-on")?utils.removeClass(e.core.outer,"lg-fullscreen-on"):utils.addClass(e.core.outer,"lg-fullscreen-on")}),utils.on(this.core.outer.querySelector(".lg-fullscreen"),"click.lg",function(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?e.exitFullscreen():e.requestFullscreen()})},l.prototype.destroy=function(){this.exitFullscreen(),utils.off(document,".lgfullscreen")},window.lgModules.fullscreen=l})},{}]},{},[1])(1)});

View File

@@ -0,0 +1,97 @@
/**!
* lg-hash.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-hash.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgHash = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgHash = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var hashDefaults = {
hash: true
};
var Hash = function Hash(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, hashDefaults, this.core.s);
if (this.core.s.hash) {
this.oldHash = window.location.hash;
this.init();
}
return this;
};
Hash.prototype.init = function () {
var _this = this;
var _hash;
// Change hash value on after each slide transition
utils.on(_this.core.el, 'onAfterSlide.lgtm', function (event) {
window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + event.detail.index;
});
// Listen hash change and change the slide according to slide value
utils.on(window, 'hashchange.lghash', function () {
_hash = window.location.hash;
var _idx = parseInt(_hash.split('&slide=')[1], 10);
// it galleryId doesn't exist in the url close the gallery
if (_hash.indexOf('lg=' + _this.core.s.galleryId) > -1) {
_this.core.slide(_idx, false, false);
} else if (_this.core.lGalleryOn) {
_this.core.destroy();
}
});
};
Hash.prototype.destroy = function () {
if (!this.core.s.hash) {
return;
}
// Reset to old hash value
if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) {
window.location.hash = this.oldHash;
} else {
if (history.pushState) {
history.pushState('', document.title, window.location.pathname + window.location.search);
} else {
window.location.hash = '';
}
}
utils.off(this.core.el, '.lghash');
};
window.lgModules.hash = Hash;
});
},{}]},{},[1])(1)
});

View File

@@ -0,0 +1,7 @@
/**!
* lg-hash.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-hash.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LgHash=e()}}(function(){var e,t,o;return function e(t,o,i){function n(s,l){if(!o[s]){if(!t[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(r)return r(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var f=o[s]={exports:{}};t[s][0].call(f.exports,function(e){var o=t[s][1][e];return n(o?o:e)},f,f.exports,e,t,o,i)}return o[s].exports}for(var r="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(t,o,i){!function(t,o){if("function"==typeof e&&e.amd)e([],o);else if("undefined"!=typeof i)o();else{var n={exports:{}};o(),t.lgHash=n.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},t={hash:!0},o=function o(i){return this.el=i,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},t,this.core.s),this.core.s.hash&&(this.oldHash=window.location.hash,this.init()),this};o.prototype.init=function(){var e=this,t;utils.on(e.core.el,"onAfterSlide.lgtm",function(t){window.location.hash="lg="+e.core.s.galleryId+"&slide="+t.detail.index}),utils.on(window,"hashchange.lghash",function(){t=window.location.hash;var o=parseInt(t.split("&slide=")[1],10);t.indexOf("lg="+e.core.s.galleryId)>-1?e.core.slide(o,!1,!1):e.core.lGalleryOn&&e.core.destroy()})},o.prototype.destroy=function(){this.core.s.hash&&(this.oldHash&&this.oldHash.indexOf("lg="+this.core.s.galleryId)<0?window.location.hash=this.oldHash:history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.hash="",utils.off(this.core.el,".lghash"))},window.lgModules.hash=o})},{}]},{},[1])(1)});

View File

@@ -0,0 +1,120 @@
/**!
* lg-pager.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-pager.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgPager = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgPager = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var pagerDefaults = {
pager: false
};
var Pager = function Pager(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, pagerDefaults, this.core.s);
if (this.core.s.pager && this.core.items.length > 1) {
this.init();
}
return this;
};
Pager.prototype.init = function () {
var _this = this;
var pagerList = '';
var $pagerCont;
var $pagerOuter;
var timeout;
_this.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', '<div class="lg-pager-outer"></div>');
if (_this.core.s.dynamic) {
for (var j = 0; j < _this.core.s.dynamicEl.length; j++) {
pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[j].thumb + '" /></div></span>';
}
} else {
for (var i = 0; i < _this.core.items.length; i++) {
if (!_this.core.s.exThumbImage) {
pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.items[i].querySelector('img').getAttribute('src') + '" /></div></span>';
} else {
pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.items[i].getAttribute(_this.core.s.exThumbImage) + '" /></div></span>';
}
}
}
$pagerOuter = _this.core.outer.querySelector('.lg-pager-outer');
$pagerOuter.innerHTML = pagerList;
$pagerCont = _this.core.outer.querySelectorAll('.lg-pager-cont');
for (var k = 0; k < $pagerCont.length; k++) {
/*jshint loopfunc: true */
(function (index) {
utils.on($pagerCont[index], 'click.lg touchend.lg', function () {
_this.core.index = index;
_this.core.slide(_this.core.index, false, false);
});
})(k);
}
utils.on($pagerOuter, 'mouseover.lg', function () {
clearTimeout(timeout);
utils.addClass($pagerOuter, 'lg-pager-hover');
});
utils.on($pagerOuter, 'mouseout.lg', function () {
timeout = setTimeout(function () {
utils.removeClass($pagerOuter, 'lg-pager-hover');
});
});
utils.on(_this.core.el, 'onBeforeSlide.lgtm', function (e) {
for (var n = 0; n < $pagerCont.length; n++) {
utils.removeClass($pagerCont[n], 'lg-pager-active');
if (e.detail.index === n) {
utils.addClass($pagerCont[n], 'lg-pager-active');
}
}
});
};
Pager.prototype.destroy = function () {};
window.lgModules.pager = Pager;
});
},{}]},{},[1])(1)
});

View File

@@ -0,0 +1,7 @@
/**!
* lg-pager.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-pager.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LgPager=e()}}(function(){var e,t,r;return function e(t,r,n){function o(i,a){if(!r[i]){if(!t[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(s)return s(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[i]={exports:{}};t[i][0].call(u.exports,function(e){var r=t[i][1][e];return o(r?r:e)},u,u.exports,e,t,r,n)}return r[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)o(n[i]);return o}({1:[function(t,r,n){!function(t,r){if("function"==typeof e&&e.amd)e([],r);else if("undefined"!=typeof n)r();else{var o={exports:{}};r(),t.lgPager=o.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},t={pager:!1},r=function r(n){return this.el=n,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},t,this.core.s),this.core.s.pager&&this.core.items.length>1&&this.init(),this};r.prototype.init=function(){var e=this,t="",r,n,o;if(e.core.outer.querySelector(".lg").insertAdjacentHTML("beforeend",'<div class="lg-pager-outer"></div>'),e.core.s.dynamic)for(var s=0;s<e.core.s.dynamicEl.length;s++)t+='<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+e.core.s.dynamicEl[s].thumb+'" /></div></span>';else for(var i=0;i<e.core.items.length;i++)t+=e.core.s.exThumbImage?'<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+e.core.items[i].getAttribute(e.core.s.exThumbImage)+'" /></div></span>':'<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="'+e.core.items[i].querySelector("img").getAttribute("src")+'" /></div></span>';n=e.core.outer.querySelector(".lg-pager-outer"),n.innerHTML=t,r=e.core.outer.querySelectorAll(".lg-pager-cont");for(var a=0;a<r.length;a++)!function(t){utils.on(r[t],"click.lg touchend.lg",function(){e.core.index=t,e.core.slide(e.core.index,!1,!1)})}(a);utils.on(n,"mouseover.lg",function(){clearTimeout(o),utils.addClass(n,"lg-pager-hover")}),utils.on(n,"mouseout.lg",function(){o=setTimeout(function(){utils.removeClass(n,"lg-pager-hover")})}),utils.on(e.core.el,"onBeforeSlide.lgtm",function(e){for(var t=0;t<r.length;t++)utils.removeClass(r[t],"lg-pager-active"),e.detail.index===t&&utils.addClass(r[t],"lg-pager-active")})},r.prototype.destroy=function(){},window.lgModules.pager=r})},{}]},{},[1])(1)});

View File

@@ -0,0 +1,105 @@
/**!
* lg-share.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-share.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgShare = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgShare = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var shareSefaults = {
share: true,
facebook: true,
facebookDropdownText: 'Facebook',
twitter: true,
twitterDropdownText: 'Twitter',
googlePlus: true,
googlePlusDropdownText: 'GooglePlus',
pinterest: true,
pinterestDropdownText: 'Pinterest'
};
var Share = function Share(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, shareSefaults, this.core.s);
if (this.core.s.share) {
this.init();
}
return this;
};
Share.prototype.init = function () {
var _this = this;
var shareHtml = '<span id="lg-share" class="lg-icon">' + '<ul class="lg-dropdown" style="position: absolute;">';
shareHtml += _this.core.s.facebook ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.facebookDropdownText + '</span></a></li>' : '';
shareHtml += _this.core.s.twitter ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.twitterDropdownText + '</span></a></li>' : '';
shareHtml += _this.core.s.googlePlus ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.googlePlusDropdownText + '</span></a></li>' : '';
shareHtml += _this.core.s.pinterest ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + this.core.s.pinterestDropdownText + '</span></a></li>' : '';
shareHtml += '</ul></span>';
this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', shareHtml);
this.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', '<div id="lg-dropdown-overlay"></div>');
utils.on(document.getElementById('lg-share'), 'click.lg', function () {
if (utils.hasClass(_this.core.outer, 'lg-dropdown-active')) {
utils.removeClass(_this.core.outer, 'lg-dropdown-active');
} else {
utils.addClass(_this.core.outer, 'lg-dropdown-active');
}
});
utils.on(document.getElementById('lg-dropdown-overlay'), 'click.lg', function () {
utils.removeClass(_this.core.outer, 'lg-dropdown-active');
});
utils.on(_this.core.el, 'onAfterSlide.lgtm', function (event) {
setTimeout(function () {
document.getElementById('lg-share-facebook').setAttribute('href', 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(_this.core.items[event.detail.index].getAttribute('data-facebook-share-url') || window.location.href));
document.getElementById('lg-share-twitter').setAttribute('href', 'https://twitter.com/intent/tweet?text=' + _this.core.items[event.detail.index].getAttribute('data-tweet-text') + '&url=' + encodeURIComponent(_this.core.items[event.detail.index].getAttribute('data-twitter-share-url') || window.location.href));
document.getElementById('lg-share-googleplus').setAttribute('href', 'https://plus.google.com/share?url=' + encodeURIComponent(_this.core.items[event.detail.index].getAttribute('data-googleplus-share-url') || window.location.href));
document.getElementById('lg-share-pinterest').setAttribute('href', 'http://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(_this.core.items[event.detail.index].getAttribute('data-pinterest-share-url') || window.location.href) + '&media=' + encodeURIComponent(_this.core.items[event.detail.index].getAttribute('href') || _this.core.items[event.detail.index].getAttribute('data-src')) + '&description=' + _this.core.items[event.detail.index].getAttribute('data-pinterest-text'));
}, 100);
});
};
Share.prototype.destroy = function () {};
window.lgModules.share = Share;
});
},{}]},{},[1])(1)
});

View File

@@ -0,0 +1,7 @@
/**!
* lg-share.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-share.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LgShare=e()}}(function(){var e,t,o;return function e(t,o,r){function n(s,l){if(!o[s]){if(!t[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(i)return i(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var c=o[s]={exports:{}};t[s][0].call(c.exports,function(e){var o=t[s][1][e];return n(o?o:e)},c,c.exports,e,t,o,r)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(t,o,r){!function(t,o){if("function"==typeof e&&e.amd)e([],o);else if("undefined"!=typeof r)o();else{var n={exports:{}};o(),t.lgShare=n.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},t={share:!0,facebook:!0,facebookDropdownText:"Facebook",twitter:!0,twitterDropdownText:"Twitter",googlePlus:!0,googlePlusDropdownText:"GooglePlus",pinterest:!0,pinterestDropdownText:"Pinterest"},o=function o(r){return this.el=r,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},t,this.core.s),this.core.s.share&&this.init(),this};o.prototype.init=function(){var e=this,t='<span id="lg-share" class="lg-icon"><ul class="lg-dropdown" style="position: absolute;">';t+=e.core.s.facebook?'<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.facebookDropdownText+"</span></a></li>":"",t+=e.core.s.twitter?'<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.twitterDropdownText+"</span></a></li>":"",t+=e.core.s.googlePlus?'<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.googlePlusDropdownText+"</span></a></li>":"",t+=e.core.s.pinterest?'<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.pinterestDropdownText+"</span></a></li>":"",t+="</ul></span>",this.core.outer.querySelector(".lg-toolbar").insertAdjacentHTML("beforeend",t),this.core.outer.querySelector(".lg").insertAdjacentHTML("beforeend",'<div id="lg-dropdown-overlay"></div>'),utils.on(document.getElementById("lg-share"),"click.lg",function(){utils.hasClass(e.core.outer,"lg-dropdown-active")?utils.removeClass(e.core.outer,"lg-dropdown-active"):utils.addClass(e.core.outer,"lg-dropdown-active")}),utils.on(document.getElementById("lg-dropdown-overlay"),"click.lg",function(){utils.removeClass(e.core.outer,"lg-dropdown-active")}),utils.on(e.core.el,"onAfterSlide.lgtm",function(t){setTimeout(function(){document.getElementById("lg-share-facebook").setAttribute("href","https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(e.core.items[t.detail.index].getAttribute("data-facebook-share-url")||window.location.href)),document.getElementById("lg-share-twitter").setAttribute("href","https://twitter.com/intent/tweet?text="+e.core.items[t.detail.index].getAttribute("data-tweet-text")+"&url="+encodeURIComponent(e.core.items[t.detail.index].getAttribute("data-twitter-share-url")||window.location.href)),document.getElementById("lg-share-googleplus").setAttribute("href","https://plus.google.com/share?url="+encodeURIComponent(e.core.items[t.detail.index].getAttribute("data-googleplus-share-url")||window.location.href)),document.getElementById("lg-share-pinterest").setAttribute("href","http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(e.core.items[t.detail.index].getAttribute("data-pinterest-share-url")||window.location.href)+"&media="+encodeURIComponent(e.core.items[t.detail.index].getAttribute("href")||e.core.items[t.detail.index].getAttribute("data-src"))+"&description="+e.core.items[t.detail.index].getAttribute("data-pinterest-text"))},100)})},o.prototype.destroy=function(){},window.lgModules.share=o})},{}]},{},[1])(1)});

View File

@@ -0,0 +1,491 @@
/**!
* lg-thumbnail.js | 0.0.4 | August 9th 2016
* http://sachinchoolur.github.io/lg-thumbnail.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgThumbnail = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgThumbnail = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var thumbnailDefaults = {
thumbnail: true,
animateThumb: true,
currentPagerPosition: 'middle',
thumbWidth: 100,
thumbContHeight: 100,
thumbMargin: 5,
exThumbImage: false,
showThumbByDefault: true,
toggleThumb: true,
pullCaptionUp: true,
enableThumbDrag: true,
enableThumbSwipe: true,
swipeThreshold: 50,
loadYoutubeThumbnail: true,
youtubeThumbSize: 1,
loadVimeoThumbnail: true,
vimeoThumbSize: 'thumbnail_small',
loadDailymotionThumbnail: true
};
var Thumbnail = function Thumbnail(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, thumbnailDefaults, this.core.s);
this.thumbOuter = null;
this.thumbOuterWidth = 0;
this.thumbTotalWidth = this.core.items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin);
this.thumbIndex = this.core.index;
// Thumbnail animation value
this.left = 0;
this.init();
return this;
};
Thumbnail.prototype.init = function () {
var _this = this;
if (this.core.s.thumbnail && this.core.items.length > 1) {
if (this.core.s.showThumbByDefault) {
setTimeout(function () {
utils.addClass(_this.core.outer, 'lg-thumb-open');
}, 700);
}
if (this.core.s.pullCaptionUp) {
utils.addClass(this.core.outer, 'lg-pull-caption-up');
}
this.build();
if (this.core.s.animateThumb) {
if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
this.enableThumbDrag();
}
if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
this.enableThumbSwipe();
}
this.thumbClickable = false;
} else {
this.thumbClickable = true;
}
this.toggle();
this.thumbkeyPress();
}
};
Thumbnail.prototype.build = function () {
var _this = this;
var thumbList = '';
var vimeoErrorThumbSize = '';
var $thumb;
var html = '<div class="lg-thumb-outer">' + '<div class="lg-thumb group">' + '</div>' + '</div>';
switch (this.core.s.vimeoThumbSize) {
case 'thumbnail_large':
vimeoErrorThumbSize = '640';
break;
case 'thumbnail_medium':
vimeoErrorThumbSize = '200x150';
break;
case 'thumbnail_small':
vimeoErrorThumbSize = '100x75';
}
utils.addClass(_this.core.outer, 'lg-has-thumb');
_this.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', html);
_this.thumbOuter = _this.core.outer.querySelector('.lg-thumb-outer');
_this.thumbOuterWidth = _this.thumbOuter.offsetWidth;
if (_this.core.s.animateThumb) {
_this.core.outer.querySelector('.lg-thumb').style.width = _this.thumbTotalWidth + 'px';
_this.core.outer.querySelector('.lg-thumb').style.position = 'relative';
}
if (this.core.s.animateThumb) {
_this.thumbOuter.style.height = _this.core.s.thumbContHeight + 'px';
}
function getThumb(src, thumb, index) {
var isVideo = _this.core.isVideo(src, index) || {};
var thumbImg;
var vimeoId = '';
if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
if (isVideo.youtube) {
if (_this.core.s.loadYoutubeThumbnail) {
thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg';
} else {
thumbImg = thumb;
}
} else if (isVideo.vimeo) {
if (_this.core.s.loadVimeoThumbnail) {
thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg';
vimeoId = isVideo.vimeo[1];
} else {
thumbImg = thumb;
}
} else if (isVideo.dailymotion) {
if (_this.core.s.loadDailymotionThumbnail) {
thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
} else {
thumbImg = thumb;
}
}
} else {
thumbImg = thumb;
}
thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>';
vimeoId = '';
}
if (_this.core.s.dynamic) {
for (var j = 0; j < _this.core.s.dynamicEl.length; j++) {
getThumb(_this.core.s.dynamicEl[j].src, _this.core.s.dynamicEl[j].thumb, j);
}
} else {
for (var i = 0; i < _this.core.items.length; i++) {
if (!_this.core.s.exThumbImage) {
getThumb(_this.core.items[i].getAttribute('href') || _this.core.items[i].getAttribute('data-src'), _this.core.items[i].querySelector('img').getAttribute('src'), i);
} else {
getThumb(_this.core.items[i].getAttribute('href') || _this.core.items[i].getAttribute('data-src'), _this.core.items[i].getAttribute(_this.core.s.exThumbImage), i);
}
}
}
_this.core.outer.querySelector('.lg-thumb').innerHTML = thumbList;
$thumb = _this.core.outer.querySelectorAll('.lg-thumb-item');
for (var n = 0; n < $thumb.length; n++) {
/*jshint loopfunc: true */
(function (index) {
var $this = $thumb[index];
var vimeoVideoId = $this.getAttribute('data-vimeo-id');
if (vimeoVideoId) {
window['lgJsonP' + _this.el.getAttribute('lg-uid') + '' + n] = function (content) {
$this.querySelector('img').setAttribute('src', content[0][_this.core.s.vimeoThumbSize]);
};
var script = document.createElement('script');
script.className = 'lg-script';
script.src = '//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=lgJsonP' + _this.el.getAttribute('lg-uid') + '' + n;
document.body.appendChild(script);
}
})(n);
}
// manage active class for thumbnail
utils.addClass($thumb[_this.core.index], 'active');
utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () {
for (var j = 0; j < $thumb.length; j++) {
utils.removeClass($thumb[j], 'active');
}
utils.addClass($thumb[_this.core.index], 'active');
});
for (var k = 0; k < $thumb.length; k++) {
/*jshint loopfunc: true */
(function (index) {
utils.on($thumb[index], 'click.lg touchend.lg', function () {
setTimeout(function () {
// In IE9 and bellow touch does not support
// Go to slide if browser does not support css transitions
if (_this.thumbClickable && !_this.core.lgBusy || !_this.core.doCss()) {
_this.core.index = index;
_this.core.slide(_this.core.index, false, true);
}
}, 50);
});
})(k);
}
utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () {
_this.animateThumb(_this.core.index);
});
utils.on(window, 'resize.lgthumb orientationchange.lgthumb', function () {
setTimeout(function () {
_this.animateThumb(_this.core.index);
_this.thumbOuterWidth = _this.thumbOuter.offsetWidth;
}, 200);
});
};
Thumbnail.prototype.setTranslate = function (value) {
utils.setVendor(this.core.outer.querySelector('.lg-thumb'), 'Transform', 'translate3d(-' + value + 'px, 0px, 0px)');
};
Thumbnail.prototype.animateThumb = function (index) {
var $thumb = this.core.outer.querySelector('.lg-thumb');
if (this.core.s.animateThumb) {
var position;
switch (this.core.s.currentPagerPosition) {
case 'left':
position = 0;
break;
case 'middle':
position = this.thumbOuterWidth / 2 - this.core.s.thumbWidth / 2;
break;
case 'right':
position = this.thumbOuterWidth - this.core.s.thumbWidth;
}
this.left = (this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1 - position;
if (this.left > this.thumbTotalWidth - this.thumbOuterWidth) {
this.left = this.thumbTotalWidth - this.thumbOuterWidth;
}
if (this.left < 0) {
this.left = 0;
}
if (this.core.lGalleryOn) {
if (!utils.hasClass($thumb, 'on')) {
utils.setVendor(this.core.outer.querySelector('.lg-thumb'), 'TransitionDuration', this.core.s.speed + 'ms');
}
if (!this.core.doCss()) {
$thumb.style.left = -this.left + 'px';
}
} else {
if (!this.core.doCss()) {
$thumb.style.left = -this.left + 'px';
}
}
this.setTranslate(this.left);
}
};
// Enable thumbnail dragging and swiping
Thumbnail.prototype.enableThumbDrag = function () {
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isDraging = false;
var isMoved = false;
var tempLeft = 0;
utils.addClass(_this.thumbOuter, 'lg-grab');
utils.on(_this.core.outer.querySelector('.lg-thumb'), 'mousedown.lgthumb', function (e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
// execute only on .lg-object
e.preventDefault();
startCoords = e.pageX;
isDraging = true;
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
_this.core.outer.scrollLeft += 1;
_this.core.outer.scrollLeft -= 1;
// *
_this.thumbClickable = false;
utils.removeClass(_this.thumbOuter, 'lg-grab');
utils.addClass(_this.thumbOuter, 'lg-grabbing');
}
});
utils.on(window, 'mousemove.lgthumb', function (e) {
if (isDraging) {
tempLeft = _this.left;
isMoved = true;
endCoords = e.pageX;
utils.addClass(_this.thumbOuter, 'lg-dragging');
tempLeft = tempLeft - (endCoords - startCoords);
if (tempLeft > _this.thumbTotalWidth - _this.thumbOuterWidth) {
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
}
if (tempLeft < 0) {
tempLeft = 0;
}
// move current slide
_this.setTranslate(tempLeft);
}
});
utils.on(window, 'mouseup.lgthumb', function () {
if (isMoved) {
isMoved = false;
utils.removeClass(_this.thumbOuter, 'lg-dragging');
_this.left = tempLeft;
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
_this.thumbClickable = true;
}
} else {
_this.thumbClickable = true;
}
if (isDraging) {
isDraging = false;
utils.removeClass(_this.thumbOuter, 'lg-grabbing');
utils.addClass(_this.thumbOuter, 'lg-grab');
}
});
};
Thumbnail.prototype.enableThumbSwipe = function () {
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isMoved = false;
var tempLeft = 0;
utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchstart.lg', function (e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
e.preventDefault();
startCoords = e.targetTouches[0].pageX;
_this.thumbClickable = false;
}
});
utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchmove.lg', function (e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
e.preventDefault();
endCoords = e.targetTouches[0].pageX;
isMoved = true;
utils.addClass(_this.thumbOuter, 'lg-dragging');
tempLeft = _this.left;
tempLeft = tempLeft - (endCoords - startCoords);
if (tempLeft > _this.thumbTotalWidth - _this.thumbOuterWidth) {
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
}
if (tempLeft < 0) {
tempLeft = 0;
}
// move current slide
_this.setTranslate(tempLeft);
}
});
utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchend.lg', function () {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
if (isMoved) {
isMoved = false;
utils.removeClass(_this.thumbOuter, 'lg-dragging');
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
_this.thumbClickable = true;
}
_this.left = tempLeft;
} else {
_this.thumbClickable = true;
}
} else {
_this.thumbClickable = true;
}
});
};
Thumbnail.prototype.toggle = function () {
var _this = this;
if (_this.core.s.toggleThumb) {
utils.addClass(_this.core.outer, 'lg-can-toggle');
_this.thumbOuter.insertAdjacentHTML('beforeend', '<span class="lg-toggle-thumb lg-icon"></span>');
utils.on(_this.core.outer.querySelector('.lg-toggle-thumb'), 'click.lg', function () {
if (utils.hasClass(_this.core.outer, 'lg-thumb-open')) {
utils.removeClass(_this.core.outer, 'lg-thumb-open');
} else {
utils.addClass(_this.core.outer, 'lg-thumb-open');
}
});
}
};
Thumbnail.prototype.thumbkeyPress = function () {
var _this = this;
utils.on(window, 'keydown.lgthumb', function (e) {
if (e.keyCode === 38) {
e.preventDefault();
utils.addClass(_this.core.outer, 'lg-thumb-open');
} else if (e.keyCode === 40) {
e.preventDefault();
utils.removeClass(_this.core.outer, 'lg-thumb-open');
}
});
};
Thumbnail.prototype.destroy = function () {
if (this.core.s.thumbnail && this.core.items.length > 1) {
utils.off(window, '.lgthumb');
this.thumbOuter.parentNode.removeChild(this.thumbOuter);
utils.removeClass(this.core.outer, 'lg-has-thumb');
var lgScript = document.getElementsByClassName('lg-script');
while (lgScript[0]) {
lgScript[0].parentNode.removeChild(lgScript[0]);
}
}
};
window.lgModules.thumbnail = Thumbnail;
});
},{}]},{},[1])(1)
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,318 @@
/**!
* lg-video.js | 0.0.1 | August 1st 2016
* http://sachinchoolur.github.io/lg-video.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgVideo = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgVideo = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var videoDefaults = {
videoMaxWidth: '855px',
youtubePlayerParams: false,
vimeoPlayerParams: false,
dailymotionPlayerParams: false,
vkPlayerParams: false,
videojs: false,
videojsOptions: {}
};
var Video = function Video(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, videoDefaults, 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
utils.on(_this.core.el, 'hasVideo.lgtm', function (event) {
_this.core.___slide[event.detail.index].querySelector('.lg-video').insertAdjacentHTML('beforeend', _this.loadVideo(event.detail.src, 'lg-object', true, event.detail.index, event.detail.html));
if (event.detail.html) {
if (_this.core.s.videojs) {
try {
videojs(_this.core.___slide[event.detail.index].querySelector('.lg-html5'), _this.core.s.videojsOptions, function () {
if (!_this.videoLoaded) {
this.play();
}
});
} catch (e) {
console.error('Make sure you have included videojs');
}
} else {
_this.core.___slide[event.detail.index].querySelector('.lg-html5').play();
}
}
});
// Set max width for video
utils.on(_this.core.el, 'onAferAppendSlide.lgtm', function (event) {
if (_this.core.___slide[event.detail.index].querySelector('.lg-video-cont')) {
_this.core.___slide[event.detail.index].querySelector('.lg-video-cont').style.maxWidth = _this.core.s.videoMaxWidth;
_this.videoLoaded = true;
}
});
var loadOnClick = function loadOnClick($el) {
// check slide has poster
if (utils.hasClass($el.querySelector('.lg-object'), 'lg-has-poster') && $el.querySelector('.lg-object').style.display !== 'none') {
// check already video element present
if (!utils.hasClass($el, 'lg-has-video')) {
utils.addClass($el, 'lg-video-playing lg-has-video');
var _src;
var _html;
var _loadVideo = function _loadVideo(_src, _html) {
$el.querySelector('.lg-video').insertAdjacentHTML('beforeend', _this.loadVideo(_src, '', false, _this.core.index, _html));
if (_html) {
if (_this.core.s.videojs) {
try {
videojs(_this.core.___slide[_this.core.index].querySelector('.lg-html5'), _this.core.s.videojsOptions, function () {
this.play();
});
} catch (e) {
console.error('Make sure you have included videojs');
}
} else {
_this.core.___slide[_this.core.index].querySelector('.lg-html5').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[_this.core.index].getAttribute('href') || _this.core.items[_this.core.index].getAttribute('data-src');
_html = _this.core.items[_this.core.index].getAttribute('data-html');
_loadVideo(_src, _html);
}
var $tempImg = $el.querySelector('.lg-object');
$el.querySelector('.lg-video').appendChild($tempImg);
// @todo loading icon for html5 videos also
// for showing the loading indicator while loading video
if (!utils.hasClass($el.querySelector('.lg-video-object'), 'lg-html5')) {
utils.removeClass($el, 'lg-complete');
utils.on($el.querySelector('.lg-video-object'), 'load.lg error.lg', function () {
utils.addClass($el, 'lg-complete');
});
}
} else {
var youtubePlayer = $el.querySelector('.lg-youtube');
var vimeoPlayer = $el.querySelector('.lg-vimeo');
var dailymotionPlayer = $el.querySelector('.lg-dailymotion');
var html5Player = $el.querySelector('.lg-html5');
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();
}
}
utils.addClass($el, '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)) {
utils.on(_this.core.el, 'onSlideClick.lgtm', function () {
var $el = _this.core.___slide[_this.core.index];
loadOnClick($el);
});
} else {
// For IE 9 and bellow
for (var i = 0; i < _this.core.___slide.length; i++) {
/*jshint loopfunc: true */
(function (index) {
utils.on(_this.core.___slide[index], 'click.lg', function () {
loadOnClick(_this.core.___slide[index]);
});
})(i);
}
}
utils.on(_this.core.el, 'onBeforeSlide.lgtm', function (event) {
var $videoSlide = _this.core.___slide[event.detail.prevIndex];
var youtubePlayer = $videoSlide.querySelector('.lg-youtube');
var vimeoPlayer = $videoSlide.querySelector('.lg-vimeo');
var dailymotionPlayer = $videoSlide.querySelector('.lg-dailymotion');
var vkPlayer = $videoSlide.querySelector('.lg-vk');
var html5Player = $videoSlide.querySelector('.lg-html5');
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.setAttribute('src', vkPlayer.getAttribute('src').replace('&autoplay', '&noplay'));
}
var _src;
if (_this.core.s.dynamic) {
_src = _this.core.s.dynamicEl[event.detail.index].src;
} else {
_src = _this.core.items[event.detail.index].getAttribute('href') || _this.core.items[event.detail.index].getAttribute('data-src');
}
var _isVideo = _this.core.isVideo(_src, event.detail.index) || {};
if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
utils.addClass(_this.core.outer, 'lg-hide-download');
}
//$videoSlide.addClass('lg-complete');
});
utils.on(_this.core.el, 'onAfterSlide.lgtm', function (event) {
utils.removeClass(_this.core.___slide[event.detail.prevIndex], '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 + '&' + utils.param(this.core.s.youtubePlayerParams);
}
video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';
} else if (isVideo.vimeo) {
a = '?autoplay=' + autoplay + '&api=1';
if (this.core.s.vimeoPlayerParams) {
a = a + '&' + utils.param(this.core.s.vimeoPlayerParams);
}
video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" width="560" height="315" src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
} else if (isVideo.dailymotion) {
a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
if (this.core.s.dailymotionPlayerParams) {
a = a + '&' + utils.param(this.core.s.dailymotionPlayerParams);
}
video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>';
} else if (isVideo.html5) {
var fL = html.substring(0, 1);
if (fL === '.' || fL === '#') {
html = document.querySelector(html).innerHTML;
}
video = html;
} else if (isVideo.vk) {
a = '&autoplay=' + autoplay;
if (this.core.s.vkPlayerParams) {
a = a + '&' + utils.param(this.core.s.vkPlayerParams);
}
video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="http://vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';
}
return video;
};
Video.prototype.destroy = function () {
this.videoLoaded = false;
};
window.lgModules.video = Video;
});
},{}]},{},[1])(1)
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,533 @@
/**!
* lg-zoom.js | 0.0.2 | August 4th 2016
* http://sachinchoolur.github.io/lg-zoom.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgZoom = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.lgZoom = mod.exports;
}
})(this, function () {
'use strict';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var zoomDefaults = {
scale: 1,
zoom: true,
actualSize: true,
enableZoomAfter: 300
};
var Zoom = function Zoom(element) {
this.el = element;
this.core = window.lgData[this.el.getAttribute('lg-uid')];
this.core.s = _extends({}, zoomDefaults, this.core.s);
if (this.core.s.zoom && this.core.doCss()) {
this.init();
// Store the zoomable timeout value just to clear it while closing
this.zoomabletimeout = false;
// Set the initial value center
this.pageX = window.innerWidth / 2;
this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
}
return this;
};
Zoom.prototype.init = function () {
var _this = this;
var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
if (_this.core.s.actualSize) {
zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
}
this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', zoomIcons);
// Add zoomable class
utils.on(_this.core.el, 'onSlideItemLoad.lgtmzoom', function (event) {
// delay will be 0 except first time
var _speed = _this.core.s.enableZoomAfter + event.detail.delay;
// set _speed value 0 if gallery opened from direct url and if it is first slide
if (utils.hasClass(document.body, 'lg-from-hash') && event.detail.delay) {
// will execute only once
_speed = 0;
} else {
// Remove lg-from-hash to enable starting animation.
utils.removeClass(document.body, 'lg-from-hash');
}
_this.zoomabletimeout = setTimeout(function () {
utils.addClass(_this.core.___slide[event.detail.index], 'lg-zoomable');
}, _speed + 30);
});
var scale = 1;
/**
* @desc Image zoom
* Translate the wrap and scale the image to get better user experience
*
* @param {String} scaleVal - Zoom decrement/increment value
*/
var zoom = function zoom(scaleVal) {
var image = _this.core.outer.querySelector('.lg-current .lg-image');
var _x;
var _y;
// Find offset manually to avoid issue after zoom
var offsetX = (window.innerWidth - image.clientWidth) / 2;
var offsetY = (window.innerHeight - image.clientHeight) / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
_x = _this.pageX - offsetX;
_y = _this.pageY - offsetY;
var x = (scaleVal - 1) * _x;
var y = (scaleVal - 1) * _y;
utils.setVendor(image, 'Transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)');
image.setAttribute('data-scale', scaleVal);
image.parentElement.style.left = -x + 'px';
image.parentElement.style.top = -y + 'px';
image.parentElement.setAttribute('data-x', x);
image.parentElement.setAttribute('data-y', y);
};
var callScale = function callScale() {
if (scale > 1) {
utils.addClass(_this.core.outer, 'lg-zoomed');
} else {
_this.resetZoom();
}
if (scale < 1) {
scale = 1;
}
zoom(scale);
};
var actualSize = function actualSize(event, image, index, fromIcon) {
var w = image.clientWidth;
var nw;
if (_this.core.s.dynamic) {
nw = _this.core.s.dynamicEl[index].width || image.naturalWidth || w;
} else {
nw = _this.core.items[index].getAttribute('data-width') || image.naturalWidth || w;
}
var _scale;
if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
scale = 1;
} else {
if (nw > w) {
_scale = nw / w;
scale = _scale || 2;
}
}
if (fromIcon) {
_this.pageX = window.innerWidth / 2;
_this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
} else {
_this.pageX = event.pageX || event.targetTouches[0].pageX;
_this.pageY = event.pageY || event.targetTouches[0].pageY;
}
callScale();
setTimeout(function () {
utils.removeClass(_this.core.outer, 'lg-grabbing');
utils.addClass(_this.core.outer, 'lg-grab');
}, 10);
};
var tapped = false;
// event triggered after appending slide content
utils.on(_this.core.el, 'onAferAppendSlide.lgtmzoom', function (event) {
var index = event.detail.index;
// Get the current element
var image = _this.core.___slide[index].querySelector('.lg-image');
if (!_this.core.isTouch) {
utils.on(image, 'dblclick', function (event) {
actualSize(event, image, index);
});
}
if (_this.core.isTouch) {
utils.on(image, 'touchstart', function (event) {
if (!tapped) {
tapped = setTimeout(function () {
tapped = null;
}, 300);
} else {
clearTimeout(tapped);
tapped = null;
actualSize(event, image, index);
}
event.preventDefault();
});
}
});
// Update zoom on resize and orientationchange
utils.on(window, 'resize.lgzoom scroll.lgzoom orientationchange.lgzoom', function () {
_this.pageX = window.innerWidth / 2;
_this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
zoom(scale);
});
utils.on(document.getElementById('lg-zoom-out'), 'click.lg', function () {
if (_this.core.outer.querySelector('.lg-current .lg-image')) {
scale -= _this.core.s.scale;
callScale();
}
});
utils.on(document.getElementById('lg-zoom-in'), 'click.lg', function () {
if (_this.core.outer.querySelector('.lg-current .lg-image')) {
scale += _this.core.s.scale;
callScale();
}
});
utils.on(document.getElementById('lg-actual-size'), 'click.lg', function (event) {
actualSize(event, _this.core.___slide[_this.core.index].querySelector('.lg-image'), _this.core.index, true);
});
// Reset zoom on slide change
utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () {
scale = 1;
_this.resetZoom();
});
// Drag option after zoom
if (!_this.core.isTouch) {
_this.zoomDrag();
}
if (_this.core.isTouch) {
_this.zoomSwipe();
}
};
// Reset zoom effect
Zoom.prototype.resetZoom = function () {
utils.removeClass(this.core.outer, 'lg-zoomed');
for (var i = 0; i < this.core.___slide.length; i++) {
if (this.core.___slide[i].querySelector('.lg-img-wrap')) {
this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('style');
this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-x');
this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-y');
}
}
for (var j = 0; j < this.core.___slide.length; j++) {
if (this.core.___slide[j].querySelector('.lg-image')) {
this.core.___slide[j].querySelector('.lg-image').removeAttribute('style');
this.core.___slide[j].querySelector('.lg-image').removeAttribute('data-scale');
}
}
// Reset pagx pagy values to center
this.pageX = window.innerWidth / 2;
this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
};
Zoom.prototype.zoomSwipe = function () {
var _this = this;
var startCoords = {};
var endCoords = {};
var isMoved = false;
// Allow x direction drag
var allowX = false;
// Allow Y direction drag
var allowY = false;
for (var i = 0; i < _this.core.___slide.length; i++) {
/*jshint loopfunc: true */
utils.on(_this.core.___slide[i], 'touchstart.lg', function (e) {
if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
var image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
allowY = image.offsetHeight * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientHeight;
allowX = image.offsetWidth * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientWidth;
if (allowX || allowY) {
e.preventDefault();
startCoords = {
x: e.targetTouches[0].pageX,
y: e.targetTouches[0].pageY
};
}
}
});
}
for (var j = 0; j < _this.core.___slide.length; j++) {
/*jshint loopfunc: true */
utils.on(_this.core.___slide[j], 'touchmove.lg', function (e) {
if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
var distanceX;
var distanceY;
e.preventDefault();
isMoved = true;
endCoords = {
x: e.targetTouches[0].pageX,
y: e.targetTouches[0].pageY
};
// reset opacity and transition duration
utils.addClass(_this.core.outer, 'lg-zoom-dragging');
if (allowY) {
distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y);
} else {
distanceY = -Math.abs(_el.getAttribute('data-y'));
}
if (allowX) {
distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x);
} else {
distanceX = -Math.abs(_el.getAttribute('data-x'));
}
if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
_el.style.left = distanceX + 'px';
_el.style.top = distanceY + 'px';
}
}
});
}
for (var k = 0; k < _this.core.___slide.length; k++) {
/*jshint loopfunc: true */
utils.on(_this.core.___slide[k], 'touchend.lg', function () {
if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
if (isMoved) {
isMoved = false;
utils.removeClass(_this.core.outer, 'lg-zoom-dragging');
_this.touchendZoom(startCoords, endCoords, allowX, allowY);
}
}
});
}
};
Zoom.prototype.zoomDrag = function () {
var _this = this;
var startCoords = {};
var endCoords = {};
var isDraging = false;
var isMoved = false;
// Allow x direction drag
var allowX = false;
// Allow Y direction drag
var allowY = false;
for (var i = 0; i < _this.core.___slide.length; i++) {
/*jshint loopfunc: true */
utils.on(_this.core.___slide[i], 'mousedown.lgzoom', function (e) {
// execute only on .lg-object
var image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
allowY = image.offsetHeight * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientHeight;
allowX = image.offsetWidth * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientWidth;
if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
if (utils.hasClass(e.target, 'lg-object') && (allowX || allowY)) {
e.preventDefault();
startCoords = {
x: e.pageX,
y: e.pageY
};
isDraging = true;
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
_this.core.outer.scrollLeft += 1;
_this.core.outer.scrollLeft -= 1;
utils.removeClass(_this.core.outer, 'lg-grab');
utils.addClass(_this.core.outer, 'lg-grabbing');
}
}
});
}
utils.on(window, 'mousemove.lgzoom', function (e) {
if (isDraging) {
var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
var distanceX;
var distanceY;
isMoved = true;
endCoords = {
x: e.pageX,
y: e.pageY
};
// reset opacity and transition duration
utils.addClass(_this.core.outer, 'lg-zoom-dragging');
if (allowY) {
distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y);
} else {
distanceY = -Math.abs(_el.getAttribute('data-y'));
}
if (allowX) {
distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x);
} else {
distanceX = -Math.abs(_el.getAttribute('data-x'));
}
_el.style.left = distanceX + 'px';
_el.style.top = distanceY + 'px';
}
});
utils.on(window, 'mouseup.lgzoom', function (e) {
if (isDraging) {
isDraging = false;
utils.removeClass(_this.core.outer, 'lg-zoom-dragging');
// Fix for chrome mouse move on click
if (isMoved && (startCoords.x !== endCoords.x || startCoords.y !== endCoords.y)) {
endCoords = {
x: e.pageX,
y: e.pageY
};
_this.touchendZoom(startCoords, endCoords, allowX, allowY);
}
isMoved = false;
}
utils.removeClass(_this.core.outer, 'lg-grabbing');
utils.addClass(_this.core.outer, 'lg-grab');
});
};
Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY) {
var _this = this;
var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
var image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
var distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x);
var distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y);
var minY = (_this.core.outer.querySelector('.lg').clientHeight - image.offsetHeight) / 2;
var maxY = Math.abs(image.offsetHeight * Math.abs(image.getAttribute('data-scale')) - _this.core.outer.querySelector('.lg').clientHeight + minY);
var minX = (_this.core.outer.querySelector('.lg').clientWidth - image.offsetWidth) / 2;
var maxX = Math.abs(image.offsetWidth * Math.abs(image.getAttribute('data-scale')) - _this.core.outer.querySelector('.lg').clientWidth + minX);
if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
if (allowY) {
if (distanceY <= -maxY) {
distanceY = -maxY;
} else if (distanceY >= -minY) {
distanceY = -minY;
}
}
if (allowX) {
if (distanceX <= -maxX) {
distanceX = -maxX;
} else if (distanceX >= -minX) {
distanceX = -minX;
}
}
if (allowY) {
_el.setAttribute('data-y', Math.abs(distanceY));
} else {
distanceY = -Math.abs(_el.getAttribute('data-y'));
}
if (allowX) {
_el.setAttribute('data-x', Math.abs(distanceX));
} else {
distanceX = -Math.abs(_el.getAttribute('data-x'));
}
_el.style.left = distanceX + 'px';
_el.style.top = distanceY + 'px';
}
};
Zoom.prototype.destroy = function () {
var _this = this;
// Unbind all events added by lightGallery zoom plugin
utils.off(_this.core.el, '.lgzoom');
utils.off(window, '.lgzoom');
for (var i = 0; i < _this.core.___slide.length; i++) {
utils.off(_this.core.___slide[i], '.lgzoom');
}
utils.off(_this.core.el, '.lgtmzoom');
_this.resetZoom();
clearTimeout(_this.zoomabletimeout);
_this.zoomabletimeout = false;
};
window.lgModules.zoom = Zoom;
});
},{}]},{},[1])(1)
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long