Removed opentip

Cleanup lightgallery
This commit is contained in:
djmaze 2020-08-13 13:16:08 +02:00
parent a8ef5ec75b
commit f5a444aa14
31 changed files with 2196 additions and 5957 deletions

View file

@ -72,32 +72,33 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
* Removed jquery-mousewheel * Removed jquery-mousewheel
* Removed matchmedia-polyfill * Removed matchmedia-polyfill
* Removed momentjs (localization still used) * Removed momentjs (localization still used)
* Removed opentip (use CSS)
|js/* |1.14.0 |native |gzip 1.14 |gzip | |js/* |1.14.0 |native |gzip 1.14 |gzip |
|----------- |--------: |--------: |--------: |--------: | |----------- |--------: |--------: |--------: |--------: |
|admin.js |2.130.942 |1.130.247 | 485.481 | 273.277 | |admin.js |2.130.942 |1.119.116 | 485.481 | 270.646 |
|app.js |4.184.455 |2.840.968 | 932.725 | 662.061 | |app.js |4.184.455 |2.829.860 | 932.725 | 659.501 |
|boot.js | 671.522 | 44.029 | 169.502 | 15.460 | |boot.js | 671.522 | 44.029 | 169.502 | 15.460 |
|libs.js | 647.614 | 426.949 | 194.728 | 131.409 | |libs.js | 647.614 | 364.163 | 194.728 | 118.262 |
|polyfills.js | 325.834 | 0 | 71.825 | 0 | |polyfills.js | 325.834 | 0 | 71.825 | 0 |
|TOTAL js |7.960.367 |4.442.193 |1.854.261 |1.082.207 | |TOTAL js |7.960.367 |4.357.168 |1.854.261 |1.063.869 |
|js/min/* |1.14.0 |native |gzip 1.14 |gzip | |js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|--------------- |--------: |--------: |--------: |--------: | |--------------- |--------: |--------: |--------: |--------: |
|admin.min.js | 252.147 | 152.759 | 73.657 | 43.564 | |admin.min.js | 252.147 | 151.264 | 73.657 | 43.122 |
|app.min.js | 511.202 | 378.335 |140.462 | 99.341 | |app.min.js | 511.202 | 376.839 |140.462 | 98.898 |
|boot.min.js | 66.007 | 5.589 | 22.567 | 2.333 | |boot.min.js | 66.007 | 5.589 | 22.567 | 2.333 |
|libs.min.js | 572.545 | 385.139 |176.720 |121.907 | |libs.min.js | 572.545 | 348.651 |176.720 |112.822 |
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 | |polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|TOTAL js/min |1.434.353 | 921.822 |424.718 |267.145 | |TOTAL js/min |1.434.353 | 882.343 |424.718 |257.175 |
512.531 bytes (157.573 gzip) is not much, but it feels faster. 552.010 bytes (167.543 gzip) is not much, but it feels faster.
|css/* |1.14.0 |native | |css/* |1.14.0 |native |
|-------------- |--------: |--------: | |-------------- |--------: |--------: |
|app.css | 340.334 | 272.858 | |app.css | 340.334 | 267.507 |
|app.min.css | 274.791 | 216.893 | |app.min.css | 274.791 | 212.244 |
### PHP73 branch ### PHP73 branch

View file

@ -1,42 +0,0 @@
const Opentip = window.Opentip || {};
Opentip.styles = Opentip.styles || {};
Opentip.styles.rainloop = {
'extends': 'standard',
'fixed': true,
'target': true,
'delay': 0.2,
'hideDelay': 0,
'hideEffect': 'fade',
'hideEffectDuration': 0.2,
'showEffect': 'fade',
'showEffectDuration': 0.2,
'showOn': 'mouseover click',
'removeElementsOnHide': true,
'background': '#fff',
'shadow': false,
'borderColor': '#999',
'borderRadius': 2,
'borderWidth': 1
};
Opentip.styles.rainloopTip = {
'extends': 'rainloop',
'delay': 0.4,
'group': 'rainloopTips'
};
Opentip.styles.rainloopErrorTip = {
'extends': 'rainloop',
'className': 'rainloopErrorTip'
};
export { Opentip, Opentip as default };

132
dev/External/ko.js vendored
View file

@ -1,17 +1,9 @@
import Opentip from 'Opentip';
import { SaveSettingsStep, Magics } from 'Common/Enums'; import { SaveSettingsStep, Magics } from 'Common/Enums';
const const
$ = jQuery, $ = jQuery,
ko = window.ko, ko = window.ko,
fDisposalTooltipHelper = (element) => { Translator = () => require('Common/Translator'),
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
if (element && element.__opentip) {
element.__opentip.deactivate();
}
});
},
isFunction = v => typeof v === 'function'; isFunction = v => typeof v === 'function';
ko.bindingHandlers.editor = { ko.bindingHandlers.editor = {
@ -112,79 +104,35 @@ ko.bindingHandlers.visibleAnimated = {
ko.bindingHandlers.tooltip = { ko.bindingHandlers.tooltip = {
init: (element, fValueAccessor) => { init: (element, fValueAccessor) => {
const $el = $(element), const fValue = fValueAccessor(),
fValue = fValueAccessor(),
isMobile = 'on' === ($el.data('tooltip-mobile') || 'off'),
isI18N = 'on' === ($el.data('tooltip-i18n') || 'on'),
Globals = require('Common/Globals'); Globals = require('Common/Globals');
if (!Globals.bMobileDevice || isMobile) { if (!Globals.bMobileDevice || 'on' === element.dataset.tooltipMobile) {
const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue); const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
element.__opentip = new Opentip(element, { if ('off' === element.dataset.tooltipI18n) {
'style': 'rainloopTip', element.title = sValue;
'element': element,
'tipJoint': $el.data('tooltip-join') || 'bottom'
});
Globals.dropdownVisibility.subscribe((v) => {
if (v) {
element.__opentip.hide();
}
});
if (sValue) {
element.__opentip.activate();
} else { } else {
element.__opentip.hide(); element.title = Translator().i18n(sValue);
element.__opentip.deactivate(); Translator().trigger.subscribe(() =>
element.__opentip.setContent(''); element.title = Translator().i18n(sValue)
);
Globals.dropdownVisibility.subscribe(() =>
element.title = Translator().i18n(sValue)
);
} }
if (isI18N) {
const Translator = require('Common/Translator');
element.__opentip.setContent(Translator.i18n(sValue));
Translator.trigger.subscribe(() => {
element.__opentip.setContent(Translator.i18n(sValue));
});
Globals.dropdownVisibility.subscribe(() => {
if (element && element.__opentip) {
element.__opentip.setContent(Translator.i18n(sValue));
}
});
} else {
element.__opentip.setContent(sValue);
}
addEventListener('rl.tooltips.diactivate', () => {
element.__opentip.hide();
element.__opentip.deactivate();
});
addEventListener('rl.tooltips.activate', () => {
element.__opentip.activate();
});
} }
}, },
update: (element, fValueAccessor) => { update: (element, fValueAccessor) => {
const $el = $(element), const fValue = fValueAccessor(),
fValue = fValueAccessor(),
isMobile = 'on' === ($el.data('tooltip-mobile') || 'off'),
isI18N = 'on' === ($el.data('tooltip-i18n') || 'on'),
Globals = require('Common/Globals'); Globals = require('Common/Globals');
if ((!Globals.bMobileDevice || isMobile) && element.__opentip) { if (!Globals.bMobileDevice || 'on' === element.dataset.tooltipMobile) {
const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue); const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
if (sValue) { if (sValue) {
element.__opentip.setContent(isI18N ? require('Common/Translator').i18n(sValue) : sValue); element.title = 'off' === element.dataset.tooltipI18n ? sValue : Translator().i18n(sValue);
element.__opentip.activate();
} else { } else {
element.__opentip.hide(); element.title = '';
element.__opentip.deactivate();
element.__opentip.setContent('');
} }
} }
} }
@ -192,49 +140,21 @@ ko.bindingHandlers.tooltip = {
ko.bindingHandlers.tooltipErrorTip = { ko.bindingHandlers.tooltipErrorTip = {
init: function(element) { init: function(element) {
const $el = $(element);
element.__opentip = new Opentip(element, {
style: 'rainloopErrorTip',
hideOn: 'mouseout click',
element: element,
tipJoint: $el.data('tooltip-join') || 'top'
});
element.__opentip.deactivate();
$(document).on('click', () => { $(document).on('click', () => {
if (element && element.__opentip) { element.removeAttribute('data-rainloopErrorTip')
element.__opentip.hide(); });
} ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
element.removeAttribute('data-rainloopErrorTip')
}); });
fDisposalTooltipHelper(element);
}, },
update: (element, fValueAccessor) => { update: (element, fValueAccessor) => {
const $el = $(element), const fValue = fValueAccessor(),
fValue = fValueAccessor(), value = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
value = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue),
openTips = element.__opentip;
if (openTips) { if (value) {
if (value) { setTimeout(() => element.setAttribute('data-rainloopErrorTip', value), Magics.Time100ms);
setTimeout(() => { } else {
if ($el.is(':visible')) { element.removeAttribute('data-rainloopErrorTip');
openTips.setContent(value);
openTips.activate();
openTips.show();
} else {
openTips.hide();
openTips.deactivate();
openTips.setContent('');
}
}, Magics.Time100ms);
} else {
openTips.hide();
openTips.deactivate();
openTips.setContent('');
}
} }
} }
}; };

View file

@ -23,43 +23,55 @@
opacity: 0; opacity: 0;
} }
.opentip-container { [data-rainloopTip],
[data-rainloopErrorTip] {
position: relative;
}
[data-rainloopTip]::before,
[data-rainloopErrorTip]::before {
background: #fff;
border-radius: 3px;
border: 1px solid #999;
content : attr(data-rainloopTip);
font-size: 13px;
left: 100%;
opacity : 0;
padding: 0.25em;
position : absolute;
text-align: left;
top: 100%;
transition: opacity 0.2s ease-in-out;
white-space: nowrap;
z-index: 2001 !important; z-index: 2001 !important;
.ot-content { }
font-size: 13px; @media only screen and (max-width: 600px) {
} [data-rainloopTip]::before,
[data-rainloopErrorTip]::before {
&.style-rainloopErrorTip .ot-content { min-width: 60vw;
color: red; white-space: normal;
}
&.ot-show-effect-none, &.ot-hide-effect-none {
transition: none !important;
}
&.ot-show-effect-fade {
transition: none;
&.ot-hidden {
opacity: 0;
}
&.ot-going-to-show {
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
&.ot-showing {
opacity: 1;
transition: opacity 0.2s ease-in-out;
}
&.ot-visible {
opacity: 1;
transition: none;
}
} }
} }
[data-rainloopErrorTip]::before {
color: red;
content : attr(data-rainloopErrorTip);
opacity : 1;
}
[data-tooltip]:hover::before {
opacity : 1;
}
[data-rainloopTip]::after,
[data-rainloopErrorTip]::after {
border-color: transparent transparent #999 transparent;
border-style: solid;
border-width: 5px;
content: "";
margin: -5px;
max-width: 80vw;
position: absolute;
top: 100%;
transform: rotate(-45deg);
z-index: 2002;
}
svg-icon { svg-icon {
display: none; display: none;

View file

@ -1,119 +0,0 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
import { i18n, getNotification } from 'Common/Translator';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import LicenseStore from 'Stores/Admin/License';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@popup({
name: 'View/Popup/Activate',
templateID: 'PopupsActivate'
})
class ActivatePopupView extends AbstractViewNext {
constructor() {
super();
this.domain = ko.observable('');
this.key = ko.observable('');
this.key.focus = ko.observable(false);
this.activationSuccessed = ko.observable(false);
this.licenseTrigger = LicenseStore.licenseTrigger;
this.activateProcess = ko.observable(false);
this.activateText = ko.observable('');
this.activateText.isError = ko.observable(false);
this.htmlDescription = ko.computed(() => i18n('POPUPS_ACTIVATE/HTML_DESC', { 'DOMAIN': this.domain() }));
this.key.subscribe(() => {
this.activateText('');
this.activateText.isError(false);
});
this.activationSuccessed.subscribe((value) => {
if (value) {
this.licenseTrigger(!this.licenseTrigger());
}
});
}
@command(
(self) => !self.activateProcess() && self.domain() && self.key() && !self.activationSuccessed()
)
activateCommand() {
this.activateProcess(true);
if (this.validateSubscriptionKey()) {
Remote.licensingActivate(
(sResult, oData) => {
this.activateProcess(false);
if (StorageResultType.Success === sResult && oData.Result) {
if (true === oData.Result) {
this.activationSuccessed(true);
this.activateText(i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
this.activateText.isError(false);
} else {
this.activateText(oData.Result);
this.activateText.isError(true);
this.key.focus(true);
}
} else if (oData.ErrorCode) {
this.activateText(getNotification(oData.ErrorCode));
this.activateText.isError(true);
this.key.focus(true);
} else {
this.activateText(getNotification(Notification.UnknownError));
this.activateText.isError(true);
this.key.focus(true);
}
},
this.domain(),
this.key().replace(/[^A-Z0-9-]/gi, '')
);
} else {
this.activateProcess(false);
this.activateText(i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
this.activateText.isError(true);
this.key.focus(true);
}
}
onShow(isTrial) {
this.domain(Settings.settingsGet('AdminDomain'));
if (!this.activateProcess()) {
isTrial = undefined === isTrial ? false : !!isTrial;
this.key(isTrial ? RAINLOOP_TRIAL_KEY : '');
this.activateText('');
this.activateText.isError(false);
this.activationSuccessed(false);
}
}
onShowWithDelay() {
if (!this.activateProcess()) {
this.key.focus(true);
}
}
/**
* @returns {boolean}
*/
validateSubscriptionKey() {
const value = this.key();
return (
!value ||
RAINLOOP_TRIAL_KEY === value ||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(value.trim().replace(/[^A-Z0-9-]/gi, ''))
);
}
}
export { ActivatePopupView, ActivatePopupView as default };

