sortable: removing ui.options caused plugins not to work anymore - fixed all regressions

This commit is contained in:
Paul Bakaus 2008-11-19 15:08:02 +00:00
parent fbde8766ba
commit c3df1b6df6

View File

@ -857,41 +857,43 @@ $.extend($.ui.sortable, {
$.ui.plugin.add("sortable", "cursor", { $.ui.plugin.add("sortable", "cursor", {
start: function(event, ui) { start: function(event, ui) {
var t = $('body'); var t = $('body'), i = $(this).data('sortable');
if (t.css("cursor")) ui.options._cursor = t.css("cursor"); if (t.css("cursor")) i.options._cursor = t.css("cursor");
t.css("cursor", ui.options.cursor); t.css("cursor", i.options.cursor);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
if (ui.options._cursor) $('body').css("cursor", ui.options._cursor); var i = $(this).data('sortable');
if (i.options._cursor) $('body').css("cursor", i.options._cursor);
} }
}); });
$.ui.plugin.add("sortable", "zIndex", { $.ui.plugin.add("sortable", "zIndex", {
start: function(event, ui) { start: function(event, ui) {
var t = ui.helper; var t = ui.helper, i = $(this).data('sortable');
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); if(t.css("zIndex")) i.options._zIndex = t.css("zIndex");
t.css('zIndex', ui.options.zIndex); t.css('zIndex', i.options.zIndex);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex); var i = $(this).data('sortable');
if(i.options._zIndex) $(ui.helper).css('zIndex', i.options._zIndex);
} }
}); });
$.ui.plugin.add("sortable", "opacity", { $.ui.plugin.add("sortable", "opacity", {
start: function(event, ui) { start: function(event, ui) {
var t = ui.helper; var t = ui.helper, i = $(this).data('sortable');
if(t.css("opacity")) ui.options._opacity = t.css("opacity"); if(t.css("opacity")) i.options._opacity = t.css("opacity");
t.css('opacity', ui.options.opacity); t.css('opacity', i.options.opacity);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity); var i = $(this).data('sortable');
if(i.options._opacity) $(ui.helper).css('opacity', i.options._opacity);
} }
}); });
$.ui.plugin.add("sortable", "scroll", { $.ui.plugin.add("sortable", "scroll", {
start: function(event, ui) { start: function(event, ui) {
var o = ui.options; var i = $(this).data('sortable'), o = i.options;
var i = $(this).data("sortable");
i.overflowY = function(el) { i.overflowY = function(el) {
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode); do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
@ -908,8 +910,7 @@ $.ui.plugin.add("sortable", "scroll", {
}, },
sort: function(event, ui) { sort: function(event, ui) {
var o = ui.options; var i = $(this).data('sortable'), o = i.options;
var i = $(this).data("sortable");
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') { if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - event.pageY < o.scrollSensitivity) if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - event.pageY < o.scrollSensitivity)
@ -940,11 +941,9 @@ $.ui.plugin.add("sortable", "scroll", {
$.ui.plugin.add("sortable", "axis", { $.ui.plugin.add("sortable", "axis", {
sort: function(event, ui) { sort: function(event, ui) {
var i = $(this).data('sortable'), o = i.options;
var i = $(this).data("sortable"); if(o.axis == "y") i.position.left = i.originalPosition.left;
if(ui.options.axis == "y") i.position.left = i.originalPosition.left; if(o.axis == "x") i.position.top = i.originalPosition.top;
if(ui.options.axis == "x") i.position.top = i.originalPosition.top;
} }
}); });