mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-04 00:42:20 +02:00
feature 2771 upgrade jquery ui - forgot to add non minimified files (not used anywhere in the code, but for the sake of coherence)
git-svn-id: http://piwigo.org/svn/trunk@18953 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
/*!
|
||||
* jQuery UI Effects Blind 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/blind-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
var rvertical = /up|down|vertical/,
|
||||
rpositivemotion = /up|left|vertical|horizontal/;
|
||||
|
||||
$.effects.effect.blind = function( o, done ) {
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "hide" ),
|
||||
direction = o.direction || "up",
|
||||
vertical = rvertical.test( direction ),
|
||||
ref = vertical ? "height" : "width",
|
||||
ref2 = vertical ? "top" : "left",
|
||||
motion = rpositivemotion.test( direction ),
|
||||
animation = {},
|
||||
show = mode === "show",
|
||||
wrapper, distance, margin;
|
||||
|
||||
// if already wrapped, the wrapper's properties are my property. #6245
|
||||
if ( el.parent().is( ".ui-effects-wrapper" ) ) {
|
||||
$.effects.save( el.parent(), props );
|
||||
} else {
|
||||
$.effects.save( el, props );
|
||||
}
|
||||
el.show();
|
||||
wrapper = $.effects.createWrapper( el ).css({
|
||||
overflow: "hidden"
|
||||
});
|
||||
|
||||
distance = wrapper[ ref ]();
|
||||
margin = parseFloat( wrapper.css( ref2 ) ) || 0;
|
||||
|
||||
animation[ ref ] = show ? distance : 0;
|
||||
if ( !motion ) {
|
||||
el
|
||||
.css( vertical ? "bottom" : "right", 0 )
|
||||
.css( vertical ? "top" : "left", "auto" )
|
||||
.css({ position: "absolute" });
|
||||
|
||||
animation[ ref2 ] = show ? margin : distance + margin;
|
||||
}
|
||||
|
||||
// start at 0 if we are showing
|
||||
if ( show ) {
|
||||
wrapper.css( ref, 0 );
|
||||
if ( ! motion ) {
|
||||
wrapper.css( ref2, margin + distance );
|
||||
}
|
||||
}
|
||||
|
||||
// Animate
|
||||
wrapper.animate( animation, {
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
if ( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/*!
|
||||
* jQuery UI Effects Bounce 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/bounce-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.bounce = function( o, done ) {
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
|
||||
// defaults:
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
hide = mode === "hide",
|
||||
show = mode === "show",
|
||||
direction = o.direction || "up",
|
||||
distance = o.distance,
|
||||
times = o.times || 5,
|
||||
|
||||
// number of internal animations
|
||||
anims = times * 2 + ( show || hide ? 1 : 0 ),
|
||||
speed = o.duration / anims,
|
||||
easing = o.easing,
|
||||
|
||||
// utility:
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
motion = ( direction === "up" || direction === "left" ),
|
||||
i,
|
||||
upAnim,
|
||||
downAnim,
|
||||
|
||||
// we will need to re-assemble the queue to stack our animations in place
|
||||
queue = el.queue(),
|
||||
queuelen = queue.length;
|
||||
|
||||
// Avoid touching opacity to prevent clearType and PNG issues in IE
|
||||
if ( show || hide ) {
|
||||
props.push( "opacity" );
|
||||
}
|
||||
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
$.effects.createWrapper( el ); // Create Wrapper
|
||||
|
||||
// default distance for the BIGGEST bounce is the outer Distance / 3
|
||||
if ( !distance ) {
|
||||
distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
|
||||
}
|
||||
|
||||
if ( show ) {
|
||||
downAnim = { opacity: 1 };
|
||||
downAnim[ ref ] = 0;
|
||||
|
||||
// if we are showing, force opacity 0 and set the initial position
|
||||
// then do the "first" animation
|
||||
el.css( "opacity", 0 )
|
||||
.css( ref, motion ? -distance * 2 : distance * 2 )
|
||||
.animate( downAnim, speed, easing );
|
||||
}
|
||||
|
||||
// start at the smallest distance if we are hiding
|
||||
if ( hide ) {
|
||||
distance = distance / Math.pow( 2, times - 1 );
|
||||
}
|
||||
|
||||
downAnim = {};
|
||||
downAnim[ ref ] = 0;
|
||||
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
|
||||
for ( i = 0; i < times; i++ ) {
|
||||
upAnim = {};
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
el.animate( upAnim, speed, easing )
|
||||
.animate( downAnim, speed, easing );
|
||||
|
||||
distance = hide ? distance * 2 : distance / 2;
|
||||
}
|
||||
|
||||
// Last Bounce when Hiding
|
||||
if ( hide ) {
|
||||
upAnim = { opacity: 0 };
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
el.animate( upAnim, speed, easing );
|
||||
}
|
||||
|
||||
el.queue(function() {
|
||||
if ( hide ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
});
|
||||
|
||||
// inject all the animations we just queued to be first in line (after "inprogress")
|
||||
if ( queuelen > 1) {
|
||||
queue.splice.apply( queue,
|
||||
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
||||
}
|
||||
el.dequeue();
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*!
|
||||
* jQuery UI Effects Clip 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/clip-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.clip = function( o, done ) {
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "hide" ),
|
||||
show = mode === "show",
|
||||
direction = o.direction || "vertical",
|
||||
vert = direction === "vertical",
|
||||
size = vert ? "height" : "width",
|
||||
position = vert ? "top" : "left",
|
||||
animation = {},
|
||||
wrapper, animate, distance;
|
||||
|
||||
// Save & Show
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
|
||||
// Create Wrapper
|
||||
wrapper = $.effects.createWrapper( el ).css({
|
||||
overflow: "hidden"
|
||||
});
|
||||
animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
|
||||
distance = animate[ size ]();
|
||||
|
||||
// Shift
|
||||
if ( show ) {
|
||||
animate.css( size, 0 );
|
||||
animate.css( position, distance / 2 );
|
||||
}
|
||||
|
||||
// Create Animation Object:
|
||||
animation[ size ] = show ? distance : 0;
|
||||
animation[ position ] = show ? 0 : distance / 2;
|
||||
|
||||
// Animate
|
||||
animate.animate( animation, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: function() {
|
||||
if ( !show ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
* jQuery UI Effects Drop 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/drop-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.drop = function( o, done ) {
|
||||
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "hide" ),
|
||||
show = mode === "show",
|
||||
direction = o.direction || "left",
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
|
||||
animation = {
|
||||
opacity: show ? 1 : 0
|
||||
},
|
||||
distance;
|
||||
|
||||
// Adjust
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
$.effects.createWrapper( el );
|
||||
|
||||
distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
|
||||
|
||||
if ( show ) {
|
||||
el
|
||||
.css( "opacity", 0 )
|
||||
.css( ref, motion === "pos" ? -distance : distance );
|
||||
}
|
||||
|
||||
// Animation
|
||||
animation[ ref ] = ( show ?
|
||||
( motion === "pos" ? "+=" : "-=" ) :
|
||||
( motion === "pos" ? "-=" : "+=" ) ) +
|
||||
distance;
|
||||
|
||||
// Animate
|
||||
el.animate( animation, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: function() {
|
||||
if ( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,97 @@
|
||||
/*!
|
||||
* jQuery UI Effects Explode 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/explode-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.explode = function( o, done ) {
|
||||
|
||||
var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
|
||||
cells = rows,
|
||||
el = $( this ),
|
||||
mode = $.effects.setMode( el, o.mode || "hide" ),
|
||||
show = mode === "show",
|
||||
|
||||
// show and then visibility:hidden the element before calculating offset
|
||||
offset = el.show().css( "visibility", "hidden" ).offset(),
|
||||
|
||||
// width and height of a piece
|
||||
width = Math.ceil( el.outerWidth() / cells ),
|
||||
height = Math.ceil( el.outerHeight() / rows ),
|
||||
pieces = [],
|
||||
|
||||
// loop
|
||||
i, j, left, top, mx, my;
|
||||
|
||||
// children animate complete:
|
||||
function childComplete() {
|
||||
pieces.push( this );
|
||||
if ( pieces.length === rows * cells ) {
|
||||
animComplete();
|
||||
}
|
||||
}
|
||||
|
||||
// clone the element for each row and cell.
|
||||
for( i = 0; i < rows ; i++ ) { // ===>
|
||||
top = offset.top + i * height;
|
||||
my = i - ( rows - 1 ) / 2 ;
|
||||
|
||||
for( j = 0; j < cells ; j++ ) { // |||
|
||||
left = offset.left + j * width;
|
||||
mx = j - ( cells - 1 ) / 2 ;
|
||||
|
||||
// Create a clone of the now hidden main element that will be absolute positioned
|
||||
// within a wrapper div off the -left and -top equal to size of our pieces
|
||||
el
|
||||
.clone()
|
||||
.appendTo( "body" )
|
||||
.wrap( "<div></div>" )
|
||||
.css({
|
||||
position: "absolute",
|
||||
visibility: "visible",
|
||||
left: -j * width,
|
||||
top: -i * height
|
||||
})
|
||||
|
||||
// select the wrapper - make it overflow: hidden and absolute positioned based on
|
||||
// where the original was located +left and +top equal to the size of pieces
|
||||
.parent()
|
||||
.addClass( "ui-effects-explode" )
|
||||
.css({
|
||||
position: "absolute",
|
||||
overflow: "hidden",
|
||||
width: width,
|
||||
height: height,
|
||||
left: left + ( show ? mx * width : 0 ),
|
||||
top: top + ( show ? my * height : 0 ),
|
||||
opacity: show ? 0 : 1
|
||||
}).animate({
|
||||
left: left + ( show ? 0 : mx * width ),
|
||||
top: top + ( show ? 0 : my * height ),
|
||||
opacity: show ? 1 : 0
|
||||
}, o.duration || 500, o.easing, childComplete );
|
||||
}
|
||||
}
|
||||
|
||||
function animComplete() {
|
||||
el.css({
|
||||
visibility: "visible"
|
||||
});
|
||||
$( pieces ).remove();
|
||||
if ( !show ) {
|
||||
el.hide();
|
||||
}
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fade 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fade-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.fade = function( o, done ) {
|
||||
var el = $( this ),
|
||||
mode = $.effects.setMode( el, o.mode || "toggle" );
|
||||
|
||||
el.animate({
|
||||
opacity: mode
|
||||
}, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: done
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fold 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fold-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.fold = function( o, done ) {
|
||||
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "hide" ),
|
||||
show = mode === "show",
|
||||
hide = mode === "hide",
|
||||
size = o.size || 15,
|
||||
percent = /([0-9]+)%/.exec( size ),
|
||||
horizFirst = !!o.horizFirst,
|
||||
widthFirst = show !== horizFirst,
|
||||
ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
|
||||
duration = o.duration / 2,
|
||||
wrapper, distance,
|
||||
animation1 = {},
|
||||
animation2 = {};
|
||||
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
|
||||
// Create Wrapper
|
||||
wrapper = $.effects.createWrapper( el ).css({
|
||||
overflow: "hidden"
|
||||
});
|
||||
distance = widthFirst ?
|
||||
[ wrapper.width(), wrapper.height() ] :
|
||||
[ wrapper.height(), wrapper.width() ];
|
||||
|
||||
if ( percent ) {
|
||||
size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
|
||||
}
|
||||
if ( show ) {
|
||||
wrapper.css( horizFirst ? {
|
||||
height: 0,
|
||||
width: size
|
||||
} : {
|
||||
height: size,
|
||||
width: 0
|
||||
});
|
||||
}
|
||||
|
||||
// Animation
|
||||
animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
|
||||
animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
|
||||
|
||||
// Animate
|
||||
wrapper
|
||||
.animate( animation1, duration, o.easing )
|
||||
.animate( animation2, duration, o.easing, function() {
|
||||
if ( hide ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* jQuery UI Effects Highlight 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/highlight-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.highlight = function( o, done ) {
|
||||
var elem = $( this ),
|
||||
props = [ "backgroundImage", "backgroundColor", "opacity" ],
|
||||
mode = $.effects.setMode( elem, o.mode || "show" ),
|
||||
animation = {
|
||||
backgroundColor: elem.css( "backgroundColor" )
|
||||
};
|
||||
|
||||
if (mode === "hide") {
|
||||
animation.opacity = 0;
|
||||
}
|
||||
|
||||
$.effects.save( elem, props );
|
||||
|
||||
elem
|
||||
.show()
|
||||
.css({
|
||||
backgroundImage: "none",
|
||||
backgroundColor: o.color || "#ffff99"
|
||||
})
|
||||
.animate( animation, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: function() {
|
||||
if ( mode === "hide" ) {
|
||||
elem.hide();
|
||||
}
|
||||
$.effects.restore( elem, props );
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* jQuery UI Effects Pulsate 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/pulsate-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.pulsate = function( o, done ) {
|
||||
var elem = $( this ),
|
||||
mode = $.effects.setMode( elem, o.mode || "show" ),
|
||||
show = mode === "show",
|
||||
hide = mode === "hide",
|
||||
showhide = ( show || mode === "hide" ),
|
||||
|
||||
// showing or hiding leaves of the "last" animation
|
||||
anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
|
||||
duration = o.duration / anims,
|
||||
animateTo = 0,
|
||||
queue = elem.queue(),
|
||||
queuelen = queue.length,
|
||||
i;
|
||||
|
||||
if ( show || !elem.is(":visible")) {
|
||||
elem.css( "opacity", 0 ).show();
|
||||
animateTo = 1;
|
||||
}
|
||||
|
||||
// anims - 1 opacity "toggles"
|
||||
for ( i = 1; i < anims; i++ ) {
|
||||
elem.animate({
|
||||
opacity: animateTo
|
||||
}, duration, o.easing );
|
||||
animateTo = 1 - animateTo;
|
||||
}
|
||||
|
||||
elem.animate({
|
||||
opacity: animateTo
|
||||
}, duration, o.easing);
|
||||
|
||||
elem.queue(function() {
|
||||
if ( hide ) {
|
||||
elem.hide();
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
// We just queued up "anims" animations, we need to put them next in the queue
|
||||
if ( queuelen > 1 ) {
|
||||
queue.splice.apply( queue,
|
||||
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
||||
}
|
||||
elem.dequeue();
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+291
@@ -0,0 +1,291 @@
|
||||
/*!
|
||||
* jQuery UI Effects Scale 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/scale-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.puff = function( o, done ) {
|
||||
var elem = $( this ),
|
||||
mode = $.effects.setMode( elem, o.mode || "hide" ),
|
||||
hide = mode === "hide",
|
||||
percent = parseInt( o.percent, 10 ) || 150,
|
||||
factor = percent / 100,
|
||||
original = {
|
||||
height: elem.height(),
|
||||
width: elem.width()
|
||||
};
|
||||
|
||||
$.extend( o, {
|
||||
effect: "scale",
|
||||
queue: false,
|
||||
fade: true,
|
||||
mode: mode,
|
||||
complete: done,
|
||||
percent: hide ? percent : 100,
|
||||
from: hide ?
|
||||
original :
|
||||
{
|
||||
height: original.height * factor,
|
||||
width: original.width * factor
|
||||
}
|
||||
});
|
||||
|
||||
elem.effect( o );
|
||||
};
|
||||
|
||||
$.effects.effect.scale = function( o, done ) {
|
||||
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
options = $.extend( true, {}, o ),
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
percent = parseInt( o.percent, 10 ) ||
|
||||
( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
|
||||
direction = o.direction || "both",
|
||||
origin = o.origin,
|
||||
original = {
|
||||
height: el.height(),
|
||||
width: el.width(),
|
||||
outerHeight: el.outerHeight(),
|
||||
outerWidth: el.outerWidth()
|
||||
},
|
||||
factor = {
|
||||
y: direction !== "horizontal" ? (percent / 100) : 1,
|
||||
x: direction !== "vertical" ? (percent / 100) : 1
|
||||
};
|
||||
|
||||
// We are going to pass this effect to the size effect:
|
||||
options.effect = "size";
|
||||
options.queue = false;
|
||||
options.complete = done;
|
||||
|
||||
// Set default origin and restore for show/hide
|
||||
if ( mode !== "effect" ) {
|
||||
options.origin = origin || ["middle","center"];
|
||||
options.restore = true;
|
||||
}
|
||||
|
||||
options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original );
|
||||
options.to = {
|
||||
height: original.height * factor.y,
|
||||
width: original.width * factor.x,
|
||||
outerHeight: original.outerHeight * factor.y,
|
||||
outerWidth: original.outerWidth * factor.x
|
||||
};
|
||||
|
||||
// Fade option to support puff
|
||||
if ( options.fade ) {
|
||||
if ( mode === "show" ) {
|
||||
options.from.opacity = 0;
|
||||
options.to.opacity = 1;
|
||||
}
|
||||
if ( mode === "hide" ) {
|
||||
options.from.opacity = 1;
|
||||
options.to.opacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Animate
|
||||
el.effect( options );
|
||||
|
||||
};
|
||||
|
||||
$.effects.effect.size = function( o, done ) {
|
||||
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
|
||||
|
||||
// Always restore
|
||||
props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
|
||||
|
||||
// Copy for children
|
||||
props2 = [ "width", "height", "overflow" ],
|
||||
cProps = [ "fontSize" ],
|
||||
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
|
||||
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
|
||||
|
||||
// Set options
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
restore = o.restore || mode !== "effect",
|
||||
scale = o.scale || "both",
|
||||
origin = o.origin || [ "middle", "center" ],
|
||||
original, baseline, factor,
|
||||
position = el.css( "position" );
|
||||
|
||||
if ( mode === "show" ) {
|
||||
el.show();
|
||||
}
|
||||
original = {
|
||||
height: el.height(),
|
||||
width: el.width(),
|
||||
outerHeight: el.outerHeight(),
|
||||
outerWidth: el.outerWidth()
|
||||
};
|
||||
|
||||
el.from = o.from || original;
|
||||
el.to = o.to || original;
|
||||
|
||||
// Set scaling factor
|
||||
factor = {
|
||||
from: {
|
||||
y: el.from.height / original.height,
|
||||
x: el.from.width / original.width
|
||||
},
|
||||
to: {
|
||||
y: el.to.height / original.height,
|
||||
x: el.to.width / original.width
|
||||
}
|
||||
};
|
||||
|
||||
// Scale the css box
|
||||
if ( scale === "box" || scale === "both" ) {
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
props = props.concat( vProps );
|
||||
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
|
||||
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
|
||||
}
|
||||
|
||||
// Horizontal props scaling
|
||||
if ( factor.from.x !== factor.to.x ) {
|
||||
props = props.concat( hProps );
|
||||
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
|
||||
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
|
||||
}
|
||||
}
|
||||
|
||||
// Scale the content
|
||||
if ( scale === "content" || scale === "both" ) {
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
props = props.concat( cProps );
|
||||
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
|
||||
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
|
||||
}
|
||||
}
|
||||
|
||||
$.effects.save( el, restore ? props : props1 );
|
||||
el.show();
|
||||
$.effects.createWrapper( el );
|
||||
el.css( "overflow", "hidden" ).css( el.from );
|
||||
|
||||
// Adjust
|
||||
if (origin) { // Calculate baseline shifts
|
||||
baseline = $.effects.getBaseline( origin, original );
|
||||
el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
|
||||
el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
|
||||
el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
|
||||
el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
|
||||
}
|
||||
el.css( el.from ); // set top & left
|
||||
|
||||
// Animate
|
||||
if ( scale === "content" || scale === "both" ) { // Scale the children
|
||||
|
||||
// Add margins/font-size
|
||||
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
|
||||
hProps = hProps.concat([ "marginLeft", "marginRight" ]);
|
||||
props2 = props.concat(vProps).concat(hProps);
|
||||
|
||||
el.find( "*[width]" ).each( function(){
|
||||
var child = $( this ),
|
||||
c_original = {
|
||||
height: child.height(),
|
||||
width: child.width()
|
||||
};
|
||||
if (restore) {
|
||||
$.effects.save(child, props2);
|
||||
}
|
||||
|
||||
child.from = {
|
||||
height: c_original.height * factor.from.y,
|
||||
width: c_original.width * factor.from.x
|
||||
};
|
||||
child.to = {
|
||||
height: c_original.height * factor.to.y,
|
||||
width: c_original.width * factor.to.x
|
||||
};
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
|
||||
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
|
||||
}
|
||||
|
||||
// Horizontal props scaling
|
||||
if ( factor.from.x !== factor.to.x ) {
|
||||
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
|
||||
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
|
||||
}
|
||||
|
||||
// Animate children
|
||||
child.css( child.from );
|
||||
child.animate( child.to, o.duration, o.easing, function() {
|
||||
|
||||
// Restore children
|
||||
if ( restore ) {
|
||||
$.effects.restore( child, props2 );
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Animate
|
||||
el.animate( el.to, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: function() {
|
||||
if ( el.to.opacity === 0 ) {
|
||||
el.css( "opacity", el.from.opacity );
|
||||
}
|
||||
if( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, restore ? props : props1 );
|
||||
if ( !restore ) {
|
||||
|
||||
// we need to calculate our new positioning based on the scaling
|
||||
if ( position === "static" ) {
|
||||
el.css({
|
||||
position: "relative",
|
||||
top: el.to.top,
|
||||
left: el.to.left
|
||||
});
|
||||
} else {
|
||||
$.each([ "top", "left" ], function( idx, pos ) {
|
||||
el.css( pos, function( _, str ) {
|
||||
var val = parseInt( str, 10 ),
|
||||
toRef = idx ? el.to.left : el.to.top;
|
||||
|
||||
// if original was "auto", recalculate the new value from wrapper
|
||||
if ( str === "auto" ) {
|
||||
return toRef + "px";
|
||||
}
|
||||
|
||||
return val + toRef + "px";
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*!
|
||||
* jQuery UI Effects Shake 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/shake-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.shake = function( o, done ) {
|
||||
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
direction = o.direction || "left",
|
||||
distance = o.distance || 20,
|
||||
times = o.times || 3,
|
||||
anims = times * 2 + 1,
|
||||
speed = Math.round(o.duration/anims),
|
||||
ref = (direction === "up" || direction === "down") ? "top" : "left",
|
||||
positiveMotion = (direction === "up" || direction === "left"),
|
||||
animation = {},
|
||||
animation1 = {},
|
||||
animation2 = {},
|
||||
i,
|
||||
|
||||
// we will need to re-assemble the queue to stack our animations in place
|
||||
queue = el.queue(),
|
||||
queuelen = queue.length;
|
||||
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
$.effects.createWrapper( el );
|
||||
|
||||
// Animation
|
||||
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
|
||||
animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
|
||||
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
|
||||
|
||||
// Animate
|
||||
el.animate( animation, speed, o.easing );
|
||||
|
||||
// Shakes
|
||||
for ( i = 1; i < times; i++ ) {
|
||||
el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
|
||||
}
|
||||
el
|
||||
.animate( animation1, speed, o.easing )
|
||||
.animate( animation, speed / 2, o.easing )
|
||||
.queue(function() {
|
||||
if ( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
});
|
||||
|
||||
// inject all the animations we just queued to be first in line (after "inprogress")
|
||||
if ( queuelen > 1) {
|
||||
queue.splice.apply( queue,
|
||||
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
||||
}
|
||||
el.dequeue();
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*!
|
||||
* jQuery UI Effects Slide 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/slide-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.slide = function( o, done ) {
|
||||
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
|
||||
mode = $.effects.setMode( el, o.mode || "show" ),
|
||||
show = mode === "show",
|
||||
direction = o.direction || "left",
|
||||
ref = (direction === "up" || direction === "down") ? "top" : "left",
|
||||
positiveMotion = (direction === "up" || direction === "left"),
|
||||
distance,
|
||||
animation = {};
|
||||
|
||||
// Adjust
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
|
||||
|
||||
$.effects.createWrapper( el ).css({
|
||||
overflow: "hidden"
|
||||
});
|
||||
|
||||
if ( show ) {
|
||||
el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
|
||||
}
|
||||
|
||||
// Animation
|
||||
animation[ ref ] = ( show ?
|
||||
( positiveMotion ? "+=" : "-=") :
|
||||
( positiveMotion ? "-=" : "+=")) +
|
||||
distance;
|
||||
|
||||
// Animate
|
||||
el.animate( animation, {
|
||||
queue: false,
|
||||
duration: o.duration,
|
||||
easing: o.easing,
|
||||
complete: function() {
|
||||
if ( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* jQuery UI Effects Transfer 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/transfer-effect/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.effect.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.transfer = function( o, done ) {
|
||||
var elem = $( this ),
|
||||
target = $( o.to ),
|
||||
targetFixed = target.css( "position" ) === "fixed",
|
||||
body = $("body"),
|
||||
fixTop = targetFixed ? body.scrollTop() : 0,
|
||||
fixLeft = targetFixed ? body.scrollLeft() : 0,
|
||||
endPosition = target.offset(),
|
||||
animation = {
|
||||
top: endPosition.top - fixTop ,
|
||||
left: endPosition.left - fixLeft ,
|
||||
height: target.innerHeight(),
|
||||
width: target.innerWidth()
|
||||
},
|
||||
startPosition = elem.offset(),
|
||||
transfer = $( '<div class="ui-effects-transfer"></div>' )
|
||||
.appendTo( document.body )
|
||||
.addClass( o.className )
|
||||
.css({
|
||||
top: startPosition.top - fixTop ,
|
||||
left: startPosition.left - fixLeft ,
|
||||
height: elem.innerHeight(),
|
||||
width: elem.innerWidth(),
|
||||
position: targetFixed ? "fixed" : "absolute"
|
||||
})
|
||||
.animate( animation, o.duration, o.easing, function() {
|
||||
transfer.remove();
|
||||
done();
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
+1279
File diff suppressed because it is too large
Load Diff
+609
@@ -0,0 +1,609 @@
|
||||
/*!
|
||||
* jQuery UI Menu 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/menu/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.position.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
var mouseHandled = false;
|
||||
|
||||
$.widget( "ui.menu", {
|
||||
version: "1.9.0",
|
||||
defaultElement: "<ul>",
|
||||
delay: 300,
|
||||
options: {
|
||||
icons: {
|
||||
submenu: "ui-icon-carat-1-e"
|
||||
},
|
||||
menus: "ul",
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "right top"
|
||||
},
|
||||
role: "menu",
|
||||
|
||||
// callbacks
|
||||
blur: null,
|
||||
focus: null,
|
||||
select: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this.activeMenu = this.element;
|
||||
this.element
|
||||
.uniqueId()
|
||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||
.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
|
||||
.attr({
|
||||
role: this.options.role,
|
||||
tabIndex: 0
|
||||
})
|
||||
// need to catch all clicks on disabled menu
|
||||
// not possible through _on
|
||||
.bind( "click" + this.eventNamespace, $.proxy(function( event ) {
|
||||
if ( this.options.disabled ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}, this ));
|
||||
|
||||
if ( this.options.disabled ) {
|
||||
this.element
|
||||
.addClass( "ui-state-disabled" )
|
||||
.attr( "aria-disabled", "true" );
|
||||
}
|
||||
|
||||
this._on({
|
||||
// Prevent focus from sticking to links inside menu after clicking
|
||||
// them (focus should always stay on UL during navigation).
|
||||
"mousedown .ui-menu-item > a": function( event ) {
|
||||
event.preventDefault();
|
||||
},
|
||||
"click .ui-state-disabled > a": function( event ) {
|
||||
event.preventDefault();
|
||||
},
|
||||
"click .ui-menu-item:has(a)": function( event ) {
|
||||
var target = $( event.target ).closest( ".ui-menu-item" );
|
||||
if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
||||
mouseHandled = true;
|
||||
|
||||
this.select( event );
|
||||
// Open submenu on click
|
||||
if ( target.has( ".ui-menu" ).length ) {
|
||||
this.expand( event );
|
||||
} else if ( !this.element.is( ":focus" ) ) {
|
||||
// Redirect focus to the menu
|
||||
this.element.trigger( "focus", [ true ] );
|
||||
|
||||
// If the active item is on the top level, let it stay active.
|
||||
// Otherwise, blur the active item since it is no longer visible.
|
||||
if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
|
||||
clearTimeout( this.timer );
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mouseenter .ui-menu-item": function( event ) {
|
||||
var target = $( event.currentTarget );
|
||||
// Remove ui-state-active class from siblings of the newly focused menu item
|
||||
// to avoid a jump caused by adjacent elements both having a class with a border
|
||||
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
|
||||
this.focus( event, target );
|
||||
},
|
||||
mouseleave: "collapseAll",
|
||||
"mouseleave .ui-menu": "collapseAll",
|
||||
focus: function( event, keepActiveItem ) {
|
||||
// If there's already an active item, keep it active
|
||||
// If not, activate the first item
|
||||
var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
|
||||
|
||||
if ( !keepActiveItem ) {
|
||||
this.focus( event, item );
|
||||
}
|
||||
},
|
||||
blur: function( event ) {
|
||||
this._delay(function() {
|
||||
if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
|
||||
this.collapseAll( event );
|
||||
}
|
||||
});
|
||||
},
|
||||
keydown: "_keydown"
|
||||
});
|
||||
|
||||
this.refresh();
|
||||
|
||||
// Clicks outside of a menu collapse any open menus
|
||||
this._on( this.document, {
|
||||
click: function( event ) {
|
||||
if ( !$( event.target ).closest( ".ui-menu" ).length ) {
|
||||
this.collapseAll( event );
|
||||
}
|
||||
|
||||
// Reset the mouseHandled flag
|
||||
mouseHandled = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
// Destroy (sub)menus
|
||||
this.element
|
||||
.removeAttr( "aria-activedescendant" )
|
||||
.find( ".ui-menu" ).andSelf()
|
||||
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
|
||||
.removeAttr( "role" )
|
||||
.removeAttr( "tabIndex" )
|
||||
.removeAttr( "aria-labelledby" )
|
||||
.removeAttr( "aria-expanded" )
|
||||
.removeAttr( "aria-hidden" )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeUniqueId()
|
||||
.show();
|
||||
|
||||
// Destroy menu items
|
||||
this.element.find( ".ui-menu-item" )
|
||||
.removeClass( "ui-menu-item" )
|
||||
.removeAttr( "role" )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.children( "a" )
|
||||
.removeUniqueId()
|
||||
.removeClass( "ui-corner-all ui-state-hover" )
|
||||
.removeAttr( "tabIndex" )
|
||||
.removeAttr( "role" )
|
||||
.removeAttr( "aria-haspopup" )
|
||||
.children().each( function() {
|
||||
var elem = $( this );
|
||||
if ( elem.data( "ui-menu-submenu-carat" ) ) {
|
||||
elem.remove();
|
||||
}
|
||||
});
|
||||
|
||||
// Destroy menu dividers
|
||||
this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
|
||||
},
|
||||
|
||||
_keydown: function( event ) {
|
||||
var match, prev, character, skip, regex,
|
||||
preventDefault = true;
|
||||
|
||||
function escape( value ) {
|
||||
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
|
||||
}
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
this.previousPage( event );
|
||||
break;
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
this.nextPage( event );
|
||||
break;
|
||||
case $.ui.keyCode.HOME:
|
||||
this._move( "first", "first", event );
|
||||
break;
|
||||
case $.ui.keyCode.END:
|
||||
this._move( "last", "last", event );
|
||||
break;
|
||||
case $.ui.keyCode.UP:
|
||||
this.previous( event );
|
||||
break;
|
||||
case $.ui.keyCode.DOWN:
|
||||
this.next( event );
|
||||
break;
|
||||
case $.ui.keyCode.LEFT:
|
||||
this.collapse( event );
|
||||
break;
|
||||
case $.ui.keyCode.RIGHT:
|
||||
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
|
||||
this.expand( event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.ENTER:
|
||||
case $.ui.keyCode.SPACE:
|
||||
this._activate( event );
|
||||
break;
|
||||
case $.ui.keyCode.ESCAPE:
|
||||
this.collapse( event );
|
||||
break;
|
||||
default:
|
||||
preventDefault = false;
|
||||
prev = this.previousFilter || "";
|
||||
character = String.fromCharCode( event.keyCode );
|
||||
skip = false;
|
||||
|
||||
clearTimeout( this.filterTimer );
|
||||
|
||||
if ( character === prev ) {
|
||||
skip = true;
|
||||
} else {
|
||||
character = prev + character;
|
||||
}
|
||||
|
||||
regex = new RegExp( "^" + escape( character ), "i" );
|
||||
match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
|
||||
return regex.test( $( this ).children( "a" ).text() );
|
||||
});
|
||||
match = skip && match.index( this.active.next() ) !== -1 ?
|
||||
this.active.nextAll( ".ui-menu-item" ) :
|
||||
match;
|
||||
|
||||
// If no matches on the current filter, reset to the last character pressed
|
||||
// to move down the menu to the first item that starts with that character
|
||||
if ( !match.length ) {
|
||||
character = String.fromCharCode( event.keyCode );
|
||||
regex = new RegExp( "^" + escape( character ), "i" );
|
||||
match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
|
||||
return regex.test( $( this ).children( "a" ).text() );
|
||||
});
|
||||
}
|
||||
|
||||
if ( match.length ) {
|
||||
this.focus( event, match );
|
||||
if ( match.length > 1 ) {
|
||||
this.previousFilter = character;
|
||||
this.filterTimer = this._delay(function() {
|
||||
delete this.previousFilter;
|
||||
}, 1000 );
|
||||
} else {
|
||||
delete this.previousFilter;
|
||||
}
|
||||
} else {
|
||||
delete this.previousFilter;
|
||||
}
|
||||
}
|
||||
|
||||
if ( preventDefault ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
_activate: function( event ) {
|
||||
if ( !this.active.is( ".ui-state-disabled" ) ) {
|
||||
if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
|
||||
this.expand( event );
|
||||
} else {
|
||||
this.select( event );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
// Initialize nested menus
|
||||
var menus,
|
||||
icon = this.options.icons.submenu,
|
||||
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
|
||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||
.hide()
|
||||
.attr({
|
||||
role: this.options.role,
|
||||
"aria-hidden": "true",
|
||||
"aria-expanded": "false"
|
||||
});
|
||||
|
||||
// Don't refresh list items that are already adapted
|
||||
menus = submenus.add( this.element );
|
||||
|
||||
menus.children( ":not(.ui-menu-item):has(a)" )
|
||||
.addClass( "ui-menu-item" )
|
||||
.attr( "role", "presentation" )
|
||||
.children( "a" )
|
||||
.uniqueId()
|
||||
.addClass( "ui-corner-all" )
|
||||
.attr({
|
||||
tabIndex: -1,
|
||||
role: this._itemRole()
|
||||
});
|
||||
|
||||
// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
|
||||
menus.children( ":not(.ui-menu-item)" ).each(function() {
|
||||
var item = $( this );
|
||||
// hyphen, em dash, en dash
|
||||
if ( !/[^\-—–\s]/.test( item.text() ) ) {
|
||||
item.addClass( "ui-widget-content ui-menu-divider" );
|
||||
}
|
||||
});
|
||||
|
||||
// Add aria-disabled attribute to any disabled menu item
|
||||
menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
|
||||
|
||||
submenus.each(function() {
|
||||
var menu = $( this ),
|
||||
item = menu.prev( "a" ),
|
||||
submenuCarat = $( "<span>" )
|
||||
.addClass( "ui-menu-icon ui-icon " + icon )
|
||||
.data( "ui-menu-submenu-carat", true );
|
||||
|
||||
item
|
||||
.attr( "aria-haspopup", "true" )
|
||||
.prepend( submenuCarat );
|
||||
menu.attr( "aria-labelledby", item.attr( "id" ) );
|
||||
});
|
||||
|
||||
// If the active item has been removed, blur the menu
|
||||
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
|
||||
this.blur();
|
||||
}
|
||||
},
|
||||
|
||||
_itemRole: function() {
|
||||
return {
|
||||
menu: "menuitem",
|
||||
listbox: "option"
|
||||
}[ this.options.role ];
|
||||
},
|
||||
|
||||
focus: function( event, item ) {
|
||||
var nested, focused;
|
||||
this.blur( event, event && event.type === "focus" );
|
||||
|
||||
this._scrollIntoView( item );
|
||||
|
||||
this.active = item.first();
|
||||
focused = this.active.children( "a" ).addClass( "ui-state-focus" );
|
||||
// Only update aria-activedescendant if there's a role
|
||||
// otherwise we assume focus is managed elsewhere
|
||||
if ( this.options.role ) {
|
||||
this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
|
||||
}
|
||||
|
||||
// Highlight active parent menu item, if any
|
||||
this.active
|
||||
.parent()
|
||||
.closest( ".ui-menu-item" )
|
||||
.children( "a:first" )
|
||||
.addClass( "ui-state-active" );
|
||||
|
||||
if ( event && event.type === "keydown" ) {
|
||||
this._close();
|
||||
} else {
|
||||
this.timer = this._delay(function() {
|
||||
this._close();
|
||||
}, this.delay );
|
||||
}
|
||||
|
||||
nested = item.children( ".ui-menu" );
|
||||
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
|
||||
this._startOpening(nested);
|
||||
}
|
||||
this.activeMenu = item.parent();
|
||||
|
||||
this._trigger( "focus", event, { item: item } );
|
||||
},
|
||||
|
||||
_scrollIntoView: function( item ) {
|
||||
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
|
||||
if ( this._hasScroll() ) {
|
||||
borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
|
||||
paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
|
||||
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
|
||||
scroll = this.activeMenu.scrollTop();
|
||||
elementHeight = this.activeMenu.height();
|
||||
itemHeight = item.height();
|
||||
|
||||
if ( offset < 0 ) {
|
||||
this.activeMenu.scrollTop( scroll + offset );
|
||||
} else if ( offset + itemHeight > elementHeight ) {
|
||||
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
blur: function( event, fromFocus ) {
|
||||
if ( !fromFocus ) {
|
||||
clearTimeout( this.timer );
|
||||
}
|
||||
|
||||
if ( !this.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.active.children( "a" ).removeClass( "ui-state-focus" );
|
||||
this.active = null;
|
||||
|
||||
this._trigger( "blur", event, { item: this.active } );
|
||||
},
|
||||
|
||||
_startOpening: function( submenu ) {
|
||||
clearTimeout( this.timer );
|
||||
|
||||
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
|
||||
// shift in the submenu position when mousing over the carat icon
|
||||
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.timer = this._delay(function() {
|
||||
this._close();
|
||||
this._open( submenu );
|
||||
}, this.delay );
|
||||
},
|
||||
|
||||
_open: function( submenu ) {
|
||||
var position = $.extend({
|
||||
of: this.active
|
||||
}, this.options.position );
|
||||
|
||||
clearTimeout( this.timer );
|
||||
this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
|
||||
.hide()
|
||||
.attr( "aria-hidden", "true" );
|
||||
|
||||
submenu
|
||||
.show()
|
||||
.removeAttr( "aria-hidden" )
|
||||
.attr( "aria-expanded", "true" )
|
||||
.position( position );
|
||||
},
|
||||
|
||||
collapseAll: function( event, all ) {
|
||||
clearTimeout( this.timer );
|
||||
this.timer = this._delay(function() {
|
||||
// If we were passed an event, look for the submenu that contains the event
|
||||
var currentMenu = all ? this.element :
|
||||
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
|
||||
|
||||
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
|
||||
if ( !currentMenu.length ) {
|
||||
currentMenu = this.element;
|
||||
}
|
||||
|
||||
this._close( currentMenu );
|
||||
|
||||
this.blur( event );
|
||||
this.activeMenu = currentMenu;
|
||||
}, this.delay );
|
||||
},
|
||||
|
||||
// With no arguments, closes the currently active menu - if nothing is active
|
||||
// it closes all menus. If passed an argument, it will search for menus BELOW
|
||||
_close: function( startMenu ) {
|
||||
if ( !startMenu ) {
|
||||
startMenu = this.active ? this.active.parent() : this.element;
|
||||
}
|
||||
|
||||
startMenu
|
||||
.find( ".ui-menu" )
|
||||
.hide()
|
||||
.attr( "aria-hidden", "true" )
|
||||
.attr( "aria-expanded", "false" )
|
||||
.end()
|
||||
.find( "a.ui-state-active" )
|
||||
.removeClass( "ui-state-active" );
|
||||
},
|
||||
|
||||
collapse: function( event ) {
|
||||
var newItem = this.active &&
|
||||
this.active.parent().closest( ".ui-menu-item", this.element );
|
||||
if ( newItem && newItem.length ) {
|
||||
this._close();
|
||||
this.focus( event, newItem );
|
||||
}
|
||||
},
|
||||
|
||||
expand: function( event ) {
|
||||
var newItem = this.active &&
|
||||
this.active
|
||||
.children( ".ui-menu " )
|
||||
.children( ".ui-menu-item" )
|
||||
.first();
|
||||
|
||||
if ( newItem && newItem.length ) {
|
||||
this._open( newItem.parent() );
|
||||
|
||||
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
|
||||
this._delay(function() {
|
||||
this.focus( event, newItem );
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
next: function( event ) {
|
||||
this._move( "next", "first", event );
|
||||
},
|
||||
|
||||
previous: function( event ) {
|
||||
this._move( "prev", "last", event );
|
||||
},
|
||||
|
||||
isFirstItem: function() {
|
||||
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
|
||||
},
|
||||
|
||||
isLastItem: function() {
|
||||
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
|
||||
},
|
||||
|
||||
_move: function( direction, filter, event ) {
|
||||
var next;
|
||||
if ( this.active ) {
|
||||
if ( direction === "first" || direction === "last" ) {
|
||||
next = this.active
|
||||
[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
|
||||
.eq( -1 );
|
||||
} else {
|
||||
next = this.active
|
||||
[ direction + "All" ]( ".ui-menu-item" )
|
||||
.eq( 0 );
|
||||
}
|
||||
}
|
||||
if ( !next || !next.length || !this.active ) {
|
||||
next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
|
||||
}
|
||||
|
||||
this.focus( event, next );
|
||||
},
|
||||
|
||||
nextPage: function( event ) {
|
||||
var item, base, height;
|
||||
|
||||
if ( !this.active ) {
|
||||
this.next( event );
|
||||
return;
|
||||
}
|
||||
if ( this.isLastItem() ) {
|
||||
return;
|
||||
}
|
||||
if ( this._hasScroll() ) {
|
||||
base = this.active.offset().top;
|
||||
height = this.element.height();
|
||||
this.active.nextAll( ".ui-menu-item" ).each(function() {
|
||||
item = $( this );
|
||||
return item.offset().top - base - height < 0;
|
||||
});
|
||||
|
||||
this.focus( event, item );
|
||||
} else {
|
||||
this.focus( event, this.activeMenu.children( ".ui-menu-item" )
|
||||
[ !this.active ? "first" : "last" ]() );
|
||||
}
|
||||
},
|
||||
|
||||
previousPage: function( event ) {
|
||||
var item, base, height;
|
||||
if ( !this.active ) {
|
||||
this.next( event );
|
||||
return;
|
||||
}
|
||||
if ( this.isFirstItem() ) {
|
||||
return;
|
||||
}
|
||||
if ( this._hasScroll() ) {
|
||||
base = this.active.offset().top;
|
||||
height = this.element.height();
|
||||
this.active.prevAll( ".ui-menu-item" ).each(function() {
|
||||
item = $( this );
|
||||
return item.offset().top - base + height > 0;
|
||||
});
|
||||
|
||||
this.focus( event, item );
|
||||
} else {
|
||||
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
|
||||
}
|
||||
},
|
||||
|
||||
_hasScroll: function() {
|
||||
return this.element.outerHeight() < this.element.prop( "scrollHeight" );
|
||||
},
|
||||
|
||||
select: function( event ) {
|
||||
// TODO: It should never be possible to not have an active item at this
|
||||
// point, but the tests don't trigger mouseenter before click.
|
||||
this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
|
||||
var ui = { item: this.active };
|
||||
if ( !this.active.has( ".ui-menu" ).length ) {
|
||||
this.collapseAll( event, true );
|
||||
}
|
||||
this._trigger( "select", event, ui );
|
||||
}
|
||||
});
|
||||
|
||||
}( jQuery ));
|
||||
+481
@@ -0,0 +1,481 @@
|
||||
/*!
|
||||
* jQuery UI Spinner 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/spinner/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.button.js
|
||||
*/
|
||||
(function( $ ) {
|
||||
|
||||
function modifier( fn ) {
|
||||
return function() {
|
||||
var previous = this.element.val();
|
||||
fn.apply( this, arguments );
|
||||
this._refresh();
|
||||
if ( previous !== this.element.val() ) {
|
||||
this._trigger( "change" );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.widget( "ui.spinner", {
|
||||
version: "1.9.0",
|
||||
defaultElement: "<input>",
|
||||
widgetEventPrefix: "spin",
|
||||
options: {
|
||||
culture: null,
|
||||
icons: {
|
||||
down: "ui-icon-triangle-1-s",
|
||||
up: "ui-icon-triangle-1-n"
|
||||
},
|
||||
incremental: true,
|
||||
max: null,
|
||||
min: null,
|
||||
numberFormat: null,
|
||||
page: 10,
|
||||
step: 1,
|
||||
|
||||
change: null,
|
||||
spin: null,
|
||||
start: null,
|
||||
stop: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
// handle string values that need to be parsed
|
||||
this._setOption( "max", this.options.max );
|
||||
this._setOption( "min", this.options.min );
|
||||
this._setOption( "step", this.options.step );
|
||||
|
||||
// format the value, but don't constrain
|
||||
this._value( this.element.val(), true );
|
||||
|
||||
this._draw();
|
||||
this._on( this._events );
|
||||
this._refresh();
|
||||
|
||||
// turning off autocomplete prevents the browser from remembering the
|
||||
// value when navigating through history, so we re-enable autocomplete
|
||||
// if the page is unloaded before the widget is destroyed. #7790
|
||||
this._on( this.window, {
|
||||
beforeunload: function() {
|
||||
this.element.removeAttr( "autocomplete" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_getCreateOptions: function() {
|
||||
var options = {},
|
||||
element = this.element;
|
||||
|
||||
$.each( [ "min", "max", "step" ], function( i, option ) {
|
||||
var value = element.attr( option );
|
||||
if ( value !== undefined && value.length ) {
|
||||
options[ option ] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_events: {
|
||||
keydown: function( event ) {
|
||||
if ( this._start( event ) && this._keydown( event ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
keyup: "_stop",
|
||||
focus: function() {
|
||||
this.uiSpinner.addClass( "ui-state-active" );
|
||||
this.previous = this.element.val();
|
||||
},
|
||||
blur: function( event ) {
|
||||
if ( this.cancelBlur ) {
|
||||
delete this.cancelBlur;
|
||||
return;
|
||||
}
|
||||
|
||||
this._refresh();
|
||||
this.uiSpinner.removeClass( "ui-state-active" );
|
||||
if ( this.previous !== this.element.val() ) {
|
||||
this._trigger( "change", event );
|
||||
}
|
||||
},
|
||||
mousewheel: function( event, delta ) {
|
||||
if ( !delta ) {
|
||||
return;
|
||||
}
|
||||
if ( !this.spinning && !this._start( event ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
|
||||
clearTimeout( this.mousewheelTimer );
|
||||
this.mousewheelTimer = this._delay(function() {
|
||||
if ( this.spinning ) {
|
||||
this._stop( event );
|
||||
}
|
||||
}, 100 );
|
||||
event.preventDefault();
|
||||
},
|
||||
"mousedown .ui-spinner-button": function( event ) {
|
||||
var previous;
|
||||
|
||||
// We never want the buttons to have focus; whenever the user is
|
||||
// interacting with the spinner, the focus should be on the input.
|
||||
// If the input is focused then this.previous is properly set from
|
||||
// when the input first received focus. If the input is not focused
|
||||
// then we need to set this.previous based on the value before spinning.
|
||||
previous = this.element[0] === this.document[0].activeElement ?
|
||||
this.previous : this.element.val();
|
||||
function checkFocus() {
|
||||
var isActive = this.element[0] === this.document[0].activeElement;
|
||||
if ( !isActive ) {
|
||||
this.element.focus();
|
||||
this.previous = previous;
|
||||
// support: IE
|
||||
// IE sets focus asynchronously, so we need to check if focus
|
||||
// moved off of the input because the user clicked on the button.
|
||||
this._delay(function() {
|
||||
this.previous = previous;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ensure focus is on (or stays on) the text field
|
||||
event.preventDefault();
|
||||
checkFocus.call( this );
|
||||
|
||||
// support: IE
|
||||
// IE doesn't prevent moving focus even with event.preventDefault()
|
||||
// so we set a flag to know when we should ignore the blur event
|
||||
// and check (again) if focus moved off of the input.
|
||||
this.cancelBlur = true;
|
||||
this._delay(function() {
|
||||
delete this.cancelBlur;
|
||||
checkFocus.call( this );
|
||||
});
|
||||
|
||||
if ( this._start( event ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
|
||||
},
|
||||
"mouseup .ui-spinner-button": "_stop",
|
||||
"mouseenter .ui-spinner-button": function( event ) {
|
||||
// button will add ui-state-active if mouse was down while mouseleave and kept down
|
||||
if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this._start( event ) === false ) {
|
||||
return false;
|
||||
}
|
||||
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
|
||||
},
|
||||
// TODO: do we really want to consider this a stop?
|
||||
// shouldn't we just stop the repeater and wait until mouseup before
|
||||
// we trigger the stop event?
|
||||
"mouseleave .ui-spinner-button": "_stop"
|
||||
},
|
||||
|
||||
_draw: function() {
|
||||
var uiSpinner = this.uiSpinner = this.element
|
||||
.addClass( "ui-spinner-input" )
|
||||
.attr( "autocomplete", "off" )
|
||||
.wrap( this._uiSpinnerHtml() )
|
||||
.parent()
|
||||
// add buttons
|
||||
.append( this._buttonHtml() );
|
||||
this._hoverable( uiSpinner );
|
||||
|
||||
this.element.attr( "role", "spinbutton" );
|
||||
|
||||
// button bindings
|
||||
this.buttons = uiSpinner.find( ".ui-spinner-button" )
|
||||
.attr( "tabIndex", -1 )
|
||||
.button()
|
||||
.removeClass( "ui-corner-all" );
|
||||
|
||||
// IE 6 doesn't understand height: 50% for the buttons
|
||||
// unless the wrapper has an explicit height
|
||||
if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
|
||||
uiSpinner.height() > 0 ) {
|
||||
uiSpinner.height( uiSpinner.height() );
|
||||
}
|
||||
|
||||
// disable spinner if element was already disabled
|
||||
if ( this.options.disabled ) {
|
||||
this.disable();
|
||||
}
|
||||
},
|
||||
|
||||
_keydown: function( event ) {
|
||||
var options = this.options,
|
||||
keyCode = $.ui.keyCode;
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case keyCode.UP:
|
||||
this._repeat( null, 1, event );
|
||||
return true;
|
||||
case keyCode.DOWN:
|
||||
this._repeat( null, -1, event );
|
||||
return true;
|
||||
case keyCode.PAGE_UP:
|
||||
this._repeat( null, options.page, event );
|
||||
return true;
|
||||
case keyCode.PAGE_DOWN:
|
||||
this._repeat( null, -options.page, event );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_uiSpinnerHtml: function() {
|
||||
return "<span class='ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all'></span>";
|
||||
},
|
||||
|
||||
_buttonHtml: function() {
|
||||
return "" +
|
||||
"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
|
||||
"<span class='ui-icon " + this.options.icons.up + "'>▲</span>" +
|
||||
"</a>" +
|
||||
"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
|
||||
"<span class='ui-icon " + this.options.icons.down + "'>▼</span>" +
|
||||
"</a>";
|
||||
},
|
||||
|
||||
_start: function( event ) {
|
||||
if ( !this.spinning && this._trigger( "start", event ) === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !this.counter ) {
|
||||
this.counter = 1;
|
||||
}
|
||||
this.spinning = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
_repeat: function( i, steps, event ) {
|
||||
i = i || 500;
|
||||
|
||||
clearTimeout( this.timer );
|
||||
this.timer = this._delay(function() {
|
||||
this._repeat( 40, steps, event );
|
||||
}, i );
|
||||
|
||||
this._spin( steps * this.options.step, event );
|
||||
},
|
||||
|
||||
_spin: function( step, event ) {
|
||||
var value = this.value() || 0;
|
||||
|
||||
if ( !this.counter ) {
|
||||
this.counter = 1;
|
||||
}
|
||||
|
||||
value = this._adjustValue( value + step * this._increment( this.counter ) );
|
||||
|
||||
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
|
||||
this._value( value );
|
||||
this.counter++;
|
||||
}
|
||||
},
|
||||
|
||||
_increment: function( i ) {
|
||||
var incremental = this.options.incremental;
|
||||
|
||||
if ( incremental ) {
|
||||
return $.isFunction( incremental ) ?
|
||||
incremental( i ) :
|
||||
Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
_precision: function() {
|
||||
var precision = this._precisionOf( this.options.step );
|
||||
if ( this.options.min !== null ) {
|
||||
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
||||
}
|
||||
return precision;
|
||||
},
|
||||
|
||||
_precisionOf: function( num ) {
|
||||
var str = num.toString(),
|
||||
decimal = str.indexOf( "." );
|
||||
return decimal === -1 ? 0 : str.length - decimal - 1;
|
||||
},
|
||||
|
||||
_adjustValue: function( value ) {
|
||||
var base, aboveMin,
|
||||
options = this.options;
|
||||
|
||||
// make sure we're at a valid step
|
||||
// - find out where we are relative to the base (min or 0)
|
||||
base = options.min !== null ? options.min : 0;
|
||||
aboveMin = value - base;
|
||||
// - round to the nearest step
|
||||
aboveMin = Math.round(aboveMin / options.step) * options.step;
|
||||
// - rounding is based on 0, so adjust back to our base
|
||||
value = base + aboveMin;
|
||||
|
||||
// fix precision from bad JS floating point math
|
||||
value = parseFloat( value.toFixed( this._precision() ) );
|
||||
|
||||
// clamp the value
|
||||
if ( options.max !== null && value > options.max) {
|
||||
return options.max;
|
||||
}
|
||||
if ( options.min !== null && value < options.min ) {
|
||||
return options.min;
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
_stop: function( event ) {
|
||||
if ( !this.spinning ) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout( this.timer );
|
||||
clearTimeout( this.mousewheelTimer );
|
||||
this.counter = 0;
|
||||
this.spinning = false;
|
||||
this._trigger( "stop", event );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "culture" || key === "numberFormat" ) {
|
||||
var prevValue = this._parse( this.element.val() );
|
||||
this.options[ key ] = value;
|
||||
this.element.val( this._format( prevValue ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key === "max" || key === "min" || key === "step" ) {
|
||||
if ( typeof value === "string" ) {
|
||||
value = this._parse( value );
|
||||
}
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
if ( value ) {
|
||||
this.element.prop( "disabled", true );
|
||||
this.buttons.button( "disable" );
|
||||
} else {
|
||||
this.element.prop( "disabled", false );
|
||||
this.buttons.button( "enable" );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setOptions: modifier(function( options ) {
|
||||
this._super( options );
|
||||
this._value( this.element.val() );
|
||||
}),
|
||||
|
||||
_parse: function( val ) {
|
||||
if ( typeof val === "string" && val !== "" ) {
|
||||
val = window.Globalize && this.options.numberFormat ?
|
||||
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
|
||||
}
|
||||
return val === "" || isNaN( val ) ? null : val;
|
||||
},
|
||||
|
||||
_format: function( value ) {
|
||||
if ( value === "" ) {
|
||||
return "";
|
||||
}
|
||||
return window.Globalize && this.options.numberFormat ?
|
||||
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
|
||||
value;
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
this.element.attr({
|
||||
"aria-valuemin": this.options.min,
|
||||
"aria-valuemax": this.options.max,
|
||||
// TODO: what should we do with values that can't be parsed?
|
||||
"aria-valuenow": this._parse( this.element.val() )
|
||||
});
|
||||
},
|
||||
|
||||
// update the value without triggering change
|
||||
_value: function( value, allowAny ) {
|
||||
var parsed;
|
||||
if ( value !== "" ) {
|
||||
parsed = this._parse( value );
|
||||
if ( parsed !== null ) {
|
||||
if ( !allowAny ) {
|
||||
parsed = this._adjustValue( parsed );
|
||||
}
|
||||
value = this._format( parsed );
|
||||
}
|
||||
}
|
||||
this.element.val( value );
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.element
|
||||
.removeClass( "ui-spinner-input" )
|
||||
.prop( "disabled", false )
|
||||
.removeAttr( "autocomplete" )
|
||||
.removeAttr( "role" )
|
||||
.removeAttr( "aria-valuemin" )
|
||||
.removeAttr( "aria-valuemax" )
|
||||
.removeAttr( "aria-valuenow" );
|
||||
this.uiSpinner.replaceWith( this.element );
|
||||
},
|
||||
|
||||
stepUp: modifier(function( steps ) {
|
||||
this._stepUp( steps );
|
||||
}),
|
||||
_stepUp: function( steps ) {
|
||||
this._spin( (steps || 1) * this.options.step );
|
||||
},
|
||||
|
||||
stepDown: modifier(function( steps ) {
|
||||
this._stepDown( steps );
|
||||
}),
|
||||
_stepDown: function( steps ) {
|
||||
this._spin( (steps || 1) * -this.options.step );
|
||||
},
|
||||
|
||||
pageUp: modifier(function( pages ) {
|
||||
this._stepUp( (pages || 1) * this.options.page );
|
||||
}),
|
||||
|
||||
pageDown: modifier(function( pages ) {
|
||||
this._stepDown( (pages || 1) * this.options.page );
|
||||
}),
|
||||
|
||||
value: function( newVal ) {
|
||||
if ( !arguments.length ) {
|
||||
return this._parse( this.element.val() );
|
||||
}
|
||||
modifier( this._value ).call( this, newVal );
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.uiSpinner;
|
||||
}
|
||||
});
|
||||
|
||||
}( jQuery ) );
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
/*!
|
||||
* jQuery UI Tooltip 1.9.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/tooltip/
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.position.js
|
||||
*/
|
||||
(function( $ ) {
|
||||
|
||||
var increments = 0;
|
||||
|
||||
function addDescribedBy( elem, id ) {
|
||||
var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
|
||||
describedby.push( id );
|
||||
elem
|
||||
.data( "ui-tooltip-id", id )
|
||||
.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
|
||||
}
|
||||
|
||||
function removeDescribedBy( elem ) {
|
||||
var id = elem.data( "ui-tooltip-id" ),
|
||||
describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
|
||||
index = $.inArray( id, describedby );
|
||||
if ( index !== -1 ) {
|
||||
describedby.splice( index, 1 );
|
||||
}
|
||||
|
||||
elem.removeData( "ui-tooltip-id" );
|
||||
describedby = $.trim( describedby.join( " " ) );
|
||||
if ( describedby ) {
|
||||
elem.attr( "aria-describedby", describedby );
|
||||
} else {
|
||||
elem.removeAttr( "aria-describedby" );
|
||||
}
|
||||
}
|
||||
|
||||
$.widget( "ui.tooltip", {
|
||||
version: "1.9.0",
|
||||
options: {
|
||||
content: function() {
|
||||
return $( this ).attr( "title" );
|
||||
},
|
||||
hide: true,
|
||||
items: "[title]",
|
||||
position: {
|
||||
my: "left+15 center",
|
||||
at: "right center",
|
||||
collision: "flipfit flipfit"
|
||||
},
|
||||
show: true,
|
||||
tooltipClass: null,
|
||||
track: false,
|
||||
|
||||
// callbacks
|
||||
close: null,
|
||||
open: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this._on({
|
||||
mouseover: "open",
|
||||
focusin: "open"
|
||||
});
|
||||
|
||||
// IDs of generated tooltips, needed for destroy
|
||||
this.tooltips = {};
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
var that = this;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this[ value ? "_disable" : "_enable" ]();
|
||||
this.options[ key ] = value;
|
||||
// disable element style changes
|
||||
return;
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "content" ) {
|
||||
$.each( this.tooltips, function( id, element ) {
|
||||
that._updateContent( element );
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_disable: function() {
|
||||
var that = this;
|
||||
|
||||
// close open tooltips
|
||||
$.each( this.tooltips, function( id, element ) {
|
||||
var event = $.Event( "blur" );
|
||||
event.target = event.currentTarget = element[0];
|
||||
that.close( event, true );
|
||||
});
|
||||
|
||||
// remove title attributes to prevent native tooltips
|
||||
this.element.find( this.options.items ).andSelf().each(function() {
|
||||
var element = $( this );
|
||||
if ( element.is( "[title]" ) ) {
|
||||
element
|
||||
.data( "ui-tooltip-title", element.attr( "title" ) )
|
||||
.attr( "title", "" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_enable: function() {
|
||||
// restore title attributes
|
||||
this.element.find( this.options.items ).andSelf().each(function() {
|
||||
var element = $( this );
|
||||
if ( element.data( "ui-tooltip-title" ) ) {
|
||||
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
open: function( event ) {
|
||||
var target = $( event ? event.target : this.element )
|
||||
.closest( this.options.items );
|
||||
|
||||
// No element to show a tooltip for
|
||||
if ( !target.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the tooltip is open and we're tracking then reposition the tooltip.
|
||||
// This makes sure that a tracking tooltip doesn't obscure a focused element
|
||||
// if the user was hovering when the element gained focused.
|
||||
if ( this.options.track && target.data( "ui-tooltip-id" ) ) {
|
||||
this._find( target ).position( $.extend({
|
||||
of: target
|
||||
}, this.options.position ) );
|
||||
// Stop tracking (#8622)
|
||||
this._off( this.document, "mousemove" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( target.attr( "title" ) ) {
|
||||
target.data( "ui-tooltip-title", target.attr( "title" ) );
|
||||
}
|
||||
|
||||
target.data( "tooltip-open", true );
|
||||
|
||||
this._updateContent( target, event );
|
||||
},
|
||||
|
||||
_updateContent: function( target, event ) {
|
||||
var content,
|
||||
contentOption = this.options.content,
|
||||
that = this;
|
||||
|
||||
if ( typeof contentOption === "string" ) {
|
||||
return this._open( event, target, contentOption );
|
||||
}
|
||||
|
||||
content = contentOption.call( target[0], function( response ) {
|
||||
// ignore async response if tooltip was closed already
|
||||
if ( !target.data( "tooltip-open" ) ) {
|
||||
return;
|
||||
}
|
||||
// IE may instantly serve a cached response for ajax requests
|
||||
// delay this call to _open so the other call to _open runs first
|
||||
that._delay(function() {
|
||||
this._open( event, target, response );
|
||||
});
|
||||
});
|
||||
if ( content ) {
|
||||
this._open( event, target, content );
|
||||
}
|
||||
},
|
||||
|
||||
_open: function( event, target, content ) {
|
||||
var tooltip, positionOption;
|
||||
if ( !content ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Content can be updated multiple times. If the tooltip already
|
||||
// exists, then just update the content and bail.
|
||||
tooltip = this._find( target );
|
||||
if ( tooltip.length ) {
|
||||
tooltip.find( ".ui-tooltip-content" ).html( content );
|
||||
return;
|
||||
}
|
||||
|
||||
// if we have a title, clear it to prevent the native tooltip
|
||||
// we have to check first to avoid defining a title if none exists
|
||||
// (we don't want to cause an element to start matching [title])
|
||||
//
|
||||
// We use removeAttr only for key events, to allow IE to export the correct
|
||||
// accessible attributes. For mouse events, set to empty string to avoid
|
||||
// native tooltip showing up (happens only when removing inside mouseover).
|
||||
if ( target.is( "[title]" ) ) {
|
||||
if ( event && event.type === "mouseover" ) {
|
||||
target.attr( "title", "" );
|
||||
} else {
|
||||
target.removeAttr( "title" );
|
||||
}
|
||||
}
|
||||
|
||||
tooltip = this._tooltip( target );
|
||||
addDescribedBy( target, tooltip.attr( "id" ) );
|
||||
tooltip.find( ".ui-tooltip-content" ).html( content );
|
||||
|
||||
function position( event ) {
|
||||
positionOption.of = event;
|
||||
tooltip.position( positionOption );
|
||||
}
|
||||
if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
|
||||
positionOption = $.extend( {}, this.options.position );
|
||||
this._on( this.document, {
|
||||
mousemove: position
|
||||
});
|
||||
// trigger once to override element-relative positioning
|
||||
position( event );
|
||||
} else {
|
||||
tooltip.position( $.extend({
|
||||
of: target
|
||||
}, this.options.position ) );
|
||||
}
|
||||
|
||||
tooltip.hide();
|
||||
|
||||
this._show( tooltip, this.options.show );
|
||||
|
||||
this._trigger( "open", event, { tooltip: tooltip } );
|
||||
|
||||
this._on( target, {
|
||||
mouseleave: "close",
|
||||
focusout: "close",
|
||||
keyup: function( event ) {
|
||||
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
|
||||
var fakeEvent = $.Event(event);
|
||||
fakeEvent.currentTarget = target[0];
|
||||
this.close( fakeEvent, true );
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
close: function( event, force ) {
|
||||
var that = this,
|
||||
target = $( event ? event.currentTarget : this.element ),
|
||||
tooltip = this._find( target );
|
||||
|
||||
// disabling closes the tooltip, so we need to track when we're closing
|
||||
// to avoid an infinite loop in case the tooltip becomes disabled on close
|
||||
if ( this.closing ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't close if the element has focus
|
||||
// this prevents the tooltip from closing if you hover while focused
|
||||
//
|
||||
// we have to check the event type because tabbing out of the document
|
||||
// may leave the element as the activeElement
|
||||
if ( !force && event && event.type !== "focusout" &&
|
||||
this.document[0].activeElement === target[0] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// only set title if we had one before (see comment in _open())
|
||||
if ( target.data( "ui-tooltip-title" ) ) {
|
||||
target.attr( "title", target.data( "ui-tooltip-title" ) );
|
||||
}
|
||||
|
||||
removeDescribedBy( target );
|
||||
|
||||
tooltip.stop( true );
|
||||
this._hide( tooltip, this.options.hide, function() {
|
||||
$( this ).remove();
|
||||
delete that.tooltips[ this.id ];
|
||||
});
|
||||
|
||||
target.removeData( "tooltip-open" );
|
||||
this._off( target, "mouseleave focusout keyup" );
|
||||
this._off( this.document, "mousemove" );
|
||||
|
||||
this.closing = true;
|
||||
this._trigger( "close", event, { tooltip: tooltip } );
|
||||
this.closing = false;
|
||||
},
|
||||
|
||||
_tooltip: function( element ) {
|
||||
var id = "ui-tooltip-" + increments++,
|
||||
tooltip = $( "<div>" )
|
||||
.attr({
|
||||
id: id,
|
||||
role: "tooltip"
|
||||
})
|
||||
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
|
||||
( this.options.tooltipClass || "" ) );
|
||||
$( "<div>" )
|
||||
.addClass( "ui-tooltip-content" )
|
||||
.appendTo( tooltip );
|
||||
tooltip.appendTo( this.document[0].body );
|
||||
if ( $.fn.bgiframe ) {
|
||||
tooltip.bgiframe();
|
||||
}
|
||||
this.tooltips[ id ] = element;
|
||||
return tooltip;
|
||||
},
|
||||
|
||||
_find: function( target ) {
|
||||
var id = target.data( "ui-tooltip-id" );
|
||||
return id ? $( "#" + id ) : $();
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
var that = this;
|
||||
|
||||
// close open tooltips
|
||||
$.each( this.tooltips, function( id, element ) {
|
||||
// Delegate to close method to handle common cleanup
|
||||
var event = $.Event( "blur" );
|
||||
event.target = event.currentTarget = element[0];
|
||||
that.close( event, true );
|
||||
|
||||
// Remove immediately; destroying an open tooltip doesn't use the
|
||||
// hide animation
|
||||
$( "#" + id ).remove();
|
||||
|
||||
// Restore the title
|
||||
if ( element.data( "ui-tooltip-title" ) ) {
|
||||
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
||||
element.removeData( "ui-tooltip-title" );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}( jQuery ) );
|
||||
Reference in New Issue
Block a user