View file

@ -93,7 +93,6 @@
"node-fs": "0.1.7", "node-fs": "0.1.7",
"normalize.css": "8.0.1", "normalize.css": "8.0.1",
"openpgp": "2.6.2", "openpgp": "2.6.2",
"opentip": "2.4.3",
"prettier": "1.19.1", "prettier": "1.19.1",
"raw-loader": "4.0.0", "raw-loader": "4.0.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",

View file

@ -55,7 +55,6 @@ config.paths.css = {
'vendors/fontastic/styles.css', 'vendors/fontastic/styles.css',
'vendors/inputosaurus/inputosaurus.css', 'vendors/inputosaurus/inputosaurus.css',
'vendors/flags/flags-fixed.css', 'vendors/flags/flags-fixed.css',
'node_modules/opentip/css/opentip.css',
'vendors/lightgallery/dist/css/lightgallery.min.css', 'vendors/lightgallery/dist/css/lightgallery.min.css',
'vendors/lightgallery/dist/css/lg-transitions.min.css', 'vendors/lightgallery/dist/css/lg-transitions.min.css',
'dev/Styles/_progressjs.css' 'dev/Styles/_progressjs.css'
@ -86,8 +85,6 @@ config.paths.js = {
'node_modules/knockout-sortable/build/knockout-sortable.min.js ', 'node_modules/knockout-sortable/build/knockout-sortable.min.js ',
'node_modules/simplestatemanager/dist/ssm.min.js', 'node_modules/simplestatemanager/dist/ssm.min.js',
'node_modules/autolinker/dist/Autolinker.min.js', 'node_modules/autolinker/dist/Autolinker.min.js',
'node_modules/opentip/lib/opentip.js',
'node_modules/opentip/lib/adapter-jquery.js',
'vendors/lightgallery/dist/js/lightgallery.min.js', // license 'vendors/lightgallery/dist/js/lightgallery.min.js', // license
'vendors/lightgallery/dist/js/lg-fullscreen.min.js', 'vendors/lightgallery/dist/js/lg-fullscreen.min.js',
'vendors/lightgallery/dist/js/lg-thumbnail.min.js', 'vendors/lightgallery/dist/js/lg-thumbnail.min.js',

View file

@ -90,17 +90,18 @@
$items = $('[role=menu] li:not(.divider):visible a', $parent) $items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return if ($items.length) {
index = $items.index($items.filter(':focus')) index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0 if (!~index) index = 0
$items $items
.eq(index) .eq(index)
.focus() .focus()
}
} }
} }
@ -199,7 +200,7 @@
that.enforceFocus() that.enforceFocus()
transition ? transition ?
that.$element.one('transitionend', function () { that.$element.focus().trigger('shown') }) : that.$element.one('transitionend', () => that.$element.focus().trigger('shown')) :
that.$element.focus().trigger('shown') that.$element.focus().trigger('shown')
}) })
@ -231,7 +232,7 @@
enforceFocus () { enforceFocus () {
var that = this var that = this
$(doc).on('focusin.modal', function (e) { $(doc).on('focusin.modal', e => {
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
that.$element.focus() that.$element.focus()
} }
@ -241,9 +242,7 @@
escape () { escape () {
var that = this var that = this
if (this.isShown && this.options.keyboard) { if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.modal', function ( e ) { this.$element.on('keyup.dismiss.modal', e => e.which == 27 && that.hide())
e.which == 27 && that.hide()
})
} else if (!this.isShown) { } else if (!this.isShown) {
this.$element.off('keyup.dismiss.modal') this.$element.off('keyup.dismiss.modal')
} }
@ -251,12 +250,12 @@
hideWithTransition () { hideWithTransition () {
var that = this var that = this
, timeout = setTimeout(function () { , timeout = setTimeout(() => {
that.$element.off('transitionend') that.$element.off('transitionend')
that.hideModal() that.hideModal()
}, 500) }, 500)
this.$element.one('transitionend', function () { this.$element.one('transitionend', () => {
clearTimeout(timeout) clearTimeout(timeout)
that.hideModal() that.hideModal()
}) })
@ -265,7 +264,7 @@
hideModal () { hideModal () {
var that = this var that = this
this.$element.hide() this.$element.hide()
this.backdrop(function () { this.backdrop(() => {
that.removeBackdrop() that.removeBackdrop()
that.$element.trigger('hidden') that.$element.trigger('hidden')
}) })
@ -347,9 +346,7 @@
$target $target
.modal(option) .modal(option)
.one('hide', function () { .one('hide', () => $this.focus())
$this.focus()
})
}) })
/* TAB CLASS DEFINITION /* TAB CLASS DEFINITION
@ -452,4 +449,4 @@
$(this).tab('show') $(this).tab('show')
}) })
})(window.jQuery); })(jQuery);

File diff suppressed because one or more lines are too long

View file

@ -20,13 +20,10 @@
($ => { ($ => {
var inputosaurustext = { const fakeSpan = $('<span class="inputosaurus-fake-span"></span>');
version: "0.1.6", $('body').append(fakeSpan);
$.widget("ui.inputosaurus", {
fakeSpan: $('<span class="inputosaurus-fake-span"></span>'),
eventprefix: "inputosaurus",
options: { options: {
@ -259,10 +256,10 @@
// the input dynamically resizes based on the length of its value // the input dynamically resizes based on the length of its value
_resizeInput : function(ev) { _resizeInput : function(ev) {
var widget = (ev && ev.data.widget) || this; var widget = (ev && ev.data.widget) || this;
inputosaurustext.fakeSpan.text(widget.elements.input.val()); fakeSpan.text(widget.elements.input.val());
// setTimeout(function () { // setTimeout(function () {
var txtWidth = 25 + inputosaurustext.fakeSpan.width(); var txtWidth = 25 + fakeSpan.width();
txtWidth = txtWidth > 50 ? txtWidth : 50; txtWidth = txtWidth > 50 ? txtWidth : 50;
txtWidth = txtWidth < 500 ? txtWidth : 500; txtWidth = txtWidth < 500 ? txtWidth : 500;
widget.elements.input.width(txtWidth); widget.elements.input.width(txtWidth);
@ -637,10 +634,7 @@
els.ul.replaceWith(this.element); els.ul.replaceWith(this.element);
} }
} }
}; });
$('body').append(inputosaurustext.fakeSpan);
$.widget("ui.inputosaurus", inputosaurustext);
})(jQuery); })(jQuery);

View file

@ -149,7 +149,7 @@
}); });
// reset modifiers to false whenever the window is (re)focused. // reset modifiers to false whenever the window is (re)focused.
window.addEventListener('focus', () => { addEventListener('focus', () => {
for(let k in _mods) _mods[k] = false; for(let k in _mods) _mods[k] = false;
for(let k in _MODIFIERS) assignKey[k] = false; for(let k in _MODIFIERS) assignKey[k] = false;
}); });

View file

@ -8,7 +8,7 @@
* @license MIT License (MIT) * @license MIT License (MIT)
*/ */
(function($, window, document, undefined) { ($ => {
'use strict'; 'use strict';
@ -25,166 +25,170 @@
* Creates the autoplay plugin. * Creates the autoplay plugin.
* @param {object} element - lightGallery element * @param {object} element - lightGallery element
*/ */
var Autoplay = function(element) { class Autoplay
{
this.core = $(element).data('lightGallery'); constructor(element) {
this.$el = $(element); this.core = $(element).data('lightGallery');
// Execute only if items are above 1 this.$el = $(element);
if (this.core.$items.length < 2) {
return false;
}
this.core.s = $.extend({}, defaults, this.core.s); // Execute only if items are above 1
this.interval = false; if (this.core.$items.length < 2) {
return 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.find('.lg').append('<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
_this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
if (_this.interval) {
_this.cancelAuto();
_this.canceledOnTouch = true;
} }
});
// restore autoplay if autoplay canceled from touchstart / dragstart this.core.s = $.extend({}, defaults, this.core.s);
_this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() { this.interval = false;
if (!_this.interval && _this.canceledOnTouch) {
// 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;
}
init() {
var _this = this;
// append autoplay controls
if (_this.core.s.autoplayControls) {
_this.controls();
}
// Create progress bar
if (_this.core.s.progressBar) {
_this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>');
}
// set progress
_this.progress();
// Start autoplay
if (_this.core.s.autoplay) {
_this.startlAuto(); _this.startlAuto();
_this.canceledOnTouch = false;
} }
});
}; // cancel interval on touchstart and dragstart
_this.$el.on('onDragstart.lg.tm touchstart.lg.tm', () => {
Autoplay.prototype.progress = function() {
var _this = this;
var _$progressBar;
var _$progress;
_this.$el.on('onBeforeSlide.lg.tm', function() {
// start progress bar animation
if (_this.core.s.progressBar && _this.fromAuto) {
_$progressBar = _this.core.$outer.find('.lg-progress-bar');
_$progress = _this.core.$outer.find('.lg-progress');
if (_this.interval) { if (_this.interval) {
_$progress.removeAttr('style'); _this.cancelAuto();
_$progressBar.removeClass('lg-start'); _this.canceledOnTouch = true;
setTimeout(function() {
_$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
_$progressBar.addClass('lg-start');
}, 20);
} }
} });
// Remove setinterval if slide is triggered manually and fourceautoplay is false // restore autoplay if autoplay canceled from touchstart / dragstart
if (!_this.fromAuto && !_this.core.s.fourceAutoplay) { _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', () => {
_this.cancelAuto(); if (!_this.interval && _this.canceledOnTouch) {
}
_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.s.appendAutoplayControlsTo).append(_html);
_this.core.$outer.find('.lg-autoplay-button').on('click.lg', function() {
if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
_this.cancelAuto();
_this.core.s.fourceAutoplay = false;
} else {
if (!_this.interval) {
_this.startlAuto(); _this.startlAuto();
_this.core.s.fourceAutoplay = _this.fourceAutoplayTemp; _this.canceledOnTouch = false;
} }
} });
});
};
// Autostart gallery }
Autoplay.prototype.startlAuto = function() {
var _this = this;
_this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s'); progress() {
_this.core.$outer.addClass('lg-show-autoplay');
_this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
_this.interval = setInterval(function() { var _this = this;
if (_this.core.index + 1 < _this.core.$items.length) { var _$progressBar;
_this.core.index++; var _$progress;
} else {
_this.core.index = 0;
}
_this.fromAuto = true; _this.$el.on('onBeforeSlide.lg.tm', () => {
_this.core.slide(_this.core.index, false, false);
}, _this.core.s.speed + _this.core.s.pause);
};
// cancel Autostart // start progress bar animation
Autoplay.prototype.cancelAuto = function() { if (_this.core.s.progressBar && _this.fromAuto) {
clearInterval(this.interval); _$progressBar = _this.core.$outer.find('.lg-progress-bar');
this.interval = false; _$progress = _this.core.$outer.find('.lg-progress');
this.core.$outer.find('.lg-progress').removeAttr('style'); if (_this.interval) {
this.core.$outer.removeClass('lg-show-autoplay'); _$progress.removeAttr('style');
this.core.$outer.find('.lg-progress-bar').removeClass('lg-start'); _$progressBar.removeClass('lg-start');
}; setTimeout(() => {
_$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
_$progressBar.addClass('lg-start');
}, 20);
}
}
Autoplay.prototype.destroy = function() { // Remove setinterval if slide is triggered manually and fourceautoplay is false
if (!_this.fromAuto && !_this.core.s.fourceAutoplay) {
_this.cancelAuto();
}
this.cancelAuto(); _this.fromAuto = false;
this.core.$outer.find('.lg-progress-bar').remove();
}; });
}
// Manage autoplay via play/stop buttons
controls() {
var _this = this;
var _html = '<span class="lg-autoplay-button lg-icon"></span>';
// Append autoplay controls
$(this.core.s.appendAutoplayControlsTo).append(_html);
_this.core.$outer.find('.lg-autoplay-button').on('click.lg', () => {
if ($(_this.core.$outer).hasClass('lg-show-autoplay')) {
_this.cancelAuto();
_this.core.s.fourceAutoplay = false;
} else {
if (!_this.interval) {
_this.startlAuto();
_this.core.s.fourceAutoplay = _this.fourceAutoplayTemp;
}
}
});
}
// Autostart gallery
startlAuto() {
var _this = this;
_this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
_this.core.$outer.addClass('lg-show-autoplay');
_this.core.$outer.find('.lg-progress-bar').addClass('lg-start');
_this.interval = setInterval(() => {
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
cancelAuto() {
clearInterval(this.interval);
this.interval = false;
this.core.$outer.find('.lg-progress').removeAttr('style');
this.core.$outer.removeClass('lg-show-autoplay');
this.core.$outer.find('.lg-progress-bar').removeClass('lg-start');
}
destroy() {
this.cancelAuto();
this.core.$outer.find('.lg-progress-bar').remove();
}
}
$.fn.lightGallery.modules.autoplay = Autoplay; $.fn.lightGallery.modules.autoplay = Autoplay;
})(jQuery, window, document); })(jQuery);

View file

@ -1,4 +1,4 @@
/*! lightgallery - v1.2.21 - 2016-06-28 /*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/ * http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ * Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
!function(a,b,c,d){"use strict";var e={autoplay:!1,pause:5e3,progressBar:!0,fourceAutoplay:!1,autoplayControls:!0,appendAutoplayControlsTo:".lg-toolbar"},f=function(b){return this.core=a(b).data("lightGallery"),this.$el=a(b),this.core.$items.length<2?!1:(this.core.s=a.extend({},e,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)};f.prototype.init=function(){var a=this;a.core.s.autoplayControls&&a.controls(),a.core.s.progressBar&&a.core.$outer.find(".lg").append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>'),a.progress(),a.core.s.autoplay&&a.startlAuto(),a.$el.on("onDragstart.lg.tm touchstart.lg.tm",function(){a.interval&&(a.cancelAuto(),a.canceledOnTouch=!0)}),a.$el.on("onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm",function(){!a.interval&&a.canceledOnTouch&&(a.startlAuto(),a.canceledOnTouch=!1)})},f.prototype.progress=function(){var a,b,c=this;c.$el.on("onBeforeSlide.lg.tm",function(){c.core.s.progressBar&&c.fromAuto&&(a=c.core.$outer.find(".lg-progress-bar"),b=c.core.$outer.find(".lg-progress"),c.interval&&(b.removeAttr("style"),a.removeClass("lg-start"),setTimeout(function(){b.css("transition","width "+(c.core.s.speed+c.core.s.pause)+"ms ease 0s"),a.addClass("lg-start")},20))),c.fromAuto||c.core.s.fourceAutoplay||c.cancelAuto(),c.fromAuto=!1})},f.prototype.controls=function(){var b=this,c='<span class="lg-autoplay-button lg-icon"></span>';a(this.core.s.appendAutoplayControlsTo).append(c),b.core.$outer.find(".lg-autoplay-button").on("click.lg",function(){a(b.core.$outer).hasClass("lg-show-autoplay")?(b.cancelAuto(),b.core.s.fourceAutoplay=!1):b.interval||(b.startlAuto(),b.core.s.fourceAutoplay=b.fourceAutoplayTemp)})},f.prototype.startlAuto=function(){var a=this;a.core.$outer.find(".lg-progress").css("transition","width "+(a.core.s.speed+a.core.s.pause)+"ms ease 0s"),a.core.$outer.addClass("lg-show-autoplay"),a.core.$outer.find(".lg-progress-bar").addClass("lg-start"),a.interval=setInterval(function(){a.core.index+1<a.core.$items.length?a.core.index++:a.core.index=0,a.fromAuto=!0,a.core.slide(a.core.index,!1,!1)},a.core.s.speed+a.core.s.pause)},f.prototype.cancelAuto=function(){clearInterval(this.interval),this.interval=!1,this.core.$outer.find(".lg-progress").removeAttr("style"),this.core.$outer.removeClass("lg-show-autoplay"),this.core.$outer.find(".lg-progress-bar").removeClass("lg-start")},f.prototype.destroy=function(){this.cancelAuto(),this.core.$outer.find(".lg-progress-bar").remove()},a.fn.lightGallery.modules.autoplay=f}(jQuery,window,document); (e=>{"use strict";var o={autoplay:!1,pause:5e3,progressBar:!0,fourceAutoplay:!1,autoplayControls:!0,appendAutoplayControlsTo:".lg-toolbar"};e.fn.lightGallery.modules.autoplay=class{constructor(r){return this.core=e(r).data("lightGallery"),this.$el=e(r),!(this.core.$items.length<2)&&(this.core.s=e.extend({},o,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)}init(){var e=this;e.core.s.autoplayControls&&e.controls(),e.core.s.progressBar&&e.core.$outer.find(".lg").append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>'),e.progress(),e.core.s.autoplay&&e.startlAuto(),e.$el.on("onDragstart.lg.tm touchstart.lg.tm",()=>{e.interval&&(e.cancelAuto(),e.canceledOnTouch=!0)}),e.$el.on("onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm",()=>{!e.interval&&e.canceledOnTouch&&(e.startlAuto(),e.canceledOnTouch=!1)})}progress(){var e,o,r=this;r.$el.on("onBeforeSlide.lg.tm",()=>{r.core.s.progressBar&&r.fromAuto&&(e=r.core.$outer.find(".lg-progress-bar"),o=r.core.$outer.find(".lg-progress"),r.interval&&(o.removeAttr("style"),e.removeClass("lg-start"),setTimeout(()=>{o.css("transition","width "+(r.core.s.speed+r.core.s.pause)+"ms ease 0s"),e.addClass("lg-start")},20))),r.fromAuto||r.core.s.fourceAutoplay||r.cancelAuto(),r.fromAuto=!1})}controls(){var o=this;e(this.core.s.appendAutoplayControlsTo).append('<span class="lg-autoplay-button lg-icon"></span>'),o.core.$outer.find(".lg-autoplay-button").on("click.lg",()=>{e(o.core.$outer).hasClass("lg-show-autoplay")?(o.cancelAuto(),o.core.s.fourceAutoplay=!1):o.interval||(o.startlAuto(),o.core.s.fourceAutoplay=o.fourceAutoplayTemp)})}startlAuto(){var e=this;e.core.$outer.find(".lg-progress").css("transition","width "+(e.core.s.speed+e.core.s.pause)+"ms ease 0s"),e.core.$outer.addClass("lg-show-autoplay"),e.core.$outer.find(".lg-progress-bar").addClass("lg-start"),e.interval=setInterval(()=>{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)}cancelAuto(){clearInterval(this.interval),this.interval=!1,this.core.$outer.find(".lg-progress").removeAttr("style"),this.core.$outer.removeClass("lg-show-autoplay"),this.core.$outer.find(".lg-progress-bar").removeClass("lg-start")}destroy(){this.cancelAuto(),this.core.$outer.find(".lg-progress-bar").remove()}}})(jQuery);

View file

@ -1,7 +1,7 @@
/*! lightgallery - v1.2.21 - 2016-06-28 /*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/ * http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ * Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) { (($, document) => {
'use strict'; 'use strict';
@ -9,89 +9,92 @@
fullScreen: true fullScreen: true
}; };
var Fullscreen = function(element) { class Fullscreen
{
constructor(element) {
// get lightGallery core plugin data // get lightGallery core plugin data
this.core = $(element).data('lightGallery'); this.core = $(element).data('lightGallery');
this.$el = $(element); this.$el = $(element);
// extend module defalut settings with lightGallery core settings // extend module defalut settings with lightGallery core settings
this.core.s = $.extend({}, defaults, this.core.s); this.core.s = $.extend({}, defaults, this.core.s);
this.init(); this.init();
return this; return this;
}; }
Fullscreen.prototype.init = function() { init() {
var fullScreen = ''; var fullScreen = '';
if (this.core.s.fullScreen) { if (this.core.s.fullScreen) {
// check for fullscreen browser support // check for fullscreen browser support
if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled &&
!document.mozFullScreenEnabled && !document.msFullscreenEnabled) { !document.mozFullScreenEnabled && !document.msFullscreenEnabled) {
return; return;
} else { } else {
fullScreen = '<span class="lg-fullscreen lg-icon"></span>'; fullScreen = '<span class="lg-fullscreen lg-icon"></span>';
this.core.$outer.find('.lg-toolbar').append(fullScreen); this.core.$outer.find('.lg-toolbar').append(fullScreen);
this.fullScreen(); this.fullScreen();
}
} }
} }
};
Fullscreen.prototype.requestFullscreen = function() { requestFullscreen() {
var el = document.documentElement; var el = document.documentElement;
if (el.requestFullscreen) { if (el.requestFullscreen) {
el.requestFullscreen(); el.requestFullscreen();
} else if (el.msRequestFullscreen) { } else if (el.msRequestFullscreen) {
el.msRequestFullscreen(); el.msRequestFullscreen();
} else if (el.mozRequestFullScreen) { } else if (el.mozRequestFullScreen) {
el.mozRequestFullScreen(); el.mozRequestFullScreen();
} else if (el.webkitRequestFullscreen) { } else if (el.webkitRequestFullscreen) {
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;
$(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
_this.core.$outer.toggleClass('lg-fullscreen-on');
});
this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
_this.requestFullscreen();
} else {
_this.exitFullscreen();
} }
}); }
}; exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
Fullscreen.prototype.destroy = function() { // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
fullScreen() {
var _this = this;
// exit from fullscreen if activated $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', () =>
this.exitFullscreen(); _this.core.$outer.toggleClass('lg-fullscreen-on')
);
$(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg'); this.core.$outer.find('.lg-fullscreen').on('click.lg', () => {
}; if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
_this.requestFullscreen();
} else {
_this.exitFullscreen();
}
});
}
destroy() {
// exit from fullscreen if activated
this.exitFullscreen();
$(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
}
}
$.fn.lightGallery.modules.fullscreen = Fullscreen; $.fn.lightGallery.modules.fullscreen = Fullscreen;
})(jQuery, window, document); })(jQuery, document);

View file

@ -1,4 +1,4 @@
/*! lightgallery - v1.2.21 - 2016-06-28 /*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/ * http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ * Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
!function(a,b,c,d){"use strict";var e={fullScreen:!0},f=function(b){return this.core=a(b).data("lightGallery"),this.$el=a(b),this.core.s=a.extend({},e,this.core.s),this.init(),this};f.prototype.init=function(){var a="";if(this.core.s.fullScreen){if(!(c.fullscreenEnabled||c.webkitFullscreenEnabled||c.mozFullScreenEnabled||c.msFullscreenEnabled))return;a='<span class="lg-fullscreen lg-icon"></span>',this.core.$outer.find(".lg-toolbar").append(a),this.fullScreen()}},f.prototype.requestFullscreen=function(){var a=c.documentElement;a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen()},f.prototype.exitFullscreen=function(){c.exitFullscreen?c.exitFullscreen():c.msExitFullscreen?c.msExitFullscreen():c.mozCancelFullScreen?c.mozCancelFullScreen():c.webkitExitFullscreen&&c.webkitExitFullscreen()},f.prototype.fullScreen=function(){var b=this;a(c).on("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg",function(){b.core.$outer.toggleClass("lg-fullscreen-on")}),this.core.$outer.find(".lg-fullscreen").on("click.lg",function(){c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement||c.msFullscreenElement?b.exitFullscreen():b.requestFullscreen()})},f.prototype.destroy=function(){this.exitFullscreen(),a(c).off("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg")},a.fn.lightGallery.modules.fullscreen=f}(jQuery,window,document); ((e,l)=>{"use strict";var n={fullScreen:!0};e.fn.lightGallery.modules.fullscreen=class{constructor(l){return this.core=e(l).data("lightGallery"),this.$el=e(l),this.core.s=e.extend({},n,this.core.s),this.init(),this}init(){var e="";if(this.core.s.fullScreen){if(!(l.fullscreenEnabled||l.webkitFullscreenEnabled||l.mozFullScreenEnabled||l.msFullscreenEnabled))return;e='<span class="lg-fullscreen lg-icon"></span>',this.core.$outer.find(".lg-toolbar").append(e),this.fullScreen()}}requestFullscreen(){var e=l.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}exitFullscreen(){l.exitFullscreen?l.exitFullscreen():l.msExitFullscreen?l.msExitFullscreen():l.mozCancelFullScreen?l.mozCancelFullScreen():l.webkitExitFullscreen&&l.webkitExitFullscreen()}fullScreen(){var n=this;e(l).on("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg",()=>n.core.$outer.toggleClass("lg-fullscreen-on")),this.core.$outer.find(".lg-fullscreen").on("click.lg",()=>{l.fullscreenElement||l.mozFullScreenElement||l.webkitFullscreenElement||l.msFullscreenElement?n.exitFullscreen():n.requestFullscreen()})}destroy(){this.exitFullscreen(),e(l).off("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg")}}})(jQuery,document);

View file

@ -1,73 +0,0 @@
/*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {
'use strict';
var defaults = {
hash: true
};
var Hash = function(element) {
this.core = $(element).data('lightGallery');
this.core.s = $.extend({}, defaults, 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
_this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) {
window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index;
});
// Listen hash change and change the slide according to slide value
$(window).on('hashchange.lg.hash', 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 = '';
}
}
this.core.$el.off('.lg.hash');
};
$.fn.lightGallery.modules.hash = Hash;
})(jQuery, window, document);

View file

@ -1,4 +0,0 @@
/*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
!function(a,b,c,d){"use strict";var e={hash:!0},f=function(c){return this.core=a(c).data("lightGallery"),this.core.s=a.extend({},e,this.core.s),this.core.s.hash&&(this.oldHash=b.location.hash,this.init()),this};f.prototype.init=function(){var c,d=this;d.core.$el.on("onAfterSlide.lg.tm",function(a,c,e){b.location.hash="lg="+d.core.s.galleryId+"&slide="+e}),a(b).on("hashchange.lg.hash",function(){c=b.location.hash;var a=parseInt(c.split("&slide=")[1],10);c.indexOf("lg="+d.core.s.galleryId)>-1?d.core.slide(a,!1,!1):d.core.lGalleryOn&&d.core.destroy()})},f.prototype.destroy=function(){this.core.s.hash&&(this.oldHash&&this.oldHash.indexOf("lg="+this.core.s.galleryId)<0?b.location.hash=this.oldHash:history.pushState?history.pushState("",c.title,b.location.pathname+b.location.search):b.location.hash="",this.core.$el.off(".lg.hash"))},a.fn.lightGallery.modules.hash=f}(jQuery,window,document);

View file

@ -1,85 +0,0 @@
/*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {
'use strict';
var defaults = {
pager: false
};
var Pager = function(element) {
this.core = $(element).data('lightGallery');
this.$el = $(element);
this.core.s = $.extend({}, defaults, 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.find('.lg').append('<div class="lg-pager-outer"></div>');
if (_this.core.s.dynamic) {
for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
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[i].thumb + '" /></div></span>';
}
} else {
_this.core.$items.each(function() {
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).find('img').attr('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).attr(_this.core.s.exThumbImage) + '" /></div></span>';
}
});
}
$pagerOuter = _this.core.$outer.find('.lg-pager-outer');
$pagerOuter.html(pagerList);
$pagerCont = _this.core.$outer.find('.lg-pager-cont');
$pagerCont.on('click.lg touchend.lg', function() {
var _$this = $(this);
_this.core.index = _$this.index();
_this.core.slide(_this.core.index, false, false);
});
$pagerOuter.on('mouseover.lg', function() {
clearTimeout(timeout);
$pagerOuter.addClass('lg-pager-hover');
});
$pagerOuter.on('mouseout.lg', function() {
timeout = setTimeout(function() {
$pagerOuter.removeClass('lg-pager-hover');
});
});
_this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) {
$pagerCont.removeClass('lg-pager-active');
$pagerCont.eq(index).addClass('lg-pager-active');
});
};
Pager.prototype.destroy = function() {
};
$.fn.lightGallery.modules.pager = Pager;
})(jQuery, window, document);

View file

@ -1,4 +0,0 @@
/*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
!function(a,b,c,d){"use strict";var e={pager:!1},f=function(b){return this.core=a(b).data("lightGallery"),this.$el=a(b),this.core.s=a.extend({},e,this.core.s),this.core.s.pager&&this.core.$items.length>1&&this.init(),this};f.prototype.init=function(){var b,c,d,e=this,f="";if(e.core.$outer.find(".lg").append('<div class="lg-pager-outer"></div>'),e.core.s.dynamic)for(var g=0;g<e.core.s.dynamicEl.length;g++)f+='<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[g].thumb+'" /></div></span>';else e.core.$items.each(function(){f+=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="'+a(this).attr(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="'+a(this).find("img").attr("src")+'" /></div></span>'});c=e.core.$outer.find(".lg-pager-outer"),c.html(f),b=e.core.$outer.find(".lg-pager-cont"),b.on("click.lg touchend.lg",function(){var b=a(this);e.core.index=b.index(),e.core.slide(e.core.index,!1,!1)}),c.on("mouseover.lg",function(){clearTimeout(d),c.addClass("lg-pager-hover")}),c.on("mouseout.lg",function(){d=setTimeout(function(){c.removeClass("lg-pager-hover")})}),e.core.$el.on("onBeforeSlide.lg.tm",function(a,c,d){b.removeClass("lg-pager-active"),b.eq(d).addClass("lg-pager-active")})},f.prototype.destroy=function(){},a.fn.lightGallery.modules.pager=f}(jQuery,window,document);

View file

@ -1,7 +1,7 @@
/*! lightgallery - v1.2.21 - 2016-06-28 /*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/ * http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ * Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) { (($, window) => {
'use strict'; 'use strict';
@ -33,422 +33,423 @@
loadDailymotionThumbnail: true loadDailymotionThumbnail: true
}; };
var Thumbnail = function(element) { class Thumbnail
{
constructor(element) {
// get lightGallery core plugin data // get lightGallery core plugin data
this.core = $(element).data('lightGallery'); this.core = $(element).data('lightGallery');
// extend module default settings with lightGallery core settings // extend module default settings with lightGallery core settings
this.core.s = $.extend({}, defaults, this.core.s); this.core.s = $.extend({}, defaults, this.core.s);
this.$el = $(element); this.$el = $(element);
this.$thumbOuter = null; this.$thumbOuter = null;
this.thumbOuterWidth = 0; this.thumbOuterWidth = 0;
this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin)); this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin));
this.thumbIndex = this.core.index; this.thumbIndex = this.core.index;
// Thumbnail animation value // Thumbnail animation value
this.left = 0; this.left = 0;
this.init(); this.init();
return this; return this;
}; }
Thumbnail.prototype.init = function() { init() {
var _this = this; var _this = this;
if (this.core.s.thumbnail && this.core.$items.length > 1) { if (this.core.s.thumbnail && this.core.$items.length > 1) {
if (this.core.s.showThumbByDefault) { if (this.core.s.showThumbByDefault) {
setTimeout(function(){ setTimeout(function(){
_this.core.$outer.addClass('lg-thumb-open'); _this.core.$outer.addClass('lg-thumb-open');
}, 700); }, 700);
}
if (this.core.s.pullCaptionUp) {
this.core.$outer.addClass('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()) { if (this.core.s.pullCaptionUp) {
this.enableThumbSwipe(); this.core.$outer.addClass('lg-pull-caption-up');
} }
this.thumbClickable = false; this.build();
} else { if (this.core.s.animateThumb) {
this.thumbClickable = true; if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) {
} this.enableThumbDrag();
this.toogle();
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';
}
_this.core.$outer.addClass('lg-has-thumb');
_this.core.$outer.find('.lg').append(html);
_this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
_this.thumbOuterWidth = _this.$thumbOuter.width();
if (_this.core.s.animateThumb) {
_this.core.$outer.find('.lg-thumb').css({
width: _this.thumbTotalWidth + 'px',
position: 'relative'
});
}
if (this.core.s.animateThumb) {
_this.$thumbOuter.css('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) { if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) {
thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg'; this.enableThumbSwipe();
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>'; this.thumbClickable = false;
vimeoId = '';
}
if (_this.core.s.dynamic) {
for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
}
} else {
_this.core.$items.each(function(i) {
if (!_this.core.s.exThumbImage) {
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
} else { } else {
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i); this.thumbClickable = true;
} }
}); this.toogle();
this.thumbkeyPress();
}
} }
_this.core.$outer.find('.lg-thumb').html(thumbList); build() {
var _this = this;
var thumbList = '';
var vimeoErrorThumbSize = '';
var $thumb;
var html = '<div class="lg-thumb-outer">' +
'<div class="lg-thumb group">' +
'</div>' +
'</div>';
$thumb = _this.core.$outer.find('.lg-thumb-item'); switch (this.core.s.vimeoThumbSize) {
case 'thumbnail_large':
vimeoErrorThumbSize = '640';
break;
case 'thumbnail_medium':
vimeoErrorThumbSize = '200x150';
break;
case 'thumbnail_small':
vimeoErrorThumbSize = '100x75';
}
// Load vimeo thumbnails _this.core.$outer.addClass('lg-has-thumb');
$thumb.each(function() {
var $this = $(this);
var vimeoVideoId = $this.attr('data-vimeo-id');
if (vimeoVideoId) { _this.core.$outer.find('.lg').append(html);
$.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
format: 'json' _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer');
}, function(data) { _this.thumbOuterWidth = _this.$thumbOuter.width();
$this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
if (_this.core.s.animateThumb) {
_this.core.$outer.find('.lg-thumb').css({
width: _this.thumbTotalWidth + 'px',
position: 'relative'
}); });
} }
});
// manage active class for thumbnail if (this.core.s.animateThumb) {
$thumb.eq(_this.core.index).addClass('active'); _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px');
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
$thumb.removeClass('active');
$thumb.eq(_this.core.index).addClass('active');
});
$thumb.on('click.lg touchend.lg', function() {
var _$this = $(this);
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 = _$this.index();
_this.core.slide(_this.core.index, false, true);
}
}, 50);
});
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
_this.animateThumb(_this.core.index);
});
$(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
setTimeout(function() {
_this.animateThumb(_this.core.index);
_this.thumbOuterWidth = _this.$thumbOuter.width();
}, 200);
});
};
Thumbnail.prototype.setTranslate = function(value) {
// jQuery supports Automatic CSS prefixing since jQuery 1.8.0
this.core.$outer.find('.lg-thumb').css({
transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
});
};
Thumbnail.prototype.animateThumb = function(index) {
var $thumb = this.core.$outer.find('.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) { function getThumb(src, thumb, index) {
this.left = 0; var isVideo = _this.core.isVideo(src, index) || {};
} var thumbImg;
var vimeoId = '';
if (this.core.lGalleryOn) { if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) {
if (!$thumb.hasClass('on')) { if (isVideo.youtube) {
this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms'); 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;
} }
if (!this.core.doCss()) { 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>';
$thumb.animate({ vimeoId = '';
left: -this.left + 'px' }
}, this.core.s.speed);
if (_this.core.s.dynamic) {
for (var i = 0; i < _this.core.s.dynamicEl.length; i++) {
getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i);
} }
} else { } else {
if (!this.core.doCss()) { _this.core.$items.each(function(i) {
$thumb.css('left', -this.left + 'px');
} if (!_this.core.s.exThumbImage) {
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i);
} else {
getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i);
}
});
} }
this.setTranslate(this.left); _this.core.$outer.find('.lg-thumb').html(thumbList);
$thumb = _this.core.$outer.find('.lg-thumb-item');
// Load vimeo thumbnails
$thumb.each(function() {
var $this = $(this);
var vimeoVideoId = $this.attr('data-vimeo-id');
if (vimeoVideoId) {
$.getJSON('//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=?', {
format: 'json'
}, function(data) {
$this.find('img').attr('src', data[0][_this.core.s.vimeoThumbSize]);
});
}
});
// manage active class for thumbnail
$thumb.eq(_this.core.index).addClass('active');
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
$thumb.removeClass('active');
$thumb.eq(_this.core.index).addClass('active');
});
$thumb.on('click.lg touchend.lg', function() {
var _$this = $(this);
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 = _$this.index();
_this.core.slide(_this.core.index, false, true);
}
}, 50);
});
_this.core.$el.on('onBeforeSlide.lg.tm', function() {
_this.animateThumb(_this.core.index);
});
$(window).on('resize.lg.thumb orientationchange.lg.thumb', function() {
setTimeout(function() {
_this.animateThumb(_this.core.index);
_this.thumbOuterWidth = _this.$thumbOuter.width();
}, 200);
});
} }
};
// Enable thumbnail dragging and swiping setTranslate(value) {
Thumbnail.prototype.enableThumbDrag = function() { // jQuery supports Automatic CSS prefixing since jQuery 1.8.0
this.core.$outer.find('.lg-thumb').css({
transform: 'translate3d(-' + (value) + 'px, 0px, 0px)'
});
}
var _this = this; animateThumb(index) {
var startCoords = 0; var $thumb = this.core.$outer.find('.lg-thumb');
var endCoords = 0; if (this.core.s.animateThumb) {
var isDraging = false; var position;
var isMoved = false; switch (this.core.s.currentPagerPosition) {
var tempLeft = 0; case 'left':
position = 0;
_this.$thumbOuter.addClass('lg-grab'); break;
case 'middle':
_this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) { position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2);
if (_this.thumbTotalWidth > _this.thumbOuterWidth) { break;
// execute only on .lg-object case 'right':
e.preventDefault(); position = this.thumbOuterWidth - this.core.s.thumbWidth;
startCoords = e.pageX; }
isDraging = true; this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position;
if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) {
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 this.left = this.thumbTotalWidth - this.thumbOuterWidth;
_this.core.$outer.scrollLeft += 1;
_this.core.$outer.scrollLeft -= 1;
// *
_this.thumbClickable = false;
_this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
}
});
$(window).on('mousemove.lg.thumb', function(e) {
if (isDraging) {
tempLeft = _this.left;
isMoved = true;
endCoords = e.pageX;
_this.$thumbOuter.addClass('lg-dragging');
tempLeft = tempLeft - (endCoords - startCoords);
if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
} }
if (tempLeft < 0) { if (this.left < 0) {
tempLeft = 0; this.left = 0;
} }
// move current slide if (this.core.lGalleryOn) {
_this.setTranslate(tempLeft); if (!$thumb.hasClass('on')) {
this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms');
}
} if (!this.core.doCss()) {
}); $thumb.animate({
left: -this.left + 'px'
$(window).on('mouseup.lg.thumb', function() { }, this.core.s.speed);
if (isMoved) { }
isMoved = false; } else {
_this.$thumbOuter.removeClass('lg-dragging'); if (!this.core.doCss()) {
$thumb.css('left', -this.left + 'px');
_this.left = tempLeft; }
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
_this.thumbClickable = true;
} }
} else { this.setTranslate(this.left);
_this.thumbClickable = true;
} }
}
if (isDraging) { // Enable thumbnail dragging and swiping
isDraging = false; enableThumbDrag() {
_this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
}
});
}; var _this = this;
var startCoords = 0;
var endCoords = 0;
var isDraging = false;
var isMoved = false;
var tempLeft = 0;
Thumbnail.prototype.enableThumbSwipe = function() { _this.$thumbOuter.addClass('lg-grab');
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isMoved = false;
var tempLeft = 0;
_this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) { _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) { if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
e.preventDefault(); // execute only on .lg-object
startCoords = e.originalEvent.targetTouches[0].pageX; e.preventDefault();
_this.thumbClickable = false; startCoords = e.pageX;
} isDraging = true;
});
_this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) { // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
if (_this.thumbTotalWidth > _this.thumbOuterWidth) { _this.core.$outer.scrollLeft += 1;
e.preventDefault(); _this.core.$outer.scrollLeft -= 1;
endCoords = e.originalEvent.targetTouches[0].pageX;
isMoved = true;
_this.$thumbOuter.addClass('lg-dragging'); // *
_this.thumbClickable = false;
tempLeft = _this.left; _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing');
tempLeft = tempLeft - (endCoords - startCoords);
if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) {
tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth;
} }
});
$(window).on('mousemove.lg.thumb', function(e) {
if (isDraging) {
tempLeft = _this.left;
isMoved = true;
endCoords = e.pageX;
_this.$thumbOuter.addClass('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);
if (tempLeft < 0) {
tempLeft = 0;
} }
}).on('mouseup.lg.thumb', function() {
// move current slide
_this.setTranslate(tempLeft);
}
});
_this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
if (isMoved) { if (isMoved) {
isMoved = false; isMoved = false;
_this.$thumbOuter.removeClass('lg-dragging'); _this.$thumbOuter.removeClass('lg-dragging');
_this.left = tempLeft;
if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
_this.thumbClickable = true; _this.thumbClickable = true;
} }
_this.left = tempLeft;
} else { } else {
_this.thumbClickable = true; _this.thumbClickable = true;
} }
} else {
_this.thumbClickable = true; if (isDraging) {
isDraging = false;
_this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');
}
});
}
enableThumbSwipe() {
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isMoved = false;
var tempLeft = 0;
_this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
e.preventDefault();
startCoords = e.originalEvent.targetTouches[0].pageX;
_this.thumbClickable = false;
}
});
_this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
e.preventDefault();
endCoords = e.originalEvent.targetTouches[0].pageX;
isMoved = true;
_this.$thumbOuter.addClass('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);
}
});
_this.core.$outer.find('.lg-thumb').on('touchend.lg', function() {
if (_this.thumbTotalWidth > _this.thumbOuterWidth) {
if (isMoved) {
isMoved = false;
_this.$thumbOuter.removeClass('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;
}
});
}
toogle() {
var _this = this;
if (_this.core.s.toogleThumb) {
_this.core.$outer.addClass('lg-can-toggle');
_this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>');
_this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() {
_this.core.$outer.toggleClass('lg-thumb-open');
});
} }
}); }
}; thumbkeyPress() {
var _this = this;
Thumbnail.prototype.toogle = function() { $(window).on('keydown.lg.thumb', function(e) {
var _this = this; if (e.keyCode === 38) {
if (_this.core.s.toogleThumb) { e.preventDefault();
_this.core.$outer.addClass('lg-can-toggle'); _this.core.$outer.addClass('lg-thumb-open');
_this.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>'); } else if (e.keyCode === 40) {
_this.core.$outer.find('.lg-toogle-thumb').on('click.lg', function() { e.preventDefault();
_this.core.$outer.toggleClass('lg-thumb-open'); _this.core.$outer.removeClass('lg-thumb-open');
}
}); });
} }
};
Thumbnail.prototype.thumbkeyPress = function() { destroy() {
var _this = this; if (this.core.s.thumbnail && this.core.$items.length > 1) {
$(window).on('keydown.lg.thumb', function(e) { $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
if (e.keyCode === 38) { this.$thumbOuter.remove();
e.preventDefault(); this.core.$outer.removeClass('lg-has-thumb');
_this.core.$outer.addClass('lg-thumb-open');
} else if (e.keyCode === 40) {
e.preventDefault();
_this.core.$outer.removeClass('lg-thumb-open');
} }
});
};
Thumbnail.prototype.destroy = function() {
if (this.core.s.thumbnail && this.core.$items.length > 1) {
$(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');
this.$thumbOuter.remove();
this.core.$outer.removeClass('lg-has-thumb');
} }
}; }
$.fn.lightGallery.modules.Thumbnail = Thumbnail; $.fn.lightGallery.modules.Thumbnail = Thumbnail;
})(jQuery, window, document); })(jQuery, window);

File diff suppressed because one or more lines are too long

View file

@ -1,292 +0,0 @@
/*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(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 = '<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 + '&' + $.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 + '&' + $.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 = $(html).html();
}
video = html;
} else if (isVideo.vk) {
a = '&autoplay=' + autoplay;
if (this.core.s.vkPlayerParams) {
a = a + '&' + $.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;
};
$.fn.lightGallery.modules.video = Video;
})(jQuery, window, document);

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
/*! lightgallery - v1.2.21 - 2016-06-28 /*! lightgallery - v1.2.21 - 2016-06-28
* http://sachinchoolur.github.io/lightGallery/ * http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ * Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) { (($, window) => {
'use strict'; 'use strict';
@ -12,466 +12,467 @@
enableZoomAfter: 300 enableZoomAfter: 300
}; };
var Zoom = function(element) { class Zoom
{
constructor(element) {
this.core = $(element).data('lightGallery'); this.core = $(element).data('lightGallery');
this.core.s = $.extend({}, defaults, this.core.s); this.core.s = $.extend({}, defaults, this.core.s);
if (this.core.s.zoom && this.core.doCss()) { if (this.core.s.zoom && this.core.doCss()) {
this.init(); this.init();
// Store the zoomable timeout value just to clear it while closing // Store the zoomable timeout value just to clear it while closing
this.zoomabletimeout = false; this.zoomabletimeout = false;
// Set the initial value center // Set the initial value center
this.pageX = $(window).width() / 2; this.pageX = $(window).width() / 2;
this.pageY = ($(window).height() / 2) + $(window).scrollTop(); this.pageY = ($(window).height() / 2) + $(window).scrollTop();
} }
return this; return this;
}; }
Zoom.prototype.init = function() { init() {
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.find('.lg-toolbar').append(zoomIcons);
// Add zoomable class
_this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
// delay will be 0 except first time
var _speed = _this.core.s.enableZoomAfter + delay;
var _this = this; // set _speed value 0 if gallery opened from direct url and if it is first slide
var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>'; if ($('body').hasClass('lg-from-hash') && delay) {
if (_this.core.s.actualSize) {
zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
}
this.core.$outer.find('.lg-toolbar').append(zoomIcons);
// Add zoomable class
_this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
// delay will be 0 except first time // will execute only once
var _speed = _this.core.s.enableZoomAfter + delay; _speed = 0;
} else {
// set _speed value 0 if gallery opened from direct url and if it is first slide // Remove lg-from-hash to enable starting animation.
if ($('body').hasClass('lg-from-hash') && delay) { $('body').removeClass('lg-from-hash');
}
// will execute only once
_speed = 0; _this.zoomabletimeout = setTimeout(function() {
} else { _this.core.$slide.eq(index).addClass('lg-zoomable');
}, _speed + 30);
// Remove lg-from-hash to enable starting animation. });
$('body').removeClass('lg-from-hash');
} var scale = 1;
/**
_this.zoomabletimeout = setTimeout(function() { * @desc Image zoom
_this.core.$slide.eq(index).addClass('lg-zoomable'); * Translate the wrap and scale the image to get better user experience
}, _speed + 30); *
}); * @param {String} scaleVal - Zoom decrement/increment value
*/
var scale = 1; var zoom = function(scaleVal) {
/**
* @desc Image zoom var $image = _this.core.$outer.find('.lg-current .lg-image');
* Translate the wrap and scale the image to get better user experience var _x;
* var _y;
* @param {String} scaleVal - Zoom decrement/increment value
*/ // Find offset manually to avoid issue after zoom
var zoom = function(scaleVal) { var offsetX = ($(window).width() - $image.width()) / 2;
var offsetY = (($(window).height() - $image.height()) / 2) + $(window).scrollTop();
var $image = _this.core.$outer.find('.lg-current .lg-image');
var _x; _x = _this.pageX - offsetX;
var _y; _y = _this.pageY - offsetY;
// Find offset manually to avoid issue after zoom var x = (scaleVal - 1) * (_x);
var offsetX = ($(window).width() - $image.width()) / 2; var y = (scaleVal - 1) * (_y);
var offsetY = (($(window).height() - $image.height()) / 2) + $(window).scrollTop();
$image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
_x = _this.pageX - offsetX;
_y = _this.pageY - offsetY; $image.parent().css({
left: -x + 'px',
var x = (scaleVal - 1) * (_x); top: -y + 'px'
var y = (scaleVal - 1) * (_y); }).attr('data-x', x).attr('data-y', y);
};
$image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
var callScale = function() {
$image.parent().css({ if (scale > 1) {
left: -x + 'px', _this.core.$outer.addClass('lg-zoomed');
top: -y + 'px' } else {
}).attr('data-x', x).attr('data-y', y); _this.resetZoom();
}; }
var callScale = function() { if (scale < 1) {
if (scale > 1) { scale = 1;
_this.core.$outer.addClass('lg-zoomed'); }
} else {
_this.resetZoom(); zoom(scale);
} };
if (scale < 1) { var actualSize = function(event, $image, index, fromIcon) {
scale = 1; var w = $image.width();
} var nw;
if (_this.core.s.dynamic) {
zoom(scale); nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
}; } else {
nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
var actualSize = function(event, $image, index, fromIcon) { }
var w = $image.width();
var nw; var _scale;
if (_this.core.s.dynamic) {
nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w; if (_this.core.$outer.hasClass('lg-zoomed')) {
} else { scale = 1;
nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w; } else {
} if (nw > w) {
_scale = nw / w;
var _scale; scale = _scale || 2;
}
if (_this.core.$outer.hasClass('lg-zoomed')) { }
scale = 1;
} else { if (fromIcon) {
if (nw > w) { _this.pageX = $(window).width() / 2;
_scale = nw / w; _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
scale = _scale || 2; } else {
} _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
} _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
}
if (fromIcon) {
_this.pageX = $(window).width() / 2; callScale();
_this.pageY = ($(window).height() / 2) + $(window).scrollTop(); setTimeout(function() {
} else { _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
_this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX; }, 10);
_this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY; };
}
var tapped = false;
callScale();
setTimeout(function() { // event triggered after appending slide content
_this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
}, 10);
}; // Get the current element
var $image = _this.core.$slide.eq(index).find('.lg-image');
var tapped = false;
$image.on('dblclick', function(event) {
// event triggered after appending slide content actualSize(event, $image, index);
_this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) { });
// Get the current element $image.on('touchstart', function(event) {
var $image = _this.core.$slide.eq(index).find('.lg-image'); if (!tapped) {
tapped = setTimeout(function() {
$image.on('dblclick', function(event) { tapped = null;
actualSize(event, $image, index); }, 300);
}); } else {
clearTimeout(tapped);
$image.on('touchstart', function(event) { tapped = null;
if (!tapped) { actualSize(event, $image, index);
tapped = setTimeout(function() { }
tapped = null;
}, 300); event.preventDefault();
} else { });
clearTimeout(tapped);
tapped = null; });
actualSize(event, $image, index);
} // Update zoom on resize and orientationchange
$(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
event.preventDefault(); _this.pageX = $(window).width() / 2;
}); _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
zoom(scale);
}); });
// Update zoom on resize and orientationchange $('#lg-zoom-out').on('click.lg', function() {
$(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() { if (_this.core.$outer.find('.lg-current .lg-image').length) {
_this.pageX = $(window).width() / 2; scale -= _this.core.s.scale;
_this.pageY = ($(window).height() / 2) + $(window).scrollTop(); callScale();
zoom(scale); }
}); });
$('#lg-zoom-out').on('click.lg', function() { $('#lg-zoom-in').on('click.lg', function() {
if (_this.core.$outer.find('.lg-current .lg-image').length) { if (_this.core.$outer.find('.lg-current .lg-image').length) {
scale -= _this.core.s.scale; scale += _this.core.s.scale;
callScale(); callScale();
} }
}); });
$('#lg-zoom-in').on('click.lg', function() { $('#lg-actual-size').on('click.lg', function(event) {
if (_this.core.$outer.find('.lg-current .lg-image').length) { actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
scale += _this.core.s.scale; });
callScale();
} // Reset zoom on slide change
}); _this.core.$el.on('onBeforeSlide.lg.tm', function() {
scale = 1;
$('#lg-actual-size').on('click.lg', function(event) { _this.resetZoom();
actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true); });
});
// Drag option after zoom
// Reset zoom on slide change if (!_this.core.isTouch) {
_this.core.$el.on('onBeforeSlide.lg.tm', function() { _this.zoomDrag();
scale = 1; }
_this.resetZoom();
}); if (_this.core.isTouch) {
_this.zoomSwipe();
// Drag option after zoom }
if (!_this.core.isTouch) {
_this.zoomDrag(); }
}
// Reset zoom effect
if (_this.core.isTouch) { resetZoom() {
_this.zoomSwipe(); this.core.$outer.removeClass('lg-zoomed');
} this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
this.core.$slide.find('.lg-image').removeAttr('style data-scale');
};
// Reset pagx pagy values to center
// Reset zoom effect this.pageX = $(window).width() / 2;
Zoom.prototype.resetZoom = function() { this.pageY = ($(window).height() / 2) + $(window).scrollTop();
this.core.$outer.removeClass('lg-zoomed'); }
this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
this.core.$slide.find('.lg-image').removeAttr('style data-scale'); zoomSwipe() {
var _this = this;
// Reset pagx pagy values to center var startCoords = {};
this.pageX = $(window).width() / 2; var endCoords = {};
this.pageY = ($(window).height() / 2) + $(window).scrollTop(); var isMoved = false;
};
// Allow x direction drag
Zoom.prototype.zoomSwipe = function() { var allowX = false;
var _this = this;
var startCoords = {}; // Allow Y direction drag
var endCoords = {}; var allowY = false;
var isMoved = false;
_this.core.$slide.on('touchstart.lg', function(e) {
// Allow x direction drag
var allowX = false; if (_this.core.$outer.hasClass('lg-zoomed')) {
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
// Allow Y direction drag
var allowY = false; allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
_this.core.$slide.on('touchstart.lg', function(e) { if ((allowX || allowY)) {
e.preventDefault();
if (_this.core.$outer.hasClass('lg-zoomed')) { startCoords = {
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); x: e.originalEvent.targetTouches[0].pageX,
y: e.originalEvent.targetTouches[0].pageY
allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); };
allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); }
if ((allowX || allowY)) { }
e.preventDefault();
startCoords = { });
x: e.originalEvent.targetTouches[0].pageX,
y: e.originalEvent.targetTouches[0].pageY _this.core.$slide.on('touchmove.lg', function(e) {
};
} if (_this.core.$outer.hasClass('lg-zoomed')) {
}
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
}); var distanceX;
var distanceY;
_this.core.$slide.on('touchmove.lg', function(e) {
e.preventDefault();
if (_this.core.$outer.hasClass('lg-zoomed')) { isMoved = true;
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); endCoords = {
var distanceX; x: e.originalEvent.targetTouches[0].pageX,
var distanceY; y: e.originalEvent.targetTouches[0].pageY
};
e.preventDefault();
isMoved = true; // reset opacity and transition duration
_this.core.$outer.addClass('lg-zoom-dragging');
endCoords = {
x: e.originalEvent.targetTouches[0].pageX, if (allowY) {
y: e.originalEvent.targetTouches[0].pageY distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
}; } else {
distanceY = -Math.abs(_$el.attr('data-y'));
// reset opacity and transition duration }
_this.core.$outer.addClass('lg-zoom-dragging');
if (allowX) {
if (allowY) { distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); } else {
} else { distanceX = -Math.abs(_$el.attr('data-x'));
distanceY = -Math.abs(_$el.attr('data-y')); }
}
if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
if (allowX) { _$el.css({
distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); left: distanceX + 'px',
} else { top: distanceY + 'px'
distanceX = -Math.abs(_$el.attr('data-x')); });
} }
if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { }
_$el.css({
left: distanceX + 'px', });
top: distanceY + 'px'
}); _this.core.$slide.on('touchend.lg', function() {
} if (_this.core.$outer.hasClass('lg-zoomed')) {
if (isMoved) {
} isMoved = false;
_this.core.$outer.removeClass('lg-zoom-dragging');
}); _this.touchendZoom(startCoords, endCoords, allowX, allowY);
_this.core.$slide.on('touchend.lg', function() { }
if (_this.core.$outer.hasClass('lg-zoomed')) { }
if (isMoved) { });
isMoved = false;
_this.core.$outer.removeClass('lg-zoom-dragging'); }
_this.touchendZoom(startCoords, endCoords, allowX, allowY);
zoomDrag() {
}
} var _this = this;
}); var startCoords = {};
var endCoords = {};
}; var isDraging = false;
var isMoved = false;
Zoom.prototype.zoomDrag = function() {
// Allow x direction drag
var _this = this; var allowX = false;
var startCoords = {};
var endCoords = {}; // Allow Y direction drag
var isDraging = false; var allowY = false;
var isMoved = false;
_this.core.$slide.on('mousedown.lg.zoom', function(e) {
// Allow x direction drag
var allowX = false; // execute only on .lg-object
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
// Allow Y direction drag
var allowY = false; allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
_this.core.$slide.on('mousedown.lg.zoom', function(e) {
if (_this.core.$outer.hasClass('lg-zoomed')) {
// execute only on .lg-object if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); e.preventDefault();
startCoords = {
allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); x: e.pageX,
allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); y: e.pageY
};
if (_this.core.$outer.hasClass('lg-zoomed')) {
if ($(e.target).hasClass('lg-object') && (allowX || allowY)) { isDraging = true;
e.preventDefault();
startCoords = { // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
x: e.pageX, _this.core.$outer.scrollLeft += 1;
y: e.pageY _this.core.$outer.scrollLeft -= 1;
};
_this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
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; $(window).on('mousemove.lg.zoom', function(e) {
if (isDraging) {
_this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing'); var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
} var distanceX;
} var distanceY;
});
isMoved = true;
$(window).on('mousemove.lg.zoom', function(e) { endCoords = {
if (isDraging) { x: e.pageX,
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); y: e.pageY
var distanceX; };
var distanceY;
// reset opacity and transition duration
isMoved = true; _this.core.$outer.addClass('lg-zoom-dragging');
endCoords = {
x: e.pageX, if (allowY) {
y: e.pageY distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
}; } else {
distanceY = -Math.abs(_$el.attr('data-y'));
// reset opacity and transition duration }
_this.core.$outer.addClass('lg-zoom-dragging');
if (allowX) {
if (allowY) { distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); } else {
} else { distanceX = -Math.abs(_$el.attr('data-x'));
distanceY = -Math.abs(_$el.attr('data-y')); }
}
_$el.css({
if (allowX) { left: distanceX + 'px',
distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); top: distanceY + 'px'
} else { });
distanceX = -Math.abs(_$el.attr('data-x')); }
} }).on('mouseup.lg.zoom', function(e) {
_$el.css({ if (isDraging) {
left: distanceX + 'px', isDraging = false;
top: distanceY + 'px' _this.core.$outer.removeClass('lg-zoom-dragging');
});
} // Fix for chrome mouse move on click
}); if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
endCoords = {
$(window).on('mouseup.lg.zoom', function(e) { x: e.pageX,
y: e.pageY
if (isDraging) { };
isDraging = false; _this.touchendZoom(startCoords, endCoords, allowX, allowY);
_this.core.$outer.removeClass('lg-zoom-dragging');
}
// Fix for chrome mouse move on click
if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) { isMoved = false;
endCoords = { }
x: e.pageX,
y: e.pageY _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
};
_this.touchendZoom(startCoords, endCoords, allowX, allowY); });
}
}
touchendZoom(startCoords, endCoords, allowX, allowY) {
isMoved = false;
} var _this = this;
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
_this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
}); var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
}; var minY = (_this.core.$outer.find('.lg').height() - $image.outerHeight()) / 2;
var maxY = Math.abs(($image.outerHeight() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) { var minX = (_this.core.$outer.find('.lg').width() - $image.outerWidth()) / 2;
var maxX = Math.abs(($image.outerWidth() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
var _this = this;
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); if (allowY) {
var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); if (distanceY <= -maxY) {
var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); distanceY = -maxY;
var minY = (_this.core.$outer.find('.lg').height() - $image.outerHeight()) / 2; } else if (distanceY >= -minY) {
var maxY = Math.abs(($image.outerHeight() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY); distanceY = -minY;
var minX = (_this.core.$outer.find('.lg').width() - $image.outerWidth()) / 2; }
var maxX = Math.abs(($image.outerWidth() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX); }
if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { if (allowX) {
if (allowY) { if (distanceX <= -maxX) {
if (distanceY <= -maxY) { distanceX = -maxX;
distanceY = -maxY; } else if (distanceX >= -minX) {
} else if (distanceY >= -minY) { distanceX = -minX;
distanceY = -minY; }
} }
}
if (allowY) {
if (allowX) { _$el.attr('data-y', Math.abs(distanceY));
if (distanceX <= -maxX) { } else {
distanceX = -maxX; distanceY = -Math.abs(_$el.attr('data-y'));
} else if (distanceX >= -minX) { }
distanceX = -minX;
} if (allowX) {
} _$el.attr('data-x', Math.abs(distanceX));
} else {
if (allowY) { distanceX = -Math.abs(_$el.attr('data-x'));
_$el.attr('data-y', Math.abs(distanceY)); }
} else {
distanceY = -Math.abs(_$el.attr('data-y')); _$el.css({
} left: distanceX + 'px',
top: distanceY + 'px'
if (allowX) { });
_$el.attr('data-x', Math.abs(distanceX));
} else { }
distanceX = -Math.abs(_$el.attr('data-x')); }
}
destroy() {
_$el.css({
left: distanceX + 'px', var _this = this;
top: distanceY + 'px'
}); // Unbind all events added by lightGallery zoom plugin
_this.core.$el.off('.lg.zoom');
} $(window).off('.lg.zoom');
}; _this.core.$slide.off('.lg.zoom');
_this.core.$el.off('.lg.tm.zoom');
Zoom.prototype.destroy = function() { _this.resetZoom();
clearTimeout(_this.zoomabletimeout);
var _this = this; _this.zoomabletimeout = false;
}
// Unbind all events added by lightGallery zoom plugin }
_this.core.$el.off('.lg.zoom');
$(window).off('.lg.zoom');
_this.core.$slide.off('.lg.zoom');
_this.core.$el.off('.lg.tm.zoom');
_this.resetZoom();
clearTimeout(_this.zoomabletimeout);
_this.zoomabletimeout = false;
};
$.fn.lightGallery.modules.zoom = Zoom; $.fn.lightGallery.modules.zoom = Zoom;
})(jQuery, window, document); })(jQuery, window);

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

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -84,7 +84,6 @@ module.exports = function(publicPath, pro, mode) {
modules: [devPath, 'node_modules'], modules: [devPath, 'node_modules'],
extensions: ['.js'], extensions: ['.js'],
alias: { alias: {
'Opentip$': path.join(externalPathJoin, 'Opentip.js'),
'ko$': path.join(externalPathJoin, 'ko.js') 'ko$': path.join(externalPathJoin, 'ko.js')
} }
}, },

View file

@ -5107,16 +5107,6 @@ openpgp@2.6.2:
node-fetch "^1.3.3" node-fetch "^1.3.3"
node-localstorage "~1.3.0" node-localstorage "~1.3.0"
opentip@2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/opentip/-/opentip-2.4.3.tgz#2a3b500c2738f8069c33462ed48b5afe9ce804e6"
dependencies:
bean "0.x"
bonzo "1.x"
domready "0.x"
qwery "3.x"
reqwest "0.x"
optionator@^0.8.2: optionator@^0.8.2:
version "0.8.2" version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"