├── demo
├── 1.jpg
├── 2.jpg
├── 3.jpg
├── xxx.jpg
├── xxx_3x.jpg
└── index.html
├── index.js
├── dist
├── skin.css.map
├── photo-preview-skin
│ ├── preloader.gif
│ ├── default-skin.png
│ └── default-skin.svg
├── skin.css
└── vue-photo-preview.js
├── .gitignore
├── .babelrc
├── src
├── main.js
├── App.vue
└── lib
│ ├── preview.vue
│ └── index.js
├── package.json
├── webpack.config.js
└── README.md
/demo/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/demo/1.jpg
--------------------------------------------------------------------------------
/demo/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/demo/2.jpg
--------------------------------------------------------------------------------
/demo/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/demo/3.jpg
--------------------------------------------------------------------------------
/demo/xxx.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/demo/xxx.jpg
--------------------------------------------------------------------------------
/demo/xxx_3x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/demo/xxx_3x.jpg
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import photoPreview from './dist/vue-photo-preview.js'
2 | export default photoPreview
--------------------------------------------------------------------------------
/dist/skin.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"skin.css","sourceRoot":""}
--------------------------------------------------------------------------------
/dist/photo-preview-skin/preloader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/dist/photo-preview-skin/preloader.gif
--------------------------------------------------------------------------------
/dist/photo-preview-skin/default-skin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/826327700/vue-photo-preview/HEAD/dist/photo-preview-skin/default-skin.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | npm-debug.log
4 | yarn-error.log
5 | # Editor directories and files
6 | .idea
7 | *.suo
8 | *.ntvs*
9 | *.njsproj
10 | *.sln
11 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "es2015",
5 | {
6 | "modules": false
7 | }
8 | ],
9 | [
10 | "stage-0"
11 | ]
12 | ],
13 | "plugins": [
14 | [
15 | "transform-runtime",
16 | {
17 | "helpers": false,
18 | "polyfill": false,
19 | "regenerator": true,
20 | "moduleName": "babel-runtime"
21 | }
22 | ]
23 | ]
24 | }
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 |
4 | import Preview from './lib/index'
5 |
6 | var opts={
7 | mainClass : 'pswp--minimal--dark',
8 | barsSize : {
9 | top: 0,
10 | bottom: 0
11 | },
12 | captionEl : false,
13 | fullscreenEl : false,
14 | shareEl : false,
15 | bgOpacity : 0.85,
16 | tapToClose : true,
17 | tapToToggleControls : false,
18 | }
19 | Vue.use(Preview,opts)
20 |
21 | new Vue({
22 | el: '#app',
23 | render: h => h(App)
24 | })
25 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |

