1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00
invoiceninja/public/js/lightbox.min.js.map
2016-07-20 23:12:46 +02:00

1 line
24 KiB
Plaintext

{"version":3,"sources":["lightbox.js"],"names":["root","factory","define","amd","exports","module","require","lightbox","jQuery","this","$","Lightbox","options","album","currentImageIndex","init","extend","constructor","defaults","option","albumLabel","alwaysShowNavOnTouchDevices","fadeDuration","fitImagesInViewport","positionFromTop","resizeDuration","showImageNumberLabel","wrapAround","disableScrolling","prototype","imageCountLabel","currentImageNum","totalImages","replace","enable","build","self","on","event","start","currentTarget","appendTo","$lightbox","$overlay","$outerContainer","find","$container","containerTopPadding","parseInt","css","containerRightPadding","containerBottomPadding","containerLeftPadding","hide","end","target","attr","changeImage","length","$link","addToAlbum","push","link","title","$window","window","proxy","sizeOverlay","visibility","$links","imageNumber","dataLightboxValue","prop","i","j","top","scrollTop","left","scrollLeft","fadeIn","addClass","disableKeyboardNav","$image","preloader","Image","onload","$preloader","imageHeight","imageWidth","maxImageHeight","maxImageWidth","windowHeight","windowWidth","width","height","maxWidth","maxHeight","sizeContainer","src","document","postResize","newWidth","newHeight","showImage","oldWidth","outerWidth","oldHeight","outerHeight","animate","stop","updateNav","updateDetails","preloadNeighboringImages","enableKeyboardNav","alwaysShowNav","createEvent","e","show","html","undefined","open","location","href","labelText","text","removeClass","preloadNext","preloadPrev","keyboardAction","off","KEYCODE_ESC","KEYCODE_LEFTARROW","KEYCODE_RIGHTARROW","keycode","keyCode","key","String","fromCharCode","toLowerCase","match","fadeOut"],"mappings":"CAaA,SAAAA,EAAAC,GACA,kBAAAC,SAAAA,OAAAC,IAEAD,QAAA,UAAAD,GACA,gBAAAG,SAIAC,OAAAD,QAAAH,EAAAK,QAAA,WAGAN,EAAAO,SAAAN,EAAAD,EAAAQ,SAEAC,KAAA,SAAAC,GAEA,QAAAC,GAAAC,GACAH,KAAAI,SACAJ,KAAAK,kBAAA,OACAL,KAAAM,OAGAN,KAA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gD,YAAA,KAMA9C,EAAAkB,UAAAyB,IAAA,WACA7C,KAAAwE,qBACAvE,EAAAuD,QAAAgE,IAAA,SAAAxH,KAAA0D,aACA1D,KAAAiC,UAAAkG,QAAAnI,KAAAG,QAAAU,cACAb,KAAAkC,SAAAiG,QAAAnI,KAAAG,QAAAU,cACAZ,EAAA,yBAAAuC,KACAmB,WAAA,YAEA3D,KAAAG,QAAAgB,kBACAlB,EAAA,QAAAmH,YAAA,yBAIA,GAAAlH","file":"lightbox.min.js","sourcesContent":["/*!\n * Lightbox v2.8.2\n * by Lokesh Dhakar\n *\n * More info:\n * http://lokeshdhakar.com/projects/lightbox2/\n *\n * Copyright 2007, 2015 Lokesh Dhakar\n * Released under the MIT license\n * https://github.com/lokesh/lightbox2/blob/master/LICENSE\n */\n\n// Uses Node, AMD or browser globals to create a module.\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require('jquery'));\n } else {\n // Browser globals (root is window)\n root.lightbox = factory(root.jQuery);\n }\n}(this, function ($) {\n\n function Lightbox(options) {\n this.album = [];\n this.currentImageIndex = void 0;\n this.init();\n\n // options\n this.options = $.extend({}, this.constructor.defaults);\n this.option(options);\n }\n\n // Descriptions of all options available on the demo site:\n // http://lokeshdhakar.com/projects/lightbox2/index.html#options\n Lightbox.defaults = {\n albumLabel: 'Image %1 of %2',\n alwaysShowNavOnTouchDevices: false,\n fadeDuration: 500,\n fitImagesInViewport: true,\n // maxWidth: 800,\n // maxHeight: 600,\n positionFromTop: 50,\n resizeDuration: 700,\n showImageNumberLabel: true,\n wrapAround: false,\n disableScrolling: false\n };\n\n Lightbox.prototype.option = function(options) {\n $.extend(this.options, options);\n };\n\n Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {\n return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);\n };\n\n Lightbox.prototype.init = function() {\n this.enable();\n this.build();\n };\n\n // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes\n // that contain 'lightbox'. When these are clicked, start lightbox.\n Lightbox.prototype.enable = function() {\n var self = this;\n $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {\n self.start($(event.currentTarget));\n return false;\n });\n };\n\n // Build html for the lightbox and the overlay.\n // Attach event handlers to the new DOM elements. click click click\n Lightbox.prototype.build = function() {\n var self = this;\n $('<div id=\"lightboxOverlay\" class=\"lightboxOverlay\"></div><div id=\"lightbox\" class=\"lightbox\"><div class=\"lb-outerContainer\"><div class=\"lb-container\"><img class=\"lb-image\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\" /><div class=\"lb-nav\"><a class=\"lb-prev\" href=\"\" ></a><a class=\"lb-next\" href=\"\" ></a></div><div class=\"lb-loader\"><a class=\"lb-cancel\"></a></div></div></div><div class=\"lb-dataContainer\"><div class=\"lb-data\"><div class=\"lb-details\"><span class=\"lb-caption\"></span><span class=\"lb-number\"></span></div><div class=\"lb-closeContainer\"><a class=\"lb-close\"></a></div></div></div></div>').appendTo($('body'));\n\n // Cache jQuery objects\n this.$lightbox = $('#lightbox');\n this.$overlay = $('#lightboxOverlay');\n this.$outerContainer = this.$lightbox.find('.lb-outerContainer');\n this.$container = this.$lightbox.find('.lb-container');\n\n // Store css values for future lookup\n this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);\n this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);\n this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);\n this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);\n\n // Attach event handlers to the newly minted DOM elements\n this.$overlay.hide().on('click', function() {\n self.end();\n return false;\n });\n\n this.$lightbox.hide().on('click', function(event) {\n if ($(event.target).attr('id') === 'lightbox') {\n self.end();\n }\n return false;\n });\n\n this.$outerContainer.on('click', function(event) {\n if ($(event.target).attr('id') === 'lightbox') {\n self.end();\n }\n return false;\n });\n\n this.$lightbox.find('.lb-prev').on('click', function() {\n if (self.currentImageIndex === 0) {\n self.changeImage(self.album.length - 1);\n } else {\n self.changeImage(self.currentImageIndex - 1);\n }\n return false;\n });\n\n this.$lightbox.find('.lb-next').on('click', function() {\n if (self.currentImageIndex === self.album.length - 1) {\n self.changeImage(0);\n } else {\n self.changeImage(self.currentImageIndex + 1);\n }\n return false;\n });\n\n this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {\n self.end();\n return false;\n });\n };\n\n // Show overlay and lightbox. If the image is part of a set, add siblings to album array.\n Lightbox.prototype.start = function($link) {\n var self = this;\n var $window = $(window);\n\n $window.on('resize', $.proxy(this.sizeOverlay, this));\n\n $('select, object, embed').css({\n visibility: 'hidden'\n });\n\n this.sizeOverlay();\n\n this.album = [];\n var imageNumber = 0;\n\n function addToAlbum($link) {\n self.album.push({\n link: $link.attr('href'),\n title: $link.attr('data-title') || $link.attr('title')\n });\n }\n\n // Support both data-lightbox attribute and rel attribute implementations\n var dataLightboxValue = $link.attr('data-lightbox');\n var $links;\n\n if (dataLightboxValue) {\n $links = $($link.prop('tagName') + '[data-lightbox=\"' + dataLightboxValue + '\"]');\n for (var i = 0; i < $links.length; i = ++i) {\n addToAlbum($($links[i]));\n if ($links[i] === $link[0]) {\n imageNumber = i;\n }\n }\n } else {\n if ($link.attr('rel') === 'lightbox') {\n // If image is not part of a set\n addToAlbum($link);\n } else {\n // If image is part of a set\n $links = $($link.prop('tagName') + '[rel=\"' + $link.attr('rel') + '\"]');\n for (var j = 0; j < $links.length; j = ++j) {\n addToAlbum($($links[j]));\n if ($links[j] === $link[0]) {\n imageNumber = j;\n }\n }\n }\n }\n\n // Position Lightbox\n var top = $window.scrollTop() + this.options.positionFromTop;\n var left = $window.scrollLeft();\n this.$lightbox.css({\n top: top + 'px',\n left: left + 'px'\n }).fadeIn(this.options.fadeDuration);\n\n // Disable scrolling of the page while open\n if (this.options.disableScrolling) {\n $('body').addClass('lb-disable-scrolling');\n }\n\n this.changeImage(imageNumber);\n };\n\n // Hide most UI elements in preparation for the animated resizing of the lightbox.\n Lightbox.prototype.changeImage = function(imageNumber) {\n var self = this;\n\n this.disableKeyboardNav();\n var $image = this.$lightbox.find('.lb-image');\n\n this.$overlay.fadeIn(this.options.fadeDuration);\n\n $('.lb-loader').fadeIn('slow');\n this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();\n\n this.$outerContainer.addClass('animating');\n\n // When image to show is preloaded, we send the width and height to sizeContainer()\n var preloader = new Image();\n preloader.onload = function() {\n var $preloader;\n var imageHeight;\n var imageWidth;\n var maxImageHeight;\n var maxImageWidth;\n var windowHeight;\n var windowWidth;\n\n $image.attr('src', self.album[imageNumber].link);\n\n $preloader = $(preloader);\n\n $image.width(preloader.width);\n $image.height(preloader.height);\n\n if (self.options.fitImagesInViewport) {\n // Fit image inside the viewport.\n // Take into account the border around the image and an additional 10px gutter on each side.\n\n windowWidth = $(window).width();\n windowHeight = $(window).height();\n maxImageWidth = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;\n maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;\n\n // Check if image size is larger then maxWidth|maxHeight in settings\n if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {\n maxImageWidth = self.options.maxWidth;\n }\n if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {\n maxImageHeight = self.options.maxHeight;\n }\n\n // Is there a fitting issue?\n if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {\n if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {\n imageWidth = maxImageWidth;\n imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);\n $image.width(imageWidth);\n $image.height(imageHeight);\n } else {\n imageHeight = maxImageHeight;\n imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);\n $image.width(imageWidth);\n $image.height(imageHeight);\n }\n }\n }\n self.sizeContainer($image.width(), $image.height());\n };\n\n preloader.src = this.album[imageNumber].link;\n this.currentImageIndex = imageNumber;\n };\n\n // Stretch overlay to fit the viewport\n Lightbox.prototype.sizeOverlay = function() {\n this.$overlay\n .width($(document).width())\n .height($(document).height());\n };\n\n // Animate the size of the lightbox to fit the image we are showing\n Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {\n var self = this;\n\n var oldWidth = this.$outerContainer.outerWidth();\n var oldHeight = this.$outerContainer.outerHeight();\n var newWidth = imageWidth + this.containerLeftPadding + this.containerRightPadding;\n var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;\n\n function postResize() {\n self.$lightbox.find('.lb-dataContainer').width(newWidth);\n self.$lightbox.find('.lb-prevLink').height(newHeight);\n self.$lightbox.find('.lb-nextLink').height(newHeight);\n self.showImage();\n }\n\n if (oldWidth !== newWidth || oldHeight !== newHeight) {\n this.$outerContainer.animate({\n width: newWidth,\n height: newHeight\n }, this.options.resizeDuration, 'swing', function() {\n postResize();\n });\n } else {\n postResize();\n }\n };\n\n // Display the image and its details and begin preload neighboring images.\n Lightbox.prototype.showImage = function() {\n this.$lightbox.find('.lb-loader').stop(true).hide();\n this.$lightbox.find('.lb-image').fadeIn('slow');\n\n this.updateNav();\n this.updateDetails();\n this.preloadNeighboringImages();\n this.enableKeyboardNav();\n };\n\n // Display previous and next navigation if appropriate.\n Lightbox.prototype.updateNav = function() {\n // Check to see if the browser supports touch events. If so, we take the conservative approach\n // and assume that mouse hover events are not supported and always show prev/next navigation\n // arrows in image sets.\n var alwaysShowNav = false;\n try {\n document.createEvent('TouchEvent');\n alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;\n } catch (e) {}\n\n this.$lightbox.find('.lb-nav').show();\n\n if (this.album.length > 1) {\n if (this.options.wrapAround) {\n if (alwaysShowNav) {\n this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');\n }\n this.$lightbox.find('.lb-prev, .lb-next').show();\n } else {\n if (this.currentImageIndex > 0) {\n this.$lightbox.find('.lb-prev').show();\n if (alwaysShowNav) {\n this.$lightbox.find('.lb-prev').css('opacity', '1');\n }\n }\n if (this.currentImageIndex < this.album.length - 1) {\n this.$lightbox.find('.lb-next').show();\n if (alwaysShowNav) {\n this.$lightbox.find('.lb-next').css('opacity', '1');\n }\n }\n }\n }\n };\n\n // Display caption, image number, and closing button.\n Lightbox.prototype.updateDetails = function() {\n var self = this;\n\n // Enable anchor clicks in the injected caption html.\n // Thanks Nate Wright for the fix. @https://github.com/NateWr\n if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&\n this.album[this.currentImageIndex].title !== '') {\n this.$lightbox.find('.lb-caption')\n .html(this.album[this.currentImageIndex].title)\n .fadeIn('fast')\n .find('a').on('click', function(event) {\n if ($(this).attr('target') !== undefined) {\n window.open($(this).attr('href'), $(this).attr('target'));\n } else {\n location.href = $(this).attr('href');\n }\n });\n }\n\n if (this.album.length > 1 && this.options.showImageNumberLabel) {\n var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);\n this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');\n } else {\n this.$lightbox.find('.lb-number').hide();\n }\n\n this.$outerContainer.removeClass('animating');\n\n this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {\n return self.sizeOverlay();\n });\n };\n\n // Preload previous and next images in set.\n Lightbox.prototype.preloadNeighboringImages = function() {\n if (this.album.length > this.currentImageIndex + 1) {\n var preloadNext = new Image();\n preloadNext.src = this.album[this.currentImageIndex + 1].link;\n }\n if (this.currentImageIndex > 0) {\n var preloadPrev = new Image();\n preloadPrev.src = this.album[this.currentImageIndex - 1].link;\n }\n };\n\n Lightbox.prototype.enableKeyboardNav = function() {\n $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));\n };\n\n Lightbox.prototype.disableKeyboardNav = function() {\n $(document).off('.keyboard');\n };\n\n Lightbox.prototype.keyboardAction = function(event) {\n var KEYCODE_ESC = 27;\n var KEYCODE_LEFTARROW = 37;\n var KEYCODE_RIGHTARROW = 39;\n\n var keycode = event.keyCode;\n var key = String.fromCharCode(keycode).toLowerCase();\n if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {\n this.end();\n } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {\n if (this.currentImageIndex !== 0) {\n this.changeImage(this.currentImageIndex - 1);\n } else if (this.options.wrapAround && this.album.length > 1) {\n this.changeImage(this.album.length - 1);\n }\n } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {\n if (this.currentImageIndex !== this.album.length - 1) {\n this.changeImage(this.currentImageIndex + 1);\n } else if (this.options.wrapAround && this.album.length > 1) {\n this.changeImage(0);\n }\n }\n };\n\n // Closing time. :-(\n Lightbox.prototype.end = function() {\n this.disableKeyboardNav();\n $(window).off('resize', this.sizeOverlay);\n this.$lightbox.fadeOut(this.options.fadeDuration);\n this.$overlay.fadeOut(this.options.fadeDuration);\n $('select, object, embed').css({\n visibility: 'visible'\n });\n if (this.options.disableScrolling) {\n $('body').removeClass('lb-disable-scrolling');\n }\n };\n\n return new Lightbox();\n}));\n"],"sourceRoot":"/source/"}