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 matchmedia-polyfill
* Removed momentjs (localization still used)
* Removed opentip (use CSS)
|js/* |1.14.0 |native |gzip 1.14 |gzip |
|----------- |--------: |--------: |--------: |--------: |
|admin.js |2.130.942 |1.130.247 | 485.481 | 273.277 |
|app.js |4.184.455 |2.840.968 | 932.725 | 662.061 |
|admin.js |2.130.942 |1.119.116 | 485.481 | 270.646 |
|app.js |4.184.455 |2.829.860 | 932.725 | 659.501 |
|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 |
|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 |
|--------------- |--------: |--------: |--------: |--------: |
|admin.min.js | 252.147 | 152.759 | 73.657 | 43.564 |
|app.min.js | 511.202 | 378.335 |140.462 | 99.341 |
|admin.min.js | 252.147 | 151.264 | 73.657 | 43.122 |
|app.min.js | 511.202 | 376.839 |140.462 | 98.898 |
|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 |
|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 |
|-------------- |--------: |--------: |
|app.css | 340.334 | 272.858 |
|app.min.css | 274.791 | 216.893 |
|app.css | 340.334 | 267.507 |
|app.min.css | 274.791 | 212.244 |
### 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 };

128
dev/External/ko.js vendored
View file

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

View file

@ -23,42 +23,54 @@
opacity: 0;
}
.opentip-container {
z-index: 2001 !important;
.ot-content {
[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;
}
@media only screen and (max-width: 600px) {
[data-rainloopTip]::before,
[data-rainloopErrorTip]::before {
min-width: 60vw;
white-space: normal;
}
&.style-rainloopErrorTip .ot-content {
}
[data-rainloopErrorTip]::before {
color: red;
}
&.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;
}
}
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 {

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",
"normalize.css": "8.0.1",
"openpgp": "2.6.2",
"opentip": "2.4.3",
"prettier": "1.19.1",
"raw-loader": "4.0.0",
"rimraf": "3.0.2",

View file

@ -55,7 +55,6 @@ config.paths.css = {
'vendors/fontastic/styles.css',
'vendors/inputosaurus/inputosaurus.css',
'vendors/flags/flags-fixed.css',
'node_modules/opentip/css/opentip.css',
'vendors/lightgallery/dist/css/lightgallery.min.css',
'vendors/lightgallery/dist/css/lg-transitions.min.css',
'dev/Styles/_progressjs.css'
@ -86,8 +85,6 @@ config.paths.js = {
'node_modules/knockout-sortable/build/knockout-sortable.min.js ',
'node_modules/simplestatemanager/dist/ssm.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/lg-fullscreen.min.js',
'vendors/lightgallery/dist/js/lg-thumbnail.min.js',

View file

@ -90,7 +90,7 @@
$items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
if ($items.length) {
index = $items.index($items.filter(':focus'))
@ -102,6 +102,7 @@
.eq(index)
.focus()
}
}
}
@ -199,7 +200,7 @@
that.enforceFocus()
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')
})
@ -231,7 +232,7 @@
enforceFocus () {
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) {
that.$element.focus()
}
@ -241,9 +242,7 @@
escape () {
var that = this
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
this.$element.on('keyup.dismiss.modal', e => e.which == 27 && that.hide())
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.modal')
}
@ -251,12 +250,12 @@
hideWithTransition () {
var that = this
, timeout = setTimeout(function () {
, timeout = setTimeout(() => {
that.$element.off('transitionend')
that.hideModal()
}, 500)
this.$element.one('transitionend', function () {
this.$element.one('transitionend', () => {
clearTimeout(timeout)
that.hideModal()
})
@ -265,7 +264,7 @@
hideModal () {
var that = this
this.$element.hide()
this.backdrop(function () {
this.backdrop(() => {
that.removeBackdrop()
that.$element.trigger('hidden')
})
@ -347,9 +346,7 @@
$target
.modal(option)
.one('hide', function () {
$this.focus()
})
.one('hide', () => $this.focus())
})
/* TAB CLASS DEFINITION
@ -452,4 +449,4 @@
$(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",
fakeSpan: $('<span class="inputosaurus-fake-span"></span>'),
eventprefix: "inputosaurus",
$('body').append(fakeSpan);
$.widget("ui.inputosaurus", {
options: {
@ -259,10 +256,10 @@
// the input dynamically resizes based on the length of its value
_resizeInput : function(ev) {
var widget = (ev && ev.data.widget) || this;
inputosaurustext.fakeSpan.text(widget.elements.input.val());
fakeSpan.text(widget.elements.input.val());
// setTimeout(function () {
var txtWidth = 25 + inputosaurustext.fakeSpan.width();
var txtWidth = 25 + fakeSpan.width();
txtWidth = txtWidth > 50 ? txtWidth : 50;
txtWidth = txtWidth < 500 ? txtWidth : 500;
widget.elements.input.width(txtWidth);
@ -637,10 +634,7 @@
els.ul.replaceWith(this.element);
}
}
};
$('body').append(inputosaurustext.fakeSpan);
$.widget("ui.inputosaurus", inputosaurustext);
});
})(jQuery);

View file

@ -149,7 +149,7 @@
});
// 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 _MODIFIERS) assignKey[k] = false;
});

View file

@ -8,7 +8,7 @@
* @license MIT License (MIT)
*/
(function($, window, document, undefined) {
($ => {
'use strict';
@ -25,7 +25,10 @@
* Creates the autoplay plugin.
* @param {object} element - lightGallery element
*/
var Autoplay = function(element) {
class Autoplay
{
constructor(element) {
this.core = $(element).data('lightGallery');
@ -56,9 +59,9 @@
this.init();
return this;
};
}
Autoplay.prototype.init = function() {
init() {
var _this = this;
// append autoplay controls
@ -80,7 +83,7 @@
}
// cancel interval on touchstart and dragstart
_this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() {
_this.$el.on('onDragstart.lg.tm touchstart.lg.tm', () => {
if (_this.interval) {
_this.cancelAuto();
_this.canceledOnTouch = true;
@ -88,22 +91,22 @@
});
// restore autoplay if autoplay canceled from touchstart / dragstart
_this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() {
_this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', () => {
if (!_this.interval && _this.canceledOnTouch) {
_this.startlAuto();
_this.canceledOnTouch = false;
}
});
};
}
Autoplay.prototype.progress = function() {
progress() {
var _this = this;
var _$progressBar;
var _$progress;
_this.$el.on('onBeforeSlide.lg.tm', function() {
_this.$el.on('onBeforeSlide.lg.tm', () => {
// start progress bar animation
if (_this.core.s.progressBar && _this.fromAuto) {
@ -112,7 +115,7 @@
if (_this.interval) {
_$progress.removeAttr('style');
_$progressBar.removeClass('lg-start');
setTimeout(function() {
setTimeout(() => {
_$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s');
_$progressBar.addClass('lg-start');
}, 20);
@ -127,17 +130,17 @@
_this.fromAuto = false;
});
};
}
// Manage autoplay via play/stop buttons
Autoplay.prototype.controls = function() {
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', function() {
_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;
@ -148,17 +151,17 @@
}
}
});
};
}
// Autostart gallery
Autoplay.prototype.startlAuto = function() {
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(function() {
_this.interval = setInterval(() => {
if (_this.core.index + 1 < _this.core.$items.length) {
_this.core.index++;
} else {
@ -168,23 +171,24 @@
_this.fromAuto = true;
_this.core.slide(_this.core.index, false, false);
}, _this.core.s.speed + _this.core.s.pause);
};
}
// cancel Autostart
Autoplay.prototype.cancelAuto = function() {
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');
};
}
Autoplay.prototype.destroy = function() {
destroy() {
this.cancelAuto();
this.core.$outer.find('.lg-progress-bar').remove();
};
}
}
$.fn.lightGallery.modules.autoplay = Autoplay;
})(jQuery, window, document);
})(jQuery);

View file

@ -1,4 +1,4 @@
/*! 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={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
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {
(($, document) => {
'use strict';
@ -9,7 +9,9 @@
fullScreen: true
};
var Fullscreen = function(element) {
class Fullscreen
{
constructor(element) {
// get lightGallery core plugin data
this.core = $(element).data('lightGallery');
@ -22,9 +24,9 @@
this.init();
return this;
};
}
Fullscreen.prototype.init = function() {
init() {
var fullScreen = '';
if (this.core.s.fullScreen) {
@ -38,9 +40,9 @@
this.fullScreen();
}
}
};
}
Fullscreen.prototype.requestFullscreen = function() {
requestFullscreen() {
var el = document.documentElement;
if (el.requestFullscreen) {
el.requestFullscreen();
@ -51,9 +53,9 @@
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen();
}
};
}
Fullscreen.prototype.exitFullscreen = function() {
exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
@ -63,17 +65,17 @@
} 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() {
fullScreen() {
var _this = this;
$(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() {
_this.core.$outer.toggleClass('lg-fullscreen-on');
});
$(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', () =>
_this.core.$outer.toggleClass('lg-fullscreen-on')
);
this.core.$outer.find('.lg-fullscreen').on('click.lg', function() {
this.core.$outer.find('.lg-fullscreen').on('click.lg', () => {
if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
_this.requestFullscreen();
@ -82,16 +84,17 @@
}
});
};
}
Fullscreen.prototype.destroy = function() {
destroy() {
// exit from fullscreen if activated
this.exitFullscreen();
$(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg');
};
}
}
$.fn.lightGallery.modules.fullscreen = Fullscreen;
})(jQuery, window, document);
})(jQuery, document);

View file

@ -1,4 +1,4 @@
/*! 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={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
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {
(($, window) => {
'use strict';
@ -33,7 +33,9 @@
loadDailymotionThumbnail: true
};
var Thumbnail = function(element) {
class Thumbnail
{
constructor(element) {
// get lightGallery core plugin data
this.core = $(element).data('lightGallery');
@ -53,9 +55,9 @@
this.init();
return this;
};
}
Thumbnail.prototype.init = function() {
init() {
var _this = this;
if (this.core.s.thumbnail && this.core.$items.length > 1) {
if (this.core.s.showThumbByDefault) {
@ -86,9 +88,9 @@
this.toogle();
this.thumbkeyPress();
}
};
}
Thumbnail.prototype.build = function() {
build() {
var _this = this;
var thumbList = '';
var vimeoErrorThumbSize = '';
@ -226,16 +228,16 @@
}, 200);
});
};
}
Thumbnail.prototype.setTranslate = function(value) {
setTranslate(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) {
animateThumb(index) {
var $thumb = this.core.$outer.find('.lg-thumb');
if (this.core.s.animateThumb) {
var position;
@ -277,10 +279,10 @@
this.setTranslate(this.left);
}
};
}
// Enable thumbnail dragging and swiping
Thumbnail.prototype.enableThumbDrag = function() {
enableThumbDrag() {
var _this = this;
var startCoords = 0;
@ -330,9 +332,7 @@
_this.setTranslate(tempLeft);
}
});
$(window).on('mouseup.lg.thumb', function() {
}).on('mouseup.lg.thumb', function() {
if (isMoved) {
isMoved = false;
_this.$thumbOuter.removeClass('lg-dragging');
@ -353,9 +353,9 @@
}
});
};
}
Thumbnail.prototype.enableThumbSwipe = function() {
enableThumbSwipe() {
var _this = this;
var startCoords = 0;
var endCoords = 0;
@ -415,9 +415,9 @@
}
});
};
}
Thumbnail.prototype.toogle = function() {
toogle() {
var _this = this;
if (_this.core.s.toogleThumb) {
_this.core.$outer.addClass('lg-can-toggle');
@ -426,9 +426,9 @@
_this.core.$outer.toggleClass('lg-thumb-open');
});
}
};
}
Thumbnail.prototype.thumbkeyPress = function() {
thumbkeyPress() {
var _this = this;
$(window).on('keydown.lg.thumb', function(e) {
if (e.keyCode === 38) {
@ -439,16 +439,17 @@
_this.core.$outer.removeClass('lg-thumb-open');
}
});
};
}
Thumbnail.prototype.destroy = function() {
destroy() {
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;
})(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
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {
(($, window) => {
'use strict';
@ -12,7 +12,9 @@
enableZoomAfter: 300
};
var Zoom = function(element) {
class Zoom
{
constructor(element) {
this.core = $(element).data('lightGallery');
@ -30,9 +32,9 @@
}
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>';
@ -212,10 +214,10 @@
_this.zoomSwipe();
}
};
}
// Reset zoom effect
Zoom.prototype.resetZoom = function() {
resetZoom() {
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');
@ -223,9 +225,9 @@
// Reset pagx pagy values to center
this.pageX = $(window).width() / 2;
this.pageY = ($(window).height() / 2) + $(window).scrollTop();
};
}
Zoom.prototype.zoomSwipe = function() {
zoomSwipe() {
var _this = this;
var startCoords = {};
var endCoords = {};
@ -308,9 +310,9 @@
}
});
};
}
Zoom.prototype.zoomDrag = function() {
zoomDrag() {
var _this = this;
var startCoords = {};
@ -383,9 +385,7 @@
top: distanceY + 'px'
});
}
});
$(window).on('mouseup.lg.zoom', function(e) {
}).on('mouseup.lg.zoom', function(e) {
if (isDraging) {
isDraging = false;
@ -407,9 +407,9 @@
_this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
});
};
}
Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
touchendZoom(startCoords, endCoords, allowX, allowY) {
var _this = this;
var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
@ -456,9 +456,9 @@
});
}
};
}
Zoom.prototype.destroy = function() {
destroy() {
var _this = this;
@ -470,8 +470,9 @@
_this.resetZoom();
clearTimeout(_this.zoomabletimeout);
_this.zoomabletimeout = false;
};
}
}
$.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

View file

@ -1,7 +1,7 @@
/*! 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) {
(($, window) => {
'use strict';
@ -74,7 +74,9 @@
galleryId: 1
};
function Plugin(element, options) {
class Plugin
{
constructor(element, options) {
// Current lightGallery element
this.el = element;
@ -137,7 +139,7 @@
return this;
}
Plugin.prototype.init = function() {
init() {
var _this = this;
@ -147,14 +149,14 @@
}
// if dynamic option is enabled execute immediately
var _hash = window.location.hash;
var _hash = location.hash;
if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {
_this.index = parseInt(_hash.split('&slide=')[1], 10);
$('body').addClass('lg-from-hash');
if (!$('body').hasClass('lg-on')) {
setTimeout(function() {
setTimeout(() => {
_this.build(_this.index);
$('body').addClass('lg-on');
});
@ -169,7 +171,7 @@
// prevent accidental double execution
if (!$('body').hasClass('lg-on')) {
setTimeout(function() {
setTimeout(() => {
_this.build(_this.index);
$('body').addClass('lg-on');
});
@ -193,18 +195,18 @@
});
}
};
}
Plugin.prototype.build = function(index) {
build(index) {
var _this = this;
_this.structure();
// module constructor
$.each($.fn.lightGallery.modules, function(key) {
_this.modules[key] = new $.fn.lightGallery.modules[key](_this.el);
});
$.each($.fn.lightGallery.modules, key =>
_this.modules[key] = new $.fn.lightGallery.modules[key](_this.el)
);
// initiate slide function
_this.slide(index, false, false);
@ -217,7 +219,7 @@
_this.arrow();
setTimeout(function() {
setTimeout(() => {
_this.enableDrag();
_this.enableSwipe();
}, 50);
@ -234,22 +236,22 @@
_this.$el.trigger('onAfterOpen.lg');
// Hide controllers if mouse doesn't move for some period
_this.$outer.on('mousemove.lg click.lg touchstart.lg', function() {
_this.$outer.on('mousemove.lg click.lg touchstart.lg', () => {
_this.$outer.removeClass('lg-hide-items');
clearTimeout(_this.hideBartimeout);
// Timeout will be cleared on each slide movement also
_this.hideBartimeout = setTimeout(function() {
_this.$outer.addClass('lg-hide-items');
}, _this.s.hideBarsDelay);
_this.hideBartimeout = setTimeout(() =>
_this.$outer.addClass('lg-hide-items')
, _this.s.hideBarsDelay);
});
};
}
Plugin.prototype.structure = function() {
structure() {
var list = '';
var controls = '';
var i = 0;
@ -303,11 +305,9 @@
// For fixed height gallery
_this.setTop();
$(window).on('resize.lg orientationchange.lg', function() {
setTimeout(function() {
_this.setTop();
}, 100);
});
$(window).on('resize.lg orientationchange.lg', () =>
setTimeout(() => _this.setTop(), 100)
);
// add class lg-current to remove initial transition
this.$slide.eq(this.index).addClass('lg-current');
@ -340,9 +340,7 @@
$('.lg-backdrop').addClass('in');
setTimeout(function() {
_this.$outer.addClass('lg-visible');
}, this.s.backdropDuration);
setTimeout(() => _this.$outer.addClass('lg-visible'), this.s.backdropDuration);
if (this.s.download) {
this.$outer.find('.lg-toolbar').append('<a id="lg-download" target="_blank" download class="lg-download lg-icon"></a>');
@ -351,10 +349,10 @@
// Store the current scroll top value to scroll back after closing the gallery..
this.prevScrollTop = $(window).scrollTop();
};
}
// For fixed height gallery
Plugin.prototype.setTop = function() {
setTop() {
if (this.s.height !== '100%') {
var wH = $(window).height();
var top = (wH - parseInt(this.s.height, 10)) / 2;
@ -365,36 +363,17 @@
$lGallery.css('top', '0px');
}
}
};
}
// Find css3 support
Plugin.prototype.doCss = function() {
// check for css animation support
var support = function() {
var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
var root = document.documentElement;
var i = 0;
for (i = 0; i < transition.length; i++) {
if (transition[i] in root.style) {
return true;
}
}
};
if (support()) {
return true;
}
return false;
};
doCss() { return true; }
/**
* @desc Check the given src is video
* @param {String} src
* @return {Object} video type
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
*/
Plugin.prototype.isVideo = function(src, index) {
isVideo(src, index) {
var html;
if (this.s.dynamic) {
@ -408,46 +387,23 @@
html5: true
};
}
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i);
var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i);
var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i);
var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i);
if (youtube) {
return {
youtube: youtube
};
} else if (vimeo) {
return {
vimeo: vimeo
};
} else if (dailymotion) {
return {
dailymotion: dailymotion
};
} else if (vk) {
return {
vk: vk
};
}
};
/**
* @desc Create image counter
* Ex: 1/10
*/
Plugin.prototype.counter = function() {
counter() {
if (this.s.counter) {
$(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>');
}
};
}
/**
* @desc add sub-html into the slide
* @param {Number} index - index of the slide
*/
Plugin.prototype.addHtml = function(index) {
addHtml(index) {
var subHtml = null;
var subHtmlUrl;
var $currentEle;
@ -514,13 +470,13 @@
}
this.$el.trigger('onAfterAppendSubHtml.lg', [index]);
};
}
/**
* @desc Preload slides
* @param {Number} index - index of the slide
*/
Plugin.prototype.preload = function(index) {
preload(index) {
var i = 1;
var j = 1;
for (i = 1; i <= this.s.preload; i++) {
@ -538,7 +494,7 @@
this.loadContent(index - j, false, 0);
}
};
}
/**
* @desc Load slide content into slide.
@ -546,7 +502,7 @@
* @param {Boolean} rec - if true call loadcontent() function again.
* @param {Boolean} delay - delay for adding complete class. it is 0 except first time.
*/
Plugin.prototype.loadContent = function(index, rec, delay) {
loadContent(index, rec, delay) {
var _this = this;
var _hasPoster = false;
@ -556,7 +512,7 @@
var _srcset;
var _sizes;
var _html;
var getResponsiveSrc = function(srcItms) {
var getResponsiveSrc = srcItms => {
var rsWidth = [];
var rsSrc = [];
for (var i = 0; i < srcItms.length; i++) {
@ -636,17 +592,7 @@
if (iframe) {
_this.$slide.eq(index).prepend('<div class="lg-video-cont" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '" allowfullscreen="true"></iframe></div></div>');
} else if (_hasPoster) {
var videoClass = '';
if (_isVideo && _isVideo.youtube) {
videoClass = 'lg-has-youtube';
} else if (_isVideo && _isVideo.vimeo) {
videoClass = 'lg-has-vimeo';
} else {
videoClass = 'lg-has-html5';
}
_this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
_this.$slide.eq(index).prepend('<div class="lg-video-cont lg-has-html5"><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" /></div></div>');
} else if (_isVideo) {
_this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>');
_this.$el.trigger('hasVideo.lg', [index, _src, _html]);
@ -663,13 +609,6 @@
if (_srcset) {
_$img.attr('srcset', _srcset);
try {
picturefill({
elements: [_$img[0]]
});
} catch (e) {
console.error('Make sure you have included Picturefill version 2');
}
}
if (this.s.appendSubHtmlTo !== '.lg-sub-html') {
@ -679,7 +618,7 @@
_this.$slide.eq(index).addClass('lg-loaded');
}
_this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
_this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', () => {
// For first time add some delay for displaying the start animation.
var _speed = 0;
@ -690,7 +629,7 @@
_speed = delay;
}
setTimeout(function() {
setTimeout(() => {
_this.$slide.eq(index).addClass('lg-complete');
_this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]);
}, _speed);
@ -704,16 +643,16 @@
if (rec === true) {
if (!_this.$slide.eq(index).hasClass('lg-complete')) {
_this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() {
_this.preload(index);
});
_this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', () =>
_this.preload(index)
);
} else {
_this.preload(index);
}
}
//}
};
}
/**
* @desc slide function for lightgallery
@ -735,7 +674,7 @@
* @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
* @param {Boolean} fromThumb - true if slide function called via thumbnail click
*/
Plugin.prototype.slide = function(index, fromTouch, fromThumb) {
slide(index, fromTouch, fromThumb) {
var _prevIndex = this.$outer.find('.lg-current').index();
var _this = this;
@ -780,9 +719,7 @@
if (this.s.appendSubHtmlTo === '.lg-sub-html') {
// wait for slide animation to complete
setTimeout(function() {
_this.addHtml(index);
}, _time);
setTimeout(() => _this.addHtml(index), _time);
}
this.arrowDisable(index);
@ -821,7 +758,7 @@
}
// give 50 ms for browser to add/remove class
setTimeout(function() {
setTimeout(() => {
_this.$slide.removeClass('lg-current');
//_this.$slide.eq(_prevIndex).removeClass('lg-current');
@ -854,11 +791,9 @@
}
if (_this.lGalleryOn) {
setTimeout(function() {
_this.loadContent(index, true, 0);
}, this.s.speed + 50);
setTimeout(() => _this.loadContent(index, true, 0), this.s.speed + 50);
setTimeout(function() {
setTimeout(() => {
_this.lgBusy = false;
_this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]);
}, this.s.speed);
@ -878,13 +813,13 @@
}
};
}
/**
* @desc Go to next slide
* @param {Boolean} fromTouch - true if slide function called via touch event
*/
Plugin.prototype.goToNextSlide = function(fromTouch) {
goToNextSlide(fromTouch) {
var _this = this;
if (!_this.lgBusy) {
if ((_this.index + 1) < _this.$slide.length) {
@ -898,19 +833,17 @@
_this.slide(_this.index, fromTouch, false);
} else if (_this.s.slideEndAnimatoin) {
_this.$outer.addClass('lg-right-end');
setTimeout(function() {
_this.$outer.removeClass('lg-right-end');
}, 400);
setTimeout(() => _this.$outer.removeClass('lg-right-end'), 400);
}
}
}
}
};
/**
* @desc Go to previous slide
* @param {Boolean} fromTouch - true if slide function called via touch event
*/
Plugin.prototype.goToPrevSlide = function(fromTouch) {
goToPrevSlide(fromTouch) {
var _this = this;
if (!_this.lgBusy) {
if (_this.index > 0) {
@ -924,18 +857,16 @@
_this.slide(_this.index, fromTouch, false);
} else if (_this.s.slideEndAnimatoin) {
_this.$outer.addClass('lg-left-end');
setTimeout(function() {
_this.$outer.removeClass('lg-left-end');
}, 400);
setTimeout(() =>_this.$outer.removeClass('lg-left-end'), 400);
}
}
}
}
};
Plugin.prototype.keyPress = function() {
keyPress() {
var _this = this;
if (this.$items.length > 1) {
$(window).on('keyup.lg', function(e) {
$(window).on('keyup.lg', e => {
if (_this.$items.length > 1) {
if (e.keyCode === 37) {
e.preventDefault();
@ -950,7 +881,7 @@
});
}
$(window).on('keydown.lg', function(e) {
$(window).on('keydown.lg', e => {
if (_this.s.escKey === true && e.keyCode === 27) {
e.preventDefault();
if (!_this.$outer.hasClass('lg-thumb-open')) {
@ -960,20 +891,16 @@
}
}
});
};
}
Plugin.prototype.arrow = function() {
arrow() {
var _this = this;
this.$outer.find('.lg-prev').on('click.lg', function() {
_this.goToPrevSlide();
});
this.$outer.find('.lg-prev').on('click.lg', () => _this.goToPrevSlide());
this.$outer.find('.lg-next').on('click.lg', function() {
_this.goToNextSlide();
});
};
this.$outer.find('.lg-next').on('click.lg', () => _this.goToNextSlide());
}
Plugin.prototype.arrowDisable = function(index) {
arrowDisable(index) {
// Disable arrows if s.hideControlOnEnd is true
if (!this.s.loop && this.s.hideControlOnEnd) {
@ -989,9 +916,9 @@
this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled');
}
}
};
}
Plugin.prototype.setTranslate = function($el, xValue, yValue) {
setTranslate($el, xValue, yValue) {
// jQuery supports Automatic CSS prefixing since jQuery 1.8.0
if (this.s.useLeft) {
$el.css('left', xValue);
@ -1000,9 +927,9 @@
transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)'
});
}
};
}
Plugin.prototype.touchMove = function(startCoords, endCoords) {
touchMove(startCoords, endCoords) {
var distance = endCoords - startCoords;
@ -1017,9 +944,9 @@
this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0);
this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0);
}
};
}
Plugin.prototype.touchEnd = function(distance) {
touchEnd(distance) {
var _this = this;
// keep slide animation for any mode while dragg/swipe
@ -1030,7 +957,7 @@
this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0');
// set transition duration
setTimeout(function() {
setTimeout(() => {
_this.$outer.removeClass('lg-dragging');
if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) {
_this.goToNextSlide(true);
@ -1046,15 +973,15 @@
});
// remove slide class once drag/swipe is completed if mode is not slide
setTimeout(function() {
setTimeout(() => {
if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') {
_this.$outer.removeClass('lg-slide');
}
}, _this.s.speed + 100);
};
}
Plugin.prototype.enableSwipe = function() {
enableSwipe() {
var _this = this;
var startCoords = 0;
var endCoords = 0;
@ -1062,24 +989,20 @@
if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) {
_this.$slide.on('touchstart.lg', function(e) {
_this.$slide.on('touchstart.lg', e => {
if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) {
e.preventDefault();
_this.manageSwipeClass();
startCoords = e.originalEvent.targetTouches[0].pageX;
}
});
_this.$slide.on('touchmove.lg', function(e) {
}).on('touchmove.lg', e => {
if (!_this.$outer.hasClass('lg-zoomed')) {
e.preventDefault();
endCoords = e.originalEvent.targetTouches[0].pageX;
_this.touchMove(startCoords, endCoords);
isMoved = true;
}
});
_this.$slide.on('touchend.lg', function() {
}).on('touchend.lg', () => {
if (!_this.$outer.hasClass('lg-zoomed')) {
if (isMoved) {
isMoved = false;
@ -1091,16 +1014,16 @@
});
}
};
}
Plugin.prototype.enableDrag = function() {
enableDrag() {
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isDraging = false;
var isMoved = false;
if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) {
_this.$slide.on('mousedown.lg', function(e) {
_this.$slide.on('mousedown.lg', e => {
// execute only on .lg-object
if (!_this.$outer.hasClass('lg-zoomed')) {
if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) {
@ -1126,16 +1049,14 @@
}
});
$(window).on('mousemove.lg', function(e) {
$(window).on('mousemove.lg', e => {
if (isDraging) {
isMoved = true;
endCoords = e.pageX;
_this.touchMove(startCoords, endCoords);
_this.$el.trigger('onDragmove.lg');
}
});
$(window).on('mouseup.lg', function(e) {
}).on('mouseup.lg', e => {
if (isMoved) {
isMoved = false;
_this.touchEnd(endCoords - startCoords);
@ -1152,9 +1073,9 @@
});
}
};
}
Plugin.prototype.manageSwipeClass = function() {
manageSwipeClass() {
var touchNext = this.index + 1;
var touchPrev = this.index - 1;
var length = this.$slide.length;
@ -1172,16 +1093,14 @@
}
this.$slide.eq(touchNext).addClass('lg-next-slide');
};
Plugin.prototype.mousewheel = function() {
var _this = this;
_this.$outer.on('mousewheel.lg', function(e) {
if (!e.deltaY) {
return;
}
mousewheel() {
var _this = this;
_this.$outer.on('mousewheel.lg', e => {
if (e.deltaY) {
if (e.deltaY > 0) {
_this.goToPrevSlide();
} else {
@ -1189,23 +1108,22 @@
}
e.preventDefault();
}
});
};
}
Plugin.prototype.closeGallery = function() {
closeGallery() {
var _this = this;
var mousedown = false;
this.$outer.find('.lg-close').on('click.lg', function() {
_this.destroy();
});
this.$outer.find('.lg-close').on('click.lg', () => _this.destroy());
if (_this.s.closable) {
// If you drag the slide and release outside gallery gets close on chrome
// for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
_this.$outer.on('mousedown.lg', function(e) {
_this.$outer.on('mousedown.lg', e => {
if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) {
mousedown = true;
@ -1215,7 +1133,7 @@
});
_this.$outer.on('mouseup.lg', function(e) {
_this.$outer.on('mouseup.lg', e => {
if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) {
if (!_this.$outer.hasClass('lg-dragging')) {
@ -1227,9 +1145,9 @@
}
};
}
Plugin.prototype.destroy = function(d) {
destroy(d) {
var _this = this;
@ -1259,7 +1177,7 @@
this.$el.off('.lg.tm');
// Distroy all lightGallery modules
$.each($.fn.lightGallery.modules, function(key) {
$.each($.fn.lightGallery.modules, key => {
if (_this.modules[key]) {
_this.modules[key].destroy();
}
@ -1278,7 +1196,7 @@
$('.lg-backdrop').removeClass('in');
setTimeout(function() {
setTimeout(() => {
if (_this.$outer) {
_this.$outer.remove();
}
@ -1290,7 +1208,8 @@
}
}, _this.s.backdropDuration + 50);
};
}
}
$.fn.lightGallery = function(options) {
return this.each(function() {
@ -1308,4 +1227,4 @@
$.fn.lightGallery.modules = {};
})(jQuery, window, document);
})(jQuery, window);

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'],
extensions: ['.js'],
alias: {
'Opentip$': path.join(externalPathJoin, 'Opentip.js'),
'ko$': path.join(externalPathJoin, 'ko.js')
}
},

View file

@ -5107,16 +5107,6 @@ openpgp@2.6.2:
node-fetch "^1.3.3"
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:
version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"