5 |
6 |
7 |
8 |
18 |
19 |
34 |
--------------------------------------------------------------------------------
/dist/photo-preview-skin/default-skin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-photo-preview",
3 | "description": "\"基于photoswipe的vue图片预览组件\"",
4 | "version": "1.1.3",
5 | "author": "xiaobaozi <826327700@qq.com>",
6 | "private": false,
7 | "license": "MIT",
8 | "main": "dist/vue-photo-preview.js",
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/826327700/vue-photo-preview"
12 | },
13 | "scripts": {
14 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
15 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
16 | },
17 | "dependencies": {
18 | "css-loader": "^0.28.7",
19 | "photoswipe": "^4.1.2",
20 | "style-loader": "^0.19.0",
21 | "vue": "^2.4.4",
22 | "autoprefixer-loader": "^3.2.0",
23 | "babel-core": "^6.26.0",
24 | "babel-loader": "^7.1.2",
25 | "babel-preset-env": "^1.6.0",
26 | "cross-env": "^5.0.5",
27 | "extract-text-webpack-plugin": "^3.0.1",
28 | "file-loader": "^1.1.4",
29 | "resolve-url-loader": "^2.1.1",
30 | "vue-loader": "^13.0.5",
31 | "vue-template-compiler": "^2.4.4",
32 | "webpack": "^3.6.0",
33 | "webpack-dev-server": "^2.9.1"
34 | },
35 | "devDependencies": {
36 | "autoprefixer-loader": "^3.2.0",
37 | "babel-core": "^6.26.0",
38 | "babel-loader": "^7.1.2",
39 | "babel-plugin-transform-runtime": "^6.23.0",
40 | "babel-preset-env": "^1.6.0",
41 | "babel-preset-es2015": "^6.24.1",
42 | "babel-preset-stage-0": "^6.24.1",
43 | "cross-env": "^5.0.5",
44 | "css-loader": "^0.28.7",
45 | "extract-text-webpack-plugin": "^3.0.1",
46 | "file-loader": "^1.1.4",
47 | "resolve-url-loader": "^2.1.1",
48 | "vue-loader": "^13.0.5",
49 | "vue-template-compiler": "^2.4.4",
50 | "webpack": "^3.6.0",
51 | "webpack-dev-server": "^2.9.1"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | vue-photo-preview
7 |
8 |
17 |
18 |
19 |
20 |
21 |
22 |
单个
23 |
24 |
![]()
25 |
26 |
27 |
分组
28 |
29 |

30 |

31 |
32 |
33 |
大图
34 |
35 |

36 |
37 |
38 |
39 |
40 |
41 |
42 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var webpack = require('webpack')
3 | var ExtractTextPlugin = require("extract-text-webpack-plugin");
4 | module.exports = {
5 | //entry: './src/main.js',
6 | entry:'./src/lib/index.js',
7 | output: {
8 | path: path.resolve(__dirname, './dist'),
9 | publicPath: '/dist/',
10 | filename: 'vue-photo-preview.js',
11 | library: 'vue-photo-preview',
12 | libraryTarget: 'umd',
13 | umdNamedDefine: true
14 | },
15 | module: {
16 | rules: [
17 | {
18 | test: /\.vue$/,
19 | loader: 'vue-loader',
20 | options: {
21 | loaders: {
22 | css: ExtractTextPlugin.extract({
23 | use: ['css-loader', 'autoprefixer-loader'],
24 | fallback: 'vue-style-loader',
25 | })
26 | }
27 | // other vue-loader options go here
28 | }
29 | },
30 | {
31 | test: /\.js$/,
32 | loader: 'babel-loader',
33 | exclude: /node_modules/
34 | },
35 | {
36 | test: /\.css$/,
37 | use: ExtractTextPlugin.extract({
38 | use: ['css-loader?minimize', 'autoprefixer-loader','resolve-url-loader'],
39 | fallback: 'style-loader',
40 | })
41 | },
42 | {
43 | test: /\.(png|jpg|gif|svg)$/,
44 | loader: 'file-loader',
45 | options: {
46 | name: 'photo-preview-skin/[name].[ext]',
47 | publicPath:'./'
48 | }
49 | }
50 | ]
51 | },
52 | plugins:[
53 | new ExtractTextPlugin('skin.css'),
54 | ],
55 | resolve: {
56 | alias: {
57 | 'vue$': 'vue/dist/vue.esm.js'
58 | }
59 | },
60 | devServer: {
61 | historyApiFallback: true,
62 | noInfo: true,
63 | overlay: true
64 | },
65 | performance: {
66 | hints: false
67 | },
68 | devtool: '#eval-source-map'
69 | }
70 |
71 | if (process.env.NODE_ENV === 'production') {
72 | module.exports.devtool = '#source-map'
73 | // http://vue-loader.vuejs.org/en/workflow/production.html
74 | module.exports.plugins = (module.exports.plugins || []).concat([
75 | new webpack.DefinePlugin({
76 | 'process.env': {
77 | NODE_ENV: '"production"'
78 | }
79 | }),
80 | new webpack.optimize.UglifyJsPlugin({
81 | sourceMap: true,
82 | compress: {
83 | warnings: false
84 | }
85 | }),
86 | new webpack.LoaderOptionsPlugin({
87 | minimize: true
88 | })
89 | ])
90 | }
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-photo-preview
2 |
3 | > \"基于photoswipe的vue图片预览插件\"
4 |
5 | ## 说明
6 | 1.简化了photoswipe的默认设置
7 | 2.取消了图片需设定尺寸的要求
8 | 3.默认关闭了分享按钮
9 | 4.简化了html结构
10 |
11 | ## 使用
12 | ``` bash
13 | # 安装
14 | npm install vue-photo-preview --save
15 | ```
16 | ```
17 | # 引入
18 | import preview from 'vue-photo-preview'
19 | import 'vue-photo-preview/dist/skin.css'
20 | Vue.use(preview)
21 | //或者
22 | //var option={....} option配置请查看 http://photoswipe.com/documentation/options.html
23 | //Vue.use(preview,option)
24 | ```
25 | ```
26 | # umd
27 |
28 |
29 |
30 |
41 | ```
42 | ```
43 | # html
44 | //在img标签添加preview属性 preview值相同即表示为同一组
45 |
46 |
47 | //分组
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | ```
56 |
57 |
58 |
59 | ### 2019-02-02更新
60 | 修复打开和关闭图片页面时,动画起始位置总是位于图片组最后一张的问题。调整默认点击放大倍数。
61 |
62 | ### 2018-11-28更新
63 | 解决图片多次点击问题。缩略图只可点击一次,直至图片加载完成后,才可再次打开。
64 |
65 | ### 2018-11-15更新
66 | 重命名this.init为this.initPreview,解决部分冲突问题。
67 | 去除所有console打印
68 |
69 | ### 2018-10-15 更新
70 | 解决原图与大图模式下的BUG
71 |
72 | ### 2018-09-28 更新
73 | //添加对原插件photoswipe的事件响应,示例:
74 | ```
75 | this.$preview.on('close',())=>{//close只是众多事件名的其中一个,更多请查看文档
76 | console.log('图片查看器被关闭')
77 | })
78 | ```
79 |
80 | //添加图片查看器实例--this.$preview.self 注意:此实例仅在图片查看器被打开时生效
81 | ```
82 | this.$preview.on('imageLoadComplete',(e,item)=>{
83 | console.log(this.$preview.self) //此时this.$preview.self拥有原插件photoswipe文档中的所有方法和属性
84 | })
85 | ```
86 |
87 | //demo文件夹中index.html可以供参考写法
88 | //本次更新后继承了原插件的所有事件、方法和属性,如需复杂使用请多多查看[原插件文档](http://photoswipe.com/documentation/api.html)
89 |
90 | //应性能要求 新增大图查看 large标签填写大图路径 (插件的思路是 img的src默认为缩略图),如不填写large,则展示src
91 | ```
92 |
93 | ```
94 |
95 | ### 2018-05-17 更新
96 | //如果图片是异步生成的,在图片数据更新后调用:
97 | ```
98 | this.$previewRefresh()
99 | ```
100 |
101 |
102 |
103 | ## Options
104 | [插件配置文档](http://photoswipe.com/documentation/options.html)
105 |
106 | ## DEMO
107 | [地址](https://826327700.github.io/vue-photo-preview/demo/)
108 |
109 |
--------------------------------------------------------------------------------
/src/lib/preview.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
65 |
66 |
67 |
68 |
76 |
77 |
--------------------------------------------------------------------------------
/dist/skin.css:
--------------------------------------------------------------------------------
1 | /*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */.pswp{display:none;position:absolute;width:100%;height:100%;left:0;top:0;overflow:hidden;-ms-touch-action:none;touch-action:none;z-index:1500;-webkit-text-size-adjust:100%;-webkit-backface-visibility:hidden;outline:none}.pswp *{box-sizing:border-box}.pswp img{max-width:none}.pswp--animate_opacity{opacity:.001;will-change:opacity;transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--open{display:block}.pswp--zoom-allowed .pswp__img{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.pswp--zoomed-in .pswp__img{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.pswp--dragging .pswp__img{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.pswp__bg{background:#000;opacity:0;transform:translateZ(0);-webkit-backface-visibility:hidden}.pswp__bg,.pswp__scroll-wrap{position:absolute;left:0;top:0;width:100%;height:100%}.pswp__scroll-wrap{overflow:hidden}.pswp__container,.pswp__zoom-wrap{-ms-touch-action:none;touch-action:none;position:absolute;left:0;right:0;top:0;bottom:0}.pswp__container,.pswp__img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.pswp__zoom-wrap{position:absolute;width:100%;transform-origin:left top;transition:transform 333ms cubic-bezier(.4,0,.22,1)}.pswp__bg{will-change:opacity;transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--animated-in .pswp__bg,.pswp--animated-in .pswp__zoom-wrap{transition:none}.pswp__container,.pswp__zoom-wrap{-webkit-backface-visibility:hidden}.pswp__item{right:0;bottom:0;overflow:hidden}.pswp__img,.pswp__item{position:absolute;left:0;top:0}.pswp__img{width:auto;height:auto}.pswp__img--placeholder{-webkit-backface-visibility:hidden}.pswp__img--placeholder--blank{background:#222}.pswp--ie .pswp__img{width:100%!important;height:auto!important;left:0;top:0}.pswp__error-msg{position:absolute;left:0;top:50%;width:100%;text-align:center;font-size:14px;line-height:16px;margin-top:-8px;color:#ccc}.pswp__error-msg a{color:#ccc;text-decoration:underline}/*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */.pswp__button{width:44px;height:44px;position:relative;background:none;cursor:pointer;overflow:visible;-webkit-appearance:none;display:block;border:0;padding:0;margin:0;float:right;opacity:.75;transition:opacity .2s;box-shadow:none}.pswp__button:focus,.pswp__button:hover{opacity:1}.pswp__button:active{outline:none;opacity:.9}.pswp__button::-moz-focus-inner{padding:0;border:0}.pswp__ui--over-close .pswp__button--close{opacity:1}.pswp__button,.pswp__button--arrow--left:before,.pswp__button--arrow--right:before{background:url(./photo-preview-skin/default-skin.png) 0 0 no-repeat;background-size:264px 88px;width:44px;height:44px}@media (-webkit-min-device-pixel-ratio:1.1),(-webkit-min-device-pixel-ratio:1.09375),(min-resolution:1.1dppx),(min-resolution:105dpi){.pswp--svg .pswp__button,.pswp--svg .pswp__button--arrow--left:before,.pswp--svg .pswp__button--arrow--right:before{background-image:url(./photo-preview-skin/default-skin.svg)}.pswp--svg .pswp__button--arrow--left,.pswp--svg .pswp__button--arrow--right{background:none}}.pswp__button--close{background-position:0 -44px}.pswp__button--share{background-position:-44px -44px}.pswp__button--fs{display:none}.pswp--supports-fs .pswp__button--fs{display:block}.pswp--fs .pswp__button--fs{background-position:-44px 0}.pswp__button--zoom{display:none;background-position:-88px 0}.pswp--zoom-allowed .pswp__button--zoom{display:block}.pswp--zoomed-in .pswp__button--zoom{background-position:-132px 0}.pswp--touch .pswp__button--arrow--left,.pswp--touch .pswp__button--arrow--right{visibility:hidden}.pswp__button--arrow--left,.pswp__button--arrow--right{background:none;top:50%;margin-top:-50px;width:70px;height:100px;position:absolute}.pswp__button--arrow--left{left:0}.pswp__button--arrow--right{right:0}.pswp__button--arrow--left:before,.pswp__button--arrow--right:before{content:"";top:35px;background-color:rgba(0,0,0,.3);height:30px;width:32px;position:absolute}.pswp__button--arrow--left:before{left:6px;background-position:-138px -44px}.pswp__button--arrow--right:before{right:6px;background-position:-94px -44px}.pswp__counter,.pswp__share-modal{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pswp__share-modal{display:block;background:rgba(0,0,0,.5);width:100%;height:100%;top:0;left:0;padding:10px;position:absolute;z-index:1600;opacity:0;transition:opacity .25s ease-out;-webkit-backface-visibility:hidden;will-change:opacity}.pswp__share-modal--hidden{display:none}.pswp__share-tooltip{z-index:1620;position:absolute;background:#fff;top:56px;border-radius:2px;display:block;width:auto;right:44px;box-shadow:0 2px 5px rgba(0,0,0,.25);transform:translateY(6px);transition:transform .25s;-webkit-backface-visibility:hidden;will-change:transform}.pswp__share-tooltip a{display:block;padding:8px 12px;font-size:14px;line-height:18px}.pswp__share-tooltip a,.pswp__share-tooltip a:hover{color:#000;text-decoration:none}.pswp__share-tooltip a:first-child{border-radius:2px 2px 0 0}.pswp__share-tooltip a:last-child{border-radius:0 0 2px 2px}.pswp__share-modal--fade-in{opacity:1}.pswp__share-modal--fade-in .pswp__share-tooltip{transform:translateY(0)}.pswp--touch .pswp__share-tooltip a{padding:16px 12px}a.pswp__share--facebook:before{content:"";display:block;width:0;height:0;position:absolute;top:-12px;right:15px;border:6px solid transparent;border-bottom-color:#fff;-webkit-pointer-events:none;-moz-pointer-events:none;pointer-events:none}a.pswp__share--facebook:hover{background:#3e5c9a;color:#fff}a.pswp__share--facebook:hover:before{border-bottom-color:#3e5c9a}a.pswp__share--twitter:hover{background:#55acee;color:#fff}a.pswp__share--pinterest:hover{background:#ccc;color:#ce272d}a.pswp__share--download:hover{background:#ddd}.pswp__counter{position:absolute;left:0;top:0;height:44px;font-size:13px;line-height:44px;color:#fff;opacity:.75;padding:0 10px}.pswp__caption{position:absolute;left:0;bottom:0;width:100%;min-height:44px}.pswp__caption small{font-size:11px;color:#bbb}.pswp__caption__center{text-align:left;max-width:420px;margin:0 auto;font-size:13px;padding:10px;line-height:20px;color:#ccc}.pswp__caption--empty{display:none}.pswp__caption--fake{visibility:hidden}.pswp__preloader{width:44px;height:44px;position:absolute;top:0;left:50%;margin-left:-22px;opacity:0;transition:opacity .25s ease-out;will-change:opacity;direction:ltr}.pswp__preloader__icn{width:20px;height:20px;margin:12px}.pswp__preloader--active{opacity:1}.pswp__preloader--active .pswp__preloader__icn{background:url(./photo-preview-skin/preloader.gif) 0 0 no-repeat}.pswp--css_animation .pswp__preloader--active{opacity:1}.pswp--css_animation .pswp__preloader--active .pswp__preloader__icn{animation:clockwise .5s linear infinite}.pswp--css_animation .pswp__preloader--active .pswp__preloader__donut{animation:donut-rotate 1s cubic-bezier(.4,0,.22,1) infinite}.pswp--css_animation .pswp__preloader__icn{background:none;opacity:.75;width:14px;height:14px;position:absolute;left:15px;top:15px;margin:0}.pswp--css_animation .pswp__preloader__cut{position:relative;width:7px;height:14px;overflow:hidden}.pswp--css_animation .pswp__preloader__donut{box-sizing:border-box;width:14px;height:14px;border:2px solid #fff;border-radius:50%;border-left-color:transparent;border-bottom-color:transparent;position:absolute;top:0;left:0;background:none;margin:0}@media screen and (max-width:1024px){.pswp__preloader{position:relative;left:auto;top:auto;margin:0;float:right}}@keyframes clockwise{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes donut-rotate{0%{transform:rotate(0)}50%{transform:rotate(-140deg)}to{transform:rotate(0)}}.pswp__ui{-webkit-font-smoothing:auto;visibility:visible;opacity:1;z-index:1550}.pswp__top-bar{position:absolute;left:0;top:0;height:44px;width:100%}.pswp--has_mouse .pswp__button--arrow--left,.pswp--has_mouse .pswp__button--arrow--right,.pswp__caption,.pswp__top-bar{-webkit-backface-visibility:hidden;will-change:opacity;transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--has_mouse .pswp__button--arrow--left,.pswp--has_mouse .pswp__button--arrow--right{visibility:visible}.pswp__caption,.pswp__top-bar{background-color:rgba(0,0,0,.5)}.pswp__ui--fit .pswp__caption,.pswp__ui--fit .pswp__top-bar{background-color:rgba(0,0,0,.3)}.pswp__ui--idle .pswp__button--arrow--left,.pswp__ui--idle .pswp__button--arrow--right,.pswp__ui--idle .pswp__top-bar{opacity:0}.pswp__ui--hidden .pswp__button--arrow--left,.pswp__ui--hidden .pswp__button--arrow--right,.pswp__ui--hidden .pswp__caption,.pswp__ui--hidden .pswp__top-bar{opacity:.001}.pswp__ui--one-slide .pswp__button--arrow--left,.pswp__ui--one-slide .pswp__button--arrow--right,.pswp__ui--one-slide .pswp__counter{display:none}.pswp__element--disabled{display:none!important}.pswp--minimal--dark .pswp__top-bar{background:none}
2 | /*# sourceMappingURL=skin.css.map*/
--------------------------------------------------------------------------------
/src/lib/index.js:
--------------------------------------------------------------------------------
1 | import previewComponent from './preview.vue'
2 | import PhotoSwipe from 'photoswipe/dist/photoswipe'
3 | import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default'
4 | let $preview
5 | var vuePhotoPreview ={
6 | install (Vue,opts) {
7 | const Preview = Vue.extend(previewComponent)
8 | var opts=opts||{}
9 | if (!$preview) {
10 | $preview = new Preview({el: document.createElement('div')})
11 | document.body.appendChild($preview.$el)
12 | }
13 | let eventName,eventCallback
14 | Vue.prototype.$preview={
15 | self:null,
16 | on:(name,callback)=>{
17 | eventName=name
18 | eventCallback=callback
19 | }
20 | }
21 | Vue.mixin({
22 | data(){
23 | return {
24 | galleryElements:null,
25 | galleryPicLoading:false
26 | }
27 | },
28 | methods:{
29 | $previewRefresh(){
30 | setTimeout(() => {
31 | this.galleryElements = document.querySelectorAll('img[preview]');
32 | for(var i = 0, l = this.galleryElements.length; i < l; i++) {
33 | this.galleryElements[i].setAttribute('data-pswp-uid', i + 1);
34 | this.galleryElements[i].onclick = this.onThumbnailsClick;
35 | }
36 | }, 200);
37 |
38 | },
39 | onThumbnailsClick(e) {
40 | if(this.galleryPicLoading)return false;
41 | this.galleryPicLoading=true
42 | e = e || window.event;
43 | e.preventDefault ? e.preventDefault() : e.returnValue = false;
44 |
45 | var eTarget = e.target || e.srcElement;
46 |
47 |
48 | var thumbElements;
49 | var group = eTarget.getAttribute('preview')
50 | if(group) {
51 | thumbElements = document.querySelectorAll('img[preview="' + group + '"]')
52 | } else {
53 | thumbElements = document.querySelectorAll('img[preview]')
54 | }
55 | var clickedGallery = thumbElements;
56 |
57 | var index;
58 |
59 | for(var i = 0; i < clickedGallery.length; i++) {
60 | if(clickedGallery[i] === eTarget) {
61 | index = i;
62 | break;
63 | }
64 | }
65 | if(index >= 0) {
66 | this.openPhotoSwipe(index, clickedGallery);
67 | this.$emit('preview-open',e,eTarget.src)
68 | }
69 | return false;
70 | },
71 | async openPhotoSwipe(index, galleryElement, disableAnimation, fromURL) {
72 | var pswpElement = document.querySelectorAll('.pswp')[0],
73 | gallery,
74 | options,
75 | items;
76 |
77 | var items = await this.parseThumbnailElements(galleryElement);
78 | options = {
79 |
80 | // galleryUID: galleryElement.getAttribute('data-pswp-uid'),
81 |
82 | getThumbBoundsFn: function(index) {
83 | var thumbnail = items[index].el,
84 | pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
85 | rect = thumbnail.getBoundingClientRect();
86 | return {
87 | x: rect.left,
88 | y: rect.top + pageYScroll,
89 | w: rect.width
90 | };
91 |
92 | },
93 |
94 | addCaptionHTMLFn: function(item, captionEl, isFake) {
95 | if(!item.title) {
96 | captionEl.children[0].innerText = '';
97 | return false;
98 | }
99 | captionEl.children[0].innerHTML = item.title ;
100 | return true;
101 | },
102 | showHideOpacity:true,
103 | history:false,
104 | shareEl:false,
105 | maxSpreadZoom:3,
106 | getDoubleTapZoom:function(isMouseClick, item){
107 | if(isMouseClick) {
108 |
109 | return 1.5;
110 |
111 | } else {
112 | return item.initialZoomLevel < 0.7 ? 1 : 1.5;
113 | }
114 | }
115 |
116 | };
117 |
118 | if(fromURL) {
119 | if(options.galleryPIDs) {
120 | // parse real index when custom PIDs are used
121 | // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
122 | for(var j = 0; j < items.length; j++) {
123 | if(items[j].pid == index) {
124 | options.index = j;
125 | break;
126 | }
127 | }
128 | } else {
129 | options.index = parseInt(index, 10) - 1;
130 | }
131 | } else {
132 | options.index = parseInt(index, 10);
133 | }
134 |
135 | // exit if index not found
136 | if(isNaN(options.index)) {
137 | return;
138 | }
139 | options=this.extend(options,opts)
140 |
141 | if(disableAnimation) {
142 | options.showAnimationDuration = 0;
143 | }
144 |
145 | // Pass data to PhotoSwipe and initialize it
146 | gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
147 | Vue.prototype.$preview.self=gallery
148 | // see: http://photoswipe.com/documentation/responsive-images.html
149 | var realViewportWidth,
150 | useLargeImages = false,
151 | firstResize = true,
152 | imageSrcWillChange;
153 |
154 | gallery.listen('beforeResize', function() {
155 |
156 | var dpiRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
157 | dpiRatio = Math.min(dpiRatio, 2.5);
158 | realViewportWidth = gallery.viewportSize.x * dpiRatio;
159 |
160 | if(realViewportWidth >= 1200 || (!gallery.likelyTouchDevice && realViewportWidth > 800) || screen.width > 1200) {
161 | if(!useLargeImages) {
162 | useLargeImages = true;
163 | imageSrcWillChange = true;
164 | }
165 |
166 | } else {
167 | if(useLargeImages) {
168 | useLargeImages = false;
169 | imageSrcWillChange = true;
170 | }
171 | }
172 |
173 | if(imageSrcWillChange && !firstResize) {
174 | gallery.invalidateCurrItems();
175 | }
176 |
177 | if(firstResize) {
178 | firstResize = false;
179 | }
180 |
181 | imageSrcWillChange = false;
182 |
183 | });
184 |
185 | gallery.listen('gettingData', function(index, item) {
186 | if(item.el.getAttribute('large')) {
187 | item.src = item.o.src;
188 | item.w = item.o.w;
189 | item.h = item.o.h;
190 | } else {
191 | item.src = item.m.src;
192 | item.w = item.m.w;
193 | item.h = item.m.h;
194 | }
195 | });
196 | gallery.listen('imageLoadComplete', (index, item)=> {
197 | this.galleryPicLoading=false
198 | });
199 | gallery.listen(eventName,eventCallback)
200 | gallery.init();
201 | $preview.$el.classList=$preview.$el.classList+' pswp--zoom-allowed'
202 | },
203 | parseThumbnailElements(thumbElements) {
204 | return new Promise(resolve=>{
205 | var items = [],
206 | el,
207 | load = 0,
208 | item;
209 | item = {}
210 | for(var i = 0; i < thumbElements.length; i++) {
211 | el = thumbElements[i];
212 |
213 | // include only element nodes
214 | if(el.nodeType !== 1) {
215 | continue;
216 | }
217 |
218 |
219 | if(typeof el.naturalWidth == "undefined") { // IE 6/7/8
220 |
221 | var i = new Image();
222 | i.src = el.src;
223 | var rw = i.width;
224 | var rh = i.height;
225 | } else { // HTML5 browsers
226 |
227 | var rw = el.naturalWidth;
228 | var rh = el.naturalHeight;
229 | }
230 | getImage(i)
231 | var count=0
232 | function getImage(index){
233 | var l=new Image()
234 | l.src=el.getAttribute('large')?el.getAttribute('large'):el.getAttribute('src')
235 | l.text=el.getAttribute('preview-text')
236 | l.author=el.getAttribute('data-author')
237 | l.onload=function(){
238 | item = {
239 | title: l.text,
240 | el: thumbElements[index],
241 | src: l.src,
242 | w: rw,
243 | h: rh,
244 | author: l.author,
245 | o: {
246 | src: l.src,
247 | w: this.width,
248 | h: this.height,
249 | },
250 | m: {
251 | src: l.src,
252 | w: this.width,
253 | h: this.height,
254 | }
255 | };
256 | items[index]=item
257 | count++
258 | if(count==thumbElements.length){
259 | resolve(items)
260 | }
261 | }
262 | }
263 |
264 |
265 | }
266 | })
267 |
268 | return items
269 |
270 | },
271 | extend(o1, o2) {
272 | for (var prop in o2) {
273 | o1[prop] = o2[prop];
274 | }
275 | return o1
276 | },
277 | initPreview(gallerySelector){
278 | this.galleryElements = document.querySelectorAll(gallerySelector);
279 | for(var i = 0, l = this.galleryElements.length; i < l; i++) {
280 | this.galleryElements[i].setAttribute('data-pswp-uid', i + 1);
281 | this.galleryElements[i].onclick = this.onThumbnailsClick;
282 | }
283 |
284 | }
285 | },
286 | mounted: function () {
287 | this.initPreview('img[preview]')
288 |
289 | }
290 | })
291 |
292 | }
293 | }
294 |
295 | export default vuePhotoPreview
296 |
297 | if (typeof window !== 'undefined' && !window.vuePhotoPreview) {
298 | window.vuePhotoPreview=vuePhotoPreview;
299 | }
--------------------------------------------------------------------------------
/dist/vue-photo-preview.js:
--------------------------------------------------------------------------------
1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-photo-preview",[],t):"object"==typeof exports?exports["vue-photo-preview"]=t():e["vue-photo-preview"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=1)}([function(e,t,n){"use strict";var o=n(7),i=(n.n(o),n(8));n.n(i);t.a={}},function(e,t,n){"use strict";function o(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function o(i,r){try{var a=t[i](r),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){o("next",e)},function(e){o("throw",e)});e(l)}return o("next")})}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),r=n.n(i),a=n(5),l=n(10),s=n.n(l),u=n(11),c=n.n(u),d=void 0,p={install:function(e,t){var n=e.extend(a.a),t=t||{};d||(d=new n({el:document.createElement("div")}),document.body.appendChild(d.$el));var i=void 0,l=void 0;e.prototype.$preview={self:null,on:function(e,t){i=e,l=t}},e.mixin({data:function(){return{galleryElements:null,galleryPicLoading:!1}},methods:{$previewRefresh:function(){var e=this;setTimeout(function(){e.galleryElements=document.querySelectorAll("img[preview]");for(var t=0,n=e.galleryElements.length;t=0&&(this.openPhotoSwipe(i,r),this.$emit("preview-open",e,n.src)),!1},openPhotoSwipe:function(n,a,u,p){var f=this;return o(r.a.mark(function o(){var m,h,v,g,w,y,x,b,_;return r.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return m=document.querySelectorAll(".pswp")[0],o.next=3,f.parseThumbnailElements(a);case 3:if(g=o.sent,v={getThumbBoundsFn:function(e){var t=g[e].el,n=window.pageYOffset||document.documentElement.scrollTop,o=t.getBoundingClientRect();return{x:o.left,y:o.top+n,w:o.width}},addCaptionHTMLFn:function(e,t,n){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerText="",!1)},showHideOpacity:!0,history:!1,shareEl:!1,maxSpreadZoom:3,getDoubleTapZoom:function(e,t){return e?1.5:t.initialZoomLevel<.7?1:1.5}},!p){o.next=20;break}if(!v.galleryPIDs){o.next=17;break}w=0;case 8:if(!(w=1200||!h.likelyTouchDevice&&y>800||screen.width>1200?x||(x=!0,_=!0):x&&(x=!1,_=!0),_&&!b&&h.invalidateCurrItems(),b&&(b=!1),_=!1}),h.listen("gettingData",function(e,t){t.el.getAttribute("large")?(t.src=t.o.src,t.w=t.o.w,t.h=t.o.h):(t.src=t.m.src,t.w=t.m.w,t.h=t.m.h)}),h.listen("imageLoadComplete",function(e,t){f.galleryPicLoading=!1}),h.listen(i,l),h.init(),d.$el.classList=d.$el.classList+" pswp--zoom-allowed";case 34:case"end":return o.stop()}},o,f)}))()},parseThumbnailElements:function(e){return new Promise(function(t){var n,o,i=[];o={};for(var r=0;r=0,r=i&&o.regeneratorRuntime;if(o.regeneratorRuntime=void 0,e.exports=n(4),i)o.regeneratorRuntime=r;else try{delete o.regeneratorRuntime}catch(e){o.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,o){var r=t&&t.prototype instanceof i?t:i,a=Object.create(r.prototype),l=new f(o||[]);return a._invoke=u(e,n,l),a}function o(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function r(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,i,r,a){var l=o(e[n],e,i);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&w.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,r,a)},function(e){t("throw",e,r,a)}):Promise.resolve(u).then(function(e){s.value=e,r(s)},a)}a(l.arg)}function n(e,n){function o(){return new Promise(function(o,i){t(e,n,o,i)})}return i=i?i.then(o,o):o()}var i;this._invoke=n}function u(e,t,n){var i=E;return function(r,a){if(i===S)throw new Error("Generator is already running");if(i===k){if("throw"===r)throw a;return h()}for(n.method=r,n.arg=a;;){var l=n.delegate;if(l){var s=c(l,n);if(s){if(s===D)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===E)throw i=k,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=S;var u=o(e,t,n);if("normal"===u.type){if(i=n.done?k:I,u.arg===D)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=k,n.method="throw",n.arg=u.arg)}}}function c(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,c(e,t),"throw"===t.method))return D;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return D}var i=o(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,D;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,D):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,D)}function d(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(d,this),this.reset(!0)}function m(e){if(e){var t=e[x];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=w.call(i,"catchLoc"),l=w.call(i,"finallyLoc");if(a&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&w.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),D}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;p(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:m(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),D}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";var o=n(0),i=n(9),r=n(6),a=r(o.a,i.a,!1,null,null,null);t.a=a.exports},function(e,t){e.exports=function(e,t,n,o,i,r){var a,l=e=e||{},s=typeof e.default;"object"!==s&&"function"!==s||(a=e,l=e.default);var u="function"==typeof l?l.options:l;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),i&&(u._scopeId=i);var c;if(r?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},u._ssrRegister=c):o&&(c=o),c){var d=u.functional,p=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),p(e,t)}):u.beforeCreate=p?[].concat(p,c):[c]}return{esModule:a,exports:l,options:u}}},function(e,t){},function(e,t){},function(e,t,n){"use strict";var o=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},i=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pswp",attrs:{tabindex:"-1",role:"dialog","aria-hidden":"true"}},[n("div",{staticClass:"pswp__bg"}),e._v(" "),n("div",{staticClass:"pswp__scroll-wrap"},[n("div",{staticClass:"pswp__container"},[n("div",{staticClass:"pswp__item"}),e._v(" "),n("div",{staticClass:"pswp__item"}),e._v(" "),n("div",{staticClass:"pswp__item"})]),e._v(" "),n("div",{staticClass:"pswp__ui pswp__ui--hidden"},[n("div",{staticClass:"pswp__top-bar"},[n("div",{staticClass:"pswp__counter"}),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--close",attrs:{title:"Close (Esc)"}}),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--share",attrs:{title:"Share"}}),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--fs",attrs:{title:"Toggle fullscreen"}}),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--zoom",attrs:{title:"Zoom in/out"}}),e._v(" "),n("div",{staticClass:"pswp__preloader"},[n("div",{staticClass:"pswp__preloader__icn"},[n("div",{staticClass:"pswp__preloader__cut"},[n("div",{staticClass:"pswp__preloader__donut"})])])])]),e._v(" "),n("div",{staticClass:"pswp__share-modal pswp__share-modal--hidden pswp__single-tap"},[n("div",{staticClass:"pswp__share-tooltip"})]),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--arrow--left",attrs:{title:"Previous (arrow left)"}}),e._v(" "),n("button",{staticClass:"pswp__button pswp__button--arrow--right",attrs:{title:"Next (arrow right)"}}),e._v(" "),n("div",{staticClass:"pswp__caption"},[n("div",{staticClass:"pswp__caption__center"})])])])])}],r={render:o,staticRenderFns:i};t.a=r},function(e,t,n){var o,i;/*! PhotoSwipe - v4.1.3 - 2019-01-08
2 | * http://photoswipe.com
3 | * Copyright (c) 2019 Dmitry Semenov; */
4 | !function(r,a){o=a,void 0!==(i="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=i)}(0,function(){"use strict";return function(e,t,n,o){var i={features:null,bind:function(e,t,n,o){var i=(o?"remove":"add")+"EventListener";t=t.split(" ");for(var r=0;r0&&(a=parseInt(a[1],10))>=1&&a<8&&(o.isOldIOSPhone=!0)}var l=r.match(/Android\s([0-9\.]*)/),s=l?l[1]:0;s=parseFloat(s),s>=1&&(s<4.4&&(o.isOldAndroid=!0),o.androidVersion=s),o.isMobileOpera=/opera mini|opera mobi/i.test(r)}for(var u,c,d=["transform","perspective","animationName"],p=["","webkit","Moz","ms","O"],f=0;f<4;f++){n=p[f];for(var m=0;m<3;m++)u=d[m],c=n+(n?u.charAt(0).toUpperCase()+u.slice(1):u),!o[u]&&c in t&&(o[u]=c);n&&!o.raf&&(n=n.toLowerCase(),o.raf=window[n+"RequestAnimationFrame"],o.raf&&(o.caf=window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"]))}if(!o.raf){var h=0;o.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-h)),o=window.setTimeout(function(){e(t+n)},n);return h=t+n,o},o.caf=function(e){clearTimeout(e)}}return o.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,i.features=o,o}};i.detectFeatures(),i.features.oldIE&&(i.bind=function(e,t,n,o){t=t.split(" ");for(var i,r=(o?"detach":"attach")+"Event",a=function(){n.handleEvent.call(n)},l=0;lt-1?e-t:e<0?t+e:e},Ee={},Ie=function(e,t){return Ee[e]||(Ee[e]=[]),Ee[e].push(t)},Se=function(e){var t=Ee[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var o=0;or.currItem.fitRatio?_e||(un(r.currItem,!1,!0),_e=!0):_e&&(un(r.currItem),_e=!1)),Oe(ne,fe.x,fe.y,v))},Fe=function(e){e.container&&Oe(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Ae=function(e,t){t[k]=w+e+"px, 0px"+y},Me=function(e,t){if(!a.loop&&t){var n=c+(ge.x*he-e)/ge.x,o=Math.round(e-ht.x);(n<0&&o>0||n>=Vt()-1&&o<0)&&(e=ht.x+o*a.mainScrollEndFriction)}ht.x=e,Ae(e,d)},Re=function(e,t){var n=vt[e]-ve[e];return pe[e]+de[e]+n-n*(t/g)},Pe=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Ze=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},ze=null,Ne=function(){ze&&(i.unbind(document,"mousemove",Ne),i.addClass(e,"pswp--has_mouse"),a.mouseUsed=!0,Se("mouseUsed")),ze=setTimeout(function(){ze=null},100)},Ue=function(){i.bind(document,"keydown",r),Z.transform&&i.bind(r.scrollWrap,"click",r),a.mouseUsed||i.bind(document,"mousemove",Ne),i.bind(window,"resize scroll orientationchange",r),Se("bindEvents")},Ke=function(){i.unbind(window,"resize scroll orientationchange",r),i.unbind(window,"scroll",h.scroll),i.unbind(document,"keydown",r),i.unbind(document,"mousemove",Ne),Z.transform&&i.unbind(r.scrollWrap,"click",r),G&&i.unbind(window,f,r),clearTimeout(z),Se("unbindEvents")},He=function(e,t){var n=rn(r.currItem,me,e);return t&&(te=n),n},We=function(e){return e||(e=r.currItem),e.initialZoomLevel},Be=function(e){return e||(e=r.currItem),e.w>0?a.maxSpreadZoom:1},Ge=function(e,t,n,o){return o===r.currItem.initialZoomLevel?(n[e]=r.currItem.initialPosition[e],!0):(n[e]=Re(e,o),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]1?1:e.fitRatio,n=e.container.style,o=t*e.w,i=t*e.h;n.width=o+"px",n.height=i+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},Le=function(){if(ne){var e=ne,t=r.currItem,n=t.fitRatio>1?1:t.fitRatio,o=n*t.w,i=n*t.h;e.width=o+"px",e.height=i+"px",e.left=fe.x+"px",e.top=fe.y+"px"}}},je=function(e){var t="";a.escKey&&27===e.keyCode?t="close":a.arrowKeys&&(37===e.keyCode?t="prev":39===e.keyCode&&(t="next")),t&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(e.preventDefault?e.preventDefault():e.returnValue=!1,r[t]()))},qe=function(e){e&&(q||j||oe||W)&&(e.preventDefault(),e.stopPropagation())},$e=function(){r.setScrollOffset(0,i.getScrollY())},Ve={},Xe=0,Je=function(e){Ve[e]&&(Ve[e].raf&&F(Ve[e].raf),Xe--,delete Ve[e])},Qe=function(e){Ve[e]&&Je(e),Ve[e]||(Xe++,Ve[e]={})},et=function(){for(var e in Ve)Ve.hasOwnProperty(e)&&Je(e)},tt=function(e,t,n,o,i,r,a){var l,s=ke();Qe(e);var u=function(){if(Ve[e]){if((l=ke()-s)>=o)return Je(e),r(n),void(a&&a());r((n-t)*i(l/o)+t),Ve[e].raf=L(u)}};u()},nt={shout:Se,listen:Ie,viewportSize:me,options:a,isMainScrollAnimating:function(){return oe},getZoomLevel:function(){return v},getCurrentIndex:function(){return c},isDragging:function(){return G},isZooming:function(){return J},setScrollOffset:function(e,t){ve.x=e,P=ve.y=t,Se("updateScrollOffset",ve)},applyZoomPan:function(e,t,n,o){fe.x=t,fe.y=n,v=e,Le(o)},init:function(){if(!l&&!s){var n;r.framework=i,r.template=e,r.bg=i.getChildByClass(e,"pswp__bg"),A=e.className,l=!0,Z=i.detectFeatures(),L=Z.raf,F=Z.caf,k=Z.transform,R=Z.oldIE,r.scrollWrap=i.getChildByClass(e,"pswp__scroll-wrap"),r.container=i.getChildByClass(r.scrollWrap,"pswp__container"),d=r.container.style,r.itemHolders=_=[{el:r.container.children[0],wrap:0,index:-1},{el:r.container.children[1],wrap:0,index:-1},{el:r.container.children[2],wrap:0,index:-1}],_[0].el.style.display=_[2].el.style.display="none",Ye(),h={resize:r.updateSize,orientationchange:function(){clearTimeout(z),z=setTimeout(function(){me.x!==r.scrollWrap.clientWidth&&r.updateSize()},500)},scroll:$e,keydown:je,click:qe};var o=Z.isOldIOSPhone||Z.isOldAndroid||Z.isMobileOpera;for(Z.animationName&&Z.transform&&!o||(a.showAnimationDuration=a.hideAnimationDuration=0),n=0;n=Vt())&&(c=0),r.currItem=$t(c),(Z.isOldIOSPhone||Z.isOldAndroid)&&(ye=!1),e.setAttribute("aria-hidden","false"),a.modal&&(ye?e.style.position="fixed":(e.style.position="absolute",e.style.top=i.getScrollY()+"px")),void 0===P&&(Se("initialLayout"),P=M=i.getScrollY());var u="pswp--open ";for(a.mainClass&&(u+=a.mainClass+" "),a.showHideOpacity&&(u+="pswp--animate_opacity "),u+=O?"pswp--touch":"pswp--notouch",u+=Z.animationName?" pswp--css_animation":"",u+=Z.svg?" pswp--svg":"",i.addClass(e,u),r.updateSize(),p=-1,we=null,n=0;n<3;n++)Ae((n+p)*ge.x,_[n].el.style);R||i.bind(r.scrollWrap,m,r),Ie("initialZoomInEnd",function(){r.setContent(_[0],c-1),r.setContent(_[2],c+1),_[0].el.style.display=_[2].el.style.display="block",a.focus&&e.focus(),Ue()}),r.setContent(_[1],c),r.updateCurrItem(),Se("afterInit"),ye||(x=setInterval(function(){Xe||G||J||v!==r.currItem.initialZoomLevel||r.updateSize()},1e3)),i.addClass(e,"pswp--visible")}},close:function(){l&&(l=!1,s=!0,Se("close"),Ke(),Jt(r.currItem,null,!0,r.destroy))},destroy:function(){Se("destroy"),Gt&&clearTimeout(Gt),e.setAttribute("aria-hidden","true"),e.className=A,x&&clearInterval(x),i.unbind(r.scrollWrap,m,r),i.unbind(window,"scroll",r),bt(),et(),Ee=null},panTo:function(e,t,n){n||(e>te.min.x?e=te.min.x:ete.min.y?t=te.min.y:t=3&&(p+=we+(we>0?-3:3),n=3);for(var o=0;o0?(t=_.shift(),_[2]=t,p++,Ae((p+2)*ge.x,t.el.style),r.setContent(t,c-n+o+1+1)):(t=_.pop(),_.unshift(t),p--,Ae(p*ge.x,t.el.style),r.setContent(t,c+n-o-1-1));if(ne&&1===Math.abs(we)){var i=$t(C);i.initialZoomLevel!==v&&(rn(i,me),un(i),Fe(i))}we=0,r.updateCurrZoomItem(),C=c,Se("afterChange")}}},updateSize:function(t){if(!ye&&a.modal){var n=i.getScrollY();if(P!==n&&(e.style.top=n+"px",P=n),!t&&be.x===window.innerWidth&&be.y===window.innerHeight)return;be.x=window.innerWidth,be.y=window.innerHeight,e.style.height=be.y+"px"}if(me.x=r.scrollWrap.clientWidth,me.y=r.scrollWrap.clientHeight,$e(),ge.x=me.x+Math.round(me.x*a.spacing),ge.y=me.y,Me(ge.x*he),Se("beforeResize"),void 0!==p){for(var o,l,s,u=0;u<3;u++)o=_[u],Ae((u+p)*ge.x,o.el.style),s=c+u-1,a.loop&&Vt()>2&&(s=Te(s)),l=$t(s),l&&(b||l.needsUpdate||!l.bounds)?(r.cleanSlide(l),r.setContent(o,s),1===u&&(r.currItem=l,r.updateCurrZoomItem(!0)),l.needsUpdate=!1):-1===o.index&&s>=0&&r.setContent(o,s),l&&l.container&&(rn(l,me),un(l),Fe(l));b=!1}g=v=r.currItem.initialZoomLevel,te=r.currItem.bounds,te&&(fe.x=te.center.x,fe.y=te.center.y,Le(!0)),Se("resize")},zoomTo:function(e,t,n,o,r){t&&(g=v,vt.x=Math.abs(t.x)-fe.x,vt.y=Math.abs(t.y)-fe.y,Pe(pe,fe));var a=He(e,!1),l={};Ge("x",a,l,e),Ge("y",a,l,e);var s=v,u={x:fe.x,y:fe.y};Ze(l);var c=function(t){1===t?(v=e,fe.x=l.x,fe.y=l.y):(v=(e-s)*t+s,fe.x=(l.x-u.x)*t+u.x,fe.y=(l.y-u.y)*t+u.y),r&&r(t),Le(1===t)};n?tt("customZoomTo",0,1,n,o||i.easing.sine.inOut,c):c(1)}},ot={},it={},rt={},at={},lt={},st=[],ut={},ct=[],dt={},pt=0,ft=ce(),mt=0,ht=ce(),vt=ce(),gt=ce(),wt=function(e,t){return e.x===t.x&&e.y===t.y},yt=function(e,t){return Math.abs(e.x-t.x)<25&&Math.abs(e.y-t.y)<25},xt=function(e,t){return dt.x=Math.abs(e.x-t.x),dt.y=Math.abs(e.y-t.y),Math.sqrt(dt.x*dt.x+dt.y*dt.y)},bt=function(){$&&(F($),$=null)},_t=function(){G&&($=L(_t),zt())},Ct=function(){return!("fit"===a.scaleMode&&v===r.currItem.initialZoomLevel)},Tt=function(e,t){return!(!e||e===document)&&(!(e.getAttribute("class")&&e.getAttribute("class").indexOf("pswp__scroll-wrap")>-1)&&(t(e)?e:Tt(e.parentNode,t)))},Et={},It=function(e,t){return Et.prevent=!Tt(e.target,a.isClickableElement),Se("preventDragEvent",e,t,Et),Et.prevent},St=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},kt=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},Dt=function(e,t,n){if(e-U>50){var o=ct.length>2?ct.shift():{};o.x=t,o.y=n,ct.push(o),U=e}},Ot=function(){var e=fe.y-r.currItem.initialPosition.y;return 1-Math.abs(e/(me.y/2))},Lt={},Ft={},At=[],Mt=function(e){for(;At.length>0;)At.pop();return D?(ue=0,st.forEach(function(e){0===ue?At[0]=e:1===ue&&(At[1]=e),ue++})):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(At[0]=St(e.touches[0],Lt),e.touches.length>1&&(At[1]=St(e.touches[1],Ft))):(Lt.x=e.pageX,Lt.y=e.pageY,Lt.id="",At[0]=Lt),At},Rt=function(e,t){var n,o,i,l,s=fe[e]+t[e],u=t[e]>0,c=ht.x+t.x,d=ht.x-ut.x;if(n=s>te.min[e]||ste.min[e]&&(n=a.panEndFriction,te.min[e]-s,o=te.min[e]-pe[e]),(o<=0||d<0)&&Vt()>1?(l=c,d<0&&c>ut.x&&(l=ut.x)):te.min.x!==te.max.x&&(i=s)):(s0)&&Vt()>1?(l=c,d>0&&cr.currItem.fitRatio&&(fe[e]+=t[e]*n)},Pt=function(e){if(!("mousedown"===e.type&&e.button>0)){if(qt)return void e.preventDefault();if(!B||"mousedown"!==e.type){if(It(e,!0)&&e.preventDefault(),Se("pointerDown"),D){var t=i.arraySearch(st,e.pointerId,"id");t<0&&(t=st.length),st[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Mt(e),o=n.length;X=null,et(),G&&1!==o||(G=re=!0,i.bind(window,f,r),H=se=ae=W=V=q=Y=j=!1,ie=null,Se("firstTouchStart",n),Pe(pe,fe),de.x=de.y=0,Pe(at,n[0]),Pe(lt,at),ut.x=ge.x*he,ct=[{x:at.x,y:at.y}],U=N=ke(),He(v,!0),bt(),_t()),!J&&o>1&&!oe&&!V&&(g=v,j=!1,J=Y=!0,de.y=de.x=0,Pe(pe,fe),Pe(ot,n[0]),Pe(it,n[1]),kt(ot,it,gt),vt.x=Math.abs(gt.x)-fe.x,vt.y=Math.abs(gt.y)-fe.y,Q=ee=xt(ot,it))}}},Zt=function(e){if(e.preventDefault(),D){var t=i.arraySearch(st,e.pointerId,"id");if(t>-1){var n=st[t];n.x=e.pageX,n.y=e.pageY}}if(G){var o=Mt(e);if(ie||q||J)X=o;else if(ht.x!==ge.x*he)ie="h";else{var r=Math.abs(o[0].x-at.x)-Math.abs(o[0].y-at.y);Math.abs(r)>=10&&(ie=r>0?"h":"v",X=o)}}},zt=function(){if(X){var e=X.length;if(0!==e)if(Pe(ot,X[0]),rt.x=ot.x-at.x,rt.y=ot.y-at.y,J&&e>1){if(at.x=ot.x,at.y=ot.y,!rt.x&&!rt.y&&wt(X[1],it))return;Pe(it,X[1]),j||(j=!0,Se("zoomGestureStarted"));var t=xt(ot,it),n=Wt(t);n>r.currItem.initialZoomLevel+r.currItem.initialZoomLevel/15&&(se=!0);var o=1,i=We(),l=Be();if(n1&&(o=1),n=i-o*(i/3);else n>l&&(o=(n-l)/(6*i),o>1&&(o=1),n=l+o*i);o<0&&(o=0),Q=t,kt(ot,it,ft),de.x+=ft.x-gt.x,de.y+=ft.y-gt.y,Pe(gt,ft),fe.x=Re("x",n),fe.y=Re("y",n),H=n>v,v=n,Le()}else{if(!ie)return;if(re&&(re=!1,Math.abs(rt.x)>=10&&(rt.x-=X[0].x-lt.x),Math.abs(rt.y)>=10&&(rt.y-=X[0].y-lt.y)),at.x=ot.x,at.y=ot.y,0===rt.x&&0===rt.y)return;if("v"===ie&&a.closeOnVerticalDrag&&!Ct()){de.y+=rt.y,fe.y+=rt.y;var c=Ot();return W=!0,Se("onVerticalDrag",c),De(c),void Le()}Dt(ke(),ot.x,ot.y),q=!0,te=r.currItem.bounds;var d=Rt("x",rt);d||(Rt("y",rt),Ze(fe),Le())}}},Nt=function(e){if(Z.isOldAndroid){if(B&&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&&(clearTimeout(B),B=setTimeout(function(){B=0},600))}Se("pointerUp"),It(e,!1)&&e.preventDefault();var t;if(D){var n=i.arraySearch(st,e.pointerId,"id");if(n>-1)if(t=st.splice(n,1)[0],navigator.msPointerEnabled){var o={4:"mouse",2:"touch",3:"pen"};t.type=o[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}else t.type=e.pointerType||"mouse"}var l,s=Mt(e),u=s.length;if("mouseup"===e.type&&(u=0),2===u)return X=null,!0;1===u&&Pe(lt,s[0]),0!==u||ie||oe||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),Se("touchRelease",e,t));var c=-1;if(0===u&&(G=!1,i.unbind(window,f,r),bt(),J?c=0:-1!==mt&&(c=ke()-mt)),mt=1===u?ke():-1,l=-1!==c&&c<150?"zoom":"swipe",J&&u<2&&(J=!1,1===u&&(l="zoomPointerUp"),Se("zoomGestureEnded")),X=null,q||j||oe||W)if(et(),K||(K=Ut()),K.calculateSwipeSpeed("x"),W){var d=Ot();if(dr.currItem.fitRatio&&Kt(K))}},Ut=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(o){ct.length>1?(e=ke()-U+50,t=ct[ct.length-2][o]):(e=ke()-N,t=lt[o]),n.lastFlickOffset[o]=at[o]-t,n.lastFlickDist[o]=Math.abs(n.lastFlickOffset[o]),n.lastFlickDist[o]>20?n.lastFlickSpeed[o]=n.lastFlickOffset[o]/e:n.lastFlickSpeed[o]=0,Math.abs(n.lastFlickSpeed[o])<.1&&(n.lastFlickSpeed[o]=0),n.slowDownRatio[o]=.95,n.slowDownRatioReverse[o]=1-n.slowDownRatio[o],n.speedDecelerationRatio[o]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(fe[e]>te.min[e]?n.backAnimDestination[e]=te.min[e]:fe[e]30&&(s||t.lastFlickOffset.x>20)?o=-1:l<-30&&(s||t.lastFlickOffset.x<-20)&&(o=1)}var u;o&&(c+=o,c<0?(c=a.loop?Vt()-1:0,u=!0):c>=Vt()&&(c=a.loop?0:Vt()-1,u=!0),u&&!a.loop||(we+=o,he-=o,n=!0));var d,p=ge.x*he,f=Math.abs(p-ht.x);return n||p>ht.x==t.lastFlickSpeed.x>0?(d=Math.abs(t.lastFlickSpeed.x)>0?f/Math.abs(t.lastFlickSpeed.x):333,d=Math.min(d,400),d=Math.max(d,250)):d=333,pt===c&&(n=!1),oe=!0,Se("mainScrollAnimStart"),tt("mainScroll",ht.x,p,d,i.easing.cubic.out,Me,function(){et(),oe=!1,pt=-1,(n||pt!==c)&&r.updateCurrItem(),Se("mainScrollAnimComplete")}),n&&r.updateCurrItem(!0),n},Wt=function(e){return 1/ee*e*g},Bt=function(){var e=v,t=We(),n=Be();vn&&(e=n);var o,a=le;return ae&&!H&&!se&&v1||navigator.msMaxTouchPoints>1),r.likelyTouchDevice=O,h[T]=Pt,h[E]=Zt,h[I]=Nt,S&&(h[S]=h[I]),Z.touch&&(m+=" mousedown",f+=" mousemove mouseup",h.mousedown=h[T],h.mousemove=h[E],h.mouseup=h[I]),O||(a.allowPanToNext=!1)}}});var Gt,Yt,jt,qt,$t,Vt,Xt,Jt=function(t,n,o,l){Gt&&clearTimeout(Gt),qt=!0,jt=!0;var s;t.initialLayout?(s=t.initialLayout,t.initialLayout=null):s=a.getThumbBoundsFn&&a.getThumbBoundsFn(c);var d=o?a.hideAnimationDuration:a.showAnimationDuration,p=function(){Je("initialZoom"),o?(r.template.removeAttribute("style"),r.bg.removeAttribute("style")):(De(1),n&&(n.style.display="block"),i.addClass(e,"pswp--animated-in"),Se("initialZoom"+(o?"OutEnd":"InEnd"))),l&&l(),qt=!1};if(!d||!s||void 0===s.x)return Se("initialZoom"+(o?"Out":"In")),v=t.initialZoomLevel,Pe(fe,t.initialPosition),Le(),e.style.opacity=o?0:1,De(1),void(d?setTimeout(function(){p()},d):p());!function(){var n=u,l=!r.currItem.src||r.currItem.loadError||a.showHideOpacity;t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),o||(v=s.w/t.w,fe.x=s.x,fe.y=s.y-M,r[l?"template":"bg"].style.opacity=.001,Le()),Qe("initialZoom"),o&&!n&&i.removeClass(e,"pswp--animated-in"),l&&(o?i[(n?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout(function(){i.addClass(e,"pswp--animate_opacity")},30)),Gt=setTimeout(function(){if(Se("initialZoom"+(o?"Out":"In")),o){var r=s.w/t.w,a={x:fe.x,y:fe.y},u=v,c=le,f=function(t){1===t?(v=r,fe.x=s.x,fe.y=s.y-P):(v=(r-u)*t+u,fe.x=(s.x-a.x)*t+a.x,fe.y=(s.y-P-a.y)*t+a.y),Le(),l?e.style.opacity=1-t:De(c-t*c)};n?tt("initialZoom",0,1,d,i.easing.cubic.out,f,p):(f(1),Gt=setTimeout(p,d+20))}else v=t.initialZoomLevel,Pe(fe,t.initialPosition),Le(),De(1),l?e.style.opacity=1:De(1),Gt=setTimeout(p,d+20)},o?25:90)}()},Qt={},en=[],tn={index:0,errorMsg:'',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Yt.length}},nn=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},on=function(e,t,n){var o=e.bounds;o.center.x=Math.round((Qt.x-t)/2),o.center.y=Math.round((Qt.y-n)/2)+e.vGap.top,o.max.x=t>Qt.x?Math.round(Qt.x-t):o.center.x,o.max.y=n>Qt.y?Math.round(Qt.y-n)+e.vGap.top:o.center.y,o.min.x=t>Qt.x?0:o.center.x,o.min.y=n>Qt.y?e.vGap.top:o.center.y},rn=function(e,t,n){if(e.src&&!e.loadError){var o=!n;if(o&&(e.vGap||(e.vGap={top:0,bottom:0}),Se("parseVerticalMargin",e)),Qt.x=t.x,Qt.y=t.y-e.vGap.top-e.vGap.bottom,o){var i=Qt.x/e.w,r=Qt.y/e.h;e.fitRatio=i1&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds=nn())}if(!n)return;return on(e,e.w*n,e.h*n),o&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds=nn(),e.initialPosition=e.bounds.center,e.bounds},an=function(e,t,n,o,i,a){t.loadError||o&&(t.imageAppended=!0,un(t,o,t===r.currItem&&_e),n.appendChild(o),a&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))},ln=function(e){e.loading=!0,e.loaded=!1;var t=e.img=i.createEl("pswp__img","img"),n=function(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=n,t.onerror=function(){e.loadError=!0,n()},t.src=e.src,t},sn=function(e,t){if(e.src&&e.loadError&&e.container)return t&&(e.container.innerHTML=""),e.container.innerHTML=a.errorMsg.replace("%url%",e.src),!0},un=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var o=n?e.w:Math.round(e.w*e.fitRatio),i=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=o+"px",e.placeholder.style.height=i+"px"),t.style.width=o+"px",t.style.height=i+"px"}},cn=function(){if(en.length){for(var e,t=0;t=0,i=Math.min(n[0],Vt()),l=Math.min(n[1],Vt());for(t=1;t<=(o?l:i);t++)r.lazyLoadItem(c+t);for(t=1;t<=(o?i:l);t++)r.lazyLoadItem(c-t)}),Ie("initialLayout",function(){r.currItem.initialLayout=a.getThumbBoundsFn&&a.getThumbBoundsFn(c)}),Ie("mainScrollAnimComplete",cn),Ie("initialZoomInEnd",cn),Ie("destroy",function(){for(var e,t=0;t=0&&(void 0!==Yt[e]&&Yt[e])},allowProgressiveImg:function(){return a.forceProgressiveLoading||!O||a.mouseUsed||screen.width>1200},setContent:function(e,t){a.loop&&(t=Te(t));var n=r.getItemAt(e.index);n&&(n.container=null);var o,s=r.getItemAt(t);if(!s)return void(e.el.innerHTML="");Se("gettingData",t,s),e.index=t,e.item=s;var u=s.container=i.createEl("pswp__zoom-wrap");if(!s.src&&s.html&&(s.html.tagName?u.appendChild(s.html):u.innerHTML=s.html),sn(s),rn(s,me),!s.src||s.loadError||s.loaded)s.src&&!s.loadError&&(o=i.createEl("pswp__img","img"),o.style.opacity=1,o.src=s.src,un(s,o),an(0,s,u,o));else{if(s.loadComplete=function(n){if(l){if(e&&e.index===t){if(sn(n,!0))return n.loadComplete=n.img=null,rn(n,me),Fe(n),void(e.index===c&&r.updateCurrZoomItem());n.imageAppended?!qt&&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):Z.transform&&(oe||qt)?en.push({item:n,baseDiv:u,img:n.img,index:t,holder:e,clearPlaceholder:!0}):an(0,n,u,n.img,0,!0)}n.loadComplete=null,n.img=null,Se("imageLoadComplete",t,n)}},i.features.transform){var d="pswp__img pswp__img--placeholder";d+=s.msrc?"":" pswp__img--placeholder--blank";var p=i.createEl(d,s.msrc?"img":"");s.msrc&&(p.src=s.msrc),un(s,p),u.appendChild(p),s.placeholder=p}s.loading||ln(s),r.allowProgressiveImg()&&(!jt&&Z.transform?en.push({item:s,baseDiv:u,img:s.img,index:t,holder:e}):an(0,s,u,s.img,0,!0))}jt||t!==c?Fe(s):(ne=u.style,Jt(s,o||s.img)),e.el.innerHTML="",e.el.appendChild(u)},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var dn,pn={},fn=function(e,t,n){var o=document.createEvent("CustomEvent"),i={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};o.initCustomEvent("pswpTap",!0,!0,i),e.target.dispatchEvent(o)};Ce("Tap",{publicMethods:{initTap:function(){Ie("firstTouchStart",r.onTapStart),Ie("touchRelease",r.onTapRelease),Ie("destroy",function(){pn={},dn=null})},onTapStart:function(e){e.length>1&&(clearTimeout(dn),dn=null)},onTapRelease:function(e,t){if(t&&!q&&!Y&&!Xe){var n=t;if(dn&&(clearTimeout(dn),dn=null,yt(n,pn)))return void Se("doubleTap",n);if("mouse"===t.type)return void fn(e,t,"mouse");if("BUTTON"===e.target.tagName.toUpperCase()||i.hasClass(e.target,"pswp__single-tap"))return void fn(e,t);Pe(pn,n),dn=setTimeout(function(){fn(e,t),dn=null},300)}}}});var mn;Ce("DesktopZoom",{publicMethods:{initDesktopZoom:function(){R||(O?Ie("mouseUsed",function(){r.setupDesktopZoom()}):r.setupDesktopZoom(!0))},setupDesktopZoom:function(t){mn={};var n="wheel mousewheel DOMMouseScroll";Ie("bindEvents",function(){i.bind(e,n,r.handleMouseWheel)}),Ie("unbindEvents",function(){mn&&i.unbind(e,n,r.handleMouseWheel)}),r.mouseZoomedIn=!1;var o,a=function(){r.mouseZoomedIn&&(i.removeClass(e,"pswp--zoomed-in"),r.mouseZoomedIn=!1),v<1?i.addClass(e,"pswp--zoom-allowed"):i.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){o&&(i.removeClass(e,"pswp--dragging"),o=!1)};Ie("resize",a),Ie("afterChange",a),Ie("pointerDown",function(){r.mouseZoomedIn&&(o=!0,i.addClass(e,"pswp--dragging"))}),Ie("pointerUp",l),t||a()},handleMouseWheel:function(e){if(v<=r.currItem.fitRatio)return a.modal&&(!a.closeOnScroll||Xe||G?e.preventDefault():k&&Math.abs(e.deltaY)>2&&(u=!0,r.close())),!0;if(e.stopPropagation(),mn.x=0,"deltaX"in e)1===e.deltaMode?(mn.x=18*e.deltaX,mn.y=18*e.deltaY):(mn.x=e.deltaX,mn.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(mn.x=-.16*e.wheelDeltaX),e.wheelDeltaY?mn.y=-.16*e.wheelDeltaY:mn.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;mn.y=e.detail}He(v,!0);var t=fe.x-mn.x,n=fe.y-mn.y;(a.modal||t<=te.min.x&&t>=te.max.x&&n<=te.min.y&&n>=te.max.y)&&e.preventDefault(),r.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:me.x/2+ve.x,y:me.y/2+ve.y};var n=a.getDoubleTapZoom(!0,r.currItem),o=v===n;r.mouseZoomedIn=!o,r.zoomTo(o?r.currItem.initialZoomLevel:n,t,333),i[(o?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var hn,vn,gn,wn,yn,xn,bn,_n,Cn,Tn,En,In,Sn={history:!0,galleryUID:1},kn=function(){return En.hash.substring(1)},Dn=function(){hn&&clearTimeout(hn),gn&&clearTimeout(gn)},On=function(){var e=kn(),t={};if(e.length<5)return t;var n,o=e.split("&");for(n=0;n-1&&(bn=bn.split("&gid=")[0],bn=bn.split("?gid=")[0]),Ie("afterChange",r.updateURL),Ie("unbindEvents",function(){i.unbind(window,"hashchange",r.onHashChange)});var e=function(){xn=!0,Cn||(Tn?history.back():bn?En.hash=bn:In?history.pushState("",document.title,En.pathname+En.search):En.hash=""),Dn()};Ie("unbindEvents",function(){u&&e()}),Ie("destroy",function(){xn||e()}),Ie("firstUpdate",function(){c=On().pid});var t=bn.indexOf("pid=");t>-1&&(bn=bn.substring(0,t),"&"===bn.slice(-1)&&(bn=bn.slice(0,-1))),setTimeout(function(){l&&i.bind(window,"hashchange",r.onHashChange)},40)}},onHashChange:function(){if(kn()===bn)return Cn=!0,void r.close();wn||(yn=!0,r.goTo(On().pid),yn=!1)},updateURL:function(){Dn(),yn||(_n?hn=setTimeout(Ln,800):Ln())}}}),i.extend(r,nt)}})},function(e,t,n){var o,i;/*! PhotoSwipe Default UI - 4.1.3 - 2019-01-08
5 | * http://photoswipe.com
6 | * Copyright (c) 2019 Dmitry Semenov; */
7 | !function(r,a){o=a,void 0!==(i="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=i)}(0,function(){"use strict";return function(e,t){var n,o,i,r,a,l,s,u,c,d,p,f,m,h,v,g,w,y,x,b=this,_=!1,C=!0,T=!0,E={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(e,t){return e.title?(t.children[0].innerHTML=e.title,!0):(t.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return e.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return e.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},I=function(e){if(g)return!0;e=e||window.event,v.timeToIdle&&v.mouseUsed&&!c&&P();for(var n,o,i=e.target||e.srcElement,r=i.getAttribute("class")||"",a=0;a-1&&(n.onTap(),o=!0);if(o){e.stopPropagation&&e.stopPropagation(),g=!0;var l=t.features.isOldAndroid?600:30;w=setTimeout(function(){g=!1},l)}},S=function(){return!e.likelyTouchDevice||v.mouseUsed||screen.width>v.fitControlsWidth},k=function(e,n,o){t[(o?"add":"remove")+"Class"](e,"pswp__"+n)},D=function(){var e=1===v.getNumItemsFn();e!==h&&(k(o,"ui--one-slide",e),h=e)},O=function(){k(s,"share-modal--hidden",T)},L=function(){return T=!T,T?(t.removeClass(s,"pswp__share-modal--fade-in"),setTimeout(function(){T&&O()},300)):(O(),setTimeout(function(){T||t.addClass(s,"pswp__share-modal--fade-in")},30)),T||A(),!1},F=function(t){t=t||window.event;var n=t.target||t.srcElement;return e.shout("shareLinkClick",t,n),!!n.href&&(!!n.hasAttribute("download")||(window.open(n.href,"pswp_share","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left="+(window.screen?Math.round(screen.width/2-275):100)),T||L(),!1))},A=function(){for(var e,t,n,o,i,r="",a=0;a"+e.label+"",v.parseShareButtonOut&&(r=v.parseShareButtonOut(e,r));s.children[0].innerHTML=r,s.children[0].onclick=F},M=function(e){for(var n=0;n=.95&&b.showControls()});var e;d("onPinchClose",function(t){C&&t<.9?(b.hideControls(),e=!0):e&&!C&&t>.9&&b.showControls()}),d("zoomGestureEnded",function(){(e=!1)&&!C&&b.showControls()})},B=[{name:"caption",option:"captionEl",onInit:function(e){i=e}},{name:"share-modal",option:"shareEl",onInit:function(e){s=e},onTap:function(){L()}},{name:"button--share",option:"shareEl",onInit:function(e){l=e},onTap:function(){L()}},{name:"button--zoom",option:"zoomEl",onTap:e.toggleDesktopZoom},{name:"counter",option:"counterEl",onInit:function(e){a=e}},{name:"button--close",option:"closeEl",onTap:e.close},{name:"button--arrow--left",option:"arrowEl",onTap:e.prev},{name:"button--arrow--right",option:"arrowEl",onTap:e.next},{name:"button--fs",option:"fullscreenEl",onTap:function(){n.isFullscreen()?n.exit():n.enter()}},{name:"preloader",option:"preloaderEl",onInit:function(e){p=e}}],G=function(){var e,n,i,r=function(o){if(o)for(var r=o.length,a=0;a-1&&(v[i.option]?(t.removeClass(e,"pswp__element--disabled"),i.onInit&&i.onInit(e)):t.addClass(e,"pswp__element--disabled"))}};r(o.children);var a=t.getChildByClass(o,"pswp__top-bar");a&&r(a.children)};b.init=function(){t.extend(e.options,E,!0),v=e.options,o=t.getChildByClass(e.scrollWrap,"pswp__ui"),d=e.listen,W(),d("beforeChange",b.update),d("doubleTap",function(t){var n=e.currItem.initialZoomLevel;e.getZoomLevel()!==n?e.zoomTo(n,t,333):e.zoomTo(v.getDoubleTapZoom(!1,e.currItem),t,333)}),d("preventDragEvent",function(e,t,n){var o=e.target||e.srcElement;o&&o.getAttribute("class")&&e.type.indexOf("mouse")>-1&&(o.getAttribute("class").indexOf("__caption")>0||/(SMALL|STRONG|EM)/i.test(o.tagName))&&(n.prevent=!1)}),d("bindEvents",function(){t.bind(o,"pswpTap click",I),t.bind(e.scrollWrap,"pswpTap",b.onGlobalTap),e.likelyTouchDevice||t.bind(e.scrollWrap,"mouseover",b.onMouseOver)}),d("unbindEvents",function(){T||L(),y&&clearInterval(y),t.unbind(document,"mouseout",Z),t.unbind(document,"mousemove",P),t.unbind(o,"pswpTap click",I),t.unbind(e.scrollWrap,"pswpTap",b.onGlobalTap),t.unbind(e.scrollWrap,"mouseover",b.onMouseOver),n&&(t.unbind(document,n.eventK,b.updateFullscreen),n.isFullscreen()&&(v.hideAnimationDuration=0,n.exit()),n=null)}),d("destroy",function(){v.captionEl&&(r&&o.removeChild(r),t.removeClass(i,"pswp__caption--empty")),s&&(s.children[0].onclick=null),t.removeClass(o,"pswp__ui--over-close"),t.addClass(o,"pswp__ui--hidden"),b.setIdle(!1)}),v.showAnimationDuration||t.removeClass(o,"pswp__ui--hidden"),d("initialZoomIn",function(){v.showAnimationDuration&&t.removeClass(o,"pswp__ui--hidden")}),d("initialZoomOut",function(){t.addClass(o,"pswp__ui--hidden")}),d("parseVerticalMargin",K),G(),v.shareEl&&l&&s&&(T=!0),D(),H(),z(),N()},b.setIdle=function(e){c=e,k(o,"ui--idle",e)},b.update=function(){C&&e.currItem?(b.updateIndexIndicator(),v.captionEl&&(v.addCaptionHTMLFn(e.currItem,i),k(i,"caption--empty",!e.currItem.title)),_=!0):_=!1,T||L(),D()},b.updateFullscreen=function(o){o&&setTimeout(function(){e.setScrollOffset(0,t.getScrollY())},50),t[(n.isFullscreen()?"add":"remove")+"Class"](e.template,"pswp--fs")},b.updateIndexIndicator=function(){v.counterEl&&(a.innerHTML=e.getCurrentIndex()+1+v.indexIndicatorSep+v.getNumItemsFn())},b.onGlobalTap=function(n){n=n||window.event;var o=n.target||n.srcElement;if(!g)if(n.detail&&"mouse"===n.detail.pointerType){if(M(o))return void e.close();t.hasClass(o,"pswp__img")&&(1===e.getZoomLevel()&&e.getZoomLevel()<=e.currItem.fitRatio?v.clickToCloseNonZoomable&&e.close():e.toggleDesktopZoom(n.detail.releasePoint))}else if(v.tapToToggleControls&&(C?b.hideControls():b.showControls()),v.tapToClose&&(t.hasClass(o,"pswp__img")||M(o)))return void e.close()},b.onMouseOver=function(e){e=e||window.event;var t=e.target||e.srcElement;k(o,"ui--over-close",M(t))},b.hideControls=function(){t.addClass(o,"pswp__ui--hidden"),C=!1},b.showControls=function(){C=!0,_||b.update(),t.removeClass(o,"pswp__ui--hidden")},b.supportsFullscreen=function(){var e=document;return!!(e.exitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen||e.msExitFullscreen)},b.getFullscreenAPI=function(){var t,n=document.documentElement,o="fullscreenchange";return n.requestFullscreen?t={enterK:"requestFullscreen",exitK:"exitFullscreen",elementK:"fullscreenElement",eventK:o}:n.mozRequestFullScreen?t={enterK:"mozRequestFullScreen",exitK:"mozCancelFullScreen",elementK:"mozFullScreenElement",eventK:"moz"+o}:n.webkitRequestFullscreen?t={enterK:"webkitRequestFullscreen",exitK:"webkitExitFullscreen",elementK:"webkitFullscreenElement",eventK:"webkit"+o}:n.msRequestFullscreen&&(t={enterK:"msRequestFullscreen",exitK:"msExitFullscreen",elementK:"msFullscreenElement",eventK:"MSFullscreenChange"}),t&&(t.enter=function(){if(u=v.closeOnScroll,v.closeOnScroll=!1,"webkitRequestFullscreen"!==this.enterK)return e.template[this.enterK]();e.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT)},t.exit=function(){return v.closeOnScroll=u,document[this.exitK]()},t.isFullscreen=function(){return document[this.elementK]}),t}}})}])});
8 | //# sourceMappingURL=vue-photo-preview.js.map
--------------------------------------------------------------------------------