Remove Trailing Spaces

This commit is contained in:
Eduardo Lundgren 2008-09-19 14:08:41 +00:00
parent faec9388e2
commit 8d04c3594c
58 changed files with 1043 additions and 1043 deletions

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Blind * http://docs.jquery.com/UI/Effects/Blind
* *
* Depends: * Depends:
@ -18,22 +18,22 @@ $.effects.blind = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left']; var el = $(this), props = ['position','top','left'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
var direction = o.options.direction || 'vertical'; // Default direction var direction = o.options.direction || 'vertical'; // Default direction
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
var ref = (direction == 'vertical') ? 'height' : 'width'; var ref = (direction == 'vertical') ? 'height' : 'width';
var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
if(mode == 'show') wrapper.css(ref, 0); // Shift if(mode == 'show') wrapper.css(ref, 0); // Shift
// Animation // Animation
var animation = {}; var animation = {};
animation[ref] = mode == 'show' ? distance : 0; animation[ref] = mode == 'show' ? distance : 0;
// Animate // Animate
wrapper.animate(animation, o.duration, o.options.easing, function() { wrapper.animate(animation, o.duration, o.options.easing, function() {
if(mode == 'hide') el.hide(); // Hide if(mode == 'hide') el.hide(); // Hide
@ -41,9 +41,9 @@ $.effects.blind = function(o) {
if(o.callback) o.callback.apply(el[0], arguments); // Callback if(o.callback) o.callback.apply(el[0], arguments); // Callback
el.dequeue(); el.dequeue();
}); });
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Bounce * http://docs.jquery.com/UI/Effects/Bounce
* *
* Depends: * Depends:
@ -36,7 +36,7 @@ $.effects.bounce = function(o) {
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
if (mode == 'hide') distance = distance / (times * 2); if (mode == 'hide') distance = distance / (times * 2);
if (mode != 'hide') times--; if (mode != 'hide') times--;
// Animate // Animate
if (mode == 'show') { // Show Bounce if (mode == 'show') { // Show Bounce
var animation = {opacity: 1}; var animation = {opacity: 1};
@ -72,7 +72,7 @@ $.effects.bounce = function(o) {
el.queue('fx', function() { el.dequeue(); }); el.queue('fx', function() { el.dequeue(); });
el.dequeue(); el.dequeue();
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Clip * http://docs.jquery.com/UI/Effects/Clip
* *
* Depends: * Depends:
@ -18,11 +18,11 @@ $.effects.clip = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left','height','width']; var el = $(this), props = ['position','top','left','height','width'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
var direction = o.options.direction || 'vertical'; // Default direction var direction = o.options.direction || 'vertical'; // Default direction
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
@ -33,22 +33,22 @@ $.effects.clip = function(o) {
}; };
var distance = (direction == 'vertical') ? animate.height() : animate.width(); var distance = (direction == 'vertical') ? animate.height() : animate.width();
if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
// Animation // Animation
var animation = {}; var animation = {};
animation[ref.size] = mode == 'show' ? distance : 0; animation[ref.size] = mode == 'show' ? distance : 0;
animation[ref.position] = mode == 'show' ? 0 : distance / 2; animation[ref.position] = mode == 'show' ? 0 : distance / 2;
// Animate // Animate
animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
if(o.callback) o.callback.apply(el[0], arguments); // Callback if(o.callback) o.callback.apply(el[0], arguments); // Callback
el.dequeue(); el.dequeue();
}}); }});
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/ * http://docs.jquery.com/UI/Effects/
*/ */
;(function($) { ;(function($) {
@ -299,7 +299,7 @@ var colors = {
yellow:[255,255,0], yellow:[255,255,0],
transparent: [255,255,255] transparent: [255,255,255]
}; };
/* /*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
* *
@ -307,33 +307,33 @@ var colors = {
* to offer multiple easing options * to offer multiple easing options
* *
* TERMS OF USE - jQuery Easing * TERMS OF USE - jQuery Easing
* *
* Open source under the BSD License. * Open source under the BSD License.
* *
* Copyright © 2008 George McGinley Smith * Copyright © 2008 George McGinley Smith
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this list of * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list * Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* Neither the name of the author nor the names of contributors may be used to endorse * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission. * or promote products derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
@ -449,7 +449,7 @@ jQuery.extend( jQuery.easing,
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}, },
easeInOutBack: function (x, t, b, c, d, s) { easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158; if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}, },
@ -476,33 +476,33 @@ jQuery.extend( jQuery.easing,
/* /*
* *
* TERMS OF USE - EASING EQUATIONS * TERMS OF USE - EASING EQUATIONS
* *
* Open source under the BSD License. * Open source under the BSD License.
* *
* Copyright © 2001 Robert Penner * Copyright © 2001 Robert Penner
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this list of * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list * Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* Neither the name of the author nor the names of contributors may be used to endorse * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission. * or promote products derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Drop * http://docs.jquery.com/UI/Effects/Drop
* *
* Depends: * Depends:
@ -18,11 +18,11 @@ $.effects.drop = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left','opacity']; var el = $(this), props = ['position','top','left','opacity'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
var direction = o.options.direction || 'left'; // Default Direction var direction = o.options.direction || 'left'; // Default Direction
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
$.effects.createWrapper(el); // Create Wrapper $.effects.createWrapper(el); // Create Wrapper
@ -30,11 +30,11 @@ $.effects.drop = function(o) {
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
// Animation // Animation
var animation = {opacity: mode == 'show' ? 1 : 0}; var animation = {opacity: mode == 'show' ? 1 : 0};
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
// Animate // Animate
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide if(mode == 'hide') el.hide(); // Hide
@ -42,9 +42,9 @@ $.effects.drop = function(o) {
if(o.callback) o.callback.apply(this, arguments); // Callback if(o.callback) o.callback.apply(this, arguments); // Callback
el.dequeue(); el.dequeue();
}}); }});
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus (ui.jquery.com) * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Explode * http://docs.jquery.com/UI/Effects/Explode
* *
* Depends: * Depends:
@ -18,15 +18,15 @@ $.effects.explode = function(o) {
var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
var el = $(this).show().css('visibility', 'hidden'); var el = $(this).show().css('visibility', 'hidden');
var offset = el.offset(); var offset = el.offset();
//Substract the margins - not fixing the problem yet. //Substract the margins - not fixing the problem yet.
offset.top -= parseInt(el.css("marginTop")) || 0; offset.top -= parseInt(el.css("marginTop")) || 0;
offset.left -= parseInt(el.css("marginLeft")) || 0; offset.left -= parseInt(el.css("marginLeft")) || 0;
var width = el.outerWidth(true); var width = el.outerWidth(true);
var height = el.outerHeight(true); var height = el.outerHeight(true);
@ -62,18 +62,18 @@ $.effects.explode = function(o) {
// Set a timeout, to call the callback approx. when the other animations have finished // Set a timeout, to call the callback approx. when the other animations have finished
setTimeout(function() { setTimeout(function() {
o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
if(o.callback) o.callback.apply(el[0]); // Callback if(o.callback) o.callback.apply(el[0]); // Callback
el.dequeue(); el.dequeue();
$('.effects-explode').remove(); $('.effects-explode').remove();
}, o.duration || 500); }, o.duration || 500);
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Fold * http://docs.jquery.com/UI/Effects/Fold
* *
* Depends: * Depends:
@ -18,12 +18,12 @@ $.effects.fold = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left']; var el = $(this), props = ['position','top','left'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
var size = o.options.size || 15; // Default fold size var size = o.options.size || 15; // Default fold size
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
@ -33,12 +33,12 @@ $.effects.fold = function(o) {
var percent = /([0-9]+)%/.exec(size); var percent = /([0-9]+)%/.exec(size);
if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1]; if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1];
if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
// Animation // Animation
var animation1 = {}, animation2 = {}; var animation1 = {}, animation2 = {};
animation1[ref[0]] = mode == 'show' ? distance[0] : size; animation1[ref[0]] = mode == 'show' ? distance[0] : size;
animation2[ref[1]] = mode == 'show' ? distance[1] : 0; animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
// Animate // Animate
wrapper.animate(animation1, o.duration / 2, o.options.easing) wrapper.animate(animation1, o.duration / 2, o.options.easing)
.animate(animation2, o.duration / 2, o.options.easing, function() { .animate(animation2, o.duration / 2, o.options.easing, function() {
@ -47,9 +47,9 @@ $.effects.fold = function(o) {
if(o.callback) o.callback.apply(el[0], arguments); // Callback if(o.callback) o.callback.apply(el[0], arguments); // Callback
el.dequeue(); el.dequeue();
}); });
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Highlight * http://docs.jquery.com/UI/Effects/Highlight
* *
* Depends: * Depends:
@ -15,34 +15,34 @@
$.effects.highlight = function(o) { $.effects.highlight = function(o) {
return this.queue(function() { return this.queue(function() {
// Create element // Create element
var el = $(this), props = ['backgroundImage','backgroundColor','opacity']; var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var color = o.options.color || "#ffff99"; // Default highlight color var color = o.options.color || "#ffff99"; // Default highlight color
var oldColor = el.css("backgroundColor"); var oldColor = el.css("backgroundColor");
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
// Animation // Animation
var animation = {backgroundColor: oldColor }; var animation = {backgroundColor: oldColor };
if (mode == "hide") animation['opacity'] = 0; if (mode == "hide") animation['opacity'] = 0;
// Animate // Animate
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == "hide") el.hide(); if(mode == "hide") el.hide();
$.effects.restore(el, props); $.effects.restore(el, props);
if (mode == "show" && jQuery.browser.msie) this.style.removeAttribute('filter'); if (mode == "show" && jQuery.browser.msie) this.style.removeAttribute('filter');
if(o.callback) o.callback.apply(this, arguments); if(o.callback) o.callback.apply(this, arguments);
el.dequeue(); el.dequeue();
}}); }});
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Pulsate * http://docs.jquery.com/UI/Effects/Pulsate
* *
* Depends: * Depends:
@ -15,14 +15,14 @@
$.effects.pulsate = function(o) { $.effects.pulsate = function(o) {
return this.queue(function() { return this.queue(function() {
// Create element // Create element
var el = $(this); var el = $(this);
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var times = o.options.times || 5; // Default # of times var times = o.options.times || 5; // Default # of times
// Adjust // Adjust
if (mode == 'hide') times--; if (mode == 'hide') times--;
if (el.is(':hidden')) { // Show fadeIn if (el.is(':hidden')) { // Show fadeIn
@ -31,7 +31,7 @@ $.effects.pulsate = function(o) {
el.animate({opacity: 1}, o.duration / 2, o.options.easing); el.animate({opacity: 1}, o.duration / 2, o.options.easing);
times = times-2; times = times-2;
} }
// Animate // Animate
for (var i = 0; i < times; i++) { // Pulsate for (var i = 0; i < times; i++) { // Pulsate
el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing); el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
@ -49,7 +49,7 @@ $.effects.pulsate = function(o) {
el.queue('fx', function() { el.dequeue(); }); el.queue('fx', function() { el.dequeue(); });
el.dequeue(); el.dequeue();
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Scale * http://docs.jquery.com/UI/Effects/Scale
* *
* Depends: * Depends:
@ -18,34 +18,34 @@ $.effects.puff = function(o) {
// Create element // Create element
var el = $(this); var el = $(this);
// Set options // Set options
var options = $.extend(true, {}, o.options); var options = $.extend(true, {}, o.options);
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
var percent = parseInt(o.options.percent) || 150; // Set default puff percent var percent = parseInt(o.options.percent) || 150; // Set default puff percent
options.fade = true; // It's not a puff if it doesn't fade! :) options.fade = true; // It's not a puff if it doesn't fade! :)
var original = {height: el.height(), width: el.width()}; // Save original var original = {height: el.height(), width: el.width()}; // Save original
// Adjust // Adjust
var factor = percent / 100; var factor = percent / 100;
el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor}; el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
// Animation // Animation
options.from = el.from; options.from = el.from;
options.percent = (mode == 'hide') ? percent : 100; options.percent = (mode == 'hide') ? percent : 100;
options.mode = mode; options.mode = mode;
// Animate // Animate
el.effect('scale', options, o.duration, o.callback); el.effect('scale', options, o.duration, o.callback);
el.dequeue(); el.dequeue();
}); });
}; };
$.effects.scale = function(o) { $.effects.scale = function(o) {
return this.queue(function() { return this.queue(function() {
// Create element // Create element
var el = $(this); var el = $(this);
@ -61,33 +61,33 @@ $.effects.scale = function(o) {
} }
var original = {height: el.height(), width: el.width()}; // Save original var original = {height: el.height(), width: el.width()}; // Save original
el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
// Adjust // Adjust
var factor = { // Set scaling factor var factor = { // Set scaling factor
y: direction != 'horizontal' ? (percent / 100) : 1, y: direction != 'horizontal' ? (percent / 100) : 1,
x: direction != 'vertical' ? (percent / 100) : 1 x: direction != 'vertical' ? (percent / 100) : 1
}; };
el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
if (o.options.fade) { // Fade option to support puff if (o.options.fade) { // Fade option to support puff
if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
}; };
// Animation // Animation
options.from = el.from; options.to = el.to; options.mode = mode; options.from = el.from; options.to = el.to; options.mode = mode;
// Animate // Animate
el.effect('size', options, o.duration, o.callback); el.effect('size', options, o.duration, o.callback);
el.dequeue(); el.dequeue();
}); });
}; };
$.effects.size = function(o) { $.effects.size = function(o) {
return this.queue(function() { return this.queue(function() {
// Create element // Create element
var el = $(this), props = ['position','top','left','width','height','overflow','opacity']; var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
var props1 = ['position','top','left','overflow','opacity']; // Always restore var props1 = ['position','top','left','overflow','opacity']; // Always restore
@ -95,7 +95,7 @@ $.effects.size = function(o) {
var cProps = ['fontSize']; var cProps = ['fontSize'];
var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
var restore = o.options.restore || false; // Default restore var restore = o.options.restore || false; // Default restore
@ -138,7 +138,7 @@ $.effects.size = function(o) {
$.effects.save(el, restore ? props : props1); el.show(); // Save & Show $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
$.effects.createWrapper(el); // Create Wrapper $.effects.createWrapper(el); // Create Wrapper
el.css('overflow','hidden').css(el.from); // Shift el.css('overflow','hidden').css(el.from); // Shift
// Animate // Animate
if (scale == 'content' || scale == 'both') { // Scale the children if (scale == 'content' || scale == 'both') { // Scale the children
vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
@ -164,15 +164,15 @@ $.effects.size = function(o) {
}); // Animate children }); // Animate children
}); });
}; };
// Animate // Animate
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
if(o.callback) o.callback.apply(this, arguments); // Callback if(o.callback) o.callback.apply(this, arguments); // Callback
el.dequeue(); el.dequeue();
}}); }});
}); });
}; };

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Shake * http://docs.jquery.com/UI/Effects/Shake
* *
* Depends: * Depends:
@ -18,26 +18,26 @@ $.effects.shake = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left']; var el = $(this), props = ['position','top','left'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
var direction = o.options.direction || 'left'; // Default direction var direction = o.options.direction || 'left'; // Default direction
var distance = o.options.distance || 20; // Default distance var distance = o.options.distance || 20; // Default distance
var times = o.options.times || 3; // Default # of times var times = o.options.times || 3; // Default # of times
var speed = o.duration || o.options.duration || 140; // Default speed per shake var speed = o.duration || o.options.duration || 140; // Default speed per shake
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
$.effects.createWrapper(el); // Create Wrapper $.effects.createWrapper(el); // Create Wrapper
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
// Animation // Animation
var animation = {}, animation1 = {}, animation2 = {}; var animation = {}, animation1 = {}, animation2 = {};
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
// Animate // Animate
el.animate(animation, speed, o.options.easing); el.animate(animation, speed, o.options.easing);
for (var i = 1; i < times; i++) { // Shakes for (var i = 1; i < times; i++) { // Shakes
@ -51,7 +51,7 @@ $.effects.shake = function(o) {
el.queue('fx', function() { el.dequeue(); }); el.queue('fx', function() { el.dequeue(); });
el.dequeue(); el.dequeue();
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Slide * http://docs.jquery.com/UI/Effects/Slide
* *
* Depends: * Depends:
@ -18,11 +18,11 @@ $.effects.slide = function(o) {
// Create element // Create element
var el = $(this), props = ['position','top','left']; var el = $(this), props = ['position','top','left'];
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var direction = o.options.direction || 'left'; // Default Direction var direction = o.options.direction || 'left'; // Default Direction
// Adjust // Adjust
$.effects.save(el, props); el.show(); // Save & Show $.effects.save(el, props); el.show(); // Save & Show
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
@ -30,11 +30,11 @@ $.effects.slide = function(o) {
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
// Animation // Animation
var animation = {}; var animation = {};
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
// Animate // Animate
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide if(mode == 'hide') el.hide(); // Hide
@ -42,9 +42,9 @@ $.effects.slide = function(o) {
if(o.callback) o.callback.apply(this, arguments); // Callback if(o.callback) o.callback.apply(this, arguments); // Callback
el.dequeue(); el.dequeue();
}}); }});
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com) * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Effects/Transfer * http://docs.jquery.com/UI/Effects/Transfer
* *
* Depends: * Depends:
@ -18,14 +18,14 @@ $.effects.transfer = function(o) {
// Create element // Create element
var el = $(this); var el = $(this);
// Set options // Set options
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
var target = $(o.options.to); // Find Target var target = $(o.options.to); // Find Target
var position = el.offset(); var position = el.offset();
var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body); var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body);
if(o.options.className) transfer.addClass(o.options.className); if(o.options.className) transfer.addClass(o.options.className);
// Set target css // Set target css
transfer.addClass(o.options.className); transfer.addClass(o.options.className);
transfer.css({ transfer.css({
@ -35,7 +35,7 @@ $.effects.transfer = function(o) {
width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')), width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
position: 'absolute' position: 'absolute'
}); });
// Animation // Animation
position = target.offset(); position = target.offset();
animation = { animation = {
@ -44,16 +44,16 @@ $.effects.transfer = function(o) {
height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')), height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')) width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
}; };
// Animate // Animate
transfer.animate(animation, o.duration, o.options.easing, function() { transfer.animate(animation, o.duration, o.options.easing, function() {
transfer.remove(); // Remove div transfer.remove(); // Remove div
if(o.callback) o.callback.apply(el[0], arguments); // Callback if(o.callback) o.callback.apply(el[0], arguments); // Callback
el.dequeue(); el.dequeue();
}); });
}); });
}; };
})(jQuery); })(jQuery);

View File

@ -20,7 +20,7 @@ jQuery(function($){
dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'], dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
dayStatus: 'اختر DD لليوم الأول من الأسبوع', dateStatus: 'اختر D, M d', dayStatus: 'اختر DD لليوم الأول من الأسبوع', dateStatus: 'اختر D, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: 'اختر يوم', isRTL: true}; initStatus: 'اختر يوم', isRTL: true};
$.datepicker.setDefaults($.datepicker.regional['ar']); $.datepicker.setDefaults($.datepicker.regional['ar']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'], dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],
dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'], dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'mm/dd/yy', firstDay: 0, dateFormat: 'mm/dd/yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['ca']); $.datepicker.setDefaults($.datepicker.regional['ca']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
dayNamesMin: ['ne','po','út','st','čt','pá','so'], dayNamesMin: ['ne','po','út','st','čt','pá','so'],
dayStatus: 'Nastavit DD jako první den v týdnu', dateStatus: '\'Vyber\' DD, M d', dayStatus: 'Nastavit DD jako první den v týdnu', dateStatus: '\'Vyber\' DD, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: 'Vyberte datum', isRTL: false}; initStatus: 'Vyberte datum', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['cs']); $.datepicker.setDefaults($.datepicker.regional['cs']);
}); });

View File

@ -9,9 +9,9 @@ jQuery(function($){
nextText: 'Næste&#x3e;', nextStatus: 'Vis næste måned', nextText: 'Næste&#x3e;', nextStatus: 'Vis næste måned',
nextBigText: '&#x3e;&#x3e;', nextBigStatus: '', nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
currentText: 'Idag', currentStatus: 'Vis aktuel måned', currentText: 'Idag', currentStatus: 'Vis aktuel måned',
monthNames: ['Januar','Februar','Marts','April','Maj','Juni', monthNames: ['Januar','Februar','Marts','April','Maj','Juni',
'Juli','August','September','Oktober','November','December'], 'Juli','August','September','Oktober','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
'Jul','Aug','Sep','Okt','Nov','Dec'], 'Jul','Aug','Sep','Okt','Nov','Dec'],
monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år', monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år',
weekHeader: 'Uge', weekStatus: 'Årets uge', weekHeader: 'Uge', weekStatus: 'Årets uge',
@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
dayStatus: 'Sæt DD som første ugedag', dateStatus: 'Vælg D, M d', dayStatus: 'Sæt DD som første ugedag', dateStatus: 'Vælg D, M d',
dateFormat: 'dd-mm-yy', firstDay: 0, dateFormat: 'dd-mm-yy', firstDay: 0,
initStatus: 'Vælg en dato', isRTL: false}; initStatus: 'Vælg en dato', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['da']); $.datepicker.setDefaults($.datepicker.regional['da']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d', dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: 'Wähle ein Datum', isRTL: false}; initStatus: 'Wähle ein Datum', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['de']); $.datepicker.setDefaults($.datepicker.regional['de']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'], dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'], dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['es']); $.datepicker.setDefaults($.datepicker.regional['es']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d', dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: 'Choisir la date', isRTL: false}; initStatus: 'Choisir la date', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['fr']); $.datepicker.setDefaults($.datepicker.regional['fr']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'], dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
dayStatus: 'DD', dateStatus: 'DD, M d', dayStatus: 'DD', dateStatus: 'DD, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: '', isRTL: true}; initStatus: '', isRTL: true};
$.datepicker.setDefaults($.datepicker.regional['he']); $.datepicker.setDefaults($.datepicker.regional['he']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'], dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'], dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy-mm-dd', firstDay: 1, dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['hu']); $.datepicker.setDefaults($.datepicker.regional['hu']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'], dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'], dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['hy']); $.datepicker.setDefaults($.datepicker.regional['hy']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'], dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],
dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'], dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],
dayStatus: 'gunakan DD sebagai awal hari dalam minggu', dateStatus: 'pilih le DD, MM d', dayStatus: 'gunakan DD sebagai awal hari dalam minggu', dateStatus: 'pilih le DD, MM d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: 'Pilih Tanggal', isRTL: false}; initStatus: 'Pilih Tanggal', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['id']); $.datepicker.setDefaults($.datepicker.regional['id']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'], dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'],
dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'], dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['is']); $.datepicker.setDefaults($.datepicker.regional['is']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'], dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'],
dayStatus: 'Usa DD come primo giorno della settimana', dateStatus: 'Seleziona D, M d', dayStatus: 'Usa DD come primo giorno della settimana', dateStatus: 'Seleziona D, M d',
dateFormat: 'dd/mm/yy', firstDay: 1, dateFormat: 'dd/mm/yy', firstDay: 1,
initStatus: 'Scegliere una data', isRTL: false}; initStatus: 'Scegliere una data', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['it']); $.datepicker.setDefaults($.datepicker.regional['it']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'], dayNamesShort: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
dayNamesMin: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'], dayNamesMin: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy/mm/dd', firstDay: 0, dateFormat: 'yy/mm/dd', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['ja']); $.datepicker.setDefaults($.datepicker.regional['ja']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['일','월','화','수','목','금','토'], dayNamesShort: ['일','월','화','수','목','금','토'],
dayNamesMin: ['일','월','화','수','목','금','토'], dayNamesMin: ['일','월','화','수','목','금','토'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy-mm-dd', firstDay: 0, dateFormat: 'yy-mm-dd', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['ko']); $.datepicker.setDefaults($.datepicker.regional['ko']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'], dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],
dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'], dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy-mm-dd', firstDay: 1, dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['lt']); $.datepicker.setDefaults($.datepicker.regional['lt']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'], dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'], dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd-mm-yy', firstDay: 1, dateFormat: 'dd-mm-yy', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['lv']); $.datepicker.setDefaults($.datepicker.regional['lv']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'], dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'],
dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'], dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: 'Kies een datum', isRTL: false}; initStatus: 'Kies een datum', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['nl']); $.datepicker.setDefaults($.datepicker.regional['nl']);
}); });

View File

@ -9,9 +9,9 @@ jQuery(function($){
nextText: 'Neste&raquo;', nextStatus: '', nextText: 'Neste&raquo;', nextStatus: '',
nextBigText: '&#x3e;&#x3e;', nextBigStatus: '', nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
currentText: 'I dag', currentStatus: '', currentText: 'I dag', currentStatus: '',
monthNames: ['Januar','Februar','Mars','April','Mai','Juni', monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
'Juli','August','September','Oktober','November','Desember'], 'Juli','August','September','Oktober','November','Desember'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun', monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',
'Jul','Aug','Sep','Okt','Nov','Des'], 'Jul','Aug','Sep','Okt','Nov','Des'],
monthStatus: '', yearStatus: '', monthStatus: '', yearStatus: '',
weekHeader: 'Uke', weekStatus: '', weekHeader: 'Uke', weekStatus: '',
@ -19,7 +19,7 @@ jQuery(function($){
dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy-mm-dd', firstDay: 0, dateFormat: 'yy-mm-dd', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['no']); $.datepicker.setDefaults($.datepicker.regional['no']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'], dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'], dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d', dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d',
dateFormat: 'yy-mm-dd', firstDay: 1, dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: 'Wybierz datę', isRTL: false}; initStatus: 'Wybierz datę', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['pl']); $.datepicker.setDefaults($.datepicker.regional['pl']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['pt-BR']); $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'], dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'],
dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sa'], dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sa'],
dayStatus: 'Seteaza DD ca prima saptamana zi', dateStatus: 'Selecteaza D, M d', dayStatus: 'Seteaza DD ca prima saptamana zi', dateStatus: 'Selecteaza D, M d',
dateFormat: 'mm/dd/yy', firstDay: 0, dateFormat: 'mm/dd/yy', firstDay: 0,
initStatus: 'Selecteaza o data', isRTL: false}; initStatus: 'Selecteaza o data', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['ro']); $.datepicker.setDefaults($.datepicker.regional['ro']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'], dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'], dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['ru']); $.datepicker.setDefaults($.datepicker.regional['ru']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'], dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'], dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd.mm.yy', firstDay: 0, dateFormat: 'dd.mm.yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['sk']); $.datepicker.setDefaults($.datepicker.regional['sk']);
}); });

View File

@ -17,7 +17,7 @@ jQuery(function($){
dayNamesShort: ['Ned','Pon','Tor','Sre','&#x10C;et','Pet','Sob'], dayNamesShort: ['Ned','Pon','Tor','Sre','&#x10C;et','Pet','Sob'],
dayNamesMin: ['Ne','Po','To','Sr','&#x10C;e','Pe','So'], dayNamesMin: ['Ne','Po','To','Sr','&#x10C;e','Pe','So'],
dayStatus: 'Nastavi DD za prvi dan v tednu', dateStatus: 'Izberi DD, d MM yy', dayStatus: 'Nastavi DD za prvi dan v tednu', dateStatus: 'Izberi DD, d MM yy',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: 'Izbira datuma', isRTL: false}; initStatus: 'Izbira datuma', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['sl']); $.datepicker.setDefaults($.datepicker.regional['sl']);
}); });

View File

@ -9,9 +9,9 @@ jQuery(function($){
nextText: 'Nästa&raquo;', nextStatus: '', nextText: 'Nästa&raquo;', nextStatus: '',
nextBigText: '&#x3e;&#x3e;', nextBigStatus: '', nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
currentText: 'Idag', currentStatus: '', currentText: 'Idag', currentStatus: '',
monthNames: ['Januari','Februari','Mars','April','Maj','Juni', monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
'Juli','Augusti','September','Oktober','November','December'], 'Juli','Augusti','September','Oktober','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
'Jul','Aug','Sep','Okt','Nov','Dec'], 'Jul','Aug','Sep','Okt','Nov','Dec'],
monthStatus: '', yearStatus: '', monthStatus: '', yearStatus: '',
weekHeader: 'Ve', weekStatus: '', weekHeader: 'Ve', weekStatus: '',
@ -19,7 +19,7 @@ jQuery(function($){
dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'], dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'yy-mm-dd', firstDay: 1, dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['sv']); $.datepicker.setDefaults($.datepicker.regional['sv']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd/mm/yy', firstDay: 0, dateFormat: 'dd/mm/yy', firstDay: 0,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['th']); $.datepicker.setDefaults($.datepicker.regional['th']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'], dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
dayStatus: 'Haftanın ilk gününü belirleyin', dateStatus: 'D, M d seçiniz', dayStatus: 'Haftanın ilk gününü belirleyin', dateStatus: 'D, M d seçiniz',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: 'Bir tarih seçiniz', isRTL: false}; initStatus: 'Bir tarih seçiniz', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['tr']); $.datepicker.setDefaults($.datepicker.regional['tr']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'], dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],
dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'], dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],
dayStatus: 'DD', dateStatus: 'D, M d', dayStatus: 'DD', dateStatus: 'D, M d',
dateFormat: 'dd.mm.yy', firstDay: 1, dateFormat: 'dd.mm.yy', firstDay: 1,
initStatus: '', isRTL: false}; initStatus: '', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['uk']); $.datepicker.setDefaults($.datepicker.regional['uk']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
dayNamesMin: ['日','一','二','三','四','五','六'], dayNamesMin: ['日','一','二','三','四','五','六'],
dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD', dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD',
dateFormat: 'yy-mm-dd', firstDay: 1, dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: '请选择日期', isRTL: false}; initStatus: '请选择日期', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['zh-CN']); $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
}); });

View File

@ -19,7 +19,7 @@ jQuery(function($){
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'], dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
dayNamesMin: ['日','一','二','三','四','五','六'], dayNamesMin: ['日','一','二','三','四','五','六'],
dayStatus: '設定 DD 為一周起始', dateStatus: '選擇 m月 d日, DD', dayStatus: '設定 DD 為一周起始', dateStatus: '選擇 m月 d日, DD',
dateFormat: 'yy/mm/dd', firstDay: 1, dateFormat: 'yy/mm/dd', firstDay: 1,
initStatus: '請選擇日期', isRTL: false}; initStatus: '請選擇日期', isRTL: false};
$.datepicker.setDefaults($.datepicker.regional['zh-TW']); $.datepicker.setDefaults($.datepicker.regional['zh-TW']);
}); });

View File

@ -1,6 +1,6 @@
/* /*
* jQuery UI Accordion @VERSION * jQuery UI Accordion @VERSION
* *
* Copyright (c) 2007, 2008 Jörn Zaefferer * Copyright (c) 2007, 2008 Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
@ -15,7 +15,7 @@
$.widget("ui.accordion", { $.widget("ui.accordion", {
_init: function() { _init: function() {
var options = this.options; var options = this.options;
if ( options.navigation ) { if ( options.navigation ) {
var current = this.element.find("a").filter(options.navigationFilter); var current = this.element.find("a").filter(options.navigationFilter);
if ( current.length ) { if ( current.length ) {
@ -27,23 +27,23 @@ $.widget("ui.accordion", {
} }
} }
} }
// calculate active if not specified, using the first header // calculate active if not specified, using the first header
options.headers = this.element.find(options.header); options.headers = this.element.find(options.header);
options.active = findActive(options.headers, options.active); options.active = findActive(options.headers, options.active);
// IE7-/Win - Extra vertical space in Lists fixed // IE7-/Win - Extra vertical space in Lists fixed
if ($.browser.msie) { if ($.browser.msie) {
this.element.find('a').css('zoom', '1'); this.element.find('a').css('zoom', '1');
} }
if (!this.element.hasClass("ui-accordion")) { if (!this.element.hasClass("ui-accordion")) {
this.element.addClass("ui-accordion"); this.element.addClass("ui-accordion");
$('<span class="ui-accordion-left"/>').insertBefore(options.headers); $('<span class="ui-accordion-left"/>').insertBefore(options.headers);
$('<span class="ui-accordion-right"/>').appendTo(options.headers); $('<span class="ui-accordion-right"/>').appendTo(options.headers);
options.headers.addClass("ui-accordion-header").attr("tabindex", "0"); options.headers.addClass("ui-accordion-header").attr("tabindex", "0");
} }
var maxHeight; var maxHeight;
if ( options.fillSpace ) { if ( options.fillSpace ) {
maxHeight = this.element.parent().height(); maxHeight = this.element.parent().height();
@ -60,13 +60,13 @@ $.widget("ui.accordion", {
maxHeight = Math.max(maxHeight, $(this).outerHeight()); maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight); }).height(maxHeight);
} }
options.headers options.headers
.not(options.active || "") .not(options.active || "")
.next() .next()
.hide(); .hide();
options.active.parent().andSelf().addClass(options.selectedClass); options.active.parent().andSelf().addClass(options.selectedClass);
if (options.event) { if (options.event) {
this.element.bind((options.event) + ".accordion", clickHandler); this.element.bind((options.event) + ".accordion", clickHandler);
} }
@ -98,7 +98,7 @@ function completed(cancel) {
if (!$.data(this, "accordion")) { if (!$.data(this, "accordion")) {
return; return;
} }
var instance = $.data(this, "accordion"); var instance = $.data(this, "accordion");
var options = instance.options; var options = instance.options;
options.running = cancel ? 0 : --options.running; options.running = cancel ? 0 : --options.running;
@ -120,12 +120,12 @@ function toggle(toShow, toHide, data, clickedActive, down) {
options.toHide = toHide; options.toHide = toHide;
options.data = data; options.data = data;
var complete = scopeCallback(completed, this); var complete = scopeCallback(completed, this);
$.data(this, "accordion")._trigger("changestart", null, options.data); $.data(this, "accordion")._trigger("changestart", null, options.data);
// count elements to animate // count elements to animate
options.running = toHide.size() === 0 ? toShow.size() : toHide.size(); options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
if ( options.animated ) { if ( options.animated ) {
if ( !options.alwaysOpen && clickedActive ) { if ( !options.alwaysOpen && clickedActive ) {
$.ui.accordion.animations[options.animated]({ $.ui.accordion.animations[options.animated]({
@ -160,7 +160,7 @@ function clickHandler(event) {
if (options.disabled) { if (options.disabled) {
return false; return false;
} }
// called only when using activate(false) to close all parts programmatically // called only when using activate(false) to close all parts programmatically
if ( !event.target && !options.alwaysOpen ) { if ( !event.target && !options.alwaysOpen ) {
options.active.parent().andSelf().toggleClass(options.selectedClass); options.active.parent().andSelf().toggleClass(options.selectedClass);
@ -178,14 +178,14 @@ function clickHandler(event) {
} }
// get the click target // get the click target
var clicked = $(event.target); var clicked = $(event.target);
// due to the event delegation model, we have to check if one // due to the event delegation model, we have to check if one
// of the parent elements is our actual header, and find that // of the parent elements is our actual header, and find that
// otherwise stick with the initial target // otherwise stick with the initial target
clicked = $( clicked.parents(options.header)[0] || clicked ); clicked = $( clicked.parents(options.header)[0] || clicked );
var clickedActive = clicked[0] == options.active[0]; var clickedActive = clicked[0] == options.active[0];
// if animations are still active, or the active header is the target, ignore click // if animations are still active, or the active header is the target, ignore click
if (options.running || (options.alwaysOpen && clickedActive)) { if (options.running || (options.alwaysOpen && clickedActive)) {
return false; return false;
@ -193,13 +193,13 @@ function clickHandler(event) {
if (!clicked.is(options.header)) { if (!clicked.is(options.header)) {
return; return;
} }
// switch classes // switch classes
options.active.parent().andSelf().toggleClass(options.selectedClass); options.active.parent().andSelf().toggleClass(options.selectedClass);
if ( !clickedActive ) { if ( !clickedActive ) {
clicked.parent().andSelf().addClass(options.selectedClass); clicked.parent().andSelf().addClass(options.selectedClass);
} }
// find elements to show and hide // find elements to show and hide
var toShow = clicked.next(), var toShow = clicked.next(),
toHide = options.active.next(), toHide = options.active.next(),
@ -211,7 +211,7 @@ function clickHandler(event) {
oldContent: toHide oldContent: toHide
}, },
down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] ); down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
options.active = clickedActive ? $([]) : clicked; options.active = clickedActive ? $([]) : clicked;
toggle.call(this, toShow, toHide, data, clickedActive, down ); toggle.call(this, toShow, toHide, data, clickedActive, down );

View File

@ -4,7 +4,7 @@
* Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer * Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Autocomplete * http://docs.jquery.com/UI/Autocomplete
* *
* Depends: * Depends:
@ -13,7 +13,7 @@
(function($) { (function($) {
$.widget("ui.autocomplete", { $.widget("ui.autocomplete", {
_init: function() { _init: function() {
$.extend(this.options, { $.extend(this.options, {
@ -22,11 +22,11 @@ $.widget("ui.autocomplete", {
highlight: this.options.highlight || function(value) { return value; }, // if highlight is set to false, replace it with a do-nothing function highlight: this.options.highlight || function(value) { return value; }, // if highlight is set to false, replace it with a do-nothing function
formatMatch: this.options.formatMatch || this.options.formatItem // if the formatMatch option is not specified, then use formatItem for backwards compatibility formatMatch: this.options.formatMatch || this.options.formatItem // if the formatMatch option is not specified, then use formatItem for backwards compatibility
}); });
new $.Autocompleter(this.element[0], this.options); new $.Autocompleter(this.element[0], this.options);
}, },
result: function(handler) { result: function(handler) {
return this.element.bind("result", handler); return this.element.bind("result", handler);
}, },
@ -42,7 +42,7 @@ $.widget("ui.autocomplete", {
destroy: function() { destroy: function() {
return this.element.trigger("unautocomplete"); return this.element.trigger("unautocomplete");
} }
}); });
$.Autocompleter = function(input, options) { $.Autocompleter = function(input, options) {
@ -73,9 +73,9 @@ $.Autocompleter = function(input, options) {
mouseDownOnSelect: false mouseDownOnSelect: false
}; };
var select = $.Autocompleter.Select(options, input, selectCurrent, config); var select = $.Autocompleter.Select(options, input, selectCurrent, config);
var blockSubmit; var blockSubmit;
// prevent form submit in opera when selecting with return key // prevent form submit in opera when selecting with return key
$.browser.opera && $(input.form).bind("submit.autocomplete", function() { $.browser.opera && $(input.form).bind("submit.autocomplete", function() {
if (blockSubmit) { if (blockSubmit) {
@ -83,13 +83,13 @@ $.Autocompleter = function(input, options) {
return false; return false;
} }
}); });
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
// track last key pressed // track last key pressed
lastKeyPressCode = event.keyCode; lastKeyPressCode = event.keyCode;
switch(event.keyCode) { switch(event.keyCode) {
case KEY.UP: case KEY.UP:
event.preventDefault(); event.preventDefault();
if ( select.visible() ) { if ( select.visible() ) {
@ -98,7 +98,7 @@ $.Autocompleter = function(input, options) {
onChange(0, true); onChange(0, true);
} }
break; break;
case KEY.DOWN: case KEY.DOWN:
event.preventDefault(); event.preventDefault();
if ( select.visible() ) { if ( select.visible() ) {
@ -107,7 +107,7 @@ $.Autocompleter = function(input, options) {
onChange(0, true); onChange(0, true);
} }
break; break;
case KEY.PAGEUP: case KEY.PAGEUP:
event.preventDefault(); event.preventDefault();
if ( select.visible() ) { if ( select.visible() ) {
@ -116,7 +116,7 @@ $.Autocompleter = function(input, options) {
onChange(0, true); onChange(0, true);
} }
break; break;
case KEY.PAGEDOWN: case KEY.PAGEDOWN:
event.preventDefault(); event.preventDefault();
if ( select.visible() ) { if ( select.visible() ) {
@ -125,7 +125,7 @@ $.Autocompleter = function(input, options) {
onChange(0, true); onChange(0, true);
} }
break; break;
// matches also semicolon // matches also semicolon
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB: case KEY.TAB:
@ -137,11 +137,11 @@ $.Autocompleter = function(input, options) {
return false; return false;
} }
break; break;
case KEY.ESC: case KEY.ESC:
select.hide(); select.hide();
break; break;
default: default:
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay); timeout = setTimeout(onChange, options.delay);
@ -192,16 +192,16 @@ $.Autocompleter = function(input, options) {
$input.unbind(); $input.unbind();
$(input.form).unbind(".autocomplete"); $(input.form).unbind(".autocomplete");
}); });
function selectCurrent() { function selectCurrent() {
var selected = select.selected(); var selected = select.selected();
if( !selected ) if( !selected )
return false; return false;
var v = selected.result; var v = selected.result;
previousValue = v; previousValue = v;
if ( options.multiple ) { if ( options.multiple ) {
var words = trimWords($input.val()); var words = trimWords($input.val());
if ( words.length > 1 ) { if ( words.length > 1 ) {
@ -209,26 +209,26 @@ $.Autocompleter = function(input, options) {
} }
v += options.multipleSeparator; v += options.multipleSeparator;
} }
$input.val(v); $input.val(v);
hideResultsNow(); hideResultsNow();
$input.trigger("result", [selected.data, selected.value]); $input.trigger("result", [selected.data, selected.value]);
return true; return true;
} }
function onChange(crap, skipPrevCheck) { function onChange(crap, skipPrevCheck) {
if( lastKeyPressCode == KEY.DEL ) { if( lastKeyPressCode == KEY.DEL ) {
select.hide(); select.hide();
return; return;
} }
var currentValue = $input.val(); var currentValue = $input.val();
if ( !skipPrevCheck && currentValue == previousValue ) if ( !skipPrevCheck && currentValue == previousValue )
return; return;
previousValue = currentValue; previousValue = currentValue;
currentValue = lastWord(currentValue); currentValue = lastWord(currentValue);
if ( currentValue.length >= options.minChars) { if ( currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass); $input.addClass(options.loadingClass);
@ -240,7 +240,7 @@ $.Autocompleter = function(input, options) {
select.hide(); select.hide();
} }
}; };
function trimWords(value) { function trimWords(value) {
if ( !value ) { if ( !value ) {
return [""]; return [""];
@ -253,14 +253,14 @@ $.Autocompleter = function(input, options) {
}); });
return result; return result;
} }
function lastWord(value) { function lastWord(value) {
if ( !options.multiple ) if ( !options.multiple )
return value; return value;
var words = trimWords(value); var words = trimWords(value);
return words[words.length - 1]; return words[words.length - 1];
} }
// fills in the input box w/the first match (assumed to be the best match) // fills in the input box w/the first match (assumed to be the best match)
// q: the term entered // q: the term entered
// sValue: the first matching result // sValue: the first matching result
@ -324,16 +324,16 @@ $.Autocompleter = function(input, options) {
if (data && data.length) { if (data && data.length) {
success(term, data); success(term, data);
// if an AJAX url has been supplied, try loading the data now // if an AJAX url has been supplied, try loading the data now
} else if( (typeof options.url == "string") && (options.url.length > 0) ){ } else if( (typeof options.url == "string") && (options.url.length > 0) ){
var extraParams = { var extraParams = {
timestamp: +new Date() timestamp: +new Date()
}; };
$.each(options.extraParams, function(key, param) { $.each(options.extraParams, function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param; extraParams[key] = typeof param == "function" ? param() : param;
}); });
$.ajax({ $.ajax({
// try to leverage ajaxQueue plugin to abort previous requests // try to leverage ajaxQueue plugin to abort previous requests
mode: "abort", mode: "abort",
@ -365,7 +365,7 @@ $.Autocompleter = function(input, options) {
failure(term); failure(term);
} }
}; };
function parse(data) { function parse(data) {
var parsed = []; var parsed = [];
var rows = data.split("\n"); var rows = data.split("\n");
@ -424,25 +424,25 @@ $.Autocompleter.Cache = function(options) {
var data = {}; var data = {};
var length = 0; var length = 0;
function matchSubset(s, sub) { function matchSubset(s, sub) {
if (!options.matchCase) if (!options.matchCase)
s = s.toLowerCase(); s = s.toLowerCase();
var i = s.indexOf(sub); var i = s.indexOf(sub);
if (i == -1) return false; if (i == -1) return false;
return i == 0 || options.matchContains; return i == 0 || options.matchContains;
}; };
function add(q, value) { function add(q, value) {
if (length > options.cacheLength){ if (length > options.cacheLength){
flush(); flush();
} }
if (!data[q]){ if (!data[q]){
length++; length++;
} }
data[q] = value; data[q] = value;
} }
function populate(){ function populate(){
if( !options.data ) return false; if( !options.data ) return false;
// track the matches // track the matches
@ -451,23 +451,23 @@ $.Autocompleter.Cache = function(options) {
// no url was specified, we need to adjust the cache length to make sure it fits the local data store // no url was specified, we need to adjust the cache length to make sure it fits the local data store
if( !options.url ) options.cacheLength = 1; if( !options.url ) options.cacheLength = 1;
// track all options for minChars = 0 // track all options for minChars = 0
stMatchSets[""] = []; stMatchSets[""] = [];
// loop through the array and create a lookup structure // loop through the array and create a lookup structure
for ( var i = 0, ol = options.data.length; i < ol; i++ ) { for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
var rawValue = options.data[i]; var rawValue = options.data[i];
// if rawValue is a string, make an array otherwise just reference the array // if rawValue is a string, make an array otherwise just reference the array
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
var value = options.formatMatch(rawValue, i+1, options.data.length); var value = options.formatMatch(rawValue, i+1, options.data.length);
if ( value === false ) if ( value === false )
continue; continue;
var firstChar = value.charAt(0).toLowerCase(); var firstChar = value.charAt(0).toLowerCase();
// if no lookup array for this character exists, look it up now // if no lookup array for this character exists, look it up now
if( !stMatchSets[firstChar] ) if( !stMatchSets[firstChar] )
stMatchSets[firstChar] = []; stMatchSets[firstChar] = [];
// if the match is a string // if the match is a string
@ -476,7 +476,7 @@ $.Autocompleter.Cache = function(options) {
data: rawValue, data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value result: options.formatResult && options.formatResult(rawValue) || value
}; };
// push the current match into the set list // push the current match into the set list
stMatchSets[firstChar].push(row); stMatchSets[firstChar].push(row);
@ -494,15 +494,15 @@ $.Autocompleter.Cache = function(options) {
add(i, value); add(i, value);
}); });
} }
// populate any existing data // populate any existing data
setTimeout(populate, 25); setTimeout(populate, 25);
function flush(){ function flush(){
data = {}; data = {};
length = 0; length = 0;
} }
return { return {
flush: flush, flush: flush,
add: add, add: add,
@ -510,7 +510,7 @@ $.Autocompleter.Cache = function(options) {
load: function(q) { load: function(q) {
if (!options.cacheLength || !length) if (!options.cacheLength || !length)
return null; return null;
/* /*
* if dealing w/local data and matchContains than we must make sure * if dealing w/local data and matchContains than we must make sure
* to loop through all the data collections looking for matches * to loop through all the data collections looking for matches
*/ */
@ -530,9 +530,9 @@ $.Autocompleter.Cache = function(options) {
} }
}); });
} }
} }
return csub; return csub;
} else } else
// if the exact item exists, use it // if the exact item exists, use it
if (data[q]){ if (data[q]){
return data[q]; return data[q];
@ -560,7 +560,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
var CLASSES = { var CLASSES = {
ACTIVE: "ui-autocomplete-over" ACTIVE: "ui-autocomplete-over"
}; };
var listItems, var listItems,
active = -1, active = -1,
data, data,
@ -568,7 +568,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
needsInit = true, needsInit = true,
element, element,
list; list;
// Create results // Create results
function init() { function init() {
if (!needsInit) if (!needsInit)
@ -578,11 +578,11 @@ $.Autocompleter.Select = function (options, input, select, config) {
.addClass(options.resultsClass) .addClass(options.resultsClass)
.css("position", "absolute") .css("position", "absolute")
.appendTo(document.body); .appendTo(document.body);
list = $("<ul/>").appendTo(element).mouseover( function(event) { list = $("<ul/>").appendTo(element).mouseover( function(event) {
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE); $(target(event)).addClass(CLASSES.ACTIVE);
} }
}).click(function(event) { }).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE); $(target(event)).addClass(CLASSES.ACTIVE);
@ -595,13 +595,13 @@ $.Autocompleter.Select = function (options, input, select, config) {
}).mouseup(function() { }).mouseup(function() {
config.mouseDownOnSelect = false; config.mouseDownOnSelect = false;
}); });
if( options.width > 0 ) if( options.width > 0 )
element.css("width", options.width); element.css("width", options.width);
needsInit = false; needsInit = false;
} }
function target(event) { function target(event) {
var element = event.target; var element = event.target;
while(element && element.tagName != "LI") while(element && element.tagName != "LI")
@ -628,7 +628,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
} }
} }
}; };
function movePosition(step) { function movePosition(step) {
active += step; active += step;
if (active < 0) { if (active < 0) {
@ -637,13 +637,13 @@ $.Autocompleter.Select = function (options, input, select, config) {
active = 0; active = 0;
} }
} }
function limitNumberOfItems(available) { function limitNumberOfItems(available) {
return options.max && options.max < available return options.max && options.max < available
? options.max ? options.max
: available; : available;
} }
function fillList() { function fillList() {
list.empty(); list.empty();
var max = limitNumberOfItems(data.length); var max = limitNumberOfItems(data.length);
@ -665,7 +665,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
if ( $.fn.bgiframe ) if ( $.fn.bgiframe )
list.bgiframe(); list.bgiframe();
} }
return { return {
display: function(d, q) { display: function(d, q) {
init(); init();
@ -712,14 +712,14 @@ $.Autocompleter.Select = function (options, input, select, config) {
top: offset.top + input.offsetHeight, top: offset.top + input.offsetHeight,
left: offset.left left: offset.left
}).show(); }).show();
if(options.scroll) { if(options.scroll) {
list.scrollTop(0); list.scrollTop(0);
list.css({ list.css({
maxHeight: options.scrollHeight, maxHeight: options.scrollHeight,
overflow: 'auto' overflow: 'auto'
}); });
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0; var listHeight = 0;
listItems.each(function() { listItems.each(function() {
@ -732,11 +732,11 @@ $.Autocompleter.Select = function (options, input, select, config) {
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
} }
} }
} }
$(input).triggerHandler("autocompleteshow", [{}, { options: options }], options["show"]); $(input).triggerHandler("autocompleteshow", [{}, { options: options }], options["show"]);
}, },
selected: function() { selected: function() {
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);

View File

@ -22,13 +22,13 @@ function isVisible(element) {
var style = element.style; var style = element.style;
return (style.display != 'none' && style.visibility != 'hidden'); return (style.display != 'none' && style.visibility != 'hidden');
} }
var visible = checkStyles(element); var visible = checkStyles(element);
(visible && $.each($.dir(element, 'parentNode'), function() { (visible && $.each($.dir(element, 'parentNode'), function() {
return (visible = checkStyles(this)); return (visible = checkStyles(this));
})); }));
return visible; return visible;
} }
@ -36,25 +36,25 @@ $.extend($.expr[':'], {
data: function(a, i, m) { data: function(a, i, m) {
return $.data(a, m[3]); return $.data(a, m[3]);
}, },
// TODO: add support for object, area // TODO: add support for object, area
tabbable: function(a, i, m) { tabbable: function(a, i, m) {
var nodeName = a.nodeName.toLowerCase(); var nodeName = a.nodeName.toLowerCase();
return ( return (
// in tab order // in tab order
a.tabIndex >= 0 && a.tabIndex >= 0 &&
( // filter node types that participate in the tab order ( // filter node types that participate in the tab order
// anchor tag // anchor tag
('a' == nodeName && a.href) || ('a' == nodeName && a.href) ||
// enabled form element // enabled form element
(/input|select|textarea|button/.test(nodeName) && (/input|select|textarea|button/.test(nodeName) &&
'hidden' != a.type && !a.disabled) 'hidden' != a.type && !a.disabled)
) && ) &&
// visible on page // visible on page
isVisible(a) isVisible(a)
); );
@ -98,7 +98,7 @@ function getter(namespace, plugin, method, args) {
var methods = $[namespace][plugin][type] || []; var methods = $[namespace][plugin][type] || [];
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
} }
var methods = getMethods('getter'); var methods = getMethods('getter');
if (args.length == 1 && typeof args[0] == 'string') { if (args.length == 1 && typeof args[0] == 'string') {
methods = methods.concat(getMethods('getterSetter')); methods = methods.concat(getMethods('getterSetter'));
@ -109,52 +109,52 @@ function getter(namespace, plugin, method, args) {
$.widget = function(name, prototype) { $.widget = function(name, prototype) {
var namespace = name.split(".")[0]; var namespace = name.split(".")[0];
name = name.split(".")[1]; name = name.split(".")[1];
// create plugin method // create plugin method
$.fn[name] = function(options) { $.fn[name] = function(options) {
var isMethodCall = (typeof options == 'string'), var isMethodCall = (typeof options == 'string'),
args = Array.prototype.slice.call(arguments, 1); args = Array.prototype.slice.call(arguments, 1);
// prevent calls to internal methods // prevent calls to internal methods
if (isMethodCall && options.substring(0, 1) == '_') { if (isMethodCall && options.substring(0, 1) == '_') {
return this; return this;
} }
// handle getter methods // handle getter methods
if (isMethodCall && getter(namespace, name, options, args)) { if (isMethodCall && getter(namespace, name, options, args)) {
var instance = $.data(this[0], name); var instance = $.data(this[0], name);
return (instance ? instance[options].apply(instance, args) return (instance ? instance[options].apply(instance, args)
: undefined); : undefined);
} }
// handle initialization and non-getter methods // handle initialization and non-getter methods
return this.each(function() { return this.each(function() {
var instance = $.data(this, name); var instance = $.data(this, name);
// constructor // constructor
(!instance && !isMethodCall && (!instance && !isMethodCall &&
$.data(this, name, new $[namespace][name](this, options))); $.data(this, name, new $[namespace][name](this, options)));
// method call // method call
(instance && isMethodCall && $.isFunction(instance[options]) && (instance && isMethodCall && $.isFunction(instance[options]) &&
instance[options].apply(instance, args)); instance[options].apply(instance, args));
}); });
}; };
// create widget constructor // create widget constructor
$[namespace][name] = function(element, options) { $[namespace][name] = function(element, options) {
var self = this; var self = this;
this.widgetName = name; this.widgetName = name;
this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
this.widgetBaseClass = namespace + '-' + name; this.widgetBaseClass = namespace + '-' + name;
this.options = $.extend({}, this.options = $.extend({},
$.widget.defaults, $.widget.defaults,
$[namespace][name].defaults, $[namespace][name].defaults,
$.metadata && $.metadata.get(element)[name], $.metadata && $.metadata.get(element)[name],
options); options);
this.element = $(element) this.element = $(element)
.bind('setData.' + name, function(e, key, value) { .bind('setData.' + name, function(e, key, value) {
return self._setData(key, value); return self._setData(key, value);
@ -165,13 +165,13 @@ $.widget = function(name, prototype) {
.bind('remove', function() { .bind('remove', function() {
return self.destroy(); return self.destroy();
}); });
this._init(); this._init();
}; };
// add widget prototype // add widget prototype
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
// TODO: merge getter and getterSetter properties from widget prototype // TODO: merge getter and getterSetter properties from widget prototype
// and plugin prototype // and plugin prototype
$[namespace][name].getterSetter = 'option'; $[namespace][name].getterSetter = 'option';
@ -182,11 +182,11 @@ $.widget.prototype = {
destroy: function() { destroy: function() {
this.element.removeData(this.widgetName); this.element.removeData(this.widgetName);
}, },
option: function(key, value) { option: function(key, value) {
var options = key, var options = key,
self = this; self = this;
if (typeof key == "string") { if (typeof key == "string") {
if (value === undefined) { if (value === undefined) {
return this._getData(key); return this._getData(key);
@ -194,7 +194,7 @@ $.widget.prototype = {
options = {}; options = {};
options[key] = value; options[key] = value;
} }
$.each(options, function(key, value) { $.each(options, function(key, value) {
self._setData(key, value); self._setData(key, value);
}); });
@ -204,20 +204,20 @@ $.widget.prototype = {
}, },
_setData: function(key, value) { _setData: function(key, value) {
this.options[key] = value; this.options[key] = value;
if (key == 'disabled') { if (key == 'disabled') {
this.element[value ? 'addClass' : 'removeClass']( this.element[value ? 'addClass' : 'removeClass'](
this.widgetBaseClass + '-disabled'); this.widgetBaseClass + '-disabled');
} }
}, },
enable: function() { enable: function() {
this._setData('disabled', false); this._setData('disabled', false);
}, },
disable: function() { disable: function() {
this._setData('disabled', true); this._setData('disabled', true);
}, },
_trigger: function(type, e, data) { _trigger: function(type, e, data) {
var eventName = (type == this.widgetEventPrefix var eventName = (type == this.widgetEventPrefix
? type : this.widgetEventPrefix + type); ? type : this.widgetEventPrefix + type);
@ -245,26 +245,26 @@ $.ui = {
call: function(instance, name, args) { call: function(instance, name, args) {
var set = instance.plugins[name]; var set = instance.plugins[name];
if(!set) { return; } if(!set) { return; }
for (var i = 0; i < set.length; i++) { for (var i = 0; i < set.length; i++) {
if (instance.options[set[i][0]]) { if (instance.options[set[i][0]]) {
set[i][1].apply(instance.element, args); set[i][1].apply(instance.element, args);
} }
} }
} }
}, },
cssCache: {}, cssCache: {},
css: function(name) { css: function(name) {
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
//if (!$.browser.safari) //if (!$.browser.safari)
//tmp.appendTo('body'); //tmp.appendTo('body');
//Opera and Safari set width and height to 0px instead of auto //Opera and Safari set width and height to 0px instead of auto
//Safari returns rgba(0,0,0,0) when bgcolor is not set //Safari returns rgba(0,0,0,0) when bgcolor is not set
$.ui.cssCache[name] = !!( $.ui.cssCache[name] = !!(
(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
); );
try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
@ -283,15 +283,15 @@ $.ui = {
.unbind('selectstart.ui'); .unbind('selectstart.ui');
}, },
hasScroll: function(e, a) { hasScroll: function(e, a) {
//If overflow is hidden, the element might have extra content, but the user wants to hide it //If overflow is hidden, the element might have extra content, but the user wants to hide it
if ($(e).css('overflow') == 'hidden') { return false; } if ($(e).css('overflow') == 'hidden') { return false; }
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
has = false; has = false;
if (e[scroll] > 0) { return true; } if (e[scroll] > 0) { return true; }
// TODO: determine which cases actually cause this to happen // TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to // if the element doesn't have the scroll set, see if it's possible to
// set the scroll // set the scroll
@ -308,50 +308,50 @@ $.ui = {
$.ui.mouse = { $.ui.mouse = {
_mouseInit: function() { _mouseInit: function() {
var self = this; var self = this;
this.element.bind('mousedown.'+this.widgetName, function(e) { this.element.bind('mousedown.'+this.widgetName, function(e) {
return self._mouseDown(e); return self._mouseDown(e);
}); });
// Prevent text selection in IE // Prevent text selection in IE
if ($.browser.msie) { if ($.browser.msie) {
this._mouseUnselectable = this.element.attr('unselectable'); this._mouseUnselectable = this.element.attr('unselectable');
this.element.attr('unselectable', 'on'); this.element.attr('unselectable', 'on');
} }
this.started = false; this.started = false;
}, },
// TODO: make sure destroying one instance of mouse doesn't mess with // TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse // other instances of mouse
_mouseDestroy: function() { _mouseDestroy: function() {
this.element.unbind('.'+this.widgetName); this.element.unbind('.'+this.widgetName);
// Restore text selection in IE // Restore text selection in IE
($.browser.msie ($.browser.msie
&& this.element.attr('unselectable', this._mouseUnselectable)); && this.element.attr('unselectable', this._mouseUnselectable));
}, },
_mouseDown: function(e) { _mouseDown: function(e) {
// we may have missed mouseup (out of window) // we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(e)); (this._mouseStarted && this._mouseUp(e));
this._mouseDownEvent = e; this._mouseDownEvent = e;
var self = this, var self = this,
btnIsLeft = (e.which == 1), btnIsLeft = (e.which == 1),
elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false); elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) { if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
return true; return true;
} }
this.mouseDelayMet = !this.options.delay; this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) { if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() { this._mouseDelayTimer = setTimeout(function() {
self.mouseDelayMet = true; self.mouseDelayMet = true;
}, this.options.delay); }, this.options.delay);
} }
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
this._mouseStarted = (this._mouseStart(e) !== false); this._mouseStarted = (this._mouseStart(e) !== false);
if (!this._mouseStarted) { if (!this._mouseStarted) {
@ -359,7 +359,7 @@ $.ui.mouse = {
return true; return true;
} }
} }
// these delegates are required to keep context // these delegates are required to keep context
this._mouseMoveDelegate = function(e) { this._mouseMoveDelegate = function(e) {
return self._mouseMove(e); return self._mouseMove(e);
@ -370,43 +370,43 @@ $.ui.mouse = {
$(document) $(document)
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate); .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
return false; return false;
}, },
_mouseMove: function(e) { _mouseMove: function(e) {
// IE mouseup check - mouseup happened when mouse was out of window // IE mouseup check - mouseup happened when mouse was out of window
if ($.browser.msie && !e.button) { if ($.browser.msie && !e.button) {
return this._mouseUp(e); return this._mouseUp(e);
} }
if (this._mouseStarted) { if (this._mouseStarted) {
this._mouseDrag(e); this._mouseDrag(e);
return false; return false;
} }
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
this._mouseStarted = this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, e) !== false); (this._mouseStart(this._mouseDownEvent, e) !== false);
(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e)); (this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
} }
return !this._mouseStarted; return !this._mouseStarted;
}, },
_mouseUp: function(e) { _mouseUp: function(e) {
$(document) $(document)
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
if (this._mouseStarted) { if (this._mouseStarted) {
this._mouseStarted = false; this._mouseStarted = false;
this._mouseStop(e); this._mouseStop(e);
} }
return false; return false;
}, },
_mouseDistanceMet: function(e) { _mouseDistanceMet: function(e) {
return (Math.max( return (Math.max(
Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageX - e.pageX),
@ -414,11 +414,11 @@ $.ui.mouse = {
) >= this.options.distance ) >= this.options.distance
); );
}, },
_mouseDelayMet: function(e) { _mouseDelayMet: function(e) {
return this.mouseDelayMet; return this.mouseDelayMet;
}, },
// These are placeholder methods, to be overriden by extending plugin // These are placeholder methods, to be overriden by extending plugin
_mouseStart: function(e) {}, _mouseStart: function(e) {},
_mouseDrag: function(e) {}, _mouseDrag: function(e) {},

View File

@ -4,7 +4,7 @@
* Copyright (c) 2006, 2007, 2008 Marc Grabanski * Copyright (c) 2006, 2007, 2008 Marc Grabanski
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Datepicker * http://docs.jquery.com/UI/Datepicker
* *
* Depends: * Depends:
@ -12,7 +12,7 @@
* *
* Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au). * Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).
*/ */
(function($) { // hide the namespace (function($) { // hide the namespace
var PROP_NAME = 'datepicker'; var PROP_NAME = 'datepicker';
@ -101,7 +101,7 @@ function Datepicker() {
calculateWeek: this.iso8601Week, // How to calculate the week of the year, calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it // takes a Date and returns the number of the week for it
shortYearCutoff: '+10', // Short year values < this are in the current century, shortYearCutoff: '+10', // Short year values < this are in the current century,
// > this are in the previous century, // > this are in the previous century,
// string value starting with '+' for current year + value // string value starting with '+' for current year + value
showStatus: false, // True to show status bar at bottom, false to not show it showStatus: false, // True to show status bar at bottom, false to not show it
statusForDate: this.dateStatus, // Function to provide status text for a date - statusForDate: this.dateStatus, // Function to provide status text for a date -
@ -110,7 +110,7 @@ function Datepicker() {
maxDate: null, // The latest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit
duration: 'normal', // Duration of display/closure duration: 'normal', // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
// [2] = cell title (optional), e.g. $.datepicker.noWeekends // [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow: null, // Function that takes an input field and beforeShow: null, // Function that takes an input field and
// returns a set of custom settings for the date picker // returns a set of custom settings for the date picker
@ -139,8 +139,8 @@ $.extend(Datepicker.prototype, {
if (this.debug) if (this.debug)
console.log.apply('', arguments); console.log.apply('', arguments);
}, },
/* Override the default settings for all instances of the date picker. /* Override the default settings for all instances of the date picker.
@param settings object - the new settings to use as defaults (anonymous object) @param settings object - the new settings to use as defaults (anonymous object)
@return the manager object */ @return the manager object */
setDefaults: function(settings) { setDefaults: function(settings) {
@ -170,7 +170,7 @@ $.extend(Datepicker.prototype, {
if (!target.id) if (!target.id)
target.id = 'dp' + (++this.uuid); target.id = 'dp' + (++this.uuid);
var inst = this._newInst($(target), inline); var inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {}, inlineSettings || {}); inst.settings = $.extend({}, settings || {}, inlineSettings || {});
if (nodeName == 'input') { if (nodeName == 'input') {
this._connectDatepicker(target, inst); this._connectDatepicker(target, inst);
} else if (inline) { } else if (inline) {
@ -204,7 +204,7 @@ $.extend(Datepicker.prototype, {
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
var buttonText = this._get(inst, 'buttonText'); var buttonText = this._get(inst, 'buttonText');
var buttonImage = this._get(inst, 'buttonImage'); var buttonImage = this._get(inst, 'buttonImage');
var trigger = $(this._get(inst, 'buttonImageOnly') ? var trigger = $(this._get(inst, 'buttonImageOnly') ?
$('<img/>').addClass(this._triggerClass). $('<img/>').addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) : attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
$('<button type="button"></button>').addClass(this._triggerClass). $('<button type="button"></button>').addClass(this._triggerClass).
@ -248,7 +248,7 @@ $.extend(Datepicker.prototype, {
_inlineShow: function(inst) { _inlineShow: function(inst) {
var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers
inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width()); inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width());
}, },
/* Pop-up the date picker in a "dialog" box. /* Pop-up the date picker in a "dialog" box.
@param input element - ignored @param input element - ignored
@ -458,7 +458,7 @@ $.extend(Datepicker.prototype, {
_getDateDatepicker: function(target) { _getDateDatepicker: function(target) {
var inst = this._getInst(target); var inst = this._getInst(target);
if (inst && !inst.inline) if (inst && !inst.inline)
this._setDateFromField(inst); this._setDateFromField(inst);
return (inst ? this._getDate(inst) : null); return (inst ? this._getDate(inst) : null);
}, },
@ -626,7 +626,7 @@ $.extend(Datepicker.prototype, {
offset.top -= (isFixed ? scrollY : 0); offset.top -= (isFixed ? scrollY : 0);
return offset; return offset;
}, },
/* Find an object's position on the screen. */ /* Find an object's position on the screen. */
_findPos: function(obj) { _findPos: function(obj) {
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
@ -767,7 +767,7 @@ $.extend(Datepicker.prototype, {
if (inst.stayOpen) { if (inst.stayOpen) {
$('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass); $('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass);
$(td).addClass(this._currentClass); $(td).addClass(this._currentClass);
} }
} }
inst.selectedDay = inst.currentDay = $('a', td).html(); inst.selectedDay = inst.currentDay = $('a', td).html();
inst.selectedMonth = inst.currentMonth = month; inst.selectedMonth = inst.currentMonth = month;
@ -833,7 +833,7 @@ $.extend(Datepicker.prototype, {
this._lastInput = null; this._lastInput = null;
} }
}, },
/* Update any alternate field to synchronise with the main field. */ /* Update any alternate field to synchronise with the main field. */
_updateAlternate: function(inst) { _updateAlternate: function(inst) {
var altField = this._get(inst, 'altField'); var altField = this._get(inst, 'altField');
@ -856,7 +856,7 @@ $.extend(Datepicker.prototype, {
var day = date.getDay(); var day = date.getDay();
return [(day > 0 && day < 6), '']; return [(day > 0 && day < 6), ''];
}, },
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
@param date Date - the date to get the week for @param date Date - the date to get the week for
@return number - the number of the week within the year that contains this date */ @return number - the number of the week within the year that contains this date */
@ -877,7 +877,7 @@ $.extend(Datepicker.prototype, {
} }
return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
}, },
/* Provide status text for a particular date. /* Provide status text for a particular date.
@param date the date to get the status for @param date the date to get the status for
@param inst the current datepicker instance @param inst the current datepicker instance
@ -920,7 +920,7 @@ $.extend(Datepicker.prototype, {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches) if (matches)
iFormat++; iFormat++;
return matches; return matches;
}; };
// Extract a number from the string value // Extract a number from the string value
var getNumber = function(match) { var getNumber = function(match) {
@ -972,17 +972,17 @@ $.extend(Datepicker.prototype, {
case 'd': case 'd':
day = getNumber('d'); day = getNumber('d');
break; break;
case 'D': case 'D':
getName('D', dayNamesShort, dayNames); getName('D', dayNamesShort, dayNames);
break; break;
case 'o': case 'o':
doy = getNumber('o'); doy = getNumber('o');
break; break;
case 'm': case 'm':
month = getNumber('m'); month = getNumber('m');
break; break;
case 'M': case 'M':
month = getName('M', monthNamesShort, monthNames); month = getName('M', monthNamesShort, monthNames);
break; break;
case 'y': case 'y':
year = getNumber('y'); year = getNumber('y');
@ -1074,7 +1074,7 @@ $.extend(Datepicker.prototype, {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches) if (matches)
iFormat++; iFormat++;
return matches; return matches;
}; };
// Format a number, with leading zero if necessary // Format a number, with leading zero if necessary
var formatNumber = function(match, value, len) { var formatNumber = function(match, value, len) {
@ -1102,7 +1102,7 @@ $.extend(Datepicker.prototype, {
case 'd': case 'd':
output += formatNumber('d', date.getDate(), 2); output += formatNumber('d', date.getDate(), 2);
break; break;
case 'D': case 'D':
output += formatName('D', date.getDay(), dayNamesShort, dayNames); output += formatName('D', date.getDay(), dayNamesShort, dayNames);
break; break;
case 'o': case 'o':
@ -1111,18 +1111,18 @@ $.extend(Datepicker.prototype, {
doy += this._getDaysInMonth(date.getFullYear(), m); doy += this._getDaysInMonth(date.getFullYear(), m);
output += formatNumber('o', doy, 3); output += formatNumber('o', doy, 3);
break; break;
case 'm': case 'm':
output += formatNumber('m', date.getMonth() + 1, 2); output += formatNumber('m', date.getMonth() + 1, 2);
break; break;
case 'M': case 'M':
output += formatName('M', date.getMonth(), monthNamesShort, monthNames); output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
break; break;
case 'y': case 'y':
output += (lookAhead('y') ? date.getFullYear() : output += (lookAhead('y') ? date.getFullYear() :
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
break; break;
case '@': case '@':
output += date.getTime(); output += date.getTime();
break; break;
case "'": case "'":
if (lookAhead("'")) if (lookAhead("'"))
@ -1150,7 +1150,7 @@ $.extend(Datepicker.prototype, {
else else
switch (format.charAt(iFormat)) { switch (format.charAt(iFormat)) {
case 'd': case 'm': case 'y': case '@': case 'd': case 'm': case 'y': case '@':
chars += '0123456789'; chars += '0123456789';
break; break;
case 'D': case 'M': case 'D': case 'M':
return null; // Accept anything return null; // Accept anything
@ -1175,7 +1175,7 @@ $.extend(Datepicker.prototype, {
/* Parse existing date and initialise date picker. */ /* Parse existing date and initialise date picker. */
_setDateFromField: function(inst) { _setDateFromField: function(inst) {
var dateFormat = this._get(inst, 'dateFormat'); var dateFormat = this._get(inst, 'dateFormat');
var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null; var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null;
inst.endDay = inst.endMonth = inst.endYear = null; inst.endDay = inst.endMonth = inst.endYear = null;
var date = defaultDate = this._getDefaultDate(inst); var date = defaultDate = this._getDefaultDate(inst);
if (dates.length > 0) { if (dates.length > 0) {
@ -1201,7 +1201,7 @@ $.extend(Datepicker.prototype, {
inst.currentYear = (dates[0] ? date.getFullYear() : 0); inst.currentYear = (dates[0] ? date.getFullYear() : 0);
this._adjustInstDate(inst); this._adjustInstDate(inst);
}, },
/* Retrieve the default date shown on opening. */ /* Retrieve the default date shown on opening. */
_getDefaultDate: function(inst) { _getDefaultDate: function(inst) {
var date = this._determineDate(this._get(inst, 'defaultDate'), new Date()); var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
@ -1233,7 +1233,7 @@ $.extend(Datepicker.prototype, {
case 'w' : case 'W' : case 'w' : case 'W' :
day += parseInt(matches[1],10) * 7; break; day += parseInt(matches[1],10) * 7; break;
case 'm' : case 'M' : case 'm' : case 'M' :
month += parseInt(matches[1],10); month += parseInt(matches[1],10);
day = Math.min(day, getDaysInMonth(year, month)); day = Math.min(day, getDaysInMonth(year, month));
break; break;
case 'y': case 'Y' : case 'y': case 'Y' :
@ -1348,7 +1348,7 @@ $.extend(Datepicker.prototype, {
var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : ''); var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : '');
prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate( prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate(
prevBigText, new Date(drawYear, drawMonth - stepBigMonths, 1), this._getFormatConfig(inst))); prevBigText, new Date(drawYear, drawMonth - stepBigMonths, 1), this._getFormatConfig(inst)));
var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
(showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepBigMonths + ', \'M\');"' + (showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepBigMonths + ', \'M\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') + this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') +
'<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
@ -1367,7 +1367,7 @@ $.extend(Datepicker.prototype, {
this._addStatus(showStatus, inst.id, this._get(inst, 'nextBigStatus'), initStatus) + '>' + nextBigText + '</a>' : '') : this._addStatus(showStatus, inst.id, this._get(inst, 'nextBigStatus'), initStatus) + '>' + nextBigText + '</a>' : '') :
(hideIfNoPrevNext ? '' : '<label>' + nextText + '</label><label>' + nextBigText + '</label>')) + '</div>'; (hideIfNoPrevNext ? '' : '<label>' + nextText + '</label><label>' + nextBigText + '</label>')) + '</div>';
var currentText = this._get(inst, 'currentText'); var currentText = this._get(inst, 'currentText');
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText : currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') + var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') +
@ -1398,7 +1398,7 @@ $.extend(Datepicker.prototype, {
html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' + html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
selectedDate, row > 0 || col > 0, showStatus, initStatus, monthNames) + // draw month headers selectedDate, row > 0 || col > 0, showStatus, initStatus, monthNames) + // draw month headers
'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' + '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' +
'<tr class="ui-datepicker-title-row">' + '<tr class="ui-datepicker-title-row">' +
(showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' + (showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
this._get(inst, 'weekHeader') + '</td>' : ''); this._get(inst, 'weekHeader') + '</td>' : '');
@ -1408,7 +1408,7 @@ $.extend(Datepicker.prototype, {
status.replace(/D/, dayNamesShort[day])); status.replace(/D/, dayNamesShort[day]));
html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' + html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
(!changeFirstDay ? '<span' : (!changeFirstDay ? '<span' :
'<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') + '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') +
this._addStatus(showStatus, inst.id, dayStatus, initStatus) + ' title="' + dayNames[day] + '">' + this._addStatus(showStatus, inst.id, dayStatus, initStatus) + ' title="' + dayNames[day] + '">' +
dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>'; dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
} }
@ -1470,15 +1470,15 @@ $.extend(Datepicker.prototype, {
} }
html += '</tbody></table></div>'; html += '</tbody></table></div>';
} }
html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id +
'" class="ui-datepicker-status">' + initStatus + '</div>' : '') + '" class="ui-datepicker-status">' + initStatus + '</div>' : '') +
(!closeAtTop && !inst.inline ? controls : '') + (!closeAtTop && !inst.inline ? controls : '') +
'<div style="clear: both;"></div>' + '<div style="clear: both;"></div>' +
($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : ''); '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
return html; return html;
}, },
/* Generate the month and year header. */ /* Generate the month and year header. */
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
selectedDate, secondary, showStatus, initStatus, monthNames) { selectedDate, secondary, showStatus, initStatus, monthNames) {
@ -1579,7 +1579,7 @@ $.extend(Datepicker.prototype, {
onChange.apply((inst.input ? inst.input[0] : null), onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]); [inst.selectedYear, inst.selectedMonth + 1, inst]);
}, },
/* Determine the number of months to show. */ /* Determine the number of months to show. */
_getNumberOfMonths: function(inst) { _getNumberOfMonths: function(inst) {
var numMonths = this._get(inst, 'numberOfMonths'); var numMonths = this._get(inst, 'numberOfMonths');
@ -1628,7 +1628,7 @@ $.extend(Datepicker.prototype, {
var maxDate = this._getMinMaxDate(inst, 'max'); var maxDate = this._getMinMaxDate(inst, 'max');
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
}, },
/* Provide the configuration settings for formatting/parsing. */ /* Provide the configuration settings for formatting/parsing. */
_getFormatConfig: function(inst) { _getFormatConfig: function(inst) {
var shortYearCutoff = this._get(inst, 'shortYearCutoff'); var shortYearCutoff = this._get(inst, 'shortYearCutoff');
@ -1672,14 +1672,14 @@ function isArray(a) {
Object - settings for attaching new datepicker functionality Object - settings for attaching new datepicker functionality
@return jQuery object */ @return jQuery object */
$.fn.datepicker = function(options){ $.fn.datepicker = function(options){
/* Initialise the date picker. */ /* Initialise the date picker. */
if (!$.datepicker.initialized) { if (!$.datepicker.initialized) {
$(document.body).append($.datepicker.dpDiv). $(document.body).append($.datepicker.dpDiv).
mousedown($.datepicker._checkExternalClick); mousedown($.datepicker._checkExternalClick);
$.datepicker.initialized = true; $.datepicker.initialized = true;
} }
var otherArgs = Array.prototype.slice.call(arguments, 1); var otherArgs = Array.prototype.slice.call(arguments, 1);
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
return $.datepicker['_' + options + 'Datepicker']. return $.datepicker['_' + options + 'Datepicker'].

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Richard D. Worth (rdworth.org) * Copyright (c) 2008 Richard D. Worth (rdworth.org)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Dialog * http://docs.jquery.com/UI/Dialog
* *
* Depends: * Depends:
@ -31,16 +31,16 @@ $.widget("ui.dialog", {
_init: function() { _init: function() {
this.originalTitle = this.element.attr('title'); this.originalTitle = this.element.attr('title');
this.options.title = this.options.title || this.originalTitle; this.options.title = this.options.title || this.originalTitle;
var self = this, var self = this,
options = this.options, options = this.options,
uiDialogContent = this.element uiDialogContent = this.element
.removeAttr('title') .removeAttr('title')
.addClass('ui-dialog-content') .addClass('ui-dialog-content')
.wrap('<div/>') .wrap('<div/>')
.wrap('<div/>'), .wrap('<div/>'),
uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent()) uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent())
.addClass('ui-dialog-container') .addClass('ui-dialog-container')
.css({ .css({
@ -48,14 +48,14 @@ $.widget("ui.dialog", {
width: '100%', width: '100%',
height: '100%' height: '100%'
}), }),
title = options.title || '&nbsp;', title = options.title || '&nbsp;',
uiDialogTitlebar = (this.uiDialogTitlebar = uiDialogTitlebar = (this.uiDialogTitlebar =
$('<div class="ui-dialog-titlebar"/>')) $('<div class="ui-dialog-titlebar"/>'))
.append('<span class="ui-dialog-title">' + title + '</span>') .append('<span class="ui-dialog-title">' + title + '</span>')
.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>') .append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
.prependTo(uiDialogContainer), .prependTo(uiDialogContainer),
uiDialog = (this.uiDialog = uiDialogContainer.parent()) uiDialog = (this.uiDialog = uiDialogContainer.parent())
.appendTo(document.body) .appendTo(document.body)
.hide() .hide()
@ -81,7 +81,7 @@ $.widget("ui.dialog", {
.mousedown(function() { .mousedown(function() {
self._moveToTop(); self._moveToTop();
}), }),
uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>')) uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>'))
.addClass('ui-dialog-buttonpane') .addClass('ui-dialog-buttonpane')
.css({ .css({
@ -89,7 +89,7 @@ $.widget("ui.dialog", {
bottom: 0 bottom: 0
}) })
.appendTo(uiDialog); .appendTo(uiDialog);
this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar) this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
.hover( .hover(
function() { function() {
@ -106,21 +106,21 @@ $.widget("ui.dialog", {
self.close(); self.close();
return false; return false;
}); });
uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() { uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() {
$.ui.disableSelection(this); $.ui.disableSelection(this);
}); });
(options.draggable && $.fn.draggable && this._makeDraggable()); (options.draggable && $.fn.draggable && this._makeDraggable());
(options.resizable && $.fn.resizable && this._makeResizable()); (options.resizable && $.fn.resizable && this._makeResizable());
this._createButtons(options.buttons); this._createButtons(options.buttons);
this._isOpen = false; this._isOpen = false;
(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
(options.autoOpen && this.open()); (options.autoOpen && this.open());
}, },
destroy: function() { destroy: function() {
(this.overlay && this.overlay.destroy()); (this.overlay && this.overlay.destroy());
this.uiDialog.hide(); this.uiDialog.hide();
@ -130,50 +130,50 @@ $.widget("ui.dialog", {
.removeClass('ui-dialog-content') .removeClass('ui-dialog-content')
.hide().appendTo('body'); .hide().appendTo('body');
this.uiDialog.remove(); this.uiDialog.remove();
(this.originalTitle && this.element.attr('title', this.originalTitle)); (this.originalTitle && this.element.attr('title', this.originalTitle));
}, },
close: function() { close: function() {
if (false === this._trigger('beforeclose', null, { options: this.options })) { if (false === this._trigger('beforeclose', null, { options: this.options })) {
return; return;
} }
(this.overlay && this.overlay.destroy()); (this.overlay && this.overlay.destroy());
this.uiDialog this.uiDialog
.hide(this.options.hide) .hide(this.options.hide)
.unbind('keypress.ui-dialog'); .unbind('keypress.ui-dialog');
this._trigger('close', null, { options: this.options }); this._trigger('close', null, { options: this.options });
$.ui.dialog.overlay.resize(); $.ui.dialog.overlay.resize();
this._isOpen = false; this._isOpen = false;
}, },
isOpen: function() { isOpen: function() {
return this._isOpen; return this._isOpen;
}, },
open: function() { open: function() {
if (this._isOpen) { return; } if (this._isOpen) { return; }
this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null; this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
(this.uiDialog.next().length && this.uiDialog.appendTo('body')); (this.uiDialog.next().length && this.uiDialog.appendTo('body'));
this._position(this.options.position); this._position(this.options.position);
this.uiDialog.show(this.options.show); this.uiDialog.show(this.options.show);
(this.options.autoResize && this._size()); (this.options.autoResize && this._size());
this._moveToTop(true); this._moveToTop(true);
// prevent tabbing out of modal dialogs // prevent tabbing out of modal dialogs
(this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(e) { (this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(e) {
if (e.keyCode != $.keyCode.TAB) { if (e.keyCode != $.keyCode.TAB) {
return; return;
} }
var tabbables = $(':tabbable', this), var tabbables = $(':tabbable', this),
first = tabbables.filter(':first')[0], first = tabbables.filter(':first')[0],
last = tabbables.filter(':last')[0]; last = tabbables.filter(':last')[0];
if (e.target == last && !e.shiftKey) { if (e.target == last && !e.shiftKey) {
setTimeout(function() { setTimeout(function() {
first.focus(); first.focus();
@ -184,20 +184,20 @@ $.widget("ui.dialog", {
}, 1); }, 1);
} }
})); }));
this.uiDialog.find(':tabbable:first').focus(); this.uiDialog.find(':tabbable:first').focus();
this._trigger('open', null, { options: this.options }); this._trigger('open', null, { options: this.options });
this._isOpen = true; this._isOpen = true;
}, },
_createButtons: function(buttons) { _createButtons: function(buttons) {
var self = this, var self = this,
hasButtons = false, hasButtons = false,
uiDialogButtonPane = this.uiDialogButtonPane; uiDialogButtonPane = this.uiDialogButtonPane;
// remove any existing buttons // remove any existing buttons
uiDialogButtonPane.empty().hide(); uiDialogButtonPane.empty().hide();
$.each(buttons, function() { return !(hasButtons = true); }); $.each(buttons, function() { return !(hasButtons = true); });
if (hasButtons) { if (hasButtons) {
uiDialogButtonPane.show(); uiDialogButtonPane.show();
@ -209,11 +209,11 @@ $.widget("ui.dialog", {
}); });
} }
}, },
_makeDraggable: function() { _makeDraggable: function() {
var self = this, var self = this,
options = this.options; options = this.options;
this.uiDialog.draggable({ this.uiDialog.draggable({
cancel: '.ui-dialog-content', cancel: '.ui-dialog-content',
helper: options.dragHelper, helper: options.dragHelper,
@ -231,7 +231,7 @@ $.widget("ui.dialog", {
} }
}); });
}, },
_makeResizable: function(handles) { _makeResizable: function(handles) {
handles = (handles === undefined ? this.options.resizable : handles); handles = (handles === undefined ? this.options.resizable : handles);
var self = this, var self = this,
@ -239,7 +239,7 @@ $.widget("ui.dialog", {
resizeHandles = typeof handles == 'string' resizeHandles = typeof handles == 'string'
? handles ? handles
: 'n,e,s,w,se,sw,ne,nw'; : 'n,e,s,w,se,sw,ne,nw';
this.uiDialog.resizable({ this.uiDialog.resizable({
cancel: '.ui-dialog-content', cancel: '.ui-dialog-content',
helper: options.resizeHelper, helper: options.resizeHelper,
@ -262,31 +262,31 @@ $.widget("ui.dialog", {
} }
}); });
}, },
// the force parameter allows us to move modal dialogs to their correct // the force parameter allows us to move modal dialogs to their correct
// position on open // position on open
_moveToTop: function(force) { _moveToTop: function(force) {
if ((this.options.modal && !force) if ((this.options.modal && !force)
|| (!this.options.stack && !this.options.modal)) { || (!this.options.stack && !this.options.modal)) {
return this._trigger('focus', null, { options: this.options }); return this._trigger('focus', null, { options: this.options });
} }
var maxZ = this.options.zIndex, options = this.options; var maxZ = this.options.zIndex, options = this.options;
$('.ui-dialog:visible').each(function() { $('.ui-dialog:visible').each(function() {
maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
}); });
(this.overlay && this.overlay.$el.css('z-index', ++maxZ)); (this.overlay && this.overlay.$el.css('z-index', ++maxZ));
this.uiDialog.css('z-index', ++maxZ); this.uiDialog.css('z-index', ++maxZ);
this._trigger('focus', null, { options: this.options }); this._trigger('focus', null, { options: this.options });
}, },
_position: function(pos) { _position: function(pos) {
var wnd = $(window), doc = $(document), var wnd = $(window), doc = $(document),
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
minTop = pTop; minTop = pTop;
if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
pos = [ pos = [
pos == 'right' || pos == 'left' ? pos : 'center', pos == 'right' || pos == 'left' ? pos : 'center',
@ -326,13 +326,13 @@ $.widget("ui.dialog", {
pTop += (wnd.height() - this.uiDialog.height()) / 2; pTop += (wnd.height() - this.uiDialog.height()) / 2;
} }
} }
// prevent the dialog from being too high (make sure the titlebar // prevent the dialog from being too high (make sure the titlebar
// is accessible) // is accessible)
pTop = Math.max(pTop, minTop); pTop = Math.max(pTop, minTop);
this.uiDialog.css({top: pTop, left: pLeft}); this.uiDialog.css({top: pTop, left: pLeft});
}, },
_setData: function(key, value){ _setData: function(key, value){
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
switch (key) { switch (key) {
@ -353,17 +353,17 @@ $.widget("ui.dialog", {
case "resizable": case "resizable":
var uiDialog = this.uiDialog, var uiDialog = this.uiDialog,
isResizable = this.uiDialog.is(':data(resizable)'); isResizable = this.uiDialog.is(':data(resizable)');
// currently resizable, becoming non-resizable // currently resizable, becoming non-resizable
(isResizable && !value && uiDialog.resizable('destroy')); (isResizable && !value && uiDialog.resizable('destroy'));
// currently resizable, changing handles // currently resizable, changing handles
(isResizable && typeof value == 'string' && (isResizable && typeof value == 'string' &&
uiDialog.resizable('option', 'handles', value)); uiDialog.resizable('option', 'handles', value));
// currently non-resizable, becoming resizable // currently non-resizable, becoming resizable
(isResizable || this._makeResizable(value)); (isResizable || this._makeResizable(value));
break; break;
case "title": case "title":
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;'); $(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
@ -372,10 +372,10 @@ $.widget("ui.dialog", {
this.uiDialog.width(value); this.uiDialog.width(value);
break; break;
} }
$.widget.prototype._setData.apply(this, arguments); $.widget.prototype._setData.apply(this, arguments);
}, },
_size: function() { _size: function() {
var container = this.uiDialogContainer, var container = this.uiDialogContainer,
titlebar = this.uiDialogTitlebar, titlebar = this.uiDialogTitlebar,
@ -408,9 +408,9 @@ $.extend($.ui.dialog, {
width: 300, width: 300,
zIndex: 1000 zIndex: 1000
}, },
getter: 'isOpen', getter: 'isOpen',
overlay: function(dialog) { overlay: function(dialog) {
this.$el = $.ui.dialog.overlay.create(dialog); this.$el = $.ui.dialog.overlay.create(dialog);
} }
@ -447,17 +447,17 @@ $.extend($.ui.dialog.overlay, {
return allow; return allow;
}); });
}, 1); }, 1);
// allow closing by pressing the escape key // allow closing by pressing the escape key
$(document).bind('keydown.dialog-overlay', function(e) { $(document).bind('keydown.dialog-overlay', function(e) {
(dialog.options.closeOnEscape && e.keyCode (dialog.options.closeOnEscape && e.keyCode
&& e.keyCode == $.keyCode.ESCAPE && dialog.close()); && e.keyCode == $.keyCode.ESCAPE && dialog.close());
}); });
// handle window resize // handle window resize
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
} }
var $el = $('<div/>').appendTo(document.body) var $el = $('<div/>').appendTo(document.body)
.addClass('ui-dialog-overlay').css($.extend({ .addClass('ui-dialog-overlay').css($.extend({
borderWidth: 0, margin: 0, padding: 0, borderWidth: 0, margin: 0, padding: 0,
@ -465,23 +465,23 @@ $.extend($.ui.dialog.overlay, {
width: this.width(), width: this.width(),
height: this.height() height: this.height()
}, dialog.options.overlay)); }, dialog.options.overlay));
(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
this.instances.push($el); this.instances.push($el);
return $el; return $el;
}, },
destroy: function($el) { destroy: function($el) {
this.instances.splice($.inArray(this.instances, $el), 1); this.instances.splice($.inArray(this.instances, $el), 1);
if (this.instances.length === 0) { if (this.instances.length === 0) {
$('a, :input').add([document, window]).unbind('.dialog-overlay'); $('a, :input').add([document, window]).unbind('.dialog-overlay');
} }
$el.remove(); $el.remove();
}, },
height: function() { height: function() {
// handle IE 6 // handle IE 6
if ($.browser.msie && $.browser.version < 7) { if ($.browser.msie && $.browser.version < 7) {
@ -493,7 +493,7 @@ $.extend($.ui.dialog.overlay, {
document.documentElement.offsetHeight, document.documentElement.offsetHeight,
document.body.offsetHeight document.body.offsetHeight
); );
if (scrollHeight < offsetHeight) { if (scrollHeight < offsetHeight) {
return $(window).height() + 'px'; return $(window).height() + 'px';
} else { } else {
@ -510,7 +510,7 @@ $.extend($.ui.dialog.overlay, {
return $(document).height() + 'px'; return $(document).height() + 'px';
} }
}, },
width: function() { width: function() {
// handle IE 6 // handle IE 6
if ($.browser.msie && $.browser.version < 7) { if ($.browser.msie && $.browser.version < 7) {
@ -522,7 +522,7 @@ $.extend($.ui.dialog.overlay, {
document.documentElement.offsetWidth, document.documentElement.offsetWidth,
document.body.offsetWidth document.body.offsetWidth
); );
if (scrollWidth < offsetWidth) { if (scrollWidth < offsetWidth) {
return $(window).width() + 'px'; return $(window).width() + 'px';
} else { } else {
@ -539,7 +539,7 @@ $.extend($.ui.dialog.overlay, {
return $(document).width() + 'px'; return $(document).width() + 'px';
} }
}, },
resize: function() { resize: function() {
/* If the dialog is draggable and the user drags it past the /* If the dialog is draggable and the user drags it past the
* right edge of the window, the document becomes wider so we * right edge of the window, the document becomes wider so we
@ -553,7 +553,7 @@ $.extend($.ui.dialog.overlay, {
$.each($.ui.dialog.overlay.instances, function() { $.each($.ui.dialog.overlay.instances, function() {
$overlays = $overlays.add(this); $overlays = $overlays.add(this);
}); });
$overlays.css({ $overlays.css({
width: 0, width: 0,
height: 0 height: 0

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus * Copyright (c) 2008 Paul Bakaus
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Draggables * http://docs.jquery.com/UI/Draggables
* *
* Depends: * Depends:
@ -13,7 +13,7 @@
(function($) { (function($) {
$.widget("ui.draggable", $.extend({}, $.ui.mouse, { $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
getHandle: function(e) { getHandle: function(e) {
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
@ -23,83 +23,83 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
.each(function() { .each(function() {
if(this == e.target) handle = true; if(this == e.target) handle = true;
}); });
return handle; return handle;
}, },
createHelper: function() { createHelper: function() {
var o = this.options; var o = this.options;
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element); var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
if(!helper.parents('body').length) if(!helper.parents('body').length)
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
helper.css("position", "absolute"); helper.css("position", "absolute");
return helper; return helper;
}, },
_init: function() { _init: function() {
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position = 'relative'; this.element[0].style.position = 'relative';
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-draggable")); (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-draggable"));
(this.options.disabled && this.element.addClass('ui-draggable-disabled')); (this.options.disabled && this.element.addClass('ui-draggable-disabled'));
this._mouseInit(); this._mouseInit();
}, },
_mouseCapture: function(e) { _mouseCapture: function(e) {
var o = this.options; var o = this.options;
if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle'))
return false; return false;
//Quit if we're not on a valid handle //Quit if we're not on a valid handle
this.handle = this.getHandle(e); this.handle = this.getHandle(e);
if (!this.handle) if (!this.handle)
return false; return false;
return true; return true;
}, },
_mouseStart: function(e) { _mouseStart: function(e) {
var o = this.options; var o = this.options;
//Create and append the visible helper //Create and append the visible helper
this.helper = this.createHelper(); this.helper = this.createHelper();
//If ddmanager is used for droppables, set the global draggable //If ddmanager is used for droppables, set the global draggable
if($.ui.ddmanager) if($.ui.ddmanager)
$.ui.ddmanager.current = this; $.ui.ddmanager.current = this;
/* /*
* - Position generation - * - Position generation -
* This block generates everything position related - it's the core of draggables. * This block generates everything position related - it's the core of draggables.
*/ */
this.margins = { //Cache the margins this.margins = { //Cache the margins
left: (parseInt(this.element.css("marginLeft"),10) || 0), left: (parseInt(this.element.css("marginLeft"),10) || 0),
top: (parseInt(this.element.css("marginTop"),10) || 0) top: (parseInt(this.element.css("marginTop"),10) || 0)
}; };
this.cssPosition = this.helper.css("position"); //Store the helper's css position this.cssPosition = this.helper.css("position"); //Store the helper's css position
this.offset = this.element.offset(); //The element's absolute position on the page this.offset = this.element.offset(); //The element's absolute position on the page
this.offset = { //Substract the margins from the element's absolute offset this.offset = { //Substract the margins from the element's absolute offset
top: this.offset.top - this.margins.top, top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left left: this.offset.left - this.margins.left
}; };
this.offset.click = { //Where the click happened, relative to the element this.offset.click = { //Where the click happened, relative to the element
left: e.pageX - this.offset.left, left: e.pageX - this.offset.left,
top: e.pageY - this.offset.top top: e.pageY - this.offset.top
@ -107,15 +107,15 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
//Calling this method cached the next parents that have scrollTop / scrollLeft attached //Calling this method cached the next parents that have scrollTop / scrollLeft attached
this.cacheScrollParents(); this.cacheScrollParents();
this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position
if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 }; //Ugly FF3 fix if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 }; //Ugly FF3 fix
this.offset.parent = { //Store its position plus border this.offset.parent = { //Store its position plus border
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
}; };
//This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
if(this.cssPosition == "relative") { if(this.cssPosition == "relative") {
var p = this.element.position(); var p = this.element.position();
@ -126,13 +126,13 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
} else { } else {
this.offset.relative = { top: 0, left: 0 }; this.offset.relative = { top: 0, left: 0 };
} }
//Generate the original position //Generate the original position
this.originalPosition = this._generatePosition(e); this.originalPosition = this._generatePosition(e);
//Cache the helper size //Cache the helper size
this.cacheHelperProportions(); this.cacheHelperProportions();
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
if(o.cursorAt) if(o.cursorAt)
this.adjustOffsetFromHelper(o.cursorAt); this.adjustOffsetFromHelper(o.cursorAt);
@ -144,26 +144,26 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
OFFSET_PARENT_NOT_SCROLL_PARENT_Y: this.scrollTopParent[0] != this.offsetParent[0] && !(this.scrollTopParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName)), OFFSET_PARENT_NOT_SCROLL_PARENT_Y: this.scrollTopParent[0] != this.offsetParent[0] && !(this.scrollTopParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName)),
OFFSET_PARENT_NOT_SCROLL_PARENT_X: this.scrollLeftParent[0] != this.offsetParent[0] && !(this.scrollLeftParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName)) OFFSET_PARENT_NOT_SCROLL_PARENT_X: this.scrollLeftParent[0] != this.offsetParent[0] && !(this.scrollLeftParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName))
}); });
if(o.containment) if(o.containment)
this.setContainment(); this.setContainment();
//Call plugins and callbacks //Call plugins and callbacks
this._propagate("start", e); this._propagate("start", e);
//Recache the helper size //Recache the helper size
this.cacheHelperProportions(); this.cacheHelperProportions();
//Prepare the droppable offsets //Prepare the droppable offsets
if ($.ui.ddmanager && !o.dropBehaviour) if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, e); $.ui.ddmanager.prepareOffsets(this, e);
this.helper.addClass("ui-draggable-dragging"); this.helper.addClass("ui-draggable-dragging");
this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
return true; return true;
}, },
cacheScrollParents: function() { cacheScrollParents: function() {
this.scrollTopParent = function(el) { this.scrollTopParent = function(el) {
@ -176,21 +176,21 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
}(this.helper); }(this.helper);
}, },
adjustOffsetFromHelper: function(obj) { adjustOffsetFromHelper: function(obj) {
if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left; if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top; if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
}, },
cacheHelperProportions: function() { cacheHelperProportions: function() {
this.helperProportions = { this.helperProportions = {
width: this.helper.outerWidth(), width: this.helper.outerWidth(),
height: this.helper.outerHeight() height: this.helper.outerHeight()
}; };
}, },
setContainment: function() { setContainment: function() {
var o = this.options; var o = this.options;
@ -201,12 +201,12 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
$(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0), $(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0) ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
]; ];
if(!(/^(document|window|parent)$/).test(o.containment)) { if(!(/^(document|window|parent)$/).test(o.containment)) {
var ce = $(o.containment)[0]; var ce = $(o.containment)[0];
var co = $(o.containment).offset(); var co = $(o.containment).offset();
var over = ($(ce).css("overflow") != 'hidden'); var over = ($(ce).css("overflow") != 'hidden');
this.containment = [ this.containment = [
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left, co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top, co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
@ -216,8 +216,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
} }
}, },
_convertPositionTo: function(d, pos) { _convertPositionTo: function(d, pos) {
if(!pos) pos = this.position; if(!pos) pos = this.position;
@ -263,9 +263,9 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
- (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) - (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
) )
}; };
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
/* /*
* - Position constraining - * - Position constraining -
* Constrain the position to a mix of grid, containment. * Constrain the position to a mix of grid, containment.
@ -276,39 +276,39 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
if(position.left > this.containment[2]) position.left = this.containment[2]; if(position.left > this.containment[2]) position.left = this.containment[2];
if(position.top > this.containment[3]) position.top = this.containment[3]; if(position.top > this.containment[3]) position.top = this.containment[3];
} }
if(o.grid) { if(o.grid) {
var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1]; var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0]; var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
} }
return position; return position;
}, },
_mouseDrag: function(e) { _mouseDrag: function(e) {
//Compute the helpers position //Compute the helpers position
this.position = this._generatePosition(e); this.position = this._generatePosition(e);
this.positionAbs = this._convertPositionTo("absolute"); this.positionAbs = this._convertPositionTo("absolute");
//Call plugins and callbacks and use the resulting position if something is returned //Call plugins and callbacks and use the resulting position if something is returned
this.position = this._propagate("drag", e) || this.position; this.position = this._propagate("drag", e) || this.position;
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
return false; return false;
}, },
_mouseStop: function(e) { _mouseStop: function(e) {
//If we are using droppables, inform the manager about the drop //If we are using droppables, inform the manager about the drop
var dropped = false; var dropped = false;
if ($.ui.ddmanager && !this.options.dropBehaviour) if ($.ui.ddmanager && !this.options.dropBehaviour)
var dropped = $.ui.ddmanager.drop(this, e); var dropped = $.ui.ddmanager.drop(this, e);
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
var self = this; var self = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10) || 500, function() { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10) || 500, function() {
@ -319,7 +319,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
this._propagate("stop", e); this._propagate("stop", e);
this._clear(); this._clear();
} }
return false; return false;
}, },
_clear: function() { _clear: function() {
@ -329,7 +329,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
this.helper = null; this.helper = null;
this.cancelHelperRemoval = false; this.cancelHelperRemoval = false;
}, },
// From now on bulk stuff - mainly helpers // From now on bulk stuff - mainly helpers
plugins: {}, plugins: {},
uiHash: function(e) { uiHash: function(e) {
@ -337,7 +337,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
helper: this.helper, helper: this.helper,
position: this.position, position: this.position,
absolutePosition: this.positionAbs, absolutePosition: this.positionAbs,
options: this.options options: this.options
}; };
}, },
_propagate: function(n,e) { _propagate: function(n,e) {
@ -400,7 +400,7 @@ $.ui.plugin.add("draggable", "opacity", {
$.ui.plugin.add("draggable", "iframeFix", { $.ui.plugin.add("draggable", "iframeFix", {
start: function(e, ui) { start: function(e, ui) {
$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() { $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
.css({ .css({
width: this.offsetWidth+"px", height: this.offsetHeight+"px", width: this.offsetWidth+"px", height: this.offsetHeight+"px",
@ -411,7 +411,7 @@ $.ui.plugin.add("draggable", "iframeFix", {
}); });
}, },
stop: function(e, ui) { stop: function(e, ui) {
$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
} }
}); });
@ -423,7 +423,7 @@ $.ui.plugin.add("draggable", "scroll", {
var i = $(this).data("draggable"); var i = $(this).data("draggable");
o.scrollSensitivity = o.scrollSensitivity || 20; o.scrollSensitivity = o.scrollSensitivity || 20;
o.scrollSpeed = o.scrollSpeed || 20; o.scrollSpeed = o.scrollSpeed || 20;
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);
return $(document); return $(document);
@ -432,29 +432,29 @@ $.ui.plugin.add("draggable", "scroll", {
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode); do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
return $(document); return $(document);
}(this); }(this);
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset(); if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset(); if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
}, },
drag: function(e, ui) { drag: function(e, ui) {
var o = ui.options, scrolled = false; var o = ui.options, scrolled = false;
var i = $(this).data("draggable"); var i = $(this).data("draggable");
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) - e.pageY < o.scrollSensitivity) if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed; i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed;
if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity) if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed; i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed;
} else { } else {
if(e.pageY - $(document).scrollTop() < o.scrollSensitivity) if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
} }
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft + o.scrollSpeed; i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft + o.scrollSpeed;
@ -466,17 +466,17 @@ $.ui.plugin.add("draggable", "scroll", {
if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
} }
if(scrolled !== false) if(scrolled !== false)
$.ui.ddmanager.prepareOffsets(i, e); $.ui.ddmanager.prepareOffsets(i, e);
} }
}); });
$.ui.plugin.add("draggable", "snap", { $.ui.plugin.add("draggable", "snap", {
start: function(e, ui) { start: function(e, ui) {
var inst = $(this).data("draggable"); var inst = $(this).data("draggable");
inst.snapElements = []; inst.snapElements = [];
@ -488,28 +488,28 @@ $.ui.plugin.add("draggable", "snap", {
top: $o.top, left: $o.left top: $o.top, left: $o.left
}); });
}); });
}, },
drag: function(e, ui) { drag: function(e, ui) {
var inst = $(this).data("draggable"); var inst = $(this).data("draggable");
var d = ui.options.snapTolerance || 20; var d = ui.options.snapTolerance || 20;
var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width, var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height; y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
for (var i = inst.snapElements.length - 1; i >= 0; i--){ for (var i = inst.snapElements.length - 1; i >= 0; i--){
var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
//Yes, I know, this is insane ;) //Yes, I know, this is insane ;)
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item }))); if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
inst.snapElements[i].snapping = false; inst.snapElements[i].snapping = false;
continue; continue;
} }
if(ui.options.snapMode != 'inner') { if(ui.options.snapMode != 'inner') {
var ts = Math.abs(t - y2) <= d; var ts = Math.abs(t - y2) <= d;
var bs = Math.abs(b - y1) <= d; var bs = Math.abs(b - y1) <= d;
@ -520,9 +520,9 @@ $.ui.plugin.add("draggable", "snap", {
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left; if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left; if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
} }
var first = (ts || bs || ls || rs); var first = (ts || bs || ls || rs);
if(ui.options.snapMode != 'outer') { if(ui.options.snapMode != 'outer') {
var ts = Math.abs(t - y1) <= d; var ts = Math.abs(t - y1) <= d;
var bs = Math.abs(b - y2) <= d; var bs = Math.abs(b - y2) <= d;
@ -533,11 +533,11 @@ $.ui.plugin.add("draggable", "snap", {
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left; if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left; if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
} }
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item }))); (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
inst.snapElements[i].snapping = (ts || bs || ls || rs || first); inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
}; };
} }
@ -545,7 +545,7 @@ $.ui.plugin.add("draggable", "snap", {
$.ui.plugin.add("draggable", "connectToSortable", { $.ui.plugin.add("draggable", "connectToSortable", {
start: function(e,ui) { start: function(e,ui) {
var inst = $(this).data("draggable"); var inst = $(this).data("draggable");
inst.sortables = []; inst.sortables = [];
$(ui.options.connectToSortable).each(function() { $(ui.options.connectToSortable).each(function() {
@ -555,17 +555,17 @@ $.ui.plugin.add("draggable", "connectToSortable", {
instance: sortable, instance: sortable,
shouldRevert: sortable.options.revert shouldRevert: sortable.options.revert
}); });
sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
sortable._propagate("activate", e, inst); sortable._propagate("activate", e, inst);
} }
}); });
}, },
stop: function(e,ui) { stop: function(e,ui) {
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
var inst = $(this).data("draggable"); var inst = $(this).data("draggable");
$.each(inst.sortables, function() { $.each(inst.sortables, function() {
if(this.instance.isOver) { if(this.instance.isOver) {
this.instance.isOver = 0; this.instance.isOver = 0;
@ -573,7 +573,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
if(this.shouldRevert) this.instance.options.revert = true; //revert here if(this.shouldRevert) this.instance.options.revert = true; //revert here
this.instance._mouseStop(e); this.instance._mouseStop(e);
//Also propagate receive event, since the sortable is actually receiving a element //Also propagate receive event, since the sortable is actually receiving a element
this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]); this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
@ -583,21 +583,21 @@ $.ui.plugin.add("draggable", "connectToSortable", {
} }
}); });
}, },
drag: function(e,ui) { drag: function(e,ui) {
var inst = $(this).data("draggable"), self = this; var inst = $(this).data("draggable"), self = this;
var checkPos = function(o) { var checkPos = function(o) {
var l = o.left, r = l + o.width, var l = o.left, r = l + o.width,
t = o.top, b = t + o.height; t = o.top, b = t + o.height;
return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
&& t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b); && t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
}; };
$.each(inst.sortables, function(i) { $.each(inst.sortables, function(i) {
if(checkPos.call(inst, this.instance.containerCache)) { if(checkPos.call(inst, this.instance.containerCache)) {
@ -612,7 +612,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true); this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; }; this.instance.options.helper = function() { return ui.helper[0]; };
e.target = this.instance.currentItem[0]; e.target = this.instance.currentItem[0];
this.instance._mouseCapture(e, true); this.instance._mouseCapture(e, true);
this.instance._mouseStart(e, true, true); this.instance._mouseStart(e, true, true);
@ -622,16 +622,16 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.offset.click.left = inst.offset.click.left; this.instance.offset.click.left = inst.offset.click.left;
this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
inst._propagate("toSortable", e); inst._propagate("toSortable", e);
} }
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
if(this.instance.currentItem) this.instance._mouseDrag(e); if(this.instance.currentItem) this.instance._mouseDrag(e);
} else { } else {
//If it doesn't intersect with the sortable, and it intersected before, //If it doesn't intersect with the sortable, and it intersected before,
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
if(this.instance.isOver) { if(this.instance.isOver) {
@ -640,14 +640,14 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.options.revert = false; //No revert here this.instance.options.revert = false; //No revert here
this.instance._mouseStop(e, true); this.instance._mouseStop(e, true);
this.instance.options.helper = this.instance.options._helper; this.instance.options.helper = this.instance.options._helper;
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
this.instance.currentItem.remove(); this.instance.currentItem.remove();
if(this.instance.placeholder) this.instance.placeholder.remove(); if(this.instance.placeholder) this.instance.placeholder.remove();
inst._propagate("fromSortable", e); inst._propagate("fromSortable", e);
} }
}; };
}); });
@ -660,11 +660,11 @@ $.ui.plugin.add("draggable", "stack", {
var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) { var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min); return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
}); });
$(group).each(function(i) { $(group).each(function(i) {
this.style.zIndex = ui.options.stack.min + i; this.style.zIndex = ui.options.stack.min + i;
}); });
this[0].style.zIndex = ui.options.stack.min + group.length; this[0].style.zIndex = ui.options.stack.min + group.length;
} }
}); });

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus * Copyright (c) 2008 Paul Bakaus
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Droppables * http://docs.jquery.com/UI/Droppables
* *
* Depends: * Depends:
@ -14,7 +14,7 @@
(function($) { (function($) {
$.widget("ui.droppable", { $.widget("ui.droppable", {
_setData: function(key, value) { _setData: function(key, value) {
if(key == 'accept') { if(key == 'accept') {
@ -26,9 +26,9 @@ $.widget("ui.droppable", {
} }
}, },
_init: function() { _init: function() {
var o = this.options, accept = o.accept; var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1; this.isover = 0; this.isout = 1;
@ -38,13 +38,13 @@ $.widget("ui.droppable", {
//Store the droppable's proportions //Store the droppable's proportions
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
// Add the reference and positions to the manager // Add the reference and positions to the manager
$.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || []; $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
$.ui.ddmanager.droppables[this.options.scope].push(this); $.ui.ddmanager.droppables[this.options.scope].push(this);
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable")); (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
}, },
plugins: {}, plugins: {},
ui: function(c) { ui: function(c) {
@ -62,39 +62,39 @@ $.widget("ui.droppable", {
for ( var i = 0; i < drop.length; i++ ) for ( var i = 0; i < drop.length; i++ )
if ( drop[i] == this ) if ( drop[i] == this )
drop.splice(i, 1); drop.splice(i, 1);
this.element this.element
.removeClass("ui-droppable-disabled") .removeClass("ui-droppable-disabled")
.removeData("droppable") .removeData("droppable")
.unbind(".droppable"); .unbind(".droppable");
}, },
_over: function(e) { _over: function(e) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'over', [e, this.ui(draggable)]); $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over); this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
} }
}, },
_out: function(e) { _out: function(e) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'out', [e, this.ui(draggable)]); $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out); this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
} }
}, },
_drop: function(e,custom) { _drop: function(e,custom) {
var draggable = custom || $.ui.ddmanager.current; var draggable = custom || $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var childrenIntersection = false; var childrenIntersection = false;
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'droppable'); var inst = $.data(this, 'droppable');
@ -103,29 +103,29 @@ $.widget("ui.droppable", {
} }
}); });
if(childrenIntersection) return false; if(childrenIntersection) return false;
if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]); $.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop); this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
return this.element; return this.element;
} }
return false; return false;
}, },
_activate: function(e) { _activate: function(e) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]); $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate); if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
}, },
_deactivate: function(e) { _deactivate: function(e) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]); $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate); if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);
} }
}); });
@ -139,14 +139,14 @@ $.extend($.ui.droppable, {
}); });
$.ui.intersect = function(draggable, droppable, toleranceMode) { $.ui.intersect = function(draggable, droppable, toleranceMode) {
if (!droppable.offset) return false; if (!droppable.offset) return false;
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
var l = droppable.offset.left, r = l + droppable.proportions.width, var l = droppable.offset.left, r = l + droppable.proportions.width,
t = droppable.offset.top, b = t + droppable.proportions.height; t = droppable.offset.top, b = t + droppable.proportions.height;
switch (toleranceMode) { switch (toleranceMode) {
case 'fit': case 'fit':
return (l < x1 && x2 < r return (l < x1 && x2 < r
@ -177,7 +177,7 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
return false; return false;
break; break;
} }
}; };
/* /*
@ -187,58 +187,58 @@ $.ui.ddmanager = {
current: null, current: null,
droppables: { 'default': [] }, droppables: { 'default': [] },
prepareOffsets: function(t, e) { prepareOffsets: function(t, e) {
var m = $.ui.ddmanager.droppables[t.options.scope]; var m = $.ui.ddmanager.droppables[t.options.scope];
var type = e ? e.type : null; // workaround for #2317 var type = e ? e.type : null; // workaround for #2317
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) { droppablesLoop: for (var i = 0; i < m.length; i++) {
if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; //No disabled and non-accepted if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; //No disabled and non-accepted
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
m[i].offset = m[i].element.offset(); m[i].offset = m[i].element.offset();
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], e); //Activate the droppable if used directly from draggables if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], e); //Activate the droppable if used directly from draggables
} }
}, },
drop: function(draggable, e) { drop: function(draggable, e) {
var dropped = false; var dropped = false;
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() { $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
if(!this.options) return; if(!this.options) return;
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
dropped = this._drop.call(this, e); dropped = this._drop.call(this, e);
if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
this.isout = 1; this.isover = 0; this.isout = 1; this.isover = 0;
this._deactivate.call(this, e); this._deactivate.call(this, e);
} }
}); });
return dropped; return dropped;
}, },
drag: function(draggable, e) { drag: function(draggable, e) {
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e); if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);
//Run through all droppables and check their positions based on specific tolerance options //Run through all droppables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() { $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
if(this.options.disabled || this.greedyChild || !this.visible) return; if(this.options.disabled || this.greedyChild || !this.visible) return;
var intersects = $.ui.intersect(draggable, this, this.options.tolerance); var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
if(!c) return; if(!c) return;
var parentInstance; var parentInstance;
if (this.options.greedy) { if (this.options.greedy) {
var parent = this.element.parents(':data(droppable):eq(0)'); var parent = this.element.parents(':data(droppable):eq(0)');
@ -247,17 +247,17 @@ $.ui.ddmanager = {
parentInstance.greedyChild = (c == 'isover' ? 1 : 0); parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
} }
} }
// we just moved into a greedy child // we just moved into a greedy child
if (parentInstance && c == 'isover') { if (parentInstance && c == 'isover') {
parentInstance['isover'] = 0; parentInstance['isover'] = 0;
parentInstance['isout'] = 1; parentInstance['isout'] = 1;
parentInstance._out.call(parentInstance, e); parentInstance._out.call(parentInstance, e);
} }
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
this[c == "isover" ? "_over" : "_out"].call(this, e); this[c == "isover" ? "_over" : "_out"].call(this, e);
// we just moved out of a greedy child // we just moved out of a greedy child
if (parentInstance && c == 'isout') { if (parentInstance && c == 'isout') {
parentInstance['isout'] = 0; parentInstance['isout'] = 0;
@ -265,7 +265,7 @@ $.ui.ddmanager = {
parentInstance._over.call(parentInstance, e); parentInstance._over.call(parentInstance, e);
} }
}); });
} }
}; };

View File

@ -18,7 +18,7 @@ $.widget("ui.magnifier", {
_init: function() { _init: function() {
var self = this, var self = this,
o = this.options; o = this.options;
this.element this.element
.addClass("ui-magnifier") .addClass("ui-magnifier")
.bind('click.magnifier', function(e) { .bind('click.magnifier', function(e) {
@ -28,12 +28,12 @@ $.widget("ui.magnifier", {
currentOffset: self.current[1] currentOffset: self.current[1]
}])); }]));
}); });
// the element must have relative or absolute positioning // the element must have relative or absolute positioning
if (!(/^(r|a)/).test(this.element.css("position"))) { if (!(/^(r|a)/).test(this.element.css("position"))) {
this.element.css("position", "relative"); this.element.css("position", "relative");
} }
this.items = []; this.items = [];
this.element.find(o.items).each(function() { this.element.find(o.items).each(function() {
var $this = $(this); var $this = $(this);
@ -44,10 +44,10 @@ $.widget("ui.magnifier", {
[$this.width(),$this.height()], [$this.width(),$this.height()],
(o.overlap ? $this.position() : null) (o.overlap ? $this.position() : null)
]); ]);
(o.opacity && $this.css('opacity', o.opacity.min)); (o.opacity && $this.css('opacity', o.opacity.min));
}); });
// absolutize // absolutize
(o.overlap && $.each(this.items, function() { (o.overlap && $.each(this.items, function() {
$(this[0]).css({ $(this[0]).css({
@ -56,15 +56,15 @@ $.widget("ui.magnifier", {
left: this[3].left left: this[3].left
}); });
})); }));
this.identifier = ++counter; this.identifier = ++counter;
$(document).bind("mousemove.magnifier"+this.identifier, function(e) { $(document).bind("mousemove.magnifier"+this.identifier, function(e) {
(self.disabled || self._magnify.apply(self, [e])); (self.disabled || self._magnify.apply(self, [e]));
}); });
this.pp = this.element.offset(); this.pp = this.element.offset();
}, },
destroy: function() { destroy: function() {
this.reset(); this.reset();
this.element this.element
@ -72,15 +72,15 @@ $.widget("ui.magnifier", {
.unbind(".magnifier"); .unbind(".magnifier");
$(document).unbind("mousemove.magnifier"+this.identifier); $(document).unbind("mousemove.magnifier"+this.identifier);
}, },
disable: function() { disable: function() {
this.reset(); this.reset();
$.widget.prototype.disable.apply(this, arguments); $.widget.prototype.disable.apply(this, arguments);
}, },
reset: function(e) { reset: function(e) {
var o = this.options; var o = this.options;
$.each(this.items, function() { $.each(this.items, function() {
var item = this; var item = this;
$(item[0]).css({ $(item[0]).css({
@ -89,16 +89,16 @@ $.widget("ui.magnifier", {
top: (item[3] ? item[3].top : 0), top: (item[3] ? item[3].top : 0),
left: (item[3] ? item[3].left : 0) left: (item[3] ? item[3].left : 0)
}); });
(o.opacity && $(item[0]).css('opacity', o.opacity.min)); (o.opacity && $(item[0]).css('opacity', o.opacity.min));
(o.zIndex && $(item[0]).css("z-index", "")); (o.zIndex && $(item[0]).css("z-index", ""));
}); });
}, },
_magnify: function(e) { _magnify: function(e) {
var p = [e.pageX,e.pageY], o = this.options, c, distance = 1; var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;
this.current = this.items[0]; this.current = this.items[0];
// Compute the parent's distance // Compute the parent's distance
// we don't need to fire anything if we are not near the parent // we don't need to fire anything if we are not near the parent
var overlap = ((p[0] > this.pp.left-o.distance) && var overlap = ((p[0] > this.pp.left-o.distance) &&
@ -106,10 +106,10 @@ $.widget("ui.magnifier", {
(p[1] > this.pp.top-o.distance) && (p[1] > this.pp.top-o.distance) &&
(p[1] < this.pp.top + this.element[0].offsetHeight + o.distance)); (p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));
if (!overlap) { return false; } if (!overlap) { return false; }
for (var i=0; i<this.items.length; i++) { for (var i=0; i<this.items.length; i++) {
c = this.items[i]; c = this.items[i];
var olddistance = distance; var olddistance = distance;
if (!o.axis) { if (!o.axis) {
distance = Math.sqrt( distance = Math.sqrt(
@ -123,24 +123,24 @@ $.widget("ui.magnifier", {
distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2)); distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2));
} }
} }
if (distance < o.distance) { if (distance < o.distance) {
this.current = distance < olddistance ? c : this.current; this.current = distance < olddistance ? c : this.current;
if (!o.axis || o.axis != "y") { if (!o.axis || o.axis != "y") {
$(c[0]).css({ $(c[0]).css({
width: c[2][0]+ (c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)), width: c[2][0]+ (c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)),
left: (c[3] ? (c[3].left + o.verticalLine * ((c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)))) : 0) left: (c[3] ? (c[3].left + o.verticalLine * ((c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)))) : 0)
}); });
} }
if (!o.axis || o.axis != "x") { if (!o.axis || o.axis != "x") {
$(c[0]).css({ $(c[0]).css({
height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)), height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)),
top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1))) top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)))
}); });
} }
if (o.opacity) { if (o.opacity) {
$(c[0]).css('opacity', o.opacity.max-(distance/o.distance) < o.opacity.min ? o.opacity.min : o.opacity.max-(distance/o.distance)); $(c[0]).css('opacity', o.opacity.max-(distance/o.distance) < o.opacity.min ? o.opacity.min : o.opacity.max-(distance/o.distance));
} }
@ -151,13 +151,13 @@ $.widget("ui.magnifier", {
top: (c[3] ? c[3].top : 0), top: (c[3] ? c[3].top : 0),
left: (c[3] ? c[3].left : 0) left: (c[3] ? c[3].left : 0)
}); });
(o.opacity && $(c[0]).css('opacity', o.opacity.min)); (o.opacity && $(c[0]).css('opacity', o.opacity.min));
} }
(o.zIndex && $(c[0]).css("z-index", "")); (o.zIndex && $(c[0]).css("z-index", ""));
} }
(o.zIndex && $(this.current[0]).css("z-index", o.zIndex)); (o.zIndex && $(this.current[0]).css("z-index", o.zIndex));
} }
}); });

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus * Copyright (c) 2008 Paul Bakaus
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Resizables * http://docs.jquery.com/UI/Resizables
* *
* Depends: * Depends:
@ -18,21 +18,21 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
var self = this, o = this.options; var self = this, o = this.options;
var elpos = this.element.css('position'); var elpos = this.element.css('position');
this.originalElement = this.element; this.originalElement = this.element;
// simulate .ui-resizable { position: relative; } // simulate .ui-resizable { position: relative; }
this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos }); this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
$.extend(o, { $.extend(o, {
_aspectRatio: !!(o.aspectRatio), _aspectRatio: !!(o.aspectRatio),
helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null, helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
}); });
//Default Theme //Default Theme
var aBorder = '1px solid #DEDEDE'; var aBorder = '1px solid #DEDEDE';
o.defaultTheme = { o.defaultTheme = {
'ui-resizable': { display: 'block' }, 'ui-resizable': { display: 'block' },
'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' }, 'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },
@ -45,7 +45,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder }, 'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },
'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder } 'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
}; };
o.knobTheme = { o.knobTheme = {
'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' }, 'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' }, 'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },
@ -57,17 +57,17 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' }, 'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },
'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' } 'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
}; };
o._nodeName = this.element[0].nodeName; o._nodeName = this.element[0].nodeName;
//Wrap the element if it cannot hold child nodes //Wrap the element if it cannot hold child nodes
if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) { if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
var el = this.element; var el = this.element;
//Opera fixing relative position //Opera fixing relative position
if (/relative/.test(el.css('position')) && $.browser.opera) if (/relative/.test(el.css('position')) && $.browser.opera)
el.css({ position: 'relative', top: 'auto', left: 'auto' }); el.css({ position: 'relative', top: 'auto', left: 'auto' });
//Create a wrapper element and set the wrapper to the new current internal element //Create a wrapper element and set the wrapper to the new current internal element
el.wrap( el.wrap(
$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( { $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( {
@ -78,40 +78,40 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
left: el.css('left') left: el.css('left')
}) })
); );
var oel = this.element; this.element = this.element.parent(); var oel = this.element; this.element = this.element.parent();
// store instance on wrapper // store instance on wrapper
this.element.data('resizable', this); this.element.data('resizable', this);
//Move margins to the wrapper //Move margins to the wrapper
this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"), this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom") marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
}); });
oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
//Prevent Safari textarea resize //Prevent Safari textarea resize
if ($.browser.safari && o.preventDefault) oel.css('resize', 'none'); if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' }); o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
// avoid IE jump // avoid IE jump
this.element.css({ margin: oel.css('margin') }); this.element.css({ margin: oel.css('margin') });
// fix handlers offset // fix handlers offset
this._proportionallyResize(); this._proportionallyResize();
} }
if(!o.handles) o.handles = !$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }; if(!o.handles) o.handles = !$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' };
if(o.handles.constructor == String) { if(o.handles.constructor == String) {
o.zIndex = o.zIndex || 1000; o.zIndex = o.zIndex || 1000;
if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw'; if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
var n = o.handles.split(","); o.handles = {}; var n = o.handles.split(","); o.handles = {};
// insertions are applied when don't have theme loaded // insertions are applied when don't have theme loaded
var insertionsDefault = { var insertionsDefault = {
handle: 'position: absolute; display: none; overflow:hidden;', handle: 'position: absolute; display: none; overflow:hidden;',
@ -124,18 +124,18 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
ne: 'top: 0pt; right: 0px;', ne: 'top: 0pt; right: 0px;',
nw: 'top: 0pt; left: 0px;' nw: 'top: 0pt; left: 0px;'
}; };
for(var i = 0; i < n.length; i++) { for(var i = 0; i < n.length; i++) {
var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'), var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'),
allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {}); allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});
// increase zIndex of sw, se, ne, nw axis // increase zIndex of sw, se, ne, nw axis
var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {}; var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};
var defCss = (loadDefault ? insertionsDefault[handle] : ''), var defCss = (loadDefault ? insertionsDefault[handle] : ''),
axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex ); axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );
o.handles[handle] = '.ui-resizable-'+handle; o.handles[handle] = '.ui-resizable-'+handle;
this.element.append( this.element.append(
//Theme detection, if not loaded, load o.defaultTheme //Theme detection, if not loaded, load o.defaultTheme
axis.css( loadDefault ? allDefTheme : {} ) axis.css( loadDefault ? allDefTheme : {} )
@ -143,60 +143,60 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
.css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles) .css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)
); );
} }
if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} ); if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
} }
this._renderAxis = function(target) { this._renderAxis = function(target) {
target = target || this.element; target = target || this.element;
for(var i in o.handles) { for(var i in o.handles) {
if(o.handles[i].constructor == String) if(o.handles[i].constructor == String)
o.handles[i] = $(o.handles[i], this.element).show(); o.handles[i] = $(o.handles[i], this.element).show();
if (o.transparent) if (o.transparent)
o.handles[i].css({opacity:0}); o.handles[i].css({opacity:0});
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
if (this.element.is('.ui-wrapper') && if (this.element.is('.ui-wrapper') &&
o._nodeName.match(/textarea|input|select|button/i)) { o._nodeName.match(/textarea|input|select|button/i)) {
var axis = $(o.handles[i], this.element), padWrapper = 0; var axis = $(o.handles[i], this.element), padWrapper = 0;
//Checking the correct pad and border //Checking the correct pad and border
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
//The padding type i have to apply... //The padding type i have to apply...
var padPos = [ 'padding', var padPos = [ 'padding',
/ne|nw|n/.test(i) ? 'Top' : /ne|nw|n/.test(i) ? 'Top' :
/se|sw|s/.test(i) ? 'Bottom' : /se|sw|s/.test(i) ? 'Bottom' :
/^e$/.test(i) ? 'Right' : 'Left' ].join(""); /^e$/.test(i) ? 'Right' : 'Left' ].join("");
if (!o.transparent) if (!o.transparent)
target.css(padPos, padWrapper); target.css(padPos, padWrapper);
this._proportionallyResize(); this._proportionallyResize();
} }
if(!$(o.handles[i]).length) continue; if(!$(o.handles[i]).length) continue;
} }
}; };
this._renderAxis(this.element); this._renderAxis(this.element);
o._handles = $('.ui-resizable-handle', self.element); o._handles = $('.ui-resizable-handle', self.element);
if (o.disableSelection) if (o.disableSelection)
o._handles.each(function(i, e) { $.ui.disableSelection(e); }); o._handles.each(function(i, e) { $.ui.disableSelection(e); });
//Matching axis name //Matching axis name
o._handles.mouseover(function() { o._handles.mouseover(function() {
if (!o.resizing) { if (!o.resizing) {
if (this.className) if (this.className)
var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
//Axis, default = se //Axis, default = se
self.axis = o.axis = axis && axis[1] ? axis[1] : 'se'; self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
} }
}); });
//If we want to auto hide the elements //If we want to auto hide the elements
if (o.autoHide) { if (o.autoHide) {
o._handles.hide(); o._handles.hide();
@ -211,7 +211,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
} }
}); });
} }
this._mouseInit(); this._mouseInit();
}, },
plugins: {}, plugins: {},
@ -233,16 +233,16 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
}, },
destroy: function() { destroy: function() {
var el = this.element, wrapped = el.children(".ui-resizable").get(0); var el = this.element, wrapped = el.children(".ui-resizable").get(0);
this._mouseDestroy(); this._mouseDestroy();
var _destroy = function(exp) { var _destroy = function(exp) {
$(exp).removeClass("ui-resizable ui-resizable-disabled") $(exp).removeClass("ui-resizable ui-resizable-disabled")
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
}; };
_destroy(el); _destroy(el);
if (el.is('.ui-wrapper') && wrapped) { if (el.is('.ui-wrapper') && wrapped) {
el.parent().append( el.parent().append(
$(wrapped).css({ $(wrapped).css({
@ -253,55 +253,55 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
left: el.css('left') left: el.css('left')
}) })
).end().remove(); ).end().remove();
_destroy(wrapped); _destroy(wrapped);
} }
}, },
_mouseCapture: function(e) { _mouseCapture: function(e) {
if(this.options.disabled) return false; if(this.options.disabled) return false;
var handle = false; var handle = false;
for(var i in this.options.handles) { for(var i in this.options.handles) {
if($(this.options.handles[i])[0] == e.target) handle = true; if($(this.options.handles[i])[0] == e.target) handle = true;
} }
if (!handle) return false; if (!handle) return false;
return true; return true;
}, },
_mouseStart: function(e) { _mouseStart: function(e) {
var o = this.options, iniPos = this.element.position(), el = this.element, var o = this.options, iniPos = this.element.position(), el = this.element,
num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7; num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
o.resizing = true; o.resizing = true;
o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
// bugfix #1749 // bugfix #1749
if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
// sOffset decides if document scrollOffset will be added to the top/left of the resizable element // sOffset decides if document scrollOffset will be added to the top/left of the resizable element
var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position')); var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));
var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0; var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;
el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) }); el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
} }
//Opera fixing relative position //Opera fixing relative position
if ($.browser.opera && /relative/.test(el.css('position'))) if ($.browser.opera && /relative/.test(el.css('position')))
el.css({ position: 'relative', top: 'auto', left: 'auto' }); el.css({ position: 'relative', top: 'auto', left: 'auto' });
this._renderProxy(); this._renderProxy();
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
if (o.containment) { if (o.containment) {
curleft += $(o.containment).scrollLeft()||0; curleft += $(o.containment).scrollLeft()||0;
curtop += $(o.containment).scrollTop()||0; curtop += $(o.containment).scrollTop()||0;
} }
//Store needed variables //Store needed variables
this.offset = this.helper.offset(); this.offset = this.helper.offset();
this.position = { left: curleft, top: curtop }; this.position = { left: curleft, top: curtop };
@ -310,79 +310,79 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
this.originalPosition = { left: curleft, top: curtop }; this.originalPosition = { left: curleft, top: curtop };
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
this.originalMousePosition = { left: e.pageX, top: e.pageY }; this.originalMousePosition = { left: e.pageX, top: e.pageY };
//Aspect Ratio //Aspect Ratio
o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1); o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1);
if (o.preserveCursor) if (o.preserveCursor)
$('body').css('cursor', this.axis + '-resize'); $('body').css('cursor', this.axis + '-resize');
this._propagate("start", e); this._propagate("start", e);
return true; return true;
}, },
_mouseDrag: function(e) { _mouseDrag: function(e) {
//Increase performance, avoid regex //Increase performance, avoid regex
var el = this.helper, o = this.options, props = {}, var el = this.helper, o = this.options, props = {},
self = this, smp = this.originalMousePosition, a = this.axis; self = this, smp = this.originalMousePosition, a = this.axis;
var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0; var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;
var trigger = this._change[a]; var trigger = this._change[a];
if (!trigger) return false; if (!trigger) return false;
// Calculate the attrs that will be change // Calculate the attrs that will be change
var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
if (o._aspectRatio || e.shiftKey) if (o._aspectRatio || e.shiftKey)
data = this._updateRatio(data, e); data = this._updateRatio(data, e);
data = this._respectSize(data, e); data = this._respectSize(data, e);
// plugins callbacks need to be called first // plugins callbacks need to be called first
this._propagate("resize", e); this._propagate("resize", e);
el.css({ el.css({
top: this.position.top + "px", left: this.position.left + "px", top: this.position.top + "px", left: this.position.left + "px",
width: this.size.width + "px", height: this.size.height + "px" width: this.size.width + "px", height: this.size.height + "px"
}); });
if (!o.helper && o.proportionallyResize) if (!o.helper && o.proportionallyResize)
this._proportionallyResize(); this._proportionallyResize();
this._updateCache(data); this._updateCache(data);
// calling the user callback at the end // calling the user callback at the end
this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]); this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]);
return false; return false;
}, },
_mouseStop: function(e) { _mouseStop: function(e) {
this.options.resizing = false; this.options.resizing = false;
var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this; var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
if(o.helper) { if(o.helper) {
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), 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, soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
soffsetw = ista ? 0 : self.sizeDiff.width; soffsetw = ista ? 0 : self.sizeDiff.width;
var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
if (!o.animate) if (!o.animate)
this.element.css($.extend(s, { top: top, left: left })); this.element.css($.extend(s, { top: top, left: left }));
if (o.helper && !o.animate) this._proportionallyResize(); if (o.helper && !o.animate) this._proportionallyResize();
} }
if (o.preserveCursor) if (o.preserveCursor)
$('body').css('cursor', 'auto'); $('body').css('cursor', 'auto');
this._propagate("stop", e); this._propagate("stop", e);
if (o.helper) this.helper.remove(); if (o.helper) this.helper.remove();
return false; return false;
}, },
_updateCache: function(data) { _updateCache: function(data) {
@ -394,61 +394,61 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
if (data.width) this.size.width = data.width; if (data.width) this.size.width = data.width;
}, },
_updateRatio: function(data, e) { _updateRatio: function(data, e) {
var o = this.options, cpos = this.position, csize = this.size, a = this.axis; var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
if (data.height) data.width = (csize.height * o.aspectRatio); if (data.height) data.width = (csize.height * o.aspectRatio);
else if (data.width) data.height = (csize.width / o.aspectRatio); else if (data.width) data.height = (csize.width / o.aspectRatio);
if (a == 'sw') { if (a == 'sw') {
data.left = cpos.left + (csize.width - data.width); data.left = cpos.left + (csize.width - data.width);
data.top = null; data.top = null;
} }
if (a == 'nw') { if (a == 'nw') {
data.top = cpos.top + (csize.height - data.height); data.top = cpos.top + (csize.height - data.height);
data.left = cpos.left + (csize.width - data.width); data.left = cpos.left + (csize.width - data.width);
} }
return data; return data;
}, },
_respectSize: function(data, e) { _respectSize: function(data, e) {
var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis, var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis,
ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height, ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,
isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height; isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;
if (isminw) data.width = o.minWidth; if (isminw) data.width = o.minWidth;
if (isminh) data.height = o.minHeight; if (isminh) data.height = o.minHeight;
if (ismaxw) data.width = o.maxWidth; if (ismaxw) data.width = o.maxWidth;
if (ismaxh) data.height = o.maxHeight; if (ismaxh) data.height = o.maxHeight;
var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
if (isminw && cw) data.left = dw - o.minWidth; if (isminw && cw) data.left = dw - o.minWidth;
if (ismaxw && cw) data.left = dw - o.maxWidth; if (ismaxw && cw) data.left = dw - o.maxWidth;
if (isminh && ch) data.top = dh - o.minHeight; if (isminh && ch) data.top = dh - o.minHeight;
if (ismaxh && ch) data.top = dh - o.maxHeight; if (ismaxh && ch) data.top = dh - o.maxHeight;
// fixing jump error on top/left - bug #2330 // fixing jump error on top/left - bug #2330
var isNotwh = !data.width && !data.height; var isNotwh = !data.width && !data.height;
if (isNotwh && !data.left && data.top) data.top = null; if (isNotwh && !data.left && data.top) data.top = null;
else if (isNotwh && !data.top && data.left) data.left = null; else if (isNotwh && !data.top && data.left) data.left = null;
return data; return data;
}, },
_proportionallyResize: function() { _proportionallyResize: function() {
var o = this.options; var o = this.options;
if (!o.proportionallyResize) return; if (!o.proportionallyResize) return;
var prel = o.proportionallyResize, el = this.helper || this.element; var prel = o.proportionallyResize, el = this.helper || this.element;
if (!o.borderDif) { if (!o.borderDif) {
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
o.borderDif = $.map(b, function(v, i) { o.borderDif = $.map(b, function(v, i) {
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
return border + padding; return border + padding;
}); });
} }
prel.css({ prel.css({
@ -459,14 +459,14 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
_renderProxy: function() { _renderProxy: function() {
var el = this.element, o = this.options; var el = this.element, o = this.options;
this.elementOffset = el.offset(); this.elementOffset = el.offset();
if(o.helper) { if(o.helper) {
this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
// fix ie6 offset // fix ie6 offset
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
pxyoffset = ( ie6 ? 2 : -1 ); pxyoffset = ( ie6 ? 2 : -1 );
this.helper.addClass(o.helper).css({ this.helper.addClass(o.helper).css({
width: el.outerWidth() + pxyoffset, width: el.outerWidth() + pxyoffset,
height: el.outerHeight() + pxyoffset, height: el.outerHeight() + pxyoffset,
@ -475,14 +475,14 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
top: this.elementOffset.top - ie6offset +'px', top: this.elementOffset.top - ie6offset +'px',
zIndex: ++o.zIndex zIndex: ++o.zIndex
}); });
this.helper.appendTo("body"); this.helper.appendTo("body");
if (o.disableSelection) if (o.disableSelection)
$.ui.disableSelection(this.helper.get(0)); $.ui.disableSelection(this.helper.get(0));
} else { } else {
this.helper = el; this.helper = el;
} }
}, },
_change: { _change: {
@ -537,97 +537,97 @@ $.extend($.ui.resizable, {
*/ */
$.ui.plugin.add("resizable", "containment", { $.ui.plugin.add("resizable", "containment", {
start: function(e, ui) { start: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"), 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; var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
if (!ce) return; if (!ce) return;
self.containerElement = $(ce); self.containerElement = $(ce);
if (/document/.test(oc) || oc == document) { if (/document/.test(oc) || oc == document) {
self.containerOffset = { left: 0, top: 0 }; self.containerOffset = { left: 0, top: 0 };
self.containerPosition = { left: 0, top: 0 }; self.containerPosition = { left: 0, top: 0 };
self.parentData = { self.parentData = {
element: $(document), left: 0, top: 0, element: $(document), left: 0, top: 0,
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
}; };
} }
// i'm a node, so compute top, left, right, bottom // i'm a node, so compute top, left, right, bottom
else{ else{
self.containerOffset = $(ce).offset(); self.containerOffset = $(ce).offset();
self.containerPosition = $(ce).position(); self.containerPosition = $(ce).position();
self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() }; self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };
var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
self.parentData = { self.parentData = {
element: ce, left: co.left, top: co.top, width: width, height: height element: ce, left: co.left, top: co.top, width: width, height: height
}; };
} }
}, },
resize: function(e, ui) { resize: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"), var o = ui.options, self = $(this).data("resizable"),
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
if (ce[0] != document && /static/.test(ce.css('position'))) if (ce[0] != document && /static/.test(ce.css('position')))
cop = self.containerPosition; cop = self.containerPosition;
if (cp.left < (o.helper ? co.left : cop.left)) { if (cp.left < (o.helper ? co.left : cop.left)) {
self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left)); self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
if (pRatio) self.size.height = self.size.width / o.aspectRatio; if (pRatio) self.size.height = self.size.width / o.aspectRatio;
self.position.left = o.helper ? co.left : cop.left; self.position.left = o.helper ? co.left : cop.left;
} }
if (cp.top < (o.helper ? co.top : 0)) { if (cp.top < (o.helper ? co.top : 0)) {
self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top); self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
if (pRatio) self.size.width = self.size.height * o.aspectRatio; if (pRatio) self.size.width = self.size.height * o.aspectRatio;
self.position.top = o.helper ? co.top : 0; self.position.top = o.helper ? co.top : 0;
} }
var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width, var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height; hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
if (woset + self.size.width >= self.parentData.width) { if (woset + self.size.width >= self.parentData.width) {
self.size.width = self.parentData.width - woset; self.size.width = self.parentData.width - woset;
if (pRatio) self.size.height = self.size.width / o.aspectRatio; if (pRatio) self.size.height = self.size.width / o.aspectRatio;
} }
if (hoset + self.size.height >= self.parentData.height) { if (hoset + self.size.height >= self.parentData.height) {
self.size.height = self.parentData.height - hoset; self.size.height = self.parentData.height - hoset;
if (pRatio) self.size.width = self.size.height * o.aspectRatio; if (pRatio) self.size.width = self.size.height * o.aspectRatio;
} }
}, },
stop: function(e, ui){ stop: function(e, ui){
var o = ui.options, self = $(this).data("resizable"), cp = self.position, var o = ui.options, self = $(this).data("resizable"), cp = self.position,
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight(); var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
if (o.helper && !o.animate && /relative/.test(ce.css('position'))) if (o.helper && !o.animate && /relative/.test(ce.css('position')))
$(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h }); $(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });
if (o.helper && !o.animate && /static/.test(ce.css('position'))) if (o.helper && !o.animate && /static/.test(ce.css('position')))
$(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h }); $(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });
} }
}); });
$.ui.plugin.add("resizable", "grid", { $.ui.plugin.add("resizable", "grid", {
resize: function(e, ui) { resize: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey; var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey;
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; 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); 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);
if (/^(se|s|e)$/.test(a)) { if (/^(se|s|e)$/.test(a)) {
self.size.width = os.width + ox; self.size.width = os.width + ox;
self.size.height = os.height + oy; self.size.height = os.height + oy;
@ -649,83 +649,83 @@ $.ui.plugin.add("resizable", "grid", {
self.position.left = op.left - ox; self.position.left = op.left - ox;
} }
} }
}); });
$.ui.plugin.add("resizable", "animate", { $.ui.plugin.add("resizable", "animate", {
stop: function(e, ui) { stop: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"); var o = ui.options, self = $(this).data("resizable");
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), 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, soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
soffsetw = ista ? 0 : self.sizeDiff.width; soffsetw = ista ? 0 : self.sizeDiff.width;
var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
self.element.animate( self.element.animate(
$.extend(style, top && left ? { top: top, left: left } : {}), { $.extend(style, top && left ? { top: top, left: left } : {}), {
duration: o.animateDuration || "slow", easing: o.animateEasing || "swing", duration: o.animateDuration || "slow", easing: o.animateEasing || "swing",
step: function() { step: function() {
var data = { var data = {
width: parseInt(self.element.css('width'), 10), width: parseInt(self.element.css('width'), 10),
height: parseInt(self.element.css('height'), 10), height: parseInt(self.element.css('height'), 10),
top: parseInt(self.element.css('top'), 10), top: parseInt(self.element.css('top'), 10),
left: parseInt(self.element.css('left'), 10) left: parseInt(self.element.css('left'), 10)
}; };
if (pr) pr.css({ width: data.width, height: data.height }); if (pr) pr.css({ width: data.width, height: data.height });
// propagating resize, and updating values for each animation step // propagating resize, and updating values for each animation step
self._updateCache(data); self._updateCache(data);
self._propagate("animate", e); self._propagate("animate", e);
} }
} }
); );
} }
}); });
$.ui.plugin.add("resizable", "ghost", { $.ui.plugin.add("resizable", "ghost", {
start: function(e, ui) { start: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"), 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(); if (!pr) self.ghost = self.element.clone();
else self.ghost = pr.clone(); else self.ghost = pr.clone();
self.ghost.css( self.ghost.css(
{ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 } { opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }
) )
.addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : ''); .addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');
self.ghost.appendTo(self.helper); self.ghost.appendTo(self.helper);
}, },
resize: function(e, ui){ resize: function(e, ui){
var o = ui.options, self = $(this).data("resizable"), 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 }); if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
}, },
stop: function(e, ui){ stop: function(e, ui){
var o = ui.options, self = $(this).data("resizable"), 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)); if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
} }
}); });
$.ui.plugin.add("resizable", "alsoResize", { $.ui.plugin.add("resizable", "alsoResize", {
start: function(e, ui) { start: function(e, ui) {
var o = ui.options, self = $(this).data("resizable"), var o = ui.options, self = $(this).data("resizable"),
_store = function(exp) { _store = function(exp) {
$(exp).each(function() { $(exp).each(function() {
$(this).data("resizable-alsoresize", { $(this).data("resizable-alsoresize", {
@ -734,27 +734,27 @@ $.ui.plugin.add("resizable", "alsoResize", {
}); });
}); });
}; };
if (typeof(o.alsoResize) == 'object') { if (typeof(o.alsoResize) == 'object') {
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
}else{ }else{
_store(o.alsoResize); _store(o.alsoResize);
} }
}, },
resize: function(e, ui){ resize: function(e, ui){
var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition; var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
var delta = { var delta = {
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 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() { $(exp).each(function() {
var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
$.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
var sum = (start[prop]||0) + (delta[prop]||0); var sum = (start[prop]||0) + (delta[prop]||0);
if (sum && sum >= 0) if (sum && sum >= 0)
@ -763,14 +763,14 @@ $.ui.plugin.add("resizable", "alsoResize", {
$(this).css(style); $(this).css(style);
}); });
}; };
if (typeof(o.alsoResize) == 'object') { if (typeof(o.alsoResize) == 'object') {
$.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
}else{ }else{
_alsoResize(o.alsoResize); _alsoResize(o.alsoResize);
} }
}, },
stop: function(e, ui){ stop: function(e, ui){
$(this).removeData("resizable-alsoresize-start"); $(this).removeData("resizable-alsoresize-start");
} }

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Richard D. Worth (rdworth.org) * Copyright (c) 2008 Richard D. Worth (rdworth.org)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Selectables * http://docs.jquery.com/UI/Selectables
* *
* Depends: * Depends:
@ -15,9 +15,9 @@
$.widget("ui.selectable", $.extend({}, $.ui.mouse, { $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
var self = this; var self = this;
this.element.addClass("ui-selectable"); this.element.addClass("ui-selectable");
this.dragged = false; this.dragged = false;
// cache selectee children based on filter // cache selectee children based on filter
@ -44,9 +44,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
this.refresh(); this.refresh();
this.selectees = selectees.addClass("ui-selectee"); this.selectees = selectees.addClass("ui-selectee");
this._mouseInit(); this._mouseInit();
this.helper = $(document.createElement('div')) this.helper = $(document.createElement('div'))
.css({border:'1px dotted black'}) .css({border:'1px dotted black'})
.addClass("ui-selectable-helper"); .addClass("ui-selectable-helper");
@ -67,9 +67,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
}, },
_mouseStart: function(e) { _mouseStart: function(e) {
var self = this; var self = this;
this.opos = [e.pageX, e.pageY]; this.opos = [e.pageX, e.pageY];
if (this.options.disabled) if (this.options.disabled)
return; return;
@ -114,7 +114,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
}], options.unselecting); }], options.unselecting);
} }
}); });
var isSelectee = false; var isSelectee = false;
$(e.target).parents().andSelf().each(function() { $(e.target).parents().andSelf().each(function() {
if($.data(this, "selectable-item")) isSelectee = true; if($.data(this, "selectable-item")) isSelectee = true;
@ -124,7 +124,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
_mouseDrag: function(e) { _mouseDrag: function(e) {
var self = this; var self = this;
this.dragged = true; this.dragged = true;
if (this.options.disabled) if (this.options.disabled)
return; return;
@ -207,14 +207,14 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
} }
} }
}); });
return false; return false;
}, },
_mouseStop: function(e) { _mouseStop: function(e) {
var self = this; var self = this;
this.dragged = false; this.dragged = false;
var options = this.options; var options = this.options;
$('.ui-unselecting', this.element[0]).each(function() { $('.ui-unselecting', this.element[0]).each(function() {
@ -244,9 +244,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
selectable: self.element[0], selectable: self.element[0],
options: this.options options: this.options
}], this.options.stop); }], this.options.stop);
this.helper.remove(); this.helper.remove();
return false; return false;
} }
})); }));

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus * Copyright (c) 2008 Paul Bakaus
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Slider * http://docs.jquery.com/UI/Slider
* *
* Depends: * Depends:
@ -36,12 +36,12 @@ $.widget("ui.slider", {
this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]); this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
}, },
destroy: function() { destroy: function() {
this.element this.element
.removeClass("ui-slider ui-slider-disabled") .removeClass("ui-slider ui-slider-disabled")
.removeData("slider") .removeData("slider")
.unbind(".slider"); .unbind(".slider");
if(this.handle && this.handle.length) { if(this.handle && this.handle.length) {
this.handle this.handle
.unwrap("a"); .unwrap("a");
@ -49,28 +49,28 @@ $.widget("ui.slider", {
$(this).data("mouse")._mouseDestroy(); $(this).data("mouse")._mouseDestroy();
}); });
} }
this.generated && this.generated.remove(); this.generated && this.generated.remove();
}, },
_setData: function(key, value) { _setData: function(key, value) {
$.widget.prototype._setData.apply(this, arguments); $.widget.prototype._setData.apply(this, arguments);
if (/min|max|steps/.test(key)) { if (/min|max|steps/.test(key)) {
this._initBoundaries(); this._initBoundaries();
} }
if(key == "range") { if(key == "range") {
value ? this.handle.length == 2 && this._createRange() : this._removeRange(); value ? this.handle.length == 2 && this._createRange() : this._removeRange();
} }
}, },
_init: function() { _init: function() {
var self = this; var self = this;
this.element.addClass("ui-slider"); this.element.addClass("ui-slider");
this._initBoundaries(); this._initBoundaries();
// Initialize mouse and key events for interaction // Initialize mouse and key events for interaction
this.handle = $(this.options.handle, this.element); this.handle = $(this.options.handle, this.element);
if (!this.handle.length) { if (!this.handle.length) {
@ -81,21 +81,21 @@ $.widget("ui.slider", {
return handle[0]; return handle[0];
}); });
} }
var handleclass = function(el) { var handleclass = function(el) {
this.element = $(el); this.element = $(el);
this.element.data("mouse", this); this.element.data("mouse", this);
this.options = self.options; this.options = self.options;
this.element.bind("mousedown", function() { this.element.bind("mousedown", function() {
if(self.currentHandle) this.blur(self.currentHandle); if(self.currentHandle) this.blur(self.currentHandle);
self._focus(this, true); self._focus(this, true);
}); });
this._mouseInit(); this._mouseInit();
}; };
$.extend(handleclass.prototype, $.ui.mouse, { $.extend(handleclass.prototype, $.ui.mouse, {
_mouseStart: function(e) { return self._start.call(self, e, this.element[0]); }, _mouseStart: function(e) { return self._start.call(self, e, this.element[0]); },
_mouseStop: function(e) { return self._stop.call(self, e, this.element[0]); }, _mouseStop: function(e) { return self._stop.call(self, e, this.element[0]); },
@ -103,8 +103,8 @@ $.widget("ui.slider", {
_mouseCapture: function() { return true; }, _mouseCapture: function() { return true; },
trigger: function(e) { this._mouseDown(e); } trigger: function(e) { this._mouseDown(e); }
}); });
$(this.handle) $(this.handle)
.each(function() { .each(function() {
new handleclass(this); new handleclass(this);
@ -116,14 +116,14 @@ $.widget("ui.slider", {
.bind('blur', function(e) { self._blur(this.firstChild); }) .bind('blur', function(e) { self._blur(this.firstChild); })
.bind('keydown', function(e) { if(!self.options.noKeyboard) return self._keydown(e.keyCode, this.firstChild); }) .bind('keydown', function(e) { if(!self.options.noKeyboard) return self._keydown(e.keyCode, this.firstChild); })
; ;
// Bind the click to the slider itself // Bind the click to the slider itself
this.element.bind('mousedown.slider', function(e) { this.element.bind('mousedown.slider', function(e) {
self._click.apply(self, [e]); self._click.apply(self, [e]);
self.currentHandle.data("mouse").trigger(e); self.currentHandle.data("mouse").trigger(e);
self.firstValue = self.firstValue + 1; //This is for always triggering the change event self.firstValue = self.firstValue + 1; //This is for always triggering the change event
}); });
// Move the first handle to the startValue // Move the first handle to the startValue
$.each(this.options.handles || [], function(index, handle) { $.each(this.options.handles || [], function(index, handle) {
self.moveTo(handle.start, index, true); self.moveTo(handle.start, index, true);
@ -135,10 +135,10 @@ $.widget("ui.slider", {
if(this.handle.length == 2 && this.options.range) this._createRange(); if(this.handle.length == 2 && this.options.range) this._createRange();
}, },
_initBoundaries: function() { _initBoundaries: function() {
var element = this.element[0], o = this.options; var element = this.element[0], o = this.options;
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() }; this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
$.extend(o, { $.extend(o, {
axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'), axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }), max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),
@ -156,7 +156,7 @@ $.widget("ui.slider", {
}; };
}, },
_keydown: function(keyCode, handle) { _keydown: function(keyCode, handle) {
var k = keyCode; var k = keyCode;
if(/(33|34|35|36|37|38|39|40)/.test(k)) { if(/(33|34|35|36|37|38|39|40)/.test(k)) {
@ -192,9 +192,9 @@ $.widget("ui.slider", {
// - The user didn't click a handle // - The user didn't click a handle
// - The Slider is not disabled // - The Slider is not disabled
// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move) // - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
var pointer = [e.pageX,e.pageY]; var pointer = [e.pageX,e.pageY];
var clickedHandle = false; var clickedHandle = false;
this.handle.each(function() { this.handle.each(function() {
if(this == e.target) if(this == e.target)
@ -206,7 +206,7 @@ $.widget("ui.slider", {
// If a previous handle was focussed, focus it again // If a previous handle was focussed, focus it again
if (!this.currentHandle && this.previousHandle) if (!this.currentHandle && this.previousHandle)
this._focus(this.previousHandle, true); this._focus(this.previousHandle, true);
// propagate only for distance > 0, otherwise propagation is done my drag // propagate only for distance > 0, otherwise propagation is done my drag
this.offset = this.element.offset(); this.offset = this.element.offset();
@ -215,7 +215,7 @@ $.widget("ui.slider", {
x: this._convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x") x: this._convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")
}, null, !this.options.distance); }, null, !this.options.distance);
}, },
_createRange: function() { _createRange: function() {
@ -248,7 +248,7 @@ $.widget("ui.slider", {
if(!axis) axis = this.options.axis == "vertical" ? "y" : "x"; if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";
var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle); var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
if(curHandle.data("mouse").sliderValue) { if(curHandle.data("mouse").sliderValue) {
return parseInt(curHandle.data("mouse").sliderValue[axis],10); return parseInt(curHandle.data("mouse").sliderValue[axis],10);
} else { } else {
@ -259,7 +259,7 @@ $.widget("ui.slider", {
_convertValue: function(value,axis) { _convertValue: function(value,axis) {
return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis))) * this.options.realMax[axis]; return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis))) * this.options.realMax[axis];
}, },
_translateValue: function(value,axis) { _translateValue: function(value,axis) {
return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis)); return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis));
}, },
@ -288,7 +288,7 @@ $.widget("ui.slider", {
return value; return value;
}, },
_handleSize: function(handle,axis) { _handleSize: function(handle,axis) {
return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")]; return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")];
}, },
_oneStep: function(axis) { _oneStep: function(axis) {
return this.options.stepping[axis] || 1; return this.options.stepping[axis] || 1;
@ -299,28 +299,28 @@ $.widget("ui.slider", {
_start: function(e, handle) { _start: function(e, handle) {
var o = this.options; var o = this.options;
if(o.disabled) return false; if(o.disabled) return false;
// Prepare the outer size // Prepare the outer size
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() }; this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
// This is a especially ugly fix for strange blur events happening on mousemove events // This is a especially ugly fix for strange blur events happening on mousemove events
if (!this.currentHandle) if (!this.currentHandle)
this._focus(this.previousHandle, true); this._focus(this.previousHandle, true);
this.offset = this.element.offset(); this.offset = this.element.offset();
this.handleOffset = this.currentHandle.offset(); this.handleOffset = this.currentHandle.offset();
this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left }; this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
this.firstValue = this.value(); this.firstValue = this.value();
this._propagate('start', e); this._propagate('start', e);
this._drag(e, handle); this._drag(e, handle);
return true; return true;
}, },
_stop: function(e) { _stop: function(e) {
this._propagate('stop', e); this._propagate('stop', e);
@ -338,36 +338,36 @@ $.widget("ui.slider", {
position.left = this._translateLimits(position.left, "x"); position.left = this._translateLimits(position.left, "x");
position.top = this._translateLimits(position.top, "y"); position.top = this._translateLimits(position.top, "y");
if (o.stepping.x) { if (o.stepping.x) {
var value = this._convertValue(position.left, "x"); var value = this._convertValue(position.left, "x");
value = Math.round(value / o.stepping.x) * o.stepping.x; value = Math.round(value / o.stepping.x) * o.stepping.x;
position.left = this._translateValue(value, "x"); position.left = this._translateValue(value, "x");
} }
if (o.stepping.y) { if (o.stepping.y) {
var value = this._convertValue(position.top, "y"); var value = this._convertValue(position.top, "y");
value = Math.round(value / o.stepping.y) * o.stepping.y; value = Math.round(value / o.stepping.y) * o.stepping.y;
position.top = this._translateValue(value, "y"); position.top = this._translateValue(value, "y");
} }
position.left = this._translateRange(position.left, "x"); position.left = this._translateRange(position.left, "x");
position.top = this._translateRange(position.top, "y"); position.top = this._translateRange(position.top, "y");
if(o.axis != "vertical") this.currentHandle.css({ left: position.left }); if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
if(o.axis != "horizontal") this.currentHandle.css({ top: position.top }); if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
//Store the slider's value //Store the slider's value
this.currentHandle.data("mouse").sliderValue = { this.currentHandle.data("mouse").sliderValue = {
x: Math.round(this._convertValue(position.left, "x")) || 0, x: Math.round(this._convertValue(position.left, "x")) || 0,
y: Math.round(this._convertValue(position.top, "y")) || 0 y: Math.round(this._convertValue(position.top, "y")) || 0
}; };
if (this.rangeElement) if (this.rangeElement)
this._updateRange(); this._updateRange();
this._propagate('slide', e); this._propagate('slide', e);
return false; return false;
}, },
moveTo: function(value, handle, noPropagation) { moveTo: function(value, handle, noPropagation) {
var o = this.options; var o = this.options;
@ -377,12 +377,12 @@ $.widget("ui.slider", {
//If no handle has been passed, no current handle is available and we have multiple handles, return false //If no handle has been passed, no current handle is available and we have multiple handles, return false
if (handle == undefined && !this.currentHandle && this.handle.length != 1) if (handle == undefined && !this.currentHandle && this.handle.length != 1)
return false; return false;
//If only one handle is available, use it //If only one handle is available, use it
if (handle == undefined && !this.currentHandle) if (handle == undefined && !this.currentHandle)
handle = 0; handle = 0;
if (handle != undefined) if (handle != undefined)
this.currentHandle = this.previousHandle = $(this.handle[handle] || handle); this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
@ -401,7 +401,7 @@ $.widget("ui.slider", {
x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10); x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
} }
} }
if(y !== undefined && y.constructor != Number) { if(y !== undefined && y.constructor != Number) {
var me = /^\-\=/.test(y), pe = /^\+\=/.test(y); var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
if(me || pe) { if(me || pe) {
@ -427,16 +427,16 @@ $.widget("ui.slider", {
y = this._translateRange(y, "y"); y = this._translateRange(y, "y");
o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y }); o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
} }
if (this.rangeElement) if (this.rangeElement)
this._updateRange(); this._updateRange();
//Store the slider's value //Store the slider's value
this.currentHandle.data("mouse").sliderValue = { this.currentHandle.data("mouse").sliderValue = {
x: Math.round(this._convertValue(x, "x")) || 0, x: Math.round(this._convertValue(x, "x")) || 0,
y: Math.round(this._convertValue(y, "y")) || 0 y: Math.round(this._convertValue(y, "y")) || 0
}; };
if (!noPropagation) { if (!noPropagation) {
this._propagate('start', null); this._propagate('start', null);
this._propagate('stop', null); this._propagate('stop', null);

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Paul Bakaus * Copyright (c) 2008 Paul Bakaus
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* http://docs.jquery.com/UI/Sortables * http://docs.jquery.com/UI/Sortables
* *
* Depends: * Depends:
@ -12,16 +12,16 @@
*/ */
(function($) { (function($) {
function contains(a, b) { function contains(a, b) {
var safari2 = $.browser.safari && $.browser.version < 522; var safari2 = $.browser.safari && $.browser.version < 522;
if (a.contains && !safari2) { if (a.contains && !safari2) {
return a.contains(b); return a.contains(b);
} }
if (a.compareDocumentPosition) if (a.compareDocumentPosition)
return !!(a.compareDocumentPosition(b) & 16); return !!(a.compareDocumentPosition(b) & 16);
while (b = b.parentNode) while (b = b.parentNode)
if (b == a) return true; if (b == a) return true;
return false; return false;
}; };
$.widget("ui.sortable", $.extend({}, $.ui.mouse, { $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
@ -30,19 +30,19 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
var o = this.options; var o = this.options;
this.containerCache = {}; this.containerCache = {};
this.element.addClass("ui-sortable"); this.element.addClass("ui-sortable");
//Get the items //Get the items
this.refresh(); this.refresh();
//Let's determine if the items are floating //Let's determine if the items are floating
this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
//Let's determine the parent's offset //Let's determine the parent's offset
this.offset = this.element.offset(); this.offset = this.element.offset();
//Initialize mouse events for interaction //Initialize mouse events for interaction
this._mouseInit(); this._mouseInit();
}, },
plugins: {}, plugins: {},
ui: function(inst) { ui: function(inst) {
@ -55,70 +55,70 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
element: this.element, element: this.element,
item: (inst || this)["currentItem"], item: (inst || this)["currentItem"],
sender: inst ? inst.element : null sender: inst ? inst.element : null
}; };
}, },
_propagate: function(n,e,inst, noPropagation) { _propagate: function(n,e,inst, noPropagation) {
$.ui.plugin.call(this, n, [e, this.ui(inst)]); $.ui.plugin.call(this, n, [e, this.ui(inst)]);
if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]); if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
}, },
serialize: function(o) { serialize: function(o) {
var items = this._getItemsAsjQuery(o && o.connected); var items = this._getItemsAsjQuery(o && o.connected);
var str = []; o = o || {}; var str = []; o = o || {};
$(items).each(function() { $(items).each(function() {
var res = ($(this.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); var res = ($(this.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
}); });
return str.join('&'); return str.join('&');
}, },
toArray: function(o) { toArray: function(o) {
var items = this._getItemsAsjQuery(o && o.connected); var items = this._getItemsAsjQuery(o && o.connected);
var ret = []; var ret = [];
items.each(function() { ret.push($(this).attr(o.attr || 'id')); }); items.each(function() { ret.push($(this).attr(o.attr || 'id')); });
return ret; return ret;
}, },
/* Be careful with the following core functions */ /* Be careful with the following core functions */
_intersectsWith: function(item) { _intersectsWith: function(item) {
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height; y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
var l = item.left, r = l + item.width, var l = item.left, r = l + item.width,
t = item.top, b = t + item.height; t = item.top, b = t + item.height;
var dyClick = this.offset.click.top, dxClick = this.offset.click.left; var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
return isOverElement; return isOverElement;
} else { } else {
return (l < x1 + (this.helperProportions.width / 2) // Right Half return (l < x1 + (this.helperProportions.width / 2) // Right Half
&& x2 - (this.helperProportions.width / 2) < r // Left Half && x2 - (this.helperProportions.width / 2) < r // Left Half
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half && t < y1 + (this.helperProportions.height / 2) // Bottom Half
&& y2 - (this.helperProportions.height / 2) < b ); // Top Half && y2 - (this.helperProportions.height / 2) < b ); // Top Half
} }
}, },
_intersectsWithEdge: function(item) { _intersectsWithEdge: function(item) {
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height; y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
var l = item.left, r = l + item.width, var l = item.left, r = l + item.width,
t = item.top, b = t + item.height; t = item.top, b = t + item.height;
var dyClick = this.offset.click.top, dxClick = this.offset.click.left; var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
if(!isOverElement) return false; if(!isOverElement) return false;
@ -128,7 +128,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
} else { } else {
var height = item.height; var height = item.height;
var direction = y1 - this.updateOriginalPosition.top < 0 ? 2 : 1; // 2 = up var direction = y1 - this.updateOriginalPosition.top < 0 ? 2 : 1; // 2 = up
if (direction == 1 && (y1 + dyClick) < t + height/2) { return 2; } // up if (direction == 1 && (y1 + dyClick) < t + height/2) { return 2; } // up
else if (direction == 2 && (y1 + dyClick) > t + height/2) { return 1; } // down else if (direction == 2 && (y1 + dyClick) > t + height/2) { return 1; } // down
} }
@ -138,7 +138,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
&& x2 - (this.helperProportions.width / 2) < r // Left Half && x2 - (this.helperProportions.width / 2) < r // Left Half
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half && t < y1 + (this.helperProportions.height / 2) // Bottom Half
&& y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half && y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
if(this.floating) { if(this.floating) {
if(x2 > l && x1 < l) return 2; //Crosses left edge if(x2 > l && x1 < l) return 2; //Crosses left edge
if(x1 < r && x2 > r) return 1; //Crosses right edge if(x1 < r && x2 > r) return 1; //Crosses right edge
@ -147,22 +147,22 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
if(y1 < b && y2 > b) return 2; //Crosses bottom edge if(y1 < b && y2 > b) return 2; //Crosses bottom edge
} }
} }
return false; return false;
}, },
refresh: function() { refresh: function() {
this._refreshItems(); this._refreshItems();
this.refreshPositions(); this.refreshPositions();
}, },
_getItemsAsjQuery: function(connected) { _getItemsAsjQuery: function(connected) {
var self = this; var self = this;
var items = []; var items = [];
var queries = []; var queries = [];
if(this.options.connectWith && connected) { if(this.options.connectWith && connected) {
for (var i = this.options.connectWith.length - 1; i >= 0; i--){ for (var i = this.options.connectWith.length - 1; i >= 0; i--){
var cur = $(this.options.connectWith[i]); var cur = $(this.options.connectWith[i]);
@ -174,7 +174,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
}; };
}; };
} }
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]); queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]);
for (var i = queries.length - 1; i >= 0; i--){ for (var i = queries.length - 1; i >= 0; i--){
@ -182,34 +182,34 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
items.push(this); items.push(this);
}); });
}; };
return $(items); return $(items);
}, },
_removeCurrentsFromItems: function() { _removeCurrentsFromItems: function() {
var list = this.currentItem.find(":data(sortable-item)"); var list = this.currentItem.find(":data(sortable-item)");
for (var i=0; i < this.items.length; i++) { for (var i=0; i < this.items.length; i++) {
for (var j=0; j < list.length; j++) { for (var j=0; j < list.length; j++) {
if(list[j] == this.items[i].item[0]) if(list[j] == this.items[i].item[0])
this.items.splice(i,1); this.items.splice(i,1);
}; };
}; };
}, },
_refreshItems: function() { _refreshItems: function() {
this.items = []; this.items = [];
this.containers = [this]; this.containers = [this];
var items = this.items; var items = this.items;
var self = this; var self = this;
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]]; var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]];
if(this.options.connectWith) { if(this.options.connectWith) {
for (var i = this.options.connectWith.length - 1; i >= 0; i--){ for (var i = this.options.connectWith.length - 1; i >= 0; i--){
var cur = $(this.options.connectWith[i]); var cur = $(this.options.connectWith[i]);
@ -236,7 +236,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
}; };
}, },
refreshPositions: function(fast) { refreshPositions: function(fast) {
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
@ -245,23 +245,23 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.offset.parent = { top: po.top + this.offsetParentBorders.top, left: po.left + this.offsetParentBorders.left }; this.offset.parent = { top: po.top + this.offsetParentBorders.top, left: po.left + this.offsetParentBorders.left };
} }
for (var i = this.items.length - 1; i >= 0; i--){ for (var i = this.items.length - 1; i >= 0; i--){
//We ignore calculating positions of all connected containers when we're not over them //We ignore calculating positions of all connected containers when we're not over them
if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0]) if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0])
continue; continue;
var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item; var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item;
if(!fast) { if(!fast) {
this.items[i].width = t[0].offsetWidth; this.items[i].width = t[0].offsetWidth;
this.items[i].height = t[0].offsetHeight; this.items[i].height = t[0].offsetHeight;
} }
var p = t.offset(); var p = t.offset();
this.items[i].left = p.left; this.items[i].left = p.left;
this.items[i].top = p.top; this.items[i].top = p.top;
}; };
if(this.options.custom && this.options.custom.refreshContainers) { if(this.options.custom && this.options.custom.refreshContainers) {
@ -277,20 +277,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
} }
}, },
destroy: function() { destroy: function() {
this.element this.element
.removeClass("ui-sortable ui-sortable-disabled") .removeClass("ui-sortable ui-sortable-disabled")
.removeData("sortable") .removeData("sortable")
.unbind(".sortable"); .unbind(".sortable");
this._mouseDestroy(); this._mouseDestroy();
for ( var i = this.items.length - 1; i >= 0; i-- ) for ( var i = this.items.length - 1; i >= 0; i-- )
this.items[i].item.removeData("sortable-item"); this.items[i].item.removeData("sortable-item");
}, },
_createPlaceholder: function(that) { _createPlaceholder: function(that) {
var self = that || this, o = self.options; var self = that || this, o = self.options;
if(!o.placeholder || o.placeholder.constructor == String) { if(!o.placeholder || o.placeholder.constructor == String) {
@ -308,22 +308,22 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
} }
}; };
} }
self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo(self.currentItem.parent()); self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo(self.currentItem.parent());
self.currentItem.before(self.placeholder); self.currentItem.before(self.placeholder);
o.placeholder.update(self, self.placeholder); o.placeholder.update(self, self.placeholder);
}, },
_contactContainers: function(e) { _contactContainers: function(e) {
for (var i = this.containers.length - 1; i >= 0; i--){ for (var i = this.containers.length - 1; i >= 0; i--){
if(this._intersectsWith(this.containers[i].containerCache)) { if(this._intersectsWith(this.containers[i].containerCache)) {
if(!this.containers[i].containerCache.over) { if(!this.containers[i].containerCache.over) {
if(this.currentContainer != this.containers[i]) { if(this.currentContainer != this.containers[i]) {
//When entering a new container, we will find the item with the least distance and append our item near it //When entering a new container, we will find the item with the least distance and append our item near it
var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top']; var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
for (var j = this.items.length - 1; j >= 0; j--) { for (var j = this.items.length - 1; j >= 0; j--) {
@ -333,20 +333,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
} }
} }
if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
continue; continue;
this.currentContainer = this.containers[i]; this.currentContainer = this.containers[i];
itemWithLeastDistance ? this.options.sortIndicator.call(this, e, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, e, null, this.containers[i].element, true); itemWithLeastDistance ? this.options.sortIndicator.call(this, e, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, e, null, this.containers[i].element, true);
this._propagate("change", e); //Call plugins and callbacks this._propagate("change", e); //Call plugins and callbacks
this.containers[i]._propagate("change", e, this); //Call plugins and callbacks this.containers[i]._propagate("change", e, this); //Call plugins and callbacks
//Update the placeholder //Update the placeholder
this.options.placeholder.update(this.currentContainer, this.placeholder); this.options.placeholder.update(this.currentContainer, this.placeholder);
} }
this.containers[i]._propagate("over", e, this); this.containers[i]._propagate("over", e, this);
this.containers[i].containerCache.over = 1; this.containers[i].containerCache.over = 1;
} }
@ -356,10 +356,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.containers[i].containerCache.over = 0; this.containers[i].containerCache.over = 0;
} }
} }
}; };
}, },
_mouseCapture: function(e, overrideHandle) { _mouseCapture: function(e, overrideHandle) {
if(this.options.disabled || this.options.type == 'static') return false; if(this.options.disabled || this.options.type == 'static') return false;
@ -368,7 +368,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this._refreshItems(); this._refreshItems();
//Find out if the clicked node (or one of its parents) is a actual item in this.items //Find out if the clicked node (or one of its parents) is a actual item in this.items
var currentItem = null, self = this, nodes = $(e.target).parents().each(function() { var currentItem = null, self = this, nodes = $(e.target).parents().each(function() {
if($.data(this, 'sortable-item') == self) { if($.data(this, 'sortable-item') == self) {
currentItem = $(this); currentItem = $(this);
return false; return false;
@ -379,29 +379,29 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
if(!currentItem) return false; if(!currentItem) return false;
if(this.options.handle && !overrideHandle) { if(this.options.handle && !overrideHandle) {
var validHandle = false; var validHandle = false;
$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; }); $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; });
if(!validHandle) return false; if(!validHandle) return false;
} }
this.currentItem = currentItem; this.currentItem = currentItem;
this._removeCurrentsFromItems(); this._removeCurrentsFromItems();
return true; return true;
}, },
createHelper: function() { createHelper: function() {
var o = this.options; var o = this.options;
var helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : (o.helper == "original" ? this.currentItem : this.currentItem.clone()); var helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : (o.helper == "original" ? this.currentItem : this.currentItem.clone());
if (!helper.parents('body').length) if (!helper.parents('body').length)
$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); //Add the helper to the DOM if that didn't happen already $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); //Add the helper to the DOM if that didn't happen already
return helper; return helper;
}, },
_mouseStart: function(e, overrideHandle, noActivation) { _mouseStart: function(e, overrideHandle, noActivation) {
var o = this.options; var o = this.options;
@ -410,8 +410,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
this.refreshPositions(); this.refreshPositions();
//Create and append the visible helper //Create and append the visible helper
this.helper = this.createHelper(); this.helper = this.createHelper();
/* /*
* - Position generation - * - Position generation -
@ -421,35 +421,35 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.margins = { //Cache the margins this.margins = { //Cache the margins
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
top: (parseInt(this.currentItem.css("marginTop"),10) || 0) top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
}; };
this.offset = this.currentItem.offset(); //The element's absolute position on the page this.offset = this.currentItem.offset(); //The element's absolute position on the page
this.offset = { //Substract the margins from the element's absolute offset this.offset = { //Substract the margins from the element's absolute offset
top: this.offset.top - this.margins.top, top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left left: this.offset.left - this.margins.left
}; };
this.offset.click = { //Where the click happened, relative to the element this.offset.click = { //Where the click happened, relative to the element
left: e.pageX - this.offset.left, left: e.pageX - this.offset.left,
top: e.pageY - this.offset.top top: e.pageY - this.offset.top
}; };
this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position
var po = this.offsetParent.offset(); var po = this.offsetParent.offset();
this.offsetParentBorders = { this.offsetParentBorders = {
top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
}; };
this.offset.parent = { //Store its position plus border this.offset.parent = { //Store its position plus border
top: po.top + this.offsetParentBorders.top, top: po.top + this.offsetParentBorders.top,
left: po.left + this.offsetParentBorders.left left: po.left + this.offsetParentBorders.left
}; };
this.updateOriginalPosition = this.originalPosition = this._generatePosition(e); //Generate the original position this.updateOriginalPosition = this.originalPosition = this._generatePosition(e); //Generate the original position
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //Cache the former DOM position this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //Cache the former DOM position
//If o.placeholder is used, create a new element at the given position with the class //If o.placeholder is used, create a new element at the given position with the class
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
@ -464,17 +464,17 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.helper this.helper
.css({ position: 'absolute', clear: 'both' }) .css({ position: 'absolute', clear: 'both' })
.addClass('ui-sortable-helper'); .addClass('ui-sortable-helper');
//Create the placeholder //Create the placeholder
this._createPlaceholder(); this._createPlaceholder();
//Call plugins and callbacks //Call plugins and callbacks
this._propagate("start", e); this._propagate("start", e);
//Recache the helper size //Recache the helper size
if(!this._preserveHelperProportions) if(!this._preserveHelperProportions)
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };
if(o.cursorAt) { if(o.cursorAt) {
if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left; if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;
if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right; if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right;
@ -485,8 +485,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
/* /*
* - Position constraining - * - Position constraining -
* Here we prepare position constraining like grid and containment. * Here we prepare position constraining like grid and containment.
*/ */
if(o.containment) { if(o.containment) {
if(o.containment == 'parent') o.containment = this.helper[0].parentNode; if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window') this.containment = [ if(o.containment == 'document' || o.containment == 'window') this.containment = [
@ -500,7 +500,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
var ce = $(o.containment)[0]; var ce = $(o.containment)[0];
var co = $(o.containment).offset(); var co = $(o.containment).offset();
var over = ($(ce).css("overflow") != 'hidden'); var over = ($(ce).css("overflow") != 'hidden');
this.containment = [ this.containment = [
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left, co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left,
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top, co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top,
@ -509,16 +509,16 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
]; ];
} }
} }
//Post 'activate' events to possible containers //Post 'activate' events to possible containers
if(!noActivation) { if(!noActivation) {
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); } for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); }
} }
//Prepare possible droppables //Prepare possible droppables
if($.ui.ddmanager) if($.ui.ddmanager)
$.ui.ddmanager.current = this; $.ui.ddmanager.current = this;
if ($.ui.ddmanager && !o.dropBehaviour) if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, e); $.ui.ddmanager.prepareOffsets(this, e);
@ -529,7 +529,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
}, },
_convertPositionTo: function(d, pos) { _convertPositionTo: function(d, pos) {
if(!pos) pos = this.position; if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1; var mod = d == "absolute" ? 1 : -1;
@ -548,9 +548,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
) )
}; };
}, },
_generatePosition: function(e) { _generatePosition: function(e) {
var o = this.options; var o = this.options;
var position = { var position = {
top: ( top: (
@ -566,9 +566,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
) )
}; };
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
/* /*
* - Position constraining - * - Position constraining -
* Constrain the position to a mix of grid, containment. * Constrain the position to a mix of grid, containment.
@ -579,18 +579,18 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
if(position.left > this.containment[2]) position.left = this.containment[2]; if(position.left > this.containment[2]) position.left = this.containment[2];
if(position.top > this.containment[3]) position.top = this.containment[3]; if(position.top > this.containment[3]) position.top = this.containment[3];
} }
if(o.grid) { if(o.grid) {
var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1]; var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0]; var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
} }
return position; return position;
}, },
_mouseDrag: function(e) { _mouseDrag: function(e) {
//Compute the helpers position //Compute the helpers position
@ -599,10 +599,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
//Call the internal plugins //Call the internal plugins
$.ui.plugin.call(this, "sort", [e, this.ui()]); $.ui.plugin.call(this, "sort", [e, this.ui()]);
//Regenerate the absolute position used for position checks //Regenerate the absolute position used for position checks
this.positionAbs = this._convertPositionTo("absolute"); this.positionAbs = this._convertPositionTo("absolute");
//Set the helper's position //Set the helper's position
this.helper[0].style.left = this.position.left+'px'; this.helper[0].style.left = this.position.left+'px';
this.helper[0].style.top = this.position.top+'px'; this.helper[0].style.top = this.position.top+'px';
@ -611,25 +611,25 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for (var i = this.items.length - 1; i >= 0; i--) { for (var i = this.items.length - 1; i >= 0; i--) {
var intersection = this._intersectsWithEdge(this.items[i]); var intersection = this._intersectsWithEdge(this.items[i]);
if(!intersection) continue; if(!intersection) continue;
if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before
&& !contains(this.placeholder[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked && !contains(this.placeholder[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked
&& (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true) && (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)
) { ) {
this.updateOriginalPosition = this._generatePosition(e); this.updateOriginalPosition = this._generatePosition(e);
this.direction = intersection == 1 ? "down" : "up"; this.direction = intersection == 1 ? "down" : "up";
this.options.sortIndicator.call(this, e, this.items[i]); this.options.sortIndicator.call(this, e, this.items[i]);
this._propagate("change", e); //Call plugins and callbacks this._propagate("change", e); //Call plugins and callbacks
break; break;
} }
} }
//Post events to containers //Post events to containers
this._contactContainers(e); this._contactContainers(e);
//Interconnect with droppables //Interconnect with droppables
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
@ -637,13 +637,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.element.triggerHandler("sort", [e, this.ui()], this.options["sort"]); this.element.triggerHandler("sort", [e, this.ui()], this.options["sort"]);
return false; return false;
}, },
_rearrange: function(e, i, a, hardRefresh) { _rearrange: function(e, i, a, hardRefresh) {
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
//Various things done here to improve the performance: //Various things done here to improve the performance:
// 1. we create a setTimeout, that calls refreshPositions // 1. we create a setTimeout, that calls refreshPositions
// 2. on the instance, we have a counter variable, that get's higher after every append // 2. on the instance, we have a counter variable, that get's higher after every append
@ -657,13 +657,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},0); },0);
}, },
_mouseStop: function(e, noPropagation) { _mouseStop: function(e, noPropagation) {
//If we are using droppables, inform the manager about the drop //If we are using droppables, inform the manager about the drop
if ($.ui.ddmanager && !this.options.dropBehaviour) if ($.ui.ddmanager && !this.options.dropBehaviour)
$.ui.ddmanager.drop(this, e); $.ui.ddmanager.drop(this, e);
if(this.options.revert) { if(this.options.revert) {
var self = this; var self = this;
var cur = self.placeholder.offset(); var cur = self.placeholder.offset();
@ -679,9 +679,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
} }
return false; return false;
}, },
_clear: function(e, noPropagation) { _clear: function(e, noPropagation) {
//We first have to update the dom position of the actual currentItem //We first have to update the dom position of the actual currentItem
@ -703,7 +703,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
} }
}; };
}; };
//Post events to containers //Post events to containers
for (var i = this.containers.length - 1; i >= 0; i--){ for (var i = this.containers.length - 1; i >= 0; i--){
this.containers[i]._propagate("deactivate", e, this, noPropagation); this.containers[i]._propagate("deactivate", e, this, noPropagation);
@ -712,22 +712,22 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.containers[i].containerCache.over = 0; this.containers[i].containerCache.over = 0;
} }
} }
this.dragging = false; this.dragging = false;
if(this.cancelHelperRemoval) { if(this.cancelHelperRemoval) {
this._propagate("beforeStop", e, null, noPropagation); this._propagate("beforeStop", e, null, noPropagation);
this._propagate("stop", e, null, noPropagation); this._propagate("stop", e, null, noPropagation);
return false; return false;
} }
this._propagate("beforeStop", e, null, noPropagation); this._propagate("beforeStop", e, null, noPropagation);
this.placeholder.remove(); this.placeholder.remove();
if(this.options.helper != "original") this.helper.remove(); this.helper = null; if(this.options.helper != "original") this.helper.remove(); this.helper = null;
this._propagate("stop", e, null, noPropagation); this._propagate("stop", e, null, noPropagation);
return true; return true;
} }
})); }));
@ -793,7 +793,7 @@ $.ui.plugin.add("sortable", "scroll", {
start: function(e, ui) { start: function(e, ui) {
var o = ui.options; var o = ui.options;
var i = $(this).data("sortable"); 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);
return $(document); return $(document);
@ -802,16 +802,16 @@ $.ui.plugin.add("sortable", "scroll", {
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode); do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
return $(document); return $(document);
}(i.currentItem); }(i.currentItem);
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset(); if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset(); if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
}, },
sort: function(e, ui) { sort: function(e, ui) {
var o = ui.options; var o = ui.options;
var i = $(this).data("sortable"); 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) - e.pageY < o.scrollSensitivity) if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed; i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
@ -823,7 +823,7 @@ $.ui.plugin.add("sortable", "scroll", {
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop() + o.scrollSpeed); $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
} }
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed; i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
@ -835,18 +835,18 @@ $.ui.plugin.add("sortable", "scroll", {
if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
} }
} }
}); });
$.ui.plugin.add("sortable", "axis", { $.ui.plugin.add("sortable", "axis", {
sort: function(e, ui) { sort: function(e, ui) {
var i = $(this).data("sortable"); var i = $(this).data("sortable");
if(ui.options.axis == "y") i.position.left = i.originalPosition.left; if(ui.options.axis == "y") i.position.left = i.originalPosition.left;
if(ui.options.axis == "x") i.position.top = i.originalPosition.top; if(ui.options.axis == "x") i.position.top = i.originalPosition.top;
} }
}); });

View File

@ -16,27 +16,27 @@ $.widget('ui.spinner', {
_init: function() { _init: function() {
// terminate initialization if spinner already applied to current element // terminate initialization if spinner already applied to current element
if($.data(this.element[0], 'spinner')) return; if($.data(this.element[0], 'spinner')) return;
// check for onInit callback // check for onInit callback
if (this.options.init) { if (this.options.init) {
this.options.init(this.ui(null)); this.options.init(this.ui(null));
} }
// check for decimals in steppinng and set _decimals as internal (needs cleaning up) // check for decimals in steppinng and set _decimals as internal (needs cleaning up)
this._decimals = 0; this._decimals = 0;
if (this.options.stepping.toString().indexOf('.') != -1) { if (this.options.stepping.toString().indexOf('.') != -1) {
var s = this.options.stepping.toString(); var s = this.options.stepping.toString();
this._decimals = s.slice(s.indexOf('.')+1, s.length).length; this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
} }
//Initialize needed constants //Initialize needed constants
var self = this; var self = this;
this.element this.element
.addClass('ui-spinner-box') .addClass('ui-spinner-box')
.attr('autocomplete', 'off'); // switch off autocomplete in opera .attr('autocomplete', 'off'); // switch off autocomplete in opera
this._setValue( isNaN(this._getValue()) ? this.options.start : this._getValue() ); this._setValue( isNaN(this._getValue()) ? this.options.start : this._getValue() );
this.element this.element
.wrap('<div>') .wrap('<div>')
.parent() .parent()
@ -117,9 +117,9 @@ $.widget('ui.spinner', {
self._propagate('change', e); self._propagate('change', e);
}) })
.end(); .end();
// DataList: Set contraints for object length and step size. // DataList: Set contraints for object length and step size.
// Manipulate height of spinner. // Manipulate height of spinner.
this._items = this.element.children().length; this._items = this.element.children().length;
if (this._items > 1) { if (this._items > 1) {
@ -136,7 +136,7 @@ $.widget('ui.spinner', {
this.options.min = 0; this.options.min = 0;
this.options.max = this._items-1; this.options.max = this._items-1;
} }
this.element this.element
.bind('keydown.spinner', function(e) { .bind('keydown.spinner', function(e) {
if(!self.counter) self.counter = 1; if(!self.counter) self.counter = 1;
@ -149,15 +149,15 @@ $.widget('ui.spinner', {
.bind('blur.spinner', function(e) { .bind('blur.spinner', function(e) {
self._cleanUp(); self._cleanUp();
}); });
if ($.fn.mousewheel) { if ($.fn.mousewheel) {
this.element.mousewheel(function(e, delta) { this.element.mousewheel(function(e, delta) {
self._mousewheel(e, delta); self._mousewheel(e, delta);
}); });
} }
}, },
_constrain: function() { _constrain: function() {
if(this.options.min != undefined && this._getValue() < this.options.min) this._setValue(this.options.min); if(this.options.min != undefined && this._getValue() < this.options.min) this._setValue(this.options.min);
if(this.options.max != undefined && this._getValue() > this.options.max) this._setValue(this.options.max); if(this.options.max != undefined && this._getValue() > this.options.max) this._setValue(this.options.max);
@ -168,7 +168,7 @@ $.widget('ui.spinner', {
}, },
_spin: function(d, e) { _spin: function(d, e) {
if (this.disabled) return; if (this.disabled) return;
if(isNaN(this._getValue())) this._setValue(this.options.start); if(isNaN(this._getValue())) this._setValue(this.options.start);
this._setValue(this._getValue() + (d == 'up' ? 1:-1) * (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping); this._setValue(this._getValue() + (d == 'up' ? 1:-1) * (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping);
this._animate(d); this._animate(d);
@ -201,14 +201,14 @@ $.widget('ui.spinner', {
}, },
_keydown: function(e) { _keydown: function(e) {
var KEYS = $.keyCode; var KEYS = $.keyCode;
if(e.keyCode == KEYS.UP) this._up(e); if(e.keyCode == KEYS.UP) this._up(e);
if(e.keyCode == KEYS.DOWN) this._down(e); if(e.keyCode == KEYS.DOWN) this._down(e);
if(e.keyCode == KEYS.HOME) this._setValue(this.options.min || this.options.start); //Home key goes to min, if defined, else to start if(e.keyCode == KEYS.HOME) this._setValue(this.options.min || this.options.start); //Home key goes to min, if defined, else to start
if(e.keyCode == KEYS.END && this.options.max != undefined) this._setValue(this.options.max); //End key goes to maximum if(e.keyCode == KEYS.END && this.options.max != undefined) this._setValue(this.options.max); //End key goes to maximum
return (e.keyCode == KEYS.TAB || e.keyCode == KEYS.BACKSPACE || return (e.keyCode == KEYS.TAB || e.keyCode == KEYS.BACKSPACE ||
e.keyCode == KEYS.LEFT || e.keyCode == KEYS.RIGHT || e.keyCode == KEYS.PERIOD || e.keyCode == KEYS.LEFT || e.keyCode == KEYS.RIGHT || e.keyCode == KEYS.PERIOD ||
e.keyCode == KEYS.NUMPAD_DECIMAL || e.keyCode == KEYS.NUMPAD_SUBTRACT || e.keyCode == KEYS.NUMPAD_DECIMAL || e.keyCode == KEYS.NUMPAD_SUBTRACT ||
(e.keyCode >= 96 && e.keyCode <= 105) || // add support for numeric keypad 0-9 (e.keyCode >= 96 && e.keyCode <= 105) || // add support for numeric keypad 0-9
(/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false; (/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false;
}, },
@ -223,15 +223,15 @@ $.widget('ui.spinner', {
_setValue: function(newVal) { _setValue: function(newVal) {
if(isNaN(newVal)) newVal = this.options.start; if(isNaN(newVal)) newVal = this.options.start;
this.element.val( this.element.val(
this.options.currency ? this.options.currency ?
$.ui.spinner.format.currency(newVal, this.options.currency) : $.ui.spinner.format.currency(newVal, this.options.currency) :
$.ui.spinner.format.number(newVal, this._decimals) $.ui.spinner.format.number(newVal, this._decimals)
); );
}, },
_animate: function(d) { _animate: function(d) {
if (this.element.hasClass('ui-spinner-list') && ((d == 'up' && this._getValue() <= this.options.max) || (d == 'down' && this._getValue() >= this.options.min)) ) { if (this.element.hasClass('ui-spinner-list') && ((d == 'up' && this._getValue() <= this.options.max) || (d == 'down' && this._getValue() >= this.options.min)) ) {
this.element.animate({marginTop: '-' + this._getValue() * this.element.outerHeight() }, { this.element.animate({marginTop: '-' + this._getValue() * this.element.outerHeight() }, {
duration: 'fast', duration: 'fast',
queue: false queue: false
}); });
} }
@ -245,8 +245,8 @@ $.widget('ui.spinner', {
this.element.append('<'+ wrapper +' class="ui-spinner-dyn">'+ html + '</'+ wrapper +'>'); this.element.append('<'+ wrapper +' class="ui-spinner-dyn">'+ html + '</'+ wrapper +'>');
} }
}, },
plugins: {}, plugins: {},
ui: function(e) { ui: function(e) {
return { return {

View File

@ -15,7 +15,7 @@
$.widget("ui.tabs", { $.widget("ui.tabs", {
_init: function() { _init: function() {
this.options.event += '.tabs'; // namespace event this.options.event += '.tabs'; // namespace event
// create tabs // create tabs
this._tabify(true); this._tabify(true);
}, },
@ -125,14 +125,14 @@ $.widget("ui.tabs", {
)).sort(); )).sort();
if ($.inArray(o.selected, o.disabled) != -1) if ($.inArray(o.selected, o.disabled) != -1)
o.disabled.splice($.inArray(o.selected, o.disabled), 1); o.disabled.splice($.inArray(o.selected, o.disabled), 1);
// highlight selected tab // highlight selected tab
this.$panels.addClass(o.hideClass); this.$panels.addClass(o.hideClass);
this.$lis.removeClass(o.selectedClass); this.$lis.removeClass(o.selectedClass);
if (o.selected !== null) { if (o.selected !== null) {
this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
this.$lis.eq(o.selected).addClass(o.selectedClass); this.$lis.eq(o.selected).addClass(o.selectedClass);
// seems to be expected behavior that the show callback is fired // seems to be expected behavior that the show callback is fired
var onShow = function() { var onShow = function() {
self._trigger('show', null, self._trigger('show', null,
@ -146,7 +146,7 @@ $.widget("ui.tabs", {
else else
onShow(); onShow();
} }
// clean up to avoid memory leaks in certain versions of IE 6 // clean up to avoid memory leaks in certain versions of IE 6
$(window).bind('unload', function() { $(window).bind('unload', function() {
self.$tabs.unbind('.tabs'); self.$tabs.unbind('.tabs');
@ -161,7 +161,7 @@ $.widget("ui.tabs", {
// set or update cookie after init and add/remove respectively // set or update cookie after init and add/remove respectively
if (o.cookie) if (o.cookie)
$.cookie('ui-tabs-' + $.data(self.element[0]), o.selected, o.cookie); $.cookie('ui-tabs-' + $.data(self.element[0]), o.selected, o.cookie);
// disable tabs // disable tabs
for (var i = 0, li; li = this.$lis[i]; i++) for (var i = 0, li; li = this.$lis[i]; i++)
$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass); $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
@ -169,7 +169,7 @@ $.widget("ui.tabs", {
// reset cache if switching from cached to not cached // reset cache if switching from cached to not cached
if (o.cache === false) if (o.cache === false)
this.$tabs.removeData('cache.tabs'); this.$tabs.removeData('cache.tabs');
// set up animations // set up animations
var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal'; var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';
if (o.fx && o.fx.constructor == Array) if (o.fx && o.fx.constructor == Array)
@ -227,12 +227,12 @@ $.widget("ui.tabs", {
$hide = self.$panels.filter(':visible'), $hide = self.$panels.filter(':visible'),
$show = $(this.hash); $show = $(this.hash);
// If tab is already selected and not unselectable or tab disabled or // If tab is already selected and not unselectable or tab disabled or
// or is already loading or click callback returns false stop here. // or is already loading or click callback returns false stop here.
// Check if click handler returns false last so that it is not executed // Check if click handler returns false last so that it is not executed
// for a disabled or loading tab! // for a disabled or loading tab!
if (($li.hasClass(o.selectedClass) && !o.unselect) if (($li.hasClass(o.selectedClass) && !o.unselect)
|| $li.hasClass(o.disabledClass) || $li.hasClass(o.disabledClass)
|| $(this).hasClass(o.loadingClass) || $(this).hasClass(o.loadingClass)
|| self._trigger('select', null, self.ui(this, $show[0])) === false || self._trigger('select', null, self.ui(this, $show[0])) === false
) { ) {
@ -282,7 +282,7 @@ $.widget("ui.tabs", {
}*/ }*/
var a = this; var a = this;
self.load(self.$tabs.index(this), $hide.length ? self.load(self.$tabs.index(this), $hide.length ?
function() { function() {
switchTab(a, $li, $hide, $show); switchTab(a, $li, $hide, $show);
} : } :
@ -320,7 +320,7 @@ $.widget("ui.tabs", {
}, },
add: function(url, label, index) { add: function(url, label, index) {
if (index == undefined) if (index == undefined)
index = this.$tabs.length; // append by default index = this.$tabs.length; // append by default
var o = this.options; var o = this.options;
@ -344,10 +344,10 @@ $.widget("ui.tabs", {
$li.insertBefore(this.$lis[index]); $li.insertBefore(this.$lis[index]);
$panel.insertBefore(this.$panels[index]); $panel.insertBefore(this.$panels[index]);
} }
o.disabled = $.map(o.disabled, o.disabled = $.map(o.disabled,
function(n, i) { return n >= index ? ++n : n }); function(n, i) { return n >= index ? ++n : n });
this._tabify(); this._tabify();
if (this.$tabs.length == 1) { if (this.$tabs.length == 1) {
@ -382,7 +382,7 @@ $.widget("ui.tabs", {
var o = this.options; var o = this.options;
if ($.inArray(index, o.disabled) == -1) if ($.inArray(index, o.disabled) == -1)
return; return;
var $li = this.$lis.eq(index).removeClass(o.disabledClass); var $li = this.$lis.eq(index).removeClass(o.disabledClass);
if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2... if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
$li.css('display', 'inline-block'); $li.css('display', 'inline-block');
@ -414,12 +414,12 @@ $.widget("ui.tabs", {
this.$tabs.eq(index).trigger(this.options.event); this.$tabs.eq(index).trigger(this.options.event);
}, },
load: function(index, callback) { // callback is for internal usage only load: function(index, callback) { // callback is for internal usage only
var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0], var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs'); bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
callback = callback || function() {}; callback = callback || function() {};
// no remote or from cache - just finish with callback // no remote or from cache - just finish with callback
if (!url || !bypassCache && $.data(a, 'cache.tabs')) { if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
callback(); callback();
@ -427,7 +427,7 @@ $.widget("ui.tabs", {
} }
// load remote from here on // load remote from here on
var inner = function(parent) { var inner = function(parent) {
var $parent = $(parent), $inner = $parent.find('*:last'); var $parent = $(parent), $inner = $parent.find('*:last');
return $inner.length && $inner.is(':not(img)') && $inner || $parent; return $inner.length && $inner.is(':not(img)') && $inner || $parent;
@ -440,7 +440,7 @@ $.widget("ui.tabs", {
}); });
self.xhr = null; self.xhr = null;
}; };
if (o.spinner) { if (o.spinner) {
var label = inner(a).html(); var label = inner(a).html();
inner(a).wrapInner('<em></em>') inner(a).wrapInner('<em></em>')
@ -452,16 +452,16 @@ $.widget("ui.tabs", {
success: function(r, s) { success: function(r, s) {
$(a.hash).html(r); $(a.hash).html(r);
cleanup(); cleanup();
if (o.cache) if (o.cache)
$.data(a, 'cache.tabs', true); // if loaded once do not load them again $.data(a, 'cache.tabs', true); // if loaded once do not load them again
// callbacks // callbacks
self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index])); self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
o.ajaxOptions.success && o.ajaxOptions.success(r, s); o.ajaxOptions.success && o.ajaxOptions.success(r, s);
// This callback is required because the switch has to take // This callback is required because the switch has to take
// place after loading has completed. Call last in order to // place after loading has completed. Call last in order to
// fire load before show callback... // fire load before show callback...
callback(); callback();
} }
@ -546,24 +546,24 @@ $.ui.tabs.getter = "length";
$.extend($.ui.tabs.prototype, { $.extend($.ui.tabs.prototype, {
rotation: null, rotation: null,
rotate: function(ms, continuing) { rotate: function(ms, continuing) {
continuing = continuing || false; continuing = continuing || false;
var self = this, t = this.options.selected; var self = this, t = this.options.selected;
function start() { function start() {
self.rotation = setInterval(function() { self.rotation = setInterval(function() {
t = ++t < self.$tabs.length ? t : 0; t = ++t < self.$tabs.length ? t : 0;
self.select(t); self.select(t);
}, ms); }, ms);
} }
function stop(e) { function stop(e) {
if (!e || e.clientX) { // only in case of a true click if (!e || e.clientX) { // only in case of a true click
clearInterval(self.rotation); clearInterval(self.rotation);
} }
} }
// start interval // start interval
if (ms) { if (ms) {
start(); start();