lightbox2 2.11.0 → 2.11.1
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.
- checksums.yaml +4 -4
- data/vendor/assets/javascripts/lightbox2.js +43 -19
- data/vendor/assets/stylesheets/lightbox2.scss +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d1c9036da5b0dc4f331f06473332644fb7134b7318146bd7681d192af5b3edb
|
4
|
+
data.tar.gz: d7ef64516cefd783dac0cc0e9df25cc7a8d737ef63b6086ec5ff883c2c696d89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67bb2182d2c63b13230749dc4453bb2d0aed0a9e06847cdcc9a20fde32afb8c3377c89ebc3d7a5186fe9cce2f4c38e281f34a1755db07c796a6e4227957cd9d2
|
7
|
+
data.tar.gz: 3d2242f3fceda6c5830ac3887f0ffd9da8aa4903b058bfede8736406e62930120b626fec3e09388196b79439b4446cb3629c110b3c91acc2e59ecfc6e7a58b08
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Lightbox v2.11.
|
2
|
+
* Lightbox v2.11.1
|
3
3
|
* by Lokesh Dhakar
|
4
4
|
*
|
5
5
|
* More info:
|
@@ -99,7 +99,19 @@
|
|
99
99
|
}
|
100
100
|
|
101
101
|
var self = this;
|
102
|
-
|
102
|
+
|
103
|
+
// The two root notes generated, #lightboxOverlay and #lightbox are given
|
104
|
+
// tabindex attrs so they are focusable. We attach our keyboard event
|
105
|
+
// listeners to these two elements, and not the document. Clicking anywhere
|
106
|
+
// while Lightbox is opened will keep the focus on or inside one of these
|
107
|
+
// two elements.
|
108
|
+
//
|
109
|
+
// We do this so we can prevent propogation of the Esc keypress when
|
110
|
+
// Lightbox is open. This prevents it from intefering with other components
|
111
|
+
// on the page below.
|
112
|
+
//
|
113
|
+
// Github issue: https://github.com/lokesh/lightbox2/issues/663
|
114
|
+
$('<div id="lightboxOverlay" tabindex="-1" class="lightboxOverlay"></div><div id="lightbox" tabindex="-1" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/><div class="lb-nav"><a class="lb-prev" aria-label="Previous image" href="" ></a><a class="lb-next" aria-label="Next image" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
|
103
115
|
|
104
116
|
// Cache jQuery objects
|
105
117
|
this.$lightbox = $('#lightbox');
|
@@ -323,24 +335,28 @@
|
|
323
335
|
if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
|
324
336
|
maxImageWidth = self.options.maxWidth;
|
325
337
|
}
|
326
|
-
if (self.options.maxHeight && self.options.maxHeight <
|
338
|
+
if (self.options.maxHeight && self.options.maxHeight < maxImageHeight) {
|
327
339
|
maxImageHeight = self.options.maxHeight;
|
328
340
|
}
|
329
341
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
342
|
+
} else {
|
343
|
+
maxImageWidth = self.options.maxWidth || preloader.width || maxImageWidth;
|
344
|
+
maxImageHeight = self.options.maxHeight || preloader.height || maxImageHeight;
|
345
|
+
}
|
346
|
+
|
347
|
+
// Is the current image's width or height is greater than the maxImageWidth or maxImageHeight
|
348
|
+
// option than we need to size down while maintaining the aspect ratio.
|
349
|
+
if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
|
350
|
+
if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
|
351
|
+
imageWidth = maxImageWidth;
|
352
|
+
imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
|
353
|
+
$image.width(imageWidth);
|
354
|
+
$image.height(imageHeight);
|
355
|
+
} else {
|
356
|
+
imageHeight = maxImageHeight;
|
357
|
+
imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
|
358
|
+
$image.width(imageWidth);
|
359
|
+
$image.height(imageHeight);
|
344
360
|
}
|
345
361
|
}
|
346
362
|
self.sizeContainer($image.width(), $image.height());
|
@@ -383,6 +399,10 @@
|
|
383
399
|
self.$lightbox.find('.lb-dataContainer').width(newWidth);
|
384
400
|
self.$lightbox.find('.lb-prevLink').height(newHeight);
|
385
401
|
self.$lightbox.find('.lb-nextLink').height(newHeight);
|
402
|
+
|
403
|
+
// Set focus on one of the two root nodes so keyboard events are captured.
|
404
|
+
self.$overlay.focus();
|
405
|
+
|
386
406
|
self.showImage();
|
387
407
|
}
|
388
408
|
|
@@ -489,11 +509,13 @@
|
|
489
509
|
};
|
490
510
|
|
491
511
|
Lightbox.prototype.enableKeyboardNav = function() {
|
492
|
-
|
512
|
+
this.$lightbox.on('keyup.keyboard', $.proxy(this.keyboardAction, this));
|
513
|
+
this.$overlay.on('keyup.keyboard', $.proxy(this.keyboardAction, this));
|
493
514
|
};
|
494
515
|
|
495
516
|
Lightbox.prototype.disableKeyboardNav = function() {
|
496
|
-
|
517
|
+
this.$lightbox.off('.keyboard');
|
518
|
+
this.$overlay.off('.keyboard');
|
497
519
|
};
|
498
520
|
|
499
521
|
Lightbox.prototype.keyboardAction = function(event) {
|
@@ -503,6 +525,8 @@
|
|
503
525
|
|
504
526
|
var keycode = event.keyCode;
|
505
527
|
if (keycode === KEYCODE_ESC) {
|
528
|
+
// Prevent bubbling so as to not affect other components on the page.
|
529
|
+
event.stopPropagation();
|
506
530
|
this.end();
|
507
531
|
} else if (keycode === KEYCODE_LEFTARROW) {
|
508
532
|
if (this.currentImageIndex !== 0) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightbox2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Schnitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|