diff --git a/.gitignore b/.gitignore index c48bc10..03f770e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ bower_components/ *.log build/ -dist/ examples/ diff --git a/dist/photoviewer.css b/dist/photoviewer.css new file mode 100644 index 0000000..29f4247 --- /dev/null +++ b/dist/photoviewer.css @@ -0,0 +1,485 @@ + +/*! + * ____ _ _ ___ _____ ___ _ _ _____ ____ _ _ ____ ____ + * | _ \| | | |/ _ \|_ _|/ _ \| | | |_ _| __| | | | __| _ \ + * | |_| | |_| | | | | | | | | | | | | | | | | |__| | | | |__| |_| | + * | __/| _ | | | | | | | | | | |_| | | | | __| |/\| | __| / + * | | | | | | |_| | | | | |_| |\ / _| |_| |__| /\ | |__| |\ \ + * |_| |_| |_|\___/ |_| \___/ \_/ |_____|____|_/ \_|____|_| \_\ + * + * photoviewer - v2.0.0-beta.0 + * A JS plugin to view images just like in Windows + * https://github.com/nzbin/photoviewer#readme + * + * Copyright (c) 2018 nzbin + * Released under MIT License + */ + +.photoviewer-modal { + position: absolute; + z-index: 1090; + width: 320px; + height: 320px; + cursor: default; +} + +.photoviewer-inner { + position: relative; + width: 100%; + height: 100%; + background-color: #111; + background-color: rgba(0, 0, 0, 0.85); + -webkit-box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.3); + box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.3); + cursor: default; +} + +.photoviewer-maximize { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.photoviewer-toolbar { + font-size: 0; +} + +.photoviewer-header { + position: relative; + z-index: 2; + height: 40px; + color: #fff; +} + +.photoviewer-header .photoviewer-toolbar { + float: right; +} + +.photoviewer-title { + padding: 13px 10px; + font-size: 14px; + line-height: 1; + white-space: nowrap; + text-overflow: ellipsis; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; +} + +.photoviewer-stage { + position: absolute; + top: 40px; + right: 10px; + bottom: 40px; + left: 10px; + z-index: 1; + border: 1px solid #ccc; + overflow: hidden; +} + +.photoviewer-stage.stage-ready { + text-align: center; +} + +.photoviewer-image { + position: relative; + display: inline-block; +} + +.photoviewer-image.image-ready { + max-width: 100%; + max-height: 100%; +} + +.photoviewer-footer { + position: absolute; + bottom: 0; + z-index: 2; + width: 100%; + height: 40px; + color: #fff; + text-align: center; +} + +.photoviewer-footer .photoviewer-toolbar { + display: inline-block; +} + +.photoviewer-button { + display: inline-block; + width: 40px; + height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 10px; + font-size: 14px; + color: #ccc; + line-height: 1; + text-align: center; + background: none; + border-width: 0; + border-radius: 0; + cursor: pointer; + outline: none; +} + +.photoviewer-button:hover { + color: #fff; +} + +.photoviewer-button-close:hover { + background-color: #ff4545; +} + +.photoviewer-button-maximize:hover { + background-color: #525252; +} + +.photoviewer-button-minimize:hover { + background-color: #525252; +} + +.photoviewer-loader { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 2; + text-align: center; + background-color: rgba(0, 0, 0, 0.3); + color: #333; +} + +.photoviewer-loader::before { + content: ''; + display: inline-block; + position: relative; + width: 35px; + height: 35px; + border-width: 5px; + border-style: solid; + border-color: rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.5) rgba(255, 255, 255, 0.5); + border-radius: 100%; + -webkit-animation: photoviewerLoading 1s infinite linear; + animation: photoviewerLoading 1s infinite linear; +} + +.photoviewer-loader::after { + content: ''; + display: inline-block; + width: 0; + height: 100%; + vertical-align: middle; + overflow: hidden; +} + +@-webkit-keyframes photoviewerLoading { + 0% { + -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); + transform: rotateZ(0deg) translate3d(0, 0, 0); + } + 100% { + -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); + transform: rotateZ(360deg) translate3d(0, 0, 0); + } +} + +@keyframes photoviewerLoading { + 0% { + -webkit-transform: rotateZ(0deg) translate3d(0, 0, 0); + transform: rotateZ(0deg) translate3d(0, 0, 0); + } + 100% { + -webkit-transform: rotateZ(360deg) translate3d(0, 0, 0); + transform: rotateZ(360deg) translate3d(0, 0, 0); + } +} + +.photoviewer-resizable-handle { + position: absolute; + z-index: 10; +} + +.photoviewer-resizable-handle-e { + top: 0; + right: -5px; + bottom: 0; + left: auto; + width: 10px; + cursor: e-resize; +} + +.photoviewer-resizable-handle-s { + top: auto; + right: 0; + bottom: -5px; + left: 0; + height: 10px; + cursor: s-resize; +} + +.photoviewer-resizable-handle-w { + top: 0; + right: auto; + bottom: 0; + left: -5px; + width: 10px; + cursor: w-resize; +} + +.photoviewer-resizable-handle-n { + top: -5px; + right: 0; + bottom: auto; + left: 0; + height: 10px; + cursor: n-resize; +} + +.photoviewer-resizable-handle-se { + top: auto; + right: -5px; + bottom: -5px; + left: auto; + width: 10px; + height: 10px; + cursor: se-resize; +} + +.photoviewer-resizable-handle-sw { + top: auto; + right: auto; + bottom: -5px; + left: -5px; + width: 10px; + height: 10px; + cursor: sw-resize; +} + +.photoviewer-resizable-handle-nw { + top: -5px; + right: auto; + bottom: auto; + left: -5px; + width: 10px; + height: 10px; + cursor: nw-resize; +} + +.photoviewer-resizable-handle-ne { + top: -5px; + right: -5px; + bottom: auto; + left: auto; + width: 10px; + height: 10px; + cursor: ne-resize; +} + +:-webkit-full-screen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-webkit-full-screen .photoviewer-header, +:-webkit-full-screen .photoviewer-footer, +:-webkit-full-screen .photoviewer-resizable-handle { + display: none; +} + +:-webkit-full-screen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:-moz-full-screen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-moz-full-screen .photoviewer-header, +:-moz-full-screen .photoviewer-footer, +:-moz-full-screen .photoviewer-resizable-handle { + display: none; +} + +:-moz-full-screen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:-ms-fullscreen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-ms-fullscreen .photoviewer-header, +:-ms-fullscreen .photoviewer-footer, +:-ms-fullscreen .photoviewer-resizable-handle { + display: none; +} + +:-ms-fullscreen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:full-screen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:full-screen .photoviewer-header, +:full-screen .photoviewer-footer, +:full-screen .photoviewer-resizable-handle { + display: none; +} + +:full-screen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:-webkit-full-screen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-moz-full-screen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-ms-fullscreen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:fullscreen { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +:-webkit-full-screen .photoviewer-header, +:-webkit-full-screen .photoviewer-footer, +:-webkit-full-screen .photoviewer-resizable-handle { + display: none; +} + +:-moz-full-screen .photoviewer-header, +:-moz-full-screen .photoviewer-footer, +:-moz-full-screen .photoviewer-resizable-handle { + display: none; +} + +:-ms-fullscreen .photoviewer-header, +:-ms-fullscreen .photoviewer-footer, +:-ms-fullscreen .photoviewer-resizable-handle { + display: none; +} + +:fullscreen .photoviewer-header, +:fullscreen .photoviewer-footer, +:fullscreen .photoviewer-resizable-handle { + display: none; +} + +:-webkit-full-screen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:-moz-full-screen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:-ms-fullscreen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +:fullscreen .photoviewer-stage { + top: 0; + right: 0; + bottom: 0; + left: 0; + border-width: 0; + background-color: #000; +} + +::-webkit-backdrop { + background-color: #000; +} + +::backdrop { + background-color: #000; +} + +::-ms-backdrop { + background-color: #000; +} + +.is-grab { + cursor: move; + cursor: -webkit-grab; + cursor: grab; +} + +.is-grabbing { + cursor: move; + cursor: -webkit-grabbing; + cursor: grabbing; +} + +/*# sourceMappingURL=photoviewer.css.map */ \ No newline at end of file diff --git a/dist/photoviewer.css.map b/dist/photoviewer.css.map new file mode 100644 index 0000000..2326ddf --- /dev/null +++ b/dist/photoviewer.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["","photoviewer.css"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAAA;;ACAA;EACE,mBAAmB;EACnB,cAAc;EACd,aAAa;EACb,cAAc;EACd,gBAAgB;CACjB;;AAED;EACE,mBAAmB;EACnB,YAAY;EACZ,aAAa;EACb,uBAAuB;EACvB,sCAAsC;EACtC,mDAA2C;EAA3C,2CAA2C;EAC3C,gBAAgB;CACjB;;AAED;EACE,gBAAgB;EAChB,OAAO;EACP,QAAQ;EACR,YAAY;EACZ,aAAa;CACd;;AAED;EACE,aAAa;CACd;;AAED;EACE,mBAAmB;EACnB,WAAW;EACX,aAAa;EACb,YAAY;CACb;;AAED;EACE,aAAa;CACd;;AAED;EACE,mBAAmB;EACnB,gBAAgB;EAChB,eAAe;EACf,oBAAoB;EACpB,wBAAwB;EACxB,0BAAkB;EAAlB,uBAAkB;EAAlB,sBAAkB;EAAlB,kBAAkB;EAClB,iBAAiB;CAClB;;AAED;EACE,mBAAmB;EACnB,UAAU;EACV,YAAY;EACZ,aAAa;EACb,WAAW;EACX,WAAW;EACX,uBAAuB;EACvB,iBAAiB;CAClB;;AAED;EACE,mBAAmB;CACpB;;AAED;EACE,mBAAmB;EACnB,sBAAsB;CACvB;;AAED;EACE,gBAAgB;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AED;EACE,kBAAkB;EAClB,mBAAmB;EACnB,uBAAuB;EACvB,wBAAwB;CACzB;;AALD;EACE,kBAAkB;EAClB,mBAAmB;EACnB,uBAAuB;EACvB,wBAAwB;CACzB;;AALD;EACE,kBAAkB;EAClB,mBAAmB;EACnB,uBAAuB;EACvB,wBAAwB;CACzB;;AALD;EACE,kBAAkB;EAClB,mBAAmB;EACnB,uBAAuB;EACvB,wBAAwB;CACzB;;AAED;;;EAGE,cAAc;CACf;;AAJD;;;EAGE,cAAc;CACf;;AAJD;;;EAGE,cAAc;CACf;;AAJD;;;EAGE,cAAc;CACf;;AAED;EACE,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,gBAAgB;EAChB,uBAAuB;CACxB;;AAPD;EACE,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,gBAAgB;EAChB,uBAAuB;CACxB;;AAPD;EACE,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,gBAAgB;EAChB,uBAAuB;CACxB;;AAPD;EACE,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,gBAAgB;EAChB,uBAAuB;CACxB;;AAED;EACE,uBAAuB;CACxB;;AAFD;EACE,uBAAuB;CACxB;;AAED;EACE,uBAAuB;CACxB;;AAED;EACE,aAAa;EACb,qBAAqB;EACrB,aAAa;CACd;;AAED;EACE,aAAa;EACb,yBAAyB;EACzB,iBAAiB;CAClB","file":"photoviewer.css","sourcesContent":[null,".photoviewer-modal {\n position: absolute;\n z-index: 1090;\n width: 320px;\n height: 320px;\n cursor: default;\n}\n\n.photoviewer-inner {\n position: relative;\n width: 100%;\n height: 100%;\n background-color: #111;\n background-color: rgba(0, 0, 0, 0.85);\n box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.3);\n cursor: default;\n}\n\n.photoviewer-maximize {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.photoviewer-toolbar {\n font-size: 0;\n}\n\n.photoviewer-header {\n position: relative;\n z-index: 2;\n height: 40px;\n color: #fff;\n}\n\n.photoviewer-header .photoviewer-toolbar {\n float: right;\n}\n\n.photoviewer-title {\n padding: 13px 10px;\n font-size: 14px;\n line-height: 1;\n white-space: nowrap;\n text-overflow: ellipsis;\n user-select: none;\n overflow: hidden;\n}\n\n.photoviewer-stage {\n position: absolute;\n top: 40px;\n right: 10px;\n bottom: 40px;\n left: 10px;\n z-index: 1;\n border: 1px solid #ccc;\n overflow: hidden;\n}\n\n.photoviewer-stage.stage-ready {\n text-align: center;\n}\n\n.photoviewer-image {\n position: relative;\n display: inline-block;\n}\n\n.photoviewer-image.image-ready {\n max-width: 100%;\n max-height: 100%;\n}\n\n.photoviewer-footer {\n position: absolute;\n bottom: 0;\n z-index: 2;\n width: 100%;\n height: 40px;\n color: #fff;\n text-align: center;\n}\n\n.photoviewer-footer .photoviewer-toolbar {\n display: inline-block;\n}\n\n.photoviewer-button {\n display: inline-block;\n width: 40px;\n height: 40px;\n box-sizing: border-box;\n margin: 0;\n padding: 10px;\n font-size: 14px;\n color: #ccc;\n line-height: 1;\n text-align: center;\n background: none;\n border-width: 0;\n border-radius: 0;\n cursor: pointer;\n outline: none;\n}\n\n.photoviewer-button:hover {\n color: #fff;\n}\n\n.photoviewer-button-close:hover {\n background-color: #ff4545;\n}\n\n.photoviewer-button-maximize:hover {\n background-color: #525252;\n}\n\n.photoviewer-button-minimize:hover {\n background-color: #525252;\n}\n\n.photoviewer-loader {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 2;\n text-align: center;\n background-color: rgba(0, 0, 0, 0.3);\n color: #333;\n}\n\n.photoviewer-loader::before {\n content: '';\n display: inline-block;\n position: relative;\n width: 35px;\n height: 35px;\n border-width: 5px;\n border-style: solid;\n border-color: rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.5) rgba(255, 255, 255, 0.5);\n border-radius: 100%;\n animation: photoviewerLoading 1s infinite linear;\n}\n\n.photoviewer-loader::after {\n content: '';\n display: inline-block;\n width: 0;\n height: 100%;\n vertical-align: middle;\n overflow: hidden;\n}\n\n@keyframes photoviewerLoading {\n 0% {\n transform: rotateZ(0deg) translate3d(0, 0, 0);\n }\n 100% {\n transform: rotateZ(360deg) translate3d(0, 0, 0);\n }\n}\n\n.photoviewer-resizable-handle {\n position: absolute;\n z-index: 10;\n}\n\n.photoviewer-resizable-handle-e {\n top: 0;\n right: -5px;\n bottom: 0;\n left: auto;\n width: 10px;\n cursor: e-resize;\n}\n\n.photoviewer-resizable-handle-s {\n top: auto;\n right: 0;\n bottom: -5px;\n left: 0;\n height: 10px;\n cursor: s-resize;\n}\n\n.photoviewer-resizable-handle-w {\n top: 0;\n right: auto;\n bottom: 0;\n left: -5px;\n width: 10px;\n cursor: w-resize;\n}\n\n.photoviewer-resizable-handle-n {\n top: -5px;\n right: 0;\n bottom: auto;\n left: 0;\n height: 10px;\n cursor: n-resize;\n}\n\n.photoviewer-resizable-handle-se {\n top: auto;\n right: -5px;\n bottom: -5px;\n left: auto;\n width: 10px;\n height: 10px;\n cursor: se-resize;\n}\n\n.photoviewer-resizable-handle-sw {\n top: auto;\n right: auto;\n bottom: -5px;\n left: -5px;\n width: 10px;\n height: 10px;\n cursor: sw-resize;\n}\n\n.photoviewer-resizable-handle-nw {\n top: -5px;\n right: auto;\n bottom: auto;\n left: -5px;\n width: 10px;\n height: 10px;\n cursor: nw-resize;\n}\n\n.photoviewer-resizable-handle-ne {\n top: -5px;\n right: -5px;\n bottom: auto;\n left: auto;\n width: 10px;\n height: 10px;\n cursor: ne-resize;\n}\n\n:-webkit-full-screen {\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n:-webkit-full-screen .photoviewer-header,\n:-webkit-full-screen .photoviewer-footer,\n:-webkit-full-screen .photoviewer-resizable-handle {\n display: none;\n}\n\n:-webkit-full-screen .photoviewer-stage {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-width: 0;\n background-color: #000;\n}\n\n:-moz-full-screen {\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n:-moz-full-screen .photoviewer-header,\n:-moz-full-screen .photoviewer-footer,\n:-moz-full-screen .photoviewer-resizable-handle {\n display: none;\n}\n\n:-moz-full-screen .photoviewer-stage {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-width: 0;\n background-color: #000;\n}\n\n:-ms-fullscreen {\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n:-ms-fullscreen .photoviewer-header,\n:-ms-fullscreen .photoviewer-footer,\n:-ms-fullscreen .photoviewer-resizable-handle {\n display: none;\n}\n\n:-ms-fullscreen .photoviewer-stage {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-width: 0;\n background-color: #000;\n}\n\n:full-screen {\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n:full-screen .photoviewer-header,\n:full-screen .photoviewer-footer,\n:full-screen .photoviewer-resizable-handle {\n display: none;\n}\n\n:full-screen .photoviewer-stage {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-width: 0;\n background-color: #000;\n}\n\n:fullscreen {\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n:fullscreen .photoviewer-header,\n:fullscreen .photoviewer-footer,\n:fullscreen .photoviewer-resizable-handle {\n display: none;\n}\n\n:fullscreen .photoviewer-stage {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-width: 0;\n background-color: #000;\n}\n\n::backdrop {\n background-color: #000;\n}\n\n::-ms-backdrop {\n background-color: #000;\n}\n\n.is-grab {\n cursor: move;\n cursor: -webkit-grab;\n cursor: grab;\n}\n\n.is-grabbing {\n cursor: move;\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n"]} \ No newline at end of file diff --git a/dist/photoviewer.js b/dist/photoviewer.js new file mode 100644 index 0000000..83cd3af --- /dev/null +++ b/dist/photoviewer.js @@ -0,0 +1,1492 @@ + +/*! + * ____ _ _ ___ _____ ___ _ _ _____ ____ _ _ ____ ____ + * | _ \| | | |/ _ \|_ _|/ _ \| | | |_ _| __| | | | __| _ \ + * | |_| | |_| | | | | | | | | | | | | | | | | |__| | | | |__| |_| | + * | __/| _ | | | | | | | | | | |_| | | | | __| |/\| | __| / + * | | | | | | |_| | | | | |_| |\ / _| |_| |__| /\ | |__| |\ \ + * |_| |_| |_|\___/ |_| \___/ \_/ |_____|____|_/ \_|____|_| \_\ + * + * photoviewer - v2.0.0-beta.0 + * A JS plugin to view images just like in Windows + * https://github.com/nzbin/photoviewer#readme + * + * Copyright (c) 2018 nzbin + * Released under MIT License + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : + typeof define === 'function' && define.amd ? define(['jquery'], factory) : + (global.photoviewer = factory(global.jQuery)); +}(this, (function ($$1) { 'use strict'; + + $$1 = $$1 && $$1.hasOwnProperty('default') ? $$1['default'] : $$1; + + var DEFAULTS = { + // Enable modal to drag + draggable: true, + // Enable modal to resize + resizable: true, + // Enable image to move + movable: true, + // Enable keyboard navigation + keyboard: true, + // Shows the title + title: true, + // Min width of modal + modalWidth: 320, + // Min height of modal + modalHeight: 320, + // Enable the page content fixed + fixedContent: true, + // Disable the modal size fixed + fixedModalSize: false, + // Disable the image viewer maximized on init + initMaximized: false, + // Threshold of modal to browser window + gapThreshold: 0.02, + // Threshold of image ratio + ratioThreshold: 0.1, + // Min ratio of image when zoom out + minRatio: 0.1, + // Max ratio of image when zoom in + maxRatio: 16, + // Toolbar options in header + headToolbar: ['maximize', 'close'], + // Toolbar options in footer + footToolbar: ['zoomIn', 'zoomOut', 'prev', 'fullscreen', 'next', 'actualSize', 'rotateRight'], + // Customize button icon + icons: { + minimize: 'fa fa-window-minimize', + maximize: 'fa fa-window-maximize', + close: 'fa fa-close', + zoomIn: 'fa fa-search-plus', + zoomOut: 'fa fa-search-minus', + prev: 'fa fa-arrow-left', + next: 'fa fa-arrow-right', + fullscreen: 'fa fa-photo', + actualSize: 'fa fa-arrows-alt', + rotateLeft: 'fa fa-rotate-left', + rotateRight: 'fa fa-rotate-right' + }, + // Customize language of button title + i18n: { + minimize: 'minimize', + maximize: 'maximize', + close: 'close', + zoomIn: 'zoom-in(+)', + zoomOut: 'zoom-out(-)', + prev: 'prev(←)', + next: 'next(→)', + fullscreen: 'fullscreen', + actualSize: 'actual-size(Ctrl+Alt+0)', + rotateLeft: 'rotate-left(Ctrl+,)', + rotateRight: 'rotate-right(Ctrl+.)' + }, + // Enable multiple instances + multiInstances: true, + // Init trigger event + initEvent: 'click', + // Enable animation + initAnimation: true, + // Disable modal position fixed when change images + fixedModalPos: false, + // Modal z-index + zIndex: 1090, + // Selector of drag handler + dragHandle: false, + // Callback events + callbacks: { + beforeOpen: $.noop, + opened: $.noop, + beforeClose: $.noop, + closed: $.noop, + beforeChange: $.noop, + changed: $.noop + }, + // Start images index + index: 0 + }; + + /** + * [getImgSrc] + * @param {[Object]} el [description] + */ + function getImgSrc(el) { + // Get data-src as image src at first + var src = $(el).attr('data-src') ? $(el).attr('data-src') : $(el).attr('href'); + return src; + } + /** + * [throttle] + * @param {Function} fn [description] + * @param {[Number]} delay [description] + * @return {Function} [description] + */ + + function throttle(fn, delay) { + var timer = null; + return function () { + var context = this, + args = arguments; + clearTimeout(timer); + timer = setTimeout(function () { + fn.apply(context, args); + }, delay); + }; + } + /** + * [preloadImg] + * @param {[String]} src [image src] + * @param {Function} success [callbacks] + * @param {Function} error [callbacks] + */ + + function preloadImg(src, success, error) { + var img = new Image(); + + img.onload = function () { + success(img); + }; + + img.onerror = function () { + error(img); + }; + + img.src = src; + } + /** + * [requestFullscreen] + * @param {[type]} element [description] + */ + + function requestFullscreen(element) { + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } + } + /** + * [getImageNameFromUrl] + * @param {[String]} url [description] + * @return {[String]} [description] + */ + + function getImageNameFromUrl(url) { + var reg = /^.*?\/*([^/?]*)\.[a-z]+(\?.+|$)/ig, + txt = url.replace(reg, '$1'); + return txt; + } + /** + * [getNumFromCSSValue] + * @param {[String]} value [description] + * @return {[Number]} [description] + */ + + function getNumFromCSSValue(value) { + var reg = /\d+/g, + arr = value.match(reg), + num = parseFloat(arr[0]); + return num; + } + /** + * [hasScrollbar] + * @return {[Boolean]} [description] + */ + + function hasScrollbar() { + return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); + } + /** + * [getScrollbarWidth] + * @return {[Number]} [description] + */ + + function getScrollbarWidth() { + var scrollDiv = document.createElement('div'); + scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; + document.body.appendChild(scrollDiv); + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + document.body.removeChild(scrollDiv); + return scrollbarWidth; + } + /** + * [setGrabCursor] + * @param {[Object]} imageData [description] + * @param {[Object]} stageData [description] + * @param {[Object]} stage [description] + * @param {[Boolean]} isRotate [description] + */ + + function setGrabCursor(imageData, stageData, stage, isRotated) { + var imageWidth = !isRotated ? imageData.w : imageData.h, + imageHeight = !isRotated ? imageData.h : imageData.w; + + if (imageHeight > stageData.h || imageWidth > stageData.w) { + stage.addClass('is-grab'); + } + + if (imageHeight <= stageData.h && imageWidth <= stageData.w) { + stage.removeClass('is-grab'); + } + } + /** + * [supportTouch] + * @return {[Boolean]} [description] + */ + + function supportTouch() { + return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch); + } + + var $W = $(window); + var $D = $(document); + var CLICK_EVENT = 'click'; + var RESIZE_EVENT = 'resize'; + var KEYDOWN_EVENT = 'keydown'; + var WHEEL_EVENT = 'wheel mousewheel DOMMouseScroll'; + var TOUCH_START_EVENT = supportTouch() ? 'touchstart' : 'mousedown'; + var TOUCH_MOVE_EVENT = supportTouch() ? 'touchmove' : 'mousemove'; + var TOUCH_END_EVENT = supportTouch() ? 'touchend' : 'mouseup'; + var NS = 'photoviewer'; + var CLASS_NS = '.' + NS; + var EVENT_NS = '.' + NS; + var PUBLIC_VARS = { + // image moving flag + isMoving: false, + // modal resizing flag + isResizing: false, + // modal z-index setting + zIndex: DEFAULTS.zIndex + }; + + var draggable = { + /** + * [draggable] + * @param {[Object]} modal [the modal element] + * @param {[Object]} dragHandle [the handle element when dragging] + * @param {[Object]} dragCancel [the cancel element when dragging] + */ + draggable: function draggable(modal, dragHandle, dragCancel) { + var self = this; + var isDragging = false; + var startX = 0, + startY = 0, + left = 0, + top = 0; + + var dragStart = function dragStart(e) { + e = e || window.event; // Must be removed + // e.preventDefault(); + + if (self.options.multiInstances) { + modal.css('z-index', ++PUBLIC_VARS['zIndex']); + } // Get clicked button + + + var elemCancel = $(e.target).closest(dragCancel); // Stop modal moving when click buttons + + if (elemCancel.length) { + return true; + } + + isDragging = true; + startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX; + startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY; + left = $(modal).offset().left; + top = $(modal).offset().top; + $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).on(TOUCH_END_EVENT + EVENT_NS, dragEnd); + }; + + var dragMove = function dragMove(e) { + e = e || window.event; + e.preventDefault(); + + if (isDragging && !PUBLIC_VARS['isMoving'] && !PUBLIC_VARS['isResizing'] && !self.isMaximized) { + var endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX, + endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY, + relativeX = endX - startX, + relativeY = endY - startY; + $(modal).css({ + left: relativeX + left + 'px', + top: relativeY + top + 'px' + }); + } + }; + + var dragEnd = function dragEnd() { + $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).off(TOUCH_END_EVENT + EVENT_NS, dragEnd); + isDragging = false; + }; + + $(dragHandle).on(TOUCH_START_EVENT + EVENT_NS, dragStart); + } + }; + + var ELEMS_WITH_GRABBING_CURSOR = "html,body,." + NS + "-modal,." + NS + "-stage,." + NS + "-button,." + NS + "-resizable-handle"; + var movable = { + /** + * -------------------------------------- + * 1.no movable + * 2.vertical movable + * 3.horizontal movable + * 4.vertical & horizontal movable + * -------------------------------------- + * + * [image movable] + * @param {[Object]} stage [the stage element] + * @param {[Object]} image [the image element] + */ + movable: function movable(stage, image) { + var self = this; + var isDragging = false; + var startX = 0, + startY = 0, + left = 0, + top = 0, + widthDiff = 0, + heightDiff = 0, + δ = 0; + + var dragStart = function dragStart(e) { + e = e || window.event; + e.preventDefault(); + var imageWidth = $(image).width(), + imageHeight = $(image).height(), + stageWidth = $(stage).width(), + stageHeight = $(stage).height(); + startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX; + startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY; // δ is the difference between image width and height + + δ = !self.isRotated ? 0 : (imageWidth - imageHeight) / 2; // Width or height difference can be use to limit image right or top position + + widthDiff = !self.isRotated ? imageWidth - stageWidth : imageHeight - stageWidth; + heightDiff = !self.isRotated ? imageHeight - stageHeight : imageWidth - stageHeight; // Modal can be dragging if image is smaller to stage + + isDragging = widthDiff > 0 || heightDiff > 0 ? true : false; + PUBLIC_VARS['isMoving'] = widthDiff > 0 || heightDiff > 0 ? true : false; // Reclac the element position when mousedown + // Fixed the issue of stage with a border + + left = $(image).position().left - δ; + top = $(image).position().top + δ; // Add grabbing cursor + + if (stage.hasClass('is-grab')) { + $(ELEMS_WITH_GRABBING_CURSOR).addClass('is-grabbing'); + } + + $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).on(TOUCH_END_EVENT + EVENT_NS, dragEnd); + }; + + var dragMove = function dragMove(e) { + e = e || window.event; + e.preventDefault(); + + if (isDragging) { + var endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX, + endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY, + relativeX = endX - startX, + relativeY = endY - startY, + newLeft = relativeX + left, + newTop = relativeY + top; // vertical limit + + if (heightDiff > 0) { + if (relativeY + top > δ) { + newTop = δ; + } else if (relativeY + top < -heightDiff + δ) { + newTop = -heightDiff + δ; + } + } else { + newTop = top; + } // horizontal limit + + + if (widthDiff > 0) { + if (relativeX + left > -δ) { + newLeft = -δ; + } else if (relativeX + left < -widthDiff - δ) { + newLeft = -widthDiff - δ; + } + } else { + newLeft = left; + } + + $(image).css({ + left: newLeft + 'px', + top: newTop + 'px' + }); // Update image initial data + + $.extend(self.imageData, { + left: newLeft, + top: newTop + }); + } + }; + + var dragEnd = function dragEnd() { + $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).off(TOUCH_END_EVENT + EVENT_NS, dragEnd); + isDragging = false; + PUBLIC_VARS['isMoving'] = false; // Remove grabbing cursor + + $(ELEMS_WITH_GRABBING_CURSOR).removeClass('is-grabbing'); + }; + + $(stage).on(TOUCH_START_EVENT + EVENT_NS, dragStart); + } + }; + + var ELEMS_WITH_RESIZE_CURSOR = "html,body,." + NS + "-modal,." + NS + "-stage,." + NS + "-button"; + var resizable = { + /** + * ------------------------------ + * 1.modal resizable + * 2.keep image in stage center + * 3.other image limitations + * ------------------------------ + * + * [resizable] + * @param {[Object]} modal [the modal element] + * @param {[Object]} stage [the stage element] + * @param {[Object]} image [the image element] + * @param {[Number]} minWidth [the option of modalWidth] + * @param {[Number]} minHeight [the option of modalHeight] + */ + resizable: function resizable(modal, stage, image, minWidth, minHeight) { + var self = this; + var resizableHandleE = $("
"), + resizableHandleW = $("
"), + resizableHandleS = $("
"), + resizableHandleN = $("
"), + resizableHandleSE = $("
"), + resizableHandleSW = $("
"), + resizableHandleNE = $("
"), + resizableHandleNW = $("
"); + var resizableHandles = { + 'e': resizableHandleE, + 's': resizableHandleS, + 'se': resizableHandleSE, + 'n': resizableHandleN, + 'w': resizableHandleW, + 'nw': resizableHandleNW, + 'ne': resizableHandleNE, + 'sw': resizableHandleSW + }; + $(modal).append(resizableHandleE, resizableHandleW, resizableHandleS, resizableHandleN, resizableHandleSE, resizableHandleSW, resizableHandleNE, resizableHandleNW); + var isDragging = false; + var startX = 0, + startY = 0, + modalData = { + w: 0, + h: 0, + l: 0, + t: 0 + }, + stageData = { + w: 0, + h: 0, + l: 0, + t: 0 + }, + imageData = { + w: 0, + h: 0, + l: 0, + t: 0 + }, + // δ is the difference between image width and height + δ = 0, + imgWidth = 0, + imgHeight = 0, + direction = ''; // modal CSS options + + var getModalOpts = function getModalOpts(dir, offsetX, offsetY) { + // Modal should not move when its width to the minwidth + var modalLeft = -offsetX + modalData.w > minWidth ? offsetX + modalData.l : modalData.l + modalData.w - minWidth, + modalTop = -offsetY + modalData.h > minHeight ? offsetY + modalData.t : modalData.t + modalData.h - minHeight; + var opts = { + 'e': { + width: Math.max(offsetX + modalData.w, minWidth) + 'px' + }, + 's': { + height: Math.max(offsetY + modalData.h, minHeight) + 'px' + }, + 'se': { + width: Math.max(offsetX + modalData.w, minWidth) + 'px', + height: Math.max(offsetY + modalData.h, minHeight) + 'px' + }, + 'w': { + width: Math.max(-offsetX + modalData.w, minWidth) + 'px', + left: modalLeft + 'px' + }, + 'n': { + height: Math.max(-offsetY + modalData.h, minHeight) + 'px', + top: modalTop + 'px' + }, + 'nw': { + width: Math.max(-offsetX + modalData.w, minWidth) + 'px', + height: Math.max(-offsetY + modalData.h, minHeight) + 'px', + top: modalTop + 'px', + left: modalLeft + 'px' + }, + 'ne': { + width: Math.max(offsetX + modalData.w, minWidth) + 'px', + height: Math.max(-offsetY + modalData.h, minHeight) + 'px', + top: modalTop + 'px' + }, + 'sw': { + width: Math.max(-offsetX + modalData.w, minWidth) + 'px', + height: Math.max(offsetY + modalData.h, minHeight) + 'px', + left: modalLeft + 'px' + } + }; + return opts[dir]; + }; // image CSS options + + + var getImageOpts = function getImageOpts(dir, offsetX, offsetY) { + // Image should not move when modal width to the min width + // The minwidth is modal width, so we should clac the stage minwidth + var widthDiff = offsetX + modalData.w > minWidth ? stageData.w - imgWidth + offsetX - δ : minWidth - (modalData.w - stageData.w) - imgWidth - δ, + heightDiff = offsetY + modalData.h > minHeight ? stageData.h - imgHeight + offsetY + δ : minHeight - (modalData.h - stageData.h) - imgHeight + δ, + widthDiff2 = -offsetX + modalData.w > minWidth ? stageData.w - imgWidth - offsetX - δ : minWidth - (modalData.w - stageData.w) - imgWidth - δ, + heightDiff2 = -offsetY + modalData.h > minHeight ? stageData.h - imgHeight - offsetY + δ : minHeight - (modalData.h - stageData.h) - imgHeight + δ; // Get image position in dragging + + var imgLeft = (widthDiff > 0 ? $(image).position().left : $(image).position().left < 0 ? $(image).position().left : 0) - δ, + imgTop = (heightDiff > 0 ? $(image).position().top : $(image).position().top < 0 ? $(image).position().top : 0) + δ, + imgLeft2 = (widthDiff2 > 0 ? $(image).position().left : $(image).position().left < 0 ? $(image).position().left : 0) - δ, + imgTop2 = (heightDiff2 > 0 ? $(image).position().top : $(image).position().top < 0 ? $(image).position().top : 0) + δ; + var opts = { + 'e': { + left: widthDiff >= -δ ? (widthDiff - δ) / 2 + 'px' : imgLeft > widthDiff ? imgLeft + 'px' : widthDiff + 'px' + }, + 's': { + top: heightDiff >= δ ? (heightDiff + δ) / 2 + 'px' : imgTop > heightDiff ? imgTop + 'px' : heightDiff + 'px' + }, + 'se': { + top: heightDiff >= δ ? (heightDiff + δ) / 2 + 'px' : imgTop > heightDiff ? imgTop + 'px' : heightDiff + 'px', + left: widthDiff >= -δ ? (widthDiff - δ) / 2 + 'px' : imgLeft > widthDiff ? imgLeft + 'px' : widthDiff + 'px' + }, + 'w': { + left: widthDiff2 >= -δ ? (widthDiff2 - δ) / 2 + 'px' : imgLeft2 > widthDiff2 ? imgLeft2 + 'px' : widthDiff2 + 'px' + }, + 'n': { + top: heightDiff2 >= δ ? (heightDiff2 + δ) / 2 + 'px' : imgTop2 > heightDiff2 ? imgTop2 + 'px' : heightDiff2 + 'px' + }, + 'nw': { + top: heightDiff2 >= δ ? (heightDiff2 + δ) / 2 + 'px' : imgTop2 > heightDiff2 ? imgTop2 + 'px' : heightDiff2 + 'px', + left: widthDiff2 >= -δ ? (widthDiff2 - δ) / 2 + 'px' : imgLeft2 > widthDiff2 ? imgLeft2 + 'px' : widthDiff2 + 'px' + }, + 'ne': { + top: heightDiff2 >= δ ? (heightDiff2 + δ) / 2 + 'px' : imgTop2 > heightDiff2 ? imgTop2 + 'px' : heightDiff2 + 'px', + left: widthDiff >= -δ ? (widthDiff - δ) / 2 + 'px' : imgLeft > widthDiff ? imgLeft + 'px' : widthDiff + 'px' + }, + 'sw': { + top: heightDiff >= δ ? (heightDiff + δ) / 2 + 'px' : imgTop > heightDiff ? imgTop + 'px' : heightDiff + 'px', + left: widthDiff2 >= -δ ? (widthDiff2 - δ) / 2 + 'px' : imgLeft2 > widthDiff2 ? imgLeft2 + 'px' : widthDiff2 + 'px' + } + }; + return opts[dir]; + }; + + var dragStart = function dragStart(dir, e) { + e = e || window.event; + e.preventDefault(); + isDragging = true; + PUBLIC_VARS['isResizing'] = true; + startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX; + startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY; // Reclac the modal data when mousedown + + modalData = { + w: $(modal).width(), + h: $(modal).height(), + l: $(modal).offset().left, + t: $(modal).offset().top + }; + stageData = { + w: $(stage).width(), + h: $(stage).height(), + l: $(stage).offset().left, + t: $(stage).offset().top + }; + imageData = { + w: $(image).width(), + h: $(image).height(), + l: $(image).position().left, + t: $(image).position().top + }; // δ is the difference between image width and height + + δ = !self.isRotated ? 0 : (imageData.w - imageData.h) / 2; + imgWidth = !self.isRotated ? imageData.w : imageData.h; + imgHeight = !self.isRotated ? imageData.h : imageData.w; + direction = dir; // Add resizable cursor + + $(ELEMS_WITH_RESIZE_CURSOR).css('cursor', dir + '-resize'); + $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).on(TOUCH_END_EVENT + EVENT_NS, dragEnd); + }; + + var dragMove = function dragMove(e) { + e = e || window.event; + e.preventDefault(); + + if (isDragging && !self.isMaximized) { + var endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX, + endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY, + relativeX = endX - startX, + relativeY = endY - startY; + var modalOpts = getModalOpts(direction, relativeX, relativeY); + $(modal).css(modalOpts); + var imageOpts = getImageOpts(direction, relativeX, relativeY); + $(image).css(imageOpts); + } + }; + + var dragEnd = function dragEnd() { + $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove).off(TOUCH_END_EVENT + EVENT_NS, dragEnd); // Set grab cursor + + if (PUBLIC_VARS['isResizing']) { + setGrabCursor({ + w: imgWidth, + h: imgHeight + }, { + w: $(stage).width(), + h: $(stage).height() + }, stage); + } + + isDragging = false; + PUBLIC_VARS['isResizing'] = false; // Remove resizable cursor + + $(ELEMS_WITH_RESIZE_CURSOR).css('cursor', ''); + }; + + $.each(resizableHandles, function (dir, handle) { + handle.on(TOUCH_START_EVENT + EVENT_NS, function (e) { + dragStart(dir, e); + }); + }); + } + }; + + /** + * PhotoViewer Class + */ + + var PhotoViewer = + /*#__PURE__*/ + function () { + function PhotoViewer(items, options, el) { + var self = this; + this.options = $$1.extend(true, {}, DEFAULTS, options); + + if (options && $$1.isArray(options.footToolbar)) { + this.options.footToolbar = options.footToolbar; + } + + if (options && $$1.isArray(options.headToolbar)) { + this.options.headToolbar = options.headToolbar; + } // Store element of clicked + + + this.$el = $$1(el); // As we have multiple instances, + // so every instance has following variables. + // modal open flag + + this.isOpened = false; // modal maximize flag + + this.isMaximized = false; // image rotate 90*(2n+1) flag + + this.isRotated = false; // image rotate angle + + this.rotateAngle = 0; // Store image data in every instance + + this.imageData = {}; // Store modal data in every instance + + this.modalData = { + width: null, + height: null, + left: null, + top: null + }; + this.init(items, self.options, el); + } + + var _proto = PhotoViewer.prototype; + + _proto.init = function init(items, opts, el) { + this.groupData = items; + this.groupIndex = opts['index']; // Get image src + + var imgSrc = items[this.groupIndex]['src']; + this.open(); + this.loadImg(imgSrc); // draggable & movable & resizable + + if (opts.draggable) { + this.draggable(this.$photoviewer, this.dragHandle, CLASS_NS + '-button'); + } + + if (opts.movable) { + this.movable(this.$stage, this.$image); + } + + if (opts.resizable) { + this.resizable(this.$photoviewer, this.$stage, this.$image, opts.modalWidth, opts.modalHeight); + } + }; + + _proto._creatBtns = function _creatBtns(toolbar, btns) { + var btnsStr = ''; + $$1.each(toolbar, function (index, item) { + btnsStr += btns[item]; + }); + return btnsStr; + }; + + _proto._creatTitle = function _creatTitle() { + return this.options.title ? "
" : ''; + }; + + _proto._creatDOM = function _creatDOM() { + var btnsTpl = { + minimize: "", + maximize: "", + close: "", + zoomIn: "", + zoomOut: "", + prev: "", + next: "", + fullscreen: "", + actualSize: "", + rotateLeft: "", + rotateRight: "" + }; // photoviewer base HTML + + var photoviewerHTML = "
\n
\n
\n
\n " + this._creatBtns(this.options.headToolbar, btnsTpl) + "\n
\n " + this._creatTitle() + "\n
\n
\n \"\"\n
\n
\n
\n " + this._creatBtns(this.options.footToolbar, btnsTpl) + "\n
\n
\n
\n
"; + return photoviewerHTML; + }; + + _proto.build = function build() { + // Create photoviewer HTML string + var photoviewerHTML = this._creatDOM(); // Make photoviewer HTML string to jQuery element + + + var $photoviewer = $$1(photoviewerHTML); // Get all photoviewer element + + this.$photoviewer = $photoviewer; + this.$header = $photoviewer.find(CLASS_NS + '-header'); + this.$headToolbar = $photoviewer.find(CLASS_NS + '-toolbar-head'); + this.$footer = $photoviewer.find(CLASS_NS + '-footer'); + this.$footToolbar = $photoviewer.find(CLASS_NS + '-toolbar-foot'); + this.$stage = $photoviewer.find(CLASS_NS + '-stage'); + this.$title = $photoviewer.find(CLASS_NS + '-title'); + this.$image = $photoviewer.find(CLASS_NS + '-image'); + this.$close = $photoviewer.find(CLASS_NS + '-button-close'); + this.$maximize = $photoviewer.find(CLASS_NS + '-button-maximize'); + this.$minimize = $photoviewer.find(CLASS_NS + '-button-minimize'); + this.$zoomIn = $photoviewer.find(CLASS_NS + '-button-zoom-in'); + this.$zoomOut = $photoviewer.find(CLASS_NS + '-button-zoom-out'); + this.$actualSize = $photoviewer.find(CLASS_NS + '-button-actual-size'); + this.$fullscreen = $photoviewer.find(CLASS_NS + '-button-fullscreen'); + this.$rotateLeft = $photoviewer.find(CLASS_NS + '-button-rotate-left'); + this.$rotateRight = $photoviewer.find(CLASS_NS + '-button-rotate-right'); + this.$prev = $photoviewer.find(CLASS_NS + '-button-prev'); + this.$next = $photoviewer.find(CLASS_NS + '-button-next'); // Add class before image loaded + + this.$stage.addClass('stage-ready'); + this.$image.addClass('image-ready'); // Reset modal z-index with multiple instances + + this.$photoviewer.css('z-index', PUBLIC_VARS['zIndex']); // Set handle element of draggable + + if (!this.options.dragHandle || this.options.dragHandle === CLASS_NS + '-modal') { + this.dragHandle = this.$photoviewer; + } else { + this.dragHandle = this.$photoviewer.find(this.options.dragHandle); + } + }; + + _proto.open = function open() { + if (!this.options.multiInstances) { + $$1(CLASS_NS + '-modal').eq(0).remove(); + } // Fixed modal position bug + + + if (!$$1(CLASS_NS + '-modal').length && this.options.fixedContent) { + $$1('html').css({ + 'overflow': 'hidden' + }); + + if (hasScrollbar()) { + var scrollbarWidth = getScrollbarWidth(); + + if (scrollbarWidth) { + $$1('html').css({ + 'padding-right': scrollbarWidth + }); + } + } + } + + this.build(); + + this._triggerHook('beforeOpen', this.$el); // Add PhotoViewer to DOM + + + $$1('body').append(this.$photoviewer); + this.addEvents(); + this.setModalPos(this.$photoviewer); + + this._triggerHook('opened', this.$el); + }; + + _proto.close = function close() { + this._triggerHook('beforeClose', this.$el); // Remove instance + + + this.$photoviewer.remove(); + this.isOpened = false; + this.isMaximized = false; + this.isRotated = false; + this.rotateAngle = 0; + var zeroModal = !$$1(CLASS_NS + '-modal').length; // Fixed modal position bug + + if (zeroModal && this.options.fixedContent) { + $$1('html').css({ + 'overflow': '', + 'padding-right': '' + }); + } // Reset zIndex after close + + + if (zeroModal && this.options.multiInstances) { + PUBLIC_VARS['zIndex'] = this.options.zIndex; + } // off events + + + if (!$$1(CLASS_NS + '-modal').length) { + $D.off(KEYDOWN_EVENT + EVENT_NS); + $W.off(RESIZE_EVENT + EVENT_NS); + } + + this._triggerHook('closed', this.$el); + }; + + _proto.setModalPos = function setModalPos(modal) { + var winWidth = $W.width(), + winHeight = $W.height(), + scrollLeft = $D.scrollLeft(), + scrollTop = $D.scrollTop(); + var modalWidth = this.options.modalWidth, + modalHeight = this.options.modalHeight; // Set modal maximized when init + + if (this.options.initMaximized) { + modal.addClass(NS + '-maximize'); + modal.css({ + width: '100%', + height: '100%', + left: 0, + top: 0 + }); + this.isOpened = true; + this.isMaximized = true; + } else { + // Make the modal in windows center + modal.css({ + width: modalWidth, + height: modalHeight, + left: (winWidth - modalWidth) / 2 + scrollLeft + 'px', + top: (winHeight - modalHeight) / 2 + scrollTop + 'px' + }); + } + }; + + _proto.setModalSize = function setModalSize(img) { + var self = this, + winWidth = $W.width(), + winHeight = $W.height(), + scrollLeft = $D.scrollLeft(), + scrollTop = $D.scrollTop(); // stage css value + + var stageCSS = { + left: this.$stage.css('left'), + right: this.$stage.css('right'), + top: this.$stage.css('top'), + bottom: this.$stage.css('bottom'), + borderLeft: this.$stage.css('border-left-width'), + borderRight: this.$stage.css('border-right-width'), + borderTop: this.$stage.css('border-top-width'), + borderBottom: this.$stage.css('border-bottom-width') + }; // Modal size should calc with stage css value + + var modalWidth = img.width + getNumFromCSSValue(stageCSS.left) + getNumFromCSSValue(stageCSS.right) + getNumFromCSSValue(stageCSS.borderLeft) + getNumFromCSSValue(stageCSS.borderRight), + modalHeight = img.height + getNumFromCSSValue(stageCSS.top) + getNumFromCSSValue(stageCSS.bottom) + getNumFromCSSValue(stageCSS.borderTop) + getNumFromCSSValue(stageCSS.borderBottom); + var gapThreshold = (this.options.gapThreshold > 0 ? this.options.gapThreshold : 0) + 1, + // modal scale to window + scale = Math.min(winWidth / (modalWidth * gapThreshold), winHeight / (modalHeight * gapThreshold), 1); + var minWidth = Math.max(modalWidth * scale, this.options.modalWidth), + minHeight = Math.max(modalHeight * scale, this.options.modalHeight); + minWidth = this.options.fixedModalSize ? this.options.modalWidth : Math.round(minWidth); + minHeight = this.options.fixedModalSize ? this.options.modalHeight : Math.round(minHeight); + var modalCSSObj = { + width: minWidth + 'px', + height: minHeight + 'px', + left: (winWidth - minWidth) / 2 + scrollLeft + 'px', + top: (winHeight - minHeight) / 2 + scrollTop + 'px' + }; // Add modal init animation + + if (this.options.initAnimation) { + this.$photoviewer.animate(modalCSSObj, function () { + self.setImageSize(img); + }); + } else { + this.$photoviewer.css(modalCSSObj); + this.setImageSize(img); + } + + this.isOpened = true; + }; + + _proto.setImageSize = function setImageSize(img) { + var stageData = { + w: this.$stage.width(), + h: this.$stage.height() + }; // image scale to stage + + var scale = 1; + + if (!this.isRotated) { + scale = Math.min(stageData.w / img.width, stageData.h / img.height, 1); + } else { + scale = Math.min(stageData.w / img.height, stageData.h / img.width, 1); + } + + this.$image.css({ + width: Math.ceil(img.width * scale) + 'px', + height: Math.ceil(img.height * scale) + 'px', + left: (stageData.w - Math.ceil(img.width * scale)) / 2 + 'px', + top: (stageData.h - Math.ceil(img.height * scale)) / 2 + 'px' + }); // Store image initial data + + $$1.extend(this.imageData, { + width: img.width * scale, + height: img.height * scale, + left: (stageData.w - img.width * scale) / 2, + top: (stageData.h - img.height * scale) / 2 + }); // Set grab cursor + + setGrabCursor({ + w: this.$image.width(), + h: this.$image.height() + }, { + w: this.$stage.width(), + h: this.$stage.height() + }, this.$stage, this.isRotated); // loader end + + this.$photoviewer.find(CLASS_NS + '-loader').remove(); // Add image init animation + + if (this.options.initAnimation) { + this.$image.fadeIn(); + } + }; + + _proto.loadImg = function loadImg(imgSrc) { + var self = this; + var loaderHTML = "
"; // loader start + + this.$photoviewer.append(loaderHTML); + + if (this.options.initAnimation) { + this.$image.hide(); + } + + this.$image.attr('src', imgSrc); + preloadImg(imgSrc, function (img) { + // Store original data + self.imageData = { + originalWidth: img.width, + originalHeight: img.height + }; + + if (self.isMaximized || self.isOpened && self.options.fixedModalPos) { + self.setImageSize(img); + } else { + self.setModalSize(img); + } + + self.$stage.removeClass('stage-ready'); + self.$image.removeClass('image-ready'); + }, function () { + // loader end + self.$photoviewer.find(CLASS_NS + '-loader').remove(); + }); + + if (this.options.title) { + this.setImgTitle(imgSrc); + } + }; + + _proto.setImgTitle = function setImgTitle(url) { + var caption = this.groupData[this.groupIndex].caption, + captionTxt = caption ? caption : getImageNameFromUrl(url); + this.$title.text(captionTxt); + }; + + _proto.jump = function jump(index) { + this.groupIndex = this.groupIndex + index; + this.jumpTo(this.groupIndex); + }; + + _proto.jumpTo = function jumpTo(index) { + index = index % this.groupData.length; + + if (index >= 0) { + index = index % this.groupData.length; + } else if (index < 0) { + index = (this.groupData.length + index) % this.groupData.length; + } + + this.groupIndex = index; + + this._triggerHook('beforeChange', index); + + this.loadImg(this.groupData[index].src); + + this._triggerHook('changed', index); + }; + + _proto.wheel = function wheel(e) { + e.preventDefault(); + var delta = 1; + + if (e.originalEvent.deltaY) { + delta = e.originalEvent.deltaY > 0 ? 1 : -1; + } else if (e.originalEvent.wheelDelta) { + delta = -e.originalEvent.wheelDelta / 120; + } else if (e.originalEvent.detail) { + delta = e.originalEvent.detail > 0 ? 1 : -1; + } // ratio threshold + + + var ratio = -delta * this.options.ratioThreshold; // mouse point position relative to stage + + var pointer = { + x: e.originalEvent.clientX - this.$stage.offset().left + $D.scrollLeft(), + y: e.originalEvent.clientY - this.$stage.offset().top + $D.scrollTop() + }; + this.zoom(ratio, pointer, e); + }; + + _proto.zoom = function zoom(ratio, origin, e) { + // zoom out & zoom in + ratio = ratio < 0 ? 1 / (1 - ratio) : 1 + ratio; + + if (ratio > 0.95 && ratio < 1.05) { + ratio = 1; + } + + ratio = this.$image.width() / this.imageData.originalWidth * ratio; // min image size + + ratio = Math.max(ratio, this.options.minRatio); // max image size + + ratio = Math.min(ratio, this.options.maxRatio); + this.zoomTo(ratio, origin, e); + }; + + _proto.zoomTo = function zoomTo(ratio, origin, e) { + var $image = this.$image, + $stage = this.$stage, + imgData = { + w: this.imageData.width, + h: this.imageData.height, + x: this.imageData.left, + y: this.imageData.top + }; // image stage position + // We will use it to calc the relative position of image + + var stageData = { + w: $stage.width(), + h: $stage.height(), + x: $stage.offset().left, + y: $stage.offset().top + }; + var newWidth = this.imageData.originalWidth * ratio, + newHeight = this.imageData.originalHeight * ratio, + // Think about it for a while ~~~ + newLeft = origin.x - (origin.x - imgData.x) / imgData.w * newWidth, + newTop = origin.y - (origin.y - imgData.y) / imgData.h * newHeight; // δ is the difference between image new width and new height + + var δ = !this.isRotated ? 0 : (newWidth - newHeight) / 2, + imgNewWidth = !this.isRotated ? newWidth : newHeight, + imgNewHeight = !this.isRotated ? newHeight : newWidth; + var offsetX = stageData.w - newWidth, + offsetY = stageData.h - newHeight; // zoom out & zoom in condition + // It's important and it takes me a lot of time to get it + // The conditions with image rotate 90 degree drive me crazy alomst! + + if (imgNewHeight <= stageData.h) { + newTop = (stageData.h - newHeight) / 2; + } else { + newTop = newTop > δ ? δ : newTop > offsetY - δ ? newTop : offsetY - δ; + } + + if (imgNewWidth <= stageData.w) { + newLeft = (stageData.w - newWidth) / 2; + } else { + newLeft = newLeft > -δ ? -δ : newLeft > offsetX + δ ? newLeft : offsetX + δ; + } + + $image.css({ + width: Math.round(newWidth) + 'px', + height: Math.round(newHeight) + 'px', + left: Math.round(newLeft) + 'px', + top: Math.round(newTop) + 'px' + }); // Update image initial data + + $$1.extend(this.imageData, { + width: newWidth, + height: newHeight, + left: newLeft, + top: newTop + }); // Set grab cursor + + setGrabCursor({ + w: Math.round(imgNewWidth), + h: Math.round(imgNewHeight) + }, { + w: stageData.w, + h: stageData.h + }, this.$stage); + }; + + _proto.rotate = function rotate(angle) { + this.rotateAngle = this.rotateAngle + angle; + + if (this.rotateAngle / 90 % 2 === 0) { + this.isRotated = false; + } else { + this.isRotated = true; + } + + this.rotateTo(this.rotateAngle); + }; + + _proto.rotateTo = function rotateTo(angle) { + this.$image.css({ + transform: 'rotate(' + angle + 'deg)' + }); + this.setImageSize({ + width: this.imageData.originalWidth, + height: this.imageData.originalHeight + }); // Remove grab cursor when rotate + + this.$stage.removeClass('is-grab'); + }; + + _proto.resize = function resize() { + var self = this; + var resizeHandler = throttle(function () { + if (self.isOpened) { + if (self.isMaximized) { + self.setImageSize({ + width: self.imageData.originalWidth, + height: self.imageData.originalHeight + }); + } else { + self.setModalSize({ + width: self.imageData.originalWidth, + height: self.imageData.originalHeight + }); + } + } + }, 500); + return resizeHandler; + }; + + _proto.maximize = function maximize() { + + if (!this.isMaximized) { + // Store modal data before maximize + this.modalData = { + width: this.$photoviewer.width(), + height: this.$photoviewer.height(), + left: this.$photoviewer.offset().left, + top: this.$photoviewer.offset().top + }; + this.$photoviewer.addClass(NS + '-maximize'); + this.$photoviewer.css({ + width: '100%', + height: '100%', + left: 0, + top: 0 + }); + this.isMaximized = true; + } else { + this.$photoviewer.removeClass(NS + '-maximize'); + this.$photoviewer.css({ + width: this.modalData.width ? this.modalData.width : this.options.modalWidth, + height: this.modalData.height ? this.modalData.height : this.options.modalHeight, + left: this.modalData.left ? this.modalData.left : ($W.width() - this.options.modalWidth) / 2 + $D.scrollLeft(), + top: this.modalData.top ? this.modalData.top : ($W.height() - this.options.modalHeight) / 2 + $D.scrollTop() + }); + this.isMaximized = false; + } + + this.setImageSize({ + width: this.imageData.originalWidth, + height: this.imageData.originalHeight + }); + }; + + _proto.fullscreen = function fullscreen() { + requestFullscreen(this.$photoviewer[0]); + }; + + _proto.keydown = function keydown(e) { + var self = this; + + if (!this.options.keyboard) { + return false; + } + + var keyCode = e.keyCode || e.which || e.charCode, + ctrlKey = e.ctrlKey || e.metaKey, + altKey = e.altKey || e.metaKey; + + switch (keyCode) { + // ← + case 37: + self.jump(-1); + break; + // → + + case 39: + self.jump(1); + break; + // + + + case 187: + self.zoom(self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + break; + // - + + case 189: + self.zoom(-self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + break; + // + Firefox + + case 61: + self.zoom(self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + break; + // - Firefox + + case 173: + self.zoom(-self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + break; + // ctrl + alt + 0 + + case 48: + if (ctrlKey && altKey) { + self.zoomTo(1, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + } + + break; + // ctrl + , + + case 188: + if (ctrlKey) { + self.rotate(-90); + } + + break; + // ctrl + . + + case 190: + if (ctrlKey) { + self.rotate(90); + } + + break; + + default: + } + }; + + _proto.addEvents = function addEvents() { + var self = this; + this.$close.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) { + self.close(); + }); + this.$stage.off(WHEEL_EVENT + EVENT_NS).on(WHEEL_EVENT + EVENT_NS, function (e) { + self.wheel(e); + }); + this.$zoomIn.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) { + self.zoom(self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + }); + this.$zoomOut.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) { + self.zoom(-self.options.ratioThreshold * 3, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + }); + this.$actualSize.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) { + self.zoomTo(1, { + x: self.$stage.width() / 2, + y: self.$stage.height() / 2 + }, e); + }); + this.$prev.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.jump(-1); + }); + this.$fullscreen.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.fullscreen(); + }); + this.$next.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.jump(1); + }); + this.$rotateLeft.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.rotate(-90); + }); + this.$rotateRight.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.rotate(90); + }); + this.$maximize.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () { + self.maximize(); + }); + $D.off(KEYDOWN_EVENT + EVENT_NS).on(KEYDOWN_EVENT + EVENT_NS, function (e) { + self.keydown(e); + }); + $W.on(RESIZE_EVENT + EVENT_NS, self.resize()); + }; + + _proto._triggerHook = function _triggerHook(e, data) { + if (this.options.callbacks[e]) { + this.options.callbacks[e].apply(this, $$1.isArray(data) ? data : [data]); + } + }; + + return PhotoViewer; + }(); + /** + * Add methods to PhotoViewer + */ + + + $$1.extend(PhotoViewer.prototype, draggable, movable, resizable); + /** + * Add PhotoViewer to globle + */ + + window.PhotoViewer = PhotoViewer; + /** + * jQuery plugin + */ + + var jqEl = null, + getImgGroup = function getImgGroup(list, groupName) { + var items = []; + $$1(list).each(function () { + var src = getImgSrc(this); + items.push({ + src: src, + caption: $$1(this).attr('data-caption'), + groupName: groupName + }); + }); + return items; + }; + + $$1.fn.photoviewer = function (options) { + jqEl = $$1(this); // Convert a numeric string into a number + + for (var key in options) { + if (typeof options[key] === 'string' && !isNaN(options[key])) { + options[key] = parseFloat(options[key]); + } + } // Get init event, 'click' or 'dblclick' + + + var opts = $$1.extend(true, {}, DEFAULTS, options); // We should get zIndex of options before plugin's init. + + PUBLIC_VARS['zIndex'] = opts.zIndex; + + if (typeof options === 'string') ; else { + if (opts.initEvent === 'dblclick') { + jqEl.off('click' + EVENT_NS).on('click' + EVENT_NS, function (e) { + e.preventDefault(); // This will stop triggering data-api event + + e.stopPropagation(); + }); + } + + jqEl.off(opts.initEvent + EVENT_NS).on(opts.initEvent + EVENT_NS, function (e) { + e.preventDefault(); // This will stop triggering data-api event + + e.stopPropagation(); // Get image group + + var items = [], + currentGroupName = $$1(this).attr('data-group'), + groupList = $D.find('[data-group="' + currentGroupName + '"]'); + + if (currentGroupName !== undefined) { + items = getImgGroup(groupList, currentGroupName); + options['index'] = $$1(this).index('[data-group="' + currentGroupName + '"]'); + } else { + items = getImgGroup(jqEl.not('[data-group]')); + options['index'] = $$1(this).index(); + } + + $$1(this).data(NS, new PhotoViewer(items, options, this)); + }); + } + + return jqEl; + }; + /** + * PhotoViewer DATA-API + */ + + + $D.on(CLICK_EVENT + EVENT_NS, '[data-' + NS + ']', function (e) { + jqEl = $$1('[data-' + NS + ']'); + e.preventDefault(); // Get image group + + var items = [], + currentGroupName = $$1(this).attr('data-group'), + groupList = $D.find('[data-group="' + currentGroupName + '"]'); + + if (currentGroupName !== undefined) { + items = getImgGroup(groupList, currentGroupName); + DEFAULTS['index'] = $$1(this).index('[data-group="' + currentGroupName + '"]'); + } else { + items = getImgGroup(jqEl.not('[data-group]')); + DEFAULTS['index'] = $$1(this).index(); + } + + $$1(this).data(NS, new PhotoViewer(items, DEFAULTS, this)); + }); + + return PhotoViewer; + +}))); +//# sourceMappingURL=photoviewer.js.map diff --git a/dist/photoviewer.js.map b/dist/photoviewer.js.map new file mode 100644 index 0000000..3b6bca7 --- /dev/null +++ b/dist/photoviewer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"photoviewer.js","sources":["../src/js/defaults.js","../src/js/utilities.js","../src/js/constants.js","../src/js/draggable.js","../src/js/movable.js","../src/js/resizable.js","../src/js/core.js"],"sourcesContent":["export default {\n\n // Enable modal to drag\n draggable: true,\n\n // Enable modal to resize\n resizable: true,\n\n // Enable image to move\n movable: true,\n\n // Enable keyboard navigation\n keyboard: true,\n\n // Shows the title\n title: true,\n\n // Min width of modal\n modalWidth: 320,\n\n // Min height of modal\n modalHeight: 320,\n\n // Enable the page content fixed\n fixedContent: true,\n\n // Disable the modal size fixed\n fixedModalSize: false,\n\n // Disable the image viewer maximized on init\n initMaximized: false,\n\n // Threshold of modal to browser window\n gapThreshold: 0.02,\n\n // Threshold of image ratio\n ratioThreshold: 0.1,\n\n // Min ratio of image when zoom out\n minRatio: 0.1,\n\n // Max ratio of image when zoom in\n maxRatio: 16,\n\n // Toolbar options in header\n headToolbar: [\n 'maximize',\n 'close'\n ],\n\n // Toolbar options in footer\n footToolbar: [\n 'zoomIn',\n 'zoomOut',\n 'prev',\n 'fullscreen',\n 'next',\n 'actualSize',\n 'rotateRight'\n ],\n\n // Customize button icon\n icons: {\n minimize: 'fa fa-window-minimize',\n maximize: 'fa fa-window-maximize',\n close: 'fa fa-close',\n zoomIn: 'fa fa-search-plus',\n zoomOut: 'fa fa-search-minus',\n prev: 'fa fa-arrow-left',\n next: 'fa fa-arrow-right',\n fullscreen: 'fa fa-photo',\n actualSize: 'fa fa-arrows-alt',\n rotateLeft: 'fa fa-rotate-left',\n rotateRight: 'fa fa-rotate-right'\n },\n\n // Customize language of button title\n i18n: {\n minimize: 'minimize',\n maximize: 'maximize',\n close: 'close',\n zoomIn: 'zoom-in(+)',\n zoomOut: 'zoom-out(-)',\n prev: 'prev(←)',\n next: 'next(→)',\n fullscreen: 'fullscreen',\n actualSize: 'actual-size(Ctrl+Alt+0)',\n rotateLeft: 'rotate-left(Ctrl+,)',\n rotateRight: 'rotate-right(Ctrl+.)'\n },\n\n // Enable multiple instances\n multiInstances: true,\n\n // Init trigger event\n initEvent: 'click',\n\n // Enable animation\n initAnimation: true,\n\n // Disable modal position fixed when change images\n fixedModalPos: false,\n\n // Modal z-index\n zIndex: 1090,\n\n // Selector of drag handler\n dragHandle: false,\n\n // Callback events\n callbacks: {\n beforeOpen: $.noop,\n opened: $.noop,\n beforeClose: $.noop,\n closed: $.noop,\n beforeChange: $.noop,\n changed: $.noop\n },\n\n // Start images index\n index: 0\n\n}\n","/**\n * [getImgSrc]\n * @param {[Object]} el [description]\n */\nexport function getImgSrc(el) {\n // Get data-src as image src at first\n let src = $(el).attr('data-src') ? $(el).attr('data-src') : $(el).attr('href');\n return src;\n}\n\n/**\n * [throttle]\n * @param {Function} fn [description]\n * @param {[Number]} delay [description]\n * @return {Function} [description]\n */\nexport function throttle(fn, delay) {\n\n let timer = null;\n\n return function () {\n let context = this,\n args = arguments;\n\n clearTimeout(timer);\n\n timer = setTimeout(function () {\n fn.apply(context, args);\n }, delay);\n };\n\n}\n\n/**\n * [preloadImg]\n * @param {[String]} src [image src]\n * @param {Function} success [callbacks]\n * @param {Function} error [callbacks]\n */\nexport function preloadImg(src, success, error) {\n\n let img = new Image();\n\n img.onload = function () {\n success(img);\n };\n\n img.onerror = function () {\n error(img);\n };\n\n img.src = src;\n\n}\n\n/**\n * [requestFullscreen]\n * @param {[type]} element [description]\n */\nexport function requestFullscreen(element) {\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n }\n}\n\n/**\n * [exitFullscreen]\n */\nexport function exitFullscreen() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n}\n\n/**\n * [getImageNameFromUrl]\n * @param {[String]} url [description]\n * @return {[String]} [description]\n */\nexport function getImageNameFromUrl(url) {\n let reg = /^.*?\\/*([^/?]*)\\.[a-z]+(\\?.+|$)/ig,\n txt = url.replace(reg, '$1');\n return txt;\n}\n\n/**\n * [getNumFromCSSValue]\n * @param {[String]} value [description]\n * @return {[Number]} [description]\n */\nexport function getNumFromCSSValue(value) {\n let reg = /\\d+/g,\n arr = value.match(reg),\n num = parseFloat(arr[0]);\n return num;\n}\n\n/**\n * [hasScrollbar]\n * @return {[Boolean]} [description]\n */\nexport function hasScrollbar() {\n return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight);\n}\n\n/**\n * [getScrollbarWidth]\n * @return {[Number]} [description]\n */\nexport function getScrollbarWidth() {\n\n let scrollDiv = document.createElement('div');\n scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';\n document.body.appendChild(scrollDiv);\n let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n\n return scrollbarWidth;\n\n}\n\n/**\n * [setGrabCursor]\n * @param {[Object]} imageData [description]\n * @param {[Object]} stageData [description]\n * @param {[Object]} stage [description]\n * @param {[Boolean]} isRotate [description]\n */\nexport function setGrabCursor(imageData, stageData, stage, isRotated) {\n\n let imageWidth = !isRotated ? imageData.w : imageData.h,\n imageHeight = !isRotated ? imageData.h : imageData.w;\n\n if (imageHeight > stageData.h || imageWidth > stageData.w) {\n stage.addClass('is-grab');\n }\n if (imageHeight <= stageData.h && imageWidth <= stageData.w) {\n stage.removeClass('is-grab');\n }\n}\n\n/**\n * [supportTouch]\n * @return {[Boolean]} [description]\n */\nexport function supportTouch() {\n return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);\n}\n","import defaults from './defaults';\nimport { supportTouch } from './utilities';\n\nexport const $W = $(window);\nexport const $D = $(document);\n\nexport const CLICK_EVENT = 'click';\nexport const RESIZE_EVENT = 'resize';\nexport const KEYDOWN_EVENT = 'keydown';\nexport const WHEEL_EVENT = 'wheel mousewheel DOMMouseScroll';\n\nexport const TOUCH_START_EVENT = supportTouch() ? 'touchstart' : 'mousedown';\nexport const TOUCH_MOVE_EVENT = supportTouch() ? 'touchmove' : 'mousemove';\nexport const TOUCH_END_EVENT = supportTouch() ? 'touchend' : 'mouseup';\n\nexport const NS = 'photoviewer';\nexport const CLASS_NS = '.' + NS;\nexport const EVENT_NS = '.' + NS;\n\nexport const PUBLIC_VARS = {\n // image moving flag\n isMoving: false,\n // modal resizing flag\n isResizing: false,\n // modal z-index setting\n zIndex: defaults.zIndex,\n};\n","import {\n $D,\n TOUCH_START_EVENT,\n TOUCH_MOVE_EVENT,\n TOUCH_END_EVENT,\n EVENT_NS,\n PUBLIC_VARS\n} from './constants';\n\nexport default {\n\n /**\n * [draggable]\n * @param {[Object]} modal [the modal element]\n * @param {[Object]} dragHandle [the handle element when dragging]\n * @param {[Object]} dragCancel [the cancel element when dragging]\n */\n draggable(modal, dragHandle, dragCancel) {\n\n let self = this;\n\n let isDragging = false;\n\n let startX = 0,\n startY = 0,\n\n left = 0,\n top = 0;\n\n let dragStart = function (e) {\n\n e = e || window.event;\n\n // Must be removed\n // e.preventDefault();\n\n if (self.options.multiInstances) {\n modal.css('z-index', ++PUBLIC_VARS['zIndex']);\n }\n\n // Get clicked button\n let elemCancel = $(e.target).closest(dragCancel);\n // Stop modal moving when click buttons\n if (elemCancel.length) {\n return true;\n }\n\n isDragging = true;\n\n startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX;\n startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY;\n\n left = $(modal).offset().left;\n top = $(modal).offset().top;\n\n $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .on(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n };\n\n let dragMove = function (e) {\n\n e = e || window.event;\n\n e.preventDefault();\n\n if (isDragging && !PUBLIC_VARS['isMoving'] && !PUBLIC_VARS['isResizing'] && !self.isMaximized) {\n\n let endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX,\n endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY,\n\n relativeX = endX - startX,\n relativeY = endY - startY;\n\n $(modal).css({\n left: relativeX + left + 'px',\n top: relativeY + top + 'px'\n });\n\n }\n\n };\n\n let dragEnd = function () {\n\n $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .off(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n isDragging = false;\n\n };\n\n $(dragHandle).on(TOUCH_START_EVENT + EVENT_NS, dragStart);\n\n }\n\n}\n","import {\n $D,\n TOUCH_START_EVENT,\n TOUCH_MOVE_EVENT,\n TOUCH_END_EVENT,\n NS,\n EVENT_NS,\n PUBLIC_VARS\n} from './constants';\n\nconst ELEMS_WITH_GRABBING_CURSOR = `html,body,.${NS}-modal,.${NS}-stage,.${NS}-button,.${NS}-resizable-handle`;\n\nexport default {\n\n /**\n * --------------------------------------\n * 1.no movable\n * 2.vertical movable\n * 3.horizontal movable\n * 4.vertical & horizontal movable\n * --------------------------------------\n *\n * [image movable]\n * @param {[Object]} stage [the stage element]\n * @param {[Object]} image [the image element]\n */\n movable(stage, image) {\n\n let self = this;\n\n let isDragging = false;\n\n let startX = 0,\n startY = 0,\n\n left = 0,\n top = 0,\n\n widthDiff = 0,\n heightDiff = 0,\n\n δ = 0;\n\n let dragStart = function (e) {\n\n e = e || window.event;\n\n e.preventDefault();\n\n let imageWidth = $(image).width(),\n imageHeight = $(image).height(),\n stageWidth = $(stage).width(),\n stageHeight = $(stage).height();\n\n startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX;\n startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY;\n\n // δ is the difference between image width and height\n δ = !self.isRotated ? 0 : (imageWidth - imageHeight) / 2;\n\n // Width or height difference can be use to limit image right or top position\n widthDiff = !self.isRotated ? (imageWidth - stageWidth) : (imageHeight - stageWidth);\n heightDiff = !self.isRotated ? (imageHeight - stageHeight) : (imageWidth - stageHeight);\n\n // Modal can be dragging if image is smaller to stage\n isDragging = (widthDiff > 0 || heightDiff > 0) ? true : false;\n PUBLIC_VARS['isMoving'] = (widthDiff > 0 || heightDiff > 0) ? true : false;\n\n // Reclac the element position when mousedown\n // Fixed the issue of stage with a border\n left = $(image).position().left - δ;\n top = $(image).position().top + δ;\n\n // Add grabbing cursor\n if (stage.hasClass('is-grab')) {\n $(ELEMS_WITH_GRABBING_CURSOR).addClass('is-grabbing');\n }\n\n $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .on(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n };\n\n let dragMove = function (e) {\n\n e = e || window.event;\n\n e.preventDefault();\n\n if (isDragging) {\n\n let endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX,\n endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY,\n\n relativeX = endX - startX,\n relativeY = endY - startY,\n\n newLeft = relativeX + left,\n newTop = relativeY + top;\n\n // vertical limit\n if (heightDiff > 0) {\n\n if ((relativeY + top) > δ) {\n newTop = δ;\n } else if ((relativeY + top) < -heightDiff + δ) {\n newTop = -heightDiff + δ;\n }\n\n } else {\n newTop = top;\n }\n // horizontal limit\n if (widthDiff > 0) {\n\n if ((relativeX + left) > -δ) {\n newLeft = -δ;\n } else if ((relativeX + left) < -widthDiff - δ) {\n newLeft = -widthDiff - δ;\n }\n\n } else {\n newLeft = left;\n }\n\n $(image).css({\n left: newLeft + 'px',\n top: newTop + 'px'\n });\n\n // Update image initial data\n $.extend(self.imageData, {\n left: newLeft,\n top: newTop\n });\n\n }\n\n };\n\n let dragEnd = function () {\n\n $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .off(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n isDragging = false;\n PUBLIC_VARS['isMoving'] = false;\n\n // Remove grabbing cursor\n $(ELEMS_WITH_GRABBING_CURSOR).removeClass('is-grabbing');\n\n };\n\n $(stage).on(TOUCH_START_EVENT + EVENT_NS, dragStart);\n\n }\n\n}\n","import {\n $D,\n TOUCH_START_EVENT,\n TOUCH_MOVE_EVENT,\n TOUCH_END_EVENT,\n NS,\n EVENT_NS,\n PUBLIC_VARS\n} from './constants';\n\nimport {\n setGrabCursor\n} from './utilities';\n\nconst ELEMS_WITH_RESIZE_CURSOR = `html,body,.${NS}-modal,.${NS}-stage,.${NS}-button`;\n\nexport default {\n\n /**\n * ------------------------------\n * 1.modal resizable\n * 2.keep image in stage center\n * 3.other image limitations\n * ------------------------------\n *\n * [resizable]\n * @param {[Object]} modal [the modal element]\n * @param {[Object]} stage [the stage element]\n * @param {[Object]} image [the image element]\n * @param {[Number]} minWidth [the option of modalWidth]\n * @param {[Number]} minHeight [the option of modalHeight]\n */\n resizable(modal, stage, image, minWidth, minHeight) {\n\n let self = this;\n\n let resizableHandleE = $(`
`),\n resizableHandleW = $(`
`),\n resizableHandleS = $(`
`),\n resizableHandleN = $(`
`),\n resizableHandleSE = $(`
`),\n resizableHandleSW = $(`
`),\n resizableHandleNE = $(`
`),\n resizableHandleNW = $(`
`);\n\n let resizableHandles = {\n 'e': resizableHandleE,\n 's': resizableHandleS,\n 'se': resizableHandleSE,\n 'n': resizableHandleN,\n 'w': resizableHandleW,\n 'nw': resizableHandleNW,\n 'ne': resizableHandleNE,\n 'sw': resizableHandleSW\n };\n\n $(modal).append(\n resizableHandleE, resizableHandleW, resizableHandleS, resizableHandleN,\n resizableHandleSE, resizableHandleSW, resizableHandleNE, resizableHandleNW\n );\n\n let isDragging = false;\n\n let startX = 0,\n startY = 0,\n\n modalData = {\n w: 0,\n h: 0,\n l: 0,\n t: 0\n },\n stageData = {\n w: 0,\n h: 0,\n l: 0,\n t: 0\n },\n imageData = {\n w: 0,\n h: 0,\n l: 0,\n t: 0\n },\n\n // δ is the difference between image width and height\n δ = 0,\n imgWidth = 0,\n imgHeight = 0,\n\n direction = '';\n\n // modal CSS options\n let getModalOpts = function (dir, offsetX, offsetY) {\n\n // Modal should not move when its width to the minwidth\n let modalLeft = (-offsetX + modalData.w) > minWidth ? (offsetX + modalData.l) : (modalData.l + modalData.w - minWidth),\n modalTop = (-offsetY + modalData.h) > minHeight ? (offsetY + modalData.t) : (modalData.t + modalData.h - minHeight);\n\n let opts = {\n 'e': {\n width: Math.max((offsetX + modalData.w), minWidth) + 'px'\n },\n 's': {\n height: Math.max((offsetY + modalData.h), minHeight) + 'px'\n },\n 'se': {\n width: Math.max((offsetX + modalData.w), minWidth) + 'px',\n height: Math.max((offsetY + modalData.h), minHeight) + 'px'\n },\n 'w': {\n width: Math.max((-offsetX + modalData.w), minWidth) + 'px',\n left: modalLeft + 'px'\n },\n 'n': {\n height: Math.max((-offsetY + modalData.h), minHeight) + 'px',\n top: modalTop + 'px'\n },\n 'nw': {\n width: Math.max((-offsetX + modalData.w), minWidth) + 'px',\n height: Math.max((-offsetY + modalData.h), minHeight) + 'px',\n top: modalTop + 'px',\n left: modalLeft + 'px'\n },\n 'ne': {\n width: Math.max((offsetX + modalData.w), minWidth) + 'px',\n height: Math.max((-offsetY + modalData.h), minHeight) + 'px',\n top: modalTop + 'px'\n },\n 'sw': {\n width: Math.max((-offsetX + modalData.w), minWidth) + 'px',\n height: Math.max((offsetY + modalData.h), minHeight) + 'px',\n left: modalLeft + 'px'\n }\n };\n\n return opts[dir];\n };\n\n // image CSS options\n let getImageOpts = function (dir, offsetX, offsetY) {\n\n // Image should not move when modal width to the min width\n // The minwidth is modal width, so we should clac the stage minwidth\n let widthDiff = (offsetX + modalData.w) > minWidth ? (stageData.w - imgWidth + offsetX - δ) : (minWidth - (modalData.w - stageData.w) - imgWidth - δ),\n heightDiff = (offsetY + modalData.h) > minHeight ? (stageData.h - imgHeight + offsetY + δ) : (minHeight - (modalData.h - stageData.h) - imgHeight + δ),\n\n widthDiff2 = (-offsetX + modalData.w) > minWidth ? (stageData.w - imgWidth - offsetX - δ) : (minWidth - (modalData.w - stageData.w) - imgWidth - δ),\n heightDiff2 = (-offsetY + modalData.h) > minHeight ? (stageData.h - imgHeight - offsetY + δ) : (minHeight - (modalData.h - stageData.h) - imgHeight + δ);\n\n // Get image position in dragging\n let imgLeft = (widthDiff > 0 ? $(image).position().left : ($(image).position().left < 0 ? $(image).position().left : 0)) - δ,\n imgTop = (heightDiff > 0 ? $(image).position().top : ($(image).position().top < 0 ? $(image).position().top : 0)) + δ,\n\n imgLeft2 = (widthDiff2 > 0 ? $(image).position().left : ($(image).position().left < 0 ? $(image).position().left : 0)) - δ,\n imgTop2 = (heightDiff2 > 0 ? $(image).position().top : ($(image).position().top < 0 ? $(image).position().top : 0)) + δ;\n\n let opts = {\n 'e': {\n left: widthDiff >= -δ ? ((widthDiff - δ) / 2 + 'px') : (imgLeft > widthDiff ? (imgLeft + 'px') : (widthDiff + 'px'))\n },\n 's': {\n top: heightDiff >= δ ? ((heightDiff + δ) / 2 + 'px') : (imgTop > heightDiff ? (imgTop + 'px') : (heightDiff + 'px'))\n },\n 'se': {\n top: heightDiff >= δ ? ((heightDiff + δ) / 2 + 'px') : (imgTop > heightDiff ? (imgTop + 'px') : (heightDiff + 'px')),\n left: widthDiff >= -δ ? ((widthDiff - δ) / 2 + 'px') : (imgLeft > widthDiff ? (imgLeft + 'px') : (widthDiff + 'px'))\n },\n 'w': {\n left: widthDiff2 >= -δ ? ((widthDiff2 - δ) / 2 + 'px') : (imgLeft2 > widthDiff2 ? (imgLeft2 + 'px') : (widthDiff2 + 'px'))\n },\n 'n': {\n top: heightDiff2 >= δ ? ((heightDiff2 + δ) / 2 + 'px') : (imgTop2 > heightDiff2 ? (imgTop2 + 'px') : (heightDiff2 + 'px'))\n },\n 'nw': {\n top: heightDiff2 >= δ ? ((heightDiff2 + δ) / 2 + 'px') : (imgTop2 > heightDiff2 ? (imgTop2 + 'px') : (heightDiff2 + 'px')),\n left: widthDiff2 >= -δ ? ((widthDiff2 - δ) / 2 + 'px') : (imgLeft2 > widthDiff2 ? (imgLeft2 + 'px') : (widthDiff2 + 'px'))\n },\n 'ne': {\n top: heightDiff2 >= δ ? ((heightDiff2 + δ) / 2 + 'px') : (imgTop2 > heightDiff2 ? (imgTop2 + 'px') : (heightDiff2 + 'px')),\n left: widthDiff >= -δ ? ((widthDiff - δ) / 2 + 'px') : (imgLeft > widthDiff ? (imgLeft + 'px') : (widthDiff + 'px'))\n },\n 'sw': {\n top: heightDiff >= δ ? ((heightDiff + δ) / 2 + 'px') : (imgTop > heightDiff ? (imgTop + 'px') : (heightDiff + 'px')),\n left: widthDiff2 >= -δ ? ((widthDiff2 - δ) / 2 + 'px') : (imgLeft2 > widthDiff2 ? (imgLeft2 + 'px') : (widthDiff2 + 'px'))\n }\n };\n\n return opts[dir];\n };\n\n let dragStart = function (dir, e) {\n\n e = e || window.event;\n\n e.preventDefault();\n\n isDragging = true;\n PUBLIC_VARS['isResizing'] = true;\n\n startX = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageX : e.clientX;\n startY = e.type === 'touchstart' ? e.originalEvent.targetTouches[0].pageY : e.clientY;\n\n // Reclac the modal data when mousedown\n modalData = {\n w: $(modal).width(),\n h: $(modal).height(),\n l: $(modal).offset().left,\n t: $(modal).offset().top\n };\n\n stageData = {\n w: $(stage).width(),\n h: $(stage).height(),\n l: $(stage).offset().left,\n t: $(stage).offset().top\n };\n\n imageData = {\n w: $(image).width(),\n h: $(image).height(),\n l: $(image).position().left,\n t: $(image).position().top\n };\n\n // δ is the difference between image width and height\n δ = !self.isRotated ? 0 : (imageData.w - imageData.h) / 2;\n imgWidth = !self.isRotated ? imageData.w : imageData.h;\n imgHeight = !self.isRotated ? imageData.h : imageData.w;\n\n direction = dir;\n\n // Add resizable cursor\n $(ELEMS_WITH_RESIZE_CURSOR).css('cursor', dir + '-resize');\n\n $D.on(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .on(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n };\n\n let dragMove = function (e) {\n\n e = e || window.event;\n\n e.preventDefault();\n\n if (isDragging && !self.isMaximized) {\n\n let endX = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageX : e.clientX,\n endY = e.type === 'touchmove' ? e.originalEvent.targetTouches[0].pageY : e.clientY,\n\n relativeX = endX - startX,\n relativeY = endY - startY;\n\n let modalOpts = getModalOpts(direction, relativeX, relativeY);\n\n $(modal).css(modalOpts);\n\n let imageOpts = getImageOpts(direction, relativeX, relativeY);\n\n $(image).css(imageOpts);\n\n }\n\n };\n\n let dragEnd = function () {\n\n $D.off(TOUCH_MOVE_EVENT + EVENT_NS, dragMove)\n .off(TOUCH_END_EVENT + EVENT_NS, dragEnd);\n\n // Set grab cursor\n if (PUBLIC_VARS['isResizing']) {\n setGrabCursor({ w: imgWidth, h: imgHeight }, { w: $(stage).width(), h: $(stage).height() },\n stage\n );\n }\n\n isDragging = false;\n PUBLIC_VARS['isResizing'] = false;\n\n // Remove resizable cursor\n $(ELEMS_WITH_RESIZE_CURSOR).css('cursor', '');\n\n };\n\n $.each(resizableHandles, function (dir, handle) {\n handle.on(TOUCH_START_EVENT + EVENT_NS, function (e) {\n dragStart(dir, e);\n });\n });\n\n }\n\n}\n","import $ from 'jquery';\n\nimport DEFAULTS from './defaults';\n\nimport {\n $W,\n $D,\n CLICK_EVENT,\n RESIZE_EVENT,\n KEYDOWN_EVENT,\n WHEEL_EVENT,\n NS,\n CLASS_NS,\n EVENT_NS,\n PUBLIC_VARS\n} from './constants';\n\nimport {\n getImgSrc,\n throttle,\n preloadImg,\n requestFullscreen,\n getImageNameFromUrl,\n getNumFromCSSValue,\n hasScrollbar,\n getScrollbarWidth,\n setGrabCursor\n} from './utilities';\n\nimport draggable from './draggable';\nimport movable from './movable';\nimport resizable from './resizable';\n\n/**\n * PhotoViewer Class\n */\nclass PhotoViewer {\n\n constructor(items, options, el) {\n\n let self = this;\n\n this.options = $.extend(true, {}, DEFAULTS, options);\n\n if (options && $.isArray(options.footToolbar)) {\n this.options.footToolbar = options.footToolbar;\n }\n\n if (options && $.isArray(options.headToolbar)) {\n this.options.headToolbar = options.headToolbar;\n }\n\n // Store element of clicked\n this.$el = $(el);\n\n // As we have multiple instances,\n // so every instance has following variables.\n\n // modal open flag\n this.isOpened = false;\n // modal maximize flag\n this.isMaximized = false;\n // image rotate 90*(2n+1) flag\n this.isRotated = false;\n // image rotate angle\n this.rotateAngle = 0;\n\n // Store image data in every instance\n this.imageData = {};\n // Store modal data in every instance\n this.modalData = {\n width: null,\n height: null,\n left: null,\n top: null\n };\n\n this.init(items, self.options, el);\n\n }\n\n init(items, opts, el) {\n\n this.groupData = items;\n this.groupIndex = opts['index'];\n\n // Get image src\n let imgSrc = items[this.groupIndex]['src'];\n\n this.open();\n\n this.loadImg(imgSrc);\n\n // draggable & movable & resizable\n if (opts.draggable) {\n this.draggable(this.$photoviewer, this.dragHandle, CLASS_NS + '-button');\n }\n if (opts.movable) {\n this.movable(this.$stage, this.$image);\n }\n if (opts.resizable) {\n this.resizable(this.$photoviewer, this.$stage, this.$image, opts.modalWidth, opts.modalHeight);\n }\n\n }\n\n _creatBtns(toolbar, btns) {\n\n let btnsStr = '';\n\n $.each(toolbar, function (index, item) {\n btnsStr += btns[item];\n });\n\n return btnsStr;\n\n }\n\n _creatTitle() {\n return (this.options.title ? `
` : '');\n }\n\n _creatDOM() {\n\n let btnsTpl = {\n minimize: ``,\n maximize: ``,\n close: ``,\n zoomIn: ``,\n zoomOut: ``,\n prev: ``,\n next: ``,\n fullscreen: ``,\n actualSize: ``,\n rotateLeft: ``,\n rotateRight: ``\n };\n\n // photoviewer base HTML\n let photoviewerHTML = `
\n
\n
\n
\n ${this._creatBtns(this.options.headToolbar, btnsTpl)}\n
\n ${this._creatTitle()}\n
\n
\n \"\"\n
\n
\n
\n ${this._creatBtns(this.options.footToolbar, btnsTpl)}\n
\n
\n
\n
`;\n\n return photoviewerHTML;\n\n }\n\n build() {\n\n // Create photoviewer HTML string\n let photoviewerHTML = this._creatDOM();\n\n // Make photoviewer HTML string to jQuery element\n let $photoviewer = $(photoviewerHTML);\n\n // Get all photoviewer element\n this.$photoviewer = $photoviewer;\n this.$header = $photoviewer.find(CLASS_NS + '-header');\n this.$headToolbar = $photoviewer.find(CLASS_NS + '-toolbar-head');\n this.$footer = $photoviewer.find(CLASS_NS + '-footer');\n this.$footToolbar = $photoviewer.find(CLASS_NS + '-toolbar-foot');\n this.$stage = $photoviewer.find(CLASS_NS + '-stage');\n this.$title = $photoviewer.find(CLASS_NS + '-title');\n this.$image = $photoviewer.find(CLASS_NS + '-image');\n this.$close = $photoviewer.find(CLASS_NS + '-button-close');\n this.$maximize = $photoviewer.find(CLASS_NS + '-button-maximize');\n this.$minimize = $photoviewer.find(CLASS_NS + '-button-minimize');\n this.$zoomIn = $photoviewer.find(CLASS_NS + '-button-zoom-in');\n this.$zoomOut = $photoviewer.find(CLASS_NS + '-button-zoom-out');\n this.$actualSize = $photoviewer.find(CLASS_NS + '-button-actual-size');\n this.$fullscreen = $photoviewer.find(CLASS_NS + '-button-fullscreen');\n this.$rotateLeft = $photoviewer.find(CLASS_NS + '-button-rotate-left');\n this.$rotateRight = $photoviewer.find(CLASS_NS + '-button-rotate-right');\n this.$prev = $photoviewer.find(CLASS_NS + '-button-prev');\n this.$next = $photoviewer.find(CLASS_NS + '-button-next');\n\n // Add class before image loaded\n this.$stage.addClass('stage-ready');\n this.$image.addClass('image-ready');\n\n // Reset modal z-index with multiple instances\n this.$photoviewer.css('z-index', PUBLIC_VARS['zIndex']);\n\n // Set handle element of draggable\n if (!this.options.dragHandle || this.options.dragHandle === CLASS_NS + '-modal') {\n this.dragHandle = this.$photoviewer;\n } else {\n this.dragHandle = this.$photoviewer.find(this.options.dragHandle);\n }\n\n }\n\n open() {\n\n if (!this.options.multiInstances) {\n $(CLASS_NS + '-modal').eq(0).remove();\n }\n\n // Fixed modal position bug\n if (!$(CLASS_NS + '-modal').length && this.options.fixedContent) {\n\n $('html').css({ 'overflow': 'hidden' });\n\n if (hasScrollbar()) {\n let scrollbarWidth = getScrollbarWidth();\n if (scrollbarWidth) {\n $('html').css({ 'padding-right': scrollbarWidth });\n }\n }\n\n }\n\n this.build();\n\n this._triggerHook('beforeOpen', this.$el);\n\n // Add PhotoViewer to DOM\n $('body').append(this.$photoviewer);\n\n this.addEvents();\n\n this.setModalPos(this.$photoviewer);\n\n this._triggerHook('opened', this.$el);\n\n }\n\n close() {\n\n this._triggerHook('beforeClose', this.$el);\n\n // Remove instance\n this.$photoviewer.remove();\n\n this.isOpened = false;\n this.isMaximized = false;\n this.isRotated = false;\n this.rotateAngle = 0;\n\n let zeroModal = !$(CLASS_NS + '-modal').length;\n\n // Fixed modal position bug\n if (zeroModal && this.options.fixedContent) {\n $('html').css({ 'overflow': '', 'padding-right': '' });\n }\n\n // Reset zIndex after close\n if (zeroModal && this.options.multiInstances) {\n PUBLIC_VARS['zIndex'] = this.options.zIndex;\n }\n\n // off events\n if (!$(CLASS_NS + '-modal').length) {\n $D.off(KEYDOWN_EVENT + EVENT_NS);\n $W.off(RESIZE_EVENT + EVENT_NS);\n }\n\n this._triggerHook('closed', this.$el);\n\n }\n\n setModalPos(modal) {\n\n let winWidth = $W.width(),\n winHeight = $W.height(),\n scrollLeft = $D.scrollLeft(),\n scrollTop = $D.scrollTop();\n\n let modalWidth = this.options.modalWidth,\n modalHeight = this.options.modalHeight;\n\n // Set modal maximized when init\n if (this.options.initMaximized) {\n\n modal.addClass(NS + '-maximize');\n\n modal.css({\n width: '100%',\n height: '100%',\n left: 0,\n top: 0\n });\n\n this.isOpened = true;\n this.isMaximized = true;\n\n } else {\n\n // Make the modal in windows center\n modal.css({\n width: modalWidth,\n height: modalHeight,\n left: (winWidth - modalWidth) / 2 + scrollLeft + 'px',\n top: (winHeight - modalHeight) / 2 + scrollTop + 'px'\n });\n\n }\n\n }\n\n setModalSize(img) {\n\n let self = this,\n winWidth = $W.width(),\n winHeight = $W.height(),\n scrollLeft = $D.scrollLeft(),\n scrollTop = $D.scrollTop();\n\n // stage css value\n let stageCSS = {\n left: this.$stage.css('left'),\n right: this.$stage.css('right'),\n top: this.$stage.css('top'),\n bottom: this.$stage.css('bottom'),\n borderLeft: this.$stage.css('border-left-width'),\n borderRight: this.$stage.css('border-right-width'),\n borderTop: this.$stage.css('border-top-width'),\n borderBottom: this.$stage.css('border-bottom-width')\n };\n\n // Modal size should calc with stage css value\n let modalWidth = img.width + getNumFromCSSValue(stageCSS.left) + getNumFromCSSValue(stageCSS.right) +\n getNumFromCSSValue(stageCSS.borderLeft) + getNumFromCSSValue(stageCSS.borderRight),\n modalHeight = img.height + getNumFromCSSValue(stageCSS.top) + getNumFromCSSValue(stageCSS.bottom) +\n getNumFromCSSValue(stageCSS.borderTop) + getNumFromCSSValue(stageCSS.borderBottom);\n\n let gapThreshold = (this.options.gapThreshold > 0 ? this.options.gapThreshold : 0) + 1,\n // modal scale to window\n scale = Math.min(winWidth / (modalWidth * gapThreshold), winHeight / (modalHeight * gapThreshold), 1);\n\n let minWidth = Math.max(modalWidth * scale, this.options.modalWidth),\n minHeight = Math.max(modalHeight * scale, this.options.modalHeight);\n\n minWidth = this.options.fixedModalSize ? this.options.modalWidth : Math.round(minWidth);\n minHeight = this.options.fixedModalSize ? this.options.modalHeight : Math.round(minHeight);\n\n let modalCSSObj = {\n width: minWidth + 'px',\n height: minHeight + 'px',\n left: (winWidth - minWidth) / 2 + scrollLeft + 'px',\n top: (winHeight - minHeight) / 2 + scrollTop + 'px'\n };\n\n // Add modal init animation\n if (this.options.initAnimation) {\n\n this.$photoviewer.animate(modalCSSObj, function () {\n self.setImageSize(img);\n });\n\n } else {\n\n this.$photoviewer.css(modalCSSObj);\n this.setImageSize(img);\n\n }\n\n this.isOpened = true;\n\n }\n\n setImageSize(img) {\n\n let stageData = {\n w: this.$stage.width(),\n h: this.$stage.height()\n };\n\n // image scale to stage\n let scale = 1;\n\n if (!this.isRotated) {\n scale = Math.min(stageData.w / img.width, stageData.h / img.height, 1);\n } else {\n scale = Math.min(stageData.w / img.height, stageData.h / img.width, 1);\n }\n\n this.$image.css({\n width: Math.ceil(img.width * scale) + 'px',\n height: Math.ceil(img.height * scale) + 'px',\n left: (stageData.w - Math.ceil(img.width * scale)) / 2 + 'px',\n top: (stageData.h - Math.ceil(img.height * scale)) / 2 + 'px'\n });\n\n // Store image initial data\n $.extend(this.imageData, {\n width: img.width * scale,\n height: img.height * scale,\n left: (stageData.w - img.width * scale) / 2,\n top: (stageData.h - img.height * scale) / 2\n });\n\n // Set grab cursor\n setGrabCursor({ w: this.$image.width(), h: this.$image.height() }, { w: this.$stage.width(), h: this.$stage.height() },\n this.$stage,\n this.isRotated\n );\n\n // loader end\n this.$photoviewer.find(CLASS_NS + '-loader').remove();\n\n // Add image init animation\n if (this.options.initAnimation) {\n this.$image.fadeIn();\n }\n\n }\n\n loadImg(imgSrc) {\n\n let self = this;\n\n let loaderHTML = `
`;\n\n // loader start\n this.$photoviewer.append(loaderHTML);\n\n if (this.options.initAnimation) {\n this.$image.hide();\n }\n\n this.$image.attr('src', imgSrc);\n\n preloadImg(imgSrc, function (img) {\n\n // Store original data\n self.imageData = {\n originalWidth: img.width,\n originalHeight: img.height\n };\n\n if (self.isMaximized || (self.isOpened && self.options.fixedModalPos)) {\n self.setImageSize(img);\n } else {\n self.setModalSize(img);\n }\n\n self.$stage.removeClass('stage-ready');\n self.$image.removeClass('image-ready');\n\n }, function () {\n // loader end\n self.$photoviewer.find(CLASS_NS + '-loader').remove();\n });\n\n if (this.options.title) {\n this.setImgTitle(imgSrc);\n }\n\n }\n\n setImgTitle(url) {\n\n let caption = this.groupData[this.groupIndex].caption,\n captionTxt = caption ? caption : getImageNameFromUrl(url);\n\n this.$title.text(captionTxt);\n\n }\n\n jump(index) {\n\n this.groupIndex = this.groupIndex + index;\n\n this.jumpTo(this.groupIndex);\n\n }\n\n jumpTo(index) {\n\n index = index % this.groupData.length;\n\n if (index >= 0) {\n index = index % this.groupData.length;\n } else if (index < 0) {\n index = (this.groupData.length + index) % this.groupData.length;\n }\n\n this.groupIndex = index;\n\n this._triggerHook('beforeChange', index);\n\n this.loadImg(this.groupData[index].src);\n\n this._triggerHook('changed', index);\n\n }\n\n wheel(e) {\n\n e.preventDefault();\n\n let delta = 1;\n\n if (e.originalEvent.deltaY) {\n delta = e.originalEvent.deltaY > 0 ? 1 : -1;\n } else if (e.originalEvent.wheelDelta) {\n delta = -e.originalEvent.wheelDelta / 120;\n } else if (e.originalEvent.detail) {\n delta = e.originalEvent.detail > 0 ? 1 : -1;\n }\n\n // ratio threshold\n let ratio = -delta * this.options.ratioThreshold;\n\n // mouse point position relative to stage\n let pointer = {\n x: e.originalEvent.clientX - this.$stage.offset().left + $D.scrollLeft(),\n y: e.originalEvent.clientY - this.$stage.offset().top + $D.scrollTop()\n };\n\n this.zoom(ratio, pointer, e);\n\n }\n\n zoom(ratio, origin, e) {\n\n // zoom out & zoom in\n ratio = ratio < 0 ? (1 / (1 - ratio)) : (1 + ratio);\n\n if (ratio > 0.95 && ratio < 1.05) {\n ratio = 1;\n }\n\n ratio = this.$image.width() / this.imageData.originalWidth * ratio;\n\n // min image size\n ratio = Math.max(ratio, this.options.minRatio);\n // max image size\n ratio = Math.min(ratio, this.options.maxRatio);\n\n this.zoomTo(ratio, origin, e);\n\n }\n\n zoomTo(ratio, origin, e) {\n\n let $image = this.$image,\n $stage = this.$stage,\n imgData = {\n w: this.imageData.width,\n h: this.imageData.height,\n x: this.imageData.left,\n y: this.imageData.top\n };\n\n // image stage position\n // We will use it to calc the relative position of image\n let stageData = {\n w: $stage.width(),\n h: $stage.height(),\n x: $stage.offset().left,\n y: $stage.offset().top\n };\n\n let newWidth = this.imageData.originalWidth * ratio,\n newHeight = this.imageData.originalHeight * ratio,\n // Think about it for a while ~~~\n newLeft = origin.x - (origin.x - imgData.x) / imgData.w * newWidth,\n newTop = origin.y - (origin.y - imgData.y) / imgData.h * newHeight;\n\n // δ is the difference between image new width and new height\n let δ = !this.isRotated ? 0 : (newWidth - newHeight) / 2,\n imgNewWidth = !this.isRotated ? newWidth : newHeight,\n imgNewHeight = !this.isRotated ? newHeight : newWidth;\n\n let offsetX = stageData.w - newWidth,\n offsetY = stageData.h - newHeight;\n\n // zoom out & zoom in condition\n // It's important and it takes me a lot of time to get it\n // The conditions with image rotate 90 degree drive me crazy alomst!\n if (imgNewHeight <= stageData.h) {\n newTop = (stageData.h - newHeight) / 2;\n } else {\n newTop = newTop > δ ? δ : (newTop > (offsetY - δ) ? newTop : (offsetY - δ));\n }\n\n if (imgNewWidth <= stageData.w) {\n newLeft = (stageData.w - newWidth) / 2;\n } else {\n newLeft = newLeft > -δ ? -δ : (newLeft > (offsetX + δ) ? newLeft : (offsetX + δ));\n }\n\n $image.css({\n width: Math.round(newWidth) + 'px',\n height: Math.round(newHeight) + 'px',\n left: Math.round(newLeft) + 'px',\n top: Math.round(newTop) + 'px'\n });\n\n // Update image initial data\n $.extend(this.imageData, {\n width: newWidth,\n height: newHeight,\n left: newLeft,\n top: newTop\n });\n\n // Set grab cursor\n setGrabCursor({ w: Math.round(imgNewWidth), h: Math.round(imgNewHeight) }, { w: stageData.w, h: stageData.h },\n this.$stage\n );\n\n }\n\n rotate(angle) {\n\n this.rotateAngle = this.rotateAngle + angle;\n\n if ((this.rotateAngle / 90) % 2 === 0) {\n this.isRotated = false;\n } else {\n this.isRotated = true;\n }\n\n this.rotateTo(this.rotateAngle);\n\n }\n\n rotateTo(angle) {\n\n let self = this;\n\n this.$image.css({\n transform: 'rotate(' + angle + 'deg)'\n });\n\n this.setImageSize({ width: this.imageData.originalWidth, height: this.imageData.originalHeight });\n\n // Remove grab cursor when rotate\n this.$stage.removeClass('is-grab');\n\n }\n\n resize() {\n\n let self = this;\n\n let resizeHandler = throttle(function () {\n\n if (self.isOpened) {\n\n if (self.isMaximized) {\n self.setImageSize({ width: self.imageData.originalWidth, height: self.imageData.originalHeight });\n } else {\n self.setModalSize({ width: self.imageData.originalWidth, height: self.imageData.originalHeight });\n }\n\n }\n\n }, 500);\n\n return resizeHandler;\n\n }\n\n maximize() {\n\n let self = this;\n\n if (!this.isMaximized) {\n // Store modal data before maximize\n this.modalData = {\n width: this.$photoviewer.width(),\n height: this.$photoviewer.height(),\n left: this.$photoviewer.offset().left,\n top: this.$photoviewer.offset().top\n };\n\n this.$photoviewer.addClass(NS + '-maximize');\n\n this.$photoviewer.css({\n width: '100%',\n height: '100%',\n left: 0,\n top: 0\n });\n\n this.isMaximized = true;\n\n } else {\n\n this.$photoviewer.removeClass(NS + '-maximize');\n\n this.$photoviewer.css({\n width: this.modalData.width ? this.modalData.width : this.options.modalWidth,\n height: this.modalData.height ? this.modalData.height : this.options.modalHeight,\n left: this.modalData.left ? this.modalData.left : ($W.width() - this.options.modalWidth) / 2 + $D.scrollLeft(),\n top: this.modalData.top ? this.modalData.top : ($W.height() - this.options.modalHeight) / 2 + $D.scrollTop()\n });\n\n this.isMaximized = false;\n }\n\n this.setImageSize({ width: this.imageData.originalWidth, height: this.imageData.originalHeight });\n\n }\n\n fullscreen() {\n\n requestFullscreen(this.$photoviewer[0]);\n\n }\n\n keydown(e) {\n\n let self = this;\n\n if (!this.options.keyboard) {\n return false;\n }\n\n let keyCode = e.keyCode || e.which || e.charCode,\n ctrlKey = e.ctrlKey || e.metaKey,\n altKey = e.altKey || e.metaKey;\n\n switch (keyCode) {\n // ←\n case 37:\n self.jump(-1);\n break;\n // →\n case 39:\n self.jump(1);\n break;\n // +\n case 187:\n self.zoom(self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n break;\n // -\n case 189:\n self.zoom(-self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n break;\n // + Firefox\n case 61:\n self.zoom(self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n break;\n // - Firefox\n case 173:\n self.zoom(-self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n break;\n // ctrl + alt + 0\n case 48:\n if (ctrlKey && altKey) {\n self.zoomTo(1, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n }\n break;\n // ctrl + ,\n case 188:\n if (ctrlKey) {\n self.rotate(-90);\n }\n break;\n // ctrl + .\n case 190:\n if (ctrlKey) {\n self.rotate(90);\n }\n break;\n default:\n }\n\n }\n\n addEvents() {\n\n let self = this;\n\n this.$close.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) {\n self.close();\n });\n\n this.$stage.off(WHEEL_EVENT + EVENT_NS).on(WHEEL_EVENT + EVENT_NS, function (e) {\n self.wheel(e);\n });\n\n this.$zoomIn.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) {\n self.zoom(self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n });\n\n this.$zoomOut.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) {\n self.zoom(-self.options.ratioThreshold * 3, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n });\n\n this.$actualSize.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function (e) {\n self.zoomTo(1, { x: self.$stage.width() / 2, y: self.$stage.height() / 2 }, e);\n });\n\n this.$prev.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.jump(-1);\n });\n\n this.$fullscreen.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.fullscreen();\n });\n\n this.$next.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.jump(1);\n });\n\n this.$rotateLeft.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.rotate(-90);\n });\n\n this.$rotateRight.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.rotate(90);\n });\n\n this.$maximize.off(CLICK_EVENT + EVENT_NS).on(CLICK_EVENT + EVENT_NS, function () {\n self.maximize();\n });\n\n $D.off(KEYDOWN_EVENT + EVENT_NS).on(KEYDOWN_EVENT + EVENT_NS, function (e) {\n self.keydown(e);\n });\n\n $W.on(RESIZE_EVENT + EVENT_NS, self.resize());\n\n }\n\n _triggerHook(e, data) {\n if (this.options.callbacks[e]) {\n this.options.callbacks[e].apply(this, $.isArray(data) ? data : [data]);\n }\n }\n\n\n}\n\n/**\n * Add methods to PhotoViewer\n */\n$.extend(PhotoViewer.prototype, draggable, movable, resizable);\n\n/**\n * Add PhotoViewer to globle\n */\nwindow.PhotoViewer = PhotoViewer;\n\n/**\n * jQuery plugin\n */\n\nlet jqEl = null,\n getImgGroup = function (list, groupName) {\n\n let items = [];\n\n $(list).each(function () {\n\n let src = getImgSrc(this);\n\n items.push({\n src: src,\n caption: $(this).attr('data-caption'),\n groupName: groupName\n });\n\n });\n\n return items;\n\n }\n\n$.fn.photoviewer = function (options) {\n\n jqEl = $(this);\n\n // Convert a numeric string into a number\n for (let key in options) {\n if (typeof (options[key]) === 'string' && !isNaN(options[key])) {\n options[key] = parseFloat(options[key])\n }\n }\n\n // Get init event, 'click' or 'dblclick'\n let opts = $.extend(true, {}, DEFAULTS, options);\n\n // We should get zIndex of options before plugin's init.\n PUBLIC_VARS['zIndex'] = opts.zIndex;\n\n if (typeof options === 'string') {\n\n // $(this).data('photoviewer')[options]();\n\n } else {\n\n if (opts.initEvent === 'dblclick') {\n\n jqEl.off('click' + EVENT_NS).on('click' + EVENT_NS, function (e) {\n\n e.preventDefault();\n // This will stop triggering data-api event\n e.stopPropagation();\n\n });\n\n }\n\n jqEl.off(opts.initEvent + EVENT_NS).on(opts.initEvent + EVENT_NS, function (e) {\n\n e.preventDefault();\n // This will stop triggering data-api event\n e.stopPropagation();\n\n // Get image group\n let items = [],\n currentGroupName = $(this).attr('data-group'),\n groupList = $D.find('[data-group=\"' + currentGroupName + '\"]');\n\n if (currentGroupName !== undefined) {\n items = getImgGroup(groupList, currentGroupName);\n options['index'] = $(this).index('[data-group=\"' + currentGroupName + '\"]');\n } else {\n items = getImgGroup(jqEl.not('[data-group]'));\n options['index'] = $(this).index();\n }\n\n $(this).data(NS, new PhotoViewer(items, options, this));\n\n });\n\n }\n\n return jqEl;\n\n};\n\n/**\n * PhotoViewer DATA-API\n */\n$D.on(CLICK_EVENT + EVENT_NS, '[data-' + NS + ']', function (e) {\n\n jqEl = $('[data-' + NS + ']');\n\n e.preventDefault();\n\n // Get image group\n let items = [],\n currentGroupName = $(this).attr('data-group'),\n groupList = $D.find('[data-group=\"' + currentGroupName + '\"]');\n\n if (currentGroupName !== undefined) {\n items = getImgGroup(groupList, currentGroupName);\n DEFAULTS['index'] = $(this).index('[data-group=\"' + currentGroupName + '\"]');\n } else {\n items = getImgGroup(jqEl.not('[data-group]'));\n DEFAULTS['index'] = $(this).index();\n }\n\n $(this).data(NS, new PhotoViewer(items, DEFAULTS, this));\n\n});\n\nexport default PhotoViewer;\n"],"names":["draggable","resizable","movable","keyboard","title","modalWidth","modalHeight","fixedContent","fixedModalSize","initMaximized","gapThreshold","ratioThreshold","minRatio","maxRatio","headToolbar","footToolbar","icons","minimize","maximize","close","zoomIn","zoomOut","prev","next","fullscreen","actualSize","rotateLeft","rotateRight","i18n","multiInstances","initEvent","initAnimation","fixedModalPos","zIndex","dragHandle","callbacks","beforeOpen","$","noop","opened","beforeClose","closed","beforeChange","changed","index","getImgSrc","el","src","attr","throttle","fn","delay","timer","context","args","arguments","clearTimeout","setTimeout","apply","preloadImg","success","error","img","Image","onload","onerror","requestFullscreen","element","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","getImageNameFromUrl","url","reg","txt","replace","getNumFromCSSValue","value","arr","match","num","parseFloat","hasScrollbar","document","body","scrollHeight","window","innerHeight","documentElement","clientHeight","getScrollbarWidth","scrollDiv","createElement","style","cssText","appendChild","scrollbarWidth","offsetWidth","clientWidth","removeChild","setGrabCursor","imageData","stageData","stage","isRotated","imageWidth","w","h","imageHeight","addClass","removeClass","supportTouch","DocumentTouch","$W","$D","CLICK_EVENT","RESIZE_EVENT","KEYDOWN_EVENT","WHEEL_EVENT","TOUCH_START_EVENT","TOUCH_MOVE_EVENT","TOUCH_END_EVENT","NS","CLASS_NS","EVENT_NS","PUBLIC_VARS","isMoving","isResizing","defaults","modal","dragCancel","self","isDragging","startX","startY","left","top","dragStart","e","event","options","css","elemCancel","target","closest","length","type","originalEvent","targetTouches","pageX","clientX","pageY","clientY","offset","on","dragMove","dragEnd","preventDefault","isMaximized","endX","endY","relativeX","relativeY","off","ELEMS_WITH_GRABBING_CURSOR","image","widthDiff","heightDiff","δ","width","height","stageWidth","stageHeight","position","hasClass","newLeft","newTop","extend","ELEMS_WITH_RESIZE_CURSOR","minWidth","minHeight","resizableHandleE","resizableHandleW","resizableHandleS","resizableHandleN","resizableHandleSE","resizableHandleSW","resizableHandleNE","resizableHandleNW","resizableHandles","append","modalData","l","t","imgWidth","imgHeight","direction","getModalOpts","dir","offsetX","offsetY","modalLeft","modalTop","opts","Math","max","getImageOpts","widthDiff2","heightDiff2","imgLeft","imgTop","imgLeft2","imgTop2","modalOpts","imageOpts","each","handle","PhotoViewer","items","DEFAULTS","isArray","$el","isOpened","rotateAngle","init","groupData","groupIndex","imgSrc","open","loadImg","$photoviewer","$stage","$image","_creatBtns","toolbar","btns","btnsStr","item","_creatTitle","_creatDOM","btnsTpl","photoviewerHTML","build","$header","find","$headToolbar","$footer","$footToolbar","$title","$close","$maximize","$minimize","$zoomIn","$zoomOut","$actualSize","$fullscreen","$rotateLeft","$rotateRight","$prev","$next","eq","remove","_triggerHook","addEvents","setModalPos","zeroModal","winWidth","winHeight","scrollLeft","scrollTop","setModalSize","stageCSS","right","bottom","borderLeft","borderRight","borderTop","borderBottom","scale","min","round","modalCSSObj","animate","setImageSize","ceil","fadeIn","loaderHTML","hide","originalWidth","originalHeight","setImgTitle","caption","captionTxt","text","jump","jumpTo","wheel","delta","deltaY","wheelDelta","detail","ratio","pointer","x","y","zoom","origin","zoomTo","imgData","newWidth","newHeight","imgNewWidth","imgNewHeight","rotate","angle","rotateTo","transform","resize","resizeHandler","keydown","keyCode","which","charCode","ctrlKey","metaKey","altKey","data","prototype","jqEl","getImgGroup","list","groupName","push","photoviewer","key","isNaN","stopPropagation","currentGroupName","groupList","undefined","not"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAe;EAEb;EACAA,aAAW,IAHE;EAKb;EACAC,aAAW,IANE;EAQb;EACAC,WAAS,IATI;EAWb;EACAC,YAAU,IAZG;EAcb;EACAC,SAAO,IAfM;EAiBb;EACAC,cAAY,GAlBC;EAoBb;EACAC,eAAa,GArBA;EAuBb;EACAC,gBAAc,IAxBD;EA0Bb;EACAC,kBAAgB,KA3BH;EA6Bb;EACAC,iBAAe,KA9BF;EAgCb;EACAC,gBAAc,IAjCD;EAmCb;EACAC,kBAAgB,GApCH;EAsCb;EACAC,YAAU,GAvCG;EAyCb;EACAC,YAAU,EA1CG;EA4Cb;EACAC,eAAa,CACX,UADW,EAEX,OAFW,CA7CA;EAkDb;EACAC,eAAa,CACX,QADW,EAEX,SAFW,EAGX,MAHW,EAIX,YAJW,EAKX,MALW,EAMX,YANW,EAOX,aAPW,CAnDA;EA6Db;EACAC,SAAO;EACLC,cAAU,uBADL;EAELC,cAAU,uBAFL;EAGLC,WAAO,aAHF;EAILC,YAAQ,mBAJH;EAKLC,aAAS,oBALJ;EAMLC,UAAM,kBAND;EAOLC,UAAM,mBAPD;EAQLC,gBAAY,aARP;EASLC,gBAAY,kBATP;EAULC,gBAAY,mBAVP;EAWLC,iBAAa;EAXR,GA9DM;EA4Eb;EACAC,QAAM;EACJX,cAAU,UADN;EAEJC,cAAU,UAFN;EAGJC,WAAO,OAHH;EAIJC,YAAQ,YAJJ;EAKJC,aAAS,aALL;EAMJC,UAAM,SANF;EAOJC,UAAM,SAPF;EAQJC,gBAAY,YARR;EASJC,gBAAY,yBATR;EAUJC,gBAAY,qBAVR;EAWJC,iBAAa;EAXT,GA7EO;EA2Fb;EACAE,kBAAgB,IA5FH;EA8Fb;EACAC,aAAW,OA/FE;EAiGb;EACAC,iBAAe,IAlGF;EAoGb;EACAC,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,GAAqC,IAA7C,CAFd;;EAIA,MAAIA,qBAAqBE,SAAzB,EAAoC;EAClCzH,YAAQ+G,YAAYS,SAAZ,EAAuBD,gBAAvB,CAAR;EACAtH,aAAS,OAAT,IAAoBtL,IAAE,IAAF,EAAQO,KAAR,CAAc,kBAAkBqS,gBAAlB,GAAqC,IAAnD,CAApB;EACD,GAHD,MAGO;EACLvH,YAAQ+G,YAAYD,KAAKY,GAAL,CAAS,cAAT,CAAZ,CAAR;EACAzH,aAAS,OAAT,IAAoBtL,IAAE,IAAF,EAAQO,KAAR,EAApB;EACD;;EAEDP,MAAE,IAAF,EAAQiS,IAAR,CAAa5M,EAAb,EAAiB,IAAI+F,WAAJ,CAAgBC,KAAhB,EAAuBC,QAAvB,EAAiC,IAAjC,CAAjB;EAED,CArBD;;;;;;;;"} \ No newline at end of file diff --git a/dist/photoviewer.min.css b/dist/photoviewer.min.css new file mode 100644 index 0000000..174abbc --- /dev/null +++ b/dist/photoviewer.min.css @@ -0,0 +1,18 @@ + +/*! + * ____ _ _ ___ _____ ___ _ _ _____ ____ _ _ ____ ____ + * | _ \| | | |/ _ \|_ _|/ _ \| | | |_ _| __| | | | __| _ \ + * | |_| | |_| | | | | | | | | | | | | | | | | |__| | | | |__| |_| | + * | __/| _ | | | | | | | | | | |_| | | | | __| |/\| | __| / + * | | | | | | |_| | | | | |_| |\ / _| |_| |__| /\ | |__| |\ \ + * |_| |_| |_|\___/ |_| \___/ \_/ |_____|____|_/ \_|____|_| \_\ + * + * photoviewer - v2.0.0-beta.0 + * A JS plugin to view images just like in Windows + * https://github.com/nzbin/photoviewer#readme + * + * Copyright (c) 2018 nzbin + * Released under MIT License + */.photoviewer-modal{position:absolute;z-index:1090;width:320px;height:320px;cursor:default}.photoviewer-inner{position:relative;width:100%;height:100%;background-color:#111;background-color:rgba(0,0,0,0.85);-webkit-box-shadow:0 0 3px 1px rgba(0,0,0,0.3);box-shadow:0 0 3px 1px rgba(0,0,0,0.3);cursor:default}.photoviewer-maximize{position:fixed;top:0;left:0;width:100%;height:100%}.photoviewer-toolbar{font-size:0}.photoviewer-header{position:relative;z-index:2;height:40px;color:#fff}.photoviewer-header .photoviewer-toolbar{float:right}.photoviewer-title{padding:13px 10px;font-size:14px;line-height:1;white-space:nowrap;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden}.photoviewer-stage{position:absolute;top:40px;right:10px;bottom:40px;left:10px;z-index:1;border:1px solid #ccc;overflow:hidden}.photoviewer-stage.stage-ready{text-align:center}.photoviewer-image{position:relative;display:inline-block}.photoviewer-image.image-ready{max-width:100%;max-height:100%}.photoviewer-footer{position:absolute;bottom:0;z-index:2;width:100%;height:40px;color:#fff;text-align:center}.photoviewer-footer .photoviewer-toolbar{display:inline-block}.photoviewer-button{display:inline-block;width:40px;height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:10px;font-size:14px;color:#ccc;line-height:1;text-align:center;background:none;border-width:0;border-radius:0;cursor:pointer;outline:none}.photoviewer-button:hover{color:#fff}.photoviewer-button-close:hover{background-color:#ff4545}.photoviewer-button-maximize:hover{background-color:#525252}.photoviewer-button-minimize:hover{background-color:#525252}.photoviewer-loader{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;text-align:center;background-color:rgba(0,0,0,0.3);color:#333}.photoviewer-loader::before{content:'';display:inline-block;position:relative;width:35px;height:35px;border-width:5px;border-style:solid;border-color:rgba(0,0,0,0.5) rgba(0,0,0,0.5) rgba(0,0,0,0.5) rgba(255,255,255,0.5);border-radius:100%;-webkit-animation:photoviewerLoading 1s infinite linear;animation:photoviewerLoading 1s infinite linear}.photoviewer-loader::after{content:'';display:inline-block;width:0;height:100%;vertical-align:middle;overflow:hidden}@-webkit-keyframes photoviewerLoading{0%{-webkit-transform:rotateZ(0deg) translate3d(0, 0, 0);transform:rotateZ(0deg) translate3d(0, 0, 0)}100%{-webkit-transform:rotateZ(360deg) translate3d(0, 0, 0);transform:rotateZ(360deg) translate3d(0, 0, 0)}}@keyframes photoviewerLoading{0%{-webkit-transform:rotateZ(0deg) translate3d(0, 0, 0);transform:rotateZ(0deg) translate3d(0, 0, 0)}100%{-webkit-transform:rotateZ(360deg) translate3d(0, 0, 0);transform:rotateZ(360deg) translate3d(0, 0, 0)}}.photoviewer-resizable-handle{position:absolute;z-index:10}.photoviewer-resizable-handle-e{top:0;right:-5px;bottom:0;left:auto;width:10px;cursor:e-resize}.photoviewer-resizable-handle-s{top:auto;right:0;bottom:-5px;left:0;height:10px;cursor:s-resize}.photoviewer-resizable-handle-w{top:0;right:auto;bottom:0;left:-5px;width:10px;cursor:w-resize}.photoviewer-resizable-handle-n{top:-5px;right:0;bottom:auto;left:0;height:10px;cursor:n-resize}.photoviewer-resizable-handle-se{top:auto;right:-5px;bottom:-5px;left:auto;width:10px;height:10px;cursor:se-resize}.photoviewer-resizable-handle-sw{top:auto;right:auto;bottom:-5px;left:-5px;width:10px;height:10px;cursor:sw-resize}.photoviewer-resizable-handle-nw{top:-5px;right:auto;bottom:auto;left:-5px;width:10px;height:10px;cursor:nw-resize}.photoviewer-resizable-handle-ne{top:-5px;right:-5px;bottom:auto;left:auto;width:10px;height:10px;cursor:ne-resize}:-webkit-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-webkit-full-screen .photoviewer-header,:-webkit-full-screen .photoviewer-footer,:-webkit-full-screen .photoviewer-resizable-handle{display:none}:-webkit-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-moz-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-moz-full-screen .photoviewer-header,:-moz-full-screen .photoviewer-footer,:-moz-full-screen .photoviewer-resizable-handle{display:none}:-moz-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-ms-fullscreen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-ms-fullscreen .photoviewer-header,:-ms-fullscreen .photoviewer-footer,:-ms-fullscreen .photoviewer-resizable-handle{display:none}:-ms-fullscreen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:full-screen .photoviewer-header,:full-screen .photoviewer-footer,:full-screen .photoviewer-resizable-handle{display:none}:full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-webkit-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-moz-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-ms-fullscreen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:fullscreen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-webkit-full-screen .photoviewer-header,:-webkit-full-screen .photoviewer-footer,:-webkit-full-screen .photoviewer-resizable-handle{display:none}:-moz-full-screen .photoviewer-header,:-moz-full-screen .photoviewer-footer,:-moz-full-screen .photoviewer-resizable-handle{display:none}:-ms-fullscreen .photoviewer-header,:-ms-fullscreen .photoviewer-footer,:-ms-fullscreen .photoviewer-resizable-handle{display:none}:fullscreen .photoviewer-header,:fullscreen .photoviewer-footer,:fullscreen .photoviewer-resizable-handle{display:none}:-webkit-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-moz-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-ms-fullscreen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:fullscreen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}::-webkit-backdrop{background-color:#000}::backdrop{background-color:#000}::-ms-backdrop{background-color:#000}.is-grab{cursor:move;cursor:-webkit-grab;cursor:grab}.is-grabbing{cursor:move;cursor:-webkit-grabbing;cursor:grabbing} + +/*# sourceMappingURL=photoviewer.min.css.map */ \ No newline at end of file diff --git a/dist/photoviewer.min.css.map b/dist/photoviewer.min.css.map new file mode 100644 index 0000000..4ffdffb --- /dev/null +++ b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C,AAA5F,YAAY,iBAAiB,kBAAkB,sBAAsB,sBAAsB,CAAC,qIAA0G,YAAY,CAAC,AAAvH,4HAA0G,YAAY,CAAC,AAAvH,sHAA0G,YAAY,CAAC,AAAvH,0GAA0G,YAAY,CAAC,wCAA+B,MAAM,QAAQ,SAAS,OAAO,eAAe,qBAAqB,CAAC,AAAlG,qCAA+B,MAAM,QAAQ,SAAS,OAAO,eAAe,qBAAqB,CAAC,AAAlG,mCAA+B,MAAM,QAAQ,SAAS,OAAO,eAAe,qBAAqB,CAAC,AAAlG,+BAA+B,MAAM,QAAQ,SAAS,OAAO,eAAe,qBAAqB,CAAC,mBAAW,qBAAqB,CAAC,AAAjC,WAAW,qBAAqB,CAAC,eAAe,qBAAqB,CAAC,SAAS,YAAY,oBAAoB,WAAW,CAAC,aAAa,YAAY,wBAAwB,eAAe,CAAC","file":"photoviewer.min.css","sourcesContent":[null,".photoviewer-modal{position:absolute;z-index:1090;width:320px;height:320px;cursor:default}.photoviewer-inner{position:relative;width:100%;height:100%;background-color:#111;background-color:rgba(0,0,0,0.85);box-shadow:0 0 3px 1px rgba(0,0,0,0.3);cursor:default}.photoviewer-maximize{position:fixed;top:0;left:0;width:100%;height:100%}.photoviewer-toolbar{font-size:0}.photoviewer-header{position:relative;z-index:2;height:40px;color:#fff}.photoviewer-header .photoviewer-toolbar{float:right}.photoviewer-title{padding:13px 10px;font-size:14px;line-height:1;white-space:nowrap;text-overflow:ellipsis;user-select:none;overflow:hidden}.photoviewer-stage{position:absolute;top:40px;right:10px;bottom:40px;left:10px;z-index:1;border:1px solid #ccc;overflow:hidden}.photoviewer-stage.stage-ready{text-align:center}.photoviewer-image{position:relative;display:inline-block}.photoviewer-image.image-ready{max-width:100%;max-height:100%}.photoviewer-footer{position:absolute;bottom:0;z-index:2;width:100%;height:40px;color:#fff;text-align:center}.photoviewer-footer .photoviewer-toolbar{display:inline-block}.photoviewer-button{display:inline-block;width:40px;height:40px;box-sizing:border-box;margin:0;padding:10px;font-size:14px;color:#ccc;line-height:1;text-align:center;background:none;border-width:0;border-radius:0;cursor:pointer;outline:none}.photoviewer-button:hover{color:#fff}.photoviewer-button-close:hover{background-color:#ff4545}.photoviewer-button-maximize:hover{background-color:#525252}.photoviewer-button-minimize:hover{background-color:#525252}.photoviewer-loader{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;text-align:center;background-color:rgba(0,0,0,0.3);color:#333}.photoviewer-loader::before{content:'';display:inline-block;position:relative;width:35px;height:35px;border-width:5px;border-style:solid;border-color:rgba(0,0,0,0.5) rgba(0,0,0,0.5) rgba(0,0,0,0.5) rgba(255,255,255,0.5);border-radius:100%;animation:photoviewerLoading 1s infinite linear}.photoviewer-loader::after{content:'';display:inline-block;width:0;height:100%;vertical-align:middle;overflow:hidden}@keyframes photoviewerLoading{0%{transform:rotateZ(0deg) translate3d(0, 0, 0)}100%{transform:rotateZ(360deg) translate3d(0, 0, 0)}}.photoviewer-resizable-handle{position:absolute;z-index:10}.photoviewer-resizable-handle-e{top:0;right:-5px;bottom:0;left:auto;width:10px;cursor:e-resize}.photoviewer-resizable-handle-s{top:auto;right:0;bottom:-5px;left:0;height:10px;cursor:s-resize}.photoviewer-resizable-handle-w{top:0;right:auto;bottom:0;left:-5px;width:10px;cursor:w-resize}.photoviewer-resizable-handle-n{top:-5px;right:0;bottom:auto;left:0;height:10px;cursor:n-resize}.photoviewer-resizable-handle-se{top:auto;right:-5px;bottom:-5px;left:auto;width:10px;height:10px;cursor:se-resize}.photoviewer-resizable-handle-sw{top:auto;right:auto;bottom:-5px;left:-5px;width:10px;height:10px;cursor:sw-resize}.photoviewer-resizable-handle-nw{top:-5px;right:auto;bottom:auto;left:-5px;width:10px;height:10px;cursor:nw-resize}.photoviewer-resizable-handle-ne{top:-5px;right:-5px;bottom:auto;left:auto;width:10px;height:10px;cursor:ne-resize}:-webkit-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-webkit-full-screen .photoviewer-header,:-webkit-full-screen .photoviewer-footer,:-webkit-full-screen .photoviewer-resizable-handle{display:none}:-webkit-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-moz-full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-moz-full-screen .photoviewer-header,:-moz-full-screen .photoviewer-footer,:-moz-full-screen .photoviewer-resizable-handle{display:none}:-moz-full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:-ms-fullscreen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:-ms-fullscreen .photoviewer-header,:-ms-fullscreen .photoviewer-footer,:-ms-fullscreen .photoviewer-resizable-handle{display:none}:-ms-fullscreen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:full-screen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:full-screen .photoviewer-header,:full-screen .photoviewer-footer,:full-screen .photoviewer-resizable-handle{display:none}:full-screen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}:fullscreen{top:0 !important;left:0 !important;width:100% !important;height:100% !important}:fullscreen .photoviewer-header,:fullscreen .photoviewer-footer,:fullscreen .photoviewer-resizable-handle{display:none}:fullscreen .photoviewer-stage{top:0;right:0;bottom:0;left:0;border-width:0;background-color:#000}::backdrop{background-color:#000}::-ms-backdrop{background-color:#000}.is-grab{cursor:move;cursor:-webkit-grab;cursor:grab}.is-grabbing{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}\n"]} \ No newline at end of file diff --git a/dist/photoviewer.min.js b/dist/photoviewer.min.js new file mode 100644 index 0000000..08e5128 --- /dev/null +++ b/dist/photoviewer.min.js @@ -0,0 +1,18 @@ +/*! + * ____ _ _ ___ _____ ___ _ _ _____ ____ _ _ ____ ____ + * | _ \| | | |/ _ \|_ _|/ _ \| | | |_ _| __| | | | __| _ \ + * | |_| | |_| | | | | | | | | | | | | | | | | |__| | | | |__| |_| | + * | __/| _ | | | | | | | | | | |_| | | | | __| |/\| | __| / + * | | | | | | |_| | | | | |_| |\ / _| |_| |__| /\ | |__| |\ \ + * |_| |_| |_|\___/ |_| \___/ \_/ |_____|____|_/ \_|____|_| \_\ + * + * photoviewer - v2.0.0-beta.0 + * A JS plugin to view images just like in Windows + * https://github.com/nzbin/photoviewer#readme + * + * Copyright (c) 2018 nzbin + * Released under MIT License + */ +!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],i):t.photoviewer=i(t.jQuery)}(this,function(x){"use strict";x=x&&x.hasOwnProperty("default")?x.default:x;var a={draggable:!0,resizable:!0,movable:!0,keyboard:!0,title:!0,modalWidth:320,modalHeight:320,fixedContent:!0,fixedModalSize:!1,initMaximized:!1,gapThreshold:.02,ratioThreshold:.1,minRatio:.1,maxRatio:16,headToolbar:["maximize","close"],footToolbar:["zoomIn","zoomOut","prev","fullscreen","next","actualSize","rotateRight"],icons:{minimize:"fa fa-window-minimize",maximize:"fa fa-window-maximize",close:"fa fa-close",zoomIn:"fa fa-search-plus",zoomOut:"fa fa-search-minus",prev:"fa fa-arrow-left",next:"fa fa-arrow-right",fullscreen:"fa fa-photo",actualSize:"fa fa-arrows-alt",rotateLeft:"fa fa-rotate-left",rotateRight:"fa fa-rotate-right"},i18n:{minimize:"minimize",maximize:"maximize",close:"close",zoomIn:"zoom-in(+)",zoomOut:"zoom-out(-)",prev:"prev(←)",next:"next(→)",fullscreen:"fullscreen",actualSize:"actual-size(Ctrl+Alt+0)",rotateLeft:"rotate-left(Ctrl+,)",rotateRight:"rotate-right(Ctrl+.)"},multiInstances:!0,initEvent:"click",initAnimation:!0,fixedModalPos:!1,zIndex:1090,dragHandle:!1,callbacks:{beforeOpen:$.noop,opened:$.noop,beforeClose:$.noop,closed:$.noop,beforeChange:$.noop,changed:$.noop},index:0};function u(t){var i=t.match(/\d+/g);return parseFloat(i[0])}function b(t,i,e,o){var s=o?t.h:t.w,a=o?t.w:t.h;(a>i.h||s>i.w)&&e.addClass("is-grab"),a<=i.h&&s<=i.w&&e.removeClass("is-grab")}function t(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}var f=$(window),w=$(document),e="click",o="resize",s="keydown",n="wheel mousewheel DOMMouseScroll",z=t()?"touchstart":"mousedown",y=t()?"touchmove":"mousemove",_=t()?"touchend":"mouseup",c="photoviewer",h="."+c,L="."+c,X={isMoving:!1,isResizing:!1,zIndex:a.zIndex},i={draggable:function(a,t,i){var n=this,h=!1,r=0,l=0,d=0,p=0,e=function(t){if((t=t||window.event).preventDefault(),h&&!X.isMoving&&!X.isResizing&&!n.isMaximized){var i="touchmove"===t.type?t.originalEvent.targetTouches[0].pageX:t.clientX,e="touchmove"===t.type?t.originalEvent.targetTouches[0].pageY:t.clientY,o=i-r,s=e-l;$(a).css({left:o+d+"px",top:s+p+"px"})}},o=function t(){w.off(y+L,e).off(_+L,t),h=!1};$(t).on(z+L,function(t){if(t=t||window.event,n.options.multiInstances&&a.css("z-index",++X.zIndex),$(t.target).closest(i).length)return!0;h=!0,r="touchstart"===t.type?t.originalEvent.targetTouches[0].pageX:t.clientX,l="touchstart"===t.type?t.originalEvent.targetTouches[0].pageY:t.clientY,d=$(a).offset().left,p=$(a).offset().top,w.on(y+L,e).on(_+L,o)})}},M="html,body,."+c+"-modal,."+c+"-stage,."+c+"-button,."+c+"-resizable-handle",r={movable:function(a,h){var r=this,l=!1,d=0,p=0,g=0,c=0,u=0,f=0,m=0,n=function(t){if((t=t||window.event).preventDefault(),l){var i="touchmove"===t.type?t.originalEvent.targetTouches[0].pageX:t.clientX,e="touchmove"===t.type?t.originalEvent.targetTouches[0].pageY:t.clientY,o=i-d,s=e-p,a=o+g,n=s+c;0'),i=$('
'),e=$('
'),o=$('
'),a=$('
'),n=$('
'),h=$('
'),r=$('
'),l={e:t,s:e,se:a,n:o,w:i,nw:r,ne:h,sw:n};$(M).append(t,i,e,o,a,n,h,r);var k=!1,H=0,E=0,C={w:0,h:0,l:0,t:0},S={w:0,h:0,l:0,t:0},d={w:0,h:0,l:0,t:0},O=0,W=0,Y=0,A="",p=function(t){if((t=t||window.event).preventDefault(),k&&!R.isMaximized){var i="touchmove"===t.type?t.originalEvent.targetTouches[0].pageX:t.clientX,e="touchmove"===t.type?t.originalEvent.targetTouches[0].pageY:t.clientY,o=i-H,s=e-E,a=(w=A,b=s,z=-(x=o)+C.w>D?x+C.l:C.l+C.w-D,y=-b+C.h>I?b+C.t:C.t+C.h-I,{e:{width:Math.max(x+C.w,D)+"px"},s:{height:Math.max(b+C.h,I)+"px"},se:{width:Math.max(x+C.w,D)+"px",height:Math.max(b+C.h,I)+"px"},w:{width:Math.max(-x+C.w,D)+"px",left:z+"px"},n:{height:Math.max(-b+C.h,I)+"px",top:y+"px"},nw:{width:Math.max(-x+C.w,D)+"px",height:Math.max(-b+C.h,I)+"px",top:y+"px",left:z+"px"},ne:{width:Math.max(x+C.w,D)+"px",height:Math.max(-b+C.h,I)+"px",top:y+"px"},sw:{width:Math.max(-x+C.w,D)+"px",height:Math.max(b+C.h,I)+"px",left:z+"px"}}[w]);$(M).css(a);var n=(h=A,l=s,d=(r=o)+C.w>D?S.w-W+r-O:D-(C.w-S.w)-W-O,p=l+C.h>I?S.h-Y+l+O:I-(C.h-S.h)-Y+O,g=-r+C.w>D?S.w-W-r-O:D-(C.w-S.w)-W-O,c=-l+C.h>I?S.h-Y-l+O:I-(C.h-S.h)-Y+O,u=(0':""},i._creatDOM=function(){var t={minimize:'',maximize:'',close:'',zoomIn:'',zoomOut:'',prev:'',next:'',fullscreen:'',actualSize:'',rotateLeft:'',rotateRight:''};return'
\n
\n
\n
\n '+this._creatBtns(this.options.headToolbar,t)+"\n
\n "+this._creatTitle()+'\n
\n
\n \n
\n \n
\n
"},i.build=function(){var t=this._creatDOM(),i=x(t);this.$photoviewer=i,this.$header=i.find(h+"-header"),this.$headToolbar=i.find(h+"-toolbar-head"),this.$footer=i.find(h+"-footer"),this.$footToolbar=i.find(h+"-toolbar-foot"),this.$stage=i.find(h+"-stage"),this.$title=i.find(h+"-title"),this.$image=i.find(h+"-image"),this.$close=i.find(h+"-button-close"),this.$maximize=i.find(h+"-button-maximize"),this.$minimize=i.find(h+"-button-minimize"),this.$zoomIn=i.find(h+"-button-zoom-in"),this.$zoomOut=i.find(h+"-button-zoom-out"),this.$actualSize=i.find(h+"-button-actual-size"),this.$fullscreen=i.find(h+"-button-fullscreen"),this.$rotateLeft=i.find(h+"-button-rotate-left"),this.$rotateRight=i.find(h+"-button-rotate-right"),this.$prev=i.find(h+"-button-prev"),this.$next=i.find(h+"-button-next"),this.$stage.addClass("stage-ready"),this.$image.addClass("image-ready"),this.$photoviewer.css("z-index",X.zIndex),this.options.dragHandle&&this.options.dragHandle!==h+"-modal"?this.dragHandle=this.$photoviewer.find(this.options.dragHandle):this.dragHandle=this.$photoviewer},i.open=function(){if(this.options.multiInstances||x(h+"-modal").eq(0).remove(),!x(h+"-modal").length&&this.options.fixedContent&&(x("html").css({overflow:"hidden"}),document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight))){var t=function(){var t=document.createElement("div");t.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(t);var i=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),i}();t&&x("html").css({"padding-right":t})}this.build(),this._triggerHook("beforeOpen",this.$el),x("body").append(this.$photoviewer),this.addEvents(),this.setModalPos(this.$photoviewer),this._triggerHook("opened",this.$el)},i.close=function(){this._triggerHook("beforeClose",this.$el),this.$photoviewer.remove(),this.isOpened=!1,this.isMaximized=!1,this.isRotated=!1,this.rotateAngle=0;var t=!x(h+"-modal").length;t&&this.options.fixedContent&&x("html").css({overflow:"","padding-right":""}),t&&this.options.multiInstances&&(X.zIndex=this.options.zIndex),x(h+"-modal").length||(w.off(s+L),f.off(o+L)),this._triggerHook("closed",this.$el)},i.setModalPos=function(t){var i=f.width(),e=f.height(),o=w.scrollLeft(),s=w.scrollTop(),a=this.options.modalWidth,n=this.options.modalHeight;this.options.initMaximized?(t.addClass(c+"-maximize"),t.css({width:"100%",height:"100%",left:0,top:0}),this.isOpened=!0,this.isMaximized=!0):t.css({width:a,height:n,left:(i-a)/2+o+"px",top:(e-n)/2+s+"px"})},i.setModalSize=function(t){var i=this,e=f.width(),o=f.height(),s=w.scrollLeft(),a=w.scrollTop(),n={left:this.$stage.css("left"),right:this.$stage.css("right"),top:this.$stage.css("top"),bottom:this.$stage.css("bottom"),borderLeft:this.$stage.css("border-left-width"),borderRight:this.$stage.css("border-right-width"),borderTop:this.$stage.css("border-top-width"),borderBottom:this.$stage.css("border-bottom-width")},h=t.width+u(n.left)+u(n.right)+u(n.borderLeft)+u(n.borderRight),r=t.height+u(n.top)+u(n.bottom)+u(n.borderTop)+u(n.borderBottom),l=(0'),this.options.initAnimation&&this.$image.hide(),this.$image.attr("src",t),i=t,e=function(t){a.imageData={originalWidth:t.width,originalHeight:t.height},a.isMaximized||a.isOpened&&a.options.fixedModalPos?a.setImageSize(t):a.setModalSize(t),a.$stage.removeClass("stage-ready"),a.$image.removeClass("image-ready")},o=function(){a.$photoviewer.find(h+"-loader").remove()},(s=new Image).onload=function(){e(s)},s.onerror=function(){o(s)},s.src=i,this.options.title&&this.setImgTitle(t)},i.setImgTitle=function(t){var i=this.groupData[this.groupIndex].caption,e=i||t.replace(/^.*?\/*([^/?]*)\.[a-z]+(\?.+|$)/gi,"$1");this.$title.text(e)},i.jump=function(t){this.groupIndex=this.groupIndex+t,this.jumpTo(this.groupIndex)},i.jumpTo=function(t){0<=(t%=this.groupData.length)?t%=this.groupData.length:t<0&&(t=(this.groupData.length+t)%this.groupData.length),this.groupIndex=t,this._triggerHook("beforeChange",t),this.loadImg(this.groupData[t].src),this._triggerHook("changed",t)},i.wheel=function(t){t.preventDefault();var i=1;t.originalEvent.deltaY?i=0 -
-
- ${this._creatBtns(this.options.headToolbar, btnsTpl)} +
+
+
+ ${this._creatBtns(this.options.headToolbar, btnsTpl)} +
+ ${this._creatTitle()}
- ${this._creatTitle()} -
-
- -
- `; @@ -260,7 +262,7 @@ class PhotoViewer { } - close(el) { + close() { this._triggerHook('beforeClose', this.$el); @@ -445,7 +447,7 @@ class PhotoViewer { let self = this; - let loaderHTML = `
`; + let loaderHTML = `
`; // loader start this.$photoviewer.append(loaderHTML); @@ -877,7 +879,6 @@ window.PhotoViewer = PhotoViewer; * jQuery plugin */ -// jquery element of calling plugin let jqEl = null, getImgGroup = function (list, groupName) { @@ -911,7 +912,7 @@ $.fn.photoviewer = function (options) { } // Get init event, 'click' or 'dblclick' - let opts = $.extend(true, {}, defaults, options); + let opts = $.extend(true, {}, DEFAULTS, options); // We should get zIndex of options before plugin's init. PUBLIC_VARS['zIndex'] = opts.zIndex; @@ -946,18 +947,14 @@ $.fn.photoviewer = function (options) { groupList = $D.find('[data-group="' + currentGroupName + '"]'); if (currentGroupName !== undefined) { - items = getImgGroup(groupList, currentGroupName); options['index'] = $(this).index('[data-group="' + currentGroupName + '"]'); - } else { - items = getImgGroup(jqEl.not('[data-group]')); options['index'] = $(this).index(); - } - $(this).data(NS, new PhotoViewer(this, items, options)); + $(this).data(NS, new PhotoViewer(items, options, this)); }); @@ -982,18 +979,14 @@ $D.on(CLICK_EVENT + EVENT_NS, '[data-' + NS + ']', function (e) { groupList = $D.find('[data-group="' + currentGroupName + '"]'); if (currentGroupName !== undefined) { - items = getImgGroup(groupList, currentGroupName); - defaults['index'] = $(this).index('[data-group="' + currentGroupName + '"]'); - + DEFAULTS['index'] = $(this).index('[data-group="' + currentGroupName + '"]'); } else { - items = getImgGroup(jqEl.not('[data-group]')); - defaults['index'] = $(this).index(); - + DEFAULTS['index'] = $(this).index(); } - $(this).data(NS, new PhotoViewer(this, items, defaults)); + $(this).data(NS, new PhotoViewer(items, DEFAULTS, this)); }); diff --git a/src/js/defaults.js b/src/js/defaults.js index 3e7c55f..d265139 100644 --- a/src/js/defaults.js +++ b/src/js/defaults.js @@ -71,8 +71,7 @@ export default { fullscreen: 'fa fa-photo', actualSize: 'fa fa-arrows-alt', rotateLeft: 'fa fa-rotate-left', - rotateRight: 'fa fa-rotate-right', - loader: 'fa fa-spinner fa-pulse' + rotateRight: 'fa fa-rotate-right' }, // Customize language of button title diff --git a/src/sass/_general.scss b/src/sass/_general.scss index 186c069..8d4635e 100644 --- a/src/sass/_general.scss +++ b/src/sass/_general.scss @@ -6,6 +6,13 @@ z-index: 1090; width: 320px; height: 320px; + cursor: default; +} + +.photoviewer-inner { + position: relative; + width: 100%; + height: 100%; background-color: #111; background-color: rgba(0, 0, 0, .85); box-shadow: 0 0 3px 1px rgba(0, 0, 0, .3); @@ -130,6 +137,19 @@ background-color: rgba(0, 0, 0, .3); color: #333; + &::before { + content: ''; + display: inline-block; + position: relative; + width: 35px; + height: 35px; + border-width: 5px; + border-style: solid; + border-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, .5) rgba(0, 0, 0, .5) rgba(255, 255, 255, .5); + border-radius: 100%; + animation: photoviewerLoading 1s infinite linear; + } + &::after { content: ''; display: inline-block; @@ -138,8 +158,14 @@ vertical-align: middle; overflow: hidden; } +} + +@keyframes photoviewerLoading { + 0% { + transform: rotateZ(0deg) translate3d(0, 0, 0); + } - i { - font-size: 32px; + 100% { + transform: rotateZ(360deg) translate3d(0, 0, 0); } } diff --git a/src/sass/_resizable.scss b/src/sass/_resizable.scss index be4c14d..3c5aece 100644 --- a/src/sass/_resizable.scss +++ b/src/sass/_resizable.scss @@ -1,95 +1,82 @@ // ----------------------- // Resizable // ----------------------- -// .photoviewer-resizable-handle {} +.photoviewer-resizable-handle { + position: absolute; + z-index: 10; +} .photoviewer-resizable-handle-e { - position: absolute; top: 0; right: -5px; bottom: 0; left: auto; - z-index: 10; width: 10px; cursor: e-resize; } .photoviewer-resizable-handle-s { - position: absolute; top: auto; right: 0; bottom: -5px; left: 0; - z-index: 10; height: 10px; cursor: s-resize; } .photoviewer-resizable-handle-w { - position: absolute; top: 0; right: auto; bottom: 0; left: -5px; - z-index: 10; width: 10px; cursor: w-resize; } .photoviewer-resizable-handle-n { - position: absolute; top: -5px; right: 0; bottom: auto; left: 0; - z-index: 10; height: 10px; cursor: n-resize; } .photoviewer-resizable-handle-se { - position: absolute; top: auto; right: -5px; bottom: -5px; left: auto; - z-index: 11; width: 10px; height: 10px; cursor: se-resize; } .photoviewer-resizable-handle-sw { - position: absolute; top: auto; right: auto; bottom: -5px; left: -5px; - z-index: 11; width: 10px; height: 10px; cursor: sw-resize; } .photoviewer-resizable-handle-nw { - position: absolute; top: -5px; right: auto; bottom: auto; left: -5px; - z-index: 11; width: 10px; height: 10px; cursor: nw-resize; } .photoviewer-resizable-handle-ne { - position: absolute; top: -5px; right: -5px; bottom: auto; left: auto; - z-index: 11; width: 10px; height: 10px; cursor: ne-resize;