aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.resizable.js
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2009-01-16 02:09:45 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2009-01-16 02:09:45 +0000
commit8139c81d1b3521c8b8406a3c069c1c8829b05abe (patch)
tree1b1a3d259e4521916f7ec4d510ff5201f43d5ea7 /ui/ui.resizable.js
parent78c4d87d7b2f9f8ece53f062eb44cabf9dd51bf3 (diff)
downloadjquery-ui-8139c81d1b3521c8b8406a3c069c1c8829b05abe.tar.gz
jquery-ui-8139c81d1b3521c8b8406a3c069c1c8829b05abe.zip
Revert changes for #3838 for the release 1.6rc5
Diffstat (limited to 'ui/ui.resizable.js')
-rw-r--r--ui/ui.resizable.js40
1 files changed, 17 insertions, 23 deletions
diff --git a/ui/ui.resizable.js b/ui/ui.resizable.js
index d67cb5454..c557444cd 100644
--- a/ui/ui.resizable.js
+++ b/ui/ui.resizable.js
@@ -12,15 +12,9 @@
*/
(function($) {
-var widgetName = "resizable";
-var classWidgetName = ".resizable";
-
$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
_init: function() {
- // update widgetName with the name given by the widget factory
- widgetName = this.widgetName;
- classWidgetName = '.' + widgetName;
var self = this, o = this.options;
@@ -89,7 +83,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
var oel = this.element; this.element = this.element.parent();
// store instance on wrapper
- this.element.data(widgetName, this);
+ this.element.data('resizable', this);
//Move margins to the wrapper
this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
@@ -234,7 +228,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
var _destroy = function(exp) {
$(exp).removeClass("ui-resizable ui-resizable-disabled")
- .removeData(widgetName).unbind(classWidgetName).find('.ui-resizable-handle').remove();
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
};
_destroy(el);
@@ -576,10 +570,10 @@ $.extend($.ui.resizable, {
* Resizable Extensions
*/
-$.ui.plugin.add(widgetName, "alsoResize", {
+$.ui.plugin.add("resizable", "alsoResize", {
start: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName),
+ var o = ui.options, self = $(this).data("resizable"),
_store = function(exp) {
$(exp).each(function() {
@@ -599,7 +593,7 @@ $.ui.plugin.add(widgetName, "alsoResize", {
},
resize: function(event, ui){
- var o = ui.options, self = $(this).data(widgetName), os = self.originalSize, op = self.originalPosition;
+ var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
var delta = {
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
@@ -631,10 +625,10 @@ $.ui.plugin.add(widgetName, "alsoResize", {
}
});
-$.ui.plugin.add(widgetName, "animate", {
+$.ui.plugin.add("resizable", "animate", {
stop: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName);
+ var o = ui.options, self = $(this).data("resizable");
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
@@ -670,10 +664,10 @@ $.ui.plugin.add(widgetName, "animate", {
});
-$.ui.plugin.add(widgetName, "containment", {
+$.ui.plugin.add("resizable", "containment", {
start: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName), el = self.element;
+ var o = ui.options, self = $(this).data("resizable"), el = self.element;
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
if (!ce) return;
@@ -705,7 +699,7 @@ $.ui.plugin.add(widgetName, "containment", {
},
resize: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName),
+ var o = ui.options, self = $(this).data("resizable"),
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
@@ -739,7 +733,7 @@ $.ui.plugin.add(widgetName, "containment", {
},
stop: function(event, ui){
- var o = ui.options, self = $(this).data(widgetName), cp = self.position,
+ var o = ui.options, self = $(this).data("resizable"), cp = self.position,
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
@@ -753,10 +747,10 @@ $.ui.plugin.add(widgetName, "containment", {
}
});
-$.ui.plugin.add(widgetName, "ghost", {
+$.ui.plugin.add("resizable", "ghost", {
start: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize, cs = self.size;
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
if (!pr) self.ghost = self.element.clone();
else self.ghost = pr.clone();
@@ -771,23 +765,23 @@ $.ui.plugin.add(widgetName, "ghost", {
},
resize: function(event, ui){
- var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize;
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
},
stop: function(event, ui){
- var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize;
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
}
});
-$.ui.plugin.add(widgetName, "grid", {
+$.ui.plugin.add("resizable", "grid", {
resize: function(event, ui) {
- var o = ui.options, self = $(this).data(widgetName), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
+ var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);