Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yaquawa committed Nov 8, 2017
1 parent b553fa9 commit ad0a26a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 68 deletions.
34 changes: 9 additions & 25 deletions dist/jquery.photoswipe-global.js
Expand Up @@ -3725,8 +3725,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PhotoSwipe = exports.default = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _photoswipe = require('photoswipe');

var _photoswipe2 = _interopRequireDefault(_photoswipe);
Expand Down Expand Up @@ -3775,10 +3773,14 @@ function PhotoSwipeMounter($) {

function getWH(wh, $img) {
var d = $.Deferred(),
wh_value = $img.data('original-src-' + wh);
wh_value = $img.data('original-src-' + wh),
original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (wh_value) {
d.resolve(wh_value);
} else if (matches !== null) {
d.resolve(matches[wh === 'width' ? 1 : 2]);
} else {
$('<img>').on('load', function () {
d.resolve(this[wh]);
Expand All @@ -3797,24 +3799,6 @@ function PhotoSwipeMounter($) {
}

function getImgSize($img) {
var original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (matches !== null) {
var _ret = function () {
// resolve width and height by file name
var d = $.Deferred();
setTimeout(function () {
d.resolve(Number(matches[1]), Number(matches[2]));
}, 0);
return {
v: d.promise()
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}

return $.when(getWidth($img), getHeight($img));
}

Expand Down Expand Up @@ -3974,9 +3958,9 @@ function PhotoSwipeMounter($) {
}

$.fn.photoSwipe = function () {
var slideSelector = arguments.length <= 0 || arguments[0] === undefined ? 'img' : arguments[0];
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var events = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var slideSelector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'img';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

var defaultOptions = {
bgOpacity: 0.973,
Expand Down Expand Up @@ -4028,7 +4012,7 @@ exports.PhotoSwipe = _photoswipe2.default;
},{"./libs/photoswipe-ui-default":3,"photoswipe":1}],3:[function(require,module,exports){
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

/*! PhotoSwipe Default UI - 4.1.1 - 2015-12-24
* http://photoswipe.com
Expand Down
34 changes: 9 additions & 25 deletions dist/jquery.photoswipe.js
Expand Up @@ -3725,8 +3725,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PhotoSwipe = exports.default = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _photoswipe = require('photoswipe');

var _photoswipe2 = _interopRequireDefault(_photoswipe);
Expand Down Expand Up @@ -3775,10 +3773,14 @@ function PhotoSwipeMounter($) {

function getWH(wh, $img) {
var d = $.Deferred(),
wh_value = $img.data('original-src-' + wh);
wh_value = $img.data('original-src-' + wh),
original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (wh_value) {
d.resolve(wh_value);
} else if (matches !== null) {
d.resolve(matches[wh === 'width' ? 1 : 2]);
} else {
$('<img>').on('load', function () {
d.resolve(this[wh]);
Expand All @@ -3797,24 +3799,6 @@ function PhotoSwipeMounter($) {
}

function getImgSize($img) {
var original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (matches !== null) {
var _ret = function () {
// resolve width and height by file name
var d = $.Deferred();
setTimeout(function () {
d.resolve(Number(matches[1]), Number(matches[2]));
}, 0);
return {
v: d.promise()
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}

return $.when(getWidth($img), getHeight($img));
}

Expand Down Expand Up @@ -3974,9 +3958,9 @@ function PhotoSwipeMounter($) {
}

$.fn.photoSwipe = function () {
var slideSelector = arguments.length <= 0 || arguments[0] === undefined ? 'img' : arguments[0];
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var events = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var slideSelector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'img';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

var defaultOptions = {
bgOpacity: 0.973,
Expand Down Expand Up @@ -4030,7 +4014,7 @@ exports.PhotoSwipe = _photoswipe2.default;
},{"./libs/photoswipe-ui-default":3,"photoswipe":1}],3:[function(require,module,exports){
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

/*! PhotoSwipe Default UI - 4.1.1 - 2015-12-24
* http://photoswipe.com
Expand Down
4 changes: 2 additions & 2 deletions dist/min/jquery.photoswipe-global.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/min/jquery.photoswipe.js

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions src/jquery.photoswipe.js
Expand Up @@ -41,11 +41,15 @@ function PhotoSwipeMounter($) {
}

function getWH(wh, $img) {
var d = $.Deferred(),
wh_value = $img.data(`original-src-${wh}`);
var d = $.Deferred(),
wh_value = $img.data(`original-src-${wh}`),
original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (wh_value) {
d.resolve(wh_value);
} else if (matches !== null) {
d.resolve(matches[(wh === 'width' ? 1 : 2)]);
} else {
$(`<img>`).on('load', function () {
d.resolve(this[wh]);
Expand All @@ -64,18 +68,6 @@ function PhotoSwipeMounter($) {
}

function getImgSize($img) {
var original_src = decodeURI($img.data('original-src') || $img.attr('src')),
matches = original_src.match(/(\d+)[*×x](\d+)/);

if (matches !== null) {
// resolve width and height by file name
let d = $.Deferred();
setTimeout(function () {
d.resolve(Number(matches[1]), Number(matches[2]));
}, 0);
return d.promise();
}

return $.when(getWidth($img), getHeight($img));
}

Expand Down

0 comments on commit ad0a26a

Please sign in to comment.