Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/vendor
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-07-25 22:44:23 +0300
committerOlivier Paroz <github@oparoz.com>2015-07-25 22:44:23 +0300
commit49131955ff7e0c466ee00178cd7650aa3e4e7ac5 (patch)
tree2c8d318c8e6e0c9222964b9fe41f68f57ff9e5b8 /js/vendor
parent1be509d847380f49c6c2052f937c25b1c5d7ff6a (diff)
Support IE8 in the slideshow
Diffstat (limited to 'js/vendor')
-rw-r--r--js/vendor/image-scale/LICENSE20
-rw-r--r--js/vendor/image-scale/README.md210
-rw-r--r--js/vendor/image-scale/image-scale.js512
-rw-r--r--js/vendor/image-scale/image-scale.min.js10
4 files changed, 752 insertions, 0 deletions
diff --git a/js/vendor/image-scale/LICENSE b/js/vendor/image-scale/LICENSE
new file mode 100644
index 00000000..b3908ae8
--- /dev/null
+++ b/js/vendor/image-scale/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2013 GestiXi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/js/vendor/image-scale/README.md b/js/vendor/image-scale/README.md
new file mode 100644
index 00000000..304ab691
--- /dev/null
+++ b/js/vendor/image-scale/README.md
@@ -0,0 +1,210 @@
+Image Scale
+===========
+
+**Scale images to fit or fill any target container via two simple properties: scale and align.**
+
+*This plugin is greatly inspired from Sproutcore SC.ImageView.*
+
+------
+
+## Installation
+
+image-scale depends on jQuery. To use it, include this in your page :
+
+ <script src="jquery.js" type="text/javascript"></script>
+ <script src="image-scale.js" type="text/javascript"></script>
+
+------
+
+## Usage
+
+If you want to identify the images that you want to scale, you can add a class to them. In this example we are adding a class call `scale`.
+
+You can also set the `data-scale` and `data-align` attributes directly to the images if you want to override the default setting.
+
+ <div class="image-container">
+ <img class="scale" data-scale="best-fit-down" data-align="center" src="img/example.jpg">
+ </div>
+
+Now add this JavaScript code to your page :
+
+ $(function() {
+ $("img.scale").imageScale();
+ });
+
+You're done.
+
+------
+
+## Properties
+
+
+### scale
+
+Determines how the image will scale to fit within its containing space. Possible values:
+
+* **fill** - stretches or compresses the source image to fill the target frame
+* **best-fill** - fits the shortest side of the source image within the target frame while maintaining the original aspect ratio
+* **best-fit** - fits the longest edge of the source image within the target frame while maintaining the original aspect ratio
+* **best-fit-down** - same as *best-fit* but will not stretch the source if it is smaller than the target
+* **none** - the source image is left unscaled
+
+<!-- -->
+
+ Type: String
+ Default: best-fill
+
+
+### align
+
+Align the image within its frame. Possible values:
+
+* **left**
+* **right**
+* **center**
+* **top**
+* **bottom**
+* **top-left**
+* **top-right**
+* **bottom-left**
+* **bottom-right**
+
+<!-- -->
+
+ Type: String
+ Default: center
+
+
+### parent
+
+A jQuery Object against which the image size will be calculated.
+If null, the parent of the image will be used.
+
+ Type: jQuery Object
+ Default: null
+
+
+### hideParentOverflow
+
+A boolean determining if the parent should hide its overflow.
+
+ Type: Boolean
+ Default: true
+
+
+### fadeInDuration
+
+A duration in milliseconds determining how long the fadeIn animation
+will run when your image is scale for the firstTime.
+
+Set it to 0 if you don't want any animation.
+
+ Type: Number or String
+ Default: 0
+
+
+### rescaleOnResize
+
+A boolean indicating if the image size should be rescaled when the window is resized.
+
+The window size is checked using requestAnimationFrame for good performance.
+
+ Type: Boolean
+ Default: false
+
+
+### didScale
+
+A function that will be call each time the receiver is scaled.
+
+Example:
+
+ $images.imageScale({
+ didScale: function(firstTime, options) {
+ console.log('did scale img: ', this.element);
+ }
+ });
+
+<!-- -->
+
+ Type: Function
+ Parameters:
+ - firstTime {Boolean} true if the image was scale for the first time.
+ - options {Object} the options passed to the scale method.
+
+
+### debug
+
+A number indicating the debug level :
+
+0. silent
+1. error
+2. error & warning
+3. error & warning & notice
+
+<!-- -->
+
+ Type: Number
+ Default: 0
+
+------
+
+## Methods
+
+
+### scale
+
+Main method. Used to scale the images.
+
+When `rescaleOnResize` is set to true, this method is executed each time the
+windows size changes.
+
+If `rescaleOnResize` is set to false, you may want to call it manually. Here is an
+example on how you should do it:
+
+ $image.imageScale('scale');
+
+
+### destroy
+
+Removes the data for the element.
+
+Here is an example on how you can call the destroy method:
+
+ $image.imageScale('destroy');
+
+
+------
+
+## Demo
+
+See it in action on our [home page](https://www.gestixi.com).
+
+
+You can also check out the Sproutcore [Automatic Image Scaling demo](http://showcase.sproutcore.com/#demos/Automatic%20Image%20Scaling) to understand the difference between all the different options.
+
+
+------
+
+## Size
+
+Original Size: 3.91KB gzipped (13.99KB uncompressed)
+
+Compiled Size: **1.8KB gzipped** (4.42KB uncompressed)
+
+
+------
+
+## Author
+
+**Nicolas Badia**
+
++ [https://twitter.com/@nicolas_badia](https://twitter.com/@nicolas_badia)
++ [https://github.com/nicolasbadia](https://github.com/nicolasbadia)
+
+
+------
+
+## Copyright and license
+
+Copyright 2013-2015 GestiXi under [The MIT License (MIT)](LICENSE). \ No newline at end of file
diff --git a/js/vendor/image-scale/image-scale.js b/js/vendor/image-scale/image-scale.js
new file mode 100644
index 00000000..3934d35c
--- /dev/null
+++ b/js/vendor/image-scale/image-scale.js
@@ -0,0 +1,512 @@
+// ==========================================================================
+// Project: Image Scale
+// Description: Scale images to fit or fill any target size via two simple properties: scale and align.
+// Copyright: ©2012-2015 GestiXi
+// License: Licensed under the MIT license (see LICENCE)
+// Version: 2.1
+// Author: Nicolas BADIA
+// ==========================================================================
+
+! function($) {
+ "use strict";
+
+ // ..........................................................
+ // IMAGE SCALE PLUGIN DEFINITION
+ //
+
+ $.fn.imageScale = function(options) {
+
+ return this.each(function() {
+ var that = this,
+ $this = $(this),
+ data = $this.data('imageScale'),
+ $img = this.tagName === 'IMG' ? $this : $this.find("img");
+
+ if (!data) {
+ var didLoad = $img[0].complete,
+ formattedOpt = $.extend({}, $.fn.imageScale.defaults, typeof options == 'object' && options),
+
+ loadFunc = function() {
+ $this.data('imageScale', (data = new ImageScale(that, formattedOpt)));
+
+ data.scale(true, formattedOpt);
+ };
+
+ if (didLoad) {
+ loadFunc.apply($this[0]);
+ } else {
+ $img.on("load", loadFunc).attr("src", $img.attr("src"));
+ }
+ } else {
+ if (typeof options == 'string') data[options]();
+ else if (typeof options == 'object') {
+ var method = options.method || 'scale';
+ data[method](false, options);
+ } else data.scale();
+ }
+ })
+ }
+
+ $.fn.imageScale.defaults = {
+ /**
+ Determines how the image will scale to fit within its containing space. Possible values:
+
+ * **fill** - stretches or compresses the source image to fill the target frame
+ * **best-fill** - fits the shortest side of the source image within the target frame while maintaining the original aspect ratio
+ * **best-fit** - fits the longest edge of the source image within the target frame while maintaining the original aspect ratio
+ * **best-fit-down** - same as *best-fit* but will not stretch the source if it is smaller than the target
+ * **none** - the source image is left unscaled
+
+ @type String
+ @default best-fill
+ @since Version 1.2
+ */
+ scale: 'best-fill',
+
+ /**
+ Align the image within its frame. Possible values:
+
+ * **left**
+ * **right**
+ * **center**
+ * **top**
+ * **bottom**
+ * **top-left**
+ * **top-right**
+ * **bottom-left**
+ * **bottom-right**
+
+ @type String
+ @default center
+ @since Version 1.2
+ */
+ align: 'center',
+
+ /**
+ A jQuery Object against which the image size will be calculated.
+ If null, the parent of the image will be used.
+
+ @type jQuery Object
+ @default null
+ @since Version 1.0
+ */
+ parent: null,
+
+ /**
+ A boolean determining if the parent should hide its overflow.
+
+ @type Boolean
+ @default true
+ @since Version 1.0
+ */
+ hideParentOverflow: true,
+
+ /**
+ A duration in milliseconds determining how long the fadeIn animation will run when your image is scale for the firstTime.
+
+ Set it to 0 if you don't want any animation.
+
+ @type Number|String
+ @default 0
+ @since Version 1.1
+ */
+ fadeInDuration: 0,
+
+ /**
+ A boolean indicating if the image size should be rescaled when the window is resized.
+
+ The window size is checked using requestAnimationFrame for good performance.
+
+ @type Boolean
+ @default false
+ @since Version 1.0
+ */
+ rescaleOnResize: false,
+
+ /**
+ A function that will be call each time the receiver is scaled.
+
+ Example:
+
+ $images.imageScale({
+ didScale: function() {
+ console.log('did scale img: ', this.element);
+ }
+ });
+
+ @type Function
+ @param firstTime {Boolean} true if the image was scale for the first time.
+ @param options {Object} the options passed to the scale method.
+ @since Version 2.0
+ */
+ didScale: function(firstTime, options) {},
+
+ /**
+ A number indicating the log level :
+
+ 0: silent
+ 1: error
+ 2: error & warning
+ 3: error & warning & notice
+
+ @type Number
+ @default 0
+ @since Version 1.0
+ */
+ logLevel: 0
+ }
+
+ // ..........................................................
+ // IMAGE SCALE PUBLIC CLASS DEFINITION
+ //
+
+ var ImageScale = function(element, options) {
+ var that = this;
+ that.options = options;
+ that.element = element;
+
+ var $element = that.$element = $(element),
+ $img = that.$img = element.tagName === 'IMG' ? $element : $element.find("img"),
+ img = that.img = $img[0];
+
+ that.src = $img.attr('src');
+
+ that.imgWidth = img.naturalWidth || img.width;
+ that.imgHeight = img.naturalHeight || img.height;
+
+ var $parent = that.$parent = options.parent ? options.parent : $($element.parent()[0]);
+ that.parent = $parent[0];
+
+ // Fixes: https://github.com/gestixi/image-scale/issues/1
+ if ($parent.css('position') === 'static') {
+ $parent.css('position', 'relative');
+ }
+
+ if (options.rescaleOnResize) {
+ $(window).resize(function(e) {
+ that.scheduleScale();
+ });
+ }
+ }
+
+ $.fn.imageScale.Constructor = ImageScale;
+
+ ImageScale.prototype = {
+
+ NONE: "none",
+ FILL: "fill",
+ BEST_FILL: "best-fill",
+ BEST_FIT: "best-fit",
+ BEST_FIT_DOWN_ONLY: "best-fit-down",
+
+ ALIGN_LEFT: 'left',
+ ALIGN_RIGHT: 'right',
+ ALIGN_CENTER: 'center',
+ ALIGN_TOP: 'top',
+ ALIGN_BOTTOM: 'bottom',
+ ALIGN_TOP_LEFT: 'top-left',
+ ALIGN_TOP_RIGHT: 'top-right',
+ ALIGN_BOTTOM_LEFT: 'bottom-left',
+ ALIGN_BOTTOM_RIGHT: 'bottom-right',
+
+ constructor: ImageScale,
+
+ /**
+ The initial element.
+
+ @type DOM Element
+ */
+ element: null,
+
+ /**
+ The passed options.
+
+ @type Object
+ */
+ options: null,
+
+ /**
+ Main method. Used to scale the images.
+
+ When `rescaleOnResize` is set to true, this method is executed each time the
+ windows size changes.
+
+ If `rescaleOnResize` is set to false, you may want to call it manually. Here is an
+ example on how you should do it:
+
+ $image.imageScale('scale');
+
+
+ @param {Boolean} firstTime
+ */
+ scale: function(firstTime, opt) {
+ if (this._isDestroyed || this._canScale === false) return;
+
+ var that = this,
+ options = this.options,
+ $parent = this.$parent,
+ element = this.element,
+ $element = this.$element,
+ img = this.img,
+ $img = this.$img;
+
+ if (firstTime) {
+ if (options.hideParentOverflow) {
+ $parent.css({
+ overflow: 'hidden'
+ });
+ }
+ } else {
+ // If the source of the image has changed
+ if (this.src !== $img.attr('src')) {
+ this.destroy();
+ $element.data('imageScale', null);
+ $element.imageScale(options);
+ return;
+ }
+ }
+
+ this._didScheduleScale = false;
+
+ if (options.rescaleOnResize && !opt) {
+ if (!this._needUpdate(this.parent)) return;
+ }
+ opt = opt ? opt : {};
+
+ var transition = opt.transition;
+ if (transition) {
+ this._canScale = false;
+ $element.css('transition', 'all ' + transition + 'ms');
+
+ setTimeout(function() {
+ that._canScale = null;
+ $element.css('transition', 'null');
+ }, transition);
+ }
+
+ var destWidth = opt.destWidth ? opt.destWidth : $parent.outerWidth(),
+ destHeight = opt.destHeight ? opt.destHeight : $parent.outerHeight(),
+
+ destInnerWidth = opt.destWidth ? opt.destWidth : $parent.innerWidth(),
+ destInnerHeight = opt.destHeight ? opt.destHeight : $parent.innerHeight(),
+
+ widthOffset = destWidth - destInnerWidth,
+ heightOffset = destHeight - destInnerHeight,
+
+ scaleData = $element.attr('data-scale'),
+ alignData = $element.attr('data-align'),
+
+ scale = scaleData ? scaleData : options.scale,
+ align = alignData ? alignData : options.align,
+
+ fadeInDuration = options.fadeInDuration;
+
+ if (!scale) {
+ if (options.logLevel > 2) {
+ console.log("imageScale - DEBUG NOTICE: The scale property is null.", element);
+ }
+ return;
+ }
+
+ if (this._cacheDestWidth === destWidth && this._cacheDestHeight === destHeight) {
+ if (options.logLevel > 2) {
+ console.log("imageScale - DEBUG NOTICE: The parent size hasn't changed: dest width: '" + destWidth + "' - dest height: '" + destHeight + "'.", element);
+ }
+ }
+
+ var sourceWidth = this.imgWidth,
+ sourceHeight = this.imgHeight;
+
+ if (!(destWidth && destHeight && sourceWidth && sourceHeight)) {
+ if (options.logLevel > 0) {
+ console.error("imageScale - DEBUG ERROR: The dimensions are incorrect: source width: '" + sourceWidth + "' - source height: '" + sourceHeight + "' - dest width: '" + destWidth + "' - dest height: '" + destHeight + "'.", element);
+ }
+ return;
+ }
+
+ this._cacheDestWidth = destWidth;
+ this._cacheDestHeight = destHeight;
+
+ var layout = this._innerFrameForSize(scale, align, sourceWidth, sourceHeight, destWidth, destHeight);
+
+ if (widthOffset) layout.x -= widthOffset / 2;
+ if (heightOffset) layout.y -= heightOffset / 2;
+
+ $element.css({
+ position: 'absolute',
+ top: layout.y + 'px',
+ left: layout.x + 'px',
+ width: layout.width + 'px',
+ height: layout.height + 'px',
+ 'max-width': 'none'
+ });
+
+ if (firstTime && fadeInDuration) {
+ $element.css({
+ display: 'none'
+ });
+ $element.fadeIn(fadeInDuration);
+ }
+
+ options.didScale.call(this, firstTime, opt);
+ },
+
+ /**
+ Removes the data for the element.
+
+ Here is an example on how you can call the destroy method:
+
+ $image.imageScale('destroy');
+
+ */
+ destroy: function() {
+ this._isDestroyed = true;
+ this.$element.removeData('imageScale');
+ },
+
+ /**
+ @private
+
+ Returns a frame (x, y, width, height) fitting the source size (sourceWidth & sourceHeight) within the
+ destination size (destWidth & destHeight) according to the align and scale properties.
+
+ @param {String} scale
+ @param {String} align
+ @param {Number} sourceWidth
+ @param {Number} sourceHeight
+ @param {Number} destWidth
+ @param {Number} destHeight
+ @returns {Object} the inner frame with properties: { x: value, y: value, width: value, height: value }
+ */
+ _innerFrameForSize: function(scale, align, sourceWidth, sourceHeight, destWidth, destHeight) {
+ var scaleX,
+ scaleY,
+ result;
+
+ // Fast path
+ result = {
+ x: 0,
+ y: 0,
+ width: destWidth,
+ height: destHeight
+ };
+ if (scale === this.FILL) return result;
+
+ // Determine the appropriate scale
+ scaleX = destWidth / sourceWidth;
+ scaleY = destHeight / sourceHeight;
+
+ switch (scale) {
+ case this.BEST_FIT_DOWN_ONLY:
+ if (scale !== this.BEST_FIT_DOWN_ONLY && this.options.logLevel > 1) {
+ console.warn("imageScale - DEBUG WARNING: The scale '" + scale + "' was not understood.");
+ }
+
+ if ((sourceWidth > destWidth) || (sourceHeight > destHeight)) {
+ scale = scaleX < scaleY ? scaleX : scaleY;
+ } else {
+ scale = 1.0;
+ }
+ break;
+ case this.BEST_FIT:
+ scale = scaleX < scaleY ? scaleX : scaleY;
+ break;
+ case this.NONE:
+ scale = 1.0;
+ break;
+ //case this.BEST_FILL:
+ default:
+ scale = scaleX > scaleY ? scaleX : scaleY;
+ break;
+ }
+
+ sourceWidth *= scale;
+ sourceHeight *= scale;
+ result.width = Math.round(sourceWidth);
+ result.height = Math.round(sourceHeight);
+
+ // Align the image within its frame
+ switch (align) {
+ case this.ALIGN_LEFT:
+ result.x = 0;
+ result.y = (destHeight / 2) - (sourceHeight / 2);
+ break;
+ case this.ALIGN_RIGHT:
+ result.x = destWidth - sourceWidth;
+ result.y = (destHeight / 2) - (sourceHeight / 2);
+ break;
+ case this.ALIGN_TOP:
+ result.x = (destWidth / 2) - (sourceWidth / 2);
+ result.y = 0;
+ break;
+ case this.ALIGN_BOTTOM:
+ result.x = (destWidth / 2) - (sourceWidth / 2);
+ result.y = destHeight - sourceHeight;
+ break;
+ case this.ALIGN_TOP_LEFT:
+ result.x = 0;
+ result.y = 0;
+ break;
+ case this.ALIGN_TOP_RIGHT:
+ result.x = destWidth - sourceWidth;
+ result.y = 0;
+ break;
+ case this.ALIGN_BOTTOM_LEFT:
+ result.x = 0;
+ result.y = destHeight - sourceHeight;
+ break;
+ case this.ALIGN_BOTTOM_RIGHT:
+ result.x = destWidth - sourceWidth;
+ result.y = destHeight - sourceHeight;
+ break;
+ default: // this.ALIGN_CENTER
+ if (align !== this.ALIGN_CENTER && this.options.logLevel > 1) {
+ console.warn("imageScale - DEBUG WARNING: The align '" + align + "' was not understood.");
+ }
+ result.x = (destWidth / 2) - (sourceWidth / 2);
+ result.y = (destHeight / 2) - (sourceHeight / 2);
+ }
+
+ return result;
+ },
+
+ /**
+ @private
+
+ Determines if the windows size has changed since the last update.
+
+ @returns {Boolean}
+ */
+ _needUpdate: function(parent) {
+ var size = parent.clientHeight + ' ' + parent.clientWidth;
+
+ if (this._lastParentSize !== size) {
+ this._lastParentSize = size;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ @private
+
+ Schedule a scale update.
+ */
+ scheduleScale: function() {
+ if (this._didScheduleScale) return;
+
+ if (window.requestAnimationFrame) {
+ var that = this;
+ this._didScheduleScale = true;
+ // setTimeout important when resizing down if the scrollbar were visible
+ requestAnimationFrame(function() {
+ setTimeout(function() {
+ that.scale();
+ }, 0);
+ });
+ } else {
+ this.scale();
+ }
+ }
+ }
+}(window.jQuery); \ No newline at end of file
diff --git a/js/vendor/image-scale/image-scale.min.js b/js/vendor/image-scale/image-scale.min.js
new file mode 100644
index 00000000..b4c6b40d
--- /dev/null
+++ b/js/vendor/image-scale/image-scale.min.js
@@ -0,0 +1,10 @@
+/*! image-scale v2.1 | ©2012-2013 Nicolas BADIA | Licensed under the MIT license */
+!function(l){l.fn.imageScale=function(b){return this.each(function(){var f=this,c=l(this),a=c.data("imageScale"),g="IMG"===this.tagName?c:c.find("img");if(a)if("string"==typeof b)a[b]();else if("object"==typeof b)a[b.method||"scale"](!1,b);else a.scale();else{var e=g[0].complete,k=l.extend({},l.fn.imageScale.defaults,"object"==typeof b&&b),h=function(){c.data("imageScale",a=new n(f,k));a.scale(!0,k)};e?h.apply(c[0]):g.on("load",h).attr("src",g.attr("src"))}})};l.fn.imageScale.defaults={scale:"best-fill",
+align:"center",parent:null,hideParentOverflow:!0,fadeInDuration:0,rescaleOnResize:!1,didScale:function(b,f){},logLevel:0};var n=function(b,f){var c=this;c.options=f;c.element=b;var a=c.$element=l(b),g=c.$img="IMG"===b.tagName?a:a.find("img"),e=c.img=g[0];c.src=g.attr("src");c.imgWidth=e.naturalWidth||e.width;c.imgHeight=e.naturalHeight||e.height;a=c.$parent=f.parent?f.parent:l(a.parent()[0]);c.parent=a[0];"static"===a.css("position")&&a.css("position","relative");f.rescaleOnResize&&l(window).resize(function(a){c.scheduleScale()})};
+l.fn.imageScale.Constructor=n;n.prototype={NONE:"none",FILL:"fill",BEST_FILL:"best-fill",BEST_FIT:"best-fit",BEST_FIT_DOWN_ONLY:"best-fit-down",ALIGN_LEFT:"left",ALIGN_RIGHT:"right",ALIGN_CENTER:"center",ALIGN_TOP:"top",ALIGN_BOTTOM:"bottom",ALIGN_TOP_LEFT:"top-left",ALIGN_TOP_RIGHT:"top-right",ALIGN_BOTTOM_LEFT:"bottom-left",ALIGN_BOTTOM_RIGHT:"bottom-right",constructor:n,element:null,options:null,scale:function(b,f){if(!this._isDestroyed&&!1!==this._canScale){var c=this,a=this.options,g=this.$parent,
+e=this.element,k=this.$element,h=this.$img;if(b)a.hideParentOverflow&&g.css({overflow:"hidden"});else if(this.src!==h.attr("src")){this.destroy();k.data("imageScale",null);k.imageScale(a);return}this._didScheduleScale=!1;if(!a.rescaleOnResize||f||this._needUpdate(this.parent)){f=f?f:{};if(h=f.transition)this._canScale=!1,k.css("transition","all "+h+"ms"),setTimeout(function(){c._canScale=null;k.css("transition","null")},h);var h=f.destWidth?f.destWidth:g.outerWidth(),d=f.destHeight?f.destHeight:g.outerHeight(),
+l=f.destWidth?f.destWidth:g.innerWidth(),m=f.destHeight?f.destHeight:g.innerHeight(),g=h-l,l=d-m,m=k.attr("data-scale"),p=k.attr("data-align"),m=m?m:a.scale,n=p?p:a.align,p=a.fadeInDuration;if(m){this._cacheDestWidth===h&&this._cacheDestHeight===d&&2<a.logLevel&&console.log("imageScale - DEBUG NOTICE: The parent size hasn't changed: dest width: '"+h+"' - dest height: '"+d+"'.",e);var q=this.imgWidth,r=this.imgHeight;h&&d&&q&&r?(this._cacheDestWidth=h,this._cacheDestHeight=d,e=this._innerFrameForSize(m,
+n,q,r,h,d),g&&(e.x-=g/2),l&&(e.y-=l/2),k.css({position:"absolute",top:e.y+"px",left:e.x+"px",width:e.width+"px",height:e.height+"px","max-width":"none"}),b&&p&&(k.css({display:"none"}),k.fadeIn(p)),a.didScale.call(this,b,f)):0<a.logLevel&&console.error("imageScale - DEBUG ERROR: The dimensions are incorrect: source width: '"+q+"' - source height: '"+r+"' - dest width: '"+h+"' - dest height: '"+d+"'.",e)}else 2<a.logLevel&&console.log("imageScale - DEBUG NOTICE: The scale property is null.",e)}}},
+destroy:function(){this._isDestroyed=!0;this.$element.removeData("imageScale")},_innerFrameForSize:function(b,f,c,a,g,e){var k,h,d;d={x:0,y:0,width:g,height:e};if(b===this.FILL)return d;k=g/c;h=e/a;switch(b){case this.BEST_FIT_DOWN_ONLY:b!==this.BEST_FIT_DOWN_ONLY&&1<this.options.logLevel&&console.warn("imageScale - DEBUG WARNING: The scale '"+b+"' was not understood.");b=c>g||a>e?k<h?k:h:1;break;case this.BEST_FIT:b=k<h?k:h;break;case this.NONE:b=1;break;default:b=k>h?k:h}c*=b;a*=b;d.width=Math.round(c);
+d.height=Math.round(a);switch(f){case this.ALIGN_LEFT:d.x=0;d.y=e/2-a/2;break;case this.ALIGN_RIGHT:d.x=g-c;d.y=e/2-a/2;break;case this.ALIGN_TOP:d.x=g/2-c/2;d.y=0;break;case this.ALIGN_BOTTOM:d.x=g/2-c/2;d.y=e-a;break;case this.ALIGN_TOP_LEFT:d.x=0;d.y=0;break;case this.ALIGN_TOP_RIGHT:d.x=g-c;d.y=0;break;case this.ALIGN_BOTTOM_LEFT:d.x=0;d.y=e-a;break;case this.ALIGN_BOTTOM_RIGHT:d.x=g-c;d.y=e-a;break;default:f!==this.ALIGN_CENTER&&1<this.options.logLevel&&console.warn("imageScale - DEBUG WARNING: The align '"+
+f+"' was not understood."),d.x=g/2-c/2,d.y=e/2-a/2}return d},_needUpdate:function(b){b=b.clientHeight+" "+b.clientWidth;return this._lastParentSize!==b?(this._lastParentSize=b,!0):!1},scheduleScale:function(){if(!this._didScheduleScale)if(window.requestAnimationFrame){var b=this;this._didScheduleScale=!0;requestAnimationFrame(function(){setTimeout(function(){b.scale()},0)})}else this.scale()}}}(window.jQuery); \ No newline at end of file