diff options
Diffstat (limited to 'ishtar_common/static/lightgallery')
6 files changed, 1205 insertions, 0 deletions
| diff --git a/ishtar_common/static/lightgallery/js/lg-fullscreen.js b/ishtar_common/static/lightgallery/js/lg-fullscreen.js new file mode 100644 index 000000000..e99d54eb0 --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-fullscreen.js @@ -0,0 +1,125 @@ +/**! + * lg-fullscreen.js | 1.0.0 | October 5th 2016 + * http://sachinchoolur.github.io/lg-fullscreen.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgFullscreen = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +(function (global, factory) { +    if (typeof define === "function" && define.amd) { +        define([], factory); +    } else if (typeof exports !== "undefined") { +        factory(); +    } else { +        var mod = { +            exports: {} +        }; +        factory(); +        global.lgFullscreen = mod.exports; +    } +})(this, function () { +    'use strict'; + +    var _extends = Object.assign || function (target) { +        for (var i = 1; i < arguments.length; i++) { +            var source = arguments[i]; + +            for (var key in source) { +                if (Object.prototype.hasOwnProperty.call(source, key)) { +                    target[key] = source[key]; +                } +            } +        } + +        return target; +    }; + +    var fullscreenDefaults = { +        fullScreen: true +    }; + +    var Fullscreen = function Fullscreen(element) { + +        this.el = element; + +        this.core = window.lgData[this.el.getAttribute('lg-uid')]; +        this.core.s = _extends({}, fullscreenDefaults, this.core.s); + +        this.init(); + +        return this; +    }; + +    Fullscreen.prototype.init = function () { +        var fullScreen = ''; +        if (this.core.s.fullScreen) { + +            // check for fullscreen browser support +            if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled) { +                return; +            } else { +                fullScreen = '<span class="lg-fullscreen lg-icon"></span>'; +                this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', fullScreen); +                this.fullScreen(); +            } +        } +    }; + +    Fullscreen.prototype.requestFullscreen = function () { +        var el = document.documentElement; +        if (el.requestFullscreen) { +            el.requestFullscreen(); +        } else if (el.msRequestFullscreen) { +            el.msRequestFullscreen(); +        } else if (el.mozRequestFullScreen) { +            el.mozRequestFullScreen(); +        } else if (el.webkitRequestFullscreen) { +            el.webkitRequestFullscreen(); +        } +    }; + +    Fullscreen.prototype.exitFullscreen = function () { +        if (document.exitFullscreen) { +            document.exitFullscreen(); +        } else if (document.msExitFullscreen) { +            document.msExitFullscreen(); +        } else if (document.mozCancelFullScreen) { +            document.mozCancelFullScreen(); +        } else if (document.webkitExitFullscreen) { +            document.webkitExitFullscreen(); +        } +    }; + +    // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode +    Fullscreen.prototype.fullScreen = function () { +        var _this = this; + +        utils.on(document, 'fullscreenchange.lgfullscreen webkitfullscreenchange.lgfullscreen mozfullscreenchange.lgfullscreen MSFullscreenChange.lgfullscreen', function () { +            if (utils.hasClass(_this.core.outer, 'lg-fullscreen-on')) { +                utils.removeClass(_this.core.outer, 'lg-fullscreen-on'); +            } else { +                utils.addClass(_this.core.outer, 'lg-fullscreen-on'); +            } +        }); + +        utils.on(this.core.outer.querySelector('.lg-fullscreen'), 'click.lg', function () { +            if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { +                _this.requestFullscreen(); +            } else { +                _this.exitFullscreen(); +            } +        }); +    }; + +    Fullscreen.prototype.destroy = function () { + +        // exit from fullscreen if activated +        this.exitFullscreen(); + +        utils.off(document, '.lgfullscreen'); +    }; + +    window.lgModules.fullscreen = Fullscreen; +}); + +},{}]},{},[1])(1) +});
\ No newline at end of file diff --git a/ishtar_common/static/lightgallery/js/lg-fullscreen.min.js b/ishtar_common/static/lightgallery/js/lg-fullscreen.min.js new file mode 100644 index 000000000..541aade6c --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-fullscreen.min.js @@ -0,0 +1,7 @@ +/**! + * lg-fullscreen.js | 1.0.0 | October 5th 2016 + * http://sachinchoolur.github.io/lg-fullscreen.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.LgFullscreen=e()}}(function(){var e,n,l;return function e(n,l,t){function r(o,c){if(!l[o]){if(!n[o]){var s="function"==typeof require&&require;if(!c&&s)return s(o,!0);if(u)return u(o,!0);var i=new Error("Cannot find module '"+o+"'");throw i.code="MODULE_NOT_FOUND",i}var f=l[o]={exports:{}};n[o][0].call(f.exports,function(e){var l=n[o][1][e];return r(l?l:e)},f,f.exports,e,n,l,t)}return l[o].exports}for(var u="function"==typeof require&&require,o=0;o<t.length;o++)r(t[o]);return r}({1:[function(n,l,t){!function(n,l){if("function"==typeof e&&e.amd)e([],l);else if("undefined"!=typeof t)l();else{var r={exports:{}};l(),n.lgFullscreen=r.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var l=arguments[n];for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&(e[t]=l[t])}return e},n={fullScreen:!0},l=function l(t){return this.el=t,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},n,this.core.s),this.init(),this};l.prototype.init=function(){var e="";if(this.core.s.fullScreen){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))return;e='<span class="lg-fullscreen lg-icon"></span>',this.core.outer.querySelector(".lg-toolbar").insertAdjacentHTML("beforeend",e),this.fullScreen()}},l.prototype.requestFullscreen=function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()},l.prototype.exitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},l.prototype.fullScreen=function(){var e=this;utils.on(document,"fullscreenchange.lgfullscreen webkitfullscreenchange.lgfullscreen mozfullscreenchange.lgfullscreen MSFullscreenChange.lgfullscreen",function(){utils.hasClass(e.core.outer,"lg-fullscreen-on")?utils.removeClass(e.core.outer,"lg-fullscreen-on"):utils.addClass(e.core.outer,"lg-fullscreen-on")}),utils.on(this.core.outer.querySelector(".lg-fullscreen"),"click.lg",function(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?e.exitFullscreen():e.requestFullscreen()})},l.prototype.destroy=function(){this.exitFullscreen(),utils.off(document,".lgfullscreen")},window.lgModules.fullscreen=l})},{}]},{},[1])(1)});
\ No newline at end of file diff --git a/ishtar_common/static/lightgallery/js/lg-thumbnail.js b/ishtar_common/static/lightgallery/js/lg-thumbnail.js new file mode 100644 index 000000000..69aa0581c --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-thumbnail.js @@ -0,0 +1,491 @@ +/**! + * lg-thumbnail.js | 1.0.0 | October 5th 2016 + * http://sachinchoolur.github.io/lg-thumbnail.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgThumbnail = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +(function (global, factory) { +    if (typeof define === "function" && define.amd) { +        define([], factory); +    } else if (typeof exports !== "undefined") { +        factory(); +    } else { +        var mod = { +            exports: {} +        }; +        factory(); +        global.lgThumbnail = mod.exports; +    } +})(this, function () { +    'use strict'; + +    var _extends = Object.assign || function (target) { +        for (var i = 1; i < arguments.length; i++) { +            var source = arguments[i]; + +            for (var key in source) { +                if (Object.prototype.hasOwnProperty.call(source, key)) { +                    target[key] = source[key]; +                } +            } +        } + +        return target; +    }; + +    var thumbnailDefaults = { +        thumbnail: true, + +        animateThumb: true, +        currentPagerPosition: 'middle', + +        thumbWidth: 100, +        thumbContHeight: 100, +        thumbMargin: 5, + +        exThumbImage: false, +        showThumbByDefault: true, +        toggleThumb: true, +        pullCaptionUp: true, + +        enableThumbDrag: true, +        enableThumbSwipe: true, +        swipeThreshold: 50, + +        loadYoutubeThumbnail: true, +        youtubeThumbSize: 1, + +        loadVimeoThumbnail: true, +        vimeoThumbSize: 'thumbnail_small', + +        loadDailymotionThumbnail: true +    }; + +    var Thumbnail = function Thumbnail(element) { + +        this.el = element; + +        this.core = window.lgData[this.el.getAttribute('lg-uid')]; +        this.core.s = _extends({}, thumbnailDefaults, this.core.s); + +        this.thumbOuter = null; +        this.thumbOuterWidth = 0; +        this.thumbTotalWidth = this.core.items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin); +        this.thumbIndex = this.core.index; + +        // Thumbnail animation value +        this.left = 0; + +        this.init(); + +        return this; +    }; + +    Thumbnail.prototype.init = function () { +        var _this = this; +        if (this.core.s.thumbnail && this.core.items.length > 1) { +            if (this.core.s.showThumbByDefault) { +                setTimeout(function () { +                    utils.addClass(_this.core.outer, 'lg-thumb-open'); +                }, 700); +            } + +            if (this.core.s.pullCaptionUp) { +                utils.addClass(this.core.outer, 'lg-pull-caption-up'); +            } + +            this.build(); +            if (this.core.s.animateThumb) { +                if (this.core.s.enableThumbDrag && !this.core.isTouch && this.core.doCss()) { +                    this.enableThumbDrag(); +                } + +                if (this.core.s.enableThumbSwipe && this.core.isTouch && this.core.doCss()) { +                    this.enableThumbSwipe(); +                } + +                this.thumbClickable = false; +            } else { +                this.thumbClickable = true; +            } + +            this.toggle(); +            this.thumbkeyPress(); +        } +    }; + +    Thumbnail.prototype.build = function () { +        var _this = this; +        var thumbList = ''; +        var vimeoErrorThumbSize = ''; +        var $thumb; +        var html = '<div class="lg-thumb-outer">' + '<div class="lg-thumb group">' + '</div>' + '</div>'; + +        switch (this.core.s.vimeoThumbSize) { +            case 'thumbnail_large': +                vimeoErrorThumbSize = '640'; +                break; +            case 'thumbnail_medium': +                vimeoErrorThumbSize = '200x150'; +                break; +            case 'thumbnail_small': +                vimeoErrorThumbSize = '100x75'; +        } + +        utils.addClass(_this.core.outer, 'lg-has-thumb'); + +        _this.core.outer.querySelector('.lg').insertAdjacentHTML('beforeend', html); + +        _this.thumbOuter = _this.core.outer.querySelector('.lg-thumb-outer'); +        _this.thumbOuterWidth = _this.thumbOuter.offsetWidth; + +        if (_this.core.s.animateThumb) { +            _this.core.outer.querySelector('.lg-thumb').style.width = _this.thumbTotalWidth + 'px'; +            _this.core.outer.querySelector('.lg-thumb').style.position = 'relative'; +        } + +        if (this.core.s.animateThumb) { +            _this.thumbOuter.style.height = _this.core.s.thumbContHeight + 'px'; +        } + +        function getThumb(src, thumb, index) { +            var isVideo = _this.core.isVideo(src, index) || {}; +            var thumbImg; +            var vimeoId = ''; + +            if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) { +                if (isVideo.youtube) { +                    if (_this.core.s.loadYoutubeThumbnail) { +                        thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg'; +                    } else { +                        thumbImg = thumb; +                    } +                } else if (isVideo.vimeo) { +                    if (_this.core.s.loadVimeoThumbnail) { +                        thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg'; +                        vimeoId = isVideo.vimeo[1]; +                    } else { +                        thumbImg = thumb; +                    } +                } else if (isVideo.dailymotion) { +                    if (_this.core.s.loadDailymotionThumbnail) { +                        thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1]; +                    } else { +                        thumbImg = thumb; +                    } +                } +            } else { +                thumbImg = thumb; +            } + +            thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" /></div>'; +            vimeoId = ''; +        } + +        if (_this.core.s.dynamic) { +            for (var j = 0; j < _this.core.s.dynamicEl.length; j++) { +                getThumb(_this.core.s.dynamicEl[j].src, _this.core.s.dynamicEl[j].thumb, j); +            } +        } else { +            for (var i = 0; i < _this.core.items.length; i++) { +                if (!_this.core.s.exThumbImage) { +                    getThumb(_this.core.items[i].getAttribute('href') || _this.core.items[i].getAttribute('data-src'), _this.core.items[i].querySelector('img').getAttribute('src'), i); +                } else { +                    getThumb(_this.core.items[i].getAttribute('href') || _this.core.items[i].getAttribute('data-src'), _this.core.items[i].getAttribute(_this.core.s.exThumbImage), i); +                } +            } +        } + +        _this.core.outer.querySelector('.lg-thumb').innerHTML = thumbList; + +        $thumb = _this.core.outer.querySelectorAll('.lg-thumb-item'); + +        for (var n = 0; n < $thumb.length; n++) { + +            /*jshint loopfunc: true */ +            (function (index) { +                var $this = $thumb[index]; +                var vimeoVideoId = $this.getAttribute('data-vimeo-id'); +                if (vimeoVideoId) { + +                    window['lgJsonP' + _this.el.getAttribute('lg-uid') + '' + n] = function (content) { +                        $this.querySelector('img').setAttribute('src', content[0][_this.core.s.vimeoThumbSize]); +                    }; + +                    var script = document.createElement('script'); +                    script.className = 'lg-script'; +                    script.src = '//www.vimeo.com/api/v2/video/' + vimeoVideoId + '.json?callback=lgJsonP' + _this.el.getAttribute('lg-uid') + '' + n; +                    document.body.appendChild(script); +                } +            })(n); +        } + +        // manage active class for thumbnail +        utils.addClass($thumb[_this.core.index], 'active'); +        utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () { + +            for (var j = 0; j < $thumb.length; j++) { +                utils.removeClass($thumb[j], 'active'); +            } + +            utils.addClass($thumb[_this.core.index], 'active'); +        }); + +        for (var k = 0; k < $thumb.length; k++) { + +            /*jshint loopfunc: true */ +            (function (index) { + +                utils.on($thumb[index], 'click.lg touchend.lg', function () { + +                    setTimeout(function () { + +                        // In IE9 and bellow touch does not support +                        // Go to slide if browser does not support css transitions +                        if (_this.thumbClickable && !_this.core.lgBusy || !_this.core.doCss()) { +                            _this.core.index = index; +                            _this.core.slide(_this.core.index, false, true); +                        } +                    }, 50); +                }); +            })(k); +        } + +        utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () { +            _this.animateThumb(_this.core.index); +        }); + +        utils.on(window, 'resize.lgthumb orientationchange.lgthumb', function () { +            setTimeout(function () { +                _this.animateThumb(_this.core.index); +                _this.thumbOuterWidth = _this.thumbOuter.offsetWidth; +            }, 200); +        }); +    }; + +    Thumbnail.prototype.setTranslate = function (value) { +        utils.setVendor(this.core.outer.querySelector('.lg-thumb'), 'Transform', 'translate3d(-' + value + 'px, 0px, 0px)'); +    }; + +    Thumbnail.prototype.animateThumb = function (index) { +        var $thumb = this.core.outer.querySelector('.lg-thumb'); +        if (this.core.s.animateThumb) { +            var position; +            switch (this.core.s.currentPagerPosition) { +                case 'left': +                    position = 0; +                    break; +                case 'middle': +                    position = this.thumbOuterWidth / 2 - this.core.s.thumbWidth / 2; +                    break; +                case 'right': +                    position = this.thumbOuterWidth - this.core.s.thumbWidth; +            } +            this.left = (this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1 - position; +            if (this.left > this.thumbTotalWidth - this.thumbOuterWidth) { +                this.left = this.thumbTotalWidth - this.thumbOuterWidth; +            } + +            if (this.left < 0) { +                this.left = 0; +            } + +            if (this.core.lGalleryOn) { +                if (!utils.hasClass($thumb, 'on')) { +                    utils.setVendor(this.core.outer.querySelector('.lg-thumb'), 'TransitionDuration', this.core.s.speed + 'ms'); +                } + +                if (!this.core.doCss()) { +                    $thumb.style.left = -this.left + 'px'; +                } +            } else { +                if (!this.core.doCss()) { +                    $thumb.style.left = -this.left + 'px'; +                } +            } + +            this.setTranslate(this.left); +        } +    }; + +    // Enable thumbnail dragging and swiping +    Thumbnail.prototype.enableThumbDrag = function () { + +        var _this = this; +        var startCoords = 0; +        var endCoords = 0; +        var isDraging = false; +        var isMoved = false; +        var tempLeft = 0; + +        utils.addClass(_this.thumbOuter, 'lg-grab'); + +        utils.on(_this.core.outer.querySelector('.lg-thumb'), 'mousedown.lgthumb', function (e) { +            if (_this.thumbTotalWidth > _this.thumbOuterWidth) { +                // execute only on .lg-object +                e.preventDefault(); +                startCoords = e.pageX; +                isDraging = true; + +                // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 +                _this.core.outer.scrollLeft += 1; +                _this.core.outer.scrollLeft -= 1; + +                // * +                _this.thumbClickable = false; +                utils.removeClass(_this.thumbOuter, 'lg-grab'); +                utils.addClass(_this.thumbOuter, 'lg-grabbing'); +            } +        }); + +        utils.on(window, 'mousemove.lgthumb', function (e) { +            if (isDraging) { +                tempLeft = _this.left; +                isMoved = true; +                endCoords = e.pageX; + +                utils.addClass(_this.thumbOuter, 'lg-dragging'); + +                tempLeft = tempLeft - (endCoords - startCoords); + +                if (tempLeft > _this.thumbTotalWidth - _this.thumbOuterWidth) { +                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; +                } + +                if (tempLeft < 0) { +                    tempLeft = 0; +                } + +                // move current slide +                _this.setTranslate(tempLeft); +            } +        }); + +        utils.on(window, 'mouseup.lgthumb', function () { +            if (isMoved) { +                isMoved = false; +                utils.removeClass(_this.thumbOuter, 'lg-dragging'); + +                _this.left = tempLeft; + +                if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { +                    _this.thumbClickable = true; +                } +            } else { +                _this.thumbClickable = true; +            } + +            if (isDraging) { +                isDraging = false; +                utils.removeClass(_this.thumbOuter, 'lg-grabbing'); +                utils.addClass(_this.thumbOuter, 'lg-grab'); +            } +        }); +    }; + +    Thumbnail.prototype.enableThumbSwipe = function () { +        var _this = this; +        var startCoords = 0; +        var endCoords = 0; +        var isMoved = false; +        var tempLeft = 0; + +        utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchstart.lg', function (e) { +            if (_this.thumbTotalWidth > _this.thumbOuterWidth) { +                e.preventDefault(); +                startCoords = e.targetTouches[0].pageX; +                _this.thumbClickable = false; +            } +        }); + +        utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchmove.lg', function (e) { +            if (_this.thumbTotalWidth > _this.thumbOuterWidth) { +                e.preventDefault(); +                endCoords = e.targetTouches[0].pageX; +                isMoved = true; + +                utils.addClass(_this.thumbOuter, 'lg-dragging'); + +                tempLeft = _this.left; + +                tempLeft = tempLeft - (endCoords - startCoords); + +                if (tempLeft > _this.thumbTotalWidth - _this.thumbOuterWidth) { +                    tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; +                } + +                if (tempLeft < 0) { +                    tempLeft = 0; +                } + +                // move current slide +                _this.setTranslate(tempLeft); +            } +        }); + +        utils.on(_this.core.outer.querySelector('.lg-thumb'), 'touchend.lg', function () { +            if (_this.thumbTotalWidth > _this.thumbOuterWidth) { + +                if (isMoved) { +                    isMoved = false; +                    utils.removeClass(_this.thumbOuter, 'lg-dragging'); +                    if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { +                        _this.thumbClickable = true; +                    } + +                    _this.left = tempLeft; +                } else { +                    _this.thumbClickable = true; +                } +            } else { +                _this.thumbClickable = true; +            } +        }); +    }; + +    Thumbnail.prototype.toggle = function () { +        var _this = this; +        if (_this.core.s.toggleThumb) { +            utils.addClass(_this.core.outer, 'lg-can-toggle'); +            _this.thumbOuter.insertAdjacentHTML('beforeend', '<span class="lg-toggle-thumb lg-icon"></span>'); +            utils.on(_this.core.outer.querySelector('.lg-toggle-thumb'), 'click.lg', function () { +                if (utils.hasClass(_this.core.outer, 'lg-thumb-open')) { +                    utils.removeClass(_this.core.outer, 'lg-thumb-open'); +                } else { +                    utils.addClass(_this.core.outer, 'lg-thumb-open'); +                } +            }); +        } +    }; + +    Thumbnail.prototype.thumbkeyPress = function () { +        var _this = this; +        utils.on(window, 'keydown.lgthumb', function (e) { +            if (e.keyCode === 38) { +                e.preventDefault(); +                utils.addClass(_this.core.outer, 'lg-thumb-open'); +            } else if (e.keyCode === 40) { +                e.preventDefault(); +                utils.removeClass(_this.core.outer, 'lg-thumb-open'); +            } +        }); +    }; + +    Thumbnail.prototype.destroy = function () { +        if (this.core.s.thumbnail && this.core.items.length > 1) { +            utils.off(window, '.lgthumb'); +            this.thumbOuter.parentNode.removeChild(this.thumbOuter); +            utils.removeClass(this.core.outer, 'lg-has-thumb'); + +            var lgScript = document.getElementsByClassName('lg-script'); +            while (lgScript[0]) { +                lgScript[0].parentNode.removeChild(lgScript[0]); +            } +        } +    }; + +    window.lgModules.thumbnail = Thumbnail; +}); + +},{}]},{},[1])(1) +});
\ No newline at end of file diff --git a/ishtar_common/static/lightgallery/js/lg-thumbnail.min.js b/ishtar_common/static/lightgallery/js/lg-thumbnail.min.js new file mode 100644 index 000000000..586165a6d --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-thumbnail.min.js @@ -0,0 +1,7 @@ +/**! + * lg-thumbnail.js | 1.0.0 | October 5th 2016 + * http://sachinchoolur.github.io/lg-thumbnail.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.LgThumbnail=t()}}(function(){var t,e,i;return function t(e,i,o){function u(s,l){if(!i[s]){if(!e[s]){var h="function"==typeof require&&require;if(!l&&h)return h(s,!0);if(r)return r(s,!0);var n=new Error("Cannot find module '"+s+"'");throw n.code="MODULE_NOT_FOUND",n}var a=i[s]={exports:{}};e[s][0].call(a.exports,function(t){var i=e[s][1][t];return u(i?i:t)},a,a.exports,t,e,i,o)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)u(o[s]);return u}({1:[function(e,i,o){!function(e,i){if("function"==typeof t&&t.amd)t([],i);else if("undefined"!=typeof o)i();else{var u={exports:{}};i(),e.lgThumbnail=u.exports}}(this,function(){"use strict";var t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},e={thumbnail:!0,animateThumb:!0,currentPagerPosition:"middle",thumbWidth:100,thumbContHeight:100,thumbMargin:5,exThumbImage:!1,showThumbByDefault:!0,toggleThumb:!0,pullCaptionUp:!0,enableThumbDrag:!0,enableThumbSwipe:!0,swipeThreshold:50,loadYoutubeThumbnail:!0,youtubeThumbSize:1,loadVimeoThumbnail:!0,vimeoThumbSize:"thumbnail_small",loadDailymotionThumbnail:!0},i=function i(o){return this.el=o,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=t({},e,this.core.s),this.thumbOuter=null,this.thumbOuterWidth=0,this.thumbTotalWidth=this.core.items.length*(this.core.s.thumbWidth+this.core.s.thumbMargin),this.thumbIndex=this.core.index,this.left=0,this.init(),this};i.prototype.init=function(){var t=this;this.core.s.thumbnail&&this.core.items.length>1&&(this.core.s.showThumbByDefault&&setTimeout(function(){utils.addClass(t.core.outer,"lg-thumb-open")},700),this.core.s.pullCaptionUp&&utils.addClass(this.core.outer,"lg-pull-caption-up"),this.build(),this.core.s.animateThumb?(this.core.s.enableThumbDrag&&!this.core.isTouch&&this.core.doCss()&&this.enableThumbDrag(),this.core.s.enableThumbSwipe&&this.core.isTouch&&this.core.doCss()&&this.enableThumbSwipe(),this.thumbClickable=!1):this.thumbClickable=!0,this.toggle(),this.thumbkeyPress())},i.prototype.build=function(){function t(t,u,r){var s=e.core.isVideo(t,r)||{},l,h="";s.youtube||s.vimeo||s.dailymotion?s.youtube?l=e.core.s.loadYoutubeThumbnail?"//img.youtube.com/vi/"+s.youtube[1]+"/"+e.core.s.youtubeThumbSize+".jpg":u:s.vimeo?e.core.s.loadVimeoThumbnail?(l="//i.vimeocdn.com/video/error_"+o+".jpg",h=s.vimeo[1]):l=u:s.dailymotion&&(l=e.core.s.loadDailymotionThumbnail?"//www.dailymotion.com/thumbnail/video/"+s.dailymotion[1]:u):l=u,i+='<div data-vimeo-id="'+h+'" class="lg-thumb-item" style="width:'+e.core.s.thumbWidth+"px; margin-right: "+e.core.s.thumbMargin+'px"><img src="'+l+'" /></div>',h=""}var e=this,i="",o="",u,r='<div class="lg-thumb-outer"><div class="lg-thumb group"></div></div>';switch(this.core.s.vimeoThumbSize){case"thumbnail_large":o="640";break;case"thumbnail_medium":o="200x150";break;case"thumbnail_small":o="100x75"}if(utils.addClass(e.core.outer,"lg-has-thumb"),e.core.outer.querySelector(".lg").insertAdjacentHTML("beforeend",r),e.thumbOuter=e.core.outer.querySelector(".lg-thumb-outer"),e.thumbOuterWidth=e.thumbOuter.offsetWidth,e.core.s.animateThumb&&(e.core.outer.querySelector(".lg-thumb").style.width=e.thumbTotalWidth+"px",e.core.outer.querySelector(".lg-thumb").style.position="relative"),this.core.s.animateThumb&&(e.thumbOuter.style.height=e.core.s.thumbContHeight+"px"),e.core.s.dynamic)for(var s=0;s<e.core.s.dynamicEl.length;s++)t(e.core.s.dynamicEl[s].src,e.core.s.dynamicEl[s].thumb,s);else for(var l=0;l<e.core.items.length;l++)e.core.s.exThumbImage?t(e.core.items[l].getAttribute("href")||e.core.items[l].getAttribute("data-src"),e.core.items[l].getAttribute(e.core.s.exThumbImage),l):t(e.core.items[l].getAttribute("href")||e.core.items[l].getAttribute("data-src"),e.core.items[l].querySelector("img").getAttribute("src"),l);e.core.outer.querySelector(".lg-thumb").innerHTML=i,u=e.core.outer.querySelectorAll(".lg-thumb-item");for(var h=0;h<u.length;h++)!function(t){var i=u[t],o=i.getAttribute("data-vimeo-id");if(o){window["lgJsonP"+e.el.getAttribute("lg-uid")+h]=function(t){i.querySelector("img").setAttribute("src",t[0][e.core.s.vimeoThumbSize])};var r=document.createElement("script");r.className="lg-script",r.src="//www.vimeo.com/api/v2/video/"+o+".json?callback=lgJsonP"+e.el.getAttribute("lg-uid")+h,document.body.appendChild(r)}}(h);utils.addClass(u[e.core.index],"active"),utils.on(e.core.el,"onBeforeSlide.lgtm",function(){for(var t=0;t<u.length;t++)utils.removeClass(u[t],"active");utils.addClass(u[e.core.index],"active")});for(var n=0;n<u.length;n++)!function(t){utils.on(u[t],"click.lg touchend.lg",function(){setTimeout(function(){(e.thumbClickable&&!e.core.lgBusy||!e.core.doCss())&&(e.core.index=t,e.core.slide(e.core.index,!1,!0))},50)})}(n);utils.on(e.core.el,"onBeforeSlide.lgtm",function(){e.animateThumb(e.core.index)}),utils.on(window,"resize.lgthumb orientationchange.lgthumb",function(){setTimeout(function(){e.animateThumb(e.core.index),e.thumbOuterWidth=e.thumbOuter.offsetWidth},200)})},i.prototype.setTranslate=function(t){utils.setVendor(this.core.outer.querySelector(".lg-thumb"),"Transform","translate3d(-"+t+"px, 0px, 0px)")},i.prototype.animateThumb=function(t){var e=this.core.outer.querySelector(".lg-thumb");if(this.core.s.animateThumb){var i;switch(this.core.s.currentPagerPosition){case"left":i=0;break;case"middle":i=this.thumbOuterWidth/2-this.core.s.thumbWidth/2;break;case"right":i=this.thumbOuterWidth-this.core.s.thumbWidth}this.left=(this.core.s.thumbWidth+this.core.s.thumbMargin)*t-1-i,this.left>this.thumbTotalWidth-this.thumbOuterWidth&&(this.left=this.thumbTotalWidth-this.thumbOuterWidth),this.left<0&&(this.left=0),this.core.lGalleryOn?(utils.hasClass(e,"on")||utils.setVendor(this.core.outer.querySelector(".lg-thumb"),"TransitionDuration",this.core.s.speed+"ms"),this.core.doCss()||(e.style.left=-this.left+"px")):this.core.doCss()||(e.style.left=-this.left+"px"),this.setTranslate(this.left)}},i.prototype.enableThumbDrag=function(){var t=this,e=0,i=0,o=!1,u=!1,r=0;utils.addClass(t.thumbOuter,"lg-grab"),utils.on(t.core.outer.querySelector(".lg-thumb"),"mousedown.lgthumb",function(i){t.thumbTotalWidth>t.thumbOuterWidth&&(i.preventDefault(),e=i.pageX,o=!0,t.core.outer.scrollLeft+=1,t.core.outer.scrollLeft-=1,t.thumbClickable=!1,utils.removeClass(t.thumbOuter,"lg-grab"),utils.addClass(t.thumbOuter,"lg-grabbing"))}),utils.on(window,"mousemove.lgthumb",function(s){o&&(r=t.left,u=!0,i=s.pageX,utils.addClass(t.thumbOuter,"lg-dragging"),r-=i-e,r>t.thumbTotalWidth-t.thumbOuterWidth&&(r=t.thumbTotalWidth-t.thumbOuterWidth),r<0&&(r=0),t.setTranslate(r))}),utils.on(window,"mouseup.lgthumb",function(){u?(u=!1,utils.removeClass(t.thumbOuter,"lg-dragging"),t.left=r,Math.abs(i-e)<t.core.s.swipeThreshold&&(t.thumbClickable=!0)):t.thumbClickable=!0,o&&(o=!1,utils.removeClass(t.thumbOuter,"lg-grabbing"),utils.addClass(t.thumbOuter,"lg-grab"))})},i.prototype.enableThumbSwipe=function(){var t=this,e=0,i=0,o=!1,u=0;utils.on(t.core.outer.querySelector(".lg-thumb"),"touchstart.lg",function(i){t.thumbTotalWidth>t.thumbOuterWidth&&(i.preventDefault(),e=i.targetTouches[0].pageX,t.thumbClickable=!1)}),utils.on(t.core.outer.querySelector(".lg-thumb"),"touchmove.lg",function(r){t.thumbTotalWidth>t.thumbOuterWidth&&(r.preventDefault(),i=r.targetTouches[0].pageX,o=!0,utils.addClass(t.thumbOuter,"lg-dragging"),u=t.left,u-=i-e,u>t.thumbTotalWidth-t.thumbOuterWidth&&(u=t.thumbTotalWidth-t.thumbOuterWidth),u<0&&(u=0),t.setTranslate(u))}),utils.on(t.core.outer.querySelector(".lg-thumb"),"touchend.lg",function(){t.thumbTotalWidth>t.thumbOuterWidth&&o?(o=!1,utils.removeClass(t.thumbOuter,"lg-dragging"),Math.abs(i-e)<t.core.s.swipeThreshold&&(t.thumbClickable=!0),t.left=u):t.thumbClickable=!0})},i.prototype.toggle=function(){var t=this;t.core.s.toggleThumb&&(utils.addClass(t.core.outer,"lg-can-toggle"),t.thumbOuter.insertAdjacentHTML("beforeend",'<span class="lg-toggle-thumb lg-icon"></span>'),utils.on(t.core.outer.querySelector(".lg-toggle-thumb"),"click.lg",function(){utils.hasClass(t.core.outer,"lg-thumb-open")?utils.removeClass(t.core.outer,"lg-thumb-open"):utils.addClass(t.core.outer,"lg-thumb-open")}))},i.prototype.thumbkeyPress=function(){var t=this;utils.on(window,"keydown.lgthumb",function(e){38===e.keyCode?(e.preventDefault(),utils.addClass(t.core.outer,"lg-thumb-open")):40===e.keyCode&&(e.preventDefault(),utils.removeClass(t.core.outer,"lg-thumb-open"))})},i.prototype.destroy=function(){if(this.core.s.thumbnail&&this.core.items.length>1){utils.off(window,".lgthumb"),this.thumbOuter.parentNode.removeChild(this.thumbOuter),utils.removeClass(this.core.outer,"lg-has-thumb");for(var t=document.getElementsByClassName("lg-script");t[0];)t[0].parentNode.removeChild(t[0])}},window.lgModules.thumbnail=i})},{}]},{},[1])(1)});
\ No newline at end of file diff --git a/ishtar_common/static/lightgallery/js/lg-zoom.js b/ishtar_common/static/lightgallery/js/lg-zoom.js new file mode 100644 index 000000000..369b0442e --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-zoom.js @@ -0,0 +1,568 @@ +/**! + * lg-zoom.js | 1.0.1 | December 22nd 2016 + * http://sachinchoolur.github.io/lg-zoom.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LgZoom = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +(function (global, factory) { +    if (typeof define === "function" && define.amd) { +        define([], factory); +    } else if (typeof exports !== "undefined") { +        factory(); +    } else { +        var mod = { +            exports: {} +        }; +        factory(); +        global.lgZoom = mod.exports; +    } +})(this, function () { +    'use strict'; + +    var _extends = Object.assign || function (target) { +        for (var i = 1; i < arguments.length; i++) { +            var source = arguments[i]; + +            for (var key in source) { +                if (Object.prototype.hasOwnProperty.call(source, key)) { +                    target[key] = source[key]; +                } +            } +        } + +        return target; +    }; + +    var getUseLeft = function getUseLeft() { +        var useLeft = false; +        var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); +        if (isChrome && parseInt(isChrome[2], 10) < 54) { +            useLeft = true; +        } + +        return useLeft; +    }; + +    var zoomDefaults = { +        scale: 1, +        zoom: true, +        actualSize: true, +        enableZoomAfter: 300, +        useLeftForZoom: getUseLeft() +    }; + +    var Zoom = function Zoom(element) { + +        this.el = element; + +        this.core = window.lgData[this.el.getAttribute('lg-uid')]; +        this.core.s = _extends({}, zoomDefaults, this.core.s); + +        if (this.core.s.zoom && this.core.doCss()) { +            this.init(); + +            // Store the zoomable timeout value just to clear it while closing +            this.zoomabletimeout = false; + +            // Set the initial value center +            this.pageX = window.innerWidth / 2; +            this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop); +        } + +        return this; +    }; + +    Zoom.prototype.init = function () { + +        var _this = this; +        var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>'; + +        if (_this.core.s.actualSize) { +            zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>'; +        } + +        if (_this.core.s.useLeftForZoom) { +            utils.addClass(_this.core.outer, 'lg-use-left-for-zoom'); +        } else { +            utils.addClass(_this.core.outer, 'lg-use-transition-for-zoom'); +        } + +        this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', zoomIcons); + +        // Add zoomable class +        utils.on(_this.core.el, 'onSlideItemLoad.lgtmzoom', function (event) { + +            // delay will be 0 except first time +            var _speed = _this.core.s.enableZoomAfter + event.detail.delay; + +            // set _speed value 0 if gallery opened from direct url and if it is first slide +            if (utils.hasClass(document.body, 'lg-from-hash') && event.detail.delay) { + +                // will execute only once +                _speed = 0; +            } else { + +                // Remove lg-from-hash to enable starting animation. +                utils.removeClass(document.body, 'lg-from-hash'); +            } + +            _this.zoomabletimeout = setTimeout(function () { +                utils.addClass(_this.core.___slide[event.detail.index], 'lg-zoomable'); +            }, _speed + 30); +        }); + +        var scale = 1; +        /** +         * @desc Image zoom +         * Translate the wrap and scale the image to get better user experience +         * +         * @param {String} scaleVal - Zoom decrement/increment value +         */ +        var zoom = function zoom(scaleVal) { + +            var image = _this.core.outer.querySelector('.lg-current .lg-image'); +            var _x; +            var _y; + +            // Find offset manually to avoid issue after zoom +            var offsetX = (window.innerWidth - image.clientWidth) / 2; +            var offsetY = (window.innerHeight - image.clientHeight) / 2 + (document.documentElement.scrollTop || document.body.scrollTop); + +            _x = _this.pageX - offsetX; +            _y = _this.pageY - offsetY; + +            var x = (scaleVal - 1) * _x; +            var y = (scaleVal - 1) * _y; + +            utils.setVendor(image, 'Transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)'); +            image.setAttribute('data-scale', scaleVal); + +            if (_this.core.s.useLeftForZoom) { +                image.parentElement.style.left = -x + 'px'; +                image.parentElement.style.top = -y + 'px'; +            } else { +                utils.setVendor(image.parentElement, 'Transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)'); +            } + +            image.parentElement.setAttribute('data-x', x); +            image.parentElement.setAttribute('data-y', y); +        }; + +        var callScale = function callScale() { +            if (scale > 1) { +                utils.addClass(_this.core.outer, 'lg-zoomed'); +            } else { +                _this.resetZoom(); +            } + +            if (scale < 1) { +                scale = 1; +            } + +            zoom(scale); +        }; + +        var actualSize = function actualSize(event, image, index, fromIcon) { +            var w = image.clientWidth; +            var nw; +            if (_this.core.s.dynamic) { +                nw = _this.core.s.dynamicEl[index].width || image.naturalWidth || w; +            } else { +                nw = _this.core.items[index].getAttribute('data-width') || image.naturalWidth || w; +            } + +            var _scale; + +            if (utils.hasClass(_this.core.outer, 'lg-zoomed')) { +                scale = 1; +            } else { +                if (nw > w) { +                    _scale = nw / w; +                    scale = _scale || 2; +                } +            } + +            if (fromIcon) { +                _this.pageX = window.innerWidth / 2; +                _this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop); +            } else { +                _this.pageX = event.pageX || event.targetTouches[0].pageX; +                _this.pageY = event.pageY || event.targetTouches[0].pageY; +            } + +            callScale(); +            setTimeout(function () { +                utils.removeClass(_this.core.outer, 'lg-grabbing'); +                utils.addClass(_this.core.outer, 'lg-grab'); +            }, 10); +        }; + +        var tapped = false; + +        // event triggered after appending slide content +        utils.on(_this.core.el, 'onAferAppendSlide.lgtmzoom', function (event) { + +            var index = event.detail.index; + +            // Get the current element +            var image = _this.core.___slide[index].querySelector('.lg-image'); + +            if (!_this.core.isTouch) { +                utils.on(image, 'dblclick', function (event) { +                    actualSize(event, image, index); +                }); +            } + +            if (_this.core.isTouch) { +                utils.on(image, 'touchstart', function (event) { +                    if (!tapped) { +                        tapped = setTimeout(function () { +                            tapped = null; +                        }, 300); +                    } else { +                        clearTimeout(tapped); +                        tapped = null; +                        actualSize(event, image, index); +                    } + +                    event.preventDefault(); +                }); +            } +        }); + +        // Update zoom on resize and orientationchange +        utils.on(window, 'resize.lgzoom scroll.lgzoom orientationchange.lgzoom', function () { +            _this.pageX = window.innerWidth / 2; +            _this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop); +            zoom(scale); +        }); + +        utils.on(document.getElementById('lg-zoom-out'), 'click.lg', function () { +            if (_this.core.outer.querySelector('.lg-current .lg-image')) { +                scale -= _this.core.s.scale; +                callScale(); +            } +        }); + +        utils.on(document.getElementById('lg-zoom-in'), 'click.lg', function () { +            if (_this.core.outer.querySelector('.lg-current .lg-image')) { +                scale += _this.core.s.scale; +                callScale(); +            } +        }); + +        utils.on(document.getElementById('lg-actual-size'), 'click.lg', function (event) { +            actualSize(event, _this.core.___slide[_this.core.index].querySelector('.lg-image'), _this.core.index, true); +        }); + +        // Reset zoom on slide change +        utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () { +            scale = 1; +            _this.resetZoom(); +        }); + +        // Drag option after zoom +        if (!_this.core.isTouch) { +            _this.zoomDrag(); +        } + +        if (_this.core.isTouch) { +            _this.zoomSwipe(); +        } +    }; + +    // Reset zoom effect +    Zoom.prototype.resetZoom = function () { +        utils.removeClass(this.core.outer, 'lg-zoomed'); +        for (var i = 0; i < this.core.___slide.length; i++) { +            if (this.core.___slide[i].querySelector('.lg-img-wrap')) { +                this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('style'); +                this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-x'); +                this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-y'); +            } +        } + +        for (var j = 0; j < this.core.___slide.length; j++) { +            if (this.core.___slide[j].querySelector('.lg-image')) { +                this.core.___slide[j].querySelector('.lg-image').removeAttribute('style'); +                this.core.___slide[j].querySelector('.lg-image').removeAttribute('data-scale'); +            } +        } + +        // Reset pagx pagy values to center +        this.pageX = window.innerWidth / 2; +        this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop); +    }; + +    Zoom.prototype.zoomSwipe = function () { +        var _this = this; +        var startCoords = {}; +        var endCoords = {}; +        var isMoved = false; + +        // Allow x direction drag +        var allowX = false; + +        // Allow Y direction drag +        var allowY = false; + +        for (var i = 0; i < _this.core.___slide.length; i++) { + +            /*jshint loopfunc: true */ +            utils.on(_this.core.___slide[i], 'touchstart.lg', function (e) { + +                if (utils.hasClass(_this.core.outer, 'lg-zoomed')) { +                    var image = _this.core.___slide[_this.core.index].querySelector('.lg-object'); + +                    allowY = image.offsetHeight * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientHeight; +                    allowX = image.offsetWidth * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientWidth; +                    if (allowX || allowY) { +                        e.preventDefault(); +                        startCoords = { +                            x: e.targetTouches[0].pageX, +                            y: e.targetTouches[0].pageY +                        }; +                    } +                } +            }); +        } + +        for (var j = 0; j < _this.core.___slide.length; j++) { + +            /*jshint loopfunc: true */ +            utils.on(_this.core.___slide[j], 'touchmove.lg', function (e) { + +                if (utils.hasClass(_this.core.outer, 'lg-zoomed')) { + +                    var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap'); +                    var distanceX; +                    var distanceY; + +                    e.preventDefault(); +                    isMoved = true; + +                    endCoords = { +                        x: e.targetTouches[0].pageX, +                        y: e.targetTouches[0].pageY +                    }; + +                    // reset opacity and transition duration +                    utils.addClass(_this.core.outer, 'lg-zoom-dragging'); + +                    if (allowY) { +                        distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y); +                    } else { +                        distanceY = -Math.abs(_el.getAttribute('data-y')); +                    } + +                    if (allowX) { +                        distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x); +                    } else { +                        distanceX = -Math.abs(_el.getAttribute('data-x')); +                    } + +                    if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) { + +                        if (_this.core.s.useLeftForZoom) { +                            _el.style.left = distanceX + 'px'; +                            _el.style.top = distanceY + 'px'; +                        } else { +                            utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); +                        } +                    } +                } +            }); +        } + +        for (var k = 0; k < _this.core.___slide.length; k++) { + +            /*jshint loopfunc: true */ +            utils.on(_this.core.___slide[k], 'touchend.lg', function () { +                if (utils.hasClass(_this.core.outer, 'lg-zoomed')) { +                    if (isMoved) { +                        isMoved = false; +                        utils.removeClass(_this.core.outer, 'lg-zoom-dragging'); +                        _this.touchendZoom(startCoords, endCoords, allowX, allowY); +                    } +                } +            }); +        } +    }; + +    Zoom.prototype.zoomDrag = function () { + +        var _this = this; +        var startCoords = {}; +        var endCoords = {}; +        var isDraging = false; +        var isMoved = false; + +        // Allow x direction drag +        var allowX = false; + +        // Allow Y direction drag +        var allowY = false; + +        for (var i = 0; i < _this.core.___slide.length; i++) { + +            /*jshint loopfunc: true */ +            utils.on(_this.core.___slide[i], 'mousedown.lgzoom', function (e) { + +                // execute only on .lg-object +                var image = _this.core.___slide[_this.core.index].querySelector('.lg-object'); + +                allowY = image.offsetHeight * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientHeight; +                allowX = image.offsetWidth * image.getAttribute('data-scale') > _this.core.outer.querySelector('.lg').clientWidth; + +                if (utils.hasClass(_this.core.outer, 'lg-zoomed')) { +                    if (utils.hasClass(e.target, 'lg-object') && (allowX || allowY)) { +                        e.preventDefault(); +                        startCoords = { +                            x: e.pageX, +                            y: e.pageY +                        }; + +                        isDraging = true; + +                        // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 +                        _this.core.outer.scrollLeft += 1; +                        _this.core.outer.scrollLeft -= 1; + +                        utils.removeClass(_this.core.outer, 'lg-grab'); +                        utils.addClass(_this.core.outer, 'lg-grabbing'); +                    } +                } +            }); +        } + +        utils.on(window, 'mousemove.lgzoom', function (e) { +            if (isDraging) { +                var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap'); +                var distanceX; +                var distanceY; + +                isMoved = true; +                endCoords = { +                    x: e.pageX, +                    y: e.pageY +                }; + +                // reset opacity and transition duration +                utils.addClass(_this.core.outer, 'lg-zoom-dragging'); + +                if (allowY) { +                    distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y); +                } else { +                    distanceY = -Math.abs(_el.getAttribute('data-y')); +                } + +                if (allowX) { +                    distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x); +                } else { +                    distanceX = -Math.abs(_el.getAttribute('data-x')); +                } + +                if (_this.core.s.useLeftForZoom) { +                    _el.style.left = distanceX + 'px'; +                    _el.style.top = distanceY + 'px'; +                } else { +                    utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); +                } +            } +        }); + +        utils.on(window, 'mouseup.lgzoom', function (e) { + +            if (isDraging) { +                isDraging = false; +                utils.removeClass(_this.core.outer, 'lg-zoom-dragging'); + +                // Fix for chrome mouse move on click +                if (isMoved && (startCoords.x !== endCoords.x || startCoords.y !== endCoords.y)) { +                    endCoords = { +                        x: e.pageX, +                        y: e.pageY +                    }; +                    _this.touchendZoom(startCoords, endCoords, allowX, allowY); +                } + +                isMoved = false; +            } + +            utils.removeClass(_this.core.outer, 'lg-grabbing'); +            utils.addClass(_this.core.outer, 'lg-grab'); +        }); +    }; + +    Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY) { + +        var _this = this; +        var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap'); +        var image = _this.core.___slide[_this.core.index].querySelector('.lg-object'); +        var distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x); +        var distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y); +        var minY = (_this.core.outer.querySelector('.lg').clientHeight - image.offsetHeight) / 2; +        var maxY = Math.abs(image.offsetHeight * Math.abs(image.getAttribute('data-scale')) - _this.core.outer.querySelector('.lg').clientHeight + minY); +        var minX = (_this.core.outer.querySelector('.lg').clientWidth - image.offsetWidth) / 2; +        var maxX = Math.abs(image.offsetWidth * Math.abs(image.getAttribute('data-scale')) - _this.core.outer.querySelector('.lg').clientWidth + minX); + +        if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) { +            if (allowY) { +                if (distanceY <= -maxY) { +                    distanceY = -maxY; +                } else if (distanceY >= -minY) { +                    distanceY = -minY; +                } +            } + +            if (allowX) { +                if (distanceX <= -maxX) { +                    distanceX = -maxX; +                } else if (distanceX >= -minX) { +                    distanceX = -minX; +                } +            } + +            if (allowY) { +                _el.setAttribute('data-y', Math.abs(distanceY)); +            } else { +                distanceY = -Math.abs(_el.getAttribute('data-y')); +            } + +            if (allowX) { +                _el.setAttribute('data-x', Math.abs(distanceX)); +            } else { +                distanceX = -Math.abs(_el.getAttribute('data-x')); +            } + +            if (_this.core.s.useLeftForZoom) { +                _el.style.left = distanceX + 'px'; +                _el.style.top = distanceY + 'px'; +            } else { +                utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); +            } +        } +    }; + +    Zoom.prototype.destroy = function () { + +        var _this = this; + +        // Unbind all events added by lightGallery zoom plugin +        utils.off(_this.core.el, '.lgzoom'); +        utils.off(window, '.lgzoom'); +        for (var i = 0; i < _this.core.___slide.length; i++) { +            utils.off(_this.core.___slide[i], '.lgzoom'); +        } + +        utils.off(_this.core.el, '.lgtmzoom'); +        _this.resetZoom(); +        clearTimeout(_this.zoomabletimeout); +        _this.zoomabletimeout = false; +    }; + +    window.lgModules.zoom = Zoom; +}); + +},{}]},{},[1])(1) +});
\ No newline at end of file diff --git a/ishtar_common/static/lightgallery/js/lg-zoom.min.js b/ishtar_common/static/lightgallery/js/lg-zoom.min.js new file mode 100644 index 000000000..004a9e73c --- /dev/null +++ b/ishtar_common/static/lightgallery/js/lg-zoom.min.js @@ -0,0 +1,7 @@ +/**! + * lg-zoom.js | 1.0.1 | December 22nd 2016 + * http://sachinchoolur.github.io/lg-zoom.js + * Copyright (c) 2016 Sachin N;  + * @license GPLv3  + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LgZoom=e()}}(function(){var e,t,o;return function e(t,o,r){function l(s,a){if(!o[s]){if(!t[s]){var n="function"==typeof require&&require;if(!a&&n)return n(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=o[s]={exports:{}};t[s][0].call(c.exports,function(e){var o=t[s][1][e];return l(o?o:e)},c,c.exports,e,t,o,r)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)l(r[s]);return l}({1:[function(t,o,r){!function(t,o){if("function"==typeof e&&e.amd)e([],o);else if("undefined"!=typeof r)o();else{var l={exports:{}};o(),t.lgZoom=l.exports}}(this,function(){"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},t=function e(){var t=!1,o=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return o&&parseInt(o[2],10)<54&&(t=!0),t},o={scale:1,zoom:!0,actualSize:!0,enableZoomAfter:300,useLeftForZoom:t()},r=function t(r){return this.el=r,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=e({},o,this.core.s),this.core.s.zoom&&this.core.doCss()&&(this.init(),this.zoomabletimeout=!1,this.pageX=window.innerWidth/2,this.pageY=window.innerHeight/2+(document.documentElement.scrollTop||document.body.scrollTop)),this};r.prototype.init=function(){var e=this,t='<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';e.core.s.actualSize&&(t+='<span id="lg-actual-size" class="lg-icon"></span>'),e.core.s.useLeftForZoom?utils.addClass(e.core.outer,"lg-use-left-for-zoom"):utils.addClass(e.core.outer,"lg-use-transition-for-zoom"),this.core.outer.querySelector(".lg-toolbar").insertAdjacentHTML("beforeend",t),utils.on(e.core.el,"onSlideItemLoad.lgtmzoom",function(t){var o=e.core.s.enableZoomAfter+t.detail.delay;utils.hasClass(document.body,"lg-from-hash")&&t.detail.delay?o=0:utils.removeClass(document.body,"lg-from-hash"),e.zoomabletimeout=setTimeout(function(){utils.addClass(e.core.___slide[t.detail.index],"lg-zoomable")},o+30)});var o=1,r=function t(o){var r=e.core.outer.querySelector(".lg-current .lg-image"),l,i,s=(window.innerWidth-r.clientWidth)/2,a=(window.innerHeight-r.clientHeight)/2+(document.documentElement.scrollTop||document.body.scrollTop);l=e.pageX-s,i=e.pageY-a;var n=(o-1)*l,u=(o-1)*i;utils.setVendor(r,"Transform","scale3d("+o+", "+o+", 1)"),r.setAttribute("data-scale",o),e.core.s.useLeftForZoom?(r.parentElement.style.left=-n+"px",r.parentElement.style.top=-u+"px"):utils.setVendor(r.parentElement,"Transform","translate3d(-"+n+"px, -"+u+"px, 0)"),r.parentElement.setAttribute("data-x",n),r.parentElement.setAttribute("data-y",u)},l=function t(){o>1?utils.addClass(e.core.outer,"lg-zoomed"):e.resetZoom(),o<1&&(o=1),r(o)},i=function t(r,i,s,a){var n=i.clientWidth,u;u=e.core.s.dynamic?e.core.s.dynamicEl[s].width||i.naturalWidth||n:e.core.items[s].getAttribute("data-width")||i.naturalWidth||n;var c;utils.hasClass(e.core.outer,"lg-zoomed")?o=1:u>n&&(c=u/n,o=c||2),a?(e.pageX=window.innerWidth/2,e.pageY=window.innerHeight/2+(document.documentElement.scrollTop||document.body.scrollTop)):(e.pageX=r.pageX||r.targetTouches[0].pageX,e.pageY=r.pageY||r.targetTouches[0].pageY),l(),setTimeout(function(){utils.removeClass(e.core.outer,"lg-grabbing"),utils.addClass(e.core.outer,"lg-grab")},10)},s=!1;utils.on(e.core.el,"onAferAppendSlide.lgtmzoom",function(t){var o=t.detail.index,r=e.core.___slide[o].querySelector(".lg-image");e.core.isTouch||utils.on(r,"dblclick",function(e){i(e,r,o)}),e.core.isTouch&&utils.on(r,"touchstart",function(e){s?(clearTimeout(s),s=null,i(e,r,o)):s=setTimeout(function(){s=null},300),e.preventDefault()})}),utils.on(window,"resize.lgzoom scroll.lgzoom orientationchange.lgzoom",function(){e.pageX=window.innerWidth/2,e.pageY=window.innerHeight/2+(document.documentElement.scrollTop||document.body.scrollTop),r(o)}),utils.on(document.getElementById("lg-zoom-out"),"click.lg",function(){e.core.outer.querySelector(".lg-current .lg-image")&&(o-=e.core.s.scale,l())}),utils.on(document.getElementById("lg-zoom-in"),"click.lg",function(){e.core.outer.querySelector(".lg-current .lg-image")&&(o+=e.core.s.scale,l())}),utils.on(document.getElementById("lg-actual-size"),"click.lg",function(t){i(t,e.core.___slide[e.core.index].querySelector(".lg-image"),e.core.index,!0)}),utils.on(e.core.el,"onBeforeSlide.lgtm",function(){o=1,e.resetZoom()}),e.core.isTouch||e.zoomDrag(),e.core.isTouch&&e.zoomSwipe()},r.prototype.resetZoom=function(){utils.removeClass(this.core.outer,"lg-zoomed");for(var e=0;e<this.core.___slide.length;e++)this.core.___slide[e].querySelector(".lg-img-wrap")&&(this.core.___slide[e].querySelector(".lg-img-wrap").removeAttribute("style"),this.core.___slide[e].querySelector(".lg-img-wrap").removeAttribute("data-x"),this.core.___slide[e].querySelector(".lg-img-wrap").removeAttribute("data-y"));for(var t=0;t<this.core.___slide.length;t++)this.core.___slide[t].querySelector(".lg-image")&&(this.core.___slide[t].querySelector(".lg-image").removeAttribute("style"),this.core.___slide[t].querySelector(".lg-image").removeAttribute("data-scale"));this.pageX=window.innerWidth/2,this.pageY=window.innerHeight/2+(document.documentElement.scrollTop||document.body.scrollTop)},r.prototype.zoomSwipe=function(){for(var e=this,t={},o={},r=!1,l=!1,i=!1,s=0;s<e.core.___slide.length;s++)utils.on(e.core.___slide[s],"touchstart.lg",function(o){if(utils.hasClass(e.core.outer,"lg-zoomed")){var r=e.core.___slide[e.core.index].querySelector(".lg-object");i=r.offsetHeight*r.getAttribute("data-scale")>e.core.outer.querySelector(".lg").clientHeight,l=r.offsetWidth*r.getAttribute("data-scale")>e.core.outer.querySelector(".lg").clientWidth,(l||i)&&(o.preventDefault(),t={x:o.targetTouches[0].pageX,y:o.targetTouches[0].pageY})}});for(var a=0;a<e.core.___slide.length;a++)utils.on(e.core.___slide[a],"touchmove.lg",function(s){if(utils.hasClass(e.core.outer,"lg-zoomed")){var a=e.core.___slide[e.core.index].querySelector(".lg-img-wrap"),n,u;s.preventDefault(),r=!0,o={x:s.targetTouches[0].pageX,y:s.targetTouches[0].pageY},utils.addClass(e.core.outer,"lg-zoom-dragging"),u=i?-Math.abs(a.getAttribute("data-y"))+(o.y-t.y):-Math.abs(a.getAttribute("data-y")),n=l?-Math.abs(a.getAttribute("data-x"))+(o.x-t.x):-Math.abs(a.getAttribute("data-x")),(Math.abs(o.x-t.x)>15||Math.abs(o.y-t.y)>15)&&(e.core.s.useLeftForZoom?(a.style.left=n+"px",a.style.top=u+"px"):utils.setVendor(a,"Transform","translate3d("+n+"px, "+u+"px, 0)"))}});for(var n=0;n<e.core.___slide.length;n++)utils.on(e.core.___slide[n],"touchend.lg",function(){utils.hasClass(e.core.outer,"lg-zoomed")&&r&&(r=!1,utils.removeClass(e.core.outer,"lg-zoom-dragging"),e.touchendZoom(t,o,l,i))})},r.prototype.zoomDrag=function(){for(var e=this,t={},o={},r=!1,l=!1,i=!1,s=!1,a=0;a<e.core.___slide.length;a++)utils.on(e.core.___slide[a],"mousedown.lgzoom",function(o){var l=e.core.___slide[e.core.index].querySelector(".lg-object");s=l.offsetHeight*l.getAttribute("data-scale")>e.core.outer.querySelector(".lg").clientHeight,i=l.offsetWidth*l.getAttribute("data-scale")>e.core.outer.querySelector(".lg").clientWidth,utils.hasClass(e.core.outer,"lg-zoomed")&&utils.hasClass(o.target,"lg-object")&&(i||s)&&(o.preventDefault(),t={x:o.pageX,y:o.pageY},r=!0,e.core.outer.scrollLeft+=1,e.core.outer.scrollLeft-=1,utils.removeClass(e.core.outer,"lg-grab"),utils.addClass(e.core.outer,"lg-grabbing"))});utils.on(window,"mousemove.lgzoom",function(a){if(r){var n=e.core.___slide[e.core.index].querySelector(".lg-img-wrap"),u,c;l=!0,o={x:a.pageX,y:a.pageY},utils.addClass(e.core.outer,"lg-zoom-dragging"),c=s?-Math.abs(n.getAttribute("data-y"))+(o.y-t.y):-Math.abs(n.getAttribute("data-y")),u=i?-Math.abs(n.getAttribute("data-x"))+(o.x-t.x):-Math.abs(n.getAttribute("data-x")),e.core.s.useLeftForZoom?(n.style.left=u+"px",n.style.top=c+"px"):utils.setVendor(n,"Transform","translate3d("+u+"px, "+c+"px, 0)")}}),utils.on(window,"mouseup.lgzoom",function(a){r&&(r=!1,utils.removeClass(e.core.outer,"lg-zoom-dragging"),!l||t.x===o.x&&t.y===o.y||(o={x:a.pageX,y:a.pageY},e.touchendZoom(t,o,i,s)),l=!1),utils.removeClass(e.core.outer,"lg-grabbing"),utils.addClass(e.core.outer,"lg-grab")})},r.prototype.touchendZoom=function(e,t,o,r){var l=this,i=l.core.___slide[l.core.index].querySelector(".lg-img-wrap"),s=l.core.___slide[l.core.index].querySelector(".lg-object"),a=-Math.abs(i.getAttribute("data-x"))+(t.x-e.x),n=-Math.abs(i.getAttribute("data-y"))+(t.y-e.y),u=(l.core.outer.querySelector(".lg").clientHeight-s.offsetHeight)/2,c=Math.abs(s.offsetHeight*Math.abs(s.getAttribute("data-scale"))-l.core.outer.querySelector(".lg").clientHeight+u),d=(l.core.outer.querySelector(".lg").clientWidth-s.offsetWidth)/2,g=Math.abs(s.offsetWidth*Math.abs(s.getAttribute("data-scale"))-l.core.outer.querySelector(".lg").clientWidth+d);(Math.abs(t.x-e.x)>15||Math.abs(t.y-e.y)>15)&&(r&&(n<=-c?n=-c:n>=-u&&(n=-u)),o&&(a<=-g?a=-g:a>=-d&&(a=-d)),r?i.setAttribute("data-y",Math.abs(n)):n=-Math.abs(i.getAttribute("data-y")),o?i.setAttribute("data-x",Math.abs(a)):a=-Math.abs(i.getAttribute("data-x")),l.core.s.useLeftForZoom?(i.style.left=a+"px",i.style.top=n+"px"):utils.setVendor(i,"Transform","translate3d("+a+"px, "+n+"px, 0)"))},r.prototype.destroy=function(){var e=this;utils.off(e.core.el,".lgzoom"),utils.off(window,".lgzoom");for(var t=0;t<e.core.___slide.length;t++)utils.off(e.core.___slide[t],".lgzoom");utils.off(e.core.el,".lgtmzoom"),e.resetZoom(),clearTimeout(e.zoomabletimeout),e.zoomabletimeout=!1},window.lgModules.zoom=r})},{}]},{},[1])(1)});
\ No newline at end of file | 
