sigal 2.3__py3-none-any.whl → 2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sigal/__init__.py +2 -285
- sigal/__main__.py +312 -0
- sigal/gallery.py +188 -158
- sigal/image.py +113 -115
- sigal/log.py +11 -11
- sigal/plugins/adjust.py +4 -4
- sigal/plugins/compress_assets.py +26 -25
- sigal/plugins/copyright.py +8 -8
- sigal/plugins/encrypt/encrypt.py +7 -7
- sigal/plugins/encrypt/endec.py +2 -2
- sigal/plugins/extended_caching.py +26 -22
- sigal/plugins/feeds.py +19 -21
- sigal/plugins/media_page.py +1 -1
- sigal/plugins/nomedia.py +1 -1
- sigal/plugins/nonmedia_files.py +59 -93
- sigal/plugins/titleregexp.py +98 -0
- sigal/plugins/watermark.py +13 -13
- sigal/plugins/zip_gallery.py +17 -8
- sigal/settings.py +92 -78
- sigal/signals.py +10 -10
- sigal/templates/sigal.conf.py +18 -14
- sigal/themes/default/templates/decrypt.html +1 -0
- sigal/themes/default/templates/description.html +29 -0
- sigal/themes/default/templates/footer.html +3 -0
- sigal/themes/galleria/templates/album_items.html +4 -23
- sigal/themes/photoswipe/static/photoswipe-dynamic-caption-plugin.esm.js +414 -0
- sigal/themes/photoswipe/static/photoswipe-dynamic-caption-plugin.esm.min.js +5 -0
- sigal/themes/photoswipe/static/photoswipe-fullscreen.esm.js +129 -0
- sigal/themes/photoswipe/static/photoswipe-fullscreen.esm.min.js +8 -0
- sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js +1960 -0
- sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js.map +1 -0
- sigal/themes/photoswipe/static/photoswipe-lightbox.esm.min.js +5 -0
- sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.js +257 -0
- sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.min.js +1 -0
- sigal/themes/photoswipe/static/photoswipe.css +385 -140
- sigal/themes/photoswipe/static/photoswipe.esm.js +7081 -0
- sigal/themes/photoswipe/static/photoswipe.esm.js.map +1 -0
- sigal/themes/photoswipe/static/photoswipe.esm.min.js +5 -0
- sigal/themes/photoswipe/static/styles.css +53 -0
- sigal/themes/photoswipe/templates/album.html +69 -74
- sigal/utils.py +80 -12
- sigal/version.py +20 -4
- sigal/video.py +43 -24
- sigal/writer.py +26 -8
- {sigal-2.3.dist-info → sigal-2.5.dist-info}/LICENSE +1 -1
- {sigal-2.3.dist-info → sigal-2.5.dist-info}/METADATA +23 -30
- {sigal-2.3.dist-info → sigal-2.5.dist-info}/RECORD +50 -50
- {sigal-2.3.dist-info → sigal-2.5.dist-info}/WHEEL +1 -1
- sigal-2.5.dist-info/entry_points.txt +2 -0
- sigal/plugins/upload_s3.py +0 -106
- sigal/themes/photoswipe/static/app.js +0 -214
- sigal/themes/photoswipe/static/default-skin/default-skin.css +0 -485
- sigal/themes/photoswipe/static/default-skin/default-skin.css.map +0 -10
- sigal/themes/photoswipe/static/default-skin/default-skin.png +0 -0
- sigal/themes/photoswipe/static/default-skin/default-skin.svg +0 -36
- sigal/themes/photoswipe/static/default-skin/preloader.gif +0 -0
- sigal/themes/photoswipe/static/echo/blank.gif +0 -0
- sigal/themes/photoswipe/static/echo/echo.js +0 -135
- sigal/themes/photoswipe/static/echo/echo.min.js +0 -2
- sigal/themes/photoswipe/static/photoswipe-ui-default.js +0 -871
- sigal/themes/photoswipe/static/photoswipe-ui-default.min.js +0 -1
- sigal/themes/photoswipe/static/photoswipe.css.map +0 -10
- sigal/themes/photoswipe/static/photoswipe.js +0 -3592
- sigal/themes/photoswipe/static/photoswipe.min.js +0 -1
- sigal-2.3.dist-info/entry_points.txt +0 -2
- {sigal-2.3.dist-info → sigal-2.5.dist-info}/top_level.txt +0 -0
|
@@ -1,871 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* PhotoSwipe Default UI - 4.4.0 - 2020-12-06
|
|
3
|
-
* http://photoswipe.com
|
|
4
|
-
* Copyright (c) 2020 Dmitry Semenov;
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* UI on top of main sliding area (caption, arrows, close button, etc.).
|
|
10
|
-
* Built just using public methods/properties of PhotoSwipe.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
(function (root, factory) {
|
|
14
|
-
if (typeof define === 'function' && define.amd) {
|
|
15
|
-
define(factory);
|
|
16
|
-
} else if (typeof exports === 'object') {
|
|
17
|
-
module.exports = factory();
|
|
18
|
-
} else {
|
|
19
|
-
root.PhotoSwipeUI_Default = factory();
|
|
20
|
-
}
|
|
21
|
-
})(this, function () {
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
|
-
var PhotoSwipeUI_Default = function (pswp, framework) {
|
|
25
|
-
var ui = this;
|
|
26
|
-
var _overlayUIUpdated = false,
|
|
27
|
-
_controlsVisible = true,
|
|
28
|
-
_fullscrenAPI,
|
|
29
|
-
_stopAllAnimations,
|
|
30
|
-
_controls,
|
|
31
|
-
_captionContainer,
|
|
32
|
-
_fakeCaptionContainer,
|
|
33
|
-
_indexIndicator,
|
|
34
|
-
_prevButton,
|
|
35
|
-
_nextButton,
|
|
36
|
-
_shareButton,
|
|
37
|
-
_shareModal,
|
|
38
|
-
_shareModalHidden = true,
|
|
39
|
-
_downloadButton,
|
|
40
|
-
_initalCloseOnScrollValue,
|
|
41
|
-
_isIdle,
|
|
42
|
-
_listen,
|
|
43
|
-
_loadingIndicator,
|
|
44
|
-
_loadingIndicatorHidden,
|
|
45
|
-
_loadingIndicatorTimeout,
|
|
46
|
-
_galleryHasOneSlide,
|
|
47
|
-
_options,
|
|
48
|
-
_defaultUIOptions = {
|
|
49
|
-
barsSize: {top: 44, bottom: 'auto'},
|
|
50
|
-
closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'],
|
|
51
|
-
timeToIdle: 4000,
|
|
52
|
-
timeToIdleOutside: 1000,
|
|
53
|
-
loadingIndicatorDelay: 1000, // 2s
|
|
54
|
-
|
|
55
|
-
addCaptionHTMLFn: function (item, captionEl /*, isFake */) {
|
|
56
|
-
if (!item.title) {
|
|
57
|
-
framework.resetEl(captionEl.firstChild);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
captionEl.children[0].innerHTML = item.title;
|
|
61
|
-
return true;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
closeEl: true,
|
|
65
|
-
captionEl: true,
|
|
66
|
-
fullscreenEl: true,
|
|
67
|
-
zoomEl: true,
|
|
68
|
-
shareEl: true,
|
|
69
|
-
downloadEl: true,
|
|
70
|
-
counterEl: true,
|
|
71
|
-
arrowEl: true,
|
|
72
|
-
preloaderEl: true,
|
|
73
|
-
closeOnOutsideClick: true,
|
|
74
|
-
|
|
75
|
-
tapToClose: false,
|
|
76
|
-
tapToToggleControls: true,
|
|
77
|
-
|
|
78
|
-
clickToCloseNonZoomable: true,
|
|
79
|
-
clickToShowNextNonZoomable: false,
|
|
80
|
-
|
|
81
|
-
shareButtons: [
|
|
82
|
-
{id: 'facebook', label: 'Share on Facebook', url: 'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
|
|
83
|
-
{id: 'twitter', label: 'Tweet', url: 'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
|
|
84
|
-
{
|
|
85
|
-
id: 'pinterest',
|
|
86
|
-
label: 'Pin it',
|
|
87
|
-
url: 'http://www.pinterest.com/pin/create/button/' + '?url={{url}}&media={{image_url}}&description={{text}}'
|
|
88
|
-
},
|
|
89
|
-
{id: 'download', label: 'Download image', url: '{{raw_image_url}}', download: true}
|
|
90
|
-
],
|
|
91
|
-
getImageURLForShare: function (/* shareButtonData */) {
|
|
92
|
-
return pswp.currItem.src || '';
|
|
93
|
-
},
|
|
94
|
-
getPageURLForShare: function (/* shareButtonData */) {
|
|
95
|
-
return window.location.href;
|
|
96
|
-
},
|
|
97
|
-
getTextForShare: function (/* shareButtonData */) {
|
|
98
|
-
return pswp.currItem.title || '';
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
indexIndicatorSep: ' / ',
|
|
102
|
-
fitControlsWidth: 1200
|
|
103
|
-
},
|
|
104
|
-
_blockControlsTap,
|
|
105
|
-
_blockControlsTapTimeout;
|
|
106
|
-
|
|
107
|
-
var _onControlsTap = function (e) {
|
|
108
|
-
if (_blockControlsTap) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
e = e || window.event;
|
|
113
|
-
|
|
114
|
-
if (_options.timeToIdle && _options.mouseUsed && !_isIdle) {
|
|
115
|
-
// reset idle timer
|
|
116
|
-
_onIdleMouseMove();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
var target = e.target || e.srcElement,
|
|
120
|
-
uiElement,
|
|
121
|
-
clickedClass = target.getAttribute('class') || '',
|
|
122
|
-
found;
|
|
123
|
-
|
|
124
|
-
for (var i = 0; i < _uiElements.length; i++) {
|
|
125
|
-
uiElement = _uiElements[i];
|
|
126
|
-
if (uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name) > -1) {
|
|
127
|
-
uiElement.onTap();
|
|
128
|
-
found = true;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (found) {
|
|
133
|
-
if (e.stopPropagation) {
|
|
134
|
-
e.stopPropagation();
|
|
135
|
-
}
|
|
136
|
-
_blockControlsTap = true;
|
|
137
|
-
|
|
138
|
-
// Some versions of Android don't prevent ghost click event
|
|
139
|
-
// when preventDefault() was called on touchstart and/or touchend.
|
|
140
|
-
//
|
|
141
|
-
// This happens on v4.3, 4.2, 4.1,
|
|
142
|
-
// older versions strangely work correctly,
|
|
143
|
-
// but just in case we add delay on all of them)
|
|
144
|
-
var tapDelay = framework.features.isOldAndroid ? 600 : 30;
|
|
145
|
-
_blockControlsTapTimeout = setTimeout(function () {
|
|
146
|
-
_blockControlsTap = false;
|
|
147
|
-
}, tapDelay);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
_fitControlsInViewport = function () {
|
|
151
|
-
return !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth;
|
|
152
|
-
},
|
|
153
|
-
_togglePswpClass = function (el, cName, add) {
|
|
154
|
-
framework[(add ? 'add' : 'remove') + 'Class'](el, 'pswp__' + cName);
|
|
155
|
-
},
|
|
156
|
-
// add class when there is just one item in the gallery
|
|
157
|
-
// (by default it hides left/right arrows and 1ofX counter)
|
|
158
|
-
_countNumItems = function () {
|
|
159
|
-
var hasOneSlide = _options.getNumItemsFn() === 1;
|
|
160
|
-
|
|
161
|
-
if (hasOneSlide !== _galleryHasOneSlide) {
|
|
162
|
-
_togglePswpClass(_controls, 'ui--one-slide', hasOneSlide);
|
|
163
|
-
_galleryHasOneSlide = hasOneSlide;
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
_downloadFile = function () {
|
|
167
|
-
var link = document.createElement('A');
|
|
168
|
-
link.setAttribute('href', pswp.currItem.downloadURL || pswp.currItem.src || '');
|
|
169
|
-
link.setAttribute('target', '_blank');
|
|
170
|
-
link.setAttribute('download', '');
|
|
171
|
-
|
|
172
|
-
_downloadButton.appendChild(link);
|
|
173
|
-
link.click();
|
|
174
|
-
_downloadButton.removeChild(link);
|
|
175
|
-
},
|
|
176
|
-
_toggleShareModalClass = function () {
|
|
177
|
-
_togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden);
|
|
178
|
-
},
|
|
179
|
-
_toggleShareModal = function () {
|
|
180
|
-
_shareModalHidden = !_shareModalHidden;
|
|
181
|
-
|
|
182
|
-
if (!_shareModalHidden) {
|
|
183
|
-
_toggleShareModalClass();
|
|
184
|
-
setTimeout(function () {
|
|
185
|
-
if (!_shareModalHidden) {
|
|
186
|
-
framework.addClass(_shareModal, 'pswp__share-modal--fade-in');
|
|
187
|
-
}
|
|
188
|
-
}, 30);
|
|
189
|
-
} else {
|
|
190
|
-
framework.removeClass(_shareModal, 'pswp__share-modal--fade-in');
|
|
191
|
-
setTimeout(function () {
|
|
192
|
-
if (_shareModalHidden) {
|
|
193
|
-
_toggleShareModalClass();
|
|
194
|
-
}
|
|
195
|
-
}, 300);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (!_shareModalHidden) {
|
|
199
|
-
_updateShareURLs();
|
|
200
|
-
}
|
|
201
|
-
return false;
|
|
202
|
-
},
|
|
203
|
-
_openWindowPopup = function (e) {
|
|
204
|
-
e = e || window.event;
|
|
205
|
-
var target = e.target || e.srcElement;
|
|
206
|
-
|
|
207
|
-
pswp.shout('shareLinkClick', e, target);
|
|
208
|
-
|
|
209
|
-
if (!target.href) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (target.hasAttribute('download')) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
window.open(
|
|
218
|
-
target.href,
|
|
219
|
-
'pswp_share',
|
|
220
|
-
'scrollbars=yes,resizable=yes,toolbar=no,' +
|
|
221
|
-
'location=yes,width=550,height=420,top=100,left=' +
|
|
222
|
-
(window.screen ? Math.round(screen.width / 2 - 275) : 100)
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
if (!_shareModalHidden) {
|
|
226
|
-
_toggleShareModal();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return false;
|
|
230
|
-
},
|
|
231
|
-
_updateShareURLs = function () {
|
|
232
|
-
var shareButtonOut = '',
|
|
233
|
-
shareButtonData,
|
|
234
|
-
shareURL,
|
|
235
|
-
image_url,
|
|
236
|
-
page_url,
|
|
237
|
-
share_text;
|
|
238
|
-
|
|
239
|
-
for (var i = 0; i < _options.shareButtons.length; i++) {
|
|
240
|
-
shareButtonData = _options.shareButtons[i];
|
|
241
|
-
|
|
242
|
-
image_url = _options.getImageURLForShare(shareButtonData);
|
|
243
|
-
page_url = _options.getPageURLForShare(shareButtonData);
|
|
244
|
-
share_text = _options.getTextForShare(shareButtonData);
|
|
245
|
-
|
|
246
|
-
shareURL = shareButtonData.url
|
|
247
|
-
.replace('{{url}}', encodeURIComponent(page_url))
|
|
248
|
-
.replace('{{image_url}}', encodeURIComponent(image_url))
|
|
249
|
-
.replace('{{raw_image_url}}', image_url)
|
|
250
|
-
.replace('{{text}}', encodeURIComponent(share_text));
|
|
251
|
-
|
|
252
|
-
shareButtonOut +=
|
|
253
|
-
'<a href="' +
|
|
254
|
-
shareURL +
|
|
255
|
-
'" target="_blank" ' +
|
|
256
|
-
'class="pswp__share--' +
|
|
257
|
-
shareButtonData.id +
|
|
258
|
-
'"' +
|
|
259
|
-
(shareButtonData.download ? 'download' : '') +
|
|
260
|
-
'>' +
|
|
261
|
-
shareButtonData.label +
|
|
262
|
-
'</a>';
|
|
263
|
-
|
|
264
|
-
if (_options.parseShareButtonOut) {
|
|
265
|
-
shareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
_shareModal.children[0].innerHTML = shareButtonOut;
|
|
269
|
-
_shareModal.children[0].onclick = _openWindowPopup;
|
|
270
|
-
},
|
|
271
|
-
_hasCloseClass = function (target) {
|
|
272
|
-
for (var i = 0; i < _options.closeElClasses.length; i++) {
|
|
273
|
-
if (framework.hasClass(target, 'pswp__' + _options.closeElClasses[i])) {
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
_idleInterval,
|
|
279
|
-
_idleTimer,
|
|
280
|
-
_idleIncrement = 0,
|
|
281
|
-
_onIdleMouseMove = function () {
|
|
282
|
-
clearTimeout(_idleTimer);
|
|
283
|
-
_idleIncrement = 0;
|
|
284
|
-
if (_isIdle) {
|
|
285
|
-
ui.setIdle(false);
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
_onMouseLeaveWindow = function (e) {
|
|
289
|
-
e = e ? e : window.event;
|
|
290
|
-
var from = e.relatedTarget || e.toElement;
|
|
291
|
-
if (!from || from.nodeName === 'HTML') {
|
|
292
|
-
clearTimeout(_idleTimer);
|
|
293
|
-
_idleTimer = setTimeout(function () {
|
|
294
|
-
ui.setIdle(true);
|
|
295
|
-
}, _options.timeToIdleOutside);
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
_setupFullscreenAPI = function () {
|
|
299
|
-
if (_options.fullscreenEl && !framework.features.isOldAndroid) {
|
|
300
|
-
if (!_fullscrenAPI) {
|
|
301
|
-
_fullscrenAPI = ui.getFullscreenAPI();
|
|
302
|
-
}
|
|
303
|
-
if (_fullscrenAPI) {
|
|
304
|
-
framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
|
305
|
-
ui.updateFullscreen();
|
|
306
|
-
framework.addClass(pswp.template, 'pswp--supports-fs');
|
|
307
|
-
} else {
|
|
308
|
-
framework.removeClass(pswp.template, 'pswp--supports-fs');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
_setupLoadingIndicator = function () {
|
|
313
|
-
// Setup loading indicator
|
|
314
|
-
if (_options.preloaderEl) {
|
|
315
|
-
_toggleLoadingIndicator(true);
|
|
316
|
-
|
|
317
|
-
_listen('beforeChange', function () {
|
|
318
|
-
clearTimeout(_loadingIndicatorTimeout);
|
|
319
|
-
|
|
320
|
-
// display loading indicator with delay
|
|
321
|
-
_loadingIndicatorTimeout = setTimeout(function () {
|
|
322
|
-
if (pswp.currItem && pswp.currItem.loading) {
|
|
323
|
-
if (!pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth)) {
|
|
324
|
-
// show preloader if progressive loading is not enabled,
|
|
325
|
-
// or image width is not defined yet (because of slow connection)
|
|
326
|
-
_toggleLoadingIndicator(false);
|
|
327
|
-
// items-controller.js function allowProgressiveImg
|
|
328
|
-
}
|
|
329
|
-
} else {
|
|
330
|
-
_toggleLoadingIndicator(true); // hide preloader
|
|
331
|
-
}
|
|
332
|
-
}, _options.loadingIndicatorDelay);
|
|
333
|
-
});
|
|
334
|
-
_listen('imageLoadComplete', function (index, item) {
|
|
335
|
-
if (pswp.currItem === item) {
|
|
336
|
-
_toggleLoadingIndicator(true);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
_toggleLoadingIndicator = function (hide) {
|
|
342
|
-
if (_loadingIndicatorHidden !== hide) {
|
|
343
|
-
_togglePswpClass(_loadingIndicator, 'preloader--active', !hide);
|
|
344
|
-
_loadingIndicatorHidden = hide;
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
_applyNavBarGaps = function (item) {
|
|
348
|
-
var gap = item.vGap;
|
|
349
|
-
var bars = _options.barsSize;
|
|
350
|
-
|
|
351
|
-
if (_fitControlsInViewport()) {
|
|
352
|
-
if (_options.captionEl && bars.bottom === 'auto') {
|
|
353
|
-
if (!_fakeCaptionContainer) {
|
|
354
|
-
_fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake');
|
|
355
|
-
_fakeCaptionContainer.appendChild(framework.createEl('pswp__caption__center'));
|
|
356
|
-
_controls.insertBefore(_fakeCaptionContainer, _captionContainer);
|
|
357
|
-
framework.addClass(_controls, 'pswp__ui--fit');
|
|
358
|
-
}
|
|
359
|
-
if (_options.addCaptionHTMLFn(item, _fakeCaptionContainer, true)) {
|
|
360
|
-
var captionSize = _fakeCaptionContainer.clientHeight;
|
|
361
|
-
gap.bottom = parseInt(captionSize, 10) || 44;
|
|
362
|
-
} else {
|
|
363
|
-
gap.bottom = bars.top; // if no caption, set size of bottom gap to size of top
|
|
364
|
-
}
|
|
365
|
-
} else {
|
|
366
|
-
gap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// height of top bar is static, no need to calculate it
|
|
370
|
-
gap.top = bars.top;
|
|
371
|
-
} else {
|
|
372
|
-
gap.top = gap.bottom = 0;
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
_setupIdle = function () {
|
|
376
|
-
// Hide controls when mouse is used
|
|
377
|
-
if (_options.timeToIdle) {
|
|
378
|
-
_listen('mouseUsed', function () {
|
|
379
|
-
framework.bind(document, 'mousemove', _onIdleMouseMove);
|
|
380
|
-
framework.bind(document, 'mouseout', _onMouseLeaveWindow);
|
|
381
|
-
|
|
382
|
-
_idleInterval = setInterval(function () {
|
|
383
|
-
_idleIncrement++;
|
|
384
|
-
if (_idleIncrement === 2) {
|
|
385
|
-
ui.setIdle(true);
|
|
386
|
-
}
|
|
387
|
-
}, _options.timeToIdle / 2);
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
_setupHidingControlsDuringGestures = function () {
|
|
392
|
-
// Hide controls on vertical drag
|
|
393
|
-
_listen('onVerticalDrag', function (now) {
|
|
394
|
-
if (_controlsVisible && now < 0.95) {
|
|
395
|
-
ui.hideControls();
|
|
396
|
-
} else if (!_controlsVisible && now >= 0.95) {
|
|
397
|
-
ui.showControls();
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
// Hide controls when pinching to close
|
|
402
|
-
var pinchControlsHidden;
|
|
403
|
-
_listen('onPinchClose', function (now) {
|
|
404
|
-
if (_controlsVisible && now < 0.9) {
|
|
405
|
-
ui.hideControls();
|
|
406
|
-
pinchControlsHidden = true;
|
|
407
|
-
} else if (pinchControlsHidden && !_controlsVisible && now > 0.9) {
|
|
408
|
-
ui.showControls();
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
_listen('zoomGestureEnded', function () {
|
|
413
|
-
pinchControlsHidden = false;
|
|
414
|
-
if (pinchControlsHidden && !_controlsVisible) {
|
|
415
|
-
ui.showControls();
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
var _uiElements = [
|
|
421
|
-
{
|
|
422
|
-
name: 'caption',
|
|
423
|
-
option: 'captionEl',
|
|
424
|
-
onInit: function (el) {
|
|
425
|
-
_captionContainer = el;
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: 'share-modal',
|
|
430
|
-
option: 'shareEl',
|
|
431
|
-
onInit: function (el) {
|
|
432
|
-
_shareModal = el;
|
|
433
|
-
},
|
|
434
|
-
onTap: function () {
|
|
435
|
-
_toggleShareModal();
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
name: 'button--share',
|
|
440
|
-
option: 'shareEl',
|
|
441
|
-
onInit: function (el) {
|
|
442
|
-
_shareButton = el;
|
|
443
|
-
},
|
|
444
|
-
onTap: function () {
|
|
445
|
-
_toggleShareModal();
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
name: 'button--download',
|
|
450
|
-
option: 'downloadEl',
|
|
451
|
-
onInit: function (el) {
|
|
452
|
-
_downloadButton = el;
|
|
453
|
-
},
|
|
454
|
-
onTap: _downloadFile
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
name: 'button--zoom',
|
|
458
|
-
option: 'zoomEl',
|
|
459
|
-
onTap: pswp.toggleDesktopZoom
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
name: 'counter',
|
|
463
|
-
option: 'counterEl',
|
|
464
|
-
onInit: function (el) {
|
|
465
|
-
_indexIndicator = el;
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
name: 'button--close',
|
|
470
|
-
option: 'closeEl',
|
|
471
|
-
onTap: function () {
|
|
472
|
-
setTimeout(pswp.close);
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
name: 'button--arrow--left',
|
|
477
|
-
option: 'arrowEl',
|
|
478
|
-
onInit: function (el) {
|
|
479
|
-
_prevButton = el;
|
|
480
|
-
},
|
|
481
|
-
onTap: pswp.prev
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: 'button--arrow--right',
|
|
485
|
-
option: 'arrowEl',
|
|
486
|
-
onInit: function (el) {
|
|
487
|
-
_nextButton = el;
|
|
488
|
-
},
|
|
489
|
-
onTap: pswp.next
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
name: 'button--fs',
|
|
493
|
-
option: 'fullscreenEl',
|
|
494
|
-
onTap: function () {
|
|
495
|
-
if (_fullscrenAPI.isFullscreen()) {
|
|
496
|
-
_fullscrenAPI.exit();
|
|
497
|
-
} else {
|
|
498
|
-
_fullscrenAPI.enter();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
name: 'preloader',
|
|
504
|
-
option: 'preloaderEl',
|
|
505
|
-
onInit: function (el) {
|
|
506
|
-
_loadingIndicator = el;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
];
|
|
510
|
-
|
|
511
|
-
var _setupUIElements = function () {
|
|
512
|
-
var item, classAttr, uiElement;
|
|
513
|
-
|
|
514
|
-
var loopThroughChildElements = function (sChildren) {
|
|
515
|
-
if (!sChildren) {
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
var l = sChildren.length;
|
|
520
|
-
for (var i = 0; i < l; i++) {
|
|
521
|
-
item = sChildren[i];
|
|
522
|
-
classAttr = item.className;
|
|
523
|
-
|
|
524
|
-
for (var a = 0; a < _uiElements.length; a++) {
|
|
525
|
-
uiElement = _uiElements[a];
|
|
526
|
-
|
|
527
|
-
if (classAttr.indexOf('pswp__' + uiElement.name) > -1) {
|
|
528
|
-
if (_options[uiElement.option]) {
|
|
529
|
-
// if element is not disabled from options
|
|
530
|
-
|
|
531
|
-
framework.removeClass(item, 'pswp__element--disabled');
|
|
532
|
-
if (uiElement.onInit) {
|
|
533
|
-
uiElement.onInit(item);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
//item.style.display = 'block';
|
|
537
|
-
} else {
|
|
538
|
-
framework.addClass(item, 'pswp__element--disabled');
|
|
539
|
-
//item.style.display = 'none';
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
loopThroughChildElements(_controls.children);
|
|
546
|
-
|
|
547
|
-
var topBar = framework.getChildByClass(_controls, 'pswp__top-bar');
|
|
548
|
-
if (topBar) {
|
|
549
|
-
loopThroughChildElements(topBar.children);
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
ui.init = function () {
|
|
554
|
-
// extend options
|
|
555
|
-
framework.extend(pswp.options, _defaultUIOptions, true);
|
|
556
|
-
|
|
557
|
-
// create local link for fast access
|
|
558
|
-
_options = pswp.options;
|
|
559
|
-
|
|
560
|
-
// find pswp__ui element
|
|
561
|
-
_controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui');
|
|
562
|
-
|
|
563
|
-
// create local link
|
|
564
|
-
_listen = pswp.listen;
|
|
565
|
-
|
|
566
|
-
_setupHidingControlsDuringGestures();
|
|
567
|
-
|
|
568
|
-
// update controls when slides change
|
|
569
|
-
_listen('beforeChange', ui.update);
|
|
570
|
-
|
|
571
|
-
// toggle zoom on double-tap
|
|
572
|
-
_listen('doubleTap', function (point) {
|
|
573
|
-
var initialZoomLevel = pswp.currItem.initialZoomLevel;
|
|
574
|
-
if (pswp.getZoomLevel() !== initialZoomLevel) {
|
|
575
|
-
pswp.zoomTo(initialZoomLevel, point, 333);
|
|
576
|
-
} else {
|
|
577
|
-
pswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333);
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
// Allow text selection in caption
|
|
582
|
-
_listen('preventDragEvent', function (e, isDown, preventObj) {
|
|
583
|
-
var t = e.target || e.srcElement;
|
|
584
|
-
if (
|
|
585
|
-
t &&
|
|
586
|
-
t.nodeType === 1 &&
|
|
587
|
-
t.getAttribute('class') &&
|
|
588
|
-
e.type.indexOf('mouse') > -1 &&
|
|
589
|
-
(t.getAttribute('class').indexOf('__caption') > 0 || /(SMALL|STRONG|EM)/i.test(t.tagName))
|
|
590
|
-
) {
|
|
591
|
-
preventObj.prevent = false;
|
|
592
|
-
_stopAllAnimations();
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
// bind events for UI
|
|
597
|
-
_listen('bindEvents', function () {
|
|
598
|
-
framework.bind(_controls, 'pswpTap click', _onControlsTap);
|
|
599
|
-
framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
|
600
|
-
|
|
601
|
-
if (!pswp.likelyTouchDevice) {
|
|
602
|
-
framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
// unbind events for UI
|
|
607
|
-
_listen('unbindEvents', function () {
|
|
608
|
-
if (!_shareModalHidden) {
|
|
609
|
-
_toggleShareModal();
|
|
610
|
-
}
|
|
611
|
-
if (_idleInterval) {
|
|
612
|
-
clearInterval(_idleInterval);
|
|
613
|
-
}
|
|
614
|
-
framework.unbind(document, 'mouseout', _onMouseLeaveWindow);
|
|
615
|
-
framework.unbind(document, 'mousemove', _onIdleMouseMove);
|
|
616
|
-
framework.unbind(_controls, 'pswpTap click', _onControlsTap);
|
|
617
|
-
framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);
|
|
618
|
-
framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
|
|
619
|
-
|
|
620
|
-
if (_fullscrenAPI) {
|
|
621
|
-
framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen);
|
|
622
|
-
if (_fullscrenAPI.isFullscreen()) {
|
|
623
|
-
_options.hideAnimationDuration = 0;
|
|
624
|
-
_fullscrenAPI.exit();
|
|
625
|
-
}
|
|
626
|
-
_fullscrenAPI = null;
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
// clean up things when gallery is destroyed
|
|
631
|
-
_listen('destroy', function () {
|
|
632
|
-
if (_options.captionEl) {
|
|
633
|
-
if (_fakeCaptionContainer) {
|
|
634
|
-
_controls.removeChild(_fakeCaptionContainer);
|
|
635
|
-
}
|
|
636
|
-
framework.removeClass(_captionContainer, 'pswp__caption--empty');
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
if (_shareModal) {
|
|
640
|
-
_shareModal.children[0].onclick = null;
|
|
641
|
-
}
|
|
642
|
-
framework.removeClass(_controls, 'pswp__ui--over-close');
|
|
643
|
-
framework.addClass(_controls, 'pswp__ui--hidden');
|
|
644
|
-
ui.setIdle(false);
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
if (!_options.showAnimationDuration) {
|
|
648
|
-
framework.removeClass(_controls, 'pswp__ui--hidden');
|
|
649
|
-
}
|
|
650
|
-
_listen('initialZoomIn', function () {
|
|
651
|
-
if (_options.showAnimationDuration) {
|
|
652
|
-
framework.removeClass(_controls, 'pswp__ui--hidden');
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
_listen('initialZoomOut', function () {
|
|
656
|
-
framework.addClass(_controls, 'pswp__ui--hidden');
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
_listen('parseVerticalMargin', _applyNavBarGaps);
|
|
660
|
-
|
|
661
|
-
_setupUIElements();
|
|
662
|
-
|
|
663
|
-
if (_options.shareEl && _shareButton && _shareModal) {
|
|
664
|
-
_shareModalHidden = true;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
_countNumItems();
|
|
668
|
-
|
|
669
|
-
_setupIdle();
|
|
670
|
-
|
|
671
|
-
_setupFullscreenAPI();
|
|
672
|
-
|
|
673
|
-
_setupLoadingIndicator();
|
|
674
|
-
};
|
|
675
|
-
|
|
676
|
-
ui.setIdle = function (isIdle) {
|
|
677
|
-
_isIdle = isIdle;
|
|
678
|
-
_togglePswpClass(_controls, 'ui--idle', isIdle);
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
ui.update = function () {
|
|
682
|
-
// Don't update UI if it's hidden
|
|
683
|
-
if (_controlsVisible && pswp.currItem) {
|
|
684
|
-
ui.updateIndexIndicator();
|
|
685
|
-
|
|
686
|
-
if (_options.captionEl) {
|
|
687
|
-
var captionExists = _options.addCaptionHTMLFn(pswp.currItem, _captionContainer);
|
|
688
|
-
|
|
689
|
-
_togglePswpClass(_captionContainer, 'caption--empty', !captionExists);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
_overlayUIUpdated = true;
|
|
693
|
-
} else {
|
|
694
|
-
_overlayUIUpdated = false;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
if (!_shareModalHidden) {
|
|
698
|
-
_toggleShareModal();
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
_countNumItems();
|
|
702
|
-
};
|
|
703
|
-
|
|
704
|
-
ui.updateFullscreen = function (e) {
|
|
705
|
-
if (e) {
|
|
706
|
-
// some browsers change window scroll position during the fullscreen
|
|
707
|
-
// so PhotoSwipe updates it just in case
|
|
708
|
-
setTimeout(function () {
|
|
709
|
-
pswp.setScrollOffset(0, framework.getScrollY());
|
|
710
|
-
}, 50);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
// toogle pswp--fs class on root element
|
|
714
|
-
framework[(_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class'](pswp.template, 'pswp--fs');
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
ui.updateIndexIndicator = function () {
|
|
718
|
-
if (_options.counterEl) {
|
|
719
|
-
_indexIndicator.innerHTML = pswp.getCurrentIndex() + 1 + _options.indexIndicatorSep + _options.getNumItemsFn();
|
|
720
|
-
}
|
|
721
|
-
if (!_options.loop) {
|
|
722
|
-
if (pswp.getCurrentIndex() === 0) {
|
|
723
|
-
framework.addClass(_prevButton, 'pswp__element--disabled');
|
|
724
|
-
} else {
|
|
725
|
-
framework.removeClass(_prevButton, 'pswp__element--disabled');
|
|
726
|
-
}
|
|
727
|
-
if (pswp.getCurrentIndex() === _options.getNumItemsFn() - 1) {
|
|
728
|
-
framework.addClass(_nextButton, 'pswp__element--disabled');
|
|
729
|
-
} else {
|
|
730
|
-
framework.removeClass(_nextButton, 'pswp__element--disabled');
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
ui.onGlobalTap = function (e) {
|
|
736
|
-
e = e || window.event;
|
|
737
|
-
var target = e.target || e.srcElement;
|
|
738
|
-
|
|
739
|
-
if (_blockControlsTap) {
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
if (e.detail && e.detail.pointerType === 'mouse') {
|
|
744
|
-
// Silently ignore right-click events.
|
|
745
|
-
if (!e.detail.rightClick) {
|
|
746
|
-
// close gallery if clicked outside of the image
|
|
747
|
-
if (_options.closeOnOutsideClick && _hasCloseClass(target)) {
|
|
748
|
-
pswp.close();
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
if (framework.hasClass(target, 'pswp__img')) {
|
|
753
|
-
if (pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
|
|
754
|
-
if (_options.clickToCloseNonZoomable) {
|
|
755
|
-
pswp.close();
|
|
756
|
-
} else if (_options.clickToShowNextNonZoomable) {
|
|
757
|
-
pswp.next();
|
|
758
|
-
}
|
|
759
|
-
} else {
|
|
760
|
-
pswp.toggleDesktopZoom(e.detail.releasePoint);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
} else {
|
|
765
|
-
// tap anywhere (except buttons) to toggle visibility of controls
|
|
766
|
-
if (_options.tapToToggleControls) {
|
|
767
|
-
if (_controlsVisible) {
|
|
768
|
-
ui.hideControls();
|
|
769
|
-
} else {
|
|
770
|
-
ui.showControls();
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// tap to close gallery
|
|
775
|
-
if (
|
|
776
|
-
_options.tapToClose &&
|
|
777
|
-
(framework.hasClass(target, 'pswp__img') || (_options.closeOnOutsideClick && _hasCloseClass(target)))
|
|
778
|
-
) {
|
|
779
|
-
pswp.close();
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
ui.onMouseOver = function (e) {
|
|
785
|
-
e = e || window.event;
|
|
786
|
-
var target = e.target || e.srcElement;
|
|
787
|
-
|
|
788
|
-
// add class when mouse is over an element that should close the gallery
|
|
789
|
-
_togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target));
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
ui.hideControls = function () {
|
|
793
|
-
framework.addClass(_controls, 'pswp__ui--hidden');
|
|
794
|
-
_controlsVisible = false;
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
ui.showControls = function () {
|
|
798
|
-
_controlsVisible = true;
|
|
799
|
-
if (!_overlayUIUpdated) {
|
|
800
|
-
ui.update();
|
|
801
|
-
}
|
|
802
|
-
framework.removeClass(_controls, 'pswp__ui--hidden');
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
ui.supportsFullscreen = function () {
|
|
806
|
-
var d = document;
|
|
807
|
-
return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen);
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
ui.getFullscreenAPI = function () {
|
|
811
|
-
var dE = document.documentElement,
|
|
812
|
-
api,
|
|
813
|
-
tF = 'fullscreenchange';
|
|
814
|
-
|
|
815
|
-
if (dE.requestFullscreen) {
|
|
816
|
-
api = {
|
|
817
|
-
enterK: 'requestFullscreen',
|
|
818
|
-
exitK: 'exitFullscreen',
|
|
819
|
-
elementK: 'fullscreenElement',
|
|
820
|
-
eventK: tF
|
|
821
|
-
};
|
|
822
|
-
} else if (dE.mozRequestFullScreen) {
|
|
823
|
-
api = {
|
|
824
|
-
enterK: 'mozRequestFullScreen',
|
|
825
|
-
exitK: 'mozCancelFullScreen',
|
|
826
|
-
elementK: 'mozFullScreenElement',
|
|
827
|
-
eventK: 'moz' + tF
|
|
828
|
-
};
|
|
829
|
-
} else if (dE.webkitRequestFullscreen) {
|
|
830
|
-
api = {
|
|
831
|
-
enterK: 'webkitRequestFullscreen',
|
|
832
|
-
exitK: 'webkitExitFullscreen',
|
|
833
|
-
elementK: 'webkitFullscreenElement',
|
|
834
|
-
eventK: 'webkit' + tF
|
|
835
|
-
};
|
|
836
|
-
} else if (dE.msRequestFullscreen) {
|
|
837
|
-
api = {
|
|
838
|
-
enterK: 'msRequestFullscreen',
|
|
839
|
-
exitK: 'msExitFullscreen',
|
|
840
|
-
elementK: 'msFullscreenElement',
|
|
841
|
-
eventK: 'MSFullscreenChange'
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
if (api) {
|
|
846
|
-
api.enter = function () {
|
|
847
|
-
// disable close-on-scroll in fullscreen
|
|
848
|
-
_initalCloseOnScrollValue = _options.closeOnScroll;
|
|
849
|
-
_options.closeOnScroll = false;
|
|
850
|
-
|
|
851
|
-
if (this.enterK === 'webkitRequestFullscreen') {
|
|
852
|
-
pswp.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT);
|
|
853
|
-
} else {
|
|
854
|
-
return pswp.template[this.enterK]();
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
api.exit = function () {
|
|
858
|
-
_options.closeOnScroll = _initalCloseOnScrollValue;
|
|
859
|
-
|
|
860
|
-
return document[this.exitK]();
|
|
861
|
-
};
|
|
862
|
-
api.isFullscreen = function () {
|
|
863
|
-
return document[this.elementK];
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
return api;
|
|
868
|
-
};
|
|
869
|
-
};
|
|
870
|
-
return PhotoSwipeUI_Default;
|
|
871
|
-
});
|