Skip to content

Commit

Permalink
build: release 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jun 14, 2020
1 parent 4072858 commit beadfd9
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 88 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## next
## 1.6.1 (Jun 14, 2020)

- Improve image filtering.

Expand Down
34 changes: 22 additions & 12 deletions dist/viewer.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.6.0
* Viewer.js v1.6.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2020-06-06T11:26:26.858Z
* Date: 2020-06-14T07:47:18.114Z
*/

function _typeof(obj) {
Expand Down Expand Up @@ -1059,13 +1059,8 @@ var render = {
forEach(this.images, function (image, index) {
var src = image.src;
var alt = image.alt || getImageNameFromURL(src);
var url = options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(_this, image);
}
var url = _this.getImageURL(image);

if (src || url) {
var item = document.createElement('li');
Expand Down Expand Up @@ -2553,6 +2548,8 @@ var methods = {
},
// Update viewer when images changed
update: function update() {
var _this8 = this;

var element = this.element,
options = this.options,
isImg = this.isImg; // Destroy viewer if the target image was deleted
Expand All @@ -2563,11 +2560,11 @@ var methods = {

var images = [];
forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
if (options.filter) {
if (options.filter(image)) {
if (isFunction(options.filter)) {
if (options.filter.call(_this8, image)) {
images.push(image);
}
} else {
} else if (_this8.getImageURL(image)) {
images.push(image);
}
});
Expand Down Expand Up @@ -2686,6 +2683,19 @@ var methods = {
};

var others = {
getImageURL: function getImageURL(image) {
var url = this.options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(this, image);
} else {
url = '';
}

return url;
},
open: function open() {
var body = this.body;
addClass(body, CLASS_OPEN);
Expand Down Expand Up @@ -2889,7 +2899,7 @@ var Viewer = /*#__PURE__*/function () {
if (options.filter.call(_this, image)) {
images.push(image);
}
} else if (image.src) {
} else if (_this.getImageURL(image)) {
images.push(image);
}
});
Expand Down
34 changes: 22 additions & 12 deletions dist/viewer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.6.0
* Viewer.js v1.6.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2020-06-06T11:26:26.858Z
* Date: 2020-06-14T07:47:18.114Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -1065,13 +1065,8 @@
forEach(this.images, function (image, index) {
var src = image.src;
var alt = image.alt || getImageNameFromURL(src);
var url = options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(_this, image);
}
var url = _this.getImageURL(image);

if (src || url) {
var item = document.createElement('li');
Expand Down Expand Up @@ -2559,6 +2554,8 @@
},
// Update viewer when images changed
update: function update() {
var _this8 = this;

var element = this.element,
options = this.options,
isImg = this.isImg; // Destroy viewer if the target image was deleted
Expand All @@ -2569,11 +2566,11 @@

var images = [];
forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
if (options.filter) {
if (options.filter(image)) {
if (isFunction(options.filter)) {
if (options.filter.call(_this8, image)) {
images.push(image);
}
} else {
} else if (_this8.getImageURL(image)) {
images.push(image);
}
});
Expand Down Expand Up @@ -2692,6 +2689,19 @@
};

var others = {
getImageURL: function getImageURL(image) {
var url = this.options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(this, image);
} else {
url = '';
}

return url;
},
open: function open() {
var body = this.body;
addClass(body, CLASS_OPEN);
Expand Down Expand Up @@ -2895,7 +2905,7 @@
if (options.filter.call(_this, image)) {
images.push(image);
}
} else if (image.src) {
} else if (_this.getImageURL(image)) {
images.push(image);
}
});
Expand Down
4 changes: 2 additions & 2 deletions dist/viewer.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/viewer.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/css/viewer.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.6.0
* Viewer.js v1.6.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2020-06-06T11:26:24.345Z
* Date: 2020-06-14T07:47:15.792Z
*/

.viewer-zoom-in::before,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<div class="container">
<div class="row">
<div class="col-md">
<h1>Viewer.js <small class="h6">v1.6.0</small></h1>
<h1>Viewer.js <small class="h6">v1.6.1</small></h1>
<p class="lead">JavaScript image viewer.</p>
</div>
<div class="col-md">
Expand Down
34 changes: 22 additions & 12 deletions docs/js/viewer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Viewer.js v1.6.0
* Viewer.js v1.6.1
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2020-06-06T11:26:26.858Z
* Date: 2020-06-14T07:47:18.114Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -1065,13 +1065,8 @@
forEach(this.images, function (image, index) {
var src = image.src;
var alt = image.alt || getImageNameFromURL(src);
var url = options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(_this, image);
}
var url = _this.getImageURL(image);

if (src || url) {
var item = document.createElement('li');
Expand Down Expand Up @@ -2559,6 +2554,8 @@
},
// Update viewer when images changed
update: function update() {
var _this8 = this;

var element = this.element,
options = this.options,
isImg = this.isImg; // Destroy viewer if the target image was deleted
Expand All @@ -2569,11 +2566,11 @@

var images = [];
forEach(isImg ? [element] : element.querySelectorAll('img'), function (image) {
if (options.filter) {
if (options.filter(image)) {
if (isFunction(options.filter)) {
if (options.filter.call(_this8, image)) {
images.push(image);
}
} else {
} else if (_this8.getImageURL(image)) {
images.push(image);
}
});
Expand Down Expand Up @@ -2692,6 +2689,19 @@
};

var others = {
getImageURL: function getImageURL(image) {
var url = this.options.url;

if (isString(url)) {
url = image.getAttribute(url);
} else if (isFunction(url)) {
url = url.call(this, image);
} else {
url = '';
}

return url;
},
open: function open() {
var body = this.body;
addClass(body, CLASS_OPEN);
Expand Down Expand Up @@ -2895,7 +2905,7 @@
if (options.filter.call(_this, image)) {
images.push(image);
}
} else if (image.src) {
} else if (_this.getImageURL(image)) {
images.push(image);
}
});
Expand Down
Loading

0 comments on commit beadfd9

Please sign in to comment.