diff options
Diffstat (limited to '')
-rw-r--r-- | themes/default/js/ui/jquery.ui.resizable.js (renamed from themes/default/js/ui/ui.resizable.js) | 134 |
1 files changed, 73 insertions, 61 deletions
diff --git a/themes/default/js/ui/ui.resizable.js b/themes/default/js/ui/jquery.ui.resizable.js index 6172d6cb8..d9d27627b 100644 --- a/themes/default/js/ui/ui.resizable.js +++ b/themes/default/js/ui/jquery.ui.resizable.js @@ -1,20 +1,40 @@ /* - * jQuery UI Resizable 1.7.2 + * jQuery UI Resizable 1.8.9 * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Resizables * * Depends: - * ui.core.js + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js */ -(function($) { +(function( $, undefined ) { -$.widget("ui.resizable", $.extend({}, $.ui.mouse, { - - _init: function() { +$.widget("ui.resizable", $.ui.mouse, { + widgetEventPrefix: "resize", + options: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + containment: false, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + zIndex: 1000 + }, + _create: function() { var self = this, o = this.options; this.element.addClass("ui-resizable"); @@ -185,7 +205,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { if (this.elementIsWrapper) { _destroy(this.element); var wrapper = this.element; - wrapper.parent().append( + wrapper.after( this.originalElement.css({ position: wrapper.css('position'), width: wrapper.outerWidth(), @@ -193,23 +213,24 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { top: wrapper.css('top'), left: wrapper.css('left') }) - ).end().remove(); + ).remove(); } this.originalElement.css('resize', this.originalResizeStyle); _destroy(this.originalElement); + return this; }, _mouseCapture: function(event) { - var handle = false; - for(var i in this.handles) { - if($(this.handles[i])[0] == event.target) handle = true; + for (var i in this.handles) { + if ($(this.handles[i])[0] == event.target) { + handle = true; + } } - return this.options.disabled || !!handle; - + return !this.options.disabled && handle; }, _mouseStart: function(event) { @@ -495,32 +516,10 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { }; } -})); +}); $.extend($.ui.resizable, { - version: "1.7.2", - eventPrefix: "resize", - defaults: { - alsoResize: false, - animate: false, - animateDuration: "slow", - animateEasing: "swing", - aspectRatio: false, - autoHide: false, - cancel: ":input,option", - containment: false, - delay: 0, - distance: 1, - ghost: false, - grid: false, - handles: "e,s,se", - helper: false, - maxHeight: null, - maxWidth: null, - minHeight: 10, - minWidth: 10, - zIndex: 1000 - } + version: "1.8.9" }); /* @@ -529,28 +528,29 @@ $.extend($.ui.resizable, { $.ui.plugin.add("resizable", "alsoResize", { - start: function(event, ui) { - + start: function (event, ui) { var self = $(this).data("resizable"), o = self.options; - _store = function(exp) { + var _store = function (exp) { $(exp).each(function() { - $(this).data("resizable-alsoresize", { - width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10), - left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) + var el = $(this); + el.data("resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10), + position: el.css('position') // to reset Opera on stop() }); }); }; if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } - else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } }else{ _store(o.alsoResize); } }, - resize: function(event, ui){ + resize: function (event, ui) { var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; var delta = { @@ -558,18 +558,19 @@ $.ui.plugin.add("resizable", "alsoResize", { top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 }, - _alsoResize = function(exp, c) { + _alsoResize = function (exp, c) { $(exp).each(function() { - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; - $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { + $.each(css, function (i, prop) { var sum = (start[prop]||0) + (delta[prop]||0); if (sum && sum >= 0) style[prop] = sum || null; }); - //Opera fixing relative position - if (/relative/.test(el.css('position')) && $.browser.opera) { + // Opera fixing relative position + if ($.browser.opera && /relative/.test(el.css('position'))) { self._revertToRelativePosition = true; el.css({ position: 'absolute', top: 'auto', left: 'auto' }); } @@ -579,22 +580,33 @@ $.ui.plugin.add("resizable", "alsoResize", { }; if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); }else{ _alsoResize(o.alsoResize); } }, - stop: function(event, ui){ - var self = $(this).data("resizable"); + stop: function (event, ui) { + var self = $(this).data("resizable"), o = self.options; - //Opera fixing relative position - if (self._revertToRelativePosition && $.browser.opera) { + var _reset = function (exp) { + $(exp).each(function() { + var el = $(this); + // reset position for Opera - no need to verify it was changed + el.css({ position: el.data("resizable-alsoresize").position }); + }); + }; + + if (self._revertToRelativePosition) { self._revertToRelativePosition = false; - el.css({ position: 'relative' }); + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp) { _reset(exp); }); + }else{ + _reset(o.alsoResize); + } } - $(this).removeData("resizable-alsoresize-start"); + $(this).removeData("resizable-alsoresize"); } }); |