Jquery-Ui-1 8 24
Jquery-Ui-1 8 24
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* jQuery UI; Copyright (c) 2012 Paul Bakaus; http://opensource.org/licenses/MIT
*
* Includes jQuery Easing v1.3; Copyright 2008 George McGinley Smith;
http://opensource.org/licenses/BSD-3-Clause
*
* NUGET: END LICENSE TEXT */
/*! jQuery UI - v1.8.24 - 2012-09-28
* https://github.com/jquery/jquery-ui
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js,
jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js,
jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js,
jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js,
jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js,
jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js,
jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js,
jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js,
jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js,
jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js,
jquery.ui.tabs.js
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT */
(function( $, undefined ) {
$.extend( $.ui, {
version: "1.8.24",
keyCode: {
ALT: 18,
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
COMMAND: 91,
COMMAND_LEFT: 91, // COMMAND
COMMAND_RIGHT: 93,
CONTROL: 17,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
INSERT: 45,
LEFT: 37,
MENU: 93, // COMMAND_RIGHT
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SHIFT: 16,
SPACE: 32,
TAB: 9,
UP: 38,
WINDOWS: 91 // COMMAND
}
});
// plugins
$.fn.extend({
propAttr: $.fn.prop || $.fn.attr,
_focus: $.fn.focus,
focus: function( delay, fn ) {
return typeof delay === "number" ?
this.each(function() {
var elem = this;
setTimeout(function() {
$( elem ).focus();
if ( fn ) {
fn.call( elem );
}
}, delay );
}) :
this._focus.apply( this, arguments );
},
scrollParent: function() {
var scrollParent;
if (($.browser.msie && (/(static|
relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position')))
{
scrollParent = this.parents().filter(function() {
return (/(relative|absolute|
fixed)/).test($.curCSS(this,'position',1)) && (/(auto|
scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+
$.curCSS(this,'overflow-x',1));
}).eq(0);
} else {
scrollParent = this.parents().filter(function() {
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+
$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
}).eq(0);
}
if ( this.length ) {
var elem = $( this[ 0 ] ), position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-
index is ignored by the browser
// This makes behavior of this function consistent across
browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" ||
position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an
explicit value of 0
// <div style="z-index: -10;"><div style="z-index:
0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
}
return 0;
},
disableSelection: function() {
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown"
) +
".ui-disableSelection", function( event ) {
event.preventDefault();
});
},
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
}
});
return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};
return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) +
"px" );
});
};
});
}
// selectors
function focusable( element, isTabIndexNotNaN ) {
var nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
var map = element.parentNode,
mapName = map.name,
img;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !==
"map" ) {
return false;
}
img = $( "img[usemap=#" + mapName + "]" )[0];
return !!img && visible( img );
}
return ( /input|select|textarea|button|object/.test( nodeName )
? !element.disabled
: "a" == nodeName
? element.href || isTabIndexNotNaN
: isTabIndexNotNaN)
// the element and all of its ancestors must be visible
&& visible( element );
}
// support
$(function() {
var body = document.body,
div = body.appendChild( div = document.createElement( "div" ) );
$.extend( div.style, {
minHeight: "100px",
height: "auto",
padding: 0,
borderWidth: 0
});
// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
if ( !$.curCSS ) {
$.curCSS = $.css;
}
// deprecated
$.extend( $.ui, {
// $.ui.plugin is deprecated. Use the proxy pattern instead.
plugin: {
add: function( module, option, set ) {
var proto = $.ui[ module ].prototype;
for ( var i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args ) {
var set = instance.plugins[ name ];
if ( !set || !instance.element[ 0 ].parentNode ) {
return;
}
//If overflow is hidden, the element might have extra content, but the
user wants to hide it
if ( $( el ).css( "overflow" ) === "hidden") {
return false;
}
// these are odd functions, fix the API or move into individual plugins
isOverAxis: function( x, reference, size ) {
//Determines when x coordinate is over "b" element axis
return ( x > reference ) && ( x < ( reference + size ) );
},
isOver: function( y, x, top, left, height, width ) {
//Determines when x, y coordinates is over "b" element
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left,
width );
}
});
})( jQuery );
(function( $, undefined ) {
// jQuery 1.4+
if ( $.cleanData ) {
var _cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}
_cleanData( elems );
};
} else {
var _remove = $.fn.remove;
$.fn.remove = function( selector, keepData ) {
return this.each(function() {
if ( !keepData ) {
if ( !selector || $.filter( selector, [ this ] ).length ) {
$( "*", this ).add( [ this ] ).each(function() {
try {
$( this ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
});
}
}
return _remove.call( $(this), selector, keepData );
});
};
}
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
if ( isMethodCall ) {
this.each(function() {
var instance = $.data( this, name ),
methodValue = instance &&
$.isFunction( instance[options] ) ?
instance[ options ].apply( instance, args ) :
instance;
// TODO: add this back in 1.9 and use $.error() (see #5972)
// if ( !instance ) {
// throw "cannot call methods on " + name + " prior to
initialization; " +
// "attempted to call method '" + options + "'";
// }
// if ( !$.isFunction( instance[options] ) ) {
// throw "no such method '" + options + "' for " + name
+ " widget instance";
// }
// var methodValue = instance[ options ].apply( instance, args
);
if ( methodValue !== instance && methodValue !==
undefined ) {
returnValue = methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, name );
if ( instance ) {
instance.option( options || {} )._init();
} else {
$.data( this, name, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
options: {
disabled: false
},
_createWidget: function( options, element ) {
// $.widget.bridge stores the plugin instance, but we do it anyway
// so that it's stored even before the _create function runs
$.data( element, this.widgetName, this );
this.element = $( element );
this.options = $.extend( true, {},
this.options,
this._getCreateOptions(),
options );
this._create();
this._trigger( "create" );
this._init();
},
_getCreateOptions: function() {
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName
];
},
_create: function() {},
_init: function() {},
destroy: function() {
this.element
.unbind( "." + this.widgetName )
.removeData( this.widgetName );
this.widget()
.unbind( "." + this.widgetName )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetBaseClass + "-disabled " +
"ui-state-disabled" );
},
widget: function() {
return this.element;
},
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.extend( {}, this.options );
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var self = this;
$.each( options, function( key, value ) {
self._setOption( key, value );
});
return this;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
return this;
},
enable: function() {
return this._setOption( "disabled", false );
},
disable: function() {
return this._setOption( "disabled", true );
},
})( jQuery );
(function( $, undefined ) {
$.widget("ui.mouse", {
options: {
cancel: ':input,option',
distance: 1,
delay: 0
},
_mouseInit: function() {
var self = this;
this.element
.bind('mousedown.'+this.widgetName, function(event) {
return self._mouseDown(event);
})
.bind('click.'+this.widgetName, function(event) {
if (true === $.data(event.target, self.widgetName +
'.preventClickEvent')) {
$.removeData(event.target, self.widgetName +
'.preventClickEvent');
event.stopImmediatePropagation();
return false;
}
});
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);
if ( this._mouseMoveDelegate ) {
$(document)
.unbind('mousemove.'+this.widgetName,
this._mouseMoveDelegate)
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
}
},
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
if( mouseHandled ) { return };
this._mouseDownEvent = event;
this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
self.mouseDelayMet = true;
}, this.options.delay);
}
event.preventDefault();
mouseHandled = true;
return true;
},
_mouseMove: function(event) {
// IE mouseup check - mouseup happened when mouse was out of window
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
return this._mouseUp(event);
}
if (this._mouseStarted) {
this._mouseDrag(event);
return event.preventDefault();
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event) !== false);
(this._mouseStarted ? this._mouseDrag(event) :
this._mouseUp(event));
}
return !this._mouseStarted;
},
_mouseUp: function(event) {
$(document)
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
if (this._mouseStarted) {
this._mouseStarted = false;
if (event.target == this._mouseDownEvent.target) {
$.data(event.target, this.widgetName + '.preventClickEvent',
true);
}
this._mouseStop(event);
}
return false;
},
_mouseDistanceMet: function(event) {
return (Math.max(
Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math.abs(this._mouseDownEvent.pageY - event.pageY)
) >= this.options.distance
);
},
_mouseDelayMet: function(event) {
return this.mouseDelayMet;
},
})(jQuery);
(function( $, undefined ) {
$.widget("ui.draggable", $.ui.mouse, {
widgetEventPrefix: "drag",
options: {
addClasses: true,
appendTo: "parent",
axis: false,
connectToSortable: false,
containment: false,
cursor: "auto",
cursorAt: false,
grid: false,
handle: false,
helper: "original",
iframeFix: false,
opacity: false,
refreshPositions: false,
revert: false,
revertDuration: 500,
scope: "default",
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
snap: false,
snapMode: "both",
snapTolerance: 20,
stack: false,
zIndex: false
},
_create: function() {
this._mouseInit();
},
destroy: function() {
if(!this.element.data('draggable')) return;
this.element
.removeData("draggable")
.unbind(".draggable")
.removeClass("ui-draggable"
+ " ui-draggable-dragging"
+ " ui-draggable-disabled");
this._mouseDestroy();
return this;
},
_mouseCapture: function(event) {
var o = this.options;
if ( o.iframeFix ) {
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function()
{
$('<div class="ui-draggable-iframeFix" style="background:
#fff;"></div>')
.css({
width: this.offsetWidth+"px", height:
this.offsetHeight+"px",
position: "absolute", opacity: "0.001", zIndex: 1000
})
.css($(this).offset())
.appendTo("body");
});
}
return true;
},
_mouseStart: function(event) {
var o = this.options;
this.helper.addClass("ui-draggable-dragging");
/*
* - Position generation -
* This block generates everything position related - it's the core of
draggables.
*/
//If the ddmanager is used for droppables, inform the manager that
dragging has started (see #5003)
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
return true;
},
return false;
},
_mouseStop: function(event) {
//If we are using droppables, inform the manager about the drop
var dropped = false;
if ($.ui.ddmanager && !this.options.dropBehaviour)
dropped = $.ui.ddmanager.drop(this, event);
return false;
},
_mouseUp: function(event) {
//Remove frame helpers
$("div.ui-draggable-iframeFix").each(function() {
this.parentNode.removeChild(this);
});
//If the ddmanager is used for droppables, inform the manager that
dragging has stopped (see #5003)
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
cancel: function() {
if(this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({});
} else {
this._clear();
}
return this;
},
_getHandle: function(event) {
return handle;
},
_createHelper: function(event) {
var o = this.options;
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0],
[event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') :
this.element);
if(!helper.parents('body').length)
helper.appendTo((o.appendTo == 'parent' ?
this.element[0].parentNode : o.appendTo));
return helper;
},
_adjustOffsetFromHelper: function(obj) {
if (typeof obj == 'string') {
obj = obj.split(' ');
}
if ($.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ('left' in obj) {
this.offset.click.left = obj.left + this.margins.left;
}
if ('right' in obj) {
this.offset.click.left = this.helperProportions.width - obj.right
+ this.margins.left;
}
if ('top' in obj) {
this.offset.click.top = obj.top + this.margins.top;
}
if ('bottom' in obj) {
this.offset.click.top = this.helperProportions.height -
obj.bottom + this.margins.top;
}
},
_getParentOffset: function() {
return {
top: po.top +
(parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
left: po.left +
(parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
};
},
_getRelativeOffset: function() {
if(this.cssPosition == "relative") {
var p = this.element.position();
return {
top: p.top - (parseInt(this.helper.css("top"),10) || 0) +
this.scrollParent.scrollTop(),
left: p.left - (parseInt(this.helper.css("left"),10) || 0)
+ this.scrollParent.scrollLeft()
};
} else {
return { top: 0, left: 0 };
}
},
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.element.css("marginLeft"),10) || 0),
top: (parseInt(this.element.css("marginTop"),10) || 0),
right: (parseInt(this.element.css("marginRight"),10) || 0),
bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var o = this.options;
if(o.containment == 'parent') o.containment =
this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window')
this.containment = [
o.containment == 'document' ? 0 : $(window).scrollLeft() -
this.offset.relative.left - this.offset.parent.left,
o.containment == 'document' ? 0 : $(window).scrollTop() -
this.offset.relative.top - this.offset.parent.top,
(o.containment == 'document' ? 0 : $(window).scrollLeft()) + $
(o.containment == 'document' ? document : window).width() -
this.helperProportions.width - this.margins.left,
(o.containment == 'document' ? 0 : $(window).scrollTop()) + ($
(o.containment == 'document' ? document : window).height() ||
document.body.parentNode.scrollHeight) - this.helperProportions.height -
this.margins.top
];
if(!(/^(document|window|parent)$/).test(o.containment) &&
o.containment.constructor != Array) {
var c = $(o.containment);
var ce = c[0]; if(!ce) return;
var co = c.offset();
var over = ($(ce).css("overflow") != 'hidden');
this.containment = [
(parseInt($(ce).css("borderLeftWidth"),10) || 0) +
(parseInt($(ce).css("paddingLeft"),10) || 0),
(parseInt($(ce).css("borderTopWidth"),10) || 0) +
(parseInt($(ce).css("paddingTop"),10) || 0),
(over ? Math.max(ce.scrollWidth,ce.offsetWidth) :
ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($
(ce).css("paddingRight"),10) || 0) - this.helperProportions.width -
this.margins.left - this.margins.right,
(over ? Math.max(ce.scrollHeight,ce.offsetHeight) :
ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($
(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height -
this.margins.top - this.margins.bottom
];
this.relative_container = c;
},
return {
top: (
pos.top
// The absolute mouse position
+ this.offset.relative.top * mod
// Only for relative positioned nodes: Relative
offset from element to offset parent
+ this.offset.parent.top * mod
// The offsetParent's offset without borders
(offset + border)
- ($.browser.safari && $.browser.version < 526 &&
this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -
this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) *
mod)
),
left: (
pos.left
// The absolute mouse position
+ this.offset.relative.left * mod
// Only for relative positioned nodes: Relative
offset from element to offset parent
+ this.offset.parent.left * mod
// The offsetParent's offset without borders
(offset + border)
- ($.browser.safari && $.browser.version < 526 &&
this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -
this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) *
mod)
)
};
},
_generatePosition: function(event) {
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
if(o.grid) {
//Check for grid elements set to 0 to prevent divide by 0
error causing invalid argument errors in IE (see ticket #6950)
var top = o.grid[1] ? this.originalPageY +
Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] :
this.originalPageY;
pageY = containment ? (!(top - this.offset.click.top <
containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top -
this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) :
top;
return {
top: (
pageY
// The absolute mouse position
- this.offset.click.top
// Click offset (relative to the element)
- this.offset.relative.top
// Only for relative positioned nodes: Relative
offset from element to offset parent
- this.offset.parent.top
// The offsetParent's offset without borders
(offset + border)
+ ($.browser.safari && $.browser.version < 526 &&
this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -
this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
),
left: (
pageX
// The absolute mouse position
- this.offset.click.left
// Click offset (relative to the element)
- this.offset.relative.left
// Only for relative positioned nodes: Relative
offset from element to offset parent
- this.offset.parent.left
// The offsetParent's offset without borders
(offset + border)
+ ($.browser.safari && $.browser.version < 526 &&
this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -
this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
)
};
},
_clear: function() {
this.helper.removeClass("ui-draggable-dragging");
if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval)
this.helper.remove();
//if($.ui.ddmanager) $.ui.ddmanager.current = null;
this.helper = null;
this.cancelHelperRemoval = false;
},
plugins: {},
_uiHash: function(event) {
return {
helper: this.helper,
position: this.position,
originalPosition: this.originalPosition,
offset: this.positionAbs
};
}
});
$.extend($.ui.draggable, {
version: "1.8.24"
});
$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) {
},
stop: function(event, 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"),
uiSortable = $.extend({}, ui, { item: inst.element });
$.each(inst.sortables, function() {
if(this.instance.isOver) {
this.instance.isOver = 0;
this.instance.options.helper =
this.instance.options._helper;
} else {
this.instance.cancelHelperRemoval = false; //Remove the
helper in the sortable instance
this.instance._trigger("deactivate", event, uiSortable);
}
});
},
drag: function(event, ui) {
$.each(inst.sortables, function(i) {
if(this.instance._intersectsWith(this.instance.containerCache)) {
this.instance.isOver = 1;
//Now we fake the start of dragging for the sortable
instance,
//by cloning the list group item, appending it to the
sortable and using it as inst.currentItem
//We can then fire the start event of the sortable
with our passed browser event, and our own helper (so it doesn't create a new one)
this.instance.currentItem = $
(self).clone().removeAttr('id').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]; };
event.target = this.instance.currentItem[0];
this.instance._mouseCapture(event, true);
this.instance._mouseStart(event, true, true);
inst._trigger("toSortable", event);
inst.dropped = this.instance.element; //draggable
revert needs that
//hack so receive/update callbacks work (mostly)
inst.currentItem = inst.element;
this.instance.fromOutside = inst;
} else {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true;
inst._trigger("fromSortable", event);
inst.dropped = false; //draggable revert needs that
}
};
});
}
});
$.ui.plugin.add("draggable", "cursor", {
start: function(event, ui) {
var t = $('body'), o = $(this).data('draggable').options;
if (t.css("cursor")) o._cursor = t.css("cursor");
t.css("cursor", o.cursor);
},
stop: function(event, ui) {
var o = $(this).data('draggable').options;
if (o._cursor) $('body').css("cursor", o._cursor);
}
});
$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data('draggable').options;
if(t.css("opacity")) o._opacity = t.css("opacity");
t.css('opacity', o.opacity);
},
stop: function(event, ui) {
var o = $(this).data('draggable').options;
if(o._opacity) $(ui.helper).css('opacity', o._opacity);
}
});
$.ui.plugin.add("draggable", "scroll", {
start: function(event, ui) {
var i = $(this).data("draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName !=
'HTML') i.overflowOffset = i.scrollParent.offset();
},
drag: function(event, ui) {
} else {
}
});
$.ui.plugin.add("draggable", "snap", {
start: function(event, ui) {
},
drag: function(event, ui) {
var l = inst.snapElements[i].left, r = l +
inst.snapElements[i].width,
t = inst.snapElements[i].top, b = t +
inst.snapElements[i].height;
if(o.snapMode != 'inner') {
var ts = Math.abs(t - y2) <= d;
var bs = Math.abs(b - y1) <= d;
var ls = Math.abs(l - x2) <= d;
var rs = Math.abs(r - x1) <= d;
if(ts) ui.position.top =
inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left:
0 }).top - inst.margins.top;
if(bs) ui.position.top =
inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
if(ls) ui.position.left =
inst._convertPositionTo("relative", { top: 0, left: l -
inst.helperProportions.width }).left - inst.margins.left;
if(rs) ui.position.left =
inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
}
if(o.snapMode != 'outer') {
var ts = Math.abs(t - y1) <= d;
var bs = Math.abs(b - y2) <= d;
var ls = Math.abs(l - x1) <= d;
var rs = Math.abs(r - x2) <= d;
if(ts) ui.position.top =
inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
if(bs) ui.position.top =
inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left:
0 }).top - inst.margins.top;
if(ls) ui.position.left =
inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
if(rs) ui.position.left =
inst._convertPositionTo("relative", { top: 0, left: r -
inst.helperProportions.width }).left - inst.margins.left;
}
};
}
});
$.ui.plugin.add("draggable", "stack", {
start: function(event, ui) {
var o = $(this).data("draggable").options;
}
});
$.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data("draggable").options;
if(t.css("zIndex")) o._zIndex = t.css("zIndex");
t.css('zIndex', o.zIndex);
},
stop: function(event, ui) {
var o = $(this).data("draggable").options;
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
}
});
})(jQuery);
(function( $, undefined ) {
$.widget("ui.droppable", {
widgetEventPrefix: "drop",
options: {
accept: '*',
activeClass: false,
addClasses: true,
greedy: false,
hoverClass: false,
scope: 'default',
tolerance: 'intersect'
},
_create: function() {
},
destroy: function() {
var drop = $.ui.ddmanager.droppables[this.options.scope];
for ( var i = 0; i < drop.length; i++ )
if ( drop[i] == this )
drop.splice(i, 1);
this.element
.removeClass("ui-droppable ui-droppable-disabled")
.removeData("droppable")
.unbind(".droppable");
return this;
},
if(key == 'accept') {
this.accept = $.isFunction(value) ? value : function(d) {
return d.is(value);
};
}
$.Widget.prototype._setOption.apply(this, arguments);
},
_activate: function(event) {
var draggable = $.ui.ddmanager.current;
if(this.options.activeClass)
this.element.addClass(this.options.activeClass);
(draggable && this._trigger('activate', event, this.ui(draggable)));
},
_deactivate: function(event) {
var draggable = $.ui.ddmanager.current;
if(this.options.activeClass)
this.element.removeClass(this.options.activeClass);
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
},
_over: function(event) {
if (this.accept.call(this.element[0],(draggable.currentItem ||
draggable.element))) {
if(this.options.hoverClass)
this.element.addClass(this.options.hoverClass);
this._trigger('over', event, this.ui(draggable));
}
},
_out: function(event) {
if (this.accept.call(this.element[0],(draggable.currentItem ||
draggable.element))) {
if(this.options.hoverClass)
this.element.removeClass(this.options.hoverClass);
this._trigger('out', event, this.ui(draggable));
}
},
_drop: function(event,custom) {
if(this.accept.call(this.element[0],(draggable.currentItem ||
draggable.element))) {
if(this.options.activeClass)
this.element.removeClass(this.options.activeClass);
if(this.options.hoverClass)
this.element.removeClass(this.options.hoverClass);
this._trigger('drop', event, this.ui(draggable));
return this.element;
}
return false;
},
ui: function(c) {
return {
draggable: (c.currentItem || c.element),
helper: c.helper,
position: c.position,
offset: c.positionAbs
};
}
});
$.extend($.ui.droppable, {
version: "1.8.24"
});
switch (toleranceMode) {
case 'fit':
return (l <= x1 && x2 <= r
&& t <= y1 && y2 <= b);
break;
case 'intersect':
return (l < x1 + (draggable.helperProportions.width / 2) // Right
Half
&& x2 - (draggable.helperProportions.width / 2) < r // Left
Half
&& t < y1 + (draggable.helperProportions.height / 2) //
Bottom Half
&& y2 - (draggable.helperProportions.height / 2) < b ); //
Top Half
break;
case 'pointer':
var draggableLeft = ((draggable.positionAbs ||
draggable.position.absolute).left + (draggable.clickOffset ||
draggable.offset.click).left),
draggableTop = ((draggable.positionAbs ||
draggable.position.absolute).top + (draggable.clickOffset ||
draggable.offset.click).top),
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l,
droppable.proportions.height, droppable.proportions.width);
return isOver;
break;
case 'touch':
return (
(y1 >= t && y1 <= b) || // Top edge touching
(y2 >= t && y2 <= b) || // Bottom edge touching
(y1 < t && y2 > b) // Surrounded vertically
) && (
(x1 >= l && x1 <= r) || // Left edge touching
(x2 >= l && x2 <= r) || // Right edge touching
(x1 < l && x2 > r) // Surrounded
horizontally
);
break;
default:
return false;
break;
}
};
/*
This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
current: null,
droppables: { 'default': [] },
prepareOffsets: function(t, event) {
if(m[i].options.disabled || (t && !
m[i].accept.call(m[i].element[0],(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 };
},
drop: function(draggable, event) {
if(!this.options) return;
if (!this.options.disabled && this.visible &&
$.ui.intersect(draggable, this, this.options.tolerance))
dropped = this._drop.call(this, event) || dropped;
});
return dropped;
},
dragStart: function( draggable, event ) {
//Listen for scrolling so that if the dragging causes scrolling the
position of the droppables can be recalculated (see #5003)
//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, event);
var parentInstance;
if (this.options.greedy) {
// find droppable parents with same scope
var scope = this.options.scope;
var parent =
this.element.parents(':data(droppable)').filter(function () {
return $.data(this, 'droppable').options.scope ===
scope;
});
if (parent.length) {
parentInstance = $.data(parent[0], 'droppable');
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
}
}
},
dragStop: function( draggable, event ) {
})(jQuery);
(function( $, undefined ) {
$.widget("ui.resizable", $.ui.mouse, {
widgetEventPrefix: "resize",
options: {
alsoResize: false,
animate: false,
animateDuration: "slow",
animateEasing: "swing",
aspectRatio: false,
autoHide: false,
containment: false,
ghost: false,
grid: false,
handles: "e,s,se",
helper: false,
maxHeight: null,
maxWidth: null,
minHeight: 10,
minWidth: 10,
zIndex: 1000
},
_create: function() {
$.extend(this, {
_aspectRatio: !!(o.aspectRatio),
aspectRatio: o.aspectRatio,
originalElement: this.element,
_proportionallyResizeElements: [],
_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-
resizable-helper' : null
});
//Create a wrapper element and set the wrapper to the new current
internal element
this.element.wrap(
$('<div class="ui-wrapper" style="overflow:
hidden;"></div>').css({
position: this.element.css('position'),
width: this.element.outerWidth(),
height: this.element.outerHeight(),
top: this.element.css('top'),
left: this.element.css('left')
})
);
this.elementIsWrapper = true;
this._proportionallyResizeElements.push(this.originalElement.css({ position:
'static', zoom: 1, display: 'block' }));
this._renderAxis = function(target) {
for(var i in this.handles) {
if(this.handles[i].constructor == String)
this.handles[i] = $(this.handles[i],
this.element).show();
target.css(padPos, padWrapper);
this._proportionallyResize();
}
};
},
destroy: function() {
this._mouseDestroy();
this.originalElement.css('resize', this.originalResizeStyle);
_destroy(this.originalElement);
return this;
},
_mouseCapture: function(event) {
var handle = false;
for (var i in this.handles) {
if ($(this.handles[i])[0] == event.target) {
handle = true;
}
}
_mouseStart: function(event) {
this.resizing = true;
this.documentScroll = { top: $(document).scrollTop(), left: $
(document).scrollLeft() };
this._renderProxy();
if (o.containment) {
curleft += $(o.containment).scrollLeft() || 0;
curtop += $(o.containment).scrollTop() || 0;
}
//Aspect Ratio
this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio :
((this.originalSize.width / this.originalSize.height) || 1);
el.addClass("ui-resizable-resizing");
this._propagate("start", event);
return true;
},
_mouseDrag: function(event) {
// Put this in the mouseDrag handler since the user can start pressing
shift while resizing
this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey)
data = this._updateRatio(data, event);
el.css({
top: this.position.top + "px", left: this.position.left + "px",
width: this.size.width + "px", height: this.size.height + "px"
});
this._updateCache(data);
return false;
},
_mouseStop: function(event) {
this.resizing = false;
var o = this.options, self = this;
if(this._helper) {
var pr = this._proportionallyResizeElements, ista = pr.length &&
(/textarea/i).test(pr[0].nodeName),
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO -
jump height */ ? 0 : self.sizeDiff.height,
soffsetw = ista ? 0 : self.sizeDiff.width;
if (!o.animate)
this.element.css($.extend(s, { top: top, left: left }));
self.helper.height(self.size.height);
self.helper.width(self.size.width);
if (this._helper && !o.animate) this._proportionallyResize();
}
$('body').css('cursor', 'auto');
this.element.removeClass("ui-resizable-resizing");
this._propagate("stop", event);
if (this._helper) this.helper.remove();
return false;
},
_updateVirtualBoundaries: function(forceAspectRatio) {
var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
b = {
minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
};
if(this._aspectRatio || forceAspectRatio) {
// We want to create an enclosing box whose aspect ration is the
requested one
// First, compute the "projected" size for each dimension based on the
aspect ratio and other dimension
pMinWidth = b.minHeight * this.aspectRatio;
pMinHeight = b.minWidth / this.aspectRatio;
pMaxWidth = b.maxHeight * this.aspectRatio;
pMaxHeight = b.maxWidth / this.aspectRatio;
_updateCache: function(data) {
var o = this.options;
this.offset = this.helper.offset();
if (isNumber(data.left)) this.position.left = data.left;
if (isNumber(data.top)) this.position.top = data.top;
if (isNumber(data.height)) this.size.height = data.height;
if (isNumber(data.width)) this.size.width = data.width;
},
if (a == 'sw') {
data.left = cpos.left + (csize.width - data.width);
data.top = null;
}
if (a == 'nw') {
data.top = cpos.top + (csize.height - data.height);
data.left = cpos.left + (csize.width - data.width);
}
return data;
},
return data;
},
_proportionallyResize: function() {
var o = this.options;
if (!this._proportionallyResizeElements.length) return;
var element = this.helper || this.element;
if (!this.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')];
prel.css({
height: (element.height() - this.borderDif[0] -
this.borderDif[2]) || 0,
width: (element.width() - this.borderDif[1] -
this.borderDif[3]) || 0
});
};
},
_renderProxy: function() {
if(this._helper) {
this.helper.addClass(this._helper).css({
width: this.element.outerWidth() + pxyoffset,
height: this.element.outerHeight() + pxyoffset,
position: 'absolute',
left: this.elementOffset.left - ie6offset +'px',
top: this.elementOffset.top - ie6offset +'px',
zIndex: ++o.zIndex //TODO: Don't modify option
});
this.helper
.appendTo("body")
.disableSelection();
} else {
this.helper = this.element;
}
},
_change: {
e: function(event, dx, dy) {
return { width: this.originalSize.width + dx };
},
w: function(event, dx, dy) {
var o = this.options, cs = this.originalSize, sp =
this.originalPosition;
return { left: sp.left + dx, width: cs.width - dx };
},
n: function(event, dx, dy) {
var o = this.options, cs = this.originalSize, sp =
this.originalPosition;
return { top: sp.top + dy, height: cs.height - dy };
},
s: function(event, dx, dy) {
return { height: this.originalSize.height + dy };
},
se: function(event, dx, dy) {
return $.extend(this._change.s.apply(this, arguments),
this._change.e.apply(this, [event, dx, dy]));
},
sw: function(event, dx, dy) {
return $.extend(this._change.s.apply(this, arguments),
this._change.w.apply(this, [event, dx, dy]));
},
ne: function(event, dx, dy) {
return $.extend(this._change.n.apply(this, arguments),
this._change.e.apply(this, [event, dx, dy]));
},
nw: function(event, dx, dy) {
return $.extend(this._change.n.apply(this, arguments),
this._change.w.apply(this, [event, dx, dy]));
}
},
plugins: {},
ui: function() {
return {
originalElement: this.originalElement,
element: this.element,
helper: this.helper,
position: this.position,
size: this.size,
originalSize: this.originalSize,
originalPosition: this.originalPosition
};
}
});
$.extend($.ui.resizable, {
version: "1.8.24"
});
/*
* Resizable Extensions
*/
$.ui.plugin.add("resizable", "alsoResize", {
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
},
el.css(style);
});
};
$.ui.plugin.add("resizable", "animate", {
self.element.animate(
$.extend(style, top && left ? { top: top, left: left } : {}), {
duration: o.animateDuration,
easing: o.animateEasing,
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)
};
}
}
);
}
});
$.ui.plugin.add("resizable", "containment", {
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,
width: $(document).width(), height: $(document).height() ||
document.body.parentNode.scrollHeight
};
}
self.containerOffset = element.offset();
self.containerPosition = element.position();
self.containerSize = { height: (element.innerHeight() - p[3]),
width: (element.innerWidth() - p[1]) };
self.parentData = {
element: ce, left: co.left, top: co.top, width: width,
height: height
};
}
},
self.offset.left = self.parentData.left+self.position.left;
self.offset.top = self.parentData.top+self.position.top;
}
});
$.ui.plugin.add("resizable", "ghost", {
self.ghost = self.originalElement.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);
},
});
$.ui.plugin.add("resizable", "grid", {
if (/^(se|s|e)$/.test(a)) {
self.size.width = os.width + ox;
self.size.height = os.height + oy;
}
else if (/^(ne)$/.test(a)) {
self.size.width = os.width + ox;
self.size.height = os.height + oy;
self.position.top = op.top - oy;
}
else if (/^(sw)$/.test(a)) {
self.size.width = os.width + ox;
self.size.height = os.height + oy;
self.position.left = op.left - ox;
}
else {
self.size.width = os.width + ox;
self.size.height = os.height + oy;
self.position.top = op.top - oy;
self.position.left = op.left - ox;
}
}
});
})(jQuery);
(function( $, undefined ) {
$.widget("ui.selectable", $.ui.mouse, {
options: {
appendTo: 'body',
autoRefresh: true,
distance: 0,
filter: '*',
tolerance: 'touch'
},
_create: function() {
var self = this;
this.element.addClass("ui-selectable");
this.dragged = false;
this.selectees = selectees.addClass("ui-selectee");
this._mouseInit();
destroy: function() {
this.selectees
.removeClass("ui-selectee")
.removeData("selectable-item");
this.element
.removeClass("ui-selectable ui-selectable-disabled")
.removeData("selectable")
.unbind(".selectable");
this._mouseDestroy();
return this;
},
_mouseStart: function(event) {
var self = this;
if (this.options.disabled)
return;
this._trigger("start", event);
$(options.appendTo).append(this.helper);
// position helper (lasso)
this.helper.css({
"left": event.clientX,
"top": event.clientY,
"width": 0,
"height": 0
});
if (options.autoRefresh) {
this.refresh();
}
this.selectees.filter('.ui-selected').each(function() {
var selectee = $.data(this, "selectable-item");
selectee.startselected = true;
if (!event.metaKey && !event.ctrlKey) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
selectee.$element.addClass('ui-unselecting');
selectee.unselecting = true;
// selectable UNSELECTING callback
self._trigger("unselecting", event, {
unselecting: selectee.element
});
}
});
$(event.target).parents().andSelf().each(function() {
var selectee = $.data(this, "selectable-item");
if (selectee) {
var doSelect = (!event.metaKey && !event.ctrlKey) || !
selectee.$element.hasClass('ui-selected');
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-
selected")
.addClass(doSelect ? "ui-selecting" : "ui-
unselecting");
selectee.unselecting = !doSelect;
selectee.selecting = doSelect;
selectee.selected = doSelect;
// selectable (UN)SELECTING callback
if (doSelect) {
self._trigger("selecting", event, {
selecting: selectee.element
});
} else {
self._trigger("unselecting", event, {
unselecting: selectee.element
});
}
return false;
}
});
},
_mouseDrag: function(event) {
var self = this;
this.dragged = true;
if (this.options.disabled)
return;
this.selectees.each(function() {
var selectee = $.data(this, "selectable-item");
//prevent helper from being selected if appendTo: selectable
if (!selectee || selectee.element == self.element[0])
return;
var hit = false;
if (options.tolerance == 'touch') {
hit = ( !(selectee.left > x2 || selectee.right < x1 ||
selectee.top > y2 || selectee.bottom < y1) );
} else if (options.tolerance == 'fit') {
hit = (selectee.left > x1 && selectee.right < x2 &&
selectee.top > y1 && selectee.bottom < y2);
}
if (hit) {
// SELECT
if (selectee.selected) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
}
if (selectee.unselecting) {
selectee.$element.removeClass('ui-unselecting');
selectee.unselecting = false;
}
if (!selectee.selecting) {
selectee.$element.addClass('ui-selecting');
selectee.selecting = true;
// selectable SELECTING callback
self._trigger("selecting", event, {
selecting: selectee.element
});
}
} else {
// UNSELECT
if (selectee.selecting) {
if ((event.metaKey || event.ctrlKey) &&
selectee.startselected) {
selectee.$element.removeClass('ui-selecting');
selectee.selecting = false;
selectee.$element.addClass('ui-selected');
selectee.selected = true;
} else {
selectee.$element.removeClass('ui-selecting');
selectee.selecting = false;
if (selectee.startselected) {
selectee.$element.addClass('ui-
unselecting');
selectee.unselecting = true;
}
// selectable UNSELECTING callback
self._trigger("unselecting", event, {
unselecting: selectee.element
});
}
}
if (selectee.selected) {
if (!event.metaKey && !event.ctrlKey && !
selectee.startselected) {
selectee.$element.removeClass('ui-selected');
selectee.selected = false;
selectee.$element.addClass('ui-unselecting');
selectee.unselecting = true;
// selectable UNSELECTING callback
self._trigger("unselecting", event, {
unselecting: selectee.element
});
}
}
}
});
return false;
},
_mouseStop: function(event) {
var self = this;
this.dragged = false;
$('.ui-unselecting', this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass('ui-unselecting');
selectee.unselecting = false;
selectee.startselected = false;
self._trigger("unselected", event, {
unselected: selectee.element
});
});
$('.ui-selecting', this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass('ui-selecting').addClass('ui-
selected');
selectee.selecting = false;
selectee.selected = true;
selectee.startselected = true;
self._trigger("selected", event, {
selected: selectee.element
});
});
this._trigger("stop", event);
this.helper.remove();
return false;
}
});
$.extend($.ui.selectable, {
version: "1.8.24"
});
})(jQuery);
(function( $, undefined ) {
$.widget("ui.sortable", $.ui.mouse, {
widgetEventPrefix: "sort",
ready: false,
options: {
appendTo: "parent",
axis: false,
connectWith: false,
containment: false,
cursor: 'auto',
cursorAt: false,
dropOnEmpty: true,
forcePlaceholderSize: false,
forceHelperSize: false,
grid: false,
handle: false,
helper: "original",
items: '> *',
opacity: false,
placeholder: false,
revert: false,
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
scope: "default",
tolerance: "intersect",
zIndex: 1000
},
_create: function() {
var o = this.options;
this.containerCache = {};
this.element.addClass("ui-sortable");
//We're ready to go
this.ready = true
},
destroy: function() {
$.Widget.prototype.destroy.call( this );
this.element
.removeClass("ui-sortable ui-sortable-disabled");
this._mouseDestroy();
return this;
},
this.widget()
[ value ? "addClass" : "removeClass"]( "ui-sortable-
disabled" );
} else {
// Don't call widget base _setOption for disable as it adds ui-
state-disabled class
$.Widget.prototype._setOption.apply(this, arguments);
}
},
if (this.reverting) {
return false;
}
//Find out if the clicked node (or one of its parents) is a actual item
in this.items
var currentItem = null, self = this, nodes = $
(event.target).parents().each(function() {
if($.data(this, that.widgetName + '-item') == self) {
currentItem = $(this);
return false;
}
});
if($.data(event.target, that.widgetName + '-item') == self) currentItem
= $(event.target);
$(this.options.handle,
currentItem).find("*").andSelf().each(function() { if(this == event.target)
validHandle = true; });
if(!validHandle) return false;
}
this.currentItem = currentItem;
this._removeCurrentsFromItems();
return true;
},
/*
* - Position generation -
* This block generates everything position related - it's the core of
draggables.
*/
$.extend(this.offset, {
click: { //Where the click happened, relative to the element
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
parent: this._getParentOffset(),
relative: this._getRelativeOffset() //This is a relative to
absolute position minus the actual position calculation - only used for relative
positioned helper
});
// Only after we got the offset, we can change the helper's position to
absolute
// TODO: Still need to figure out a way to make relative sorting
possible
this.helper.css("position", "absolute");
this.cssPosition = this.helper.css("position");
//Prepare scrolling
if(this.scrollParent[0] != document && this.scrollParent[0].tagName !=
'HTML')
this.overflowOffset = this.scrollParent.offset();
//Call callbacks
this._trigger("start", event, this._uiHash());
this.dragging = true;
this.helper.addClass("ui-sortable-helper");
this._mouseDrag(event); //Execute the drag once - this causes the
helper not to be visible before getting its correct position
return true;
},
_mouseDrag: function(event) {
if (!this.lastPositionAbs) {
this.lastPositionAbs = this.positionAbs;
}
//Do scrolling
if(this.options.scroll) {
var o = this.options, scrolled = false;
if(this.scrollParent[0] != document &&
this.scrollParent[0].tagName != 'HTML') {
if((this.overflowOffset.top +
this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled =
this.scrollParent[0].scrollTop + o.scrollSpeed;
else if(event.pageY - this.overflowOffset.top <
o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled =
this.scrollParent[0].scrollTop - o.scrollSpeed;
if((this.overflowOffset.left +
this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled =
this.scrollParent[0].scrollLeft + o.scrollSpeed;
else if(event.pageX - this.overflowOffset.left <
o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled =
this.scrollParent[0].scrollLeft - o.scrollSpeed;
} else {
//Rearrange
for (var i = this.items.length - 1; i >= 0; i--) {
if (this.options.tolerance == "pointer" ||
this._intersectsWithSides(item)) {
this._rearrange(event, item);
} else {
break;
}
//Call callbacks
this._trigger('sort', event, this._uiHash());
this.lastPositionAbs = this.positionAbs;
return false;
},
if(!event) return;
//If we are using droppables, inform the manager about the drop
if ($.ui.ddmanager && !this.options.dropBehaviour)
$.ui.ddmanager.drop(this, event);
if(this.options.revert) {
var self = this;
var cur = self.placeholder.offset();
self.reverting = true;
$(this.helper).animate({
left: cur.left - this.offset.parent.left -
self.margins.left + (this.offsetParent[0] == document.body ? 0 :
this.offsetParent[0].scrollLeft),
top: cur.top - this.offset.parent.top - self.margins.top +
(this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
}, parseInt(this.options.revert, 10) || 500, function() {
self._clear(event);
});
} else {
this._clear(event, noPropagation);
}
return false;
},
cancel: function() {
if(this.dragging) {
if(this.options.helper == "original")
this.currentItem.css(this._storedCSS).removeClass("ui-
sortable-helper");
else
this.currentItem.show();
if (this.placeholder) {
//$(this.placeholder[0]).remove(); would have been the jQuery way
- unfortunately, it unbinds ALL events from the original node!
if(this.placeholder[0].parentNode)
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
if(this.options.helper != "original" && this.helper &&
this.helper[0].parentNode) this.helper.remove();
$.extend(this, {
helper: null,
dragging: false,
reverting: false,
_noFinalSort: null
});
if(this.domPosition.prev) {
$(this.domPosition.prev).after(this.currentItem);
} else {
$(this.domPosition.parent).prepend(this.currentItem);
}
}
return this;
},
serialize: function(o) {
$(items).each(function() {
var res = ($(o.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 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,
t = item.top,
b = t + item.height;
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 +
dxClick) > l && (x1 + dxClick) < r;
}
},
_intersectsWithPointer: function(item) {
if (!isOverElement)
return false;
return this.floating ?
( ((horizontalDirection && horizontalDirection == "right") ||
verticalDirection == "down") ? 2 : 1 )
: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
},
_intersectsWithSides: function(item) {
},
_getDragVerticalDirection: function() {
var delta = this.positionAbs.top - this.lastPositionAbs.top;
return delta != 0 && (delta > 0 ? "down" : "up");
},
_getDragHorizontalDirection: function() {
var delta = this.positionAbs.left - this.lastPositionAbs.left;
return delta != 0 && (delta > 0 ? "right" : "left");
},
refresh: function(event) {
this._refreshItems(event);
this.refreshPositions();
return this;
},
_connectWith: function() {
var options = this.options;
return options.connectWith.constructor == String
? [options.connectWith]
: options.connectWith;
},
_getItemsAsjQuery: function(connected) {
var self = this;
var items = [];
var queries = [];
var connectWith = this._connectWith();
queries.push([$.isFunction(inst.options.items) ?
inst.options.items.call(inst.element) : $(inst.options.items,
inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
}
};
};
}
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").not('.ui-sortable-placeholder'), this]);
return $(items);
},
_removeCurrentsFromItems: function() {
};
},
_refreshItems: function(event) {
this.items = [];
this.containers = [this];
var items = this.items;
var self = this;
var queries = [[$.isFunction(this.options.items) ?
this.options.items.call(this.element[0], event, { item: this.currentItem }) : $
(this.options.items, this.element), this]];
var connectWith = this._connectWith();
queries.push([$.isFunction(inst.options.items) ?
inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $
(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
};
};
}
items.push({
item: item,
instance: targetData,
width: 0, height: 0,
left: 0, top: 0
});
};
};
},
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
if(this.offsetParent && this.helper) {
this.offset.parent = this._getParentOffset();
}
if (!fast) {
item.width = t.outerWidth();
item.height = t.outerHeight();
}
var p = t.offset();
item.left = p.left;
item.top = p.top;
};
return this;
},
_createPlaceholder: function(that) {
var el = $
(document.createElement(self.currentItem[0].nodeName))
.addClass(className ||
self.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper")[0];
if(!className)
el.style.visibility = "hidden";
return el;
},
update: function(container, p) {
//Update the size of the placeholder (TODO: Logic to fuzzy, see line
316/317)
o.placeholder.update(self, self.placeholder);
},
_contactContainers: function(event) {
if(this._intersectsWith(this.containers[i].containerCache)) {
innermostContainer = this.containers[i];
innermostIndex = i;
} else {
// container doesn't intersect. trigger "out" event if
necessary
if(this.containers[i].containerCache.over) {
this.containers[i]._trigger("out", event,
this._uiHash(this));
this.containers[i].containerCache.over = 0;
}
}
// move the item into the container if it's not there already
if(this.containers.length === 1) {
this.containers[innermostIndex]._trigger("over", event,
this._uiHash(this));
this.containers[innermostIndex].containerCache.over = 1;
} else if(this.currentContainer != this.containers[innermostIndex]) {
//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[innermostIndex].floating ? 'left' : 'top'];
for (var j = this.items.length - 1; j >= 0; j--) {
if(!
$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0]))
continue;
var cur = this.containers[innermostIndex].floating ?
this.items[j].item.offset().left : this.items[j].item.offset().top;
if(Math.abs(cur - base) < dist) {
dist = Math.abs(cur - base); itemWithLeastDistance =
this.items[j];
this.direction = (cur - base > 0) ? 'down' : 'up';
}
}
this.currentContainer = this.containers[innermostIndex];
itemWithLeastDistance ? this._rearrange(event,
itemWithLeastDistance, null, true) : this._rearrange(event, null,
this.containers[innermostIndex].element, true);
this._trigger("change", event, this._uiHash());
this.containers[innermostIndex]._trigger("change", event,
this._uiHash(this));
this.containers[innermostIndex]._trigger("over", event,
this._uiHash(this));
this.containers[innermostIndex].containerCache.over = 1;
}
},
_createHelper: function(event) {
var o = this.options;
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0],
[event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() :
this.currentItem);
if(helper[0] == this.currentItem[0])
this._storedCSS = { width: this.currentItem[0].style.width,
height: this.currentItem[0].style.height, position:
this.currentItem.css("position"), top: this.currentItem.css("top"), left:
this.currentItem.css("left") };
return helper;
},
_adjustOffsetFromHelper: function(obj) {
if (typeof obj == 'string') {
obj = obj.split(' ');
}
if ($.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ('left' in obj) {
this.offset.click.left = obj.left + this.margins.left;
}
if ('right' in obj) {
this.offset.click.left = this.helperProportions.width - obj.right
+ this.margins.left;
}
if ('top' in obj) {
this.offset.click.top = obj.top + this.margins.top;
}
if ('bottom' in obj) {
this.offset.click.top = this.helperProportions.height -
obj.bottom + this.margins.top;
}
},
_getParentOffset: function() {
return {
top: po.top +
(parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
left: po.left +
(parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
};
},
_getRelativeOffset: function() {
if(this.cssPosition == "relative") {
var p = this.currentItem.position();
return {
top: p.top - (parseInt(this.helper.css("top"),10) || 0) +
this.scrollParent.scrollTop(),
left: p.left - (parseInt(this.helper.css("left"),10) || 0)
+ this.scrollParent.scrollLeft()
};
} else {
return { top: 0, left: 0 };
}
},
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var o = this.options;
if(o.containment == 'parent') o.containment =
this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window')
this.containment = [
0 - this.offset.relative.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top,
$(o.containment == 'document' ? document : window).width() -
this.helperProportions.width - this.margins.left,
($(o.containment == 'document' ? document : window).height() ||
document.body.parentNode.scrollHeight) - this.helperProportions.height -
this.margins.top
];
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)
+ (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) +
(parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) :
ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($
(ce).css("paddingRight"),10) || 0) - this.helperProportions.width -
this.margins.left,
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) :
ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($
(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height -
this.margins.top
];
}
},
return {
top: (
pos.top
// The absolute mouse position
+ this.offset.relative.top * mod
// Only for relative positioned nodes: Relative
offset from element to offset parent
+ this.offset.parent.top * mod
// The offsetParent's offset without borders
(offset + border)
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 :
( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode
? 0 : scroll.scrollTop() ) ) * mod)
),
left: (
pos.left
// The absolute mouse position
+ this.offset.relative.left * mod
// Only for relative positioned nodes: Relative
offset from element to offset parent
+ this.offset.parent.left * mod
// The offsetParent's offset without borders
(offset + border)
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 :
( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() :
scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
)
};
},
_generatePosition: function(event) {
// This is another very weird special case that only happens for
relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset
parent
// we have to refresh the relative offset during the scroll so there
are no jumps
if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document
&& this.scrollParent[0] != this.offsetParent[0])) {
this.offset.relative = this._getRelativeOffset();
}
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
if(this.containment) {
if(event.pageX - this.offset.click.left <
this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
if(event.pageY - this.offset.click.top <
this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
if(event.pageX - this.offset.click.left >
this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
if(event.pageY - this.offset.click.top >
this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
}
if(o.grid) {
var top = this.originalPageY + Math.round((pageY -
this.originalPageY) / o.grid[1]) * o.grid[1];
pageY = this.containment ? (!(top - this.offset.click.top <
this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top :
(!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top +
o.grid[1])) : top;
return {
top: (
pageY
// The absolute mouse position
- this.offset.click.top
// Click offset (relative to the element)
- this.offset.relative.top
// Only for relative positioned nodes: Relative
offset from element to offset parent
- this.offset.parent.top
// The offsetParent's offset without borders
(offset + border)
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 :
( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode
? 0 : scroll.scrollTop() ) ))
),
left: (
pageX
// The absolute mouse position
- this.offset.click.left
// Click offset (relative to the element)
- this.offset.relative.left
// Only for relative positioned nodes: Relative
offset from element to offset parent
- this.offset.parent.left
// The offsetParent's offset without borders
(offset + border)
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 :
( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() :
scrollIsRootNode ? 0 : scroll.scrollLeft() ))
)
};
},
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));
window.setTimeout(function() {
if(counter == self.counter) self.refreshPositions(!
hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
},0);
},
this.reverting = false;
// We delay all events that have to be triggered to after the point
where the placeholder has been removed and
// everything else normalized again
var delayedTriggers = [], self = this;
if(this.helper[0] == this.currentItem[0]) {
for(var i in this._storedCSS) {
if(this._storedCSS[i] == 'auto' || this._storedCSS[i] ==
'static') this._storedCSS[i] = '';
}
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-
helper");
} else {
this.currentItem.show();
}
this.dragging = false;
if(this.cancelHelperRemoval) {
if(!noPropagation) {
this._trigger("beforeStop", event, this._uiHash());
for (var i=0; i < delayedTriggers.length; i++)
{ delayedTriggers[i].call(this, event); }; //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
}
this.fromOutside = false;
return false;
}
if(!noPropagation) {
for (var i=0; i < delayedTriggers.length; i++)
{ delayedTriggers[i].call(this, event); }; //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
}
this.fromOutside = false;
return true;
},
_trigger: function() {
if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
this.cancel();
}
},
_uiHash: function(inst) {
var self = inst || this;
return {
helper: self.helper,
placeholder: self.placeholder || $([]),
position: self.position,
originalPosition: self.originalPosition,
offset: self.positionAbs,
item: self.currentItem,
sender: inst ? inst.element : null
};
}
});
$.extend($.ui.sortable, {
version: "1.8.24"
});
})(jQuery);
$.effects = {};
/******************************************************************************/
/****************************** COLOR ANIMATIONS ******************************/
/******************************************************************************/
fx.elem.style[attr] = 'rgb(' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) +
fx.start[0], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) +
fx.start[1], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) +
fx.start[2], 10), 255), 0) + ')';
};
});
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
do {
// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS =
css, 1.8+ only has css
color = ($.curCSS || $.css)(elem, attr);
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0],
transparent: [255,255,255]
};
/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
function getElementStyles() {
var style = document.defaultView
? document.defaultView.getComputedStyle(this, null)
: this.currentStyle,
newStyle = {},
key,
camelCase;
return newStyle;
}
function filterStyles(styles) {
var name, value;
for (name in styles) {
value = styles[name];
if (
// ignore null and undefined values
value == null ||
// ignore functions (when does this occur?)
$.isFunction(value) ||
// shorthand styles that need to be expanded
name in shorthandStyles ||
// ignore scrollbars (break in IE)
(/scrollbar/).test(name) ||
return styles;
}
return diff;
}
return this.queue(function() {
var that = $(this),
originalStyleAttr = that.attr('style') || ' ',
originalStyle = filterStyles(getElementStyles.call(this)),
newStyle,
className = that.attr('class') || "";
that.animate(styleDifference(originalStyle, newStyle), {
queue: false,
duration: duration,
easing: easing,
complete: function() {
$.each(classAnimationActions, function(i, action) {
if (value[action]) { that[action + 'Class']
(value[action]); }
});
// work around bug in IE by clearing the cssText before
setting it
if (typeof that.attr('style') == 'object') {
that.attr('style').cssText = '';
that.attr('style').cssText = originalStyleAttr;
} else {
that.attr('style', originalStyleAttr);
}
if (callback) { callback.apply(this, arguments); }
$.dequeue( this );
}
});
});
};
$.fn.extend({
_addClass: $.fn.addClass,
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add:
classNames },speed,easing,callback]) : this._addClass(classNames);
},
_removeClass: $.fn.removeClass,
removeClass: function(classNames,speed,easing,callback) {
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames
},speed,easing,callback]) : this._removeClass(classNames);
},
_toggleClass: $.fn.toggleClass,
toggleClass: function(classNames, force, speed, easing, callback) {
if ( typeof force == "boolean" || force === undefined ) {
if ( !speed ) {
// without speed parameter;
return this._toggleClass(classNames, force);
} else {
return $.effects.animateClass.apply(this, [(force?
{add:classNames}:{remove:classNames}),speed,easing,callback]);
}
} else {
// without switch parameter;
return $.effects.animateClass.apply(this, [{ toggle:
classNames },force,speed,easing]);
}
},
switchClass: function(remove,add,speed,easing,callback) {
return $.effects.animateClass.apply(this, [{ add: add, remove:
remove },speed,easing,callback]);
}
});
/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
$.extend($.effects, {
version: "1.8.24",
// support: Firefox
// Firefox incorrectly exposes anonymous content
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try {
active.id;
} catch( e ) {
active = document.body;
}
element.wrap( wrapper );
return wrapper.css(props).show();
},
removeWrapper: function(element) {
var parent,
active = document.activeElement;
if (element.parent().is('.ui-effects-wrapper')) {
parent = element.parent().replaceWith(element);
// Fixes #7595 - Elements lose focus when wrapped.
if ( element[ 0 ] === active || $.contains( element[ 0 ],
active ) ) {
$( active ).focus();
}
return parent;
}
return element;
},
return false;
}
$.fn.extend({
effect: function(effect, options, speed, callback) {
var args = _normalizeArguments.apply(this, arguments),
// TODO: make effects take actual parameters instead of a hash
args2 = {
options: args[1],
duration: args[2],
callback: args[3]
},
mode = args2.options.mode,
effectMethod = $.effects[effect];
if ( $.fx.off || !effectMethod ) {
// delegate to the original method (e.g., .show()) if possible
if ( mode ) {
return this[ mode ]( args2.duration, args2.callback );
} else {
return this.each(function() {
if ( args2.callback ) {
args2.callback.call( this );
}
});
}
}
_show: $.fn.show,
show: function(speed) {
if ( standardSpeed( speed ) ) {
return this._show.apply(this, arguments);
} else {
var args = _normalizeArguments.apply(this, arguments);
args[1].mode = 'show';
return this.effect.apply(this, args);
}
},
_hide: $.fn.hide,
hide: function(speed) {
if ( standardSpeed( speed ) ) {
return this._hide.apply(this, arguments);
} else {
var args = _normalizeArguments.apply(this, arguments);
args[1].mode = 'hide';
return this.effect.apply(this, args);
}
},
// helper functions
cssUnit: function(key) {
var style = this.css(key), val = [];
$.each( ['em','px','%','pt'], function(i, unit){
if(style.indexOf(unit) > 0)
val = [parseFloat(style), unit];
});
return val;
}
});
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
$.extend( baseEasings, {
Sine: function ( p ) {
return 1 - Math.cos( p * Math.PI / 2 );
},
Circ: function ( p ) {
return 1 - Math.sqrt( 1 - p * p );
},
Elastic: function( p ) {
return p === 0 || p === 1 ? p :
-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) *
Math.PI / 15 );
},
Back: function( p ) {
return p * p * ( 3 * p - 2 );
},
Bounce: function ( p ) {
var pow2,
bounce = 4;
})(jQuery);
(function( $, undefined ) {
$.effects.blind = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// 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
$.effects.restore(el, props); $.effects.removeWrapper(el); //
Restore
if(o.callback) o.callback.apply(el[0], arguments); // Callback
el.dequeue();
});
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.bounce = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// Set options
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set
Mode
var direction = o.options.direction || 'up'; // Default direction
var distance = o.options.distance || 20; // Default distance
var times = o.options.times || 5; // Default # of times
var speed = o.duration || 250; // Default speed per bounce
if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching
opacity to prevent clearType and PNG issues in IE
// 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';
var distance = o.options.distance || (ref == 'top' ?
el.outerHeight(true) / 3 : el.outerWidth(true) / 3);
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};
animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
el.animate(animation, speed / 2, o.options.easing);
distance = distance / 2;
times--;
};
for (var i = 0; i < times; i++) { // Bounces
var animation1 = {}, animation2 = {};
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
el.animate(animation1, speed / 2,
o.options.easing).animate(animation2, speed / 2, o.options.easing);
distance = (mode == 'hide') ? distance * 2 : distance / 2;
};
if (mode == 'hide') { // Last Bounce
var animation = {opacity: 0};
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
el.animate(animation, speed / 2, o.options.easing, function(){
el.hide(); // Hide
$.effects.restore(el, props);
$.effects.removeWrapper(el); // Restore
if(o.callback) o.callback.apply(this, arguments); //
Callback
});
} else {
var animation1 = {}, animation2 = {};
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
el.animate(animation1, speed / 2,
o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
$.effects.restore(el, props);
$.effects.removeWrapper(el); // Restore
if(o.callback) o.callback.apply(this, arguments); //
Callback
});
};
el.queue('fx', function() { el.dequeue(); });
el.dequeue();
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.clip = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props =
['position','top','bottom','left','right','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
var animate = el[0].tagName == 'IMG' ? wrapper : el;
var ref = {
size: (direction == 'vertical') ? 'height' : 'width',
position: (direction == 'vertical') ? 'top' : 'left'
};
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);
(function( $, undefined ) {
$.effects.drop = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props =
['position','top','bottom','left','right','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
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
var motion = (direction == 'up' || direction == 'left') ? 'pos' :
'neg';
var distance = o.options.distance || (ref == 'top' ?
el.outerHeight( true ) / 2 : el.outerWidth( 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
$.effects.restore(el, props); $.effects.removeWrapper(el); //
Restore
if(o.callback) o.callback.apply(this, arguments); // Callback
el.dequeue();
}});
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.explode = function(o) {
return this.queue(function() {
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;
for(var i=0;i<rows;i++) { // =
for(var j=0;j<cells;j++) { // ||
el
.clone()
.appendTo('body')
.wrap('<div></div>')
.css({
position: 'absolute',
visibility: 'visible',
left: -j*(width/cells),
top: -i*(height/rows)
})
.parent()
.addClass('ui-effects-explode')
.css({
position: 'absolute',
overflow: 'hidden',
width: width/cells,
height: height/rows,
left: offset.left + j*(width/cells) + (o.options.mode
== 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
top: offset.top + i*(height/rows) + (o.options.mode
== 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
opacity: o.options.mode == 'show' ? 0 : 1
}).animate({
left: offset.left + j*(width/cells) + (o.options.mode
== 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
top: offset.top + i*(height/rows) + (o.options.mode
== 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
opacity: o.options.mode == 'show' ? 1 : 0
}, o.duration || 500);
}
}
// Set a timeout, to call the callback approx. when the other animations have
finished
setTimeout(function() {
}, o.duration || 500);
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.fade = function(o) {
return this.queue(function() {
var elem = $(this),
mode = $.effects.setMode(elem, o.options.mode || 'hide');
})(jQuery);
(function( $, undefined ) {
$.effects.fold = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// 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
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); //
Create Wrapper
var widthFirst = ((mode == 'show') != horizFirst);
var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
var distance = widthFirst ? [wrapper.width(), wrapper.height()] :
[wrapper.height(), wrapper.width()];
var percent = /([0-9]+)%/.exec(size);
if(percent) size = parseInt(percent[1],10) / 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, duration, o.options.easing)
.animate(animation2, duration, o.options.easing, 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);
(function( $, undefined ) {
$.effects.highlight = function(o) {
return this.queue(function() {
var elem = $(this),
props = ['backgroundImage', 'backgroundColor', 'opacity'],
mode = $.effects.setMode(elem, o.options.mode || 'show'),
animation = {
backgroundColor: elem.css('backgroundColor')
};
if (mode == 'hide') {
animation.opacity = 0;
}
$.effects.save(elem, props);
elem
.show()
.css({
backgroundImage: 'none',
backgroundColor: o.options.color || '#ffff99'
})
.animate(animation, {
queue: false,
duration: o.duration,
easing: o.options.easing,
complete: function() {
(mode == 'hide' && elem.hide());
$.effects.restore(elem, props);
(mode == 'show' && !$.support.opacity &&
this.style.removeAttribute('filter'));
(o.callback && o.callback.apply(this, arguments));
elem.dequeue();
}
});
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.pulsate = function(o) {
return this.queue(function() {
var elem = $(this),
mode = $.effects.setMode(elem, o.options.mode || 'show'),
times = ((o.options.times || 5) * 2) - 1,
duration = o.duration ? o.duration / 2 : $.fx.speeds._default /
2,
isVisible = elem.is(':visible'),
animateTo = 0;
if (!isVisible) {
elem.css('opacity', 0).show();
animateTo = 1;
}
elem
.queue('fx', function() { elem.dequeue(); })
.dequeue();
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.puff = function(o) {
return this.queue(function() {
var elem = $(this),
mode = $.effects.setMode(elem, o.options.mode || 'hide'),
percent = parseInt(o.options.percent, 10) || 150,
factor = percent / 100,
original = { height: elem.height(), width: elem.width() };
$.extend(o.options, {
fade: true,
mode: mode,
percent: mode == 'hide' ? percent : 100,
from: mode == 'hide'
? original
: {
height: original.height * factor,
width: original.width * factor
}
});
$.effects.scale = function(o) {
return this.queue(function() {
// Create element
var el = $(this);
// Set options
var options = $.extend(true, {}, o.options);
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set
Mode
var percent = parseInt(o.options.percent,10) ||
(parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set
default scaling percent
var direction = o.options.direction || 'both'; // Set default axis
var origin = o.options.origin; // The origin of the scaling
if (mode != 'effect') { // Set default origin and restore for show/hide
options.origin = origin || ['middle','center'];
options.restore = true;
}
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
// 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','bottom','left','right','width','height','overflow','opacity'];
var props1 =
['position','top','bottom','left','right','overflow','opacity']; // Always restore
var props2 = ['width','height','overflow']; // Copy for children
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
var scale = o.options.scale || 'both'; // Default scale mode
var origin = o.options.origin; // The origin of the sizing
var original = {height: el.height(), width: el.width()}; // Save
original
el.from = o.options.from || original; // Default from state
el.to = o.options.to || original; // Default to state
// Adjust
if (origin) { // Calculate baseline shifts
var baseline = $.effects.getBaseline(origin, original);
el.from.top = (original.height - el.from.height) * baseline.y;
el.from.left = (original.width - el.from.width) * baseline.x;
el.to.top = (original.height - el.to.height) * baseline.y;
el.to.left = (original.width - el.to.width) * baseline.x;
};
var factor = { // Set scaling 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}
};
if (scale == 'box' || scale == 'both') { // Scale the css box
if (factor.from.y != factor.to.y) { // Vertical props scaling
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);
};
if (factor.from.x != factor.to.x) { // Horizontal props scaling
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);
};
};
if (scale == 'content' || scale == 'both') { // Scale the content
if (factor.from.y != factor.to.y) { // Vertical props scaling
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(); // 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
hProps = hProps.concat(['marginLeft','marginRight']); // Add
margins
props2 = props.concat(vProps).concat(hProps); // Concat
el.find("*[width]").each(function(){
var child = $(this);
if (restore) $.effects.save(child, props2);
var c_original = {height: child.height(), width:
child.width()}; // Save original
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};
if (factor.from.y != factor.to.y) { // Vertical props
scaling
child.from = $.effects.setTransition(child, vProps,
factor.from.y, child.from);
child.to = $.effects.setTransition(child, vProps,
factor.to.y, child.to);
};
if (factor.from.x != factor.to.x) { // Horizontal props
scaling
child.from = $.effects.setTransition(child, hProps,
factor.from.x, child.from);
child.to = $.effects.setTransition(child, hProps,
factor.to.x, child.to);
};
child.css(child.from); // Shift children
child.animate(child.to, o.duration, o.options.easing,
function(){
if (restore) $.effects.restore(child, props2); //
Restore children
}); // Animate children
});
};
// Animate
el.animate(el.to, { queue: false, duration: o.duration, easing:
o.options.easing, complete: function() {
if (el.to.opacity === 0) {
el.css('opacity', el.from.opacity);
}
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();
}});
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.shake = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// 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
el.animate(animation1, speed,
o.options.easing).animate(animation2, speed, o.options.easing);
};
el.animate(animation1, speed, o.options.easing).
animate(animation, speed / 2, o.options.easing, function(){ // Last
shake
$.effects.restore(el, props); $.effects.removeWrapper(el); //
Restore
if(o.callback) o.callback.apply(this, arguments); // Callback
});
el.queue('fx', function() { el.dequeue(); });
el.dequeue();
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.slide = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// 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
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
var motion = (direction == 'up' || direction == 'left') ? 'pos' :
'neg';
var distance = o.options.distance || (ref == 'top' ?
el.outerHeight( true ) : el.outerWidth( true ));
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ?
"-" + distance : -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
$.effects.restore(el, props); $.effects.removeWrapper(el); //
Restore
if(o.callback) o.callback.apply(this, arguments); // Callback
el.dequeue();
}});
});
};
})(jQuery);
(function( $, undefined ) {
$.effects.transfer = function(o) {
return this.queue(function() {
var elem = $(this),
target = $(o.options.to),
endPosition = target.offset(),
animation = {
top: endPosition.top,
left: endPosition.left,
height: target.innerHeight(),
width: target.innerWidth()
},
startPosition = elem.offset(),
transfer = $('<div class="ui-effects-transfer"></div>')
.appendTo(document.body)
.addClass(o.options.className)
.css({
top: startPosition.top,
left: startPosition.left,
height: elem.innerHeight(),
width: elem.innerWidth(),
position: 'absolute'
})
.animate(animation, o.duration, o.options.easing,
function() {
transfer.remove();
(o.callback && o.callback.apply(elem[0], arguments));
elem.dequeue();
});
});
};
})(jQuery);
(function( $, undefined ) {
$.widget( "ui.accordion", {
options: {
active: 0,
animated: "slide",
autoHeight: true,
clearStyle: false,
collapsible: false,
event: "click",
fillSpace: false,
header: "> li > :first-child,> :not(li):even",
icons: {
header: "ui-icon-triangle-1-e",
headerSelected: "ui-icon-triangle-1-s"
},
navigation: false,
navigationFilter: function() {
return this.href.toLowerCase() === location.href.toLowerCase();
}
},
_create: function() {
var self = this,
options = self.options;
self.running = 0;
self.element
.addClass( "ui-accordion ui-widget ui-helper-reset" )
// in lack of child-selectors in CSS
// we need to mark top-LIs in a UL-accordion for some IE-fix
.children( "li" )
.addClass( "ui-accordion-li-fix" );
self.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-
content ui-corner-bottom" );
if ( options.navigation ) {
var current =
self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
if ( current.length ) {
var header = current.closest( ".ui-accordion-header" );
if ( header.length ) {
// anchor within header
self.active = header;
} else {
// anchor within content
self.active = current.closest( ".ui-accordion-
content" ).prev();
}
}
}
self._createIcons();
self.resize();
// ARIA
self.element.attr( "role", "tablist" );
self.headers
.attr( "role", "tab" )
.bind( "keydown.accordion", function( event ) {
return self._keydown( event );
})
.next()
.attr( "role", "tabpanel" );
self.headers
.not( self.active || "" )
.attr({
"aria-expanded": "false",
"aria-selected": "false",
tabIndex: -1
})
.next()
.hide();
if ( options.event ) {
self.headers.bind( options.event.split(" ").join(".accordion ") +
".accordion", function(event) {
self._clickHandler.call( self, event, this );
event.preventDefault();
});
}
},
_createIcons: function() {
var options = this.options;
if ( options.icons ) {
$( "<span></span>" )
.addClass( "ui-icon " + options.icons.header )
.prependTo( this.headers );
this.active.children( ".ui-icon" )
.toggleClass(options.icons.header)
.toggleClass(options.icons.headerSelected);
this.element.addClass( "ui-accordion-icons" );
}
},
_destroyIcons: function() {
this.headers.children( ".ui-icon" ).remove();
this.element.removeClass( "ui-accordion-icons" );
},
destroy: function() {
var options = this.options;
this.element
.removeClass( "ui-accordion ui-widget ui-helper-reset" )
.removeAttr( "role" );
this.headers
.unbind( ".accordion" )
.removeClass( "ui-accordion-header ui-accordion-disabled ui-
helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-
corner-top" )
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-selected" )
.removeAttr( "tabIndex" );
if ( key == "active" ) {
this.activate( value );
}
if ( key == "icons" ) {
this._destroyIcons();
if ( value ) {
this._createIcons();
}
}
// #5332 - opacity doesn't cascade to positioned elements in IE
// so we need to add the disabled class to the headers and panels
if ( key == "disabled" ) {
this.headers.add(this.headers.next())
[ value ? "addClass" : "removeClass" ](
"ui-accordion-disabled ui-state-disabled" );
}
},
_keydown: function( event ) {
if ( this.options.disabled || event.altKey || event.ctrlKey ) {
return;
}
switch ( event.keyCode ) {
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus = this.headers[ ( currentIndex - 1 + length ) %
length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._clickHandler( { target: event.target },
event.target );
event.preventDefault();
}
if ( toFocus ) {
$( event.target ).attr( "tabIndex", -1 );
$( toFocus ).attr( "tabIndex", 0 );
toFocus.focus();
return false;
}
return true;
},
resize: function() {
var options = this.options,
maxHeight;
if ( options.fillSpace ) {
if ( $.browser.msie ) {
var defOverflow = this.element.parent().css( "overflow" );
this.element.parent().css( "overflow", "hidden");
}
maxHeight = this.element.parent().height();
if ($.browser.msie) {
this.element.parent().css( "overflow", defOverflow );
}
this.headers.each(function() {
maxHeight -= $( this ).outerHeight( true );
});
this.headers.next()
.each(function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $
( this ).height() ) );
})
.css( "overflow", "auto" );
} else if ( options.autoHeight ) {
maxHeight = 0;
this.headers.next()
.each(function() {
maxHeight = Math.max( maxHeight, $( this ).height( ""
).height() );
})
.height( maxHeight );
}
return this;
},
return this;
},
// switch classes
active
.removeClass( "ui-state-active ui-corner-top" )
.addClass( "ui-state-default ui-corner-all" )
.children( ".ui-icon" )
.removeClass( options.icons.headerSelected )
.addClass( options.icons.header );
if ( !clickedIsActive ) {
clicked
.removeClass( "ui-state-default ui-corner-all" )
.addClass( "ui-state-active ui-corner-top" )
.children( ".ui-icon" )
.removeClass( options.icons.header )
.addClass( options.icons.headerSelected );
clicked
.next()
.addClass( "ui-accordion-content-active" );
}
return;
},
self.toShow = toShow;
self.toHide = toHide;
self.data = data;
if ( options.animated ) {
var animOptions = {};
if ( !options.proxied ) {
options.proxied = options.animated;
}
if ( !options.proxiedDuration ) {
options.proxiedDuration = options.duration;
}
complete( true );
}
// TODO assert that the blur and focus triggers are really necessary,
remove otherwise
toHide.prev()
.attr({
"aria-expanded": "false",
"aria-selected": "false",
tabIndex: -1
})
.blur();
toShow.prev()
.attr({
"aria-expanded": "true",
"aria-selected": "true",
tabIndex: 0
})
.focus();
},
if ( this.options.clearStyle ) {
this.toShow.add( this.toHide ).css({
height: "",
overflow: ""
});
}
// other classes are removed before the animation; this one needs to
stay until completed
this.toHide.removeClass( "ui-accordion-content-active" );
// Work around for rendering bug in IE (#5421)
if ( this.toHide.length ) {
this.toHide.parent()[0].className = this.toHide.parent()
[0].className;
}
$.extend( $.ui.accordion, {
version: "1.8.24",
animations: {
slide: function( options, additions ) {
options = $.extend({
easing: "swing",
duration: 300
}, options, additions );
if ( !options.toHide.size() ) {
options.toShow.animate({
height: "show",
paddingTop: "show",
paddingBottom: "show"
}, options );
return;
}
if ( !options.toShow.size() ) {
options.toHide.animate({
height: "hide",
paddingTop: "hide",
paddingBottom: "hide"
}, options );
return;
}
var overflow = options.toShow.css( "overflow" ),
percentDone = 0,
showProps = {},
hideProps = {},
fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
originalWidth;
// fix width before calculating height of hidden element
var s = options.toShow;
originalWidth = s[0].style.width;
s.width( s.parent().width()
- parseFloat( s.css( "paddingLeft" ) )
- parseFloat( s.css( "paddingRight" ) )
- ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 )
- ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) );
})( jQuery );
(function( $, undefined ) {
$.widget( "ui.autocomplete", {
options: {
appendTo: "body",
autoFocus: false,
delay: 300,
minLength: 1,
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
source: null
},
pending: 0,
_create: function() {
var self = this,
doc = this.element[ 0 ].ownerDocument,
suppressKeyPress;
this.isMultiLine = this.element.is( "textarea" );
this.element
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" )
// TODO verify these actually work as intended
.attr({
role: "textbox",
"aria-autocomplete": "list",
"aria-haspopup": "true"
})
.bind( "keydown.autocomplete", function( event ) {
if ( self.options.disabled ||
self.element.propAttr( "readOnly" ) ) {
return;
}
suppressKeyPress = false;
var keyCode = $.ui.keyCode;
switch( event.keyCode ) {
case keyCode.PAGE_UP:
self._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
self._move( "nextPage", event );
break;
case keyCode.UP:
self._keyEvent( "previous", event );
break;
case keyCode.DOWN:
self._keyEvent( "next", event );
break;
case keyCode.ENTER:
case keyCode.NUMPAD_ENTER:
// when menu is open and has focus
if ( self.menu.active ) {
// #6055 - Opera still allows the keypress to
occur
// which causes forms to submit
suppressKeyPress = true;
event.preventDefault();
}
//passthrough - ENTER and TAB both select the current
element
case keyCode.TAB:
if ( !self.menu.active ) {
return;
}
self.menu.select( event );
break;
case keyCode.ESCAPE:
self.element.val( self.term );
self.close( event );
break;
default:
// keypress is triggered before the input value is
changed
clearTimeout( self.searching );
self.searching = setTimeout(function() {
// only search if the value has changed
if ( self.term != self.element.val() ) {
self.selectedItem = null;
self.search( null, event );
}
}, self.options.delay );
break;
}
})
.bind( "keypress.autocomplete", function( event ) {
if ( suppressKeyPress ) {
suppressKeyPress = false;
event.preventDefault();
}
})
.bind( "focus.autocomplete", function() {
if ( self.options.disabled ) {
return;
}
self.selectedItem = null;
self.previous = self.element.val();
})
.bind( "blur.autocomplete", function( event ) {
if ( self.options.disabled ) {
return;
}
clearTimeout( self.searching );
// clicks on the menu (or a button to trigger a search)
will cause a blur event
self.closing = setTimeout(function() {
self.close( event );
self._change( event );
}, 150 );
});
this._initSource();
this.menu = $( "<ul></ul>" )
.addClass( "ui-autocomplete" )
.appendTo( $( this.options.appendTo || "body", doc )[0] )
// prevent the close-on-blur in case of a "slow" click on the
menu (long mousedown)
.mousedown(function( event ) {
// clicking on the scrollbar causes focus to shift to the
body
// but we can't detect a mouseup or a click immediately
afterward
// so we have to track the next mousedown and close the
menu if
// the user clicks somewhere outside of the autocomplete
var menuElement = self.menu.element[ 0 ];
if ( !$( event.target ).closest( ".ui-menu-item" ).length )
{
setTimeout(function() {
$( document ).one( 'mousedown', function( event
) {
if ( event.target !== self.element[ 0 ]
&&
event.target !== menuElement &&
!$.ui.contains( menuElement,
event.target ) ) {
self.close();
}
});
}, 1 );
}
self.close( event );
self.selectedItem = item;
},
blur: function( event, ui ) {
// don't set the value of the text field if it's
already correct
// this prevents moving the cursor unnecessarily
if ( self.menu.element.is(":visible") &&
( self.element.val() !== self.term ) ) {
self.element.val( self.term );
}
}
})
.zIndex( this.element.zIndex() + 1 )
// workaround for jQuery bug #5781
http://dev.jquery.com/ticket/5781
.css({ top: 0, left: 0 })
.hide()
.data( "menu" );
if ( $.fn.bgiframe ) {
this.menu.element.bgiframe();
}
// 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
self.beforeunloadHandler = function() {
self.element.removeAttr( "autocomplete" );
};
$( window ).bind( "beforeunload", self.beforeunloadHandler );
},
destroy: function() {
this.element
.removeClass( "ui-autocomplete-input" )
.removeAttr( "autocomplete" )
.removeAttr( "role" )
.removeAttr( "aria-autocomplete" )
.removeAttr( "aria-haspopup" );
this.menu.element.remove();
$( window ).unbind( "beforeunload", this.beforeunloadHandler );
$.Widget.prototype.destroy.call( this );
},
_initSource: function() {
var self = this,
array,
url;
if ( $.isArray(this.options.source) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter(array, request.term) );
};
} else if ( typeof this.options.source === "string" ) {
url = this.options.source;
this.source = function( request, response ) {
if ( self.xhr ) {
self.xhr.abort();
}
self.xhr = $.ajax({
url: url,
data: request,
dataType: "json",
success: function( data, status ) {
response( data );
},
error: function() {
response( [] );
}
});
};
} else {
this.source = this.options.source;
}
},
// always save the actual value, not the one passed as an argument
this.term = this.element.val();
clearTimeout( this.closing );
if ( this._trigger( "search", event ) === false ) {
return;
}
_response: function() {
var that = this,
index = ++requestIndex;
that.pending--;
if ( !that.pending ) {
that.element.removeClass( "ui-autocomplete-loading" );
}
};
},
if ( this.options.autoFocus ) {
this.menu.next( new $.Event("mouseover") );
}
},
_resizeMenu: function() {
var ul = this.menu.element;
ul.outerWidth( Math.max(
// Firefox wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping (#7513)
ul.width( "" ).outerWidth() + 1,
this.element.outerWidth()
) );
},
widget: function() {
return this.menu.element;
},
_keyEvent: function( keyEvent, event ) {
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
this._move( keyEvent, event );
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
},
filter: function(array, term) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
return $.grep( array, function(value) {
return matcher.test( value.label || value.value || value );
});
}
});
}( jQuery ));
/*
* jQuery UI Menu (not officially released)
*
* This widget isn't yet finished and the API is subject to change. We plan to
finish
* it for the next release. You're welcome to give it a try anyway and give us
feedback,
* as long as you're okay with migrating your code later on. We can help with that,
too.
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Licensed under the MIT license.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Menu
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function($) {
$.widget("ui.menu", {
_create: function() {
var self = this;
this.element
.addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
.attr({
role: "listbox",
"aria-activedescendant": "ui-active-menuitem"
})
.click(function( event ) {
if ( !$( event.target ).closest( ".ui-menu-item a" ).length
) {
return;
}
// temporary
event.preventDefault();
self.select( event );
});
this.refresh();
},
refresh: function() {
var self = this;
items.children("a")
.addClass("ui-corner-all")
.attr("tabindex", -1)
// mouseenter doesn't work with event delegation
.mouseenter(function( event ) {
self.activate( event, $(this).parent() );
})
.mouseleave(function() {
self.deactivate();
});
},
deactivate: function() {
if (!this.active) { return; }
this.active.children("a")
.removeClass("ui-state-hover")
.removeAttr("id");
this._trigger("blur");
this.active = null;
},
next: function(event) {
this.move("next", ".ui-menu-item:first", event);
},
previous: function(event) {
this.move("prev", ".ui-menu-item:last", event);
},
first: function() {
return this.active && !this.active.prevAll(".ui-menu-item").length;
},
last: function() {
return this.active && !this.active.nextAll(".ui-menu-item").length;
},
hasScroll: function() {
return this.element.height() < this.element[ $.fn.prop ? "prop" :
"attr" ]("scrollHeight");
},
}(jQuery));
(function( $, undefined ) {
$.widget( "ui.button", {
options: {
disabled: null,
text: true,
label: null,
icons: {
primary: null,
secondary: null
}
},
_create: function() {
this.element.closest( "form" )
.unbind( "reset.button" )
.bind( "reset.button", formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) {
this.options.disabled = !!this.element.propAttr( "disabled" );
} else {
this.element.propAttr( "disabled", this.options.disabled );
}
this._determineButtonType();
this.hasTitle = !!this.buttonElement.attr( "title" );
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
.bind( "mouseenter.button", function() {
if ( options.disabled ) {
return;
}
$( this ).addClass( "ui-state-hover" );
if ( this === lastActive ) {
$( this ).addClass( "ui-state-active" );
}
})
.bind( "mouseleave.button", function() {
if ( options.disabled ) {
return;
}
$( this ).removeClass( hoverClass );
})
.bind( "click.button", function( event ) {
if ( options.disabled ) {
event.preventDefault();
event.stopImmediatePropagation();
}
});
this.element
.bind( "focus.button", function() {
// no need to check disabled, focus won't be triggered
anyway
self.buttonElement.addClass( focusClass );
})
.bind( "blur.button", function() {
self.buttonElement.removeClass( focusClass );
});
if ( toggleButton ) {
this.element.bind( "change.button", function() {
if ( clickDragged ) {
return;
}
self.refresh();
});
// if mouse moves between mousedown and mouseup (drag) set
clickDragged flag
// prevents issue where button state changes but checkbox/radio
checked state
// does not in Firefox (see ticket #6970)
this.buttonElement
.bind( "mousedown.button", function( event ) {
if ( options.disabled ) {
return;
}
clickDragged = false;
startXPos = event.pageX;
startYPos = event.pageY;
})
.bind( "mouseup.button", function( event ) {
if ( options.disabled ) {
return;
}
if ( startXPos !== event.pageX || startYPos !==
event.pageY ) {
clickDragged = true;
}
});
}
if ( this.buttonElement.is("a") ) {
this.buttonElement.keyup(function(event) {
if ( event.keyCode === $.ui.keyCode.SPACE ) {
// TODO pass through original event correctly
(just as 2nd argument doesn't work)
$( this ).click();
}
});
}
}
// TODO: pull out $.Widget's handling for the disabled option into
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
// be overridden by individual plugins
this._setOption( "disabled", options.disabled );
this._resetButton();
},
_determineButtonType: function() {
if ( this.element.is(":checkbox") ) {
this.type = "checkbox";
} else if ( this.element.is(":radio") ) {
this.type = "radio";
} else if ( this.element.is("input") ) {
this.type = "input";
} else {
this.type = "button";
}
widget: function() {
return this.buttonElement;
},
destroy: function() {
this.element
.removeClass( "ui-helper-hidden-accessible" );
this.buttonElement
.removeClass( baseClasses + " " + stateClasses + " " +
typeClasses )
.removeAttr( "role" )
.removeAttr( "aria-pressed" )
.html( this.buttonElement.find(".ui-button-text").html() );
if ( !this.hasTitle ) {
this.buttonElement.removeAttr( "title" );
}
$.Widget.prototype.destroy.call( this );
},
_resetButton: function() {
if ( this.type === "input" ) {
if ( this.options.label ) {
this.element.val( this.options.label );
}
return;
}
var buttonElement = this.buttonElement.removeClass( typeClasses ),
buttonText = $( "<span></span>", this.element[0].ownerDocument )
.addClass( "ui-button-text" )
.html( this.options.label )
.appendTo( buttonElement.empty() )
.text(),
icons = this.options.icons,
multipleIcons = icons.primary && icons.secondary,
buttonClasses = [];
if ( icons.primary || icons.secondary ) {
if ( this.options.text ) {
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons
? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
}
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary
ui-icon " + icons.primary + "'></span>" );
}
if ( icons.secondary ) {
buttonElement.append( "<span class='ui-button-icon-
secondary ui-icon " + icons.secondary + "'></span>" );
}
if ( !this.options.text ) {
buttonClasses.push( multipleIcons ? "ui-button-icons-
only" : "ui-button-icon-only" );
if ( !this.hasTitle ) {
buttonElement.attr( "title", buttonText );
}
}
} else {
buttonClasses.push( "ui-button-text-only" );
}
buttonElement.addClass( buttonClasses.join( " " ) );
}
});
$.widget( "ui.buttonset", {
options: {
items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
},
_create: function() {
this.element.addClass( "ui-buttonset" );
},
_init: function() {
this.refresh();
},
refresh: function() {
var rtl = this.element.css( "direction" ) === "rtl";
destroy: function() {
this.element.removeClass( "ui-buttonset" );
this.buttons
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-corner-left ui-corner-right" )
.end()
.button( "destroy" );
$.Widget.prototype.destroy.call( this );
}
});
}( jQuery ) );
(function( $, undefined ) {
function Datepicker() {
this.debug = false; // Change this to true to start debugging
this._curInst = null; // The current instance in use
this._keyEvent = false; // If the last event was a key event
this._disabledInputs = []; // List of date picker inputs that have been
disabled
this._datepickerShowing = false; // True if the popup picker is showing ,
false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker
division
this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker
class
this._appendClass = 'ui-datepicker-append'; // The name of the append marker
class
this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger
marker class
this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker
class
this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled
covering marker class
this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the
unselectable cell marker class
this._currentClass = 'ui-datepicker-current-day'; // The name of the current
day marker class
this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day
hover marker class
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
closeText: 'Done', // Display text for close link
prevText: 'Prev', // Display text for previous month link
nextText: 'Next', // Display text for next month link
currentText: 'Today', // Display text for current month link
monthNames: ['January','February','March','April','May','June',
'July','August','September','October','November','December'], //
Names of months for drop-down and formatting
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday'], // For formatting
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], //
For formatting
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings
for days starting at Sunday
weekHeader: 'Wk', // Column header for week of the year
dateFormat: 'mm/dd/yy', // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false, // True if right-to-left language, false if left-to-right
showMonthAfterYear: false, // True if the year select precedes month,
false for month then year
yearSuffix: '' // Additional text to append to the year in the month
headers
};
this._defaults = { // Global defaults for all the date picker instances
showOn: 'focus', // 'focus' for popup on focus,
// 'button' for trigger button, or 'both' for either
showAnim: 'fadeIn', // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText: '', // Display text following the input box, e.g. showing
the format
buttonText: '...', // Text for trigger button
buttonImage: '', // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it
appears on a button
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat: false, // True if date formatting applied to
prev/today/next links
gotoCurrent: false, // True if today link goes back to current
selection instead
changeMonth: false, // True if month can be selected directly, false if
only prev/next
changeYear: false, // True if year can be selected directly, false if
only prev/next
yearRange: 'c-10:c+10', // Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to
currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the
above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to
leave blank
selectOtherMonths: false, // True to allow selection of dates in other
months, false for unselectable
showWeek: false, // True to show week of the year, false to not show it
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,
// string value starting with '+' for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
duration: 'fast', // 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 '',
// [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
onSelect: null, // Define a callback function when a date is selected
onChangeMonthYear: null, // Define a callback function when the month
or year is changed
onClose: null, // Define a callback function when the datepicker is
closed
numberOfMonths: 1, // Number of months to show at a time
showCurrentAtPos: 0, // The position in multipe months at which to show
the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big
links
altField: '', // Selector for an alternate field to store selected
dates into
altFormat: '', // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date
format
showButtonPanel: false, // True to show button panel, false to not show
it
autoSize: false, // True to size the input for the date format, false
to leave as is
disabled: false // The initial disabled state
};
$.extend(this._defaults, this.regional['']);
this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-
datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
}
$.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date
picker. */
markerClassName: 'hasDatepicker',
/* 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) {
extendRemove(this._defaults, settings || {});
return this;
},
/* Handle keystrokes. */
_doKeyDown: function(event) {
var inst = $.datepicker._getInst(event.target);
var handled = true;
var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
inst._keyEvent = true;
if ($.datepicker._datepickerShowing)
switch (event.keyCode) {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
case 13: var sel = $('td.' + $.datepicker._dayOverClass +
':not(.' +
$.datepicker._currentClass +
')', inst.dpDiv);
if (sel[0])
$.datepicker._selectDay(event.target,
inst.selectedMonth, inst.selectedYear, sel[0]);
var onSelect = $.datepicker._get(inst,
'onSelect');
if (onSelect) {
var dateStr =
$.datepicker._formatDate(inst);
return offset;
},
/* Generate the HTML for the current state of the date picker. */
_generateHTML: function(inst) {
var today = new Date();
today = this._daylightSavingAdjust(
new Date(today.getFullYear(), today.getMonth(),
today.getDate())); // clear time
var isRTL = this._get(inst, 'isRTL');
var showButtonPanel = this._get(inst, 'showButtonPanel');
var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
var numMonths = this._getNumberOfMonths(inst);
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
var stepMonths = this._get(inst, 'stepMonths');
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new
Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
var drawMonth = inst.drawMonth - showCurrentAtPos;
var drawYear = inst.drawYear;
if (drawMonth < 0) {
drawMonth += 12;
drawYear--;
}
if (maxDate) {
var maxDraw = this._daylightSavingAdjust(new
Date(maxDate.getFullYear(),
maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1,
maxDate.getDate()));
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth,
1)) > maxDraw) {
drawMonth--;
if (drawMonth < 0) {
drawMonth = 11;
drawYear--;
}
}
}
inst.drawMonth = drawMonth;
inst.drawYear = drawYear;
var prevText = this._get(inst, 'prevText');
prevText = (!navigationAsDateFormat ? prevText :
this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth -
stepMonths, 1)),
this._getFormatConfig(inst)));
var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev"
data-event="click"' +
' title="' + prevText + '"><span class="ui-icon ui-icon-circle-
triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-
all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-
triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
var nextText = this._get(inst, 'nextText');
nextText = (!navigationAsDateFormat ? nextText :
this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth +
stepMonths, 1)),
this._getFormatConfig(inst)));
var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
'<a class="ui-datepicker-next ui-corner-all" data-handler="next"
data-event="click"' +
' title="' + nextText + '"><span class="ui-icon ui-icon-circle-
triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-
all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-
triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
var currentText = this._get(inst, 'currentText');
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ?
currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate,
this._getFormatConfig(inst)));
var controls = (!inst.inline ? '<button type="button" class="ui-
datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-
handler="hide" data-event="click">' +
this._get(inst, 'closeText') + '</button>' : '');
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-
buttonpane ui-widget-content">' + (isRTL ? controls : '') +
(this._isInRange(inst, gotoDate) ? '<button type="button"
class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"
data-handler="today" data-event="click"' +
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) +
'</div>' : '';
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
var showWeek = this._get(inst, 'showWeek');
var dayNames = this._get(inst, 'dayNames');
var dayNamesShort = this._get(inst, 'dayNamesShort');
var dayNamesMin = this._get(inst, 'dayNamesMin');
var monthNames = this._get(inst, 'monthNames');
var monthNamesShort = this._get(inst, 'monthNamesShort');
var beforeShowDay = this._get(inst, 'beforeShowDay');
var showOtherMonths = this._get(inst, 'showOtherMonths');
var selectOtherMonths = this._get(inst, 'selectOtherMonths');
var calculateWeek = this._get(inst, 'calculateWeek') ||
this.iso8601Week;
var defaultDate = this._getDefaultDate(inst);
var html = '';
for (var row = 0; row < numMonths[0]; row++) {
var group = '';
this.maxRows = 4;
for (var col = 0; col < numMonths[1]; col++) {
var selectedDate = this._daylightSavingAdjust(new
Date(drawYear, drawMonth, inst.selectedDay));
var cornerClass = ' ui-corner-all';
var calender = '';
if (isMultiMonth) {
calender += '<div class="ui-datepicker-group';
if (numMonths[1] > 1)
switch (col) {
case 0: calender += ' ui-datepicker-
group-first';
cornerClass = ' ui-corner-' +
(isRTL ? 'right' : 'left'); break;
case numMonths[1]-1: calender += ' ui-
datepicker-group-last';
cornerClass = ' ui-corner-' +
(isRTL ? 'left' : 'right'); break;
default: calender += ' ui-datepicker-
group-middle'; cornerClass = ''; break;
}
calender += '">';
}
calender += '<div class="ui-datepicker-header ui-widget-
header ui-helper-clearfix' + cornerClass + '">' +
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ?
next : prev) : '') +
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ?
prev : next) : '') +
this._generateMonthYearHeader(inst, drawMonth,
drawYear, minDate, maxDate,
row > 0 || col > 0, monthNames, monthNamesShort) + //
draw month headers
'</div><table class="ui-datepicker-calendar"><thead>'
+
'<tr>';
var thead = (showWeek ? '<th class="ui-datepicker-week-
col">' + this._get(inst, 'weekHeader') + '</th>' : '');
for (var dow = 0; dow < 7; dow++) { // days of the week
var day = (dow + firstDay) % 7;
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? '
class="ui-datepicker-week-end"' : '') + '>' +
'<span title="' + dayNames[day] + '">' +
dayNamesMin[day] + '</span></th>';
}
calender += thead + '</tr></thead><tbody>';
var daysInMonth = this._getDaysInMonth(drawYear,
drawMonth);
if (drawYear == inst.selectedYear && drawMonth ==
inst.selectedMonth)
inst.selectedDay = Math.min(inst.selectedDay,
daysInMonth);
var leadDays = (this._getFirstDayOfMonth(drawYear,
drawMonth) - firstDay + 7) % 7;
var curRows = Math.ceil((leadDays + daysInMonth) / 7); //
calculate the number of rows to generate
var numRows = (isMultiMonth ? this.maxRows > curRows ?
this.maxRows : curRows : curRows); //If multiple months, use the higher number of
rows (see #7043)
this.maxRows = numRows;
var printDate = this._daylightSavingAdjust(new
Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date
picker rows
calender += '<tr>';
var tbody = (!showWeek ? '' : '<td class="ui-
datepicker-week-col">' +
this._get(inst, 'calculateWeek')(printDate) +
'</td>');
for (var dow = 0; dow < 7; dow++) { // create date
picker days
var daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ?
inst.input[0] : null), [printDate]) : [true, '']);
var otherMonth = (printDate.getMonth() !=
drawMonth);
var unselectable = (otherMonth && !
selectOtherMonths) || !daySettings[0] ||
(minDate && printDate < minDate) ||
(maxDate && printDate > maxDate);
tbody += '<td class="' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-
datepicker-week-end' : '') + // highlight weekends
(otherMonth ? ' ui-datepicker-other-
month' : '') + // highlight days from other months
((printDate.getTime() ==
selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || //
user pressed key
(defaultDate.getTime() ==
printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
// or defaultDate is current printedDate
and defaultDate is selectedDate
' ' + this._dayOverClass : '') + //
highlight selected day
(unselectable ? ' ' +
this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable
days
(otherMonth && !showOtherMonths ? '' : '
' + daySettings[1] + // highlight custom dates
(printDate.getTime() ==
currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
(printDate.getTime() == today.getTime() ?
' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
((!otherMonth || showOtherMonths) &&
daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
(unselectable ? '' : ' data-
handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '"
data-year="' + printDate.getFullYear() + '"') + '>' + // actions
(otherMonth && !showOtherMonths ?
' ' : // display for other months
(unselectable ? '<span class="ui-state-
default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
(printDate.getTime() == today.getTime() ?
' ui-state-highlight' : '') +
(printDate.getTime() ==
currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
(otherMonth ? ' ui-priority-secondary' :
'') + // distinguish dates from other months
'" href="#">' + printDate.getDate() +
'</a>')) + '</td>'; // display selectable date
printDate.setDate(printDate.getDate() + 1);
printDate =
this._daylightSavingAdjust(printDate);
}
calender += tbody + '</tr>';
}
drawMonth++;
if (drawMonth > 11) {
drawMonth = 0;
drawYear++;
}
calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
((numMonths[0] > 0 && col ==
numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
group += calender;
}
html += group;
}
html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10)
< 7 && !inst.inline ?
'<iframe src="javascript:false;" class="ui-datepicker-cover"
frameborder="0"></iframe>' : '');
inst._keyEvent = false;
return html;
},
html += inst.yearshtml;
inst.yearshtml = null;
}
}
html += this._get(inst, 'yearSuffix');
if (showMonthAfterYear)
html += (secondary || !(changeMonth && changeYear) ? ' ' :
'') + monthHtml;
html += '</div>'; // Close datepicker_header
return html;
},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate: function(inst, minMax) {
return this._determineDate(inst, this._get(inst, minMax + 'Date'),
null);
},
/*
* Bind hover events for datepicker elements.
* Done via delegate so the binding only occurs once in the lifetime of the parent
div.
* Global instActive, set by _updateDatepicker allows the handlers to find their
way back to the active picker.
*/
function bindHover(dpDiv) {
var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-
datepicker-calendar td a';
return dpDiv.bind('mouseout', function(event) {
var elem = $( event.target ).closest( selector );
if ( !elem.length ) {
return;
}
elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-
datepicker-next-hover" );
})
.bind('mouseover', function(event) {
var elem = $( event.target ).closest( selector );
if ($.datepicker._isDisabledDatepicker( instActive.inline ?
dpDiv.parent()[0] : instActive.input[0]) ||
!elem.length ) {
return;
}
elem.parents('.ui-datepicker-
calendar').find('a').removeClass('ui-state-hover');
elem.addClass('ui-state-hover');
if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-
datepicker-prev-hover');
if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-
datepicker-next-hover');
});
}
})(jQuery);
(function( $, undefined ) {
var uiDialogClasses =
'ui-dialog ' +
'ui-widget ' +
'ui-widget-content ' +
'ui-corner-all ',
sizeRelatedOptions = {
buttons: true,
height: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
width: true
},
resizableRelatedOptions = {
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true
};
$.widget("ui.dialog", {
options: {
autoOpen: true,
buttons: {},
closeOnEscape: true,
closeText: 'close',
dialogClass: '',
draggable: true,
hide: null,
height: 'auto',
maxHeight: false,
maxWidth: false,
minHeight: 150,
minWidth: 150,
modal: false,
position: {
my: 'center',
at: 'center',
collision: 'fit',
// ensure that the titlebar is never outside the document
using: function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
}
},
resizable: true,
show: null,
stack: true,
title: '',
width: 300,
zIndex: 1000
},
_create: function() {
this.originalTitle = this.element.attr('title');
// #5742 - .attr() might return a DOMElement
if ( typeof this.originalTitle !== "string" ) {
this.originalTitle = "";
}
self.close(event);
event.preventDefault();
}
})
.attr({
role: 'dialog',
'aria-labelledby': titleId
})
.mousedown(function(event) {
self.moveToTop(false, event);
}),
uiDialogContent = self.element
.show()
.removeAttr('title')
.addClass(
'ui-dialog-content ' +
'ui-widget-content')
.appendTo(uiDialog),
uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $
('<span></span>'))
.addClass(
'ui-icon ' +
'ui-icon-closethick'
)
.text(options.closeText)
.appendTo(uiDialogTitlebarClose),
uiDialogTitle = $('<span></span>')
.addClass('ui-dialog-title')
.attr('id', titleId)
.html(title)
.prependTo(uiDialogTitlebar);
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
self._createButtons(options.buttons);
self._isOpen = false;
if ($.fn.bgiframe) {
uiDialog.bgiframe();
}
},
_init: function() {
if ( this.options.autoOpen ) {
this.open();
}
},
destroy: function() {
var self = this;
if (self.overlay) {
self.overlay.destroy();
}
self.uiDialog.hide();
self.element
.unbind('.dialog')
.removeData('dialog')
.removeClass('ui-dialog-content ui-widget-content')
.hide().appendTo('body');
self.uiDialog.remove();
if (self.originalTitle) {
self.element.attr('title', self.originalTitle);
}
return self;
},
widget: function() {
return this.uiDialog;
},
close: function(event) {
var self = this,
maxZ, thisZ;
if (false === self._trigger('beforeClose', event)) {
return;
}
if (self.overlay) {
self.overlay.destroy();
}
self.uiDialog.unbind('keypress.ui-dialog');
self._isOpen = false;
if (self.options.hide) {
self.uiDialog.hide(self.options.hide, function() {
self._trigger('close', event);
});
} else {
self.uiDialog.hide();
self._trigger('close', event);
}
$.ui.dialog.overlay.resize();
return self;
},
isOpen: function() {
return this._isOpen;
},
//Save and then restore scroll since Opera 9.5+ resets when parent z-
Index is changed.
// http://ui.jquery.com/bugs/ticket/3193
saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft:
self.element.scrollLeft() };
$.ui.dialog.maxZ += 1;
self.uiDialog.css('z-index', $.ui.dialog.maxZ);
self.element.attr(saveScroll);
self._trigger('focus', event);
return self;
},
open: function() {
if (this._isOpen) { return; }
// set focus to the first tabbable element in the content area or the
first button
// if there are no tabbable elements, set focus on the dialog itself
$(self.element.find(':tabbable').get().concat(
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
uiDialog.get()))).eq(0).focus();
self._isOpen = true;
self._trigger('open');
return self;
},
_createButtons: function(buttons) {
var self = this,
hasButtons = false,
uiDialogButtonPane = $('<div></div>')
.addClass(
'ui-dialog-buttonpane ' +
'ui-widget-content ' +
'ui-helper-clearfix'
),
uiButtonSet = $( "<div></div>" )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );
_makeDraggable: function() {
var self = this,
options = self.options,
doc = $(document),
heightBeforeDrag;
function filteredUi(ui) {
return {
position: ui.position,
offset: ui.offset
};
}
self.uiDialog.draggable({
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
handle: '.ui-dialog-titlebar',
containment: 'document',
start: function(event, ui) {
heightBeforeDrag = options.height === "auto" ? "auto" : $
(this).height();
$(this).height($(this).height()).addClass("ui-dialog-
dragging");
self._trigger('dragStart', event, filteredUi(ui));
},
drag: function(event, ui) {
self._trigger('drag', event, filteredUi(ui));
},
stop: function(event, ui) {
options.position = [ui.position.left - doc.scrollLeft(),
ui.position.top - doc.scrollTop()];
$(this).removeClass("ui-dialog-
dragging").height(heightBeforeDrag);
self._trigger('dragStop', event, filteredUi(ui));
$.ui.dialog.overlay.resize();
}
});
},
_makeResizable: function(handles) {
handles = (handles === undefined ? this.options.resizable : handles);
var self = this,
options = self.options,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = self.uiDialog.css('position'),
resizeHandles = (typeof handles === 'string' ?
handles :
'n,e,s,w,se,sw,ne,nw'
);
function filteredUi(ui) {
return {
originalPosition: ui.originalPosition,
originalSize: ui.originalSize,
position: ui.position,
size: ui.size
};
}
self.uiDialog.resizable({
cancel: '.ui-dialog-content',
containment: 'document',
alsoResize: self.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
minHeight: self._minHeight(),
handles: resizeHandles,
start: function(event, ui) {
$(this).addClass("ui-dialog-resizing");
self._trigger('resizeStart', event, filteredUi(ui));
},
resize: function(event, ui) {
self._trigger('resize', event, filteredUi(ui));
},
stop: function(event, ui) {
$(this).removeClass("ui-dialog-resizing");
options.height = $(this).height();
options.width = $(this).width();
self._trigger('resizeStop', event, filteredUi(ui));
$.ui.dialog.overlay.resize();
}
})
.css('position', position)
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
},
_minHeight: function() {
var options = this.options;
_position: function(position) {
var myAt = [],
offset = [0, 0],
isVisible;
if (position) {
// deep extending converts arrays to objects in jQuery <=
1.3.2 :-(
// if (typeof position == 'string' || $.isArray(position)) {
// myAt = $.isArray(position) ? position : position.split('
');
position = {
my: myAt.join(" "),
at: myAt.join(" "),
offset: offset.join(" ")
};
}
// need to show the dialog to get the actual offset in the position
plugin
isVisible = this.uiDialog.is(':visible');
if (!isVisible) {
this.uiDialog.show();
}
this.uiDialog
// workaround for jQuery bug #5781
http://dev.jquery.com/ticket/5781
.css({ top: 0, left: 0 })
.position($.extend({ of: window }, position));
if (!isVisible) {
this.uiDialog.hide();
}
},
if ( key in sizeRelatedOptions ) {
resize = true;
}
if ( key in resizableRelatedOptions ) {
resizableOptions[ key ] = value;
}
});
if ( resize ) {
this._size();
}
if ( this.uiDialog.is( ":data(resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
}
},
switch (key) {
//handling of deprecated beforeclose (vs beforeClose) option
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
//TODO: remove in 1.9pre
case "beforeclose":
key = "beforeClose";
break;
case "buttons":
self._createButtons(value);
break;
case "closeText":
// ensure that we always pass a string
self.uiDialogTitlebarCloseText.text("" + value);
break;
case "dialogClass":
uiDialog
.removeClass(self.options.dialogClass)
.addClass(uiDialogClasses + value);
break;
case "disabled":
if (value) {
uiDialog.addClass('ui-dialog-disabled');
} else {
uiDialog.removeClass('ui-dialog-disabled');
}
break;
case "draggable":
var isDraggable = uiDialog.is( ":data(draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
$.Widget.prototype._setOption.apply(self, arguments);
},
_size: function() {
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-
content
* divs will both have width and height set, so we need to reset them
*/
var options = this.options,
nonContentHeight,
minContentHeight,
isVisible = this.uiDialog.is( ":visible" );
if (this.uiDialog.is(':data(resizable)')) {
this.uiDialog.resizable('option', 'minHeight',
this._minHeight());
}
}
});
$.extend($.ui.dialog, {
version: "1.8.24",
uuid: 0,
maxZ: 0,
getTitleId: function($el) {
var id = $el.attr('id');
if (!id) {
this.uuid += 1;
id = this.uuid;
}
return 'ui-dialog-title-' + id;
},
overlay: function(dialog) {
this.$el = $.ui.dialog.overlay.create(dialog);
}
});
$.extend($.ui.dialog.overlay, {
instances: [],
// reuse old instances due to IE memory leak with alpha transparency (see
#5185)
oldInstances: [],
maxZ: 0,
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
function(event) { return event + '.dialog-overlay'; }).join(' '),
create: function(dialog) {
if (this.instances.length === 0) {
// prevent use of anchors and inputs
// we use a setTimeout in case the overlay is created from an
// event that we're going to be cancelling (see #2804)
setTimeout(function() {
// handle $(el).dialog().dialog('close') (see #4065)
if ($.ui.dialog.overlay.instances.length) {
$(document).bind($.ui.dialog.overlay.events,
function(event) {
// stop events if the z-index of the target is
< the z-index of the overlay
// we cannot return true when we don't want to
cancel the event (#3523)
if ($(event.target).zIndex() <
$.ui.dialog.overlay.maxZ) {
return false;
}
});
}
}, 1);
// allow closing by pressing the escape key
$(document).bind('keydown.dialog-overlay', function(event) {
if (dialog.options.closeOnEscape && !
event.isDefaultPrevented() && event.keyCode &&
event.keyCode === $.ui.keyCode.ESCAPE) {
dialog.close(event);
event.preventDefault();
}
});
if ($.fn.bgiframe) {
$el.bgiframe();
}
this.instances.push($el);
return $el;
},
destroy: function($el) {
var indexOf = $.inArray($el, this.instances);
if (indexOf != -1){
this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
}
if (this.instances.length === 0) {
$([document, window]).unbind('.dialog-overlay');
}
$el.remove();
height: function() {
var scrollHeight,
offsetHeight;
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
scrollHeight = Math.max(
document.documentElement.scrollHeight,
document.body.scrollHeight
);
offsetHeight = Math.max(
document.documentElement.offsetHeight,
document.body.offsetHeight
);
width: function() {
var scrollWidth,
offsetWidth;
// handle IE
if ( $.browser.msie ) {
scrollWidth = Math.max(
document.documentElement.scrollWidth,
document.body.scrollWidth
);
offsetWidth = Math.max(
document.documentElement.offsetWidth,
document.body.offsetWidth
);
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
* need to stretch the overlay. If the user then drags the
* dialog back to the left, the document will become narrower,
* so we need to shrink the overlay to the appropriate size.
* This is handled by shrinking the overlay before setting it
* to the full document size.
*/
var $overlays = $([]);
$.each($.ui.dialog.overlay.instances, function() {
$overlays = $overlays.add(this);
});
$overlays.css({
width: 0,
height: 0
}).css({
width: $.ui.dialog.overlay.width(),
height: $.ui.dialog.overlay.height()
});
}
});
$.extend($.ui.dialog.overlay.prototype, {
destroy: function() {
$.ui.dialog.overlay.destroy(this.$el);
}
});
}(jQuery));
(function( $, undefined ) {
if ( targetElem.nodeType === 9 ) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: 0, left: 0 };
// TODO: use $.isWindow() in 1.9
} else if ( targetElem.setTimeout ) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
} else if ( targetElem.preventDefault ) {
// force left top to allow flipping
options.at = "left top";
targetWidth = targetHeight = 0;
basePosition = { top: options.of.pageY, left: options.of.pageX };
} else {
targetWidth = target.outerWidth();
targetHeight = target.outerHeight();
basePosition = target.offset();
}
basePosition.left += offset[ 0 ];
basePosition.top += offset[ 1 ];
return this.each(function() {
var elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) ||
0,
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
collisionWidth = elemWidth + marginLeft +
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
collisionHeight = elemHeight + marginTop +
( parseInt( $.curCSS( this, "marginBottom", true ) ) ||
0 ),
position = $.extend( {}, basePosition ),
collisionPosition;
collisionPosition = {
left: position.left - marginLeft,
top: position.top - marginTop
};
if ( $.fn.bgiframe ) {
elem.bgiframe();
}
elem.offset( $.extend( position, { using: options.using } ) );
});
};
$.ui.position = {
fit: {
left: function( position, data ) {
var win = $( window ),
over = data.collisionPosition.left + data.collisionWidth -
win.width() - win.scrollLeft();
position.left = over > 0 ? position.left - over :
Math.max( position.left - data.collisionPosition.left, position.left );
},
top: function( position, data ) {
var win = $( window ),
over = data.collisionPosition.top + data.collisionHeight -
win.height() - win.scrollTop();
position.top = over > 0 ? position.top - over :
Math.max( position.top - data.collisionPosition.top, position.top );
}
},
flip: {
left: function( position, data ) {
if ( data.at[0] === center ) {
return;
}
var win = $( window ),
over = data.collisionPosition.left + data.collisionWidth -
win.width() - win.scrollLeft(),
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
data.my[ 0 ] === "right" ?
data.elemWidth :
0,
atOffset = data.at[ 0 ] === "left" ?
data.targetWidth :
-data.targetWidth,
offset = -2 * data.offset[ 0 ];
position.left += data.collisionPosition.left < 0 ?
myOffset + atOffset + offset :
over > 0 ?
myOffset + atOffset + offset :
0;
},
top: function( position, data ) {
if ( data.at[1] === center ) {
return;
}
var win = $( window ),
over = data.collisionPosition.top + data.collisionHeight -
win.height() - win.scrollTop(),
myOffset = data.my[ 1 ] === "top" ?
-data.elemHeight :
data.my[ 1 ] === "bottom" ?
data.elemHeight :
0,
atOffset = data.at[ 1 ] === "top" ?
data.targetHeight :
-data.targetHeight,
offset = -2 * data.offset[ 1 ];
position.top += data.collisionPosition.top < 0 ?
myOffset + atOffset + offset :
over > 0 ?
myOffset + atOffset + offset :
0;
}
}
};
// offset setter from jQuery 1.4
if ( !$.offset.setOffset ) {
$.offset.setOffset = function( elem, options ) {
// set position first, in-case top/left are set even on static elem
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
elem.style.position = "relative";
}
var curElem = $( elem ),
curOffset = curElem.offset(),
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
props = {
top: (options.top - curOffset.top) + curTop,
left: (options.left - curOffset.left) + curLeft
};
if ( 'using' in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
};
// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
if ( !$.curCSS ) {
$.curCSS = $.css;
}
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
}( jQuery ));
(function( $, undefined ) {
$.widget( "ui.progressbar", {
options: {
value: 0,
max: 100
},
min: 0,
_create: function() {
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-
all" )
.attr({
role: "progressbar",
"aria-valuemin": this.min,
"aria-valuemax": this.options.max,
"aria-valuenow": this._value()
});
this.oldValue = this._value();
this._refreshValue();
},
destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-
corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.valueDiv.remove();
_value: function() {
var val = this.options.value;
// normalize invalid value
if ( typeof val !== "number" ) {
val = 0;
}
return Math.min( this.options.max, Math.max( this.min, val ) );
},
_percentage: function() {
return 100 * this._value() / this.options.max;
},
_refreshValue: function() {
var value = this.value();
var percentage = this._percentage();
$.extend( $.ui.progressbar, {
version: "1.8.24"
});
})( jQuery );
(function( $, undefined ) {
widgetEventPrefix: "slide",
options: {
animate: false,
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: false,
step: 1,
value: 0,
values: null
},
_create: function() {
var self = this,
o = this.options,
existingHandles = this.element.find( ".ui-slider-
handle" ).addClass( "ui-state-default ui-corner-all" ),
handle = "<a class='ui-slider-handle ui-state-default ui-corner-
all' href='#'></a>",
handleCount = ( o.values && o.values.length ) || 1,
handles = [];
this._keySliding = false;
this._mouseSliding = false;
this._animateOff = true;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this.element
.addClass( "ui-slider" +
" ui-slider-" + this.orientation +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all" +
( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
this.range = $([]);
if ( o.range ) {
if ( o.range === true ) {
if ( !o.values ) {
o.values = [ this._valueMin(), this._valueMin() ];
}
if ( o.values.length && o.values.length !== 2 ) {
o.values = [ o.values[0], o.values[0] ];
}
}
this.range = $( "<div></div>" )
.appendTo( this.element )
.addClass( "ui-slider-range" +
// note: this isn't the most fittingly semantic framework
class for this element,
// but worked best visually with a variety of themes
" ui-widget-header" +
( ( o.range === "min" || o.range === "max" ) ? " ui-slider-
range-" + o.range : "" ) );
}
this.handles = existingHandles.add( $
( handles.join( "" ) ).appendTo( self.element ) );
this.handle = this.handles.eq( 0 );
this.handles
.keydown(function( event ) {
var index = $( this ).data( "index.ui-slider-handle" ),
allowed,
curVal,
newVal,
step;
if ( self.options.disabled ) {
return;
}
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_UP:
case $.ui.keyCode.PAGE_DOWN:
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
event.preventDefault();
if ( !self._keySliding ) {
self._keySliding = true;
$( this ).addClass( "ui-state-active" );
allowed = self._start( event, index );
if ( allowed === false ) {
return;
}
}
break;
}
step = self.options.step;
if ( self.options.values && self.options.values.length ) {
curVal = newVal = self.values( index );
} else {
curVal = newVal = self.value();
}
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
newVal = self._valueMin();
break;
case $.ui.keyCode.END:
newVal = self._valueMax();
break;
case $.ui.keyCode.PAGE_UP:
newVal = self._trimAlignValue( curVal +
( (self._valueMax() - self._valueMin()) / numPages ) );
break;
case $.ui.keyCode.PAGE_DOWN:
newVal = self._trimAlignValue( curVal -
( (self._valueMax() - self._valueMin()) / numPages ) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
if ( curVal === self._valueMax() ) {
return;
}
newVal = self._trimAlignValue( curVal + step );
break;
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
if ( curVal === self._valueMin() ) {
return;
}
newVal = self._trimAlignValue( curVal - step );
break;
}
if ( self._keySliding ) {
self._keySliding = false;
self._stop( event, index );
self._change( event, index );
$( this ).removeClass( "ui-state-active" );
}
});
this._refreshValue();
this._animateOff = false;
},
destroy: function() {
this.handles.remove();
this.range.remove();
this.element
.removeClass( "ui-slider" +
" ui-slider-horizontal" +
" ui-slider-vertical" +
" ui-slider-disabled" +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all" )
.removeData( "slider" )
.unbind( ".slider" );
this._mouseDestroy();
return this;
},
if ( o.disabled ) {
return false;
}
this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset = this.element.offset();
self._handleIndex = index;
closestHandle
.addClass( "ui-state-active" )
.focus();
offset = closestHandle.offset();
mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-
slider-handle" );
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
top: event.pageY - offset.top -
( closestHandle.height() / 2 ) -
( parseInt( closestHandle.css("borderTopWidth"), 10 ) ||
0 ) -
( parseInt( closestHandle.css("borderBottomWidth"), 10 ) ||
0) +
( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
};
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
this._slide( event, index, normValue );
}
this._animateOff = true;
return true;
},
return false;
},
this._handleIndex = null;
this._clickOffset = null;
this._animateOff = false;
return false;
},
_detectOrientation: function() {
this.orientation = ( this.options.orientation === "vertical" ) ?
"vertical" : "horizontal";
},
return this._value();
},
if ( arguments.length > 1 ) {
this.options.values[ index ] = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, index );
return;
}
if ( arguments.length ) {
if ( $.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( newValues[ i ] );
this._change( null, i );
}
this._refreshValue();
} else {
if ( this.options.values && this.options.values.length ) {
return this._values( index );
} else {
return this.value();
}
}
} else {
return this._values();
}
},
if ( $.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
switch ( key ) {
case "disabled":
if ( value ) {
this.handles.filter( ".ui-state-focus" ).blur();
this.handles.removeClass( "ui-state-hover" );
this.handles.propAttr( "disabled", true );
this.element.addClass( "ui-disabled" );
} else {
this.handles.propAttr( "disabled", false );
this.element.removeClass( "ui-disabled" );
}
break;
case "orientation":
this._detectOrientation();
this.element
.removeClass( "ui-slider-horizontal ui-slider-
vertical" )
.addClass( "ui-slider-" + this.orientation );
this._refreshValue();
break;
case "value":
this._animateOff = true;
this._refreshValue();
this._change( null, 0 );
this._animateOff = false;
break;
case "values":
this._animateOff = true;
this._refreshValue();
for ( i = 0; i < valsLength; i += 1 ) {
this._change( null, i );
}
this._animateOff = false;
break;
}
},
return val;
},
if ( arguments.length ) {
val = this.options.values[ index ];
val = this._trimAlignValue( val );
return val;
} else {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
for ( i = 0; i < vals.length; i+= 1) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
return vals;
}
},
// returns the step-aligned value that val is closest to, between (inclusive)
min and max
_trimAlignValue: function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = (val - this._valueMin()) % step,
alignValue = val - valModStep;
_valueMin: function() {
return this.options.min;
},
_valueMax: function() {
return this.options.max;
},
_refreshValue: function() {
var oRange = this.options.range,
o = this.options,
self = this,
animate = ( !this._animateOff ) ? o.animate : false,
valPercent,
_set = {},
lastValPercent,
value,
valueMin,
valueMax;
});
$.extend( $.ui.slider, {
version: "1.8.24"
});
}(jQuery));
(function( $, undefined ) {
var tabId = 0,
listId = 0;
function getNextTabId() {
return ++tabId;
}
function getNextListId() {
return ++listId;
}
$.widget( "ui.tabs", {
options: {
add: null,
ajaxOptions: null,
cache: false,
cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com',
secure: true }
collapsible: false,
disable: null,
disabled: [],
enable: null,
event: "click",
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration:
200 }
idPrefix: "ui-tabs-",
load: null,
panelTemplate: "<div></div>",
remove: null,
select: null,
show: null,
spinner: "<em>Loading…</em>",
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
},
_create: function() {
this._tabify( true );
},
_tabId: function( a ) {
return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\
uFFFF-]/g, "" ) ||
this.options.idPrefix + getNextTabId();
},
_cookie: function() {
var cookie = this.cookie ||
( this.cookie = this.options.cookie.name || "ui-tabs-" +
getNextListId() );
return $.cookie.apply( null,
[ cookie ].concat( $.makeArray( arguments ) ) );
},
_cleanup: function() {
// restore all former loading tabs labels
this.lis.filter( ".ui-state-processing" )
.removeClass( "ui-state-processing" )
.find( "span:data(label.tabs)" )
.each(function() {
var el = $( this );
this.anchors.each(function( i, a ) {
var href = $( a ).attr( "href" );
// For dynamically created HTML that contains a hash as href IE <
8 expands
// such href to the full page url with hash and then
misinterprets tab as ajax.
// Same consideration applies for an added tab with a fragment
identifier
// since a[href=#fragment-identifier] does unexpectedly not
match.
// Thus normalize href attribute...
var hrefBase = href.split( "#" )[ 0 ],
baseEl;
if ( hrefBase && ( hrefBase === location.toString().split( "#" )[
0 ] ||
( baseEl = $( "base" )[ 0 ]) && hrefBase ===
baseEl.href ) ) {
href = a.hash;
a.href = href;
}
// inline tab
if ( fragmentId.test( href ) ) {
self.panels =
self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
// remote tab
// prevent loading the page itself if href is just "#"
} else if ( href && href !== "#" ) {
// required for restore on destroy
$.data( a, "href.tabs", href );
var id = self._tabId( a );
a.href = "#" + id;
var $panel = self.element.find( "#" + id );
if ( !$panel.length ) {
$panel = $( o.panelTemplate )
.attr( "id", id )
.addClass( "ui-tabs-panel ui-widget-content ui-
corner-bottom" )
.insertAfter( self.panels[ i - 1 ] || self.list
);
$panel.data( "destroy.tabs", true );
}
self.panels = self.panels.add( $panel );
// invalid tab href
} else {
o.disabled.push( i );
}
});
// Selected tab
// use "selected" option or try to retrieve:
// 1. from fragment identifier in url
// 2. from cookie
// 3. from selected class attribute on <li>
if ( o.selected === undefined ) {
if ( location.hash ) {
this.anchors.each(function( i, a ) {
if ( a.hash == location.hash ) {
o.selected = i;
return false;
}
});
}
if ( typeof o.selected !== "number" && o.cookie ) {
o.selected = parseInt( self._cookie(), 10 );
}
if ( typeof o.selected !== "number" &&
this.lis.filter( ".ui-tabs-selected" ).length ) {
o.selected = this.lis.index( this.lis.filter( ".ui-
tabs-selected" ) );
}
o.selected = o.selected || ( this.lis.length ? 0 : -1 );
} else if ( o.selected === null ) { // usage of null is
deprecated, TODO remove in next release
o.selected = -1;
}
this.load( o.selected );
}
// clean up to avoid memory leaks in certain versions of IE 6
// TODO: namespace this event
$( window ).bind( "unload", function() {
self.lis.add( self.anchors ).unbind( ".tabs" );
self.lis = self.anchors = self.panels = null;
});
// update selected after add/remove
} else {
o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected"
) );
}
// update collapsible
// TODO: use .toggleClass()
this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-
collapsible" );
// disable tabs
for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
$( li )[ $.inArray( i, o.disabled ) != -1 &&
// TODO: use .toggleClass()
!$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" :
"removeClass" ]( "ui-state-disabled" );
}
// remove all handlers before, tabify may run on existing tabs after
add or option change
this.lis.add( this.anchors ).unbind( ".tabs" );
// set up animations
var hideFx, showFx;
if ( o.fx ) {
if ( $.isArray( o.fx ) ) {
hideFx = o.fx[ 0 ];
showFx = o.fx[ 1 ];
} else {
hideFx = showFx = o.fx;
}
}
// Show a tab...
var showTab = showFx
? function( clicked, $show ) {
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected
ui-state-active" );
$show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker
that way
.animate( showFx, showFx.duration || "normal",
function() {
resetStyle( $show, showFx );
self._trigger( "show", null, self._ui( clicked,
$show[ 0 ] ) );
});
}
: function( clicked, $show ) {
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected
ui-state-active" );
$show.removeClass( "ui-tabs-hide" );
self._trigger( "show", null, self._ui( clicked,
$show[ 0 ] ) );
};
self.abort();
if ( o.cookie ) {
self._cookie( o.selected, o.cookie );
}
this.blur();
return false;
} else if ( !$hide.length ) {
if ( o.cookie ) {
self._cookie( o.selected, o.cookie );
}
this.blur();
return false;
}
}
if ( o.cookie ) {
self._cookie( o.selected, o.cookie );
}
return index;
},
destroy: function() {
var o = this.options;
this.abort();
this.element
.unbind( ".tabs" )
.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all
ui-tabs-collapsible" )
.removeData( "tabs" );
this.anchors.each(function() {
var href = $.data( this, "href.tabs" );
if ( href ) {
this.href = href;
}
var $this = $( this ).unbind( ".tabs" );
$.each( [ "href", "load", "cache" ], function( i, prefix ) {
$this.removeData( prefix + ".tabs" );
});
});
if ( o.cookie ) {
this._cookie( null, o.cookie );
}
return this;
},
this._tabify();
if ( this.anchors.length == 1 ) {
o.selected = 0;
$li.addClass( "ui-tabs-selected ui-state-active" );
$panel.removeClass( "ui-tabs-hide" );
this.element.queue( "tabs", function() {
self._trigger( "show", null, self._ui( self.anchors[ 0 ],
self.panels[ 0 ] ) );
});
this.load( 0 );
}
o.disabled = $.map(
$.grep( o.disabled, function(n, i) {
return n != index;
}),
function( n, i ) {
return n >= index ? --n : n;
});
this._tabify();
o.disabled.push( index );
o.disabled.sort();
return this;
},
this.abort();
if ( o.spinner ) {
var span = $( "span", a );
span.data( "label.tabs", span.html() ).html( o.spinner );
}
if ( o.cache ) {
$.data( a, "cache.tabs", true );
}
return this;
},
abort: function() {
// stop possibly running animations
this.element.queue( [] );
this.panels.stop( false, true );
length: function() {
return this.anchors.length;
}
});
$.extend( $.ui.tabs, {
version: "1.8.24"
});
/*
* Tabs Extensions
*/
/*
* Rotate
*/
$.extend( $.ui.tabs.prototype, {
rotation: null,
rotate: function( ms, continuing ) {
var self = this,
o = this.options;
if ( e ) {
e.stopPropagation();
}
});
// start rotation
if ( ms ) {
this.element.bind( "tabsshow", rotate );
this.anchors.bind( o.event + ".tabs", stop );
rotate();
// stop rotation
} else {
clearTimeout( self.rotation );
this.element.unbind( "tabsshow", rotate );
this.anchors.unbind( o.event + ".tabs", stop );
delete this._rotate;
delete this._unrotate;
}
return this;
}
});
})( jQuery );