*
* http://docs.jquery.com/UI/Effects/
*/
-;jQuery.effects || (function($, undefined) {
+;(jQuery.effects || (function($, undefined) {
-var backCompat = $.uiBackCompat !== false;
+var backCompat = $.uiBackCompat !== false,
+ // prefix used for storing data on .data()
+ dataSpace = "ui-effects-";
$.effects = {
effect: {}
/******************************************************************************/
/****************************** COLOR ANIMATIONS ******************************/
/******************************************************************************/
+(function() {
// override the animation for color styles
$.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
var result;
// Check if we're already dealing with an array of colors
- if ( color && color.constructor === Array && color.length === 3 )
- return color;
+ if ( color && color.constructor === Array && color.length === 3 ) {
+ return color;
+ }
// Look for rgb(num,num,num)
- if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
- return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+ return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+ }
// Look for rgb(num%,num%,num%)
- if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
- return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+ }
// Look for #a0b1c2
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
- return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+ }
// Look for #fff
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
- return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+ }
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
- return colors["transparent"];
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
+ return colors.transparent;
+ }
// Otherwise, we're most likely dealing with a named color
return colors[$.trim(color).toLowerCase()];
color = $.css(elem, attr);
// Keep going until we find an element that has color, or we hit the body
- if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") )
- break;
+ if ( color && color !== "transparent" || $.nodeName(elem, "body") ) {
+ break;
+ }
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
-};
+}
// Some named colors to work with
// From Interface by Stefan Petre
transparent: [255,255,255]
};
-
+})();
/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
+(function() {
var classAnimationActions = [ "add", "remove", "toggle" ],
shorthandStyles = {
borderWidth: 1,
margin: 1,
padding: 1
- },
- // prefix used for storing data on .data()
- dataSpace = "ui-effects-";
+ };
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
$.fx.step[ prop ] = function( fx ) {
for ( name in newStyle ) {
value = newStyle[ name ];
- if ( oldStyle[ name ] != value ) {
+ if ( oldStyle[ name ] !== value ) {
if ( !shorthandStyles[ name ] ) {
if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
diff[ name ] = value;
}
});
-
+})();
/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
+(function() {
+
$.extend( $.effects, {
version: "@VERSION",
setTransition: function( element, list, factor, value ) {
value = value || {};
- $.each( list, function(i, x){
+ $.each( list, function( i, x ) {
var unit = element.cssUnit( x );
- if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+ if ( unit[ 0 ] > 0 ) {
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+ }
});
return value;
}
val = [];
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
- if ( style.indexOf( unit ) > 0 )
+ if ( style.indexOf( unit ) > 0 ) {
val = [ parseFloat( style ), unit ];
+ }
});
return val;
}
});
-
+})();
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
+(function() {
+
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings = {};
};
});
-})(jQuery);
+})();
+
+})(jQuery));
// loop
i, j, left, top, mx, my;
+ // children animate complete:
+ function childComplete() {
+ pieces.push( this );
+ if ( pieces.length === rows * cells ) {
+ animComplete();
+ }
+ }
+
// clone the element for each row and cell.
for( i = 0; i < rows ; i++ ) { // ===>
top = offset.top + i * height;
}
}
- // children animate complete:
- function childComplete() {
- pieces.push( this );
- if ( pieces.length == rows * cells ) {
- animComplete();
- }
- }
-
function animComplete() {
el.css({
visibility: "visible"
size = o.size || 15,
percent = /([0-9]+)%/.exec( size ),
horizFirst = !!o.horizFirst,
- widthFirst = show != horizFirst,
+ widthFirst = show !== horizFirst,
ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
duration = o.duration / 2,
wrapper, distance,
- animation1 = {}, animation2 = {};
+ animation1 = {},
+ animation2 = {};
$.effects.save( el, props );
el.show();
var el = $( this ),
options = $.extend( true, {}, o ),
mode = $.effects.setMode( el, o.mode || "effect" ),
- percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ),
+ percent = parseInt( o.percent, 10 ) ||
+ ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
direction = o.direction || "both",
origin = o.origin,
original = {
outerWidth: el.outerWidth()
},
factor = {
- y: direction != "horizontal" ? (percent / 100) : 1,
- x: direction != "vertical" ? (percent / 100) : 1
+ y: direction !== "horizontal" ? (percent / 100) : 1,
+ x: direction !== "vertical" ? (percent / 100) : 1
};
// We are going to pass this effect to the size effect:
options.complete = done;
// Set default origin and restore for show/hide
- if ( mode != "effect" ) {
+ if ( mode !== "effect" ) {
options.origin = origin || ["middle","center"];
options.restore = true;
}
- options.from = o.from || ( mode == "show" ? { height: 0, width: 0 } : original );
+ options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original );
options.to = {
height: original.height * factor.y,
width: original.width * factor.x,
// Fade option to support puff
if ( options.fade ) {
- if ( mode == "show" ) {
+ if ( mode === "show" ) {
options.from.opacity = 0;
options.to.opacity = 1;
}
- if ( mode == "hide" ) {
+ if ( mode === "hide" ) {
options.from.opacity = 1;
options.to.opacity = 0;
}
};
// Scale the css box
- if ( scale == "box" || scale == "both" ) {
+ if ( scale === "box" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
}
// Scale the content
- if ( scale == "content" || scale == "both" ) {
+ if ( scale === "content" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
el.css( el.from ); // set top & left
// Animate
- if ( scale == "content" || scale == "both" ) { // Scale the children
+ if ( scale === "content" || scale === "both" ) { // Scale the children
// Add margins/font-size
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
height: child.height(),
width: child.width()
};
- if (restore) $.effects.save(child, props2);
-
+ if (restore) {
+ $.effects.save(child, props2);
+ }
+
child.from = {
height: c_original.height * factor.from.y,
width: c_original.width * factor.from.x
};
// Vertical props scaling
- if ( factor.from.y != factor.to.y ) {
+ if ( factor.from.y !== factor.to.y ) {
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
}
// Horizontal props scaling
- if ( factor.from.x != factor.to.x ) {
+ if ( factor.from.x !== factor.to.x ) {
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
}
child.animate( child.to, o.duration, o.easing, function() {
// Restore children
- if (restore) $.effects.restore( child, props2 );
+ if ( restore ) {
+ $.effects.restore( child, props2 );
+ }
});
});
}
if ( el.to.opacity === 0 ) {
el.css( "opacity", el.from.opacity );
}
- if( mode == "hide" ) {
+ if( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, restore ? props : props1 );
times = o.times || 3,
anims = times * 2 + 1,
speed = o.duration,
- ref = (direction == "up" || direction == "down") ? "top" : "left",
- positiveMotion = (direction == "up" || direction == "left"),
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
animation = {},
animation1 = {},
animation2 = {},
// we will need to re-assemble the queue to stack our animations in place
queue = el.queue(),
queuelen = queue.length;
-
$.effects.save( el, props );
el.show();
mode = $.effects.setMode( el, o.mode || "show" ),
show = mode === "show",
direction = o.direction || "left",
- ref = (direction == "up" || direction == "down") ? "top" : "left",
- positiveMotion = (direction == "up" || direction == "left"),
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
distance,
animation = {},
size;
* jquery.ui.widget.js
*/
(function( $, undefined ) {
- var uid = 0;
+ var uid = 0,
+ hideProps = {},
+ showProps = {},
+ showPropsAdjust = {};
+
+hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
+showProps.height = showProps.paddingTop = showProps.paddingBottom =
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
+$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } );
+
+$.fx.step.accordionHeight = function( fx ) {
+ var elem = $( fx.elem ),
+ data = elem.data( "ui-accordion-height" );
+ elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() );
+};
$.widget( "ui.accordion", {
version: "@VERSION",
},
_destroy: function() {
- var accordionId = this.accordionId;
+ var contents,
+ accordionId = this.accordionId;
// clean up main element
this.element
this._destroyIcons();
// clean up content panels
- var contents = this.headers.next()
+ contents = this.headers.next()
.css( "display", "" )
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
}
});
-$.fx.step.accordionHeight = function( fx ) {
- var elem = $( fx.elem ),
- data = elem.data( "ui-accordion-height" );
- elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() );
-};
-var hideProps = {},
- showProps = {},
- showPropsAdjust = {};
-hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
- hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
-showProps.height = showProps.paddingTop = showProps.paddingBottom =
- showProps.borderTopWidth = showProps.borderBottomWidth = "show";
-$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } );
-
// DEPRECATED
-/*!
+/*
* jQuery UI Autocomplete @VERSION
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
suppressKeyPress = true;
event.preventDefault();
}
- // passthrough - ENTER and TAB both select the current element
+ //passthrough - ENTER and TAB both select the current element
case keyCode.TAB:
if ( !self.menu.active ) {
return;
select: function( event, ui ) {
// back compat for _renderItem using item.autocomplete, via #7810
// TODO remove the fallback, see #8156
- var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
previous = self.previous;
// only trigger when focus was lost (click on menu)
.data( "menu" );
if ( $.fn.bgiframe ) {
- this.menu.element.bgiframe();
+ this.menu.element.bgiframe();
}
// turning off autocomplete prevents the browser from remembering the
if ( options.disabled ) {
return false;
}
- if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
$( this ).addClass( "ui-state-active" );
}
})
},
_determineButtonType: function() {
+ var ancestor, labelSelector, checked;
if ( this.element.is(":checkbox") ) {
this.type = "checkbox";
if ( this.type === "checkbox" || this.type === "radio" ) {
// we don't search against the document in case the element
// is disconnected from the DOM
- var ancestor = this.element.parents().last(),
- labelSelector = "label[for='" + this.element.attr("id") + "']";
+ ancestor = this.element.parents().last();
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
this.buttonElement = ancestor.find( labelSelector );
if ( !this.buttonElement.length ) {
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
}
this.element.addClass( "ui-helper-hidden-accessible" );
- var checked = this.element.is( ":checked" );
+ checked = this.element.is( ":checked" );
if ( checked ) {
this.buttonElement.addClass( "ui-state-active" );
}
// selectors
function focusable( element, isTabIndexNotNaN ) {
- var nodeName = element.nodeName.toLowerCase();
+ var map, mapName, img,
+ nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
- var map = element.parentNode,
- mapName = map.name,
- img;
+ map = element.parentNode;
+ mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
}
return ( /input|select|textarea|button|object/.test( nodeName ) ?
!element.disabled :
- "a" == nodeName ?
+ "a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) &&
// the element and all of its ancestors must be visible
// $.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 ) {
+ var i,
+ proto = $.ui[ module ].prototype;
+ for ( 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 ];
+ var i,
+ set = instance.plugins[ name ];
if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
return;
}
- for ( var i = 0; i < set.length; i++ ) {
+ for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
},
close: function( event ) {
- if ( !this._isOpen ) {
- return self;
- }
-
var self = this,
maxZ, thisZ;
+ if ( !this._isOpen ) {
+ return;
+ }
+
if ( false === self._trigger( "beforeClose", event ) ) {
return;
}
return;
}
- var self = this,
+ var hasFocus,
+ self = this,
options = self.options,
uiDialog = self.uiDialog;
// 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
- var hasFocus = self.element.find( ":tabbable" );
+ hasFocus = self.element.find( ":tabbable" );
if ( !hasFocus.length ) {
hasFocus = uiDialog.find( ".ui-dialog-buttonpane :tabbable" );
if ( !hasFocus.length ) {
},
_createButtons: function( buttons ) {
- var self = this,
+ var uiDialogButtonPane, uiButtonSet,
+ self = this,
hasButtons = false;
// if we already have a button pane, remove it
});
}
if ( hasButtons ) {
- var uiDialogButtonPane = $( "<div>" )
- .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
- uiButtonSet = $( "<div>" )
- .addClass( "ui-dialog-buttonset" )
- .appendTo( uiDialogButtonPane );
+ uiDialogButtonPane = $( "<div>" )
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+ uiButtonSet = $( "<div>" )
+ .addClass( "ui-dialog-buttonset" )
+ .appendTo( uiDialogButtonPane );
$.each( buttons, function( name, props ) {
props = $.isFunction( props ) ?
},
_setOption: function( key, value ) {
- var self = this,
+ var isDraggable, isResizable,
+ self = this,
uiDialog = self.uiDialog;
switch ( key ) {
}
break;
case "draggable":
- var isDraggable = uiDialog.is( ":data(draggable)" );
+ isDraggable = uiDialog.is( ":data(draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
break;
case "resizable":
// currently resizable, becoming non-resizable
- var isResizable = uiDialog.is( ":data(resizable)" );
+ isResizable = uiDialog.is( ":data(resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
/* 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,
+ var nonContentHeight, minContentHeight, autoHeight,
+ options = this.options,
isVisible = this.uiDialog.is( ":visible" );
// reset content sizing
});
} else {
this.uiDialog.show();
- var autoHeight = this.element.css( "height", "auto" ).height();
+ autoHeight = this.element.css( "height", "auto" ).height();
if ( !isVisible ) {
this.uiDialog.hide();
}
},
destroy: function( $el ) {
- var indexOf = $.inArray( $el, this.instances );
+ var indexOf = $.inArray( $el, this.instances ),
+ maxZ = 0;
+
if ( indexOf !== -1 ) {
this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
}
$el.height( 0 ).width( 0 ).remove();
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
- var maxZ = 0;
$.each( this.instances, function() {
maxZ = Math.max( maxZ, this.css( "z-index" ) );
});
"mouseleave": "collapseAll",
"mouseleave .ui-menu": "collapseAll",
"focus": function( event ) {
- var firstItem = this.element.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
+ var menu = this.element,
+ firstItem = menu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
if ( this._hasScroll() && !this.active ) {
- var menu = this.element;
menu.children().each( function() {
var currentItem = $( this );
if ( currentItem.offset().top - menu.offset().top >= 0 ) {
character = String.fromCharCode( event.keyCode ),
skip = false;
- if (character == prev) {
+ if (character === prev) {
skip = true;
} else {
character = prev + character;
return new RegExp("^" + escape(character), "i")
.test( $( this ).children( "a" ).text() );
});
- match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match;
+ match = skip && match.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : match;
if ( !match.length ) {
character = String.fromCharCode(event.keyCode);
match = this.activeMenu.children(".ui-menu-item").filter( function() {
refresh: function() {
// initialize nested menus
- var submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
- .attr( "role", "menu" )
- .hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" );
+ var menuId,
+ submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: "menu",
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ });
// don't refresh list items that are already adapted
- var menuId = this.menuId;
+ menuId = this.menuId;
submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
},
focus: function( event, item ) {
+ var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
this.blur( event );
if ( this._hasScroll() ) {
- var borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0,
- paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0,
- offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
- scroll = this.activeMenu.scrollTop(),
- elementHeight = this.activeMenu.height(),
- itemHeight = item.height();
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.height();
if ( offset < 0 ) {
this.activeMenu.scrollTop( scroll + offset );
this._close();
}, this.delay );
- var nested = $( "> .ui-menu", item );
+ nested = $( "> .ui-menu", item );
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
this._startOpening(nested);
}
var position = $.extend({}, {
of: this.active
- }, $.type(this.options.position) == "function" ?
+ }, $.type(this.options.position) === "function" ?
this.options.position(this.active) :
this.options.position
);
this._mouseDownEvent = event;
var that = this,
- btnIsLeft = (event.which == 1),
+ btnIsLeft = (event.which === 1),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
- elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
return true;
}
if (this._mouseStarted) {
this._mouseStarted = false;
- if (event.target == this._mouseDownEvent.target) {
+ if (event.target === this._mouseDownEvent.target) {
$.data(event.target, this.widgetName + '.preventClickEvent', true);
}
},
_refreshValue: function() {
- var value = this.value();
- var percentage = this._percentage();
+ var value = this.value(),
+ percentage = this._percentage();
if ( this.oldValue !== value ) {
this.oldValue = value;
},
_create: function() {
- var self = this,
+ var i,
+ 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>",
( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
}
- for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
handles.push( handle );
}
return ++tabId;
}
-var isLocal = function( anchor ) {
+function isLocal( anchor ) {
// clone the node to work around IE 6 not normalizing the href property
// if it's manually set, i.e., a.href = "#foo" kills the normalization
anchor = anchor.cloneNode( false );
return anchor.hash.length > 1 &&
anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
-};
+}
$.widget( "ui.tabs", {
version: "@VERSION",
},
_create: function() {
- var that = this,
+ var panel,
+ that = this,
options = that.options,
active = options.active;
// check for length avoids error when initializing empty list
if ( options.active !== false && this.anchors.length ) {
this.active = this._findActive( options.active );
- var panel = that._getPanelForTab( this.active );
+ panel = that._getPanelForTab( this.active );
panel.show();
this.lis.eq( options.active ).addClass( "ui-tabs-active ui-state-active" );
},
_setOption: function( key, value ) {
- if ( key == "active" ) {
+ if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
},
refresh: function() {
- var self = this,
+ var next,
+ self = this,
options = this.options,
lis = this.list.children( ":has(a[href])" );
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.list[ 0 ], this.active[ 0 ] ) ) {
// activate previous tab
- var next = options.active - 1;
+ next = options.active - 1;
this._activate( next >= 0 ? next : 0 );
// was active, active tab still exists
} else {
this.panels = $( [] );
this.anchors.each(function( i, a ) {
- var selector, panel;
+ var selector, panel, id;
// inline tab
if ( isLocal( a ) ) {
panel = self.element.find( self._sanitizeSelector( selector ) );
// remote tab
} else {
- var id = self._tabId( a );
+ id = self._tabId( a );
selector = "#" + id;
panel = self.element.find( selector );
if ( !panel.length ) {
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
// also sanitizes numerical indexes to valid values.
- if ( typeof index == "string" ) {
+ if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
}
index = this.anchors.length;
}
- var options = this.options,
+ var doInsertAfter, panel,
+ options = this.options,
li = $( options.tabTemplate
.replace( /#\{href\}/g, url )
.replace( /#\{label\}/g, label ) ),
li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
li.find( "a" ).attr( "aria-controls", id );
- var doInsertAfter = index >= this.lis.length;
+ doInsertAfter = index >= this.lis.length;
// try to find an existing element before creating a new one
- var panel = this.element.find( "#" + id );
+ panel = this.element.find( "#" + id );
if ( !panel.length ) {
panel = this._createPanel( id );
if ( doInsertAfter ) {
});
// cookie option
+ (function() {
+
var listId = 0;
$.widget( "ui.tabs", $.ui.tabs, {
}
});
+ })();
+
// load event
$.widget( "ui.tabs", $.ui.tabs, {
_trigger: function( type, event, data ) {
mouseleave: "close",
focusout: "close",
keyup: function( event ) {
- if ( event.keyCode == $.ui.keyCode.ESCAPE ) {
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
fakeEvent.currentTarget = target[0];
this.close( fakeEvent, true );
*/
(function( $, undefined ) {
-var slice = Array.prototype.slice;
-
-var _cleanData = $.cleanData;
+var slice = Array.prototype.slice,
+ _cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
if ( $.isFunction( value ) ) {
prototype[ prop ] = (function() {
var _super = function() {
- return base.prototype[ prop ].apply( this, arguments );
- };
- var _superApply = function( args ) {
- return base.prototype[ prop ].apply( this, args );
- };
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
return function() {
var __super = this._super,
__superApply = this._superApply,
if ( isMethodCall ) {
this.each(function() {
- var instance = $.data( this, fullName );
+ var methodValue,
+ instance = $.data( this, fullName );
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
- var methodValue = instance[ options ].apply( instance, args );
+ methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :