diff options
Diffstat (limited to 'ui')
38 files changed, 451 insertions, 277 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-de.js b/ui/i18n/jquery.ui.datepicker-de.js index 52d6c82ce..cfe91759b 100644 --- a/ui/i18n/jquery.ui.datepicker-de.js +++ b/ui/i18n/jquery.ui.datepicker-de.js @@ -13,7 +13,7 @@ jQuery(function($){ dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], - weekHeader: 'Wo', + weekHeader: 'KW', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, diff --git a/ui/i18n/jquery.ui.datepicker-fa.js b/ui/i18n/jquery.ui.datepicker-fa.js index 1d7fbd23c..be8acd2a5 100644 --- a/ui/i18n/jquery.ui.datepicker-fa.js +++ b/ui/i18n/jquery.ui.datepicker-fa.js @@ -4,15 +4,51 @@ jQuery(function($) { $.datepicker.regional['fa'] = { closeText: 'بستن', - prevText: '<قبلي', - nextText: 'بعدي>', + prevText: '<قبلی', + nextText: 'بعدی>', currentText: 'امروز', - monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور', - 'مهر','آبان','آذر','دي','بهمن','اسفند'], + monthNames: [ + 'فروردين', + 'ارديبهشت', + 'خرداد', + 'تير', + 'مرداد', + 'شهريور', + 'مهر', + 'آبان', + 'آذر', + 'دی', + 'بهمن', + 'اسفند' + ], monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], - dayNames: ['يکشنبه','دوشنبه','سهشنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'], - dayNamesShort: ['ي','د','س','چ','پ','ج', 'ش'], - dayNamesMin: ['ي','د','س','چ','پ','ج', 'ش'], + dayNames: [ + 'يکشنبه', + 'دوشنبه', + 'سهشنبه', + 'چهارشنبه', + 'پنجشنبه', + 'جمعه', + 'شنبه' + ], + dayNamesShort: [ + 'ی', + 'د', + 'س', + 'چ', + 'پ', + 'ج', + 'ش' + ], + dayNamesMin: [ + 'ی', + 'د', + 'س', + 'چ', + 'پ', + 'ج', + 'ش' + ], weekHeader: 'هف', dateFormat: 'yy/mm/dd', firstDay: 6, diff --git a/ui/i18n/jquery.ui.datepicker-ge.js b/ui/i18n/jquery.ui.datepicker-ge.js new file mode 100644 index 000000000..10d4e5851 --- /dev/null +++ b/ui/i18n/jquery.ui.datepicker-ge.js @@ -0,0 +1,21 @@ +/* Georgian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Lado Lomidze (lado.lomidze@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ge'] = { + closeText: 'დახურვა', + prevText: '< წინა', + nextText: 'შემდეგი >', + currentText: 'დღეს', + monthNames: ['იანვარი','თებერვალი','მარტი','აპრილი','მაისი','ივნისი', 'ივლისი','აგვისტო','სექტემბერი','ოქტომბერი','ნოემბერი','დეკემბერი'], + monthNamesShort: ['იან','თებ','მარ','აპრ','მაი','ივნ', 'ივლ','აგვ','სექ','ოქტ','ნოე','დეკ'], + dayNames: ['კვირა','ორშაბათი','სამშაბათი','ოთხშაბათი','ხუთშაბათი','პარასკევი','შაბათი'], + dayNamesShort: ['კვ','ორშ','სამ','ოთხ','ხუთ','პარ','შაბ'], + dayNamesMin: ['კვ','ორშ','სამ','ოთხ','ხუთ','პარ','შაბ'], + weekHeader: 'კვირა', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ge']); +}); diff --git a/ui/i18n/jquery.ui.datepicker-mk.js b/ui/i18n/jquery.ui.datepicker-mk.js index 1e602427a..028532551 100644 --- a/ui/i18n/jquery.ui.datepicker-mk.js +++ b/ui/i18n/jquery.ui.datepicker-mk.js @@ -6,9 +6,9 @@ jQuery(function($){ prevText: '<', nextText: '>', currentText: 'Денес', - monthNames: ['Јануари','Фебруари','Март','Април','Мај','Јуни', + monthNames: ['Јануари','Февруари','Март','Април','Мај','Јуни', 'Јули','Август','Септември','Октомври','Ноември','Декември'], - monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун', + monthNamesShort: ['Јан','Фев','Мар','Апр','Мај','Јун', 'Јул','Авг','Сеп','Окт','Ное','Дек'], dayNames: ['Недела','Понеделник','Вторник','Среда','Четврток','Петок','Сабота'], dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'], diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index a5e0d1c8b..005b59ad6 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Blind @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index 73fe3c502..94d73644e 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Bounce @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index 983ac9c53..861508cd0 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Clip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 24df7178c..626ab1a89 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -7,9 +7,11 @@ * * 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: {} @@ -18,6 +20,7 @@ $.effects = { /******************************************************************************/ /****************************** COLOR ANIMATIONS ******************************/ /******************************************************************************/ +(function() { // override the animation for color styles $.each(["backgroundColor", "borderBottomColor", "borderLeftColor", @@ -46,28 +49,34 @@ function getRGB(color) { 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()]; @@ -80,14 +89,15 @@ function getColor(elem, attr) { 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 @@ -140,11 +150,12 @@ var colors = { transparent: [255,255,255] }; - +})(); /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ +(function() { var classAnimationActions = [ "add", "remove", "toggle" ], shorthandStyles = { @@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ], 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 ) { @@ -171,9 +180,9 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS }); function getElementStyles() { - var style = this.ownerDocument.defaultView - ? this.ownerDocument.defaultView.getComputedStyle( this, null ) - : this.currentStyle, + var style = this.ownerDocument.defaultView ? + this.ownerDocument.defaultView.getComputedStyle( this, null ) : + this.currentStyle, newStyle = {}, key, camelCase, @@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) { 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; @@ -332,12 +341,14 @@ $.fn.extend({ } }); - +})(); /******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/ +(function() { + $.extend( $.effects, { version: "@VERSION", @@ -375,13 +386,13 @@ $.extend( $.effects, { case "middle": y = 0.5; break; case "bottom": y = 1; break; default: y = origin[ 0 ] / original.height; - }; + } switch ( origin[ 1 ] ) { case "left": x = 0; break; case "center": x = 0.5; break; case "right": x = 1; break; default: x = origin[ 1 ] / original.width; - }; + } return { x: x, y: y @@ -473,9 +484,11 @@ $.extend( $.effects, { 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; } @@ -484,9 +497,10 @@ $.extend( $.effects, { // return an effect options object for the given parameters: function _normalizeArguments( effect, options, speed, callback ) { - // short path for passing an effect options object: + // allow passing all optinos as the first parameter if ( $.isPlainObject( effect ) ) { - return effect; + options = effect; + effect = effect.effect; } // convert to an object @@ -505,7 +519,7 @@ function _normalizeArguments( effect, options, speed, callback ) { } // catch (effect, speed, ?) - if ( $.type( options ) === "number" || $.fx.speeds[ options ]) { + if ( typeof options === "number" || $.fx.speeds[ options ] ) { callback = speed; speed = options; options = {}; @@ -523,8 +537,10 @@ function _normalizeArguments( effect, options, speed, callback ) { } speed = speed || options.duration; - effect.duration = $.fx.off ? 0 : typeof speed === "number" - ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; + effect.duration = $.fx.off ? 0 : + typeof speed === "number" ? speed : + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; effect.complete = callback || options.complete; @@ -649,19 +665,22 @@ $.fn.extend({ 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 = {}; @@ -701,10 +720,12 @@ $.each( baseEasings, function( name, easeIn ) { return 1 - easeIn( 1 - p ); }; $.easing[ "easeInOut" + name ] = function( p ) { - return p < .5 ? + return p < 0.5 ? easeIn( p * 2 ) / 2 : easeIn( p * -2 + 2 ) / -2 + 1; }; }); -})(jQuery); +})(); + +})(jQuery)); diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index 54cdc25f3..6c72be9e5 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Drop @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -31,19 +31,19 @@ $.effects.effect.drop = function( o, done ) { el.show(); $.effects.createWrapper( el ); - distance = o.distance || el[ ref == "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; + distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; if ( show ) { el .css( "opacity", 0 ) - .css( ref, motion == "pos" ? -distance : distance ); + .css( ref, motion === "pos" ? -distance : distance ); } // Animation animation[ ref ] = ( show ? ( motion === "pos" ? "+=" : "-=" ) : - ( motion === "pos" ? "-=" : "+=" ) ) - + distance; + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; // Animate el.animate( animation, { @@ -51,13 +51,14 @@ $.effects.effect.drop = function( o, done ) { duration: o.duration, easing: o.easing, complete: function() { - mode == "hide" && el.hide(); + if ( mode === "hide" ) { + el.hide(); + } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); - }; })(jQuery); diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js index 08908d3eb..ae3efb21e 100644 --- a/ui/jquery.effects.explode.js +++ b/ui/jquery.effects.explode.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Explode @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -31,6 +31,14 @@ $.effects.effect.explode = function( o, done ) { // 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; @@ -73,14 +81,6 @@ $.effects.effect.explode = function( o, done ) { } } - // children animate complete: - function childComplete() { - pieces.push( this ); - if ( pieces.length == rows * cells ) { - animComplete(); - } - } - function animComplete() { el.css({ visibility: "visible" diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js index b653f1dfd..89784bd08 100644 --- a/ui/jquery.effects.fade.js +++ b/ui/jquery.effects.fade.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Fade @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js index 3642edf3f..17aa9a36b 100644 --- a/ui/jquery.effects.fold.js +++ b/ui/jquery.effects.fold.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Fold @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -23,11 +23,12 @@ $.effects.effect.fold = function( o, done ) { 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(); diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js index 88a69ab51..ac6c269e5 100644 --- a/ui/jquery.effects.highlight.js +++ b/ui/jquery.effects.highlight.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Highlight @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index e1e4d0631..5b27bb324 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Pulsate @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 64e31ea96..83b41d3c2 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Scale @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -30,9 +30,9 @@ $.effects.effect.puff = function( o, done ) { mode: mode, complete: done, percent: hide ? percent : 100, - from: hide - ? original - : { + from: hide ? + original : + { height: original.height * factor, width: original.width * factor } @@ -47,7 +47,8 @@ $.effects.effect.scale = function( o, done ) { 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 = { @@ -57,8 +58,8 @@ $.effects.effect.scale = function( o, done ) { 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: @@ -67,12 +68,12 @@ $.effects.effect.scale = function( o, done ) { 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, @@ -80,16 +81,17 @@ $.effects.effect.scale = function( o, done ) { outerWidth: original.outerWidth * factor.x }; - if ( options.fade ) { // Fade option to support puff - if ( mode == "show" ) { + // Fade option to support puff + if ( options.fade ) { + 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; } - }; + } // Animate el.effect( options ); @@ -145,34 +147,34 @@ $.effects.effect.size = function( o, done ) { }; // Scale the css box - if ( scale == "box" || scale == "both" ) { + if ( scale === "box" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { props = props.concat( vProps ); el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); - }; + } // Horizontal props scaling if ( factor.from.x !== factor.to.x ) { props = props.concat( hProps ); el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); - }; - }; + } + } // Scale the content - if ( scale == "content" || scale == "both" ) { + if ( scale === "content" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { props = props.concat( cProps ); el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); - }; - }; - + } + } + $.effects.save( el, restore ? props : props1 ); el.show(); $.effects.createWrapper( el ); @@ -189,7 +191,7 @@ $.effects.effect.size = function( o, done ) { 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); @@ -202,8 +204,10 @@ $.effects.effect.size = function( o, done ) { 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 @@ -214,26 +218,28 @@ $.effects.effect.size = function( o, done ) { }; // 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 ); - }; + } // Animate children child.css( child.from ); child.animate( child.to, o.duration, o.easing, function() { // Restore children - if (restore) $.effects.restore( child, props2 ); + if ( restore ) { + $.effects.restore( child, props2 ); + } }); }); - }; + } // Animate el.animate( el.to, { @@ -244,7 +250,7 @@ $.effects.effect.size = function( o, done ) { 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 ); diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index 0e12cfe56..700c6df3d 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Shake @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -22,8 +22,8 @@ $.effects.effect.shake = function( o, done ) { 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 = {}, @@ -32,7 +32,6 @@ $.effects.effect.shake = function( o, done ) { // 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(); @@ -49,7 +48,7 @@ $.effects.effect.shake = function( o, done ) { // Shakes for ( i = 1; i < times; i++ ) { el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); - }; + } el .animate( animation1, speed, o.easing ) .animate( animation, speed / 2, o.easing ) diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index a376d3c56..77d540a9c 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Slide @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -20,8 +20,8 @@ $.effects.effect.slide = function( o, done ) { 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; @@ -44,8 +44,8 @@ $.effects.effect.slide = function( o, done ) { // Animation animation[ ref ] = ( show ? ( positiveMotion ? "+=" : "-=") : - ( positiveMotion ? "-=" : "+=")) - + distance; + ( positiveMotion ? "-=" : "+=")) + + distance; // Animate el.animate( animation, { @@ -61,7 +61,6 @@ $.effects.effect.slide = function( o, done ) { done(); } }); - }; })(jQuery); diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js index df392339b..3368fb18e 100644 --- a/ui/jquery.effects.transfer.js +++ b/ui/jquery.effects.transfer.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Transfer @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 2200732ac..00ecd1b64 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Accordion @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -12,6 +12,22 @@ * jquery.ui.widget.js */ (function( $, undefined ) { + 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", @@ -33,7 +49,9 @@ $.widget( "ui.accordion", { }, _create: function() { - var options = this.options; + var accordionId = this.accordionId = "ui-accordion-" + + (this.element.attr( "id" ) || ++uid), + options = this.options; this.prevShow = this.prevHide = $(); this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); @@ -68,18 +86,36 @@ $.widget( "ui.accordion", { this.headers .attr( "role", "tab" ) + .each(function( i ) { + var header = $( this ), + headerId = header.attr( "id" ), + panel = header.next(), + panelId = panel.attr( "id" ); + if ( !headerId ) { + headerId = accordionId + "-header-" + i; + header.attr( "id", headerId ); + } + if ( !panelId ) { + panelId = accordionId + "-panel-" + i; + panel.attr( "id", panelId ); + } + header.attr( "aria-controls", panelId ); + panel.attr( "aria-labelledby", headerId ); + }) .next() .attr( "role", "tabpanel" ); this.headers .not( this.active ) .attr({ - // TODO: document support for each of these - "aria-expanded": "false", "aria-selected": "false", tabIndex: -1 }) .next() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }) .hide(); // make sure at least one header is in the tab order @@ -87,12 +123,18 @@ $.widget( "ui.accordion", { this.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { this.active.attr({ - "aria-expanded": "true", "aria-selected": "true", tabIndex: 0 - }); + }) + .next() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); } + this._bind( this.headers, { keydown: "_keydown" }); + this._bind( this.headers.next(), { keydown: "_panelKeyDown" }); this._setupEvents( options.event ); }, @@ -124,6 +166,9 @@ $.widget( "ui.accordion", { }, _destroy: function() { + var contents, + accordionId = this.accordionId; + // clean up main element this.element .removeClass( "ui-accordion ui-widget ui-helper-reset" ) @@ -131,19 +176,31 @@ $.widget( "ui.accordion", { // clean up headers this.headers - .unbind( ".accordion" ) .removeClass( "ui-accordion-header ui-accordion-header-active 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" ); + .removeAttr( "aria-controls" ) + .removeAttr( "tabIndex" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); this._destroyIcons(); // clean up content panels - var contents = this.headers.next() + contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ); + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-labelledby" ) + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); if ( this.options.heightStyle !== "content" ) { this.element.css( "height", this.originalHeight ); contents.css( "height", "" ); @@ -159,7 +216,8 @@ $.widget( "ui.accordion", { if ( key === "event" ) { if ( this.options.event ) { - this.headers.unbind( ".accordion" ); + this.headers.unbind( + this.options.event.split( " " ).join( ".accordion " ) + ".accordion" ); } this._setupEvents( value ); } @@ -208,6 +266,13 @@ $.widget( "ui.accordion", { case keyCode.SPACE: case keyCode.ENTER: this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; } if ( toFocus ) { @@ -218,6 +283,12 @@ $.widget( "ui.accordion", { } }, + _panelKeyDown : function( event ) { + if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { + $( event.currentTarget ).prev().focus(); + } + }, + refresh: function() { var heightStyle = this.options.heightStyle, parent = this.element.parent(), @@ -296,14 +367,13 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { - var events = { - keydown: "_keydown" - }; - if ( event ) { - $.each( event.split(" "), function( index, eventName ) { - events[ eventName ] = "_eventHandler"; - }); + var events = {}; + if ( !event ) { + return; } + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); this._bind( this.headers, events ); }, @@ -382,21 +452,26 @@ $.widget( "ui.accordion", { this._toggleComplete( data ); } - // TODO assert that the blur and focus triggers are really necessary, remove otherwise - toHide.prev() + toHide .attr({ "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 + "aria-hidden": "true" }) - .blur(); - toShow.prev() + .prev() + .attr({ + "aria-selected": "false", + tabIndex: -1 + }); + toShow .attr({ "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 + "aria-hidden": "false" }) - .focus(); + .prev() + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); }, _animate: function( toShow, toHide, data ) { @@ -455,20 +530,6 @@ $.widget( "ui.accordion", { } }); -$.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 @@ -636,7 +697,7 @@ if ( $.uiBackCompat !== false ) { easing: "easeOutBounce", duration: 1000 } - } + }; } else { options.animate = options.animated; } diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index d95d81bca..5ec5790ed 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -238,7 +238,7 @@ $.widget( "ui.autocomplete", { 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) diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index c8e345d93..f84d748cf 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Button @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -186,7 +186,7 @@ $.widget( "ui.button", { 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" ); } }) @@ -212,6 +212,7 @@ $.widget( "ui.button", { }, _determineButtonType: function() { + var ancestor, labelSelector, checked; if ( this.element.is(":checkbox") ) { this.type = "checkbox"; @@ -226,8 +227,8 @@ $.widget( "ui.button", { 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(); @@ -238,7 +239,7 @@ $.widget( "ui.button", { } 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" ); } diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 574256cad..93353996e 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -165,24 +165,24 @@ $.each( [ "Width", "Height" ], function( i, name ) { // 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; } 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) + 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 ); + visible( element ); } function visible( element ) { @@ -242,19 +242,21 @@ $.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 ) { + 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 ); } diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 5dacd6943..c0de503f5 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Datepicker @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 35b18929f..3a9bd5dc6 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Dialog @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -201,13 +201,13 @@ $.widget("ui.dialog", { }, close: function( event ) { - if ( !this._isOpen ) { - return self; - } - var self = this, maxZ, thisZ; + if ( !this._isOpen ) { + return; + } + if ( false === self._trigger( "beforeClose", event ) ) { return; } @@ -292,7 +292,8 @@ $.widget("ui.dialog", { return; } - var self = this, + var hasFocus, + self = this, options = self.options, uiDialog = self.uiDialog; @@ -325,7 +326,7 @@ $.widget("ui.dialog", { // 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 ) { @@ -341,7 +342,8 @@ $.widget("ui.dialog", { }, _createButtons: function( buttons ) { - var self = this, + var uiDialogButtonPane, uiButtonSet, + self = this, hasButtons = false; // if we already have a button pane, remove it @@ -353,11 +355,11 @@ $.widget("ui.dialog", { }); } 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 ) ? @@ -547,7 +549,8 @@ $.widget("ui.dialog", { }, _setOption: function( key, value ) { - var self = this, + var isDraggable, isResizable, + self = this, uiDialog = self.uiDialog; switch ( key ) { @@ -571,7 +574,7 @@ $.widget("ui.dialog", { } break; case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); + isDraggable = uiDialog.is( ":data(draggable)" ); if ( isDraggable && !value ) { uiDialog.draggable( "destroy" ); } @@ -585,7 +588,7 @@ $.widget("ui.dialog", { 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" ); } @@ -614,9 +617,8 @@ $.widget("ui.dialog", { /* 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 @@ -648,7 +650,7 @@ $.widget("ui.dialog", { }); } else { this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); + autoHeight = this.element.css( "height", "auto" ).height(); if ( !isVisible ) { this.uiDialog.hide(); } @@ -740,7 +742,9 @@ $.extend( $.ui.dialog.overlay, { }, 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 ] ); } @@ -752,7 +756,6 @@ $.extend( $.ui.dialog.overlay, { $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" ) ); }); diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 0e4389305..25b256710 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Draggable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 19334bf4d..47d3e38e9 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Droppable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 17177a906..af22c19b0 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Menu @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -85,9 +85,9 @@ $.widget( "ui.menu", { "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 ) { @@ -183,7 +183,7 @@ $.widget( "ui.menu", { character = String.fromCharCode( event.keyCode ), skip = false; - if (character == prev) { + if (character === prev) { skip = true; } else { character = prev + character; @@ -195,7 +195,7 @@ $.widget( "ui.menu", { 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() { @@ -260,15 +260,18 @@ $.widget( "ui.menu", { 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" ) @@ -291,15 +294,16 @@ $.widget( "ui.menu", { }, 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 ); @@ -321,7 +325,7 @@ $.widget( "ui.menu", { this._close(); }, this.delay ); - var nested = $( "> .ui-menu", item ); + nested = $( "> .ui-menu", item ); if ( nested.length && ( /^mouse/.test( event.type ) ) ) { this._startOpening(nested); } @@ -368,9 +372,9 @@ $.widget( "ui.menu", { var position = $.extend({}, { of: this.active - }, $.type(this.options.position) == "function" - ? this.options.position(this.active) - : this.options.position + }, $.type(this.options.position) === "function" ? + this.options.position(this.active) : + this.options.position ); submenu.show() diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 64a081961..eaa953ad0 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -46,11 +46,14 @@ $.widget("ui.mouse", { // other instances of mouse _mouseDestroy: function() { this.element.unbind('.'+this.widgetName); + $(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 }; + if( mouseHandled ) { return; } // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); @@ -58,10 +61,10 @@ $.widget("ui.mouse", { 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; } @@ -131,7 +134,7 @@ $.widget("ui.mouse", { 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); } diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 977e621a6..7fe31626d 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Position @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -152,13 +152,13 @@ $.fn.position = function( options ) { var elem = $( this ), elemWidth = elem.outerWidth(), elemHeight = elem.outerHeight(), - marginLeft = parseInt( $.css( this, "marginLeft" ) ) || 0, - marginTop = parseInt( $.css( this, "marginTop" ) ) || 0, + marginLeft = parseInt( $.css( this, "marginLeft" ), 10 ) || 0, + marginTop = parseInt( $.css( this, "marginTop" ), 10 ) || 0, scrollInfo = $.position.getScrollInfo( within ), collisionWidth = elemWidth + marginLeft + - ( parseInt( $.css( this, "marginRight" ) ) || 0 ) + scrollInfo.width, + ( parseInt( $.css( this, "marginRight" ), 10 ) || 0 ) + scrollInfo.width, collisionHeight = elemHeight + marginTop + - ( parseInt( $.css( this, "marginBottom" ) ) || 0 ) + scrollInfo.height, + ( parseInt( $.css( this, "marginBottom" ), 10 ) || 0 ) + scrollInfo.height, position = $.extend( {}, basePosition ), myOffset = [ parseInt( offsets.my[ 0 ], 10 ) * @@ -483,7 +483,7 @@ if ( $.uiBackCompat !== false ) { at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ], offset: undefined } ) ); - } + }; }( jQuery ) ); } diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 26f5e76f0..68cccc554 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Progressbar @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -85,8 +85,8 @@ $.widget( "ui.progressbar", { }, _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); + var value = this.value(), + percentage = this._percentage(); if ( this.oldValue !== value ) { this.oldValue = value; diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 77fe8bcc1..9be33927e 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Resizable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js index ec54b5d9c..3244e654e 100644 --- a/ui/jquery.ui.selectable.js +++ b/ui/jquery.ui.selectable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Selectable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 75c6631ca..b355f8c7e 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Slider @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -35,7 +35,8 @@ $.widget( "ui.slider", $.ui.mouse, { }, _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>", @@ -78,7 +79,7 @@ $.widget( "ui.slider", $.ui.mouse, { ( ( 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 ); } diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 4c6a47169..4093be245 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Sortable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index dab7ce471..bd55a09ea 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Spinner @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index ba48c3770..68c182c31 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tabs @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -20,13 +20,13 @@ function getNextTabId() { 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", @@ -44,7 +44,8 @@ $.widget( "ui.tabs", { }, _create: function() { - var that = this, + var panel, + that = this, options = that.options, active = options.active; @@ -110,7 +111,7 @@ $.widget( "ui.tabs", { // 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" ); @@ -128,7 +129,7 @@ $.widget( "ui.tabs", { }, _setOption: function( key, value ) { - if ( key == "active" ) { + if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; @@ -166,7 +167,8 @@ $.widget( "ui.tabs", { }, refresh: function() { - var self = this, + var next, + self = this, options = this.options, lis = this.list.children( ":has(a[href])" ); @@ -187,7 +189,7 @@ $.widget( "ui.tabs", { // 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 { @@ -224,7 +226,7 @@ $.widget( "ui.tabs", { this.panels = $( [] ); this.anchors.each(function( i, a ) { - var selector, panel; + var selector, panel, id; // inline tab if ( isLocal( a ) ) { @@ -232,7 +234,7 @@ $.widget( "ui.tabs", { 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 ) { @@ -433,8 +435,8 @@ $.widget( "ui.tabs", { _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" ) { - index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); + if ( typeof index === "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } return index; @@ -747,7 +749,8 @@ if ( $.uiBackCompat !== false ) { 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 ) ), @@ -758,10 +761,10 @@ if ( $.uiBackCompat !== false ) { 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 ) { @@ -946,6 +949,8 @@ if ( $.uiBackCompat !== false ) { }); // cookie option + (function() { + var listId = 0; $.widget( "ui.tabs", $.ui.tabs, { @@ -966,7 +971,7 @@ if ( $.uiBackCompat !== false ) { }, _cookie: function( active ) { var cookie = [ this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + ++listId ) ]; + ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; if ( arguments.length ) { cookie.push( active === false ? -1 : active ); cookie.push( this.options.cookie ); @@ -993,6 +998,8 @@ if ( $.uiBackCompat !== false ) { } }); + })(); + // load event $.widget( "ui.tabs", $.ui.tabs, { _trigger: function( type, event, data ) { diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index eddd9a0c9..97895a6a8 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tooltip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -99,7 +99,7 @@ $.widget( "ui.tooltip", { return; } - if ( !target.data( "ui-tooltip-title" ) ) { + if ( target.attr( "title" ) ) { target.data( "ui-tooltip-title", target.attr( "title" ) ); } @@ -159,7 +159,7 @@ $.widget( "ui.tooltip", { 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 ); @@ -173,6 +173,12 @@ $.widget( "ui.tooltip", { target = $( event ? event.currentTarget : this.element ), tooltip = this._find( target ); + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( this.closing ) { + return; + } + // don't close if the element has focus // this prevents the tooltip from closing if you hover while focused if ( !force && this.document[0].activeElement === target[0] ) { @@ -195,7 +201,9 @@ $.widget( "ui.tooltip", { target.removeData( "tooltip-open" ); target.unbind( "mouseleave.tooltip focusout.tooltip keyup.tooltip" ); + this.closing = true; this._trigger( "close", event, { tooltip: tooltip } ); + this.closing = false; }, _tooltip: function( element ) { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 1b7405e28..3e3723398 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -9,9 +9,8 @@ */ (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 { @@ -73,11 +72,11 @@ $.widget = function( name, base, prototype ) { 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, @@ -163,7 +162,8 @@ $.widget.bridge = function( name, object ) { 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 + "'" ); @@ -171,7 +171,7 @@ $.widget.bridge = function( name, object ) { 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() ) : |