mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Remove Trailing Spaces
This commit is contained in:
parent
faec9388e2
commit
8d04c3594c
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Blind
|
||||
*
|
||||
* Depends:
|
||||
@ -18,22 +18,22 @@ $.effects.blind = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'vertical'; // Default direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
var ref = (direction == 'vertical') ? 'height' : 'width';
|
||||
var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
|
||||
if(mode == 'show') wrapper.css(ref, 0); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref] = mode == 'show' ? distance : 0;
|
||||
|
||||
|
||||
// Animate
|
||||
wrapper.animate(animation, o.duration, o.options.easing, function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -41,9 +41,9 @@ $.effects.blind = function(o) {
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Bounce
|
||||
*
|
||||
* 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 == 'hide') distance = distance / (times * 2);
|
||||
if (mode != 'hide') times--;
|
||||
|
||||
|
||||
// Animate
|
||||
if (mode == 'show') { // Show Bounce
|
||||
var animation = {opacity: 1};
|
||||
@ -72,7 +72,7 @@ $.effects.bounce = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Clip
|
||||
*
|
||||
* Depends:
|
||||
@ -18,11 +18,11 @@ $.effects.clip = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','height','width'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'vertical'; // Default direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
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();
|
||||
if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref.size] = mode == 'show' ? distance : 0;
|
||||
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
||||
|
||||
|
||||
// Animate
|
||||
animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
}});
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/
|
||||
*/
|
||||
;(function($) {
|
||||
@ -299,7 +299,7 @@ var colors = {
|
||||
yellow:[255,255,0],
|
||||
transparent: [255,255,255]
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
@ -307,33 +307,33 @@ var colors = {
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* 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:
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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,
|
||||
* 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
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* 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;
|
||||
},
|
||||
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;
|
||||
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
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* 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:
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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,
|
||||
* 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
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Drop
|
||||
*
|
||||
* Depends:
|
||||
@ -18,11 +18,11 @@ $.effects.drop = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','opacity'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default Direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el); // Create Wrapper
|
||||
@ -30,11 +30,11 @@ $.effects.drop = function(o) {
|
||||
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);
|
||||
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {opacity: mode == 'show' ? 1 : 0};
|
||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -42,9 +42,9 @@ $.effects.drop = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Explode
|
||||
*
|
||||
* Depends:
|
||||
@ -18,15 +18,15 @@ $.effects.explode = function(o) {
|
||||
|
||||
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;
|
||||
|
||||
|
||||
o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
|
||||
var el = $(this).show().css('visibility', 'hidden');
|
||||
var offset = el.offset();
|
||||
|
||||
|
||||
//Substract the margins - not fixing the problem yet.
|
||||
offset.top -= parseInt(el.css("marginTop")) || 0;
|
||||
offset.left -= parseInt(el.css("marginLeft")) || 0;
|
||||
|
||||
|
||||
var width = el.outerWidth(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
|
||||
setTimeout(function() {
|
||||
|
||||
|
||||
o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
|
||||
if(o.callback) o.callback.apply(el[0]); // Callback
|
||||
el.dequeue();
|
||||
|
||||
|
||||
$('.effects-explode').remove();
|
||||
|
||||
|
||||
}, o.duration || 500);
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Fold
|
||||
*
|
||||
* Depends:
|
||||
@ -18,12 +18,12 @@ $.effects.fold = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var size = o.options.size || 15; // Default fold size
|
||||
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
@ -33,12 +33,12 @@ $.effects.fold = function(o) {
|
||||
var percent = /([0-9]+)%/.exec(size);
|
||||
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
|
||||
|
||||
|
||||
// Animation
|
||||
var animation1 = {}, animation2 = {};
|
||||
animation1[ref[0]] = mode == 'show' ? distance[0] : size;
|
||||
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
||||
|
||||
|
||||
// Animate
|
||||
wrapper.animate(animation1, o.duration / 2, o.options.easing)
|
||||
.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
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Highlight
|
||||
*
|
||||
* Depends:
|
||||
@ -15,34 +15,34 @@
|
||||
$.effects.highlight = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var color = o.options.color || "#ffff99"; // Default highlight color
|
||||
var oldColor = el.css("backgroundColor");
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {backgroundColor: oldColor };
|
||||
if (mode == "hide") animation['opacity'] = 0;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == "hide") el.hide();
|
||||
$.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);
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Pulsate
|
||||
*
|
||||
* Depends:
|
||||
@ -15,14 +15,14 @@
|
||||
$.effects.pulsate = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var times = o.options.times || 5; // Default # of times
|
||||
|
||||
|
||||
// Adjust
|
||||
if (mode == 'hide') times--;
|
||||
if (el.is(':hidden')) { // Show fadeIn
|
||||
@ -31,7 +31,7 @@ $.effects.pulsate = function(o) {
|
||||
el.animate({opacity: 1}, o.duration / 2, o.options.easing);
|
||||
times = times-2;
|
||||
}
|
||||
|
||||
|
||||
// Animate
|
||||
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);
|
||||
@ -49,7 +49,7 @@ $.effects.pulsate = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Scale
|
||||
*
|
||||
* Depends:
|
||||
@ -18,34 +18,34 @@ $.effects.puff = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var options = $.extend(true, {}, o.options);
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var percent = parseInt(o.options.percent) || 150; // Set default puff percent
|
||||
options.fade = true; // It's not a puff if it doesn't fade! :)
|
||||
var original = {height: el.height(), width: el.width()}; // Save original
|
||||
|
||||
|
||||
// Adjust
|
||||
var factor = percent / 100;
|
||||
el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
|
||||
|
||||
|
||||
// Animation
|
||||
options.from = el.from;
|
||||
options.percent = (mode == 'hide') ? percent : 100;
|
||||
options.mode = mode;
|
||||
|
||||
|
||||
// Animate
|
||||
el.effect('scale', options, o.duration, o.callback);
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$.effects.scale = function(o) {
|
||||
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
@ -61,33 +61,33 @@ $.effects.scale = function(o) {
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
// Adjust
|
||||
var factor = { // Set scaling factor
|
||||
y: direction != 'horizontal' ? (percent / 100) : 1,
|
||||
x: direction != 'vertical' ? (percent / 100) : 1
|
||||
};
|
||||
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 (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
|
||||
if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
|
||||
};
|
||||
|
||||
|
||||
// Animation
|
||||
options.from = el.from; options.to = el.to; options.mode = mode;
|
||||
|
||||
|
||||
// Animate
|
||||
el.effect('size', options, o.duration, o.callback);
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$.effects.size = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
|
||||
var props1 = ['position','top','left','overflow','opacity']; // Always restore
|
||||
@ -95,7 +95,7 @@ $.effects.size = function(o) {
|
||||
var cProps = ['fontSize'];
|
||||
var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
|
||||
var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
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.createWrapper(el); // Create Wrapper
|
||||
el.css('overflow','hidden').css(el.from); // Shift
|
||||
|
||||
|
||||
// Animate
|
||||
if (scale == 'content' || scale == 'both') { // Scale the children
|
||||
vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
|
||||
@ -164,15 +164,15 @@ $.effects.size = function(o) {
|
||||
}); // Animate children
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
}});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Shake
|
||||
*
|
||||
* Depends:
|
||||
@ -18,26 +18,26 @@ $.effects.shake = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default direction
|
||||
var distance = o.options.distance || 20; // Default distance
|
||||
var times = o.options.times || 3; // Default # of times
|
||||
var speed = o.duration || o.options.duration || 140; // Default speed per shake
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el); // Create Wrapper
|
||||
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {}, animation1 = {}, animation2 = {};
|
||||
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
||||
animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
|
||||
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, speed, o.options.easing);
|
||||
for (var i = 1; i < times; i++) { // Shakes
|
||||
@ -51,7 +51,7 @@ $.effects.shake = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Slide
|
||||
*
|
||||
* Depends:
|
||||
@ -18,11 +18,11 @@ $.effects.slide = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default Direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.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 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
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -42,9 +42,9 @@ $.effects.slide = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Effects/Transfer
|
||||
*
|
||||
* Depends:
|
||||
@ -18,14 +18,14 @@ $.effects.transfer = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
var target = $(o.options.to); // Find Target
|
||||
var position = el.offset();
|
||||
var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body);
|
||||
if(o.options.className) transfer.addClass(o.options.className);
|
||||
|
||||
|
||||
// Set target css
|
||||
transfer.addClass(o.options.className);
|
||||
transfer.css({
|
||||
@ -35,7 +35,7 @@ $.effects.transfer = function(o) {
|
||||
width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
|
||||
position: 'absolute'
|
||||
});
|
||||
|
||||
|
||||
// Animation
|
||||
position = target.offset();
|
||||
animation = {
|
||||
@ -44,16 +44,16 @@ $.effects.transfer = function(o) {
|
||||
height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
|
||||
width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
|
||||
};
|
||||
|
||||
|
||||
// Animate
|
||||
transfer.animate(animation, o.duration, o.options.easing, function() {
|
||||
transfer.remove(); // Remove div
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -20,7 +20,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
|
||||
dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
|
||||
dayStatus: 'اختر DD لليوم الأول من الأسبوع', dateStatus: 'اختر D, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: 'اختر يوم', isRTL: true};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ar']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],
|
||||
dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'mm/dd/yy', firstDay: 0,
|
||||
dateFormat: 'mm/dd/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ca']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['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',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: 'Vyberte datum', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['cs']);
|
||||
});
|
||||
|
@ -9,9 +9,9 @@ jQuery(function($){
|
||||
nextText: 'Næste>', nextStatus: 'Vis næste måned',
|
||||
nextBigText: '>>', nextBigStatus: '',
|
||||
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'],
|
||||
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
|
||||
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
|
||||
'Jul','Aug','Sep','Okt','Nov','Dec'],
|
||||
monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år',
|
||||
weekHeader: 'Uge', weekStatus: 'Årets uge',
|
||||
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
|
||||
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['da']);
|
||||
$.datepicker.setDefaults($.datepicker.regional['da']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['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',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: 'Wähle ein Datum', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['de']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
|
||||
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['es']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
|
||||
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['fr']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
|
||||
dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
|
||||
dayStatus: 'DD', dateStatus: 'DD, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: true};
|
||||
$.datepicker.setDefaults($.datepicker.regional['he']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
|
||||
dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['hu']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
|
||||
dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['hy']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],
|
||||
dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['id']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Sun','Mán','Þri','Mið','Fim','Fös','Lau'],
|
||||
dayNamesMin: ['Su','Má','Þr','Mi','Fi','Fö','La'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['is']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
|
||||
dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['it']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['日','月','火','水','木','金','土'],
|
||||
dayNamesMin: ['日','月','火','水','木','金','土'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy/mm/dd', firstDay: 0,
|
||||
dateFormat: 'yy/mm/dd', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ja']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['일','월','화','수','목','금','토'],
|
||||
dayNamesMin: ['일','월','화','수','목','금','토'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 0,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ko']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],
|
||||
dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['lt']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
|
||||
dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd-mm-yy', firstDay: 1,
|
||||
dateFormat: 'dd-mm-yy', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['lv']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'],
|
||||
dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: 'Kies een datum', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['nl']);
|
||||
});
|
@ -9,9 +9,9 @@ jQuery(function($){
|
||||
nextText: 'Neste»', nextStatus: '',
|
||||
nextBigText: '>>', nextBigStatus: '',
|
||||
currentText: 'I dag', currentStatus: '',
|
||||
monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
|
||||
monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
|
||||
'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'],
|
||||
monthStatus: '', yearStatus: '',
|
||||
weekHeader: 'Uke', weekStatus: '',
|
||||
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
|
||||
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 0,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['no']);
|
||||
$.datepicker.setDefaults($.datepicker.regional['no']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
|
||||
dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['pl']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
|
||||
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['pt-BR']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'],
|
||||
dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sa'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ro']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
|
||||
dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['ru']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
|
||||
dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 0,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['sk']);
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Ned','Pon','Tor','Sre','Čet','Pet','Sob'],
|
||||
dayNamesMin: ['Ne','Po','To','Sr','Če','Pe','So'],
|
||||
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};
|
||||
$.datepicker.setDefaults($.datepicker.regional['sl']);
|
||||
});
|
||||
|
@ -9,9 +9,9 @@ jQuery(function($){
|
||||
nextText: 'Nästa»', nextStatus: '',
|
||||
nextBigText: '>>', nextBigStatus: '',
|
||||
currentText: 'Idag', currentStatus: '',
|
||||
monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
|
||||
monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
|
||||
'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'],
|
||||
monthStatus: '', yearStatus: '',
|
||||
weekHeader: 'Ve', weekStatus: '',
|
||||
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
|
||||
dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['sv']);
|
||||
$.datepicker.setDefaults($.datepicker.regional['sv']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
|
||||
dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
dateFormat: 'dd/mm/yy', firstDay: 0,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['th']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['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',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: 'Bir tarih seçiniz', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['tr']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],
|
||||
dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],
|
||||
dayStatus: 'DD', dateStatus: 'D, M d',
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
dateFormat: 'dd.mm.yy', firstDay: 1,
|
||||
initStatus: '', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['uk']);
|
||||
});
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
|
||||
dayNamesMin: ['日','一','二','三','四','五','六'],
|
||||
dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD',
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
dateFormat: 'yy-mm-dd', firstDay: 1,
|
||||
initStatus: '请选择日期', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['zh-CN']);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
|
||||
dayNamesMin: ['日','一','二','三','四','五','六'],
|
||||
dayStatus: '設定 DD 為一周起始', dateStatus: '選擇 m月 d日, DD',
|
||||
dateFormat: 'yy/mm/dd', firstDay: 1,
|
||||
dateFormat: 'yy/mm/dd', firstDay: 1,
|
||||
initStatus: '請選擇日期', isRTL: false};
|
||||
$.datepicker.setDefaults($.datepicker.regional['zh-TW']);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* jQuery UI Accordion @VERSION
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jörn Zaefferer
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
@ -15,7 +15,7 @@
|
||||
$.widget("ui.accordion", {
|
||||
_init: function() {
|
||||
var options = this.options;
|
||||
|
||||
|
||||
if ( options.navigation ) {
|
||||
var current = this.element.find("a").filter(options.navigationFilter);
|
||||
if ( current.length ) {
|
||||
@ -27,23 +27,23 @@ $.widget("ui.accordion", {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// calculate active if not specified, using the first header
|
||||
options.headers = this.element.find(options.header);
|
||||
options.active = findActive(options.headers, options.active);
|
||||
|
||||
|
||||
// IE7-/Win - Extra vertical space in Lists fixed
|
||||
if ($.browser.msie) {
|
||||
this.element.find('a').css('zoom', '1');
|
||||
}
|
||||
|
||||
|
||||
if (!this.element.hasClass("ui-accordion")) {
|
||||
this.element.addClass("ui-accordion");
|
||||
$('<span class="ui-accordion-left"/>').insertBefore(options.headers);
|
||||
$('<span class="ui-accordion-right"/>').appendTo(options.headers);
|
||||
options.headers.addClass("ui-accordion-header").attr("tabindex", "0");
|
||||
}
|
||||
|
||||
|
||||
var maxHeight;
|
||||
if ( options.fillSpace ) {
|
||||
maxHeight = this.element.parent().height();
|
||||
@ -60,13 +60,13 @@ $.widget("ui.accordion", {
|
||||
maxHeight = Math.max(maxHeight, $(this).outerHeight());
|
||||
}).height(maxHeight);
|
||||
}
|
||||
|
||||
|
||||
options.headers
|
||||
.not(options.active || "")
|
||||
.next()
|
||||
.hide();
|
||||
options.active.parent().andSelf().addClass(options.selectedClass);
|
||||
|
||||
|
||||
if (options.event) {
|
||||
this.element.bind((options.event) + ".accordion", clickHandler);
|
||||
}
|
||||
@ -98,7 +98,7 @@ function completed(cancel) {
|
||||
if (!$.data(this, "accordion")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var instance = $.data(this, "accordion");
|
||||
var options = instance.options;
|
||||
options.running = cancel ? 0 : --options.running;
|
||||
@ -120,12 +120,12 @@ function toggle(toShow, toHide, data, clickedActive, down) {
|
||||
options.toHide = toHide;
|
||||
options.data = data;
|
||||
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
|
||||
options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
|
||||
|
||||
|
||||
if ( options.animated ) {
|
||||
if ( !options.alwaysOpen && clickedActive ) {
|
||||
$.ui.accordion.animations[options.animated]({
|
||||
@ -160,7 +160,7 @@ function clickHandler(event) {
|
||||
if (options.disabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// called only when using activate(false) to close all parts programmatically
|
||||
if ( !event.target && !options.alwaysOpen ) {
|
||||
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
||||
@ -178,14 +178,14 @@ function clickHandler(event) {
|
||||
}
|
||||
// get the click target
|
||||
var clicked = $(event.target);
|
||||
|
||||
|
||||
// due to the event delegation model, we have to check if one
|
||||
// of the parent elements is our actual header, and find that
|
||||
// otherwise stick with the initial target
|
||||
clicked = $( clicked.parents(options.header)[0] || clicked );
|
||||
|
||||
|
||||
var clickedActive = clicked[0] == options.active[0];
|
||||
|
||||
|
||||
// if animations are still active, or the active header is the target, ignore click
|
||||
if (options.running || (options.alwaysOpen && clickedActive)) {
|
||||
return false;
|
||||
@ -193,13 +193,13 @@ function clickHandler(event) {
|
||||
if (!clicked.is(options.header)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// switch classes
|
||||
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
||||
if ( !clickedActive ) {
|
||||
clicked.parent().andSelf().addClass(options.selectedClass);
|
||||
}
|
||||
|
||||
|
||||
// find elements to show and hide
|
||||
var toShow = clicked.next(),
|
||||
toHide = options.active.next(),
|
||||
@ -211,7 +211,7 @@ function clickHandler(event) {
|
||||
oldContent: toHide
|
||||
},
|
||||
down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
|
||||
|
||||
|
||||
options.active = clickedActive ? $([]) : clicked;
|
||||
toggle.call(this, toShow, toHide, data, clickedActive, down );
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Autocomplete
|
||||
*
|
||||
* Depends:
|
||||
@ -13,7 +13,7 @@
|
||||
(function($) {
|
||||
|
||||
$.widget("ui.autocomplete", {
|
||||
|
||||
|
||||
_init: function() {
|
||||
|
||||
$.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
|
||||
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);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
result: function(handler) {
|
||||
return this.element.bind("result", handler);
|
||||
},
|
||||
@ -42,7 +42,7 @@ $.widget("ui.autocomplete", {
|
||||
destroy: function() {
|
||||
return this.element.trigger("unautocomplete");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.Autocompleter = function(input, options) {
|
||||
@ -73,9 +73,9 @@ $.Autocompleter = function(input, options) {
|
||||
mouseDownOnSelect: false
|
||||
};
|
||||
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
|
||||
|
||||
|
||||
var blockSubmit;
|
||||
|
||||
|
||||
// prevent form submit in opera when selecting with return key
|
||||
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
|
||||
if (blockSubmit) {
|
||||
@ -83,13 +83,13 @@ $.Autocompleter = function(input, options) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 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) {
|
||||
// track last key pressed
|
||||
lastKeyPressCode = event.keyCode;
|
||||
switch(event.keyCode) {
|
||||
|
||||
|
||||
case KEY.UP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
@ -98,7 +98,7 @@ $.Autocompleter = function(input, options) {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case KEY.DOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
@ -107,7 +107,7 @@ $.Autocompleter = function(input, options) {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case KEY.PAGEUP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
@ -116,7 +116,7 @@ $.Autocompleter = function(input, options) {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case KEY.PAGEDOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
@ -125,7 +125,7 @@ $.Autocompleter = function(input, options) {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// matches also semicolon
|
||||
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
|
||||
case KEY.TAB:
|
||||
@ -137,11 +137,11 @@ $.Autocompleter = function(input, options) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case KEY.ESC:
|
||||
select.hide();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(onChange, options.delay);
|
||||
@ -192,16 +192,16 @@ $.Autocompleter = function(input, options) {
|
||||
$input.unbind();
|
||||
$(input.form).unbind(".autocomplete");
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function selectCurrent() {
|
||||
var selected = select.selected();
|
||||
if( !selected )
|
||||
return false;
|
||||
|
||||
|
||||
var v = selected.result;
|
||||
previousValue = v;
|
||||
|
||||
|
||||
if ( options.multiple ) {
|
||||
var words = trimWords($input.val());
|
||||
if ( words.length > 1 ) {
|
||||
@ -209,26 +209,26 @@ $.Autocompleter = function(input, options) {
|
||||
}
|
||||
v += options.multipleSeparator;
|
||||
}
|
||||
|
||||
|
||||
$input.val(v);
|
||||
hideResultsNow();
|
||||
$input.trigger("result", [selected.data, selected.value]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function onChange(crap, skipPrevCheck) {
|
||||
if( lastKeyPressCode == KEY.DEL ) {
|
||||
select.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var currentValue = $input.val();
|
||||
|
||||
|
||||
if ( !skipPrevCheck && currentValue == previousValue )
|
||||
return;
|
||||
|
||||
|
||||
previousValue = currentValue;
|
||||
|
||||
|
||||
currentValue = lastWord(currentValue);
|
||||
if ( currentValue.length >= options.minChars) {
|
||||
$input.addClass(options.loadingClass);
|
||||
@ -240,7 +240,7 @@ $.Autocompleter = function(input, options) {
|
||||
select.hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function trimWords(value) {
|
||||
if ( !value ) {
|
||||
return [""];
|
||||
@ -253,14 +253,14 @@ $.Autocompleter = function(input, options) {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function lastWord(value) {
|
||||
if ( !options.multiple )
|
||||
return value;
|
||||
var words = trimWords(value);
|
||||
return words[words.length - 1];
|
||||
}
|
||||
|
||||
|
||||
// fills in the input box w/the first match (assumed to be the best match)
|
||||
// q: the term entered
|
||||
// sValue: the first matching result
|
||||
@ -324,16 +324,16 @@ $.Autocompleter = function(input, options) {
|
||||
if (data && data.length) {
|
||||
success(term, data);
|
||||
// if an AJAX url has been supplied, try loading the data now
|
||||
|
||||
|
||||
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||||
|
||||
|
||||
var extraParams = {
|
||||
timestamp: +new Date()
|
||||
};
|
||||
$.each(options.extraParams, function(key, param) {
|
||||
extraParams[key] = typeof param == "function" ? param() : param;
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
// try to leverage ajaxQueue plugin to abort previous requests
|
||||
mode: "abort",
|
||||
@ -365,7 +365,7 @@ $.Autocompleter = function(input, options) {
|
||||
failure(term);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function parse(data) {
|
||||
var parsed = [];
|
||||
var rows = data.split("\n");
|
||||
@ -424,25 +424,25 @@ $.Autocompleter.Cache = function(options) {
|
||||
|
||||
var data = {};
|
||||
var length = 0;
|
||||
|
||||
|
||||
function matchSubset(s, sub) {
|
||||
if (!options.matchCase)
|
||||
if (!options.matchCase)
|
||||
s = s.toLowerCase();
|
||||
var i = s.indexOf(sub);
|
||||
if (i == -1) return false;
|
||||
return i == 0 || options.matchContains;
|
||||
};
|
||||
|
||||
|
||||
function add(q, value) {
|
||||
if (length > options.cacheLength){
|
||||
flush();
|
||||
}
|
||||
if (!data[q]){
|
||||
if (!data[q]){
|
||||
length++;
|
||||
}
|
||||
data[q] = value;
|
||||
}
|
||||
|
||||
|
||||
function populate(){
|
||||
if( !options.data ) return false;
|
||||
// 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
|
||||
if( !options.url ) options.cacheLength = 1;
|
||||
|
||||
|
||||
// track all options for minChars = 0
|
||||
stMatchSets[""] = [];
|
||||
|
||||
|
||||
// loop through the array and create a lookup structure
|
||||
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
|
||||
var rawValue = options.data[i];
|
||||
// if rawValue is a string, make an array otherwise just reference the array
|
||||
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
|
||||
|
||||
|
||||
var value = options.formatMatch(rawValue, i+1, options.data.length);
|
||||
if ( value === false )
|
||||
continue;
|
||||
|
||||
|
||||
var firstChar = value.charAt(0).toLowerCase();
|
||||
// if no lookup array for this character exists, look it up now
|
||||
if( !stMatchSets[firstChar] )
|
||||
if( !stMatchSets[firstChar] )
|
||||
stMatchSets[firstChar] = [];
|
||||
|
||||
// if the match is a string
|
||||
@ -476,7 +476,7 @@ $.Autocompleter.Cache = function(options) {
|
||||
data: rawValue,
|
||||
result: options.formatResult && options.formatResult(rawValue) || value
|
||||
};
|
||||
|
||||
|
||||
// push the current match into the set list
|
||||
stMatchSets[firstChar].push(row);
|
||||
|
||||
@ -494,15 +494,15 @@ $.Autocompleter.Cache = function(options) {
|
||||
add(i, value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// populate any existing data
|
||||
setTimeout(populate, 25);
|
||||
|
||||
|
||||
function flush(){
|
||||
data = {};
|
||||
length = 0;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
flush: flush,
|
||||
add: add,
|
||||
@ -510,7 +510,7 @@ $.Autocompleter.Cache = function(options) {
|
||||
load: function(q) {
|
||||
if (!options.cacheLength || !length)
|
||||
return null;
|
||||
/*
|
||||
/*
|
||||
* if dealing w/local data and matchContains than we must make sure
|
||||
* to loop through all the data collections looking for matches
|
||||
*/
|
||||
@ -530,9 +530,9 @@ $.Autocompleter.Cache = function(options) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return csub;
|
||||
} else
|
||||
} else
|
||||
// if the exact item exists, use it
|
||||
if (data[q]){
|
||||
return data[q];
|
||||
@ -560,7 +560,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
var CLASSES = {
|
||||
ACTIVE: "ui-autocomplete-over"
|
||||
};
|
||||
|
||||
|
||||
var listItems,
|
||||
active = -1,
|
||||
data,
|
||||
@ -568,7 +568,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
needsInit = true,
|
||||
element,
|
||||
list;
|
||||
|
||||
|
||||
// Create results
|
||||
function init() {
|
||||
if (!needsInit)
|
||||
@ -578,11 +578,11 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
.addClass(options.resultsClass)
|
||||
.css("position", "absolute")
|
||||
.appendTo(document.body);
|
||||
|
||||
|
||||
list = $("<ul/>").appendTo(element).mouseover( function(event) {
|
||||
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
|
||||
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
}
|
||||
}).click(function(event) {
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
@ -595,13 +595,13 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
}).mouseup(function() {
|
||||
config.mouseDownOnSelect = false;
|
||||
});
|
||||
|
||||
|
||||
if( options.width > 0 )
|
||||
element.css("width", options.width);
|
||||
|
||||
|
||||
needsInit = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function target(event) {
|
||||
var element = event.target;
|
||||
while(element && element.tagName != "LI")
|
||||
@ -628,7 +628,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function movePosition(step) {
|
||||
active += step;
|
||||
if (active < 0) {
|
||||
@ -637,13 +637,13 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function limitNumberOfItems(available) {
|
||||
return options.max && options.max < available
|
||||
? options.max
|
||||
: available;
|
||||
}
|
||||
|
||||
|
||||
function fillList() {
|
||||
list.empty();
|
||||
var max = limitNumberOfItems(data.length);
|
||||
@ -665,7 +665,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
if ( $.fn.bgiframe )
|
||||
list.bgiframe();
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
display: function(d, q) {
|
||||
init();
|
||||
@ -712,14 +712,14 @@ $.Autocompleter.Select = function (options, input, select, config) {
|
||||
top: offset.top + input.offsetHeight,
|
||||
left: offset.left
|
||||
}).show();
|
||||
|
||||
|
||||
if(options.scroll) {
|
||||
list.scrollTop(0);
|
||||
list.css({
|
||||
maxHeight: options.scrollHeight,
|
||||
overflow: 'auto'
|
||||
});
|
||||
|
||||
|
||||
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
|
||||
var listHeight = 0;
|
||||
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")) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(input).triggerHandler("autocompleteshow", [{}, { options: options }], options["show"]);
|
||||
|
||||
|
||||
},
|
||||
selected: function() {
|
||||
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
|
||||
|
122
ui/ui.core.js
122
ui/ui.core.js
@ -22,13 +22,13 @@ function isVisible(element) {
|
||||
var style = element.style;
|
||||
return (style.display != 'none' && style.visibility != 'hidden');
|
||||
}
|
||||
|
||||
|
||||
var visible = checkStyles(element);
|
||||
|
||||
|
||||
(visible && $.each($.dir(element, 'parentNode'), function() {
|
||||
return (visible = checkStyles(this));
|
||||
}));
|
||||
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
@ -36,25 +36,25 @@ $.extend($.expr[':'], {
|
||||
data: function(a, i, m) {
|
||||
return $.data(a, m[3]);
|
||||
},
|
||||
|
||||
|
||||
// TODO: add support for object, area
|
||||
tabbable: function(a, i, m) {
|
||||
var nodeName = a.nodeName.toLowerCase();
|
||||
|
||||
|
||||
return (
|
||||
// in tab order
|
||||
a.tabIndex >= 0 &&
|
||||
|
||||
|
||||
( // filter node types that participate in the tab order
|
||||
|
||||
|
||||
// anchor tag
|
||||
('a' == nodeName && a.href) ||
|
||||
|
||||
|
||||
// enabled form element
|
||||
(/input|select|textarea|button/.test(nodeName) &&
|
||||
'hidden' != a.type && !a.disabled)
|
||||
) &&
|
||||
|
||||
|
||||
// visible on page
|
||||
isVisible(a)
|
||||
);
|
||||
@ -98,7 +98,7 @@ function getter(namespace, plugin, method, args) {
|
||||
var methods = $[namespace][plugin][type] || [];
|
||||
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
|
||||
}
|
||||
|
||||
|
||||
var methods = getMethods('getter');
|
||||
if (args.length == 1 && typeof args[0] == 'string') {
|
||||
methods = methods.concat(getMethods('getterSetter'));
|
||||
@ -109,52 +109,52 @@ function getter(namespace, plugin, method, args) {
|
||||
$.widget = function(name, prototype) {
|
||||
var namespace = name.split(".")[0];
|
||||
name = name.split(".")[1];
|
||||
|
||||
|
||||
// create plugin method
|
||||
$.fn[name] = function(options) {
|
||||
var isMethodCall = (typeof options == 'string'),
|
||||
args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
|
||||
// prevent calls to internal methods
|
||||
if (isMethodCall && options.substring(0, 1) == '_') {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// handle getter methods
|
||||
if (isMethodCall && getter(namespace, name, options, args)) {
|
||||
var instance = $.data(this[0], name);
|
||||
return (instance ? instance[options].apply(instance, args)
|
||||
: undefined);
|
||||
}
|
||||
|
||||
|
||||
// handle initialization and non-getter methods
|
||||
return this.each(function() {
|
||||
var instance = $.data(this, name);
|
||||
|
||||
|
||||
// constructor
|
||||
(!instance && !isMethodCall &&
|
||||
$.data(this, name, new $[namespace][name](this, options)));
|
||||
|
||||
|
||||
// method call
|
||||
(instance && isMethodCall && $.isFunction(instance[options]) &&
|
||||
instance[options].apply(instance, args));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// create widget constructor
|
||||
$[namespace][name] = function(element, options) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.widgetName = name;
|
||||
this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
|
||||
this.widgetBaseClass = namespace + '-' + name;
|
||||
|
||||
|
||||
this.options = $.extend({},
|
||||
$.widget.defaults,
|
||||
$[namespace][name].defaults,
|
||||
$.metadata && $.metadata.get(element)[name],
|
||||
options);
|
||||
|
||||
|
||||
this.element = $(element)
|
||||
.bind('setData.' + name, function(e, key, value) {
|
||||
return self._setData(key, value);
|
||||
@ -165,13 +165,13 @@ $.widget = function(name, prototype) {
|
||||
.bind('remove', function() {
|
||||
return self.destroy();
|
||||
});
|
||||
|
||||
|
||||
this._init();
|
||||
};
|
||||
|
||||
|
||||
// add widget prototype
|
||||
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
|
||||
|
||||
|
||||
// TODO: merge getter and getterSetter properties from widget prototype
|
||||
// and plugin prototype
|
||||
$[namespace][name].getterSetter = 'option';
|
||||
@ -182,11 +182,11 @@ $.widget.prototype = {
|
||||
destroy: function() {
|
||||
this.element.removeData(this.widgetName);
|
||||
},
|
||||
|
||||
|
||||
option: function(key, value) {
|
||||
var options = key,
|
||||
self = this;
|
||||
|
||||
|
||||
if (typeof key == "string") {
|
||||
if (value === undefined) {
|
||||
return this._getData(key);
|
||||
@ -194,7 +194,7 @@ $.widget.prototype = {
|
||||
options = {};
|
||||
options[key] = value;
|
||||
}
|
||||
|
||||
|
||||
$.each(options, function(key, value) {
|
||||
self._setData(key, value);
|
||||
});
|
||||
@ -204,20 +204,20 @@ $.widget.prototype = {
|
||||
},
|
||||
_setData: function(key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
|
||||
if (key == 'disabled') {
|
||||
this.element[value ? 'addClass' : 'removeClass'](
|
||||
this.widgetBaseClass + '-disabled');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
enable: function() {
|
||||
this._setData('disabled', false);
|
||||
},
|
||||
disable: function() {
|
||||
this._setData('disabled', true);
|
||||
},
|
||||
|
||||
|
||||
_trigger: function(type, e, data) {
|
||||
var eventName = (type == this.widgetEventPrefix
|
||||
? type : this.widgetEventPrefix + type);
|
||||
@ -245,26 +245,26 @@ $.ui = {
|
||||
call: function(instance, name, args) {
|
||||
var set = instance.plugins[name];
|
||||
if(!set) { return; }
|
||||
|
||||
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
if (instance.options[set[i][0]]) {
|
||||
set[i][1].apply(instance.element, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cssCache: {},
|
||||
css: function(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');
|
||||
|
||||
|
||||
//if (!$.browser.safari)
|
||||
//tmp.appendTo('body');
|
||||
|
||||
//tmp.appendTo('body');
|
||||
|
||||
//Opera and Safari set width and height to 0px instead of auto
|
||||
//Safari returns rgba(0,0,0,0) when bgcolor is not set
|
||||
$.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')))
|
||||
);
|
||||
try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
|
||||
@ -283,15 +283,15 @@ $.ui = {
|
||||
.unbind('selectstart.ui');
|
||||
},
|
||||
hasScroll: function(e, a) {
|
||||
|
||||
|
||||
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
||||
if ($(e).css('overflow') == 'hidden') { return false; }
|
||||
|
||||
|
||||
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
|
||||
has = false;
|
||||
|
||||
|
||||
if (e[scroll] > 0) { return true; }
|
||||
|
||||
|
||||
// TODO: determine which cases actually cause this to happen
|
||||
// if the element doesn't have the scroll set, see if it's possible to
|
||||
// set the scroll
|
||||
@ -308,50 +308,50 @@ $.ui = {
|
||||
$.ui.mouse = {
|
||||
_mouseInit: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.element.bind('mousedown.'+this.widgetName, function(e) {
|
||||
return self._mouseDown(e);
|
||||
});
|
||||
|
||||
|
||||
// Prevent text selection in IE
|
||||
if ($.browser.msie) {
|
||||
this._mouseUnselectable = this.element.attr('unselectable');
|
||||
this.element.attr('unselectable', 'on');
|
||||
}
|
||||
|
||||
|
||||
this.started = false;
|
||||
},
|
||||
|
||||
|
||||
// TODO: make sure destroying one instance of mouse doesn't mess with
|
||||
// other instances of mouse
|
||||
_mouseDestroy: function() {
|
||||
this.element.unbind('.'+this.widgetName);
|
||||
|
||||
|
||||
// Restore text selection in IE
|
||||
($.browser.msie
|
||||
&& this.element.attr('unselectable', this._mouseUnselectable));
|
||||
},
|
||||
|
||||
|
||||
_mouseDown: function(e) {
|
||||
// we may have missed mouseup (out of window)
|
||||
(this._mouseStarted && this._mouseUp(e));
|
||||
|
||||
|
||||
this._mouseDownEvent = e;
|
||||
|
||||
|
||||
var self = this,
|
||||
btnIsLeft = (e.which == 1),
|
||||
elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
|
||||
if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
this.mouseDelayMet = !this.options.delay;
|
||||
if (!this.mouseDelayMet) {
|
||||
this._mouseDelayTimer = setTimeout(function() {
|
||||
self.mouseDelayMet = true;
|
||||
}, this.options.delay);
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
|
||||
this._mouseStarted = (this._mouseStart(e) !== false);
|
||||
if (!this._mouseStarted) {
|
||||
@ -359,7 +359,7 @@ $.ui.mouse = {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// these delegates are required to keep context
|
||||
this._mouseMoveDelegate = function(e) {
|
||||
return self._mouseMove(e);
|
||||
@ -370,43 +370,43 @@ $.ui.mouse = {
|
||||
$(document)
|
||||
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_mouseMove: function(e) {
|
||||
// IE mouseup check - mouseup happened when mouse was out of window
|
||||
if ($.browser.msie && !e.button) {
|
||||
return this._mouseUp(e);
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseDrag(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
|
||||
this._mouseStarted =
|
||||
(this._mouseStart(this._mouseDownEvent, e) !== false);
|
||||
(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
|
||||
}
|
||||
|
||||
|
||||
return !this._mouseStarted;
|
||||
},
|
||||
|
||||
|
||||
_mouseUp: function(e) {
|
||||
$(document)
|
||||
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseStarted = false;
|
||||
this._mouseStop(e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_mouseDistanceMet: function(e) {
|
||||
return (Math.max(
|
||||
Math.abs(this._mouseDownEvent.pageX - e.pageX),
|
||||
@ -414,11 +414,11 @@ $.ui.mouse = {
|
||||
) >= this.options.distance
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
_mouseDelayMet: function(e) {
|
||||
return this.mouseDelayMet;
|
||||
},
|
||||
|
||||
|
||||
// These are placeholder methods, to be overriden by extending plugin
|
||||
_mouseStart: function(e) {},
|
||||
_mouseDrag: function(e) {},
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2006, 2007, 2008 Marc Grabanski
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Datepicker
|
||||
*
|
||||
* Depends:
|
||||
@ -12,7 +12,7 @@
|
||||
*
|
||||
* Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).
|
||||
*/
|
||||
|
||||
|
||||
(function($) { // hide the namespace
|
||||
|
||||
var PROP_NAME = 'datepicker';
|
||||
@ -101,7 +101,7 @@ function Datepicker() {
|
||||
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
|
||||
// takes a Date and returns the number of the week for it
|
||||
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
|
||||
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 -
|
||||
@ -110,7 +110,7 @@ function Datepicker() {
|
||||
maxDate: null, // The latest selectable date, or null for no limit
|
||||
duration: 'normal', // Duration of display/closure
|
||||
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
|
||||
beforeShow: null, // Function that takes an input field and
|
||||
// returns a set of custom settings for the date picker
|
||||
@ -139,8 +139,8 @@ $.extend(Datepicker.prototype, {
|
||||
if (this.debug)
|
||||
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)
|
||||
@return the manager object */
|
||||
setDefaults: function(settings) {
|
||||
@ -170,7 +170,7 @@ $.extend(Datepicker.prototype, {
|
||||
if (!target.id)
|
||||
target.id = 'dp' + (++this.uuid);
|
||||
var inst = this._newInst($(target), inline);
|
||||
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
|
||||
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
|
||||
if (nodeName == 'input') {
|
||||
this._connectDatepicker(target, inst);
|
||||
} else if (inline) {
|
||||
@ -204,7 +204,7 @@ $.extend(Datepicker.prototype, {
|
||||
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
|
||||
var buttonText = this._get(inst, 'buttonText');
|
||||
var buttonImage = this._get(inst, 'buttonImage');
|
||||
var trigger = $(this._get(inst, 'buttonImageOnly') ?
|
||||
var trigger = $(this._get(inst, 'buttonImageOnly') ?
|
||||
$('<img/>').addClass(this._triggerClass).
|
||||
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
|
||||
$('<button type="button"></button>').addClass(this._triggerClass).
|
||||
@ -248,7 +248,7 @@ $.extend(Datepicker.prototype, {
|
||||
_inlineShow: function(inst) {
|
||||
var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers
|
||||
inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width());
|
||||
},
|
||||
},
|
||||
|
||||
/* Pop-up the date picker in a "dialog" box.
|
||||
@param input element - ignored
|
||||
@ -458,7 +458,7 @@ $.extend(Datepicker.prototype, {
|
||||
_getDateDatepicker: function(target) {
|
||||
var inst = this._getInst(target);
|
||||
if (inst && !inst.inline)
|
||||
this._setDateFromField(inst);
|
||||
this._setDateFromField(inst);
|
||||
return (inst ? this._getDate(inst) : null);
|
||||
},
|
||||
|
||||
@ -626,7 +626,7 @@ $.extend(Datepicker.prototype, {
|
||||
offset.top -= (isFixed ? scrollY : 0);
|
||||
return offset;
|
||||
},
|
||||
|
||||
|
||||
/* Find an object's position on the screen. */
|
||||
_findPos: function(obj) {
|
||||
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
|
||||
@ -767,7 +767,7 @@ $.extend(Datepicker.prototype, {
|
||||
if (inst.stayOpen) {
|
||||
$('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass);
|
||||
$(td).addClass(this._currentClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
inst.selectedDay = inst.currentDay = $('a', td).html();
|
||||
inst.selectedMonth = inst.currentMonth = month;
|
||||
@ -833,7 +833,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._lastInput = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Update any alternate field to synchronise with the main field. */
|
||||
_updateAlternate: function(inst) {
|
||||
var altField = this._get(inst, 'altField');
|
||||
@ -856,7 +856,7 @@ $.extend(Datepicker.prototype, {
|
||||
var day = date.getDay();
|
||||
return [(day > 0 && day < 6), ''];
|
||||
},
|
||||
|
||||
|
||||
/* 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
|
||||
@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
|
||||
},
|
||||
|
||||
|
||||
/* Provide status text for a particular date.
|
||||
@param date the date to get the status for
|
||||
@param inst the current datepicker instance
|
||||
@ -920,7 +920,7 @@ $.extend(Datepicker.prototype, {
|
||||
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
||||
if (matches)
|
||||
iFormat++;
|
||||
return matches;
|
||||
return matches;
|
||||
};
|
||||
// Extract a number from the string value
|
||||
var getNumber = function(match) {
|
||||
@ -972,17 +972,17 @@ $.extend(Datepicker.prototype, {
|
||||
case 'd':
|
||||
day = getNumber('d');
|
||||
break;
|
||||
case 'D':
|
||||
case 'D':
|
||||
getName('D', dayNamesShort, dayNames);
|
||||
break;
|
||||
case 'o':
|
||||
doy = getNumber('o');
|
||||
break;
|
||||
case 'm':
|
||||
case 'm':
|
||||
month = getNumber('m');
|
||||
break;
|
||||
case 'M':
|
||||
month = getName('M', monthNamesShort, monthNames);
|
||||
month = getName('M', monthNamesShort, monthNames);
|
||||
break;
|
||||
case 'y':
|
||||
year = getNumber('y');
|
||||
@ -1074,7 +1074,7 @@ $.extend(Datepicker.prototype, {
|
||||
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
||||
if (matches)
|
||||
iFormat++;
|
||||
return matches;
|
||||
return matches;
|
||||
};
|
||||
// Format a number, with leading zero if necessary
|
||||
var formatNumber = function(match, value, len) {
|
||||
@ -1102,7 +1102,7 @@ $.extend(Datepicker.prototype, {
|
||||
case 'd':
|
||||
output += formatNumber('d', date.getDate(), 2);
|
||||
break;
|
||||
case 'D':
|
||||
case 'D':
|
||||
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
|
||||
break;
|
||||
case 'o':
|
||||
@ -1111,18 +1111,18 @@ $.extend(Datepicker.prototype, {
|
||||
doy += this._getDaysInMonth(date.getFullYear(), m);
|
||||
output += formatNumber('o', doy, 3);
|
||||
break;
|
||||
case 'm':
|
||||
case 'm':
|
||||
output += formatNumber('m', date.getMonth() + 1, 2);
|
||||
break;
|
||||
case 'M':
|
||||
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
|
||||
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
|
||||
break;
|
||||
case 'y':
|
||||
output += (lookAhead('y') ? date.getFullYear() :
|
||||
output += (lookAhead('y') ? date.getFullYear() :
|
||||
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
|
||||
break;
|
||||
case '@':
|
||||
output += date.getTime();
|
||||
output += date.getTime();
|
||||
break;
|
||||
case "'":
|
||||
if (lookAhead("'"))
|
||||
@ -1150,7 +1150,7 @@ $.extend(Datepicker.prototype, {
|
||||
else
|
||||
switch (format.charAt(iFormat)) {
|
||||
case 'd': case 'm': case 'y': case '@':
|
||||
chars += '0123456789';
|
||||
chars += '0123456789';
|
||||
break;
|
||||
case 'D': case 'M':
|
||||
return null; // Accept anything
|
||||
@ -1175,7 +1175,7 @@ $.extend(Datepicker.prototype, {
|
||||
/* Parse existing date and initialise date picker. */
|
||||
_setDateFromField: function(inst) {
|
||||
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;
|
||||
var date = defaultDate = this._getDefaultDate(inst);
|
||||
if (dates.length > 0) {
|
||||
@ -1201,7 +1201,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst.currentYear = (dates[0] ? date.getFullYear() : 0);
|
||||
this._adjustInstDate(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Retrieve the default date shown on opening. */
|
||||
_getDefaultDate: function(inst) {
|
||||
var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
|
||||
@ -1233,7 +1233,7 @@ $.extend(Datepicker.prototype, {
|
||||
case 'w' : case 'W' :
|
||||
day += parseInt(matches[1],10) * 7; break;
|
||||
case 'm' : case 'M' :
|
||||
month += parseInt(matches[1],10);
|
||||
month += parseInt(matches[1],10);
|
||||
day = Math.min(day, getDaysInMonth(year, month));
|
||||
break;
|
||||
case 'y': case 'Y' :
|
||||
@ -1348,7 +1348,7 @@ $.extend(Datepicker.prototype, {
|
||||
var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : '');
|
||||
prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate(
|
||||
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\');"' +
|
||||
this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') +
|
||||
'<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>' : '') :
|
||||
(hideIfNoPrevNext ? '' : '<label>' + nextText + '</label><label>' + nextBigText + '</label>')) + '</div>';
|
||||
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 :
|
||||
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
|
||||
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' : '') + '">' +
|
||||
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
|
||||
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">' +
|
||||
(showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
|
||||
this._get(inst, 'weekHeader') + '</td>' : '');
|
||||
@ -1408,7 +1408,7 @@ $.extend(Datepicker.prototype, {
|
||||
status.replace(/D/, dayNamesShort[day]));
|
||||
html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
|
||||
(!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] + '">' +
|
||||
dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
|
||||
}
|
||||
@ -1470,15 +1470,15 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
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>' : '') +
|
||||
(!closeAtTop && !inst.inline ? controls : '') +
|
||||
'<div style="clear: both;"></div>' +
|
||||
($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
|
||||
'<div style="clear: both;"></div>' +
|
||||
($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
|
||||
'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
|
||||
return html;
|
||||
},
|
||||
|
||||
|
||||
/* Generate the month and year header. */
|
||||
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
|
||||
selectedDate, secondary, showStatus, initStatus, monthNames) {
|
||||
@ -1579,7 +1579,7 @@ $.extend(Datepicker.prototype, {
|
||||
onChange.apply((inst.input ? inst.input[0] : null),
|
||||
[inst.selectedYear, inst.selectedMonth + 1, inst]);
|
||||
},
|
||||
|
||||
|
||||
/* Determine the number of months to show. */
|
||||
_getNumberOfMonths: function(inst) {
|
||||
var numMonths = this._get(inst, 'numberOfMonths');
|
||||
@ -1628,7 +1628,7 @@ $.extend(Datepicker.prototype, {
|
||||
var maxDate = this._getMinMaxDate(inst, 'max');
|
||||
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
|
||||
},
|
||||
|
||||
|
||||
/* Provide the configuration settings for formatting/parsing. */
|
||||
_getFormatConfig: function(inst) {
|
||||
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
|
||||
@ -1672,14 +1672,14 @@ function isArray(a) {
|
||||
Object - settings for attaching new datepicker functionality
|
||||
@return jQuery object */
|
||||
$.fn.datepicker = function(options){
|
||||
|
||||
|
||||
/* Initialise the date picker. */
|
||||
if (!$.datepicker.initialized) {
|
||||
$(document.body).append($.datepicker.dpDiv).
|
||||
mousedown($.datepicker._checkExternalClick);
|
||||
$.datepicker.initialized = true;
|
||||
}
|
||||
|
||||
|
||||
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
||||
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
|
||||
return $.datepicker['_' + options + 'Datepicker'].
|
||||
|
124
ui/ui.dialog.js
124
ui/ui.dialog.js
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Richard D. Worth (rdworth.org)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Dialog
|
||||
*
|
||||
* Depends:
|
||||
@ -31,16 +31,16 @@ $.widget("ui.dialog", {
|
||||
_init: function() {
|
||||
this.originalTitle = this.element.attr('title');
|
||||
this.options.title = this.options.title || this.originalTitle;
|
||||
|
||||
|
||||
var self = this,
|
||||
options = this.options,
|
||||
|
||||
|
||||
uiDialogContent = this.element
|
||||
.removeAttr('title')
|
||||
.addClass('ui-dialog-content')
|
||||
.wrap('<div/>')
|
||||
.wrap('<div/>'),
|
||||
|
||||
|
||||
uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent())
|
||||
.addClass('ui-dialog-container')
|
||||
.css({
|
||||
@ -48,14 +48,14 @@ $.widget("ui.dialog", {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
}),
|
||||
|
||||
|
||||
title = options.title || ' ',
|
||||
uiDialogTitlebar = (this.uiDialogTitlebar =
|
||||
$('<div class="ui-dialog-titlebar"/>'))
|
||||
.append('<span class="ui-dialog-title">' + title + '</span>')
|
||||
.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
|
||||
.prependTo(uiDialogContainer),
|
||||
|
||||
|
||||
uiDialog = (this.uiDialog = uiDialogContainer.parent())
|
||||
.appendTo(document.body)
|
||||
.hide()
|
||||
@ -81,7 +81,7 @@ $.widget("ui.dialog", {
|
||||
.mousedown(function() {
|
||||
self._moveToTop();
|
||||
}),
|
||||
|
||||
|
||||
uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>'))
|
||||
.addClass('ui-dialog-buttonpane')
|
||||
.css({
|
||||
@ -89,7 +89,7 @@ $.widget("ui.dialog", {
|
||||
bottom: 0
|
||||
})
|
||||
.appendTo(uiDialog);
|
||||
|
||||
|
||||
this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
|
||||
.hover(
|
||||
function() {
|
||||
@ -106,21 +106,21 @@ $.widget("ui.dialog", {
|
||||
self.close();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() {
|
||||
$.ui.disableSelection(this);
|
||||
});
|
||||
|
||||
|
||||
(options.draggable && $.fn.draggable && this._makeDraggable());
|
||||
(options.resizable && $.fn.resizable && this._makeResizable());
|
||||
|
||||
|
||||
this._createButtons(options.buttons);
|
||||
this._isOpen = false;
|
||||
|
||||
|
||||
(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
|
||||
(options.autoOpen && this.open());
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
(this.overlay && this.overlay.destroy());
|
||||
this.uiDialog.hide();
|
||||
@ -130,50 +130,50 @@ $.widget("ui.dialog", {
|
||||
.removeClass('ui-dialog-content')
|
||||
.hide().appendTo('body');
|
||||
this.uiDialog.remove();
|
||||
|
||||
|
||||
(this.originalTitle && this.element.attr('title', this.originalTitle));
|
||||
},
|
||||
|
||||
|
||||
close: function() {
|
||||
if (false === this._trigger('beforeclose', null, { options: this.options })) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
(this.overlay && this.overlay.destroy());
|
||||
this.uiDialog
|
||||
.hide(this.options.hide)
|
||||
.unbind('keypress.ui-dialog');
|
||||
|
||||
|
||||
this._trigger('close', null, { options: this.options });
|
||||
$.ui.dialog.overlay.resize();
|
||||
|
||||
|
||||
this._isOpen = false;
|
||||
},
|
||||
|
||||
|
||||
isOpen: function() {
|
||||
return this._isOpen;
|
||||
},
|
||||
|
||||
|
||||
open: function() {
|
||||
if (this._isOpen) { return; }
|
||||
|
||||
|
||||
this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
|
||||
(this.uiDialog.next().length && this.uiDialog.appendTo('body'));
|
||||
this._position(this.options.position);
|
||||
this.uiDialog.show(this.options.show);
|
||||
(this.options.autoResize && this._size());
|
||||
this._moveToTop(true);
|
||||
|
||||
|
||||
// prevent tabbing out of modal dialogs
|
||||
(this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(e) {
|
||||
if (e.keyCode != $.keyCode.TAB) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var tabbables = $(':tabbable', this),
|
||||
first = tabbables.filter(':first')[0],
|
||||
last = tabbables.filter(':last')[0];
|
||||
|
||||
|
||||
if (e.target == last && !e.shiftKey) {
|
||||
setTimeout(function() {
|
||||
first.focus();
|
||||
@ -184,20 +184,20 @@ $.widget("ui.dialog", {
|
||||
}, 1);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
this.uiDialog.find(':tabbable:first').focus();
|
||||
this._trigger('open', null, { options: this.options });
|
||||
this._isOpen = true;
|
||||
},
|
||||
|
||||
|
||||
_createButtons: function(buttons) {
|
||||
var self = this,
|
||||
hasButtons = false,
|
||||
uiDialogButtonPane = this.uiDialogButtonPane;
|
||||
|
||||
|
||||
// remove any existing buttons
|
||||
uiDialogButtonPane.empty().hide();
|
||||
|
||||
|
||||
$.each(buttons, function() { return !(hasButtons = true); });
|
||||
if (hasButtons) {
|
||||
uiDialogButtonPane.show();
|
||||
@ -209,11 +209,11 @@ $.widget("ui.dialog", {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_makeDraggable: function() {
|
||||
var self = this,
|
||||
options = this.options;
|
||||
|
||||
|
||||
this.uiDialog.draggable({
|
||||
cancel: '.ui-dialog-content',
|
||||
helper: options.dragHelper,
|
||||
@ -231,7 +231,7 @@ $.widget("ui.dialog", {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_makeResizable: function(handles) {
|
||||
handles = (handles === undefined ? this.options.resizable : handles);
|
||||
var self = this,
|
||||
@ -239,7 +239,7 @@ $.widget("ui.dialog", {
|
||||
resizeHandles = typeof handles == 'string'
|
||||
? handles
|
||||
: 'n,e,s,w,se,sw,ne,nw';
|
||||
|
||||
|
||||
this.uiDialog.resizable({
|
||||
cancel: '.ui-dialog-content',
|
||||
helper: options.resizeHelper,
|
||||
@ -262,31 +262,31 @@ $.widget("ui.dialog", {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// the force parameter allows us to move modal dialogs to their correct
|
||||
// position on open
|
||||
_moveToTop: function(force) {
|
||||
|
||||
|
||||
if ((this.options.modal && !force)
|
||||
|| (!this.options.stack && !this.options.modal)) {
|
||||
return this._trigger('focus', null, { options: this.options });
|
||||
}
|
||||
|
||||
|
||||
var maxZ = this.options.zIndex, options = this.options;
|
||||
$('.ui-dialog:visible').each(function() {
|
||||
maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
|
||||
});
|
||||
(this.overlay && this.overlay.$el.css('z-index', ++maxZ));
|
||||
this.uiDialog.css('z-index', ++maxZ);
|
||||
|
||||
|
||||
this._trigger('focus', null, { options: this.options });
|
||||
},
|
||||
|
||||
|
||||
_position: function(pos) {
|
||||
var wnd = $(window), doc = $(document),
|
||||
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
|
||||
minTop = pTop;
|
||||
|
||||
|
||||
if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
|
||||
pos = [
|
||||
pos == 'right' || pos == 'left' ? pos : 'center',
|
||||
@ -326,13 +326,13 @@ $.widget("ui.dialog", {
|
||||
pTop += (wnd.height() - this.uiDialog.height()) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prevent the dialog from being too high (make sure the titlebar
|
||||
// is accessible)
|
||||
pTop = Math.max(pTop, minTop);
|
||||
this.uiDialog.css({top: pTop, left: pLeft});
|
||||
},
|
||||
|
||||
|
||||
_setData: function(key, value){
|
||||
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
|
||||
switch (key) {
|
||||
@ -353,17 +353,17 @@ $.widget("ui.dialog", {
|
||||
case "resizable":
|
||||
var uiDialog = this.uiDialog,
|
||||
isResizable = this.uiDialog.is(':data(resizable)');
|
||||
|
||||
|
||||
// currently resizable, becoming non-resizable
|
||||
(isResizable && !value && uiDialog.resizable('destroy'));
|
||||
|
||||
|
||||
// currently resizable, changing handles
|
||||
(isResizable && typeof value == 'string' &&
|
||||
uiDialog.resizable('option', 'handles', value));
|
||||
|
||||
|
||||
// currently non-resizable, becoming resizable
|
||||
(isResizable || this._makeResizable(value));
|
||||
|
||||
|
||||
break;
|
||||
case "title":
|
||||
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' ');
|
||||
@ -372,10 +372,10 @@ $.widget("ui.dialog", {
|
||||
this.uiDialog.width(value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
_size: function() {
|
||||
var container = this.uiDialogContainer,
|
||||
titlebar = this.uiDialogTitlebar,
|
||||
@ -408,9 +408,9 @@ $.extend($.ui.dialog, {
|
||||
width: 300,
|
||||
zIndex: 1000
|
||||
},
|
||||
|
||||
|
||||
getter: 'isOpen',
|
||||
|
||||
|
||||
overlay: function(dialog) {
|
||||
this.$el = $.ui.dialog.overlay.create(dialog);
|
||||
}
|
||||
@ -447,17 +447,17 @@ $.extend($.ui.dialog.overlay, {
|
||||
return allow;
|
||||
});
|
||||
}, 1);
|
||||
|
||||
|
||||
// allow closing by pressing the escape key
|
||||
$(document).bind('keydown.dialog-overlay', function(e) {
|
||||
(dialog.options.closeOnEscape && e.keyCode
|
||||
&& e.keyCode == $.keyCode.ESCAPE && dialog.close());
|
||||
});
|
||||
|
||||
|
||||
// handle window resize
|
||||
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
||||
}
|
||||
|
||||
|
||||
var $el = $('<div/>').appendTo(document.body)
|
||||
.addClass('ui-dialog-overlay').css($.extend({
|
||||
borderWidth: 0, margin: 0, padding: 0,
|
||||
@ -465,23 +465,23 @@ $.extend($.ui.dialog.overlay, {
|
||||
width: this.width(),
|
||||
height: this.height()
|
||||
}, dialog.options.overlay));
|
||||
|
||||
|
||||
(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
|
||||
|
||||
|
||||
this.instances.push($el);
|
||||
return $el;
|
||||
},
|
||||
|
||||
|
||||
destroy: function($el) {
|
||||
this.instances.splice($.inArray(this.instances, $el), 1);
|
||||
|
||||
|
||||
if (this.instances.length === 0) {
|
||||
$('a, :input').add([document, window]).unbind('.dialog-overlay');
|
||||
}
|
||||
|
||||
|
||||
$el.remove();
|
||||
},
|
||||
|
||||
|
||||
height: function() {
|
||||
// handle IE 6
|
||||
if ($.browser.msie && $.browser.version < 7) {
|
||||
@ -493,7 +493,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
document.documentElement.offsetHeight,
|
||||
document.body.offsetHeight
|
||||
);
|
||||
|
||||
|
||||
if (scrollHeight < offsetHeight) {
|
||||
return $(window).height() + 'px';
|
||||
} else {
|
||||
@ -510,7 +510,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
return $(document).height() + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
width: function() {
|
||||
// handle IE 6
|
||||
if ($.browser.msie && $.browser.version < 7) {
|
||||
@ -522,7 +522,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
document.documentElement.offsetWidth,
|
||||
document.body.offsetWidth
|
||||
);
|
||||
|
||||
|
||||
if (scrollWidth < offsetWidth) {
|
||||
return $(window).width() + 'px';
|
||||
} else {
|
||||
@ -539,7 +539,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
return $(document).width() + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resize: function() {
|
||||
/* If the dialog is draggable and the user drags it past the
|
||||
* 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() {
|
||||
$overlays = $overlays.add(this);
|
||||
});
|
||||
|
||||
|
||||
$overlays.css({
|
||||
width: 0,
|
||||
height: 0
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Draggables
|
||||
*
|
||||
* Depends:
|
||||
@ -13,7 +13,7 @@
|
||||
(function($) {
|
||||
|
||||
$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
|
||||
|
||||
getHandle: function(e) {
|
||||
|
||||
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() {
|
||||
if(this == e.target) handle = true;
|
||||
});
|
||||
|
||||
|
||||
return handle;
|
||||
|
||||
},
|
||||
|
||||
|
||||
createHelper: function() {
|
||||
|
||||
var o = this.options;
|
||||
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)
|
||||
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
|
||||
|
||||
|
||||
if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
|
||||
helper.css("position", "absolute");
|
||||
|
||||
|
||||
return helper;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
_init: function() {
|
||||
|
||||
|
||||
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
|
||||
this.element[0].style.position = 'relative';
|
||||
|
||||
|
||||
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-draggable"));
|
||||
(this.options.disabled && this.element.addClass('ui-draggable-disabled'));
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
|
||||
|
||||
},
|
||||
|
||||
_mouseCapture: function(e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
|
||||
if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle'))
|
||||
return false;
|
||||
|
||||
|
||||
//Quit if we're not on a valid handle
|
||||
this.handle = this.getHandle(e);
|
||||
if (!this.handle)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
_mouseStart: function(e) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
|
||||
|
||||
//Create and append the visible helper
|
||||
this.helper = this.createHelper();
|
||||
|
||||
|
||||
//If ddmanager is used for droppables, set the global draggable
|
||||
if($.ui.ddmanager)
|
||||
$.ui.ddmanager.current = this;
|
||||
|
||||
|
||||
/*
|
||||
* - Position generation -
|
||||
* This block generates everything position related - it's the core of draggables.
|
||||
*/
|
||||
|
||||
|
||||
this.margins = { //Cache the margins
|
||||
left: (parseInt(this.element.css("marginLeft"),10) || 0),
|
||||
top: (parseInt(this.element.css("marginTop"),10) || 0)
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
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 = { //Substract the margins from the element's absolute offset
|
||||
top: this.offset.top - this.margins.top,
|
||||
left: this.offset.left - this.margins.left
|
||||
};
|
||||
|
||||
|
||||
this.offset.click = { //Where the click happened, relative to the element
|
||||
left: e.pageX - this.offset.left,
|
||||
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
|
||||
this.cacheScrollParents();
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
this.offset.parent = { //Store its position plus border
|
||||
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),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
|
||||
if(this.cssPosition == "relative") {
|
||||
var p = this.element.position();
|
||||
@ -126,13 +126,13 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
} else {
|
||||
this.offset.relative = { top: 0, left: 0 };
|
||||
}
|
||||
|
||||
|
||||
//Generate the original position
|
||||
this.originalPosition = this._generatePosition(e);
|
||||
|
||||
|
||||
//Cache the helper size
|
||||
this.cacheHelperProportions();
|
||||
|
||||
|
||||
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
|
||||
if(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_X: this.scrollLeftParent[0] != this.offsetParent[0] && !(this.scrollLeftParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName))
|
||||
});
|
||||
|
||||
|
||||
if(o.containment)
|
||||
this.setContainment();
|
||||
|
||||
|
||||
|
||||
//Call plugins and callbacks
|
||||
this._propagate("start", e);
|
||||
|
||||
|
||||
//Recache the helper size
|
||||
this.cacheHelperProportions();
|
||||
|
||||
|
||||
//Prepare the droppable offsets
|
||||
if ($.ui.ddmanager && !o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this, e);
|
||||
|
||||
|
||||
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
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
cacheScrollParents: function() {
|
||||
|
||||
this.scrollTopParent = function(el) {
|
||||
@ -176,21 +176,21 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
}(this.helper);
|
||||
|
||||
},
|
||||
|
||||
|
||||
adjustOffsetFromHelper: function(obj) {
|
||||
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.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;
|
||||
},
|
||||
|
||||
|
||||
cacheHelperProportions: function() {
|
||||
this.helperProportions = {
|
||||
width: this.helper.outerWidth(),
|
||||
height: this.helper.outerHeight()
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
setContainment: function() {
|
||||
|
||||
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).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)) {
|
||||
var ce = $(o.containment)[0];
|
||||
var co = $(o.containment).offset();
|
||||
var over = ($(ce).css("overflow") != 'hidden');
|
||||
|
||||
|
||||
this.containment = [
|
||||
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,
|
||||
@ -216,8 +216,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
_convertPositionTo: function(d, pos) {
|
||||
|
||||
if(!pos) pos = this.position;
|
||||
@ -263,9 +263,9 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
- (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
|
||||
|
||||
|
||||
/*
|
||||
* - Position constraining -
|
||||
* 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.top > this.containment[3]) position.top = this.containment[3];
|
||||
}
|
||||
|
||||
|
||||
if(o.grid) {
|
||||
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;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
return position;
|
||||
},
|
||||
_mouseDrag: function(e) {
|
||||
|
||||
|
||||
//Compute the helpers position
|
||||
this.position = this._generatePosition(e);
|
||||
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;
|
||||
|
||||
|
||||
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($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_mouseStop: function(e) {
|
||||
|
||||
|
||||
//If we are using droppables, inform the manager about the drop
|
||||
var dropped = false;
|
||||
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))) {
|
||||
var self = this;
|
||||
$(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._clear();
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_clear: function() {
|
||||
@ -329,7 +329,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
this.helper = null;
|
||||
this.cancelHelperRemoval = false;
|
||||
},
|
||||
|
||||
|
||||
// From now on bulk stuff - mainly helpers
|
||||
plugins: {},
|
||||
uiHash: function(e) {
|
||||
@ -337,7 +337,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
||||
helper: this.helper,
|
||||
position: this.position,
|
||||
absolutePosition: this.positionAbs,
|
||||
options: this.options
|
||||
options: this.options
|
||||
};
|
||||
},
|
||||
_propagate: function(n,e) {
|
||||
@ -400,7 +400,7 @@ $.ui.plugin.add("draggable", "opacity", {
|
||||
|
||||
$.ui.plugin.add("draggable", "iframeFix", {
|
||||
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>')
|
||||
.css({
|
||||
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
||||
@ -411,7 +411,7 @@ $.ui.plugin.add("draggable", "iframeFix", {
|
||||
});
|
||||
},
|
||||
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");
|
||||
o.scrollSensitivity = o.scrollSensitivity || 20;
|
||||
o.scrollSpeed = o.scrollSpeed || 20;
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
return $(document);
|
||||
}(this);
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
||||
},
|
||||
drag: function(e, ui) {
|
||||
|
||||
|
||||
var o = ui.options, scrolled = false;
|
||||
var i = $(this).data("draggable");
|
||||
|
||||
|
||||
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
|
||||
if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
|
||||
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed;
|
||||
if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
|
||||
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed;
|
||||
|
||||
|
||||
} else {
|
||||
if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
||||
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
||||
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
||||
}
|
||||
|
||||
|
||||
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
|
||||
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
|
||||
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)
|
||||
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
||||
}
|
||||
|
||||
|
||||
if(scrolled !== false)
|
||||
$.ui.ddmanager.prepareOffsets(i, e);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.ui.plugin.add("draggable", "snap", {
|
||||
start: function(e, ui) {
|
||||
|
||||
|
||||
var inst = $(this).data("draggable");
|
||||
inst.snapElements = [];
|
||||
|
||||
@ -488,28 +488,28 @@ $.ui.plugin.add("draggable", "snap", {
|
||||
top: $o.top, left: $o.left
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
drag: function(e, ui) {
|
||||
|
||||
|
||||
var inst = $(this).data("draggable");
|
||||
var d = ui.options.snapTolerance || 20;
|
||||
|
||||
var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
|
||||
y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
//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(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;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(ui.options.snapMode != 'inner') {
|
||||
var ts = Math.abs(t - y2) <= 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(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
|
||||
}
|
||||
|
||||
|
||||
var first = (ts || bs || ls || rs);
|
||||
|
||||
|
||||
if(ui.options.snapMode != 'outer') {
|
||||
var ts = Math.abs(t - y1) <= 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(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))
|
||||
(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);
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@ -545,7 +545,7 @@ $.ui.plugin.add("draggable", "snap", {
|
||||
|
||||
$.ui.plugin.add("draggable", "connectToSortable", {
|
||||
start: function(e,ui) {
|
||||
|
||||
|
||||
var inst = $(this).data("draggable");
|
||||
inst.sortables = [];
|
||||
$(ui.options.connectToSortable).each(function() {
|
||||
@ -555,17 +555,17 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
||||
instance: sortable,
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
stop: function(e,ui) {
|
||||
|
||||
|
||||
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
||||
var inst = $(this).data("draggable");
|
||||
|
||||
|
||||
$.each(inst.sortables, function() {
|
||||
if(this.instance.isOver) {
|
||||
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)
|
||||
if(this.shouldRevert) this.instance.options.revert = true; //revert here
|
||||
this.instance._mouseStop(e);
|
||||
|
||||
|
||||
//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"]);
|
||||
|
||||
@ -583,21 +583,21 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
drag: function(e,ui) {
|
||||
|
||||
var inst = $(this).data("draggable"), self = this;
|
||||
|
||||
|
||||
var checkPos = function(o) {
|
||||
|
||||
|
||||
var l = o.left, r = l + o.width,
|
||||
t = o.top, b = t + o.height;
|
||||
|
||||
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) {
|
||||
|
||||
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.options._helper = this.instance.options.helper; //Store helper option to later restore it
|
||||
this.instance.options.helper = function() { return ui.helper[0]; };
|
||||
|
||||
|
||||
e.target = this.instance.currentItem[0];
|
||||
this.instance._mouseCapture(e, 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.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;
|
||||
|
||||
|
||||
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
|
||||
if(this.instance.currentItem) this.instance._mouseDrag(e);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
//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
|
||||
if(this.instance.isOver) {
|
||||
@ -640,14 +640,14 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
||||
this.instance.options.revert = false; //No revert here
|
||||
this.instance._mouseStop(e, true);
|
||||
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
|
||||
this.instance.currentItem.remove();
|
||||
if(this.instance.placeholder) this.instance.placeholder.remove();
|
||||
|
||||
|
||||
inst._propagate("fromSortable", e);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
@ -660,11 +660,11 @@ $.ui.plugin.add("draggable", "stack", {
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
$(group).each(function(i) {
|
||||
this.style.zIndex = ui.options.stack.min + i;
|
||||
});
|
||||
|
||||
|
||||
this[0].style.zIndex = ui.options.stack.min + group.length;
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Droppables
|
||||
*
|
||||
* Depends:
|
||||
@ -14,7 +14,7 @@
|
||||
(function($) {
|
||||
|
||||
$.widget("ui.droppable", {
|
||||
|
||||
|
||||
_setData: function(key, value) {
|
||||
|
||||
if(key == 'accept') {
|
||||
@ -26,9 +26,9 @@ $.widget("ui.droppable", {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
_init: function() {
|
||||
|
||||
|
||||
var o = this.options, accept = o.accept;
|
||||
this.isover = 0; this.isout = 1;
|
||||
|
||||
@ -38,13 +38,13 @@ $.widget("ui.droppable", {
|
||||
|
||||
//Store the droppable's proportions
|
||||
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
||||
|
||||
|
||||
// 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].push(this);
|
||||
|
||||
|
||||
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
|
||||
|
||||
|
||||
},
|
||||
plugins: {},
|
||||
ui: function(c) {
|
||||
@ -62,39 +62,39 @@ $.widget("ui.droppable", {
|
||||
for ( var i = 0; i < drop.length; i++ )
|
||||
if ( drop[i] == this )
|
||||
drop.splice(i, 1);
|
||||
|
||||
|
||||
this.element
|
||||
.removeClass("ui-droppable-disabled")
|
||||
.removeData("droppable")
|
||||
.unbind(".droppable");
|
||||
},
|
||||
_over: function(e) {
|
||||
|
||||
|
||||
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 (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
|
||||
this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
_out: function(e) {
|
||||
|
||||
|
||||
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 (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
|
||||
this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
_drop: function(e,custom) {
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
var childrenIntersection = false;
|
||||
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
||||
var inst = $.data(this, 'droppable');
|
||||
@ -103,29 +103,29 @@ $.widget("ui.droppable", {
|
||||
}
|
||||
});
|
||||
if(childrenIntersection) return false;
|
||||
|
||||
|
||||
if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
|
||||
this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
|
||||
return this.element;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
_activate: function(e) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
|
||||
if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
|
||||
|
||||
|
||||
},
|
||||
_deactivate: function(e) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
|
||||
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) {
|
||||
|
||||
|
||||
if (!droppable.offset) return false;
|
||||
|
||||
|
||||
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;
|
||||
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
||||
t = droppable.offset.top, b = t + droppable.proportions.height;
|
||||
|
||||
|
||||
switch (toleranceMode) {
|
||||
case 'fit':
|
||||
return (l < x1 && x2 < r
|
||||
@ -177,7 +177,7 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@ -187,58 +187,58 @@ $.ui.ddmanager = {
|
||||
current: null,
|
||||
droppables: { 'default': [] },
|
||||
prepareOffsets: function(t, e) {
|
||||
|
||||
|
||||
var m = $.ui.ddmanager.droppables[t.options.scope];
|
||||
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++) {
|
||||
|
||||
|
||||
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
|
||||
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].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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
drop: function(draggable, e) {
|
||||
|
||||
|
||||
var dropped = false;
|
||||
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
||||
|
||||
|
||||
if(!this.options) return;
|
||||
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
||||
dropped = this._drop.call(this, e);
|
||||
|
||||
|
||||
if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
this.isout = 1; this.isover = 0;
|
||||
this._deactivate.call(this, e);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return dropped;
|
||||
|
||||
|
||||
},
|
||||
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(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);
|
||||
|
||||
|
||||
//Run through all droppables and check their positions based on specific tolerance options
|
||||
|
||||
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
||||
|
||||
|
||||
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
||||
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
||||
|
||||
|
||||
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
||||
if(!c) return;
|
||||
|
||||
|
||||
var parentInstance;
|
||||
if (this.options.greedy) {
|
||||
var parent = this.element.parents(':data(droppable):eq(0)');
|
||||
@ -247,17 +247,17 @@ $.ui.ddmanager = {
|
||||
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we just moved into a greedy child
|
||||
if (parentInstance && c == 'isover') {
|
||||
parentInstance['isover'] = 0;
|
||||
parentInstance['isout'] = 1;
|
||||
parentInstance._out.call(parentInstance, e);
|
||||
}
|
||||
|
||||
|
||||
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
||||
this[c == "isover" ? "_over" : "_out"].call(this, e);
|
||||
|
||||
|
||||
// we just moved out of a greedy child
|
||||
if (parentInstance && c == 'isout') {
|
||||
parentInstance['isout'] = 0;
|
||||
@ -265,7 +265,7 @@ $.ui.ddmanager = {
|
||||
parentInstance._over.call(parentInstance, e);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ $.widget("ui.magnifier", {
|
||||
_init: function() {
|
||||
var self = this,
|
||||
o = this.options;
|
||||
|
||||
|
||||
this.element
|
||||
.addClass("ui-magnifier")
|
||||
.bind('click.magnifier', function(e) {
|
||||
@ -28,12 +28,12 @@ $.widget("ui.magnifier", {
|
||||
currentOffset: self.current[1]
|
||||
}]));
|
||||
});
|
||||
|
||||
|
||||
// the element must have relative or absolute positioning
|
||||
if (!(/^(r|a)/).test(this.element.css("position"))) {
|
||||
this.element.css("position", "relative");
|
||||
}
|
||||
|
||||
|
||||
this.items = [];
|
||||
this.element.find(o.items).each(function() {
|
||||
var $this = $(this);
|
||||
@ -44,10 +44,10 @@ $.widget("ui.magnifier", {
|
||||
[$this.width(),$this.height()],
|
||||
(o.overlap ? $this.position() : null)
|
||||
]);
|
||||
|
||||
|
||||
(o.opacity && $this.css('opacity', o.opacity.min));
|
||||
});
|
||||
|
||||
|
||||
// absolutize
|
||||
(o.overlap && $.each(this.items, function() {
|
||||
$(this[0]).css({
|
||||
@ -56,15 +56,15 @@ $.widget("ui.magnifier", {
|
||||
left: this[3].left
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
this.identifier = ++counter;
|
||||
$(document).bind("mousemove.magnifier"+this.identifier, function(e) {
|
||||
(self.disabled || self._magnify.apply(self, [e]));
|
||||
});
|
||||
|
||||
|
||||
this.pp = this.element.offset();
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
this.reset();
|
||||
this.element
|
||||
@ -72,15 +72,15 @@ $.widget("ui.magnifier", {
|
||||
.unbind(".magnifier");
|
||||
$(document).unbind("mousemove.magnifier"+this.identifier);
|
||||
},
|
||||
|
||||
|
||||
disable: function() {
|
||||
this.reset();
|
||||
$.widget.prototype.disable.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
reset: function(e) {
|
||||
var o = this.options;
|
||||
|
||||
|
||||
$.each(this.items, function() {
|
||||
var item = this;
|
||||
$(item[0]).css({
|
||||
@ -89,16 +89,16 @@ $.widget("ui.magnifier", {
|
||||
top: (item[3] ? item[3].top : 0),
|
||||
left: (item[3] ? item[3].left : 0)
|
||||
});
|
||||
|
||||
|
||||
(o.opacity && $(item[0]).css('opacity', o.opacity.min));
|
||||
(o.zIndex && $(item[0]).css("z-index", ""));
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_magnify: function(e) {
|
||||
var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;
|
||||
this.current = this.items[0];
|
||||
|
||||
|
||||
// Compute the parent's distance
|
||||
// we don't need to fire anything if we are not near the parent
|
||||
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 + this.element[0].offsetHeight + o.distance));
|
||||
if (!overlap) { return false; }
|
||||
|
||||
|
||||
for (var i=0; i<this.items.length; i++) {
|
||||
c = this.items[i];
|
||||
|
||||
|
||||
var olddistance = distance;
|
||||
if (!o.axis) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (distance < o.distance) {
|
||||
this.current = distance < olddistance ? c : this.current;
|
||||
|
||||
|
||||
if (!o.axis || o.axis != "y") {
|
||||
$(c[0]).css({
|
||||
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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!o.axis || o.axis != "x") {
|
||||
$(c[0]).css({
|
||||
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)))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
@ -151,13 +151,13 @@ $.widget("ui.magnifier", {
|
||||
top: (c[3] ? c[3].top : 0),
|
||||
left: (c[3] ? c[3].left : 0)
|
||||
});
|
||||
|
||||
|
||||
(o.opacity && $(c[0]).css('opacity', o.opacity.min));
|
||||
}
|
||||
|
||||
|
||||
(o.zIndex && $(c[0]).css("z-index", ""));
|
||||
}
|
||||
|
||||
|
||||
(o.zIndex && $(this.current[0]).css("z-index", o.zIndex));
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Resizables
|
||||
*
|
||||
* Depends:
|
||||
@ -18,21 +18,21 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
var self = this, o = this.options;
|
||||
|
||||
var elpos = this.element.css('position');
|
||||
|
||||
|
||||
this.originalElement = this.element;
|
||||
|
||||
|
||||
// simulate .ui-resizable { position: relative; }
|
||||
this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
|
||||
|
||||
|
||||
$.extend(o, {
|
||||
_aspectRatio: !!(o.aspectRatio),
|
||||
helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
|
||||
knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
|
||||
});
|
||||
|
||||
|
||||
//Default Theme
|
||||
var aBorder = '1px solid #DEDEDE';
|
||||
|
||||
|
||||
o.defaultTheme = {
|
||||
'ui-resizable': { display: 'block' },
|
||||
'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-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
|
||||
};
|
||||
|
||||
|
||||
o.knobTheme = {
|
||||
'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
|
||||
'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-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
|
||||
};
|
||||
|
||||
|
||||
o._nodeName = this.element[0].nodeName;
|
||||
|
||||
|
||||
//Wrap the element if it cannot hold child nodes
|
||||
if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
|
||||
var el = this.element;
|
||||
|
||||
|
||||
//Opera fixing relative position
|
||||
if (/relative/.test(el.css('position')) && $.browser.opera)
|
||||
el.css({ position: 'relative', top: 'auto', left: 'auto' });
|
||||
|
||||
|
||||
//Create a wrapper element and set the wrapper to the new current internal element
|
||||
el.wrap(
|
||||
$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( {
|
||||
@ -78,40 +78,40 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
left: el.css('left')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
var oel = this.element; this.element = this.element.parent();
|
||||
|
||||
|
||||
// store instance on wrapper
|
||||
this.element.data('resizable', this);
|
||||
|
||||
this.element.data('resizable', this);
|
||||
|
||||
//Move margins to the wrapper
|
||||
this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
|
||||
marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
|
||||
});
|
||||
|
||||
|
||||
oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
||||
|
||||
|
||||
//Prevent Safari textarea resize
|
||||
if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
|
||||
|
||||
|
||||
o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
|
||||
|
||||
|
||||
// avoid IE jump
|
||||
this.element.css({ margin: oel.css('margin') });
|
||||
|
||||
|
||||
// fix handlers offset
|
||||
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.constructor == String) {
|
||||
|
||||
|
||||
o.zIndex = o.zIndex || 1000;
|
||||
|
||||
|
||||
if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
|
||||
|
||||
|
||||
var n = o.handles.split(","); o.handles = {};
|
||||
|
||||
|
||||
// insertions are applied when don't have theme loaded
|
||||
var insertionsDefault = {
|
||||
handle: 'position: absolute; display: none; overflow:hidden;',
|
||||
@ -124,18 +124,18 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
ne: 'top: 0pt; right: 0px;',
|
||||
nw: 'top: 0pt; left: 0px;'
|
||||
};
|
||||
|
||||
|
||||
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'] : {});
|
||||
|
||||
|
||||
// increase zIndex of sw, se, ne, nw axis
|
||||
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 );
|
||||
o.handles[handle] = '.ui-resizable-'+handle;
|
||||
|
||||
|
||||
this.element.append(
|
||||
//Theme detection, if not loaded, load o.defaultTheme
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
|
||||
}
|
||||
|
||||
|
||||
this._renderAxis = function(target) {
|
||||
target = target || this.element;
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
||||
if (o.transparent)
|
||||
o.handles[i].css({opacity:0});
|
||||
|
||||
|
||||
//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)) {
|
||||
|
||||
|
||||
var axis = $(o.handles[i], this.element), padWrapper = 0;
|
||||
|
||||
|
||||
//Checking the correct pad and border
|
||||
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
||||
|
||||
|
||||
//The padding type i have to apply...
|
||||
var padPos = [ 'padding',
|
||||
var padPos = [ 'padding',
|
||||
/ne|nw|n/.test(i) ? 'Top' :
|
||||
/se|sw|s/.test(i) ? 'Bottom' :
|
||||
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
||||
|
||||
/se|sw|s/.test(i) ? 'Bottom' :
|
||||
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
||||
|
||||
if (!o.transparent)
|
||||
target.css(padPos, padWrapper);
|
||||
|
||||
|
||||
this._proportionallyResize();
|
||||
}
|
||||
if(!$(o.handles[i]).length) continue;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this._renderAxis(this.element);
|
||||
o._handles = $('.ui-resizable-handle', self.element);
|
||||
|
||||
|
||||
if (o.disableSelection)
|
||||
o._handles.each(function(i, e) { $.ui.disableSelection(e); });
|
||||
|
||||
|
||||
//Matching axis name
|
||||
o._handles.mouseover(function() {
|
||||
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);
|
||||
//Axis, default = se
|
||||
self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//If we want to auto hide the elements
|
||||
if (o.autoHide) {
|
||||
o._handles.hide();
|
||||
@ -211,7 +211,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
},
|
||||
plugins: {},
|
||||
@ -233,16 +233,16 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
},
|
||||
destroy: function() {
|
||||
var el = this.element, wrapped = el.children(".ui-resizable").get(0);
|
||||
|
||||
|
||||
this._mouseDestroy();
|
||||
|
||||
|
||||
var _destroy = function(exp) {
|
||||
$(exp).removeClass("ui-resizable ui-resizable-disabled")
|
||||
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
|
||||
};
|
||||
|
||||
|
||||
_destroy(el);
|
||||
|
||||
|
||||
if (el.is('.ui-wrapper') && wrapped) {
|
||||
el.parent().append(
|
||||
$(wrapped).css({
|
||||
@ -253,55 +253,55 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
left: el.css('left')
|
||||
})
|
||||
).end().remove();
|
||||
|
||||
|
||||
_destroy(wrapped);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_mouseCapture: function(e) {
|
||||
|
||||
|
||||
if(this.options.disabled) return false;
|
||||
|
||||
|
||||
var handle = false;
|
||||
for(var i in this.options.handles) {
|
||||
if($(this.options.handles[i])[0] == e.target) handle = true;
|
||||
}
|
||||
if (!handle) return false;
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_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;
|
||||
o.resizing = true;
|
||||
o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
|
||||
|
||||
|
||||
// bugfix #1749
|
||||
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
|
||||
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;
|
||||
|
||||
|
||||
el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
|
||||
}
|
||||
|
||||
|
||||
//Opera fixing relative position
|
||||
if ($.browser.opera && /relative/.test(el.css('position')))
|
||||
el.css({ position: 'relative', top: 'auto', left: 'auto' });
|
||||
|
||||
|
||||
this._renderProxy();
|
||||
|
||||
|
||||
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
|
||||
|
||||
|
||||
if (o.containment) {
|
||||
curleft += $(o.containment).scrollLeft()||0;
|
||||
curtop += $(o.containment).scrollTop()||0;
|
||||
}
|
||||
|
||||
|
||||
//Store needed variables
|
||||
this.offset = this.helper.offset();
|
||||
this.position = { left: curleft, top: curtop };
|
||||
@ -310,79 +310,79 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
this.originalPosition = { left: curleft, top: curtop };
|
||||
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
|
||||
this.originalMousePosition = { left: e.pageX, top: e.pageY };
|
||||
|
||||
|
||||
//Aspect Ratio
|
||||
o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1);
|
||||
|
||||
|
||||
if (o.preserveCursor)
|
||||
$('body').css('cursor', this.axis + '-resize');
|
||||
|
||||
|
||||
this._propagate("start", e);
|
||||
return true;
|
||||
},
|
||||
_mouseDrag: function(e) {
|
||||
|
||||
|
||||
//Increase performance, avoid regex
|
||||
var el = this.helper, o = this.options, props = {},
|
||||
self = this, smp = this.originalMousePosition, a = this.axis;
|
||||
|
||||
|
||||
var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;
|
||||
var trigger = this._change[a];
|
||||
if (!trigger) return false;
|
||||
|
||||
|
||||
// Calculate the attrs that will be change
|
||||
var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
|
||||
|
||||
|
||||
if (o._aspectRatio || e.shiftKey)
|
||||
data = this._updateRatio(data, e);
|
||||
|
||||
|
||||
data = this._respectSize(data, e);
|
||||
|
||||
|
||||
// plugins callbacks need to be called first
|
||||
this._propagate("resize", e);
|
||||
|
||||
|
||||
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"
|
||||
});
|
||||
|
||||
|
||||
if (!o.helper && o.proportionallyResize)
|
||||
this._proportionallyResize();
|
||||
|
||||
|
||||
this._updateCache(data);
|
||||
|
||||
|
||||
// calling the user callback at the end
|
||||
this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]);
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_mouseStop: function(e) {
|
||||
|
||||
|
||||
this.options.resizing = false;
|
||||
var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
|
||||
|
||||
|
||||
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,
|
||||
soffsetw = ista ? 0 : self.sizeDiff.width;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
if (!o.animate)
|
||||
this.element.css($.extend(s, { top: top, left: left }));
|
||||
|
||||
|
||||
if (o.helper && !o.animate) this._proportionallyResize();
|
||||
}
|
||||
|
||||
|
||||
if (o.preserveCursor)
|
||||
$('body').css('cursor', 'auto');
|
||||
|
||||
|
||||
this._propagate("stop", e);
|
||||
|
||||
|
||||
if (o.helper) this.helper.remove();
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_updateCache: function(data) {
|
||||
@ -394,61 +394,61 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
if (data.width) this.size.width = data.width;
|
||||
},
|
||||
_updateRatio: function(data, e) {
|
||||
|
||||
|
||||
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
|
||||
|
||||
|
||||
if (data.height) data.width = (csize.height * o.aspectRatio);
|
||||
else if (data.width) data.height = (csize.width / o.aspectRatio);
|
||||
|
||||
|
||||
if (a == 'sw') {
|
||||
data.left = cpos.left + (csize.width - data.width);
|
||||
data.top = null;
|
||||
}
|
||||
if (a == 'nw') {
|
||||
if (a == 'nw') {
|
||||
data.top = cpos.top + (csize.height - data.height);
|
||||
data.left = cpos.left + (csize.width - data.width);
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
},
|
||||
_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,
|
||||
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 (isminh) data.height = o.minHeight;
|
||||
if (ismaxw) data.width = o.maxWidth;
|
||||
if (ismaxh) data.height = o.maxHeight;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
if (isminw && cw) data.left = dw - o.minWidth;
|
||||
if (ismaxw && cw) data.left = dw - o.maxWidth;
|
||||
if (isminh && ch) data.top = dh - o.minHeight;
|
||||
if (ismaxh && ch) data.top = dh - o.maxHeight;
|
||||
|
||||
|
||||
// fixing jump error on top/left - bug #2330
|
||||
var isNotwh = !data.width && !data.height;
|
||||
if (isNotwh && !data.left && data.top) data.top = null;
|
||||
else if (isNotwh && !data.top && data.left) data.left = null;
|
||||
|
||||
|
||||
return data;
|
||||
},
|
||||
_proportionallyResize: function() {
|
||||
var o = this.options;
|
||||
if (!o.proportionallyResize) return;
|
||||
var prel = o.proportionallyResize, el = this.helper || this.element;
|
||||
|
||||
|
||||
if (!o.borderDif) {
|
||||
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')];
|
||||
|
||||
|
||||
o.borderDif = $.map(b, function(v, i) {
|
||||
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
|
||||
return border + padding;
|
||||
return border + padding;
|
||||
});
|
||||
}
|
||||
prel.css({
|
||||
@ -459,14 +459,14 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
_renderProxy: function() {
|
||||
var el = this.element, o = this.options;
|
||||
this.elementOffset = el.offset();
|
||||
|
||||
|
||||
if(o.helper) {
|
||||
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
|
||||
|
||||
|
||||
// fix ie6 offset
|
||||
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
|
||||
pxyoffset = ( ie6 ? 2 : -1 );
|
||||
|
||||
|
||||
this.helper.addClass(o.helper).css({
|
||||
width: el.outerWidth() + pxyoffset,
|
||||
height: el.outerHeight() + pxyoffset,
|
||||
@ -475,14 +475,14 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
top: this.elementOffset.top - ie6offset +'px',
|
||||
zIndex: ++o.zIndex
|
||||
});
|
||||
|
||||
|
||||
this.helper.appendTo("body");
|
||||
|
||||
|
||||
if (o.disableSelection)
|
||||
$.ui.disableSelection(this.helper.get(0));
|
||||
|
||||
|
||||
} else {
|
||||
this.helper = el;
|
||||
this.helper = el;
|
||||
}
|
||||
},
|
||||
_change: {
|
||||
@ -537,97 +537,97 @@ $.extend($.ui.resizable, {
|
||||
*/
|
||||
|
||||
$.ui.plugin.add("resizable", "containment", {
|
||||
|
||||
|
||||
start: function(e, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"), el = self.element;
|
||||
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
||||
if (!ce) return;
|
||||
|
||||
|
||||
self.containerElement = $(ce);
|
||||
|
||||
|
||||
if (/document/.test(oc) || oc == document) {
|
||||
self.containerOffset = { left: 0, top: 0 };
|
||||
self.containerPosition = { left: 0, top: 0 };
|
||||
|
||||
self.parentData = {
|
||||
element: $(document), left: 0, top: 0,
|
||||
|
||||
self.parentData = {
|
||||
element: $(document), left: 0, top: 0,
|
||||
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// i'm a node, so compute top, left, right, bottom
|
||||
else{
|
||||
self.containerOffset = $(ce).offset();
|
||||
self.containerPosition = $(ce).position();
|
||||
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);
|
||||
|
||||
self.parentData = {
|
||||
|
||||
self.parentData = {
|
||||
element: ce, left: co.left, top: co.top, width: width, height: height
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
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,
|
||||
pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
|
||||
|
||||
|
||||
if (ce[0] != document && /static/.test(ce.css('position')))
|
||||
cop = self.containerPosition;
|
||||
|
||||
|
||||
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));
|
||||
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
|
||||
self.position.left = o.helper ? co.left : cop.left;
|
||||
}
|
||||
|
||||
|
||||
if (cp.top < (o.helper ? co.top : 0)) {
|
||||
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;
|
||||
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;
|
||||
|
||||
|
||||
if (woset + self.size.width >= self.parentData.width) {
|
||||
self.size.width = self.parentData.width - woset;
|
||||
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
|
||||
}
|
||||
|
||||
|
||||
if (hoset + self.size.height >= self.parentData.height) {
|
||||
self.size.height = self.parentData.height - hoset;
|
||||
if (pRatio) self.size.width = self.size.height * o.aspectRatio;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stop: function(e, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), cp = self.position,
|
||||
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
|
||||
|
||||
|
||||
var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
|
||||
|
||||
|
||||
|
||||
|
||||
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 });
|
||||
|
||||
|
||||
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 });
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "grid", {
|
||||
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
|
||||
if (/^(se|s|e)$/.test(a)) {
|
||||
self.size.width = os.width + ox;
|
||||
self.size.height = os.height + oy;
|
||||
@ -649,83 +649,83 @@ $.ui.plugin.add("resizable", "grid", {
|
||||
self.position.left = op.left - ox;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "animate", {
|
||||
|
||||
|
||||
stop: function(e, ui) {
|
||||
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,
|
||||
soffsetw = ista ? 0 : self.sizeDiff.width;
|
||||
|
||||
|
||||
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,
|
||||
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || 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;
|
||||
|
||||
self.element.animate(
|
||||
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
||||
duration: o.animateDuration || "slow", easing: o.animateEasing || "swing",
|
||||
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
||||
duration: o.animateDuration || "slow", easing: o.animateEasing || "swing",
|
||||
step: function() {
|
||||
|
||||
|
||||
var data = {
|
||||
width: parseInt(self.element.css('width'), 10),
|
||||
height: parseInt(self.element.css('height'), 10),
|
||||
top: parseInt(self.element.css('top'), 10),
|
||||
left: parseInt(self.element.css('left'), 10)
|
||||
};
|
||||
|
||||
|
||||
if (pr) pr.css({ width: data.width, height: data.height });
|
||||
|
||||
|
||||
// propagating resize, and updating values for each animation step
|
||||
self._updateCache(data);
|
||||
self._propagate("animate", e);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "ghost", {
|
||||
|
||||
|
||||
start: function(e, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
|
||||
|
||||
|
||||
if (!pr) self.ghost = self.element.clone();
|
||||
else self.ghost = pr.clone();
|
||||
|
||||
|
||||
self.ghost.css(
|
||||
{ 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 : '');
|
||||
|
||||
|
||||
self.ghost.appendTo(self.helper);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
resize: function(e, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
|
||||
|
||||
|
||||
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
stop: function(e, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
|
||||
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "alsoResize", {
|
||||
|
||||
|
||||
start: function(e, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"),
|
||||
|
||||
var o = ui.options, self = $(this).data("resizable"),
|
||||
|
||||
_store = function(exp) {
|
||||
$(exp).each(function() {
|
||||
$(this).data("resizable-alsoresize", {
|
||||
@ -734,27 +734,27 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
if (typeof(o.alsoResize) == 'object') {
|
||||
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
||||
else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
|
||||
}else{
|
||||
_store(o.alsoResize);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resize: function(e, ui){
|
||||
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,
|
||||
top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
|
||||
},
|
||||
|
||||
|
||||
_alsoResize = function(exp, c) {
|
||||
$(exp).each(function() {
|
||||
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) {
|
||||
var sum = (start[prop]||0) + (delta[prop]||0);
|
||||
if (sum && sum >= 0)
|
||||
@ -763,14 +763,14 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
||||
$(this).css(style);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
if (typeof(o.alsoResize) == 'object') {
|
||||
$.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
|
||||
}else{
|
||||
_alsoResize(o.alsoResize);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stop: function(e, ui){
|
||||
$(this).removeData("resizable-alsoresize-start");
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Richard D. Worth (rdworth.org)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Selectables
|
||||
*
|
||||
* Depends:
|
||||
@ -15,9 +15,9 @@
|
||||
$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.element.addClass("ui-selectable");
|
||||
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
// cache selectee children based on filter
|
||||
@ -44,9 +44,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
this.refresh();
|
||||
|
||||
this.selectees = selectees.addClass("ui-selectee");
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
|
||||
|
||||
this.helper = $(document.createElement('div'))
|
||||
.css({border:'1px dotted black'})
|
||||
.addClass("ui-selectable-helper");
|
||||
@ -67,9 +67,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
},
|
||||
_mouseStart: function(e) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.opos = [e.pageX, e.pageY];
|
||||
|
||||
|
||||
if (this.options.disabled)
|
||||
return;
|
||||
|
||||
@ -114,7 +114,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
}], options.unselecting);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var isSelectee = false;
|
||||
$(e.target).parents().andSelf().each(function() {
|
||||
if($.data(this, "selectable-item")) isSelectee = true;
|
||||
@ -124,7 +124,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
_mouseDrag: function(e) {
|
||||
var self = this;
|
||||
this.dragged = true;
|
||||
|
||||
|
||||
if (this.options.disabled)
|
||||
return;
|
||||
|
||||
@ -207,14 +207,14 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_mouseStop: function(e) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
|
||||
var options = this.options;
|
||||
|
||||
$('.ui-unselecting', this.element[0]).each(function() {
|
||||
@ -244,9 +244,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
selectable: self.element[0],
|
||||
options: this.options
|
||||
}], this.options.stop);
|
||||
|
||||
|
||||
this.helper.remove();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
|
100
ui/ui.slider.js
100
ui/ui.slider.js
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Slider
|
||||
*
|
||||
* Depends:
|
||||
@ -36,12 +36,12 @@ $.widget("ui.slider", {
|
||||
this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
|
||||
},
|
||||
destroy: function() {
|
||||
|
||||
|
||||
this.element
|
||||
.removeClass("ui-slider ui-slider-disabled")
|
||||
.removeData("slider")
|
||||
.unbind(".slider");
|
||||
|
||||
|
||||
if(this.handle && this.handle.length) {
|
||||
this.handle
|
||||
.unwrap("a");
|
||||
@ -49,28 +49,28 @@ $.widget("ui.slider", {
|
||||
$(this).data("mouse")._mouseDestroy();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.generated && this.generated.remove();
|
||||
|
||||
|
||||
},
|
||||
_setData: function(key, value) {
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
if (/min|max|steps/.test(key)) {
|
||||
this._initBoundaries();
|
||||
}
|
||||
|
||||
|
||||
if(key == "range") {
|
||||
value ? this.handle.length == 2 && this._createRange() : this._removeRange();
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
|
||||
|
||||
var self = this;
|
||||
this.element.addClass("ui-slider");
|
||||
this._initBoundaries();
|
||||
|
||||
|
||||
// Initialize mouse and key events for interaction
|
||||
this.handle = $(this.options.handle, this.element);
|
||||
if (!this.handle.length) {
|
||||
@ -81,21 +81,21 @@ $.widget("ui.slider", {
|
||||
return handle[0];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var handleclass = function(el) {
|
||||
this.element = $(el);
|
||||
this.element.data("mouse", this);
|
||||
this.options = self.options;
|
||||
|
||||
|
||||
this.element.bind("mousedown", function() {
|
||||
if(self.currentHandle) this.blur(self.currentHandle);
|
||||
self._focus(this, true);
|
||||
});
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
};
|
||||
|
||||
|
||||
$.extend(handleclass.prototype, $.ui.mouse, {
|
||||
_mouseStart: function(e) { return self._start.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; },
|
||||
trigger: function(e) { this._mouseDown(e); }
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$(this.handle)
|
||||
.each(function() {
|
||||
new handleclass(this);
|
||||
@ -116,14 +116,14 @@ $.widget("ui.slider", {
|
||||
.bind('blur', function(e) { self._blur(this.firstChild); })
|
||||
.bind('keydown', function(e) { if(!self.options.noKeyboard) return self._keydown(e.keyCode, this.firstChild); })
|
||||
;
|
||||
|
||||
|
||||
// Bind the click to the slider itself
|
||||
this.element.bind('mousedown.slider', function(e) {
|
||||
self._click.apply(self, [e]);
|
||||
self.currentHandle.data("mouse").trigger(e);
|
||||
self.firstValue = self.firstValue + 1; //This is for always triggering the change event
|
||||
});
|
||||
|
||||
|
||||
// Move the first handle to the startValue
|
||||
$.each(this.options.handles || [], function(index, handle) {
|
||||
self.moveTo(handle.start, index, true);
|
||||
@ -135,10 +135,10 @@ $.widget("ui.slider", {
|
||||
if(this.handle.length == 2 && this.options.range) this._createRange();
|
||||
},
|
||||
_initBoundaries: function() {
|
||||
|
||||
|
||||
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, {
|
||||
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 }),
|
||||
@ -156,7 +156,7 @@ $.widget("ui.slider", {
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
|
||||
_keydown: function(keyCode, handle) {
|
||||
var k = keyCode;
|
||||
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 Slider is not disabled
|
||||
// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
|
||||
|
||||
|
||||
var pointer = [e.pageX,e.pageY];
|
||||
|
||||
|
||||
var clickedHandle = false;
|
||||
this.handle.each(function() {
|
||||
if(this == e.target)
|
||||
@ -206,7 +206,7 @@ $.widget("ui.slider", {
|
||||
// If a previous handle was focussed, focus it again
|
||||
if (!this.currentHandle && this.previousHandle)
|
||||
this._focus(this.previousHandle, true);
|
||||
|
||||
|
||||
// propagate only for distance > 0, otherwise propagation is done my drag
|
||||
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")
|
||||
}, null, !this.options.distance);
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
_createRange: function() {
|
||||
@ -248,7 +248,7 @@ $.widget("ui.slider", {
|
||||
if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";
|
||||
|
||||
var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
|
||||
|
||||
|
||||
if(curHandle.data("mouse").sliderValue) {
|
||||
return parseInt(curHandle.data("mouse").sliderValue[axis],10);
|
||||
} else {
|
||||
@ -259,7 +259,7 @@ $.widget("ui.slider", {
|
||||
_convertValue: function(value,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) {
|
||||
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;
|
||||
},
|
||||
_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) {
|
||||
return this.options.stepping[axis] || 1;
|
||||
@ -299,28 +299,28 @@ $.widget("ui.slider", {
|
||||
|
||||
|
||||
_start: function(e, handle) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
if(o.disabled) return false;
|
||||
|
||||
// Prepare the outer size
|
||||
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
|
||||
|
||||
|
||||
// This is a especially ugly fix for strange blur events happening on mousemove events
|
||||
if (!this.currentHandle)
|
||||
this._focus(this.previousHandle, true);
|
||||
this._focus(this.previousHandle, true);
|
||||
|
||||
this.offset = this.element.offset();
|
||||
|
||||
|
||||
this.handleOffset = this.currentHandle.offset();
|
||||
this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
|
||||
|
||||
|
||||
this.firstValue = this.value();
|
||||
|
||||
|
||||
this._propagate('start', e);
|
||||
this._drag(e, handle);
|
||||
return true;
|
||||
|
||||
|
||||
},
|
||||
_stop: function(e) {
|
||||
this._propagate('stop', e);
|
||||
@ -338,36 +338,36 @@ $.widget("ui.slider", {
|
||||
|
||||
position.left = this._translateLimits(position.left, "x");
|
||||
position.top = this._translateLimits(position.top, "y");
|
||||
|
||||
|
||||
if (o.stepping.x) {
|
||||
var value = this._convertValue(position.left, "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) {
|
||||
var value = this._convertValue(position.top, "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.top = this._translateRange(position.top, "y");
|
||||
|
||||
if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
|
||||
if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
|
||||
|
||||
|
||||
//Store the slider's value
|
||||
this.currentHandle.data("mouse").sliderValue = {
|
||||
x: Math.round(this._convertValue(position.left, "x")) || 0,
|
||||
y: Math.round(this._convertValue(position.top, "y")) || 0
|
||||
};
|
||||
|
||||
|
||||
if (this.rangeElement)
|
||||
this._updateRange();
|
||||
this._propagate('slide', e);
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
moveTo: function(value, handle, noPropagation) {
|
||||
|
||||
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 (handle == undefined && !this.currentHandle && this.handle.length != 1)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
|
||||
//If only one handle is available, use it
|
||||
if (handle == undefined && !this.currentHandle)
|
||||
handle = 0;
|
||||
|
||||
|
||||
if (handle != undefined)
|
||||
this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
|
||||
|
||||
@ -401,7 +401,7 @@ $.widget("ui.slider", {
|
||||
x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(y !== undefined && y.constructor != Number) {
|
||||
var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
|
||||
if(me || pe) {
|
||||
@ -427,16 +427,16 @@ $.widget("ui.slider", {
|
||||
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 });
|
||||
}
|
||||
|
||||
|
||||
if (this.rangeElement)
|
||||
this._updateRange();
|
||||
|
||||
|
||||
//Store the slider's value
|
||||
this.currentHandle.data("mouse").sliderValue = {
|
||||
x: Math.round(this._convertValue(x, "x")) || 0,
|
||||
y: Math.round(this._convertValue(y, "y")) || 0
|
||||
};
|
||||
|
||||
|
||||
if (!noPropagation) {
|
||||
this._propagate('start', null);
|
||||
this._propagate('stop', null);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2008 Paul Bakaus
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
* http://docs.jquery.com/UI/Sortables
|
||||
*
|
||||
* Depends:
|
||||
@ -12,16 +12,16 @@
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
function contains(a, b) {
|
||||
var safari2 = $.browser.safari && $.browser.version < 522;
|
||||
if (a.contains && !safari2) {
|
||||
return a.contains(b);
|
||||
}
|
||||
if (a.compareDocumentPosition)
|
||||
return !!(a.compareDocumentPosition(b) & 16);
|
||||
while (b = b.parentNode)
|
||||
if (b == a) return true;
|
||||
return false;
|
||||
function contains(a, b) {
|
||||
var safari2 = $.browser.safari && $.browser.version < 522;
|
||||
if (a.contains && !safari2) {
|
||||
return a.contains(b);
|
||||
}
|
||||
if (a.compareDocumentPosition)
|
||||
return !!(a.compareDocumentPosition(b) & 16);
|
||||
while (b = b.parentNode)
|
||||
if (b == a) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
@ -30,19 +30,19 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
var o = this.options;
|
||||
this.containerCache = {};
|
||||
this.element.addClass("ui-sortable");
|
||||
|
||||
|
||||
//Get the items
|
||||
this.refresh();
|
||||
|
||||
//Let's determine if the items are floating
|
||||
this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
|
||||
|
||||
|
||||
//Let's determine the parent's offset
|
||||
this.offset = this.element.offset();
|
||||
|
||||
//Initialize mouse events for interaction
|
||||
this._mouseInit();
|
||||
|
||||
|
||||
},
|
||||
plugins: {},
|
||||
ui: function(inst) {
|
||||
@ -55,70 +55,70 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
element: this.element,
|
||||
item: (inst || this)["currentItem"],
|
||||
sender: inst ? inst.element : null
|
||||
};
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
_propagate: function(n,e,inst, noPropagation) {
|
||||
$.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]);
|
||||
},
|
||||
|
||||
|
||||
serialize: function(o) {
|
||||
|
||||
var items = this._getItemsAsjQuery(o && o.connected);
|
||||
var str = []; o = o || {};
|
||||
|
||||
|
||||
$(items).each(function() {
|
||||
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]));
|
||||
});
|
||||
|
||||
|
||||
return str.join('&');
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
toArray: function(o) {
|
||||
|
||||
|
||||
var items = this._getItemsAsjQuery(o && o.connected);
|
||||
var ret = [];
|
||||
|
||||
items.each(function() { ret.push($(this).attr(o.attr || 'id')); });
|
||||
return ret;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
/* Be careful with the following core functions */
|
||||
_intersectsWith: function(item) {
|
||||
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
|
||||
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;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
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;
|
||||
} else {
|
||||
|
||||
|
||||
return (l < x1 + (this.helperProportions.width / 2) // Right Half
|
||||
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
||||
&& t < y1 + (this.helperProportions.height / 2) // Bottom 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,
|
||||
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;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
|
||||
if(!isOverElement) return false;
|
||||
|
||||
@ -128,7 +128,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
} else {
|
||||
var height = item.height;
|
||||
var direction = y1 - this.updateOriginalPosition.top < 0 ? 2 : 1; // 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
|
||||
}
|
||||
@ -138,7 +138,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
||||
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
||||
&& y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
|
||||
|
||||
|
||||
if(this.floating) {
|
||||
if(x2 > l && x1 < l) return 2; //Crosses left 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
refresh: function() {
|
||||
this._refreshItems();
|
||||
this.refreshPositions();
|
||||
},
|
||||
|
||||
|
||||
_getItemsAsjQuery: function(connected) {
|
||||
|
||||
|
||||
var self = this;
|
||||
var items = [];
|
||||
var queries = [];
|
||||
|
||||
|
||||
if(this.options.connectWith && connected) {
|
||||
for (var i = this.options.connectWith.length - 1; i >= 0; 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]);
|
||||
|
||||
for (var i = queries.length - 1; i >= 0; i--){
|
||||
@ -182,34 +182,34 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
items.push(this);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return $(items);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_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 j=0; j < list.length; j++) {
|
||||
if(list[j] == this.items[i].item[0])
|
||||
this.items.splice(i,1);
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_refreshItems: function() {
|
||||
|
||||
|
||||
this.items = [];
|
||||
this.containers = [this];
|
||||
var items = this.items;
|
||||
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]];
|
||||
|
||||
|
||||
if(this.options.connectWith) {
|
||||
for (var i = this.options.connectWith.length - 1; i >= 0; i--){
|
||||
var cur = $(this.options.connectWith[i]);
|
||||
@ -236,7 +236,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
|
||||
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
|
||||
@ -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 };
|
||||
}
|
||||
|
||||
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
|
||||
if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0])
|
||||
continue;
|
||||
|
||||
|
||||
var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item;
|
||||
|
||||
|
||||
if(!fast) {
|
||||
this.items[i].width = t[0].offsetWidth;
|
||||
this.items[i].height = t[0].offsetHeight;
|
||||
}
|
||||
|
||||
|
||||
var p = t.offset();
|
||||
this.items[i].left = p.left;
|
||||
this.items[i].top = p.top;
|
||||
|
||||
|
||||
};
|
||||
|
||||
if(this.options.custom && this.options.custom.refreshContainers) {
|
||||
@ -277,20 +277,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
this.element
|
||||
.removeClass("ui-sortable ui-sortable-disabled")
|
||||
.removeData("sortable")
|
||||
.unbind(".sortable");
|
||||
this._mouseDestroy();
|
||||
|
||||
|
||||
for ( var i = this.items.length - 1; i >= 0; i-- )
|
||||
this.items[i].item.removeData("sortable-item");
|
||||
},
|
||||
|
||||
|
||||
_createPlaceholder: function(that) {
|
||||
|
||||
|
||||
var self = that || this, o = self.options;
|
||||
|
||||
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.currentItem.before(self.placeholder);
|
||||
o.placeholder.update(self, self.placeholder);
|
||||
|
||||
},
|
||||
|
||||
|
||||
_contactContainers: function(e) {
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
|
||||
if(this._intersectsWith(this.containers[i].containerCache)) {
|
||||
if(!this.containers[i].containerCache.over) {
|
||||
|
||||
|
||||
|
||||
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
|
||||
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--) {
|
||||
@ -333,20 +333,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
|
||||
continue;
|
||||
|
||||
|
||||
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);
|
||||
this._propagate("change", e); //Call plugins and callbacks
|
||||
this.containers[i]._propagate("change", e, this); //Call plugins and callbacks
|
||||
|
||||
|
||||
//Update the placeholder
|
||||
this.options.placeholder.update(this.currentContainer, this.placeholder);
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.containers[i]._propagate("over", e, this);
|
||||
this.containers[i].containerCache.over = 1;
|
||||
}
|
||||
@ -356,10 +356,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
this.containers[i].containerCache.over = 0;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
_mouseCapture: function(e, overrideHandle) {
|
||||
|
||||
if(this.options.disabled || this.options.type == 'static') return false;
|
||||
@ -368,7 +368,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
this._refreshItems();
|
||||
|
||||
//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) {
|
||||
currentItem = $(this);
|
||||
return false;
|
||||
@ -379,29 +379,29 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
if(!currentItem) return false;
|
||||
if(this.options.handle && !overrideHandle) {
|
||||
var validHandle = false;
|
||||
|
||||
|
||||
$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; });
|
||||
if(!validHandle) return false;
|
||||
}
|
||||
|
||||
|
||||
this.currentItem = currentItem;
|
||||
this._removeCurrentsFromItems();
|
||||
return true;
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
|
||||
createHelper: function() {
|
||||
|
||||
|
||||
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());
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
return helper;
|
||||
|
||||
},
|
||||
|
||||
|
||||
_mouseStart: function(e, overrideHandle, noActivation) {
|
||||
|
||||
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
|
||||
this.refreshPositions();
|
||||
|
||||
//Create and append the visible helper
|
||||
this.helper = this.createHelper();
|
||||
//Create and append the visible helper
|
||||
this.helper = this.createHelper();
|
||||
|
||||
/*
|
||||
* - Position generation -
|
||||
@ -421,35 +421,35 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
this.margins = { //Cache the margins
|
||||
left: (parseInt(this.currentItem.css("marginLeft"),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 = { //Substract the margins from the element's absolute offset
|
||||
top: this.offset.top - this.margins.top,
|
||||
left: this.offset.left - this.margins.left
|
||||
};
|
||||
|
||||
|
||||
this.offset.click = { //Where the click happened, relative to the element
|
||||
left: e.pageX - this.offset.left,
|
||||
top: e.pageY - this.offset.top
|
||||
};
|
||||
|
||||
|
||||
this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position
|
||||
var po = this.offsetParent.offset();
|
||||
var po = this.offsetParent.offset();
|
||||
|
||||
this.offsetParentBorders = {
|
||||
top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
||||
left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
||||
};
|
||||
|
||||
|
||||
this.offset.parent = { //Store its position plus border
|
||||
top: po.top + this.offsetParentBorders.top,
|
||||
left: po.left + this.offsetParentBorders.left
|
||||
};
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
//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
|
||||
|
||||
@ -464,17 +464,17 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
this.helper
|
||||
.css({ position: 'absolute', clear: 'both' })
|
||||
.addClass('ui-sortable-helper');
|
||||
|
||||
//Create the placeholder
|
||||
|
||||
//Create the placeholder
|
||||
this._createPlaceholder();
|
||||
|
||||
//Call plugins and callbacks
|
||||
this._propagate("start", e);
|
||||
|
||||
|
||||
//Recache the helper size
|
||||
if(!this._preserveHelperProportions)
|
||||
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };
|
||||
|
||||
|
||||
if(o.cursorAt) {
|
||||
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;
|
||||
@ -485,8 +485,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
/*
|
||||
* - Position constraining -
|
||||
* Here we prepare position constraining like grid and containment.
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
if(o.containment) {
|
||||
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
|
||||
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 co = $(o.containment).offset();
|
||||
var over = ($(ce).css("overflow") != 'hidden');
|
||||
|
||||
|
||||
this.containment = [
|
||||
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left,
|
||||
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
|
||||
if(!noActivation) {
|
||||
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); }
|
||||
}
|
||||
|
||||
|
||||
//Prepare possible droppables
|
||||
if($.ui.ddmanager)
|
||||
$.ui.ddmanager.current = this;
|
||||
|
||||
|
||||
if ($.ui.ddmanager && !o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this, e);
|
||||
|
||||
@ -529,7 +529,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_convertPositionTo: function(d, pos) {
|
||||
if(!pos) pos = this.position;
|
||||
var mod = d == "absolute" ? 1 : -1;
|
||||
@ -548,9 +548,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
)
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
_generatePosition: function(e) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
var position = {
|
||||
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
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
|
||||
|
||||
|
||||
/*
|
||||
* - Position constraining -
|
||||
* 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.top > this.containment[3]) position.top = this.containment[3];
|
||||
}
|
||||
|
||||
|
||||
if(o.grid) {
|
||||
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;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
return position;
|
||||
},
|
||||
|
||||
|
||||
_mouseDrag: function(e) {
|
||||
|
||||
//Compute the helpers position
|
||||
@ -599,10 +599,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
|
||||
//Call the internal plugins
|
||||
$.ui.plugin.call(this, "sort", [e, this.ui()]);
|
||||
|
||||
|
||||
//Regenerate the absolute position used for position checks
|
||||
this.positionAbs = this._convertPositionTo("absolute");
|
||||
|
||||
|
||||
//Set the helper's position
|
||||
this.helper[0].style.left = this.position.left+'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--) {
|
||||
var intersection = this._intersectsWithEdge(this.items[i]);
|
||||
if(!intersection) continue;
|
||||
|
||||
|
||||
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
|
||||
&& !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.updateOriginalPosition = this._generatePosition(e);
|
||||
|
||||
|
||||
this.direction = intersection == 1 ? "down" : "up";
|
||||
this.options.sortIndicator.call(this, e, this.items[i]);
|
||||
this._propagate("change", e); //Call plugins and callbacks
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Post events to containers
|
||||
this._contactContainers(e);
|
||||
|
||||
|
||||
//Interconnect with droppables
|
||||
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"]);
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_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));
|
||||
|
||||
|
||||
//Various things done here to improve the performance:
|
||||
// 1. we create a setTimeout, that calls refreshPositions
|
||||
// 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);
|
||||
|
||||
},
|
||||
|
||||
|
||||
_mouseStop: function(e, noPropagation) {
|
||||
|
||||
//If we are using droppables, inform the manager about the drop
|
||||
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
||||
$.ui.ddmanager.drop(this, e);
|
||||
|
||||
|
||||
if(this.options.revert) {
|
||||
var self = this;
|
||||
var cur = self.placeholder.offset();
|
||||
@ -679,9 +679,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_clear: function(e, noPropagation) {
|
||||
|
||||
//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
|
||||
for (var i = this.containers.length - 1; i >= 0; i--){
|
||||
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.dragging = false;
|
||||
if(this.cancelHelperRemoval) {
|
||||
this._propagate("beforeStop", e, null, noPropagation);
|
||||
this._propagate("stop", e, null, noPropagation);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
this._propagate("beforeStop", e, null, noPropagation);
|
||||
|
||||
|
||||
this.placeholder.remove();
|
||||
if(this.options.helper != "original") this.helper.remove(); this.helper = null;
|
||||
this._propagate("stop", e, null, noPropagation);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
@ -793,7 +793,7 @@ $.ui.plugin.add("sortable", "scroll", {
|
||||
start: function(e, ui) {
|
||||
var o = ui.options;
|
||||
var i = $(this).data("sortable");
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
return $(document);
|
||||
}(i.currentItem);
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
||||
},
|
||||
sort: function(e, ui) {
|
||||
|
||||
|
||||
var o = ui.options;
|
||||
var i = $(this).data("sortable");
|
||||
|
||||
|
||||
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
|
||||
if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
|
||||
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)
|
||||
$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
||||
}
|
||||
|
||||
|
||||
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
|
||||
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
|
||||
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)
|
||||
$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$.ui.plugin.add("sortable", "axis", {
|
||||
sort: function(e, ui) {
|
||||
|
||||
|
||||
var i = $(this).data("sortable");
|
||||
|
||||
|
||||
if(ui.options.axis == "y") i.position.left = i.originalPosition.left;
|
||||
if(ui.options.axis == "x") i.position.top = i.originalPosition.top;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -16,27 +16,27 @@ $.widget('ui.spinner', {
|
||||
_init: function() {
|
||||
// terminate initialization if spinner already applied to current element
|
||||
if($.data(this.element[0], 'spinner')) return;
|
||||
|
||||
|
||||
// check for onInit callback
|
||||
if (this.options.init) {
|
||||
this.options.init(this.ui(null));
|
||||
}
|
||||
|
||||
|
||||
// check for decimals in steppinng and set _decimals as internal (needs cleaning up)
|
||||
this._decimals = 0;
|
||||
if (this.options.stepping.toString().indexOf('.') != -1) {
|
||||
var s = this.options.stepping.toString();
|
||||
this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
|
||||
}
|
||||
|
||||
|
||||
//Initialize needed constants
|
||||
var self = this;
|
||||
this.element
|
||||
.addClass('ui-spinner-box')
|
||||
.attr('autocomplete', 'off'); // switch off autocomplete in opera
|
||||
|
||||
|
||||
this._setValue( isNaN(this._getValue()) ? this.options.start : this._getValue() );
|
||||
|
||||
|
||||
this.element
|
||||
.wrap('<div>')
|
||||
.parent()
|
||||
@ -117,9 +117,9 @@ $.widget('ui.spinner', {
|
||||
self._propagate('change', e);
|
||||
})
|
||||
.end();
|
||||
|
||||
|
||||
// DataList: Set contraints for object length and step size.
|
||||
|
||||
|
||||
// DataList: Set contraints for object length and step size.
|
||||
// Manipulate height of spinner.
|
||||
this._items = this.element.children().length;
|
||||
if (this._items > 1) {
|
||||
@ -136,7 +136,7 @@ $.widget('ui.spinner', {
|
||||
this.options.min = 0;
|
||||
this.options.max = this._items-1;
|
||||
}
|
||||
|
||||
|
||||
this.element
|
||||
.bind('keydown.spinner', function(e) {
|
||||
if(!self.counter) self.counter = 1;
|
||||
@ -149,15 +149,15 @@ $.widget('ui.spinner', {
|
||||
.bind('blur.spinner', function(e) {
|
||||
self._cleanUp();
|
||||
});
|
||||
|
||||
|
||||
if ($.fn.mousewheel) {
|
||||
this.element.mousewheel(function(e, delta) {
|
||||
self._mousewheel(e, delta);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
_constrain: function() {
|
||||
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);
|
||||
@ -168,7 +168,7 @@ $.widget('ui.spinner', {
|
||||
},
|
||||
_spin: function(d, e) {
|
||||
if (this.disabled) return;
|
||||
|
||||
|
||||
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._animate(d);
|
||||
@ -201,14 +201,14 @@ $.widget('ui.spinner', {
|
||||
},
|
||||
_keydown: function(e) {
|
||||
var KEYS = $.keyCode;
|
||||
|
||||
|
||||
if(e.keyCode == KEYS.UP) this._up(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.END && this.options.max != undefined) this._setValue(this.options.max); //End key goes to maximum
|
||||
return (e.keyCode == KEYS.TAB || e.keyCode == KEYS.BACKSPACE ||
|
||||
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.LEFT || e.keyCode == KEYS.RIGHT || e.keyCode == KEYS.PERIOD ||
|
||||
e.keyCode == KEYS.NUMPAD_DECIMAL || e.keyCode == KEYS.NUMPAD_SUBTRACT ||
|
||||
(e.keyCode >= 96 && e.keyCode <= 105) || // add support for numeric keypad 0-9
|
||||
(/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false;
|
||||
},
|
||||
@ -223,15 +223,15 @@ $.widget('ui.spinner', {
|
||||
_setValue: function(newVal) {
|
||||
if(isNaN(newVal)) newVal = this.options.start;
|
||||
this.element.val(
|
||||
this.options.currency ?
|
||||
$.ui.spinner.format.currency(newVal, this.options.currency) :
|
||||
this.options.currency ?
|
||||
$.ui.spinner.format.currency(newVal, this.options.currency) :
|
||||
$.ui.spinner.format.number(newVal, this._decimals)
|
||||
);
|
||||
},
|
||||
_animate: function(d) {
|
||||
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() }, {
|
||||
duration: 'fast',
|
||||
duration: 'fast',
|
||||
queue: false
|
||||
});
|
||||
}
|
||||
@ -245,8 +245,8 @@ $.widget('ui.spinner', {
|
||||
this.element.append('<'+ wrapper +' class="ui-spinner-dyn">'+ html + '</'+ wrapper +'>');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
plugins: {},
|
||||
ui: function(e) {
|
||||
return {
|
||||
|
@ -15,7 +15,7 @@
|
||||
$.widget("ui.tabs", {
|
||||
_init: function() {
|
||||
this.options.event += '.tabs'; // namespace event
|
||||
|
||||
|
||||
// create tabs
|
||||
this._tabify(true);
|
||||
},
|
||||
@ -125,14 +125,14 @@ $.widget("ui.tabs", {
|
||||
)).sort();
|
||||
if ($.inArray(o.selected, o.disabled) != -1)
|
||||
o.disabled.splice($.inArray(o.selected, o.disabled), 1);
|
||||
|
||||
|
||||
// highlight selected tab
|
||||
this.$panels.addClass(o.hideClass);
|
||||
this.$lis.removeClass(o.selectedClass);
|
||||
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.$lis.eq(o.selected).addClass(o.selectedClass);
|
||||
|
||||
|
||||
// seems to be expected behavior that the show callback is fired
|
||||
var onShow = function() {
|
||||
self._trigger('show', null,
|
||||
@ -146,7 +146,7 @@ $.widget("ui.tabs", {
|
||||
else
|
||||
onShow();
|
||||
}
|
||||
|
||||
|
||||
// clean up to avoid memory leaks in certain versions of IE 6
|
||||
$(window).bind('unload', function() {
|
||||
self.$tabs.unbind('.tabs');
|
||||
@ -161,7 +161,7 @@ $.widget("ui.tabs", {
|
||||
// set or update cookie after init and add/remove respectively
|
||||
if (o.cookie)
|
||||
$.cookie('ui-tabs-' + $.data(self.element[0]), o.selected, o.cookie);
|
||||
|
||||
|
||||
// disable tabs
|
||||
for (var i = 0, li; li = this.$lis[i]; i++)
|
||||
$(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
|
||||
if (o.cache === false)
|
||||
this.$tabs.removeData('cache.tabs');
|
||||
|
||||
|
||||
// set up animations
|
||||
var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';
|
||||
if (o.fx && o.fx.constructor == Array)
|
||||
@ -227,12 +227,12 @@ $.widget("ui.tabs", {
|
||||
$hide = self.$panels.filter(':visible'),
|
||||
$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.
|
||||
// Check if click handler returns false last so that it is not executed
|
||||
// for a disabled or loading tab!
|
||||
if (($li.hasClass(o.selectedClass) && !o.unselect)
|
||||
|| $li.hasClass(o.disabledClass)
|
||||
|| $li.hasClass(o.disabledClass)
|
||||
|| $(this).hasClass(o.loadingClass)
|
||||
|| self._trigger('select', null, self.ui(this, $show[0])) === false
|
||||
) {
|
||||
@ -282,7 +282,7 @@ $.widget("ui.tabs", {
|
||||
}*/
|
||||
|
||||
var a = this;
|
||||
self.load(self.$tabs.index(this), $hide.length ?
|
||||
self.load(self.$tabs.index(this), $hide.length ?
|
||||
function() {
|
||||
switchTab(a, $li, $hide, $show);
|
||||
} :
|
||||
@ -320,7 +320,7 @@ $.widget("ui.tabs", {
|
||||
|
||||
},
|
||||
add: function(url, label, index) {
|
||||
if (index == undefined)
|
||||
if (index == undefined)
|
||||
index = this.$tabs.length; // append by default
|
||||
|
||||
var o = this.options;
|
||||
@ -344,10 +344,10 @@ $.widget("ui.tabs", {
|
||||
$li.insertBefore(this.$lis[index]);
|
||||
$panel.insertBefore(this.$panels[index]);
|
||||
}
|
||||
|
||||
|
||||
o.disabled = $.map(o.disabled,
|
||||
function(n, i) { return n >= index ? ++n : n });
|
||||
|
||||
|
||||
this._tabify();
|
||||
|
||||
if (this.$tabs.length == 1) {
|
||||
@ -382,7 +382,7 @@ $.widget("ui.tabs", {
|
||||
var o = this.options;
|
||||
if ($.inArray(index, o.disabled) == -1)
|
||||
return;
|
||||
|
||||
|
||||
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...
|
||||
$li.css('display', 'inline-block');
|
||||
@ -414,12 +414,12 @@ $.widget("ui.tabs", {
|
||||
this.$tabs.eq(index).trigger(this.options.event);
|
||||
},
|
||||
load: function(index, callback) { // callback is for internal usage only
|
||||
|
||||
|
||||
var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
|
||||
bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
|
||||
|
||||
callback = callback || function() {};
|
||||
|
||||
|
||||
// no remote or from cache - just finish with callback
|
||||
if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
|
||||
callback();
|
||||
@ -427,7 +427,7 @@ $.widget("ui.tabs", {
|
||||
}
|
||||
|
||||
// load remote from here on
|
||||
|
||||
|
||||
var inner = function(parent) {
|
||||
var $parent = $(parent), $inner = $parent.find('*:last');
|
||||
return $inner.length && $inner.is(':not(img)') && $inner || $parent;
|
||||
@ -440,7 +440,7 @@ $.widget("ui.tabs", {
|
||||
});
|
||||
self.xhr = null;
|
||||
};
|
||||
|
||||
|
||||
if (o.spinner) {
|
||||
var label = inner(a).html();
|
||||
inner(a).wrapInner('<em></em>')
|
||||
@ -452,16 +452,16 @@ $.widget("ui.tabs", {
|
||||
success: function(r, s) {
|
||||
$(a.hash).html(r);
|
||||
cleanup();
|
||||
|
||||
|
||||
if (o.cache)
|
||||
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
|
||||
|
||||
// callbacks
|
||||
self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
|
||||
o.ajaxOptions.success && o.ajaxOptions.success(r, s);
|
||||
|
||||
|
||||
// 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...
|
||||
callback();
|
||||
}
|
||||
@ -546,24 +546,24 @@ $.ui.tabs.getter = "length";
|
||||
$.extend($.ui.tabs.prototype, {
|
||||
rotation: null,
|
||||
rotate: function(ms, continuing) {
|
||||
|
||||
|
||||
continuing = continuing || false;
|
||||
|
||||
|
||||
var self = this, t = this.options.selected;
|
||||
|
||||
|
||||
function start() {
|
||||
self.rotation = setInterval(function() {
|
||||
t = ++t < self.$tabs.length ? t : 0;
|
||||
self.select(t);
|
||||
}, ms);
|
||||
}, ms);
|
||||
}
|
||||
|
||||
|
||||
function stop(e) {
|
||||
if (!e || e.clientX) { // only in case of a true click
|
||||
clearInterval(self.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// start interval
|
||||
if (ms) {
|
||||
start();
|
||||
|
Loading…
Reference in New Issue
Block a user