Index: trunk/phase3/resources/jquery.ui/jquery.ui.button.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Button 1.8.2 |
| 3 | + * jQuery UI Button 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Button |
10 | 10 | * |
— | — | @@ -11,12 +11,12 @@ |
12 | 12 | * jquery.ui.core.js |
13 | 13 | * jquery.ui.widget.js |
14 | 14 | */ |
15 | | -(function( $ ) { |
| 15 | +(function( $, undefined ) { |
16 | 16 | |
17 | 17 | var lastActive, |
18 | 18 | baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", |
19 | 19 | stateClasses = "ui-state-hover ui-state-active ", |
20 | | - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only", |
| 20 | + typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", |
21 | 21 | formResetHandler = function( event ) { |
22 | 22 | $( ":ui-button", event.target.form ).each(function() { |
23 | 23 | var inst = $( this ).data( "button" ); |
— | — | @@ -44,6 +44,7 @@ |
45 | 45 | |
46 | 46 | $.widget( "ui.button", { |
47 | 47 | options: { |
| 48 | + disabled: null, |
48 | 49 | text: true, |
49 | 50 | label: null, |
50 | 51 | icons: { |
— | — | @@ -56,6 +57,10 @@ |
57 | 58 | .unbind( "reset.button" ) |
58 | 59 | .bind( "reset.button", formResetHandler ); |
59 | 60 | |
| 61 | + if ( typeof this.options.disabled !== "boolean" ) { |
| 62 | + this.options.disabled = this.element.attr( "disabled" ); |
| 63 | + } |
| 64 | + |
60 | 65 | this._determineButtonType(); |
61 | 66 | this.hasTitle = !!this.buttonElement.attr( "title" ); |
62 | 67 | |
— | — | @@ -195,8 +200,16 @@ |
196 | 201 | if ( this.type === "checkbox" || this.type === "radio" ) { |
197 | 202 | // we don't search against the document in case the element |
198 | 203 | // is disconnected from the DOM |
199 | | - this.buttonElement = this.element.parents().last() |
200 | | - .find( "[for=" + this.element.attr("id") + "]" ); |
| 204 | + var ancestor = this.element.parents().filter(":last"), |
| 205 | + labelSelector = "label[for=" + this.element.attr("id") + "]"; |
| 206 | + this.buttonElement = ancestor.find( labelSelector ); |
| 207 | + if ( !this.buttonElement.length ) { |
| 208 | + ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); |
| 209 | + this.buttonElement = ancestor.filter( labelSelector ); |
| 210 | + if ( !this.buttonElement.length ) { |
| 211 | + this.buttonElement = ancestor.find( labelSelector ); |
| 212 | + } |
| 213 | + } |
201 | 214 | this.element.addClass( "ui-helper-hidden-accessible" ); |
202 | 215 | |
203 | 216 | var checked = this.element.is( ":checked" ); |
— | — | @@ -285,34 +298,43 @@ |
286 | 299 | .appendTo( buttonElement.empty() ) |
287 | 300 | .text(), |
288 | 301 | icons = this.options.icons, |
289 | | - multipleIcons = icons.primary && icons.secondary; |
| 302 | + multipleIcons = icons.primary && icons.secondary, |
| 303 | + buttonClasses = []; |
| 304 | + |
290 | 305 | if ( icons.primary || icons.secondary ) { |
291 | | - buttonElement.addClass( "ui-button-text-icon" + |
292 | | - ( multipleIcons ? "s" : "" ) ); |
| 306 | + if ( this.options.text ) { |
| 307 | + buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); |
| 308 | + } |
| 309 | + |
293 | 310 | if ( icons.primary ) { |
294 | 311 | buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); |
295 | 312 | } |
| 313 | + |
296 | 314 | if ( icons.secondary ) { |
297 | 315 | buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); |
298 | 316 | } |
| 317 | + |
299 | 318 | if ( !this.options.text ) { |
300 | | - buttonElement |
301 | | - .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ) |
302 | | - .removeClass( "ui-button-text-icons ui-button-text-icon" ); |
| 319 | + buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); |
| 320 | + |
303 | 321 | if ( !this.hasTitle ) { |
304 | 322 | buttonElement.attr( "title", buttonText ); |
305 | 323 | } |
306 | 324 | } |
307 | 325 | } else { |
308 | | - buttonElement.addClass( "ui-button-text-only" ); |
| 326 | + buttonClasses.push( "ui-button-text-only" ); |
309 | 327 | } |
| 328 | + buttonElement.addClass( buttonClasses.join( " " ) ); |
310 | 329 | } |
311 | 330 | }); |
312 | 331 | |
313 | 332 | $.widget( "ui.buttonset", { |
| 333 | + options: { |
| 334 | + items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" |
| 335 | + }, |
| 336 | + |
314 | 337 | _create: function() { |
315 | 338 | this.element.addClass( "ui-buttonset" ); |
316 | | - this._init(); |
317 | 339 | }, |
318 | 340 | |
319 | 341 | _init: function() { |
— | — | @@ -328,7 +350,7 @@ |
329 | 351 | }, |
330 | 352 | |
331 | 353 | refresh: function() { |
332 | | - this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" ) |
| 354 | + this.buttons = this.element.find( this.options.items ) |
333 | 355 | .filter( ":ui-button" ) |
334 | 356 | .button( "refresh" ) |
335 | 357 | .end() |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.datepicker.js |
— | — | @@ -1,20 +1,19 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Datepicker 1.8.2 |
| 3 | + * jQuery UI Datepicker 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Datepicker |
10 | 10 | * |
11 | 11 | * Depends: |
12 | 12 | * jquery.ui.core.js |
13 | 13 | */ |
| 14 | +(function( $, undefined ) { |
14 | 15 | |
15 | | -(function($) { // hide the namespace |
| 16 | +$.extend($.ui, { datepicker: { version: "1.8.11" } }); |
16 | 17 | |
17 | | -$.extend($.ui, { datepicker: { version: "1.8.2" } }); |
18 | | - |
19 | 18 | var PROP_NAME = 'datepicker'; |
20 | 19 | var dpuuid = new Date().getTime(); |
21 | 20 | |
— | — | @@ -108,7 +107,7 @@ |
109 | 108 | autoSize: false // True to size the input for the date format, false to leave as is |
110 | 109 | }; |
111 | 110 | $.extend(this._defaults, this.regional['']); |
112 | | - this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>'); |
| 111 | + this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'); |
113 | 112 | } |
114 | 113 | |
115 | 114 | $.extend(Datepicker.prototype, { |
— | — | @@ -168,7 +167,7 @@ |
169 | 168 | |
170 | 169 | /* Create a new instance object. */ |
171 | 170 | _newInst: function(target, inline) { |
172 | | - var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars |
| 171 | + var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars |
173 | 172 | return {id: id, input: target, // associated target |
174 | 173 | selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection |
175 | 174 | drawMonth: 0, drawYear: 0, // month being drawn |
— | — | @@ -273,6 +272,7 @@ |
274 | 273 | this._setDate(inst, this._getDefaultDate(inst), true); |
275 | 274 | this._updateDatepicker(inst); |
276 | 275 | this._updateAlternate(inst); |
| 276 | + inst.dpDiv.show(); |
277 | 277 | }, |
278 | 278 | |
279 | 279 | /* Pop-up the date picker in a "dialog" box. |
— | — | @@ -444,7 +444,14 @@ |
445 | 445 | this._hideDatepicker(); |
446 | 446 | } |
447 | 447 | var date = this._getDateDatepicker(target, true); |
| 448 | + var minDate = this._getMinMaxDate(inst, 'min'); |
| 449 | + var maxDate = this._getMinMaxDate(inst, 'max'); |
448 | 450 | extendRemove(inst.settings, settings); |
| 451 | + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided |
| 452 | + if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) |
| 453 | + inst.settings.minDate = this._formatDate(inst, minDate); |
| 454 | + if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) |
| 455 | + inst.settings.maxDate = this._formatDate(inst, maxDate); |
449 | 456 | this._attachments($(target), inst); |
450 | 457 | this._autoSize(inst); |
451 | 458 | this._setDateDatepicker(target, date); |
— | — | @@ -500,8 +507,8 @@ |
501 | 508 | case 9: $.datepicker._hideDatepicker(); |
502 | 509 | handled = false; |
503 | 510 | break; // hide on tab out |
504 | | - case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv). |
505 | | - add($('td.' + $.datepicker._currentClass, inst.dpDiv)); |
| 511 | + case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + |
| 512 | + $.datepicker._currentClass + ')', inst.dpDiv); |
506 | 513 | if (sel[0]) |
507 | 514 | $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); |
508 | 515 | else |
— | — | @@ -565,7 +572,7 @@ |
566 | 573 | if ($.datepicker._get(inst, 'constrainInput')) { |
567 | 574 | var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); |
568 | 575 | var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); |
569 | | - return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); |
| 576 | + return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); |
570 | 577 | } |
571 | 578 | }, |
572 | 579 | |
— | — | @@ -625,6 +632,8 @@ |
626 | 633 | } |
627 | 634 | var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; |
628 | 635 | $.datepicker._pos = null; |
| 636 | + //to avoid flashes on Firefox |
| 637 | + inst.dpDiv.empty(); |
629 | 638 | // determine sizing offscreen |
630 | 639 | inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); |
631 | 640 | $.datepicker._updateDatepicker(inst); |
— | — | @@ -639,10 +648,12 @@ |
640 | 649 | var duration = $.datepicker._get(inst, 'duration'); |
641 | 650 | var postProcess = function() { |
642 | 651 | $.datepicker._datepickerShowing = true; |
643 | | - var borders = $.datepicker._getBorders(inst.dpDiv); |
644 | | - inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only |
645 | | - css({left: -borders[0], top: -borders[1], |
| 652 | + var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only |
| 653 | + if( !! cover.length ){ |
| 654 | + var borders = $.datepicker._getBorders(inst.dpDiv); |
| 655 | + cover.css({left: -borders[0], top: -borders[1], |
646 | 656 | width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); |
| 657 | + } |
647 | 658 | }; |
648 | 659 | inst.dpDiv.zIndex($(input).zIndex()+1); |
649 | 660 | if ($.effects && $.effects[showAnim]) |
— | — | @@ -661,12 +672,12 @@ |
662 | 673 | _updateDatepicker: function(inst) { |
663 | 674 | var self = this; |
664 | 675 | var borders = $.datepicker._getBorders(inst.dpDiv); |
665 | | - inst.dpDiv.empty().append(this._generateHTML(inst)) |
666 | | - .find('iframe.ui-datepicker-cover') // IE6- only |
667 | | - .css({left: -borders[0], top: -borders[1], |
668 | | - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) |
669 | | - .end() |
670 | | - .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') |
| 676 | + inst.dpDiv.empty().append(this._generateHTML(inst)); |
| 677 | + var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only |
| 678 | + if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 |
| 679 | + cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) |
| 680 | + } |
| 681 | + inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') |
671 | 682 | .bind('mouseout', function(){ |
672 | 683 | $(this).removeClass('ui-state-hover'); |
673 | 684 | if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); |
— | — | @@ -696,8 +707,21 @@ |
697 | 708 | inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + |
698 | 709 | 'Class']('ui-datepicker-rtl'); |
699 | 710 | if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && |
700 | | - inst.input.is(':visible') && !inst.input.is(':disabled')) |
| 711 | + // #6694 - don't focus the input if it's already focused |
| 712 | + // this breaks the change event in IE |
| 713 | + inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) |
701 | 714 | inst.input.focus(); |
| 715 | + // deffered render of the years select (to avoid flashes on Firefox) |
| 716 | + if( inst.yearshtml ){ |
| 717 | + var origyearshtml = inst.yearshtml; |
| 718 | + setTimeout(function(){ |
| 719 | + //assure that inst.yearshtml didn't change. |
| 720 | + if( origyearshtml === inst.yearshtml ){ |
| 721 | + inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); |
| 722 | + } |
| 723 | + origyearshtml = inst.yearshtml = null; |
| 724 | + }, 0); |
| 725 | + } |
702 | 726 | }, |
703 | 727 | |
704 | 728 | /* Retrieve the size of left and top borders for an element. |
— | — | @@ -737,7 +761,7 @@ |
738 | 762 | _findPos: function(obj) { |
739 | 763 | var inst = this._getInst(obj); |
740 | 764 | var isRTL = this._get(inst, 'isRTL'); |
741 | | - while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { |
| 765 | + while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { |
742 | 766 | obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; |
743 | 767 | } |
744 | 768 | var position = $(obj).offset(); |
— | — | @@ -847,8 +871,11 @@ |
848 | 872 | _clickMonthYear: function(id) { |
849 | 873 | var target = $(id); |
850 | 874 | var inst = this._getInst(target[0]); |
851 | | - if (inst.input && inst._selectingMonthYear && !$.browser.msie) |
852 | | - inst.input.focus(); |
| 875 | + if (inst.input && inst._selectingMonthYear) { |
| 876 | + setTimeout(function() { |
| 877 | + inst.input.focus(); |
| 878 | + }, 0); |
| 879 | + } |
853 | 880 | inst._selectingMonthYear = !inst._selectingMonthYear; |
854 | 881 | }, |
855 | 882 | |
— | — | @@ -948,6 +975,8 @@ |
949 | 976 | if (value == '') |
950 | 977 | return null; |
951 | 978 | var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; |
| 979 | + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : |
| 980 | + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); |
952 | 981 | var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; |
953 | 982 | var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; |
954 | 983 | var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; |
— | — | @@ -966,9 +995,9 @@ |
967 | 996 | }; |
968 | 997 | // Extract a number from the string value |
969 | 998 | var getNumber = function(match) { |
970 | | - lookAhead(match); |
| 999 | + var isDoubled = lookAhead(match); |
971 | 1000 | var size = (match == '@' ? 14 : (match == '!' ? 20 : |
972 | | - (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))); |
| 1001 | + (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); |
973 | 1002 | var digits = new RegExp('^\\d{1,' + size + '}'); |
974 | 1003 | var num = value.substring(iValue).match(digits); |
975 | 1004 | if (!num) |
— | — | @@ -980,7 +1009,7 @@ |
981 | 1010 | var getName = function(match, shortNames, longNames) { |
982 | 1011 | var names = (lookAhead(match) ? longNames : shortNames); |
983 | 1012 | for (var i = 0; i < names.length; i++) { |
984 | | - if (value.substr(iValue, names[i].length) == names[i]) { |
| 1013 | + if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) { |
985 | 1014 | iValue += names[i].length; |
986 | 1015 | return i + 1; |
987 | 1016 | } |
— | — | @@ -1298,16 +1327,16 @@ |
1299 | 1328 | } |
1300 | 1329 | return new Date(year, month, day); |
1301 | 1330 | }; |
1302 | | - date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) : |
1303 | | - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); |
1304 | | - date = (date && date.toString() == 'Invalid Date' ? defaultDate : date); |
1305 | | - if (date) { |
1306 | | - date.setHours(0); |
1307 | | - date.setMinutes(0); |
1308 | | - date.setSeconds(0); |
1309 | | - date.setMilliseconds(0); |
| 1331 | + var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : |
| 1332 | + (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); |
| 1333 | + newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); |
| 1334 | + if (newDate) { |
| 1335 | + newDate.setHours(0); |
| 1336 | + newDate.setMinutes(0); |
| 1337 | + newDate.setSeconds(0); |
| 1338 | + newDate.setMilliseconds(0); |
1310 | 1339 | } |
1311 | | - return this._daylightSavingAdjust(date); |
| 1340 | + return this._daylightSavingAdjust(newDate); |
1312 | 1341 | }, |
1313 | 1342 | |
1314 | 1343 | /* Handle switch to/from daylight saving. |
— | — | @@ -1324,13 +1353,13 @@ |
1325 | 1354 | |
1326 | 1355 | /* Set the date(s) directly. */ |
1327 | 1356 | _setDate: function(inst, date, noChange) { |
1328 | | - var clear = !(date); |
| 1357 | + var clear = !date; |
1329 | 1358 | var origMonth = inst.selectedMonth; |
1330 | 1359 | var origYear = inst.selectedYear; |
1331 | | - date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); |
1332 | | - inst.selectedDay = inst.currentDay = date.getDate(); |
1333 | | - inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); |
1334 | | - inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); |
| 1360 | + var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); |
| 1361 | + inst.selectedDay = inst.currentDay = newDate.getDate(); |
| 1362 | + inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); |
| 1363 | + inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); |
1335 | 1364 | if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) |
1336 | 1365 | this._notifyChange(inst); |
1337 | 1366 | this._adjustInstDate(inst); |
— | — | @@ -1546,6 +1575,7 @@ |
1547 | 1576 | if (!showMonthAfterYear) |
1548 | 1577 | html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); |
1549 | 1578 | // year selection |
| 1579 | + inst.yearshtml = ''; |
1550 | 1580 | if (secondary || !changeYear) |
1551 | 1581 | html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; |
1552 | 1582 | else { |
— | — | @@ -1562,16 +1592,24 @@ |
1563 | 1593 | var endYear = Math.max(year, determineYear(years[1] || '')); |
1564 | 1594 | year = (minDate ? Math.max(year, minDate.getFullYear()) : year); |
1565 | 1595 | endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); |
1566 | | - html += '<select class="ui-datepicker-year" ' + |
| 1596 | + inst.yearshtml += '<select class="ui-datepicker-year" ' + |
1567 | 1597 | 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + |
1568 | 1598 | 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + |
1569 | 1599 | '>'; |
1570 | 1600 | for (; year <= endYear; year++) { |
1571 | | - html += '<option value="' + year + '"' + |
| 1601 | + inst.yearshtml += '<option value="' + year + '"' + |
1572 | 1602 | (year == drawYear ? ' selected="selected"' : '') + |
1573 | 1603 | '>' + year + '</option>'; |
1574 | 1604 | } |
1575 | | - html += '</select>'; |
| 1605 | + inst.yearshtml += '</select>'; |
| 1606 | + //when showing there is no need for later update |
| 1607 | + if( ! $.browser.mozilla ){ |
| 1608 | + html += inst.yearshtml; |
| 1609 | + inst.yearshtml = null; |
| 1610 | + } else { |
| 1611 | + // will be replaced later with inst.yearshtml |
| 1612 | + html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>'; |
| 1613 | + } |
1576 | 1614 | } |
1577 | 1615 | html += this._get(inst, 'yearSuffix'); |
1578 | 1616 | if (showMonthAfterYear) |
— | — | @@ -1599,9 +1637,9 @@ |
1600 | 1638 | _restrictMinMax: function(inst, date) { |
1601 | 1639 | var minDate = this._getMinMaxDate(inst, 'min'); |
1602 | 1640 | var maxDate = this._getMinMaxDate(inst, 'max'); |
1603 | | - date = (minDate && date < minDate ? minDate : date); |
1604 | | - date = (maxDate && date > maxDate ? maxDate : date); |
1605 | | - return date; |
| 1641 | + var newDate = (minDate && date < minDate ? minDate : date); |
| 1642 | + newDate = (maxDate && newDate > maxDate ? maxDate : newDate); |
| 1643 | + return newDate; |
1606 | 1644 | }, |
1607 | 1645 | |
1608 | 1646 | /* Notify change of month/year. */ |
— | — | @@ -1625,7 +1663,7 @@ |
1626 | 1664 | |
1627 | 1665 | /* Find the number of days in a given month. */ |
1628 | 1666 | _getDaysInMonth: function(year, month) { |
1629 | | - return 32 - new Date(year, month, 32).getDate(); |
| 1667 | + return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); |
1630 | 1668 | }, |
1631 | 1669 | |
1632 | 1670 | /* Find the day of the week of the first of a month. */ |
— | — | @@ -1695,7 +1733,12 @@ |
1696 | 1734 | Object - settings for attaching new datepicker functionality |
1697 | 1735 | @return jQuery object */ |
1698 | 1736 | $.fn.datepicker = function(options){ |
1699 | | - |
| 1737 | + |
| 1738 | + /* Verify an empty collection wasn't passed - Fixes #6976 */ |
| 1739 | + if ( !this.length ) { |
| 1740 | + return this; |
| 1741 | + } |
| 1742 | + |
1700 | 1743 | /* Initialise the date picker. */ |
1701 | 1744 | if (!$.datepicker.initialized) { |
1702 | 1745 | $(document).mousedown($.datepicker._checkExternalClick). |
— | — | @@ -1721,7 +1764,7 @@ |
1722 | 1765 | $.datepicker = new Datepicker(); // singleton instance |
1723 | 1766 | $.datepicker.initialized = false; |
1724 | 1767 | $.datepicker.uuid = new Date().getTime(); |
1725 | | -$.datepicker.version = "1.8.2"; |
| 1768 | +$.datepicker.version = "1.8.11"; |
1726 | 1769 | |
1727 | 1770 | // Workaround for #4055 |
1728 | 1771 | // Add another global to avoid noConflict issues with inline event handlers |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.sortable.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Sortable 1.8.2 |
| 3 | + * jQuery UI Sortable 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Sortables |
10 | 10 | * |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * jquery.ui.mouse.js |
14 | 14 | * jquery.ui.widget.js |
15 | 15 | */ |
16 | | -(function($) { |
| 16 | +(function( $, undefined ) { |
17 | 17 | |
18 | 18 | $.widget("ui.sortable", $.ui.mouse, { |
19 | 19 | widgetEventPrefix: "sort", |
— | — | @@ -49,8 +49,8 @@ |
50 | 50 | //Get the items |
51 | 51 | this.refresh(); |
52 | 52 | |
53 | | - //Let's determine if the items are floating |
54 | | - this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; |
| 53 | + //Let's determine if the items are being displayed horizontally |
| 54 | + this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; |
55 | 55 | |
56 | 56 | //Let's determine the parent's offset |
57 | 57 | this.offset = this.element.offset(); |
— | — | @@ -360,7 +360,7 @@ |
361 | 361 | |
362 | 362 | if(this.dragging) { |
363 | 363 | |
364 | | - this._mouseUp(); |
| 364 | + this._mouseUp({ target: null }); |
365 | 365 | |
366 | 366 | if(this.options.helper == "original") |
367 | 367 | this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); |
— | — | @@ -378,21 +378,23 @@ |
379 | 379 | |
380 | 380 | } |
381 | 381 | |
382 | | - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! |
383 | | - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); |
384 | | - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); |
| 382 | + if (this.placeholder) { |
| 383 | + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! |
| 384 | + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); |
| 385 | + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); |
385 | 386 | |
386 | | - $.extend(this, { |
387 | | - helper: null, |
388 | | - dragging: false, |
389 | | - reverting: false, |
390 | | - _noFinalSort: null |
391 | | - }); |
| 387 | + $.extend(this, { |
| 388 | + helper: null, |
| 389 | + dragging: false, |
| 390 | + reverting: false, |
| 391 | + _noFinalSort: null |
| 392 | + }); |
392 | 393 | |
393 | | - if(this.domPosition.prev) { |
394 | | - $(this.domPosition.prev).after(this.currentItem); |
395 | | - } else { |
396 | | - $(this.domPosition.parent).prepend(this.currentItem); |
| 394 | + if(this.domPosition.prev) { |
| 395 | + $(this.domPosition.prev).after(this.currentItem); |
| 396 | + } else { |
| 397 | + $(this.domPosition.parent).prepend(this.currentItem); |
| 398 | + } |
397 | 399 | } |
398 | 400 | |
399 | 401 | return this; |
— | — | @@ -409,6 +411,10 @@ |
410 | 412 | if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); |
411 | 413 | }); |
412 | 414 | |
| 415 | + if(!str.length && o.key) { |
| 416 | + str.push(o.key + '='); |
| 417 | + } |
| 418 | + |
413 | 419 | return str.join('&'); |
414 | 420 | |
415 | 421 | }, |
— | — | @@ -1061,7 +1067,7 @@ |
1062 | 1068 | }); |
1063 | 1069 | |
1064 | 1070 | $.extend($.ui.sortable, { |
1065 | | - version: "1.8.2" |
| 1071 | + version: "1.8.11" |
1066 | 1072 | }); |
1067 | 1073 | |
1068 | 1074 | })(jQuery); |
Index: trunk/phase3/resources/jquery.ui/themes/vector/jquery.ui.button.css |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | /* workarounds */ |
31 | 31 | button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ |
32 | 32 | |
33 | | -body button.ui-button { |
| 33 | +body .ui-button { |
34 | 34 | -moz-border-radius: 4px; |
35 | 35 | -webkit-border-radius: 4px; |
36 | 36 | padding: 0.2em 0.6em 0.15em !important; |
— | — | @@ -43,18 +43,18 @@ |
44 | 44 | width: auto; |
45 | 45 | overflow: visible; |
46 | 46 | } |
47 | | -body button.ui-button:hover { |
| 47 | +body .ui-button:hover { |
48 | 48 | border-color: #6e7273; |
49 | 49 | /* @embed */ |
50 | 50 | background: #e1e1e1 url(images/button-over.png) repeat-x scroll 50% 100% !important; |
51 | 51 | } |
52 | | -body button.ui-button:active, |
53 | | -body button.ui-button:focus { |
| 52 | +body .ui-button:active, |
| 53 | +body .ui-button:focus { |
54 | 54 | border-color: #707271; |
55 | 55 | /* @embed */ |
56 | 56 | background: #bfbfbf url(images/button-down.png) repeat-x scroll 50% 100% !important; |
57 | 57 | } |
58 | | -body button.ui-button.disabled { |
| 58 | +body .ui-button.disabled { |
59 | 59 | color: #7f7f7f; |
60 | 60 | border-color: #cccccc; |
61 | 61 | /* @embed */ |
— | — | @@ -67,24 +67,24 @@ |
68 | 68 | |
69 | 69 | /* Green buttons */ |
70 | 70 | |
71 | | -body button.ui-button.ui-button-green { |
| 71 | +body .ui-button.ui-button-green { |
72 | 72 | color: white; |
73 | 73 | border-color: #97af7e !important; |
74 | 74 | /* @embed */ |
75 | 75 | background: #85c940 url(images/button-off-green.png) repeat-x scroll 50% 100% !important; |
76 | 76 | } |
77 | | -body button.ui-button.ui-button-green:hover { |
| 77 | +body .ui-button.ui-button-green:hover { |
78 | 78 | border-color: #778e61; |
79 | 79 | /* @embed */ |
80 | 80 | background: #77ad40 url(images/button-over-green.png) repeat-x scroll 50% 100% !important; |
81 | 81 | } |
82 | | -body button.ui-button.ui-button-green:active, |
83 | | -body button.ui-button.ui-button-green:focus { |
| 82 | +body .ui-button.ui-button-green:active, |
| 83 | +body .ui-button.ui-button-green:focus { |
84 | 84 | border-color: #61b000; |
85 | 85 | /* @embed */ |
86 | 86 | background: #54a800 url(images/button-down-green.png) repeat-x scroll 50% 100% !important; |
87 | 87 | } |
88 | | -body button.ui-button.ui-button-green.disabled { |
| 88 | +body .ui-button.ui-button-green.disabled { |
89 | 89 | color: #7f7f7f; |
90 | 90 | border-color: #b8d29f; |
91 | 91 | /* @embed */ |
— | — | @@ -93,24 +93,24 @@ |
94 | 94 | |
95 | 95 | /* Blue buttons */ |
96 | 96 | |
97 | | -body button.ui-button.ui-button-blue { |
| 97 | +body .ui-button.ui-button-blue { |
98 | 98 | color: white; |
99 | 99 | border-color: #407ec9 !important; |
100 | 100 | /* @embed */ |
101 | 101 | background: #407ec9 url(images/button-off-blue.png) repeat-x scroll 50% 100% !important; |
102 | 102 | } |
103 | | -body button.ui-button.ui-button-blue:hover { |
| 103 | +body .ui-button.ui-button-blue:hover { |
104 | 104 | border-color: #245289; |
105 | 105 | /* @embed */ |
106 | 106 | background: #4071ad url(images/button-over-blue.png) repeat-x scroll 50% 100% !important; |
107 | 107 | } |
108 | | -body button.ui-button.ui-button-blue:active, |
109 | | -body button.ui-button.ui-button-blue:focus { |
| 108 | +body .ui-button.ui-button-blue:active, |
| 109 | +body .ui-button.ui-button-blue:focus { |
110 | 110 | border-color: #003980; |
111 | 111 | /* @embed */ |
112 | 112 | background: #004daa url(images/button-down-blue.png) repeat-x scroll 50% 100% !important; |
113 | 113 | } |
114 | | -body button.ui-button.ui-button-blue.disabled { |
| 114 | +body .ui-button.ui-button-blue.disabled { |
115 | 115 | border-color: #9eafc6; |
116 | 116 | /* @embed */ |
117 | 117 | background: #c3c8cf url(images/button-disabled-blue.png) repeat-x scroll 50% 100% !important; |
— | — | @@ -118,24 +118,24 @@ |
119 | 119 | |
120 | 120 | /* Red buttons */ |
121 | 121 | |
122 | | -body button.ui-button.ui-button-red { |
| 122 | +body .ui-button.ui-button-red { |
123 | 123 | color: white; |
124 | 124 | border-color: #af977e !important; |
125 | 125 | /* @embed */ |
126 | 126 | background: #c9404c url(images/button-off-red.png) repeat-x scroll 50% 100% !important; |
127 | 127 | } |
128 | | -body button.ui-button.ui-button-red:hover { |
| 128 | +body .ui-button.ui-button-red:hover { |
129 | 129 | border-color: #8e7761; |
130 | 130 | /* @embed */ |
131 | 131 | background: #ad404a url(images/button-over-red.png) repeat-x scroll 50% 100% !important; |
132 | 132 | } |
133 | | -body button.ui-button.ui-button-red:active, |
134 | | -body button.ui-button.ui-button-red:focus { |
| 133 | +body .ui-button.ui-button-red:active, |
| 134 | +body .ui-button.ui-button-red:focus { |
135 | 135 | border-color: #b06100; |
136 | 136 | /* @embed */ |
137 | 137 | background: #aa000f url(images/button-down-red.png) repeat-x scroll 50% 100% !important; |
138 | 138 | } |
139 | | -body button.ui-button.ui-button-red.disabled { |
| 139 | +body .ui-button.ui-button-red.disabled { |
140 | 140 | color: #7f7f7f; |
141 | 141 | border-color: #c3acae; |
142 | 142 | /* @embed */ |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.resizable.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Resizable 1.8.2 |
| 3 | + * jQuery UI Resizable 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Resizables |
10 | 10 | * |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * jquery.ui.mouse.js |
14 | 14 | * jquery.ui.widget.js |
15 | 15 | */ |
16 | | -(function($) { |
| 16 | +(function( $, undefined ) { |
17 | 17 | |
18 | 18 | $.widget("ui.resizable", $.ui.mouse, { |
19 | 19 | widgetEventPrefix: "resize", |
— | — | @@ -322,10 +322,10 @@ |
323 | 323 | |
324 | 324 | if(this._helper) { |
325 | 325 | var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), |
326 | | - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, |
327 | | - soffsetw = ista ? 0 : self.sizeDiff.width; |
| 326 | + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, |
| 327 | + soffsetw = ista ? 0 : self.sizeDiff.width; |
328 | 328 | |
329 | | - var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, |
| 329 | + var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, |
330 | 330 | left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, |
331 | 331 | top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; |
332 | 332 | |
— | — | @@ -519,7 +519,7 @@ |
520 | 520 | }); |
521 | 521 | |
522 | 522 | $.extend($.ui.resizable, { |
523 | | - version: "1.8.2" |
| 523 | + version: "1.8.11" |
524 | 524 | }); |
525 | 525 | |
526 | 526 | /* |
— | — | @@ -528,28 +528,29 @@ |
529 | 529 | |
530 | 530 | $.ui.plugin.add("resizable", "alsoResize", { |
531 | 531 | |
532 | | - start: function(event, ui) { |
533 | | - |
| 532 | + start: function (event, ui) { |
534 | 533 | var self = $(this).data("resizable"), o = self.options; |
535 | 534 | |
536 | | - var _store = function(exp) { |
| 535 | + var _store = function (exp) { |
537 | 536 | $(exp).each(function() { |
538 | | - $(this).data("resizable-alsoresize", { |
539 | | - width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10), |
540 | | - left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) |
| 537 | + var el = $(this); |
| 538 | + el.data("resizable-alsoresize", { |
| 539 | + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), |
| 540 | + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10), |
| 541 | + position: el.css('position') // to reset Opera on stop() |
541 | 542 | }); |
542 | 543 | }); |
543 | 544 | }; |
544 | 545 | |
545 | 546 | if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { |
546 | | - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } |
547 | | - else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } |
| 547 | + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } |
| 548 | + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } |
548 | 549 | }else{ |
549 | 550 | _store(o.alsoResize); |
550 | 551 | } |
551 | 552 | }, |
552 | 553 | |
553 | | - resize: function(event, ui){ |
| 554 | + resize: function (event, ui) { |
554 | 555 | var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; |
555 | 556 | |
556 | 557 | var delta = { |
— | — | @@ -557,18 +558,19 @@ |
558 | 559 | top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 |
559 | 560 | }, |
560 | 561 | |
561 | | - _alsoResize = function(exp, c) { |
| 562 | + _alsoResize = function (exp, c) { |
562 | 563 | $(exp).each(function() { |
563 | | - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; |
| 564 | + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, |
| 565 | + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; |
564 | 566 | |
565 | | - $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { |
| 567 | + $.each(css, function (i, prop) { |
566 | 568 | var sum = (start[prop]||0) + (delta[prop]||0); |
567 | 569 | if (sum && sum >= 0) |
568 | 570 | style[prop] = sum || null; |
569 | 571 | }); |
570 | 572 | |
571 | | - //Opera fixing relative position |
572 | | - if (/relative/.test(el.css('position')) && $.browser.opera) { |
| 573 | + // Opera fixing relative position |
| 574 | + if ($.browser.opera && /relative/.test(el.css('position'))) { |
573 | 575 | self._revertToRelativePosition = true; |
574 | 576 | el.css({ position: 'absolute', top: 'auto', left: 'auto' }); |
575 | 577 | } |
— | — | @@ -578,22 +580,33 @@ |
579 | 581 | }; |
580 | 582 | |
581 | 583 | if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { |
582 | | - $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); |
| 584 | + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); |
583 | 585 | }else{ |
584 | 586 | _alsoResize(o.alsoResize); |
585 | 587 | } |
586 | 588 | }, |
587 | 589 | |
588 | | - stop: function(event, ui){ |
589 | | - var self = $(this).data("resizable"); |
| 590 | + stop: function (event, ui) { |
| 591 | + var self = $(this).data("resizable"), o = self.options; |
590 | 592 | |
591 | | - //Opera fixing relative position |
592 | | - if (self._revertToRelativePosition && $.browser.opera) { |
| 593 | + var _reset = function (exp) { |
| 594 | + $(exp).each(function() { |
| 595 | + var el = $(this); |
| 596 | + // reset position for Opera - no need to verify it was changed |
| 597 | + el.css({ position: el.data("resizable-alsoresize").position }); |
| 598 | + }); |
| 599 | + }; |
| 600 | + |
| 601 | + if (self._revertToRelativePosition) { |
593 | 602 | self._revertToRelativePosition = false; |
594 | | - el.css({ position: 'relative' }); |
| 603 | + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { |
| 604 | + $.each(o.alsoResize, function (exp) { _reset(exp); }); |
| 605 | + }else{ |
| 606 | + _reset(o.alsoResize); |
| 607 | + } |
595 | 608 | } |
596 | 609 | |
597 | | - $(this).removeData("resizable-alsoresize-start"); |
| 610 | + $(this).removeData("resizable-alsoresize"); |
598 | 611 | } |
599 | 612 | }); |
600 | 613 | |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.slider.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Slider 1.8.2 |
| 3 | + * jQuery UI Slider 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Slider |
10 | 10 | * |
— | — | @@ -12,9 +12,8 @@ |
13 | 13 | * jquery.ui.mouse.js |
14 | 14 | * jquery.ui.widget.js |
15 | 15 | */ |
| 16 | +(function( $, undefined ) { |
16 | 17 | |
17 | | -(function( $ ) { |
18 | | - |
19 | 18 | // number of pages in a slider |
20 | 19 | // (how many times can you page up/down to go through the whole range) |
21 | 20 | var numPages = 5; |
— | — | @@ -310,8 +309,9 @@ |
311 | 310 | ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) |
312 | 311 | }; |
313 | 312 | |
314 | | - normValue = this._normValueFromMouse( position ); |
315 | | - this._slide( event, index, normValue ); |
| 313 | + if ( !this.handles.hasClass( "ui-state-hover" ) ) { |
| 314 | + this._slide( event, index, normValue ); |
| 315 | + } |
316 | 316 | this._animateOff = true; |
317 | 317 | return true; |
318 | 318 | }, |
— | — | @@ -585,14 +585,14 @@ |
586 | 586 | |
587 | 587 | // returns the step-aligned value that val is closest to, between (inclusive) min and max |
588 | 588 | _trimAlignValue: function( val ) { |
589 | | - if ( val < this._valueMin() ) { |
| 589 | + if ( val <= this._valueMin() ) { |
590 | 590 | return this._valueMin(); |
591 | 591 | } |
592 | | - if ( val > this._valueMax() ) { |
| 592 | + if ( val >= this._valueMax() ) { |
593 | 593 | return this._valueMax(); |
594 | 594 | } |
595 | 595 | var step = ( this.options.step > 0 ) ? this.options.step : 1, |
596 | | - valModStep = val % step, |
| 596 | + valModStep = (val - this._valueMin()) % step; |
597 | 597 | alignValue = val - valModStep; |
598 | 598 | |
599 | 599 | if ( Math.abs(valModStep) * 2 >= step ) { |
— | — | @@ -676,7 +676,7 @@ |
677 | 677 | }); |
678 | 678 | |
679 | 679 | $.extend( $.ui.slider, { |
680 | | - version: "1.8.2" |
| 680 | + version: "1.8.11" |
681 | 681 | }); |
682 | 682 | |
683 | 683 | }(jQuery)); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.widget.js |
— | — | @@ -1,28 +1,38 @@ |
2 | 2 | /*! |
3 | | - * jQuery UI Widget 1.8.2 |
| 3 | + * jQuery UI Widget 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Widget |
10 | 10 | */ |
11 | | -(function( $ ) { |
| 11 | +(function( $, undefined ) { |
12 | 12 | |
13 | | -var _remove = $.fn.remove; |
14 | | - |
15 | | -$.fn.remove = function( selector, keepData ) { |
16 | | - return this.each(function() { |
17 | | - if ( !keepData ) { |
18 | | - if ( !selector || $.filter( selector, [ this ] ).length ) { |
19 | | - $( "*", this ).add( this ).each(function() { |
20 | | - $( this ).triggerHandler( "remove" ); |
21 | | - }); |
| 13 | +// jQuery 1.4+ |
| 14 | +if ( $.cleanData ) { |
| 15 | + var _cleanData = $.cleanData; |
| 16 | + $.cleanData = function( elems ) { |
| 17 | + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { |
| 18 | + $( elem ).triggerHandler( "remove" ); |
| 19 | + } |
| 20 | + _cleanData( elems ); |
| 21 | + }; |
| 22 | +} else { |
| 23 | + var _remove = $.fn.remove; |
| 24 | + $.fn.remove = function( selector, keepData ) { |
| 25 | + return this.each(function() { |
| 26 | + if ( !keepData ) { |
| 27 | + if ( !selector || $.filter( selector, [ this ] ).length ) { |
| 28 | + $( "*", this ).add( [ this ] ).each(function() { |
| 29 | + $( this ).triggerHandler( "remove" ); |
| 30 | + }); |
| 31 | + } |
22 | 32 | } |
23 | | - } |
24 | | - return _remove.call( $(this), selector, keepData ); |
25 | | - }); |
26 | | -}; |
| 33 | + return _remove.call( $(this), selector, keepData ); |
| 34 | + }); |
| 35 | + }; |
| 36 | +} |
27 | 37 | |
28 | 38 | $.widget = function( name, base, prototype ) { |
29 | 39 | var namespace = name.split( "." )[ 0 ], |
— | — | @@ -57,7 +67,7 @@ |
58 | 68 | // basePrototype[ key ] = $.extend( {}, val ); |
59 | 69 | // } |
60 | 70 | // }); |
61 | | - basePrototype.options = $.extend( {}, basePrototype.options ); |
| 71 | + basePrototype.options = $.extend( true, {}, basePrototype.options ); |
62 | 72 | $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { |
63 | 73 | namespace: namespace, |
64 | 74 | widgetName: name, |
— | — | @@ -80,7 +90,7 @@ |
81 | 91 | options; |
82 | 92 | |
83 | 93 | // prevent calls to internal methods |
84 | | - if ( isMethodCall && options.substring( 0, 1 ) === "_" ) { |
| 94 | + if ( isMethodCall && options.charAt( 0 ) === "_" ) { |
85 | 95 | return returnValue; |
86 | 96 | } |
87 | 97 | |
— | — | @@ -90,6 +100,15 @@ |
91 | 101 | methodValue = instance && $.isFunction( instance[options] ) ? |
92 | 102 | instance[ options ].apply( instance, args ) : |
93 | 103 | instance; |
| 104 | + // TODO: add this back in 1.9 and use $.error() (see #5972) |
| 105 | +// if ( !instance ) { |
| 106 | +// throw "cannot call methods on " + name + " prior to initialization; " + |
| 107 | +// "attempted to call method '" + options + "'"; |
| 108 | +// } |
| 109 | +// if ( !$.isFunction( instance[options] ) ) { |
| 110 | +// throw "no such method '" + options + "' for " + name + " widget instance"; |
| 111 | +// } |
| 112 | +// var methodValue = instance[ options ].apply( instance, args ); |
94 | 113 | if ( methodValue !== instance && methodValue !== undefined ) { |
95 | 114 | returnValue = methodValue; |
96 | 115 | return false; |
— | — | @@ -99,10 +118,7 @@ |
100 | 119 | this.each(function() { |
101 | 120 | var instance = $.data( this, name ); |
102 | 121 | if ( instance ) { |
103 | | - if ( options ) { |
104 | | - instance.option( options ); |
105 | | - } |
106 | | - instance._init(); |
| 122 | + instance.option( options || {} )._init(); |
107 | 123 | } else { |
108 | 124 | $.data( this, name, new object( options, this ) ); |
109 | 125 | } |
— | — | @@ -129,10 +145,11 @@ |
130 | 146 | _createWidget: function( options, element ) { |
131 | 147 | // $.widget.bridge stores the plugin instance, but we do it anyway |
132 | 148 | // so that it's stored even before the _create function runs |
133 | | - this.element = $( element ).data( this.widgetName, this ); |
| 149 | + $.data( element, this.widgetName, this ); |
| 150 | + this.element = $( element ); |
134 | 151 | this.options = $.extend( true, {}, |
135 | 152 | this.options, |
136 | | - $.metadata && $.metadata.get( element )[ this.widgetName ], |
| 153 | + this._getCreateOptions(), |
137 | 154 | options ); |
138 | 155 | |
139 | 156 | var self = this; |
— | — | @@ -141,8 +158,12 @@ |
142 | 159 | }); |
143 | 160 | |
144 | 161 | this._create(); |
| 162 | + this._trigger( "create" ); |
145 | 163 | this._init(); |
146 | 164 | }, |
| 165 | + _getCreateOptions: function() { |
| 166 | + return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; |
| 167 | + }, |
147 | 168 | _create: function() {}, |
148 | 169 | _init: function() {}, |
149 | 170 | |
— | — | @@ -163,12 +184,11 @@ |
164 | 185 | }, |
165 | 186 | |
166 | 187 | option: function( key, value ) { |
167 | | - var options = key, |
168 | | - self = this; |
| 188 | + var options = key; |
169 | 189 | |
170 | 190 | if ( arguments.length === 0 ) { |
171 | 191 | // don't return a reference to the internal hash |
172 | | - return $.extend( {}, self.options ); |
| 192 | + return $.extend( {}, this.options ); |
173 | 193 | } |
174 | 194 | |
175 | 195 | if (typeof key === "string" ) { |
— | — | @@ -179,11 +199,17 @@ |
180 | 200 | options[ key ] = value; |
181 | 201 | } |
182 | 202 | |
| 203 | + this._setOptions( options ); |
| 204 | + |
| 205 | + return this; |
| 206 | + }, |
| 207 | + _setOptions: function( options ) { |
| 208 | + var self = this; |
183 | 209 | $.each( options, function( key, value ) { |
184 | 210 | self._setOption( key, value ); |
185 | 211 | }); |
186 | 212 | |
187 | | - return self; |
| 213 | + return this; |
188 | 214 | }, |
189 | 215 | _setOption: function( key, value ) { |
190 | 216 | this.options[ key ] = value; |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.core.js |
— | — | @@ -1,83 +1,25 @@ |
2 | 2 | /*! |
3 | | - * jQuery UI 1.8.2 |
| 3 | + * jQuery UI 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI |
10 | 10 | */ |
| 11 | +(function( $, undefined ) { |
11 | 12 | |
12 | | -(function($) { |
13 | | - |
14 | 13 | // prevent duplicate loading |
15 | 14 | // this is only a problem because we proxy existing functions |
16 | 15 | // and we don't want to double proxy them |
17 | 16 | $.ui = $.ui || {}; |
18 | | -if ($.ui.version) { |
| 17 | +if ( $.ui.version ) { |
19 | 18 | return; |
20 | 19 | } |
21 | 20 | |
22 | | -//Helper functions and ui object |
23 | | -$.extend($.ui, { |
24 | | - version: "1.8.2", |
| 21 | +$.extend( $.ui, { |
| 22 | + version: "1.8.11", |
25 | 23 | |
26 | | - // $.ui.plugin is deprecated. Use the proxy pattern instead. |
27 | | - plugin: { |
28 | | - add: function(module, option, set) { |
29 | | - var proto = $.ui[module].prototype; |
30 | | - for(var i in set) { |
31 | | - proto.plugins[i] = proto.plugins[i] || []; |
32 | | - proto.plugins[i].push([option, set[i]]); |
33 | | - } |
34 | | - }, |
35 | | - call: function(instance, name, args) { |
36 | | - var set = instance.plugins[name]; |
37 | | - if(!set || !instance.element[0].parentNode) { return; } |
38 | | - |
39 | | - for (var i = 0; i < set.length; i++) { |
40 | | - if (instance.options[set[i][0]]) { |
41 | | - set[i][1].apply(instance.element, args); |
42 | | - } |
43 | | - } |
44 | | - } |
45 | | - }, |
46 | | - |
47 | | - contains: function(a, b) { |
48 | | - return document.compareDocumentPosition |
49 | | - ? a.compareDocumentPosition(b) & 16 |
50 | | - : a !== b && a.contains(b); |
51 | | - }, |
52 | | - |
53 | | - hasScroll: function(el, a) { |
54 | | - |
55 | | - //If overflow is hidden, the element might have extra content, but the user wants to hide it |
56 | | - if ($(el).css('overflow') == 'hidden') { return false; } |
57 | | - |
58 | | - var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', |
59 | | - has = false; |
60 | | - |
61 | | - if (el[scroll] > 0) { return true; } |
62 | | - |
63 | | - // TODO: determine which cases actually cause this to happen |
64 | | - // if the element doesn't have the scroll set, see if it's possible to |
65 | | - // set the scroll |
66 | | - el[scroll] = 1; |
67 | | - has = (el[scroll] > 0); |
68 | | - el[scroll] = 0; |
69 | | - return has; |
70 | | - }, |
71 | | - |
72 | | - isOverAxis: function(x, reference, size) { |
73 | | - //Determines when x coordinate is over "b" element axis |
74 | | - return (x > reference) && (x < (reference + size)); |
75 | | - }, |
76 | | - |
77 | | - isOver: function(y, x, top, left, height, width) { |
78 | | - //Determines when x, y coordinates is over "b" element |
79 | | - return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); |
80 | | - }, |
81 | | - |
82 | 24 | keyCode: { |
83 | 25 | ALT: 18, |
84 | 26 | BACKSPACE: 8, |
— | — | @@ -114,36 +56,26 @@ |
115 | 57 | } |
116 | 58 | }); |
117 | 59 | |
118 | | -//jQuery plugins |
| 60 | +// plugins |
119 | 61 | $.fn.extend({ |
120 | 62 | _focus: $.fn.focus, |
121 | | - focus: function(delay, fn) { |
122 | | - return typeof delay === 'number' |
123 | | - ? this.each(function() { |
| 63 | + focus: function( delay, fn ) { |
| 64 | + return typeof delay === "number" ? |
| 65 | + this.each(function() { |
124 | 66 | var elem = this; |
125 | 67 | setTimeout(function() { |
126 | | - $(elem).focus(); |
127 | | - (fn && fn.call(elem)); |
128 | | - }, delay); |
129 | | - }) |
130 | | - : this._focus.apply(this, arguments); |
| 68 | + $( elem ).focus(); |
| 69 | + if ( fn ) { |
| 70 | + fn.call( elem ); |
| 71 | + } |
| 72 | + }, delay ); |
| 73 | + }) : |
| 74 | + this._focus.apply( this, arguments ); |
131 | 75 | }, |
132 | | - |
133 | | - enableSelection: function() { |
134 | | - return this |
135 | | - .attr('unselectable', 'off') |
136 | | - .css('MozUserSelect', ''); |
137 | | - }, |
138 | 76 | |
139 | | - disableSelection: function() { |
140 | | - return this |
141 | | - .attr('unselectable', 'on') |
142 | | - .css('MozUserSelect', 'none'); |
143 | | - }, |
144 | | - |
145 | 77 | scrollParent: function() { |
146 | 78 | var scrollParent; |
147 | | - if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { |
| 79 | + if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { |
148 | 80 | scrollParent = this.parents().filter(function() { |
149 | 81 | 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)); |
150 | 82 | }).eq(0); |
— | — | @@ -156,26 +88,25 @@ |
157 | 89 | return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; |
158 | 90 | }, |
159 | 91 | |
160 | | - zIndex: function(zIndex) { |
161 | | - if (zIndex !== undefined) { |
162 | | - return this.css('zIndex', zIndex); |
| 92 | + zIndex: function( zIndex ) { |
| 93 | + if ( zIndex !== undefined ) { |
| 94 | + return this.css( "zIndex", zIndex ); |
163 | 95 | } |
164 | | - |
165 | | - if (this.length) { |
166 | | - var elem = $(this[0]), position, value; |
167 | | - while (elem.length && elem[0] !== document) { |
| 96 | + |
| 97 | + if ( this.length ) { |
| 98 | + var elem = $( this[ 0 ] ), position, value; |
| 99 | + while ( elem.length && elem[ 0 ] !== document ) { |
168 | 100 | // Ignore z-index if position is set to a value where z-index is ignored by the browser |
169 | 101 | // This makes behavior of this function consistent across browsers |
170 | 102 | // WebKit always returns auto if the element is positioned |
171 | | - position = elem.css('position'); |
172 | | - if (position == 'absolute' || position == 'relative' || position == 'fixed') |
173 | | - { |
| 103 | + position = elem.css( "position" ); |
| 104 | + if ( position === "absolute" || position === "relative" || position === "fixed" ) { |
174 | 105 | // IE returns 0 when zIndex is not specified |
175 | 106 | // other browsers return a string |
176 | 107 | // we ignore the case of nested elements with an explicit value of 0 |
177 | 108 | // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> |
178 | | - value = parseInt(elem.css('zIndex')); |
179 | | - if (!isNaN(value) && value != 0) { |
| 109 | + value = parseInt( elem.css( "zIndex" ), 10 ); |
| 110 | + if ( !isNaN( value ) && value !== 0 ) { |
180 | 111 | return value; |
181 | 112 | } |
182 | 113 | } |
— | — | @@ -184,33 +115,194 @@ |
185 | 116 | } |
186 | 117 | |
187 | 118 | return 0; |
| 119 | + }, |
| 120 | + |
| 121 | + disableSelection: function() { |
| 122 | + return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + |
| 123 | + ".ui-disableSelection", function( event ) { |
| 124 | + event.preventDefault(); |
| 125 | + }); |
| 126 | + }, |
| 127 | + |
| 128 | + enableSelection: function() { |
| 129 | + return this.unbind( ".ui-disableSelection" ); |
188 | 130 | } |
189 | 131 | }); |
190 | 132 | |
| 133 | +$.each( [ "Width", "Height" ], function( i, name ) { |
| 134 | + var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], |
| 135 | + type = name.toLowerCase(), |
| 136 | + orig = { |
| 137 | + innerWidth: $.fn.innerWidth, |
| 138 | + innerHeight: $.fn.innerHeight, |
| 139 | + outerWidth: $.fn.outerWidth, |
| 140 | + outerHeight: $.fn.outerHeight |
| 141 | + }; |
191 | 142 | |
192 | | -//Additional selectors |
193 | | -$.extend($.expr[':'], { |
194 | | - data: function(elem, i, match) { |
195 | | - return !!$.data(elem, match[3]); |
| 143 | + function reduce( elem, size, border, margin ) { |
| 144 | + $.each( side, function() { |
| 145 | + size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; |
| 146 | + if ( border ) { |
| 147 | + size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; |
| 148 | + } |
| 149 | + if ( margin ) { |
| 150 | + size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; |
| 151 | + } |
| 152 | + }); |
| 153 | + return size; |
| 154 | + } |
| 155 | + |
| 156 | + $.fn[ "inner" + name ] = function( size ) { |
| 157 | + if ( size === undefined ) { |
| 158 | + return orig[ "inner" + name ].call( this ); |
| 159 | + } |
| 160 | + |
| 161 | + return this.each(function() { |
| 162 | + $( this ).css( type, reduce( this, size ) + "px" ); |
| 163 | + }); |
| 164 | + }; |
| 165 | + |
| 166 | + $.fn[ "outer" + name] = function( size, margin ) { |
| 167 | + if ( typeof size !== "number" ) { |
| 168 | + return orig[ "outer" + name ].call( this, size ); |
| 169 | + } |
| 170 | + |
| 171 | + return this.each(function() { |
| 172 | + $( this).css( type, reduce( this, size, true, margin ) + "px" ); |
| 173 | + }); |
| 174 | + }; |
| 175 | +}); |
| 176 | + |
| 177 | +// selectors |
| 178 | +function visible( element ) { |
| 179 | + return !$( element ).parents().andSelf().filter(function() { |
| 180 | + return $.curCSS( this, "visibility" ) === "hidden" || |
| 181 | + $.expr.filters.hidden( this ); |
| 182 | + }).length; |
| 183 | +} |
| 184 | + |
| 185 | +$.extend( $.expr[ ":" ], { |
| 186 | + data: function( elem, i, match ) { |
| 187 | + return !!$.data( elem, match[ 3 ] ); |
196 | 188 | }, |
197 | 189 | |
198 | | - focusable: function(element) { |
| 190 | + focusable: function( element ) { |
199 | 191 | var nodeName = element.nodeName.toLowerCase(), |
200 | | - tabIndex = $.attr(element, 'tabindex'); |
201 | | - return (/input|select|textarea|button|object/.test(nodeName) |
| 192 | + tabIndex = $.attr( element, "tabindex" ); |
| 193 | + if ( "area" === nodeName ) { |
| 194 | + var map = element.parentNode, |
| 195 | + mapName = map.name, |
| 196 | + img; |
| 197 | + if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { |
| 198 | + return false; |
| 199 | + } |
| 200 | + img = $( "img[usemap=#" + mapName + "]" )[0]; |
| 201 | + return !!img && visible( img ); |
| 202 | + } |
| 203 | + return ( /input|select|textarea|button|object/.test( nodeName ) |
202 | 204 | ? !element.disabled |
203 | | - : 'a' == nodeName || 'area' == nodeName |
204 | | - ? element.href || !isNaN(tabIndex) |
205 | | - : !isNaN(tabIndex)) |
| 205 | + : "a" == nodeName |
| 206 | + ? element.href || !isNaN( tabIndex ) |
| 207 | + : !isNaN( tabIndex )) |
206 | 208 | // the element and all of its ancestors must be visible |
207 | | - // the browser may report that the area is hidden |
208 | | - && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; |
| 209 | + && visible( element ); |
209 | 210 | }, |
210 | 211 | |
211 | | - tabbable: function(element) { |
212 | | - var tabIndex = $.attr(element, 'tabindex'); |
213 | | - return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); |
| 212 | + tabbable: function( element ) { |
| 213 | + var tabIndex = $.attr( element, "tabindex" ); |
| 214 | + return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" ); |
214 | 215 | } |
215 | 216 | }); |
216 | 217 | |
217 | | -})(jQuery); |
| 218 | +// support |
| 219 | +$(function() { |
| 220 | + var body = document.body, |
| 221 | + div = body.appendChild( div = document.createElement( "div" ) ); |
| 222 | + |
| 223 | + $.extend( div.style, { |
| 224 | + minHeight: "100px", |
| 225 | + height: "auto", |
| 226 | + padding: 0, |
| 227 | + borderWidth: 0 |
| 228 | + }); |
| 229 | + |
| 230 | + $.support.minHeight = div.offsetHeight === 100; |
| 231 | + $.support.selectstart = "onselectstart" in div; |
| 232 | + |
| 233 | + // set display to none to avoid a layout bug in IE |
| 234 | + // http://dev.jquery.com/ticket/4014 |
| 235 | + body.removeChild( div ).style.display = "none"; |
| 236 | +}); |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | +// deprecated |
| 243 | +$.extend( $.ui, { |
| 244 | + // $.ui.plugin is deprecated. Use the proxy pattern instead. |
| 245 | + plugin: { |
| 246 | + add: function( module, option, set ) { |
| 247 | + var proto = $.ui[ module ].prototype; |
| 248 | + for ( var i in set ) { |
| 249 | + proto.plugins[ i ] = proto.plugins[ i ] || []; |
| 250 | + proto.plugins[ i ].push( [ option, set[ i ] ] ); |
| 251 | + } |
| 252 | + }, |
| 253 | + call: function( instance, name, args ) { |
| 254 | + var set = instance.plugins[ name ]; |
| 255 | + if ( !set || !instance.element[ 0 ].parentNode ) { |
| 256 | + return; |
| 257 | + } |
| 258 | + |
| 259 | + for ( var i = 0; i < set.length; i++ ) { |
| 260 | + if ( instance.options[ set[ i ][ 0 ] ] ) { |
| 261 | + set[ i ][ 1 ].apply( instance.element, args ); |
| 262 | + } |
| 263 | + } |
| 264 | + } |
| 265 | + }, |
| 266 | + |
| 267 | + // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() |
| 268 | + contains: function( a, b ) { |
| 269 | + return document.compareDocumentPosition ? |
| 270 | + a.compareDocumentPosition( b ) & 16 : |
| 271 | + a !== b && a.contains( b ); |
| 272 | + }, |
| 273 | + |
| 274 | + // only used by resizable |
| 275 | + hasScroll: function( el, a ) { |
| 276 | + |
| 277 | + //If overflow is hidden, the element might have extra content, but the user wants to hide it |
| 278 | + if ( $( el ).css( "overflow" ) === "hidden") { |
| 279 | + return false; |
| 280 | + } |
| 281 | + |
| 282 | + var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", |
| 283 | + has = false; |
| 284 | + |
| 285 | + if ( el[ scroll ] > 0 ) { |
| 286 | + return true; |
| 287 | + } |
| 288 | + |
| 289 | + // TODO: determine which cases actually cause this to happen |
| 290 | + // if the element doesn't have the scroll set, see if it's possible to |
| 291 | + // set the scroll |
| 292 | + el[ scroll ] = 1; |
| 293 | + has = ( el[ scroll ] > 0 ); |
| 294 | + el[ scroll ] = 0; |
| 295 | + return has; |
| 296 | + }, |
| 297 | + |
| 298 | + // these are odd functions, fix the API or move into individual plugins |
| 299 | + isOverAxis: function( x, reference, size ) { |
| 300 | + //Determines when x coordinate is over "b" element axis |
| 301 | + return ( x > reference ) && ( x < ( reference + size ) ); |
| 302 | + }, |
| 303 | + isOver: function( y, x, top, left, height, width ) { |
| 304 | + //Determines when x, y coordinates is over "b" element |
| 305 | + return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); |
| 306 | + } |
| 307 | +}); |
| 308 | + |
| 309 | +})( jQuery ); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.mouse.js |
— | — | @@ -1,16 +1,16 @@ |
2 | 2 | /*! |
3 | | - * jQuery UI Mouse 1.8.2 |
| 3 | + * jQuery UI Mouse 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Mouse |
10 | 10 | * |
11 | 11 | * Depends: |
12 | 12 | * jquery.ui.widget.js |
13 | 13 | */ |
14 | | -(function($) { |
| 14 | +(function( $, undefined ) { |
15 | 15 | |
16 | 16 | $.widget("ui.mouse", { |
17 | 17 | options: { |
— | — | @@ -26,8 +26,8 @@ |
27 | 27 | return self._mouseDown(event); |
28 | 28 | }) |
29 | 29 | .bind('click.'+this.widgetName, function(event) { |
30 | | - if(self._preventClickEvent) { |
31 | | - self._preventClickEvent = false; |
| 30 | + if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { |
| 31 | + $.removeData(event.target, self.widgetName + '.preventClickEvent'); |
32 | 32 | event.stopImmediatePropagation(); |
33 | 33 | return false; |
34 | 34 | } |
— | — | @@ -75,6 +75,11 @@ |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
| 79 | + // Click event may never have fired (Gecko & Opera) |
| 80 | + if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { |
| 81 | + $.removeData(event.target, this.widgetName + '.preventClickEvent'); |
| 82 | + } |
| 83 | + |
79 | 84 | // these delegates are required to keep context |
80 | 85 | this._mouseMoveDelegate = function(event) { |
81 | 86 | return self._mouseMove(event); |
— | — | @@ -86,18 +91,14 @@ |
87 | 92 | .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
88 | 93 | .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
89 | 94 | |
90 | | - // preventDefault() is used to prevent the selection of text here - |
91 | | - // however, in Safari, this causes select boxes not to be selectable |
92 | | - // anymore, so this fix is needed |
93 | | - ($.browser.safari || event.preventDefault()); |
94 | | - |
| 95 | + event.preventDefault(); |
95 | 96 | event.originalEvent.mouseHandled = true; |
96 | 97 | return true; |
97 | 98 | }, |
98 | 99 | |
99 | 100 | _mouseMove: function(event) { |
100 | 101 | // IE mouseup check - mouseup happened when mouse was out of window |
101 | | - if ($.browser.msie && !event.button) { |
| 102 | + if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { |
102 | 103 | return this._mouseUp(event); |
103 | 104 | } |
104 | 105 | |
— | — | @@ -122,7 +123,11 @@ |
123 | 124 | |
124 | 125 | if (this._mouseStarted) { |
125 | 126 | this._mouseStarted = false; |
126 | | - this._preventClickEvent = (event.target == this._mouseDownEvent.target); |
| 127 | + |
| 128 | + if (event.target == this._mouseDownEvent.target) { |
| 129 | + $.data(event.target, this.widgetName + '.preventClickEvent', true); |
| 130 | + } |
| 131 | + |
127 | 132 | this._mouseStop(event); |
128 | 133 | } |
129 | 134 | |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.tabs.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Tabs 1.8.2 |
| 3 | + * jQuery UI Tabs 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Tabs |
10 | 10 | * |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * jquery.ui.core.js |
13 | 13 | * jquery.ui.widget.js |
14 | 14 | */ |
15 | | -(function($) { |
| 15 | +(function( $, undefined ) { |
16 | 16 | |
17 | 17 | var tabId = 0, |
18 | 18 | listId = 0; |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | return ++listId; |
26 | 26 | } |
27 | 27 | |
28 | | -$.widget("ui.tabs", { |
| 28 | +$.widget( "ui.tabs", { |
29 | 29 | options: { |
30 | 30 | add: null, |
31 | 31 | ajaxOptions: null, |
— | — | @@ -34,619 +34,650 @@ |
35 | 35 | disable: null, |
36 | 36 | disabled: [], |
37 | 37 | enable: null, |
38 | | - event: 'click', |
| 38 | + event: "click", |
39 | 39 | fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } |
40 | | - idPrefix: 'ui-tabs-', |
| 40 | + idPrefix: "ui-tabs-", |
41 | 41 | load: null, |
42 | | - panelTemplate: '<div></div>', |
| 42 | + panelTemplate: "<div></div>", |
43 | 43 | remove: null, |
44 | 44 | select: null, |
45 | 45 | show: null, |
46 | | - spinner: '<em>Loading…</em>', |
47 | | - tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>' |
| 46 | + spinner: "<em>Loading…</em>", |
| 47 | + tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>" |
48 | 48 | }, |
| 49 | + |
49 | 50 | _create: function() { |
50 | | - this._tabify(true); |
| 51 | + this._tabify( true ); |
51 | 52 | }, |
52 | 53 | |
53 | | - _setOption: function(key, value) { |
54 | | - if (key == 'selected') { |
55 | | - if (this.options.collapsible && value == this.options.selected) { |
| 54 | + _setOption: function( key, value ) { |
| 55 | + if ( key == "selected" ) { |
| 56 | + if (this.options.collapsible && value == this.options.selected ) { |
56 | 57 | return; |
57 | 58 | } |
58 | | - this.select(value); |
59 | | - } |
60 | | - else { |
61 | | - this.options[key] = value; |
| 59 | + this.select( value ); |
| 60 | + } else { |
| 61 | + this.options[ key ] = value; |
62 | 62 | this._tabify(); |
63 | 63 | } |
64 | 64 | }, |
65 | 65 | |
66 | | - _tabId: function(a) { |
67 | | - return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || |
| 66 | + _tabId: function( a ) { |
| 67 | + return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || |
68 | 68 | this.options.idPrefix + getNextTabId(); |
69 | 69 | }, |
70 | 70 | |
71 | | - _sanitizeSelector: function(hash) { |
72 | | - return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" |
| 71 | + _sanitizeSelector: function( hash ) { |
| 72 | + // we need this because an id may contain a ":" |
| 73 | + return hash.replace( /:/g, "\\:" ); |
73 | 74 | }, |
74 | 75 | |
75 | 76 | _cookie: function() { |
76 | | - var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + getNextListId()); |
77 | | - return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); |
| 77 | + var cookie = this.cookie || |
| 78 | + ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); |
| 79 | + return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); |
78 | 80 | }, |
79 | 81 | |
80 | | - _ui: function(tab, panel) { |
| 82 | + _ui: function( tab, panel ) { |
81 | 83 | return { |
82 | 84 | tab: tab, |
83 | 85 | panel: panel, |
84 | | - index: this.anchors.index(tab) |
| 86 | + index: this.anchors.index( tab ) |
85 | 87 | }; |
86 | 88 | }, |
87 | 89 | |
88 | 90 | _cleanup: function() { |
89 | 91 | // restore all former loading tabs labels |
90 | | - this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') |
91 | | - .find('span:data(label.tabs)') |
| 92 | + this.lis.filter( ".ui-state-processing" ) |
| 93 | + .removeClass( "ui-state-processing" ) |
| 94 | + .find( "span:data(label.tabs)" ) |
92 | 95 | .each(function() { |
93 | | - var el = $(this); |
94 | | - el.html(el.data('label.tabs')).removeData('label.tabs'); |
| 96 | + var el = $( this ); |
| 97 | + el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); |
95 | 98 | }); |
96 | 99 | }, |
97 | 100 | |
98 | | - _tabify: function(init) { |
| 101 | + _tabify: function( init ) { |
| 102 | + var self = this, |
| 103 | + o = this.options, |
| 104 | + fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash |
99 | 105 | |
100 | | - this.list = this.element.find('ol,ul').eq(0); |
101 | | - this.lis = $('li:has(a[href])', this.list); |
102 | | - this.anchors = this.lis.map(function() { return $('a', this)[0]; }); |
103 | | - this.panels = $([]); |
| 106 | + this.list = this.element.find( "ol,ul" ).eq( 0 ); |
| 107 | + this.lis = $( " > li:has(a[href])", this.list ); |
| 108 | + this.anchors = this.lis.map(function() { |
| 109 | + return $( "a", this )[ 0 ]; |
| 110 | + }); |
| 111 | + this.panels = $( [] ); |
104 | 112 | |
105 | | - var self = this, o = this.options; |
106 | | - |
107 | | - var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash |
108 | | - this.anchors.each(function(i, a) { |
109 | | - var href = $(a).attr('href'); |
110 | | - |
| 113 | + this.anchors.each(function( i, a ) { |
| 114 | + var href = $( a ).attr( "href" ); |
111 | 115 | // For dynamically created HTML that contains a hash as href IE < 8 expands |
112 | 116 | // such href to the full page url with hash and then misinterprets tab as ajax. |
113 | 117 | // Same consideration applies for an added tab with a fragment identifier |
114 | 118 | // since a[href=#fragment-identifier] does unexpectedly not match. |
115 | 119 | // Thus normalize href attribute... |
116 | | - var hrefBase = href.split('#')[0], baseEl; |
117 | | - if (hrefBase && (hrefBase === location.toString().split('#')[0] || |
118 | | - (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { |
| 120 | + var hrefBase = href.split( "#" )[ 0 ], |
| 121 | + baseEl; |
| 122 | + if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || |
| 123 | + ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { |
119 | 124 | href = a.hash; |
120 | 125 | a.href = href; |
121 | 126 | } |
122 | 127 | |
123 | 128 | // inline tab |
124 | | - if (fragmentId.test(href)) { |
125 | | - self.panels = self.panels.add(self._sanitizeSelector(href)); |
126 | | - } |
127 | | - |
| 129 | + if ( fragmentId.test( href ) ) { |
| 130 | + self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); |
128 | 131 | // remote tab |
129 | | - else if (href != '#') { // prevent loading the page itself if href is just "#" |
130 | | - $.data(a, 'href.tabs', href); // required for restore on destroy |
| 132 | + // prevent loading the page itself if href is just "#" |
| 133 | + } else if ( href && href !== "#" ) { |
| 134 | + // required for restore on destroy |
| 135 | + $.data( a, "href.tabs", href ); |
131 | 136 | |
132 | 137 | // TODO until #3808 is fixed strip fragment identifier from url |
133 | 138 | // (IE fails to load from such url) |
134 | | - $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data |
| 139 | + $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); |
135 | 140 | |
136 | | - var id = self._tabId(a); |
137 | | - a.href = '#' + id; |
138 | | - var $panel = $('#' + id); |
139 | | - if (!$panel.length) { |
140 | | - $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') |
141 | | - .insertAfter(self.panels[i - 1] || self.list); |
142 | | - $panel.data('destroy.tabs', true); |
| 141 | + var id = self._tabId( a ); |
| 142 | + a.href = "#" + id; |
| 143 | + var $panel = self.element.find( "#" + id ); |
| 144 | + if ( !$panel.length ) { |
| 145 | + $panel = $( o.panelTemplate ) |
| 146 | + .attr( "id", id ) |
| 147 | + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) |
| 148 | + .insertAfter( self.panels[ i - 1 ] || self.list ); |
| 149 | + $panel.data( "destroy.tabs", true ); |
143 | 150 | } |
144 | | - self.panels = self.panels.add($panel); |
145 | | - } |
146 | | - |
| 151 | + self.panels = self.panels.add( $panel ); |
147 | 152 | // invalid tab href |
148 | | - else { |
149 | | - o.disabled.push(i); |
| 153 | + } else { |
| 154 | + o.disabled.push( i ); |
150 | 155 | } |
151 | 156 | }); |
152 | 157 | |
153 | 158 | // initialization from scratch |
154 | | - if (init) { |
155 | | - |
| 159 | + if ( init ) { |
156 | 160 | // attach necessary classes for styling |
157 | | - this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); |
158 | | - this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
159 | | - this.lis.addClass('ui-state-default ui-corner-top'); |
160 | | - this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); |
| 161 | + this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); |
| 162 | + this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); |
| 163 | + this.lis.addClass( "ui-state-default ui-corner-top" ); |
| 164 | + this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); |
161 | 165 | |
162 | 166 | // Selected tab |
163 | 167 | // use "selected" option or try to retrieve: |
164 | 168 | // 1. from fragment identifier in url |
165 | 169 | // 2. from cookie |
166 | 170 | // 3. from selected class attribute on <li> |
167 | | - if (o.selected === undefined) { |
168 | | - if (location.hash) { |
169 | | - this.anchors.each(function(i, a) { |
170 | | - if (a.hash == location.hash) { |
| 171 | + if ( o.selected === undefined ) { |
| 172 | + if ( location.hash ) { |
| 173 | + this.anchors.each(function( i, a ) { |
| 174 | + if ( a.hash == location.hash ) { |
171 | 175 | o.selected = i; |
172 | | - return false; // break |
| 176 | + return false; |
173 | 177 | } |
174 | 178 | }); |
175 | 179 | } |
176 | | - if (typeof o.selected != 'number' && o.cookie) { |
177 | | - o.selected = parseInt(self._cookie(), 10); |
| 180 | + if ( typeof o.selected !== "number" && o.cookie ) { |
| 181 | + o.selected = parseInt( self._cookie(), 10 ); |
178 | 182 | } |
179 | | - if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { |
180 | | - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
| 183 | + if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { |
| 184 | + o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); |
181 | 185 | } |
182 | | - o.selected = o.selected || (this.lis.length ? 0 : -1); |
183 | | - } |
184 | | - else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release |
| 186 | + o.selected = o.selected || ( this.lis.length ? 0 : -1 ); |
| 187 | + } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release |
185 | 188 | o.selected = -1; |
186 | 189 | } |
187 | 190 | |
188 | 191 | // sanity check - default to first tab... |
189 | | - o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; |
| 192 | + o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) |
| 193 | + ? o.selected |
| 194 | + : 0; |
190 | 195 | |
191 | 196 | // Take disabling tabs via class attribute from HTML |
192 | 197 | // into account and update option properly. |
193 | 198 | // A selected tab cannot become disabled. |
194 | | - o.disabled = $.unique(o.disabled.concat( |
195 | | - $.map(this.lis.filter('.ui-state-disabled'), |
196 | | - function(n, i) { return self.lis.index(n); } ) |
197 | | - )).sort(); |
| 199 | + o.disabled = $.unique( o.disabled.concat( |
| 200 | + $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { |
| 201 | + return self.lis.index( n ); |
| 202 | + }) |
| 203 | + ) ).sort(); |
198 | 204 | |
199 | | - if ($.inArray(o.selected, o.disabled) != -1) { |
200 | | - o.disabled.splice($.inArray(o.selected, o.disabled), 1); |
| 205 | + if ( $.inArray( o.selected, o.disabled ) != -1 ) { |
| 206 | + o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); |
201 | 207 | } |
202 | 208 | |
203 | 209 | // highlight selected tab |
204 | | - this.panels.addClass('ui-tabs-hide'); |
205 | | - this.lis.removeClass('ui-tabs-selected ui-state-active'); |
206 | | - if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list |
207 | | - this.panels.eq(o.selected).removeClass('ui-tabs-hide'); |
208 | | - this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); |
| 210 | + this.panels.addClass( "ui-tabs-hide" ); |
| 211 | + this.lis.removeClass( "ui-tabs-selected ui-state-active" ); |
| 212 | + // check for length avoids error when initializing empty list |
| 213 | + if ( o.selected >= 0 && this.anchors.length ) { |
| 214 | + self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); |
| 215 | + this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); |
209 | 216 | |
210 | 217 | // seems to be expected behavior that the show callback is fired |
211 | | - self.element.queue("tabs", function() { |
212 | | - self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); |
| 218 | + self.element.queue( "tabs", function() { |
| 219 | + self._trigger( "show", null, |
| 220 | + self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); |
213 | 221 | }); |
214 | | - |
215 | | - this.load(o.selected); |
| 222 | + |
| 223 | + this.load( o.selected ); |
216 | 224 | } |
217 | 225 | |
218 | 226 | // clean up to avoid memory leaks in certain versions of IE 6 |
219 | | - $(window).bind('unload', function() { |
220 | | - self.lis.add(self.anchors).unbind('.tabs'); |
| 227 | + // TODO: namespace this event |
| 228 | + $( window ).bind( "unload", function() { |
| 229 | + self.lis.add( self.anchors ).unbind( ".tabs" ); |
221 | 230 | self.lis = self.anchors = self.panels = null; |
222 | 231 | }); |
223 | | - |
224 | | - } |
225 | 232 | // update selected after add/remove |
226 | | - else { |
227 | | - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
| 233 | + } else { |
| 234 | + o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); |
228 | 235 | } |
229 | 236 | |
230 | 237 | // update collapsible |
231 | | - this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); |
| 238 | + // TODO: use .toggleClass() |
| 239 | + this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); |
232 | 240 | |
233 | 241 | // set or update cookie after init and add/remove respectively |
234 | | - if (o.cookie) { |
235 | | - this._cookie(o.selected, o.cookie); |
| 242 | + if ( o.cookie ) { |
| 243 | + this._cookie( o.selected, o.cookie ); |
236 | 244 | } |
237 | 245 | |
238 | 246 | // disable tabs |
239 | | - for (var i = 0, li; (li = this.lis[i]); i++) { |
240 | | - $(li)[$.inArray(i, o.disabled) != -1 && |
241 | | - !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); |
| 247 | + for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { |
| 248 | + $( li )[ $.inArray( i, o.disabled ) != -1 && |
| 249 | + // TODO: use .toggleClass() |
| 250 | + !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); |
242 | 251 | } |
243 | 252 | |
244 | 253 | // reset cache if switching from cached to not cached |
245 | | - if (o.cache === false) { |
246 | | - this.anchors.removeData('cache.tabs'); |
| 254 | + if ( o.cache === false ) { |
| 255 | + this.anchors.removeData( "cache.tabs" ); |
247 | 256 | } |
248 | 257 | |
249 | 258 | // remove all handlers before, tabify may run on existing tabs after add or option change |
250 | | - this.lis.add(this.anchors).unbind('.tabs'); |
| 259 | + this.lis.add( this.anchors ).unbind( ".tabs" ); |
251 | 260 | |
252 | | - if (o.event != 'mouseover') { |
253 | | - var addState = function(state, el) { |
254 | | - if (el.is(':not(.ui-state-disabled)')) { |
255 | | - el.addClass('ui-state-' + state); |
| 261 | + if ( o.event !== "mouseover" ) { |
| 262 | + var addState = function( state, el ) { |
| 263 | + if ( el.is( ":not(.ui-state-disabled)" ) ) { |
| 264 | + el.addClass( "ui-state-" + state ); |
256 | 265 | } |
257 | 266 | }; |
258 | | - var removeState = function(state, el) { |
259 | | - el.removeClass('ui-state-' + state); |
| 267 | + var removeState = function( state, el ) { |
| 268 | + el.removeClass( "ui-state-" + state ); |
260 | 269 | }; |
261 | | - this.lis.bind('mouseover.tabs', function() { |
262 | | - addState('hover', $(this)); |
| 270 | + this.lis.bind( "mouseover.tabs" , function() { |
| 271 | + addState( "hover", $( this ) ); |
263 | 272 | }); |
264 | | - this.lis.bind('mouseout.tabs', function() { |
265 | | - removeState('hover', $(this)); |
| 273 | + this.lis.bind( "mouseout.tabs", function() { |
| 274 | + removeState( "hover", $( this ) ); |
266 | 275 | }); |
267 | | - this.anchors.bind('focus.tabs', function() { |
268 | | - addState('focus', $(this).closest('li')); |
| 276 | + this.anchors.bind( "focus.tabs", function() { |
| 277 | + addState( "focus", $( this ).closest( "li" ) ); |
269 | 278 | }); |
270 | | - this.anchors.bind('blur.tabs', function() { |
271 | | - removeState('focus', $(this).closest('li')); |
| 279 | + this.anchors.bind( "blur.tabs", function() { |
| 280 | + removeState( "focus", $( this ).closest( "li" ) ); |
272 | 281 | }); |
273 | 282 | } |
274 | 283 | |
275 | 284 | // set up animations |
276 | 285 | var hideFx, showFx; |
277 | | - if (o.fx) { |
278 | | - if ($.isArray(o.fx)) { |
279 | | - hideFx = o.fx[0]; |
280 | | - showFx = o.fx[1]; |
281 | | - } |
282 | | - else { |
| 286 | + if ( o.fx ) { |
| 287 | + if ( $.isArray( o.fx ) ) { |
| 288 | + hideFx = o.fx[ 0 ]; |
| 289 | + showFx = o.fx[ 1 ]; |
| 290 | + } else { |
283 | 291 | hideFx = showFx = o.fx; |
284 | 292 | } |
285 | 293 | } |
286 | 294 | |
287 | 295 | // Reset certain styles left over from animation |
288 | 296 | // and prevent IE's ClearType bug... |
289 | | - function resetStyle($el, fx) { |
290 | | - $el.css({ display: '' }); |
291 | | - if (!$.support.opacity && fx.opacity) { |
292 | | - $el[0].style.removeAttribute('filter'); |
| 297 | + function resetStyle( $el, fx ) { |
| 298 | + $el.css( "display", "" ); |
| 299 | + if ( !$.support.opacity && fx.opacity ) { |
| 300 | + $el[ 0 ].style.removeAttribute( "filter" ); |
293 | 301 | } |
294 | 302 | } |
295 | 303 | |
296 | 304 | // Show a tab... |
297 | | - var showTab = showFx ? |
298 | | - function(clicked, $show) { |
299 | | - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active'); |
300 | | - $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way |
301 | | - .animate(showFx, showFx.duration || 'normal', function() { |
302 | | - resetStyle($show, showFx); |
303 | | - self._trigger('show', null, self._ui(clicked, $show[0])); |
| 305 | + var showTab = showFx |
| 306 | + ? function( clicked, $show ) { |
| 307 | + $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); |
| 308 | + $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way |
| 309 | + .animate( showFx, showFx.duration || "normal", function() { |
| 310 | + resetStyle( $show, showFx ); |
| 311 | + self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); |
304 | 312 | }); |
305 | | - } : |
306 | | - function(clicked, $show) { |
307 | | - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active'); |
308 | | - $show.removeClass('ui-tabs-hide'); |
309 | | - self._trigger('show', null, self._ui(clicked, $show[0])); |
| 313 | + } |
| 314 | + : function( clicked, $show ) { |
| 315 | + $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); |
| 316 | + $show.removeClass( "ui-tabs-hide" ); |
| 317 | + self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); |
310 | 318 | }; |
311 | 319 | |
312 | 320 | // Hide a tab, $show is optional... |
313 | | - var hideTab = hideFx ? |
314 | | - function(clicked, $hide) { |
315 | | - $hide.animate(hideFx, hideFx.duration || 'normal', function() { |
316 | | - self.lis.removeClass('ui-tabs-selected ui-state-active'); |
317 | | - $hide.addClass('ui-tabs-hide'); |
318 | | - resetStyle($hide, hideFx); |
319 | | - self.element.dequeue("tabs"); |
| 321 | + var hideTab = hideFx |
| 322 | + ? function( clicked, $hide ) { |
| 323 | + $hide.animate( hideFx, hideFx.duration || "normal", function() { |
| 324 | + self.lis.removeClass( "ui-tabs-selected ui-state-active" ); |
| 325 | + $hide.addClass( "ui-tabs-hide" ); |
| 326 | + resetStyle( $hide, hideFx ); |
| 327 | + self.element.dequeue( "tabs" ); |
320 | 328 | }); |
321 | | - } : |
322 | | - function(clicked, $hide, $show) { |
323 | | - self.lis.removeClass('ui-tabs-selected ui-state-active'); |
324 | | - $hide.addClass('ui-tabs-hide'); |
325 | | - self.element.dequeue("tabs"); |
| 329 | + } |
| 330 | + : function( clicked, $hide, $show ) { |
| 331 | + self.lis.removeClass( "ui-tabs-selected ui-state-active" ); |
| 332 | + $hide.addClass( "ui-tabs-hide" ); |
| 333 | + self.element.dequeue( "tabs" ); |
326 | 334 | }; |
327 | 335 | |
328 | 336 | // attach tab event handler, unbind to avoid duplicates from former tabifying... |
329 | | - this.anchors.bind(o.event + '.tabs', function() { |
330 | | - var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), |
331 | | - $show = $(self._sanitizeSelector(this.hash)); |
| 337 | + this.anchors.bind( o.event + ".tabs", function() { |
| 338 | + var el = this, |
| 339 | + $li = $(el).closest( "li" ), |
| 340 | + $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), |
| 341 | + $show = self.element.find( self._sanitizeSelector( el.hash ) ); |
332 | 342 | |
333 | 343 | // If tab is already selected and not collapsible or tab disabled or |
334 | 344 | // or is already loading or click callback returns false stop here. |
335 | 345 | // Check if click handler returns false last so that it is not executed |
336 | 346 | // for a disabled or loading tab! |
337 | | - if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || |
338 | | - $li.hasClass('ui-state-disabled') || |
339 | | - $li.hasClass('ui-state-processing') || |
340 | | - self._trigger('select', null, self._ui(this, $show[0])) === false) { |
| 347 | + if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || |
| 348 | + $li.hasClass( "ui-state-disabled" ) || |
| 349 | + $li.hasClass( "ui-state-processing" ) || |
| 350 | + self.panels.filter( ":animated" ).length || |
| 351 | + self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { |
341 | 352 | this.blur(); |
342 | 353 | return false; |
343 | 354 | } |
344 | 355 | |
345 | | - o.selected = self.anchors.index(this); |
| 356 | + o.selected = self.anchors.index( this ); |
346 | 357 | |
347 | 358 | self.abort(); |
348 | 359 | |
349 | 360 | // if tab may be closed |
350 | | - if (o.collapsible) { |
351 | | - if ($li.hasClass('ui-tabs-selected')) { |
| 361 | + if ( o.collapsible ) { |
| 362 | + if ( $li.hasClass( "ui-tabs-selected" ) ) { |
352 | 363 | o.selected = -1; |
353 | 364 | |
354 | | - if (o.cookie) { |
355 | | - self._cookie(o.selected, o.cookie); |
| 365 | + if ( o.cookie ) { |
| 366 | + self._cookie( o.selected, o.cookie ); |
356 | 367 | } |
357 | 368 | |
358 | | - self.element.queue("tabs", function() { |
359 | | - hideTab(el, $hide); |
360 | | - }).dequeue("tabs"); |
361 | | - |
| 369 | + self.element.queue( "tabs", function() { |
| 370 | + hideTab( el, $hide ); |
| 371 | + }).dequeue( "tabs" ); |
| 372 | + |
362 | 373 | this.blur(); |
363 | 374 | return false; |
364 | | - } |
365 | | - else if (!$hide.length) { |
366 | | - if (o.cookie) { |
367 | | - self._cookie(o.selected, o.cookie); |
| 375 | + } else if ( !$hide.length ) { |
| 376 | + if ( o.cookie ) { |
| 377 | + self._cookie( o.selected, o.cookie ); |
368 | 378 | } |
369 | | - |
370 | | - self.element.queue("tabs", function() { |
371 | | - showTab(el, $show); |
| 379 | + |
| 380 | + self.element.queue( "tabs", function() { |
| 381 | + showTab( el, $show ); |
372 | 382 | }); |
373 | 383 | |
374 | | - self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 |
375 | | - |
| 384 | + // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 |
| 385 | + self.load( self.anchors.index( this ) ); |
| 386 | + |
376 | 387 | this.blur(); |
377 | 388 | return false; |
378 | 389 | } |
379 | 390 | } |
380 | 391 | |
381 | | - if (o.cookie) { |
382 | | - self._cookie(o.selected, o.cookie); |
| 392 | + if ( o.cookie ) { |
| 393 | + self._cookie( o.selected, o.cookie ); |
383 | 394 | } |
384 | 395 | |
385 | 396 | // show new tab |
386 | | - if ($show.length) { |
387 | | - if ($hide.length) { |
388 | | - self.element.queue("tabs", function() { |
389 | | - hideTab(el, $hide); |
| 397 | + if ( $show.length ) { |
| 398 | + if ( $hide.length ) { |
| 399 | + self.element.queue( "tabs", function() { |
| 400 | + hideTab( el, $hide ); |
390 | 401 | }); |
391 | 402 | } |
392 | | - self.element.queue("tabs", function() { |
393 | | - showTab(el, $show); |
| 403 | + self.element.queue( "tabs", function() { |
| 404 | + showTab( el, $show ); |
394 | 405 | }); |
395 | | - |
396 | | - self.load(self.anchors.index(this)); |
| 406 | + |
| 407 | + self.load( self.anchors.index( this ) ); |
| 408 | + } else { |
| 409 | + throw "jQuery UI Tabs: Mismatching fragment identifier."; |
397 | 410 | } |
398 | | - else { |
399 | | - throw 'jQuery UI Tabs: Mismatching fragment identifier.'; |
400 | | - } |
401 | 411 | |
402 | 412 | // Prevent IE from keeping other link focussed when using the back button |
403 | 413 | // and remove dotted border from clicked link. This is controlled via CSS |
404 | 414 | // in modern browsers; blur() removes focus from address bar in Firefox |
405 | 415 | // which can become a usability and annoying problem with tabs('rotate'). |
406 | | - if ($.browser.msie) { |
| 416 | + if ( $.browser.msie ) { |
407 | 417 | this.blur(); |
408 | 418 | } |
409 | | - |
410 | 419 | }); |
411 | 420 | |
412 | 421 | // disable click in any case |
413 | | - this.anchors.bind('click.tabs', function(){return false;}); |
| 422 | + this.anchors.bind( "click.tabs", function(){ |
| 423 | + return false; |
| 424 | + }); |
| 425 | + }, |
414 | 426 | |
| 427 | + _getIndex: function( index ) { |
| 428 | + // meta-function to give users option to provide a href string instead of a numerical index. |
| 429 | + // also sanitizes numerical indexes to valid values. |
| 430 | + if ( typeof index == "string" ) { |
| 431 | + index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); |
| 432 | + } |
| 433 | + |
| 434 | + return index; |
415 | 435 | }, |
416 | 436 | |
417 | 437 | destroy: function() { |
418 | 438 | var o = this.options; |
419 | 439 | |
420 | 440 | this.abort(); |
421 | | - |
422 | | - this.element.unbind('.tabs') |
423 | | - .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') |
424 | | - .removeData('tabs'); |
425 | 441 | |
426 | | - this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
| 442 | + this.element |
| 443 | + .unbind( ".tabs" ) |
| 444 | + .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) |
| 445 | + .removeData( "tabs" ); |
427 | 446 | |
| 447 | + this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); |
| 448 | + |
428 | 449 | this.anchors.each(function() { |
429 | | - var href = $.data(this, 'href.tabs'); |
430 | | - if (href) { |
| 450 | + var href = $.data( this, "href.tabs" ); |
| 451 | + if ( href ) { |
431 | 452 | this.href = href; |
432 | 453 | } |
433 | | - var $this = $(this).unbind('.tabs'); |
434 | | - $.each(['href', 'load', 'cache'], function(i, prefix) { |
435 | | - $this.removeData(prefix + '.tabs'); |
| 454 | + var $this = $( this ).unbind( ".tabs" ); |
| 455 | + $.each( [ "href", "load", "cache" ], function( i, prefix ) { |
| 456 | + $this.removeData( prefix + ".tabs" ); |
436 | 457 | }); |
437 | 458 | }); |
438 | 459 | |
439 | | - this.lis.unbind('.tabs').add(this.panels).each(function() { |
440 | | - if ($.data(this, 'destroy.tabs')) { |
441 | | - $(this).remove(); |
| 460 | + this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { |
| 461 | + if ( $.data( this, "destroy.tabs" ) ) { |
| 462 | + $( this ).remove(); |
| 463 | + } else { |
| 464 | + $( this ).removeClass([ |
| 465 | + "ui-state-default", |
| 466 | + "ui-corner-top", |
| 467 | + "ui-tabs-selected", |
| 468 | + "ui-state-active", |
| 469 | + "ui-state-hover", |
| 470 | + "ui-state-focus", |
| 471 | + "ui-state-disabled", |
| 472 | + "ui-tabs-panel", |
| 473 | + "ui-widget-content", |
| 474 | + "ui-corner-bottom", |
| 475 | + "ui-tabs-hide" |
| 476 | + ].join( " " ) ); |
442 | 477 | } |
443 | | - else { |
444 | | - $(this).removeClass([ |
445 | | - 'ui-state-default', |
446 | | - 'ui-corner-top', |
447 | | - 'ui-tabs-selected', |
448 | | - 'ui-state-active', |
449 | | - 'ui-state-hover', |
450 | | - 'ui-state-focus', |
451 | | - 'ui-state-disabled', |
452 | | - 'ui-tabs-panel', |
453 | | - 'ui-widget-content', |
454 | | - 'ui-corner-bottom', |
455 | | - 'ui-tabs-hide' |
456 | | - ].join(' ')); |
457 | | - } |
458 | 478 | }); |
459 | 479 | |
460 | | - if (o.cookie) { |
461 | | - this._cookie(null, o.cookie); |
| 480 | + if ( o.cookie ) { |
| 481 | + this._cookie( null, o.cookie ); |
462 | 482 | } |
463 | 483 | |
464 | 484 | return this; |
465 | 485 | }, |
466 | 486 | |
467 | | - add: function(url, label, index) { |
468 | | - if (index === undefined) { |
469 | | - index = this.anchors.length; // append by default |
| 487 | + add: function( url, label, index ) { |
| 488 | + if ( index === undefined ) { |
| 489 | + index = this.anchors.length; |
470 | 490 | } |
471 | 491 | |
472 | | - var self = this, o = this.options, |
473 | | - $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), |
474 | | - id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); |
| 492 | + var self = this, |
| 493 | + o = this.options, |
| 494 | + $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), |
| 495 | + id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); |
475 | 496 | |
476 | | - $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); |
| 497 | + $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); |
477 | 498 | |
478 | 499 | // try to find an existing element before creating a new one |
479 | | - var $panel = $('#' + id); |
480 | | - if (!$panel.length) { |
481 | | - $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); |
| 500 | + var $panel = self.element.find( "#" + id ); |
| 501 | + if ( !$panel.length ) { |
| 502 | + $panel = $( o.panelTemplate ) |
| 503 | + .attr( "id", id ) |
| 504 | + .data( "destroy.tabs", true ); |
482 | 505 | } |
483 | | - $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); |
| 506 | + $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); |
484 | 507 | |
485 | | - if (index >= this.lis.length) { |
486 | | - $li.appendTo(this.list); |
487 | | - $panel.appendTo(this.list[0].parentNode); |
| 508 | + if ( index >= this.lis.length ) { |
| 509 | + $li.appendTo( this.list ); |
| 510 | + $panel.appendTo( this.list[ 0 ].parentNode ); |
| 511 | + } else { |
| 512 | + $li.insertBefore( this.lis[ index ] ); |
| 513 | + $panel.insertBefore( this.panels[ index ] ); |
488 | 514 | } |
489 | | - else { |
490 | | - $li.insertBefore(this.lis[index]); |
491 | | - $panel.insertBefore(this.panels[index]); |
492 | | - } |
493 | 515 | |
494 | | - o.disabled = $.map(o.disabled, |
495 | | - function(n, i) { return n >= index ? ++n : n; }); |
| 516 | + o.disabled = $.map( o.disabled, function( n, i ) { |
| 517 | + return n >= index ? ++n : n; |
| 518 | + }); |
496 | 519 | |
497 | 520 | this._tabify(); |
498 | 521 | |
499 | | - if (this.anchors.length == 1) { // after tabify |
| 522 | + if ( this.anchors.length == 1 ) { |
500 | 523 | o.selected = 0; |
501 | | - $li.addClass('ui-tabs-selected ui-state-active'); |
502 | | - $panel.removeClass('ui-tabs-hide'); |
503 | | - this.element.queue("tabs", function() { |
504 | | - self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); |
| 524 | + $li.addClass( "ui-tabs-selected ui-state-active" ); |
| 525 | + $panel.removeClass( "ui-tabs-hide" ); |
| 526 | + this.element.queue( "tabs", function() { |
| 527 | + self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); |
505 | 528 | }); |
506 | | - |
507 | | - this.load(0); |
| 529 | + |
| 530 | + this.load( 0 ); |
508 | 531 | } |
509 | 532 | |
510 | | - // callback |
511 | | - this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); |
| 533 | + this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); |
512 | 534 | return this; |
513 | 535 | }, |
514 | 536 | |
515 | | - remove: function(index) { |
516 | | - var o = this.options, $li = this.lis.eq(index).remove(), |
517 | | - $panel = this.panels.eq(index).remove(); |
| 537 | + remove: function( index ) { |
| 538 | + index = this._getIndex( index ); |
| 539 | + var o = this.options, |
| 540 | + $li = this.lis.eq( index ).remove(), |
| 541 | + $panel = this.panels.eq( index ).remove(); |
518 | 542 | |
519 | 543 | // If selected tab was removed focus tab to the right or |
520 | 544 | // in case the last tab was removed the tab to the left. |
521 | | - if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { |
522 | | - this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); |
| 545 | + if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { |
| 546 | + this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); |
523 | 547 | } |
524 | 548 | |
525 | | - o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), |
526 | | - function(n, i) { return n >= index ? --n : n; }); |
| 549 | + o.disabled = $.map( |
| 550 | + $.grep( o.disabled, function(n, i) { |
| 551 | + return n != index; |
| 552 | + }), |
| 553 | + function( n, i ) { |
| 554 | + return n >= index ? --n : n; |
| 555 | + }); |
527 | 556 | |
528 | 557 | this._tabify(); |
529 | 558 | |
530 | | - // callback |
531 | | - this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); |
| 559 | + this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); |
532 | 560 | return this; |
533 | 561 | }, |
534 | 562 | |
535 | | - enable: function(index) { |
| 563 | + enable: function( index ) { |
| 564 | + index = this._getIndex( index ); |
536 | 565 | var o = this.options; |
537 | | - if ($.inArray(index, o.disabled) == -1) { |
| 566 | + if ( $.inArray( index, o.disabled ) == -1 ) { |
538 | 567 | return; |
539 | 568 | } |
540 | 569 | |
541 | | - this.lis.eq(index).removeClass('ui-state-disabled'); |
542 | | - o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); |
| 570 | + this.lis.eq( index ).removeClass( "ui-state-disabled" ); |
| 571 | + o.disabled = $.grep( o.disabled, function( n, i ) { |
| 572 | + return n != index; |
| 573 | + }); |
543 | 574 | |
544 | | - // callback |
545 | | - this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); |
| 575 | + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); |
546 | 576 | return this; |
547 | 577 | }, |
548 | 578 | |
549 | | - disable: function(index) { |
| 579 | + disable: function( index ) { |
| 580 | + index = this._getIndex( index ); |
550 | 581 | var self = this, o = this.options; |
551 | | - if (index != o.selected) { // cannot disable already selected tab |
552 | | - this.lis.eq(index).addClass('ui-state-disabled'); |
| 582 | + // cannot disable already selected tab |
| 583 | + if ( index != o.selected ) { |
| 584 | + this.lis.eq( index ).addClass( "ui-state-disabled" ); |
553 | 585 | |
554 | | - o.disabled.push(index); |
| 586 | + o.disabled.push( index ); |
555 | 587 | o.disabled.sort(); |
556 | 588 | |
557 | | - // callback |
558 | | - this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); |
| 589 | + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); |
559 | 590 | } |
560 | 591 | |
561 | 592 | return this; |
562 | 593 | }, |
563 | 594 | |
564 | | - select: function(index) { |
565 | | - if (typeof index == 'string') { |
566 | | - index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); |
| 595 | + select: function( index ) { |
| 596 | + index = this._getIndex( index ); |
| 597 | + if ( index == -1 ) { |
| 598 | + if ( this.options.collapsible && this.options.selected != -1 ) { |
| 599 | + index = this.options.selected; |
| 600 | + } else { |
| 601 | + return this; |
| 602 | + } |
567 | 603 | } |
568 | | - else if (index === null) { // usage of null is deprecated, TODO remove in next release |
569 | | - index = -1; |
570 | | - } |
571 | | - if (index == -1 && this.options.collapsible) { |
572 | | - index = this.options.selected; |
573 | | - } |
574 | | - |
575 | | - this.anchors.eq(index).trigger(this.options.event + '.tabs'); |
| 604 | + this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); |
576 | 605 | return this; |
577 | 606 | }, |
578 | 607 | |
579 | | - load: function(index) { |
580 | | - var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); |
| 608 | + load: function( index ) { |
| 609 | + index = this._getIndex( index ); |
| 610 | + var self = this, |
| 611 | + o = this.options, |
| 612 | + a = this.anchors.eq( index )[ 0 ], |
| 613 | + url = $.data( a, "load.tabs" ); |
581 | 614 | |
582 | 615 | this.abort(); |
583 | 616 | |
584 | 617 | // not remote or from cache |
585 | | - if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { |
586 | | - this.element.dequeue("tabs"); |
| 618 | + if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { |
| 619 | + this.element.dequeue( "tabs" ); |
587 | 620 | return; |
588 | 621 | } |
589 | 622 | |
590 | 623 | // load remote from here on |
591 | | - this.lis.eq(index).addClass('ui-state-processing'); |
| 624 | + this.lis.eq( index ).addClass( "ui-state-processing" ); |
592 | 625 | |
593 | | - if (o.spinner) { |
594 | | - var span = $('span', a); |
595 | | - span.data('label.tabs', span.html()).html(o.spinner); |
| 626 | + if ( o.spinner ) { |
| 627 | + var span = $( "span", a ); |
| 628 | + span.data( "label.tabs", span.html() ).html( o.spinner ); |
596 | 629 | } |
597 | 630 | |
598 | | - this.xhr = $.ajax($.extend({}, o.ajaxOptions, { |
| 631 | + this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { |
599 | 632 | url: url, |
600 | | - success: function(r, s) { |
601 | | - $(self._sanitizeSelector(a.hash)).html(r); |
| 633 | + success: function( r, s ) { |
| 634 | + self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); |
602 | 635 | |
603 | 636 | // take care of tab labels |
604 | 637 | self._cleanup(); |
605 | 638 | |
606 | | - if (o.cache) { |
607 | | - $.data(a, 'cache.tabs', true); // if loaded once do not load them again |
| 639 | + if ( o.cache ) { |
| 640 | + $.data( a, "cache.tabs", true ); |
608 | 641 | } |
609 | 642 | |
610 | | - // callbacks |
611 | | - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); |
| 643 | + self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); |
612 | 644 | try { |
613 | | - o.ajaxOptions.success(r, s); |
| 645 | + o.ajaxOptions.success( r, s ); |
614 | 646 | } |
615 | | - catch (e) {} |
| 647 | + catch ( e ) {} |
616 | 648 | }, |
617 | | - error: function(xhr, s, e) { |
| 649 | + error: function( xhr, s, e ) { |
618 | 650 | // take care of tab labels |
619 | 651 | self._cleanup(); |
620 | 652 | |
621 | | - // callbacks |
622 | | - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); |
| 653 | + self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); |
623 | 654 | try { |
624 | 655 | // Passing index avoid a race condition when this method is |
625 | 656 | // called after the user has selected another tab. |
626 | 657 | // Pass the anchor that initiated this request allows |
627 | 658 | // loadError to manipulate the tab content panel via $(a.hash) |
628 | | - o.ajaxOptions.error(xhr, s, index, a); |
| 659 | + o.ajaxOptions.error( xhr, s, index, a ); |
629 | 660 | } |
630 | | - catch (e) {} |
| 661 | + catch ( e ) {} |
631 | 662 | } |
632 | | - })); |
| 663 | + } ) ); |
633 | 664 | |
634 | 665 | // last, so that load event is fired before show... |
635 | | - self.element.dequeue("tabs"); |
| 666 | + self.element.dequeue( "tabs" ); |
636 | 667 | |
637 | 668 | return this; |
638 | 669 | }, |
639 | 670 | |
640 | 671 | abort: function() { |
641 | 672 | // stop possibly running animations |
642 | | - this.element.queue([]); |
643 | | - this.panels.stop(false, true); |
| 673 | + this.element.queue( [] ); |
| 674 | + this.panels.stop( false, true ); |
644 | 675 | |
645 | 676 | // "tabs" queue must not contain more than two elements, |
646 | 677 | // which are the callbacks for the latest clicked tab... |
647 | | - this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2)); |
| 678 | + this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); |
648 | 679 | |
649 | 680 | // terminate pending requests from other tabs |
650 | | - if (this.xhr) { |
| 681 | + if ( this.xhr ) { |
651 | 682 | this.xhr.abort(); |
652 | 683 | delete this.xhr; |
653 | 684 | } |
— | — | @@ -656,19 +687,18 @@ |
657 | 688 | return this; |
658 | 689 | }, |
659 | 690 | |
660 | | - url: function(index, url) { |
661 | | - this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); |
| 691 | + url: function( index, url ) { |
| 692 | + this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); |
662 | 693 | return this; |
663 | 694 | }, |
664 | 695 | |
665 | 696 | length: function() { |
666 | 697 | return this.anchors.length; |
667 | 698 | } |
668 | | - |
669 | 699 | }); |
670 | 700 | |
671 | | -$.extend($.ui.tabs, { |
672 | | - version: '1.8.2' |
| 701 | +$.extend( $.ui.tabs, { |
| 702 | + version: "1.8.11" |
673 | 703 | }); |
674 | 704 | |
675 | 705 | /* |
— | — | @@ -678,46 +708,45 @@ |
679 | 709 | /* |
680 | 710 | * Rotate |
681 | 711 | */ |
682 | | -$.extend($.ui.tabs.prototype, { |
| 712 | +$.extend( $.ui.tabs.prototype, { |
683 | 713 | rotation: null, |
684 | | - rotate: function(ms, continuing) { |
| 714 | + rotate: function( ms, continuing ) { |
| 715 | + var self = this, |
| 716 | + o = this.options; |
685 | 717 | |
686 | | - var self = this, o = this.options; |
687 | | - |
688 | | - var rotate = self._rotate || (self._rotate = function(e) { |
689 | | - clearTimeout(self.rotation); |
| 718 | + var rotate = self._rotate || ( self._rotate = function( e ) { |
| 719 | + clearTimeout( self.rotation ); |
690 | 720 | self.rotation = setTimeout(function() { |
691 | 721 | var t = o.selected; |
692 | 722 | self.select( ++t < self.anchors.length ? t : 0 ); |
693 | | - }, ms); |
| 723 | + }, ms ); |
694 | 724 | |
695 | | - if (e) { |
| 725 | + if ( e ) { |
696 | 726 | e.stopPropagation(); |
697 | 727 | } |
698 | 728 | }); |
699 | | - |
700 | | - var stop = self._unrotate || (self._unrotate = !continuing ? |
701 | | - function(e) { |
| 729 | + |
| 730 | + var stop = self._unrotate || ( self._unrotate = !continuing |
| 731 | + ? function(e) { |
702 | 732 | if (e.clientX) { // in case of a true click |
703 | 733 | self.rotate(null); |
704 | 734 | } |
705 | | - } : |
706 | | - function(e) { |
| 735 | + } |
| 736 | + : function( e ) { |
707 | 737 | t = o.selected; |
708 | 738 | rotate(); |
709 | 739 | }); |
710 | 740 | |
711 | 741 | // start rotation |
712 | | - if (ms) { |
713 | | - this.element.bind('tabsshow', rotate); |
714 | | - this.anchors.bind(o.event + '.tabs', stop); |
| 742 | + if ( ms ) { |
| 743 | + this.element.bind( "tabsshow", rotate ); |
| 744 | + this.anchors.bind( o.event + ".tabs", stop ); |
715 | 745 | rotate(); |
716 | | - } |
717 | 746 | // stop rotation |
718 | | - else { |
719 | | - clearTimeout(self.rotation); |
720 | | - this.element.unbind('tabsshow', rotate); |
721 | | - this.anchors.unbind(o.event + '.tabs', stop); |
| 747 | + } else { |
| 748 | + clearTimeout( self.rotation ); |
| 749 | + this.element.unbind( "tabsshow", rotate ); |
| 750 | + this.anchors.unbind( o.event + ".tabs", stop ); |
722 | 751 | delete this._rotate; |
723 | 752 | delete this._unrotate; |
724 | 753 | } |
— | — | @@ -726,4 +755,4 @@ |
727 | 756 | } |
728 | 757 | }); |
729 | 758 | |
730 | | -})(jQuery); |
| 759 | +})( jQuery ); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.progressbar.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Progressbar 1.8.2 |
| 3 | + * jQuery UI Progressbar 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Progressbar |
10 | 10 | * |
— | — | @@ -11,25 +11,30 @@ |
12 | 12 | * jquery.ui.core.js |
13 | 13 | * jquery.ui.widget.js |
14 | 14 | */ |
15 | | -(function( $ ) { |
| 15 | +(function( $, undefined ) { |
16 | 16 | |
17 | 17 | $.widget( "ui.progressbar", { |
18 | 18 | options: { |
19 | | - value: 0 |
| 19 | + value: 0, |
| 20 | + max: 100 |
20 | 21 | }, |
| 22 | + |
| 23 | + min: 0, |
| 24 | + |
21 | 25 | _create: function() { |
22 | 26 | this.element |
23 | 27 | .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) |
24 | 28 | .attr({ |
25 | 29 | role: "progressbar", |
26 | | - "aria-valuemin": this._valueMin(), |
27 | | - "aria-valuemax": this._valueMax(), |
| 30 | + "aria-valuemin": this.min, |
| 31 | + "aria-valuemax": this.options.max, |
28 | 32 | "aria-valuenow": this._value() |
29 | 33 | }); |
30 | 34 | |
31 | 35 | this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) |
32 | 36 | .appendTo( this.element ); |
33 | 37 | |
| 38 | + this.oldValue = this._value(); |
34 | 39 | this._refreshValue(); |
35 | 40 | }, |
36 | 41 | |
— | — | @@ -56,12 +61,12 @@ |
57 | 62 | }, |
58 | 63 | |
59 | 64 | _setOption: function( key, value ) { |
60 | | - switch ( key ) { |
61 | | - case "value": |
62 | | - this.options.value = value; |
63 | | - this._refreshValue(); |
64 | | - this._trigger( "change" ); |
65 | | - break; |
| 65 | + if ( key === "value" ) { |
| 66 | + this.options.value = value; |
| 67 | + this._refreshValue(); |
| 68 | + if ( this._value() === this.options.max ) { |
| 69 | + this._trigger( "complete" ); |
| 70 | + } |
66 | 71 | } |
67 | 72 | |
68 | 73 | $.Widget.prototype._setOption.apply( this, arguments ); |
— | — | @@ -73,35 +78,31 @@ |
74 | 79 | if ( typeof val !== "number" ) { |
75 | 80 | val = 0; |
76 | 81 | } |
77 | | - if ( val < this._valueMin() ) { |
78 | | - val = this._valueMin(); |
79 | | - } |
80 | | - if ( val > this._valueMax() ) { |
81 | | - val = this._valueMax(); |
82 | | - } |
83 | | - |
84 | | - return val; |
| 82 | + return Math.min( this.options.max, Math.max( this.min, val ) ); |
85 | 83 | }, |
86 | 84 | |
87 | | - _valueMin: function() { |
88 | | - return 0; |
| 85 | + _percentage: function() { |
| 86 | + return 100 * this._value() / this.options.max; |
89 | 87 | }, |
90 | 88 | |
91 | | - _valueMax: function() { |
92 | | - return 100; |
93 | | - }, |
94 | | - |
95 | 89 | _refreshValue: function() { |
96 | 90 | var value = this.value(); |
| 91 | + var percentage = this._percentage(); |
| 92 | + |
| 93 | + if ( this.oldValue !== value ) { |
| 94 | + this.oldValue = value; |
| 95 | + this._trigger( "change" ); |
| 96 | + } |
| 97 | + |
97 | 98 | this.valueDiv |
98 | | - [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" ) |
99 | | - .width( value + "%" ); |
| 99 | + .toggleClass( "ui-corner-right", value === this.options.max ) |
| 100 | + .width( percentage.toFixed(0) + "%" ); |
100 | 101 | this.element.attr( "aria-valuenow", value ); |
101 | 102 | } |
102 | 103 | }); |
103 | 104 | |
104 | 105 | $.extend( $.ui.progressbar, { |
105 | | - version: "1.8.2" |
| 106 | + version: "1.8.11" |
106 | 107 | }); |
107 | 108 | |
108 | 109 | })( jQuery ); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.dialog.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Dialog 1.8.2 |
| 3 | + * jQuery UI Dialog 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Dialog |
10 | 10 | * |
— | — | @@ -16,13 +16,28 @@ |
17 | 17 | * jquery.ui.position.js |
18 | 18 | * jquery.ui.resizable.js |
19 | 19 | */ |
20 | | -(function($) { |
| 20 | +(function( $, undefined ) { |
21 | 21 | |
22 | 22 | var uiDialogClasses = |
23 | | - 'ui-dialog ' + |
24 | | - 'ui-widget ' + |
25 | | - 'ui-widget-content ' + |
26 | | - 'ui-corner-all '; |
| 23 | + 'ui-dialog ' + |
| 24 | + 'ui-widget ' + |
| 25 | + 'ui-widget-content ' + |
| 26 | + 'ui-corner-all ', |
| 27 | + sizeRelatedOptions = { |
| 28 | + buttons: true, |
| 29 | + height: true, |
| 30 | + maxHeight: true, |
| 31 | + maxWidth: true, |
| 32 | + minHeight: true, |
| 33 | + minWidth: true, |
| 34 | + width: true |
| 35 | + }, |
| 36 | + resizableRelatedOptions = { |
| 37 | + maxHeight: true, |
| 38 | + maxWidth: true, |
| 39 | + minHeight: true, |
| 40 | + minWidth: true |
| 41 | + }; |
27 | 42 | |
28 | 43 | $.widget("ui.dialog", { |
29 | 44 | options: { |
— | — | @@ -39,7 +54,18 @@ |
40 | 55 | minHeight: 150, |
41 | 56 | minWidth: 150, |
42 | 57 | modal: false, |
43 | | - position: 'center', |
| 58 | + position: { |
| 59 | + my: 'center', |
| 60 | + at: 'center', |
| 61 | + collision: 'fit', |
| 62 | + // ensure that the titlebar is never outside the document |
| 63 | + using: function(pos) { |
| 64 | + var topOffset = $(this).css(pos).offset().top; |
| 65 | + if (topOffset < 0) { |
| 66 | + $(this).css('top', pos.top - topOffset); |
| 67 | + } |
| 68 | + } |
| 69 | + }, |
44 | 70 | resizable: true, |
45 | 71 | show: null, |
46 | 72 | stack: true, |
— | — | @@ -47,13 +73,19 @@ |
48 | 74 | width: 300, |
49 | 75 | zIndex: 1000 |
50 | 76 | }, |
| 77 | + |
51 | 78 | _create: function() { |
52 | 79 | this.originalTitle = this.element.attr('title'); |
| 80 | + // #5742 - .attr() might return a DOMElement |
| 81 | + if ( typeof this.originalTitle !== "string" ) { |
| 82 | + this.originalTitle = ""; |
| 83 | + } |
53 | 84 | |
| 85 | + this.options.title = this.options.title || this.originalTitle; |
54 | 86 | var self = this, |
55 | 87 | options = self.options, |
56 | 88 | |
57 | | - title = options.title || self.originalTitle || ' ', |
| 89 | + title = options.title || ' ', |
58 | 90 | titleId = $.ui.dialog.getTitleId(self.element), |
59 | 91 | |
60 | 92 | uiDialog = (self.uiDialog = $('<div></div>')) |
— | — | @@ -161,6 +193,7 @@ |
162 | 194 | uiDialog.bgiframe(); |
163 | 195 | } |
164 | 196 | }, |
| 197 | + |
165 | 198 | _init: function() { |
166 | 199 | if ( this.options.autoOpen ) { |
167 | 200 | this.open(); |
— | — | @@ -187,14 +220,14 @@ |
188 | 221 | |
189 | 222 | return self; |
190 | 223 | }, |
191 | | - |
| 224 | + |
192 | 225 | widget: function() { |
193 | 226 | return this.uiDialog; |
194 | 227 | }, |
195 | 228 | |
196 | 229 | close: function(event) { |
197 | 230 | var self = this, |
198 | | - maxZ; |
| 231 | + maxZ, thisZ; |
199 | 232 | |
200 | 233 | if (false === self._trigger('beforeClose', event)) { |
201 | 234 | return; |
— | — | @@ -223,7 +256,10 @@ |
224 | 257 | maxZ = 0; |
225 | 258 | $('.ui-dialog').each(function() { |
226 | 259 | if (this !== self.uiDialog[0]) { |
227 | | - maxZ = Math.max(maxZ, $(this).css('z-index')); |
| 260 | + thisZ = $(this).css('z-index'); |
| 261 | + if(!isNaN(thisZ)) { |
| 262 | + maxZ = Math.max(maxZ, thisZ); |
| 263 | + } |
228 | 264 | } |
229 | 265 | }); |
230 | 266 | $.ui.dialog.maxZ = maxZ; |
— | — | @@ -242,12 +278,12 @@ |
243 | 279 | var self = this, |
244 | 280 | options = self.options, |
245 | 281 | saveScroll; |
246 | | - |
| 282 | + |
247 | 283 | if ((options.modal && !force) || |
248 | 284 | (!options.stack && !options.modal)) { |
249 | 285 | return self._trigger('focus', event); |
250 | 286 | } |
251 | | - |
| 287 | + |
252 | 288 | if (options.zIndex > $.ui.dialog.maxZ) { |
253 | 289 | $.ui.dialog.maxZ = options.zIndex; |
254 | 290 | } |
— | — | @@ -275,9 +311,6 @@ |
276 | 312 | uiDialog = self.uiDialog; |
277 | 313 | |
278 | 314 | self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; |
279 | | - if (uiDialog.next().length) { |
280 | | - uiDialog.appendTo('body'); |
281 | | - } |
282 | 315 | self._size(); |
283 | 316 | self._position(options.position); |
284 | 317 | uiDialog.show(options.show); |
— | — | @@ -289,11 +322,11 @@ |
290 | 323 | if (event.keyCode !== $.ui.keyCode.TAB) { |
291 | 324 | return; |
292 | 325 | } |
293 | | - |
| 326 | + |
294 | 327 | var tabbables = $(':tabbable', this), |
295 | 328 | first = tabbables.filter(':first'), |
296 | 329 | last = tabbables.filter(':last'); |
297 | | - |
| 330 | + |
298 | 331 | if (event.target === last[0] && !event.shiftKey) { |
299 | 332 | first.focus(1); |
300 | 333 | return false; |
— | — | @@ -306,15 +339,12 @@ |
307 | 340 | |
308 | 341 | // set focus to the first tabbable element in the content area or the first button |
309 | 342 | // if there are no tabbable elements, set focus on the dialog itself |
310 | | - $([]) |
311 | | - .add(uiDialog.find('.ui-dialog-content :tabbable:first')) |
312 | | - .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) |
313 | | - .add(uiDialog) |
314 | | - .filter(':first') |
315 | | - .focus(); |
| 343 | + $(self.element.find(':tabbable').get().concat( |
| 344 | + uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( |
| 345 | + uiDialog.get()))).eq(0).focus(); |
316 | 346 | |
| 347 | + self._isOpen = true; |
317 | 348 | self._trigger('open'); |
318 | | - self._isOpen = true; |
319 | 349 | |
320 | 350 | return self; |
321 | 351 | }, |
— | — | @@ -327,7 +357,10 @@ |
328 | 358 | 'ui-dialog-buttonpane ' + |
329 | 359 | 'ui-widget-content ' + |
330 | 360 | 'ui-helper-clearfix' |
331 | | - ); |
| 361 | + ), |
| 362 | + uiButtonSet = $( "<div></div>" ) |
| 363 | + .addClass( "ui-dialog-buttonset" ) |
| 364 | + .appendTo( uiDialogButtonPane ); |
332 | 365 | |
333 | 366 | // if we already have a button pane, remove it |
334 | 367 | self.uiDialog.find('.ui-dialog-buttonpane').remove(); |
— | — | @@ -338,11 +371,17 @@ |
339 | 372 | }); |
340 | 373 | } |
341 | 374 | if (hasButtons) { |
342 | | - $.each(buttons, function(name, fn) { |
| 375 | + $.each(buttons, function(name, props) { |
| 376 | + props = $.isFunction( props ) ? |
| 377 | + { click: props, text: name } : |
| 378 | + props; |
343 | 379 | var button = $('<button type="button"></button>') |
344 | | - .text(name) |
345 | | - .click(function() { fn.apply(self.element[0], arguments); }) |
346 | | - .appendTo(uiDialogButtonPane); |
| 380 | + .attr( props, true ) |
| 381 | + .unbind('click') |
| 382 | + .click(function() { |
| 383 | + props.click.apply(self.element[0], arguments); |
| 384 | + }) |
| 385 | + .appendTo(uiButtonSet); |
347 | 386 | if ($.fn.button) { |
348 | 387 | button.button(); |
349 | 388 | } |
— | — | @@ -450,40 +489,34 @@ |
451 | 490 | offset = [0, 0], |
452 | 491 | isVisible; |
453 | 492 | |
454 | | - position = position || $.ui.dialog.prototype.options.position; |
| 493 | + if (position) { |
| 494 | + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( |
| 495 | + // if (typeof position == 'string' || $.isArray(position)) { |
| 496 | + // myAt = $.isArray(position) ? position : position.split(' '); |
455 | 497 | |
456 | | - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( |
457 | | -// if (typeof position == 'string' || $.isArray(position)) { |
458 | | -// myAt = $.isArray(position) ? position : position.split(' '); |
| 498 | + if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { |
| 499 | + myAt = position.split ? position.split(' ') : [position[0], position[1]]; |
| 500 | + if (myAt.length === 1) { |
| 501 | + myAt[1] = myAt[0]; |
| 502 | + } |
459 | 503 | |
460 | | - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { |
461 | | - myAt = position.split ? position.split(' ') : [position[0], position[1]]; |
462 | | - if (myAt.length === 1) { |
463 | | - myAt[1] = myAt[0]; |
464 | | - } |
| 504 | + $.each(['left', 'top'], function(i, offsetPosition) { |
| 505 | + if (+myAt[i] === myAt[i]) { |
| 506 | + offset[i] = myAt[i]; |
| 507 | + myAt[i] = offsetPosition; |
| 508 | + } |
| 509 | + }); |
465 | 510 | |
466 | | - $.each(['left', 'top'], function(i, offsetPosition) { |
467 | | - if (+myAt[i] === myAt[i]) { |
468 | | - offset[i] = myAt[i]; |
469 | | - myAt[i] = offsetPosition; |
470 | | - } |
471 | | - }); |
472 | | - } else if (typeof position === 'object') { |
473 | | - if ('left' in position) { |
474 | | - myAt[0] = 'left'; |
475 | | - offset[0] = position.left; |
476 | | - } else if ('right' in position) { |
477 | | - myAt[0] = 'right'; |
478 | | - offset[0] = -position.right; |
479 | | - } |
| 511 | + position = { |
| 512 | + my: myAt.join(" "), |
| 513 | + at: myAt.join(" "), |
| 514 | + offset: offset.join(" ") |
| 515 | + }; |
| 516 | + } |
480 | 517 | |
481 | | - if ('top' in position) { |
482 | | - myAt[1] = 'top'; |
483 | | - offset[1] = position.top; |
484 | | - } else if ('bottom' in position) { |
485 | | - myAt[1] = 'bottom'; |
486 | | - offset[1] = -position.bottom; |
487 | | - } |
| 518 | + position = $.extend({}, $.ui.dialog.prototype.options.position, position); |
| 519 | + } else { |
| 520 | + position = $.ui.dialog.prototype.options.position; |
488 | 521 | } |
489 | 522 | |
490 | 523 | // need to show the dialog to get the actual offset in the position plugin |
— | — | @@ -494,31 +527,40 @@ |
495 | 528 | this.uiDialog |
496 | 529 | // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 |
497 | 530 | .css({ top: 0, left: 0 }) |
498 | | - .position({ |
499 | | - my: myAt.join(' '), |
500 | | - at: myAt.join(' '), |
501 | | - offset: offset.join(' '), |
502 | | - of: window, |
503 | | - collision: 'fit', |
504 | | - // ensure that the titlebar is never outside the document |
505 | | - using: function(pos) { |
506 | | - var topOffset = $(this).css(pos).offset().top; |
507 | | - if (topOffset < 0) { |
508 | | - $(this).css('top', pos.top - topOffset); |
509 | | - } |
510 | | - } |
511 | | - }); |
| 531 | + .position($.extend({ of: window }, position)); |
512 | 532 | if (!isVisible) { |
513 | 533 | this.uiDialog.hide(); |
514 | 534 | } |
515 | 535 | }, |
516 | 536 | |
| 537 | + _setOptions: function( options ) { |
| 538 | + var self = this, |
| 539 | + resizableOptions = {}, |
| 540 | + resize = false; |
| 541 | + |
| 542 | + $.each( options, function( key, value ) { |
| 543 | + self._setOption( key, value ); |
| 544 | + |
| 545 | + if ( key in sizeRelatedOptions ) { |
| 546 | + resize = true; |
| 547 | + } |
| 548 | + if ( key in resizableRelatedOptions ) { |
| 549 | + resizableOptions[ key ] = value; |
| 550 | + } |
| 551 | + }); |
| 552 | + |
| 553 | + if ( resize ) { |
| 554 | + this._size(); |
| 555 | + } |
| 556 | + if ( this.uiDialog.is( ":data(resizable)" ) ) { |
| 557 | + this.uiDialog.resizable( "option", resizableOptions ); |
| 558 | + } |
| 559 | + }, |
| 560 | + |
517 | 561 | _setOption: function(key, value){ |
518 | 562 | var self = this, |
519 | | - uiDialog = self.uiDialog, |
520 | | - isResizable = uiDialog.is(':data(resizable)'), |
521 | | - resize = false; |
522 | | - |
| 563 | + uiDialog = self.uiDialog; |
| 564 | + |
523 | 565 | switch (key) { |
524 | 566 | //handling of deprecated beforeclose (vs beforeClose) option |
525 | 567 | //Ticket #4669 http://dev.jqueryui.com/ticket/4669 |
— | — | @@ -530,7 +572,7 @@ |
531 | 573 | self._createButtons(value); |
532 | 574 | break; |
533 | 575 | case "closeText": |
534 | | - // convert whatever was passed in to a string, for text() to not throw up |
| 576 | + // ensure that we always pass a string |
535 | 577 | self.uiDialogTitlebarCloseText.text("" + value); |
536 | 578 | break; |
537 | 579 | case "dialogClass": |
— | — | @@ -546,44 +588,21 @@ |
547 | 589 | } |
548 | 590 | break; |
549 | 591 | case "draggable": |
550 | | - if (value) { |
| 592 | + var isDraggable = uiDialog.is( ":data(draggable)" ); |
| 593 | + if ( isDraggable && !value ) { |
| 594 | + uiDialog.draggable( "destroy" ); |
| 595 | + } |
| 596 | + |
| 597 | + if ( !isDraggable && value ) { |
551 | 598 | self._makeDraggable(); |
552 | | - } else { |
553 | | - uiDialog.draggable('destroy'); |
554 | 599 | } |
555 | 600 | break; |
556 | | - case "height": |
557 | | - resize = true; |
558 | | - break; |
559 | | - case "maxHeight": |
560 | | - if (isResizable) { |
561 | | - uiDialog.resizable('option', 'maxHeight', value); |
562 | | - } |
563 | | - resize = true; |
564 | | - break; |
565 | | - case "maxWidth": |
566 | | - if (isResizable) { |
567 | | - uiDialog.resizable('option', 'maxWidth', value); |
568 | | - } |
569 | | - resize = true; |
570 | | - break; |
571 | | - case "minHeight": |
572 | | - if (isResizable) { |
573 | | - uiDialog.resizable('option', 'minHeight', value); |
574 | | - } |
575 | | - resize = true; |
576 | | - break; |
577 | | - case "minWidth": |
578 | | - if (isResizable) { |
579 | | - uiDialog.resizable('option', 'minWidth', value); |
580 | | - } |
581 | | - resize = true; |
582 | | - break; |
583 | 601 | case "position": |
584 | 602 | self._position(value); |
585 | 603 | break; |
586 | 604 | case "resizable": |
587 | 605 | // currently resizable, becoming non-resizable |
| 606 | + var isResizable = uiDialog.is( ":data(resizable)" ); |
588 | 607 | if (isResizable && !value) { |
589 | 608 | uiDialog.resizable('destroy'); |
590 | 609 | } |
— | — | @@ -602,15 +621,9 @@ |
603 | 622 | // convert whatever was passed in o a string, for html() to not throw up |
604 | 623 | $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); |
605 | 624 | break; |
606 | | - case "width": |
607 | | - resize = true; |
608 | | - break; |
609 | 625 | } |
610 | 626 | |
611 | 627 | $.Widget.prototype._setOption.apply(self, arguments); |
612 | | - if (resize) { |
613 | | - self._size(); |
614 | | - } |
615 | 628 | }, |
616 | 629 | |
617 | 630 | _size: function() { |
— | — | @@ -618,16 +631,21 @@ |
619 | 632 | * divs will both have width and height set, so we need to reset them |
620 | 633 | */ |
621 | 634 | var options = this.options, |
622 | | - nonContentHeight; |
| 635 | + nonContentHeight, |
| 636 | + minContentHeight, |
| 637 | + isVisible = this.uiDialog.is( ":visible" ); |
623 | 638 | |
624 | 639 | // reset content sizing |
625 | | - // hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350) |
626 | | - this.element.css({ |
| 640 | + this.element.show().css({ |
627 | 641 | width: 'auto', |
628 | 642 | minHeight: 0, |
629 | 643 | height: 0 |
630 | 644 | }); |
631 | 645 | |
| 646 | + if (options.minWidth > options.width) { |
| 647 | + options.width = options.minWidth; |
| 648 | + } |
| 649 | + |
632 | 650 | // reset wrapper sizing |
633 | 651 | // determine the height of all the non-content elements |
634 | 652 | nonContentHeight = this.uiDialog.css({ |
— | — | @@ -635,17 +653,27 @@ |
636 | 654 | width: options.width |
637 | 655 | }) |
638 | 656 | .height(); |
| 657 | + minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); |
| 658 | + |
| 659 | + if ( options.height === "auto" ) { |
| 660 | + // only needed for IE6 support |
| 661 | + if ( $.support.minHeight ) { |
| 662 | + this.element.css({ |
| 663 | + minHeight: minContentHeight, |
| 664 | + height: "auto" |
| 665 | + }); |
| 666 | + } else { |
| 667 | + this.uiDialog.show(); |
| 668 | + var autoHeight = this.element.css( "height", "auto" ).height(); |
| 669 | + if ( !isVisible ) { |
| 670 | + this.uiDialog.hide(); |
| 671 | + } |
| 672 | + this.element.height( Math.max( autoHeight, minContentHeight ) ); |
| 673 | + } |
| 674 | + } else { |
| 675 | + this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); |
| 676 | + } |
639 | 677 | |
640 | | - this.element |
641 | | - .css(options.height === 'auto' ? { |
642 | | - minHeight: Math.max(options.minHeight - nonContentHeight, 0), |
643 | | - height: 'auto' |
644 | | - } : { |
645 | | - minHeight: 0, |
646 | | - height: Math.max(options.height - nonContentHeight, 0) |
647 | | - }) |
648 | | - .show(); |
649 | | - |
650 | 678 | if (this.uiDialog.is(':data(resizable)')) { |
651 | 679 | this.uiDialog.resizable('option', 'minHeight', this._minHeight()); |
652 | 680 | } |
— | — | @@ -653,7 +681,7 @@ |
654 | 682 | }); |
655 | 683 | |
656 | 684 | $.extend($.ui.dialog, { |
657 | | - version: "1.8.2", |
| 685 | + version: "1.8.11", |
658 | 686 | |
659 | 687 | uuid: 0, |
660 | 688 | maxZ: 0, |
— | — | @@ -689,7 +717,10 @@ |
690 | 718 | if ($.ui.dialog.overlay.instances.length) { |
691 | 719 | $(document).bind($.ui.dialog.overlay.events, function(event) { |
692 | 720 | // stop events if the z-index of the target is < the z-index of the overlay |
693 | | - return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ); |
| 721 | + // we cannot return true when we don't want to cancel the event (#3523) |
| 722 | + if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { |
| 723 | + return false; |
| 724 | + } |
694 | 725 | }); |
695 | 726 | } |
696 | 727 | }, 1); |
— | — | @@ -724,7 +755,10 @@ |
725 | 756 | }, |
726 | 757 | |
727 | 758 | destroy: function($el) { |
728 | | - this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]); |
| 759 | + var indexOf = $.inArray($el, this.instances); |
| 760 | + if (indexOf != -1){ |
| 761 | + this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); |
| 762 | + } |
729 | 763 | |
730 | 764 | if (this.instances.length === 0) { |
731 | 765 | $([document, window]).unbind('.dialog-overlay'); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.accordion.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Accordion 1.8.2 |
| 3 | + * jQuery UI Accordion 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Accordion |
10 | 10 | * |
— | — | @@ -11,12 +11,12 @@ |
12 | 12 | * jquery.ui.core.js |
13 | 13 | * jquery.ui.widget.js |
14 | 14 | */ |
15 | | -(function($) { |
| 15 | +(function( $, undefined ) { |
16 | 16 | |
17 | | -$.widget("ui.accordion", { |
| 17 | +$.widget( "ui.accordion", { |
18 | 18 | options: { |
19 | 19 | active: 0, |
20 | | - animated: 'slide', |
| 20 | + animated: "slide", |
21 | 21 | autoHeight: true, |
22 | 22 | clearStyle: false, |
23 | 23 | collapsible: false, |
— | — | @@ -29,322 +29,398 @@ |
30 | 30 | }, |
31 | 31 | navigation: false, |
32 | 32 | navigationFilter: function() { |
33 | | - return this.href.toLowerCase() == location.href.toLowerCase(); |
| 33 | + return this.href.toLowerCase() === location.href.toLowerCase(); |
34 | 34 | } |
35 | 35 | }, |
| 36 | + |
36 | 37 | _create: function() { |
| 38 | + var self = this, |
| 39 | + options = self.options; |
37 | 40 | |
38 | | - var o = this.options, self = this; |
39 | | - this.running = 0; |
| 41 | + self.running = 0; |
40 | 42 | |
41 | | - this.element.addClass("ui-accordion ui-widget ui-helper-reset"); |
42 | | - |
43 | | - // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix |
44 | | - this.element.children("li").addClass("ui-accordion-li-fix"); |
| 43 | + self.element |
| 44 | + .addClass( "ui-accordion ui-widget ui-helper-reset" ) |
| 45 | + // in lack of child-selectors in CSS |
| 46 | + // we need to mark top-LIs in a UL-accordion for some IE-fix |
| 47 | + .children( "li" ) |
| 48 | + .addClass( "ui-accordion-li-fix" ); |
45 | 49 | |
46 | | - this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all") |
47 | | - .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); }) |
48 | | - .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); }) |
49 | | - .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); }) |
50 | | - .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); }); |
| 50 | + self.headers = self.element.find( options.header ) |
| 51 | + .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) |
| 52 | + .bind( "mouseenter.accordion", function() { |
| 53 | + if ( options.disabled ) { |
| 54 | + return; |
| 55 | + } |
| 56 | + $( this ).addClass( "ui-state-hover" ); |
| 57 | + }) |
| 58 | + .bind( "mouseleave.accordion", function() { |
| 59 | + if ( options.disabled ) { |
| 60 | + return; |
| 61 | + } |
| 62 | + $( this ).removeClass( "ui-state-hover" ); |
| 63 | + }) |
| 64 | + .bind( "focus.accordion", function() { |
| 65 | + if ( options.disabled ) { |
| 66 | + return; |
| 67 | + } |
| 68 | + $( this ).addClass( "ui-state-focus" ); |
| 69 | + }) |
| 70 | + .bind( "blur.accordion", function() { |
| 71 | + if ( options.disabled ) { |
| 72 | + return; |
| 73 | + } |
| 74 | + $( this ).removeClass( "ui-state-focus" ); |
| 75 | + }); |
51 | 76 | |
52 | | - this.headers |
53 | | - .next() |
54 | | - .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); |
| 77 | + self.headers.next() |
| 78 | + .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); |
55 | 79 | |
56 | | - if ( o.navigation ) { |
57 | | - var current = this.element.find("a").filter(o.navigationFilter); |
| 80 | + if ( options.navigation ) { |
| 81 | + var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); |
58 | 82 | if ( current.length ) { |
59 | | - var header = current.closest(".ui-accordion-header"); |
| 83 | + var header = current.closest( ".ui-accordion-header" ); |
60 | 84 | if ( header.length ) { |
61 | 85 | // anchor within header |
62 | | - this.active = header; |
| 86 | + self.active = header; |
63 | 87 | } else { |
64 | 88 | // anchor within content |
65 | | - this.active = current.closest(".ui-accordion-content").prev(); |
| 89 | + self.active = current.closest( ".ui-accordion-content" ).prev(); |
66 | 90 | } |
67 | 91 | } |
68 | 92 | } |
69 | 93 | |
70 | | - this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); |
71 | | - this.active.next().addClass('ui-accordion-content-active'); |
| 94 | + self.active = self._findActive( self.active || options.active ) |
| 95 | + .addClass( "ui-state-default ui-state-active" ) |
| 96 | + .toggleClass( "ui-corner-all" ) |
| 97 | + .toggleClass( "ui-corner-top" ); |
| 98 | + self.active.next().addClass( "ui-accordion-content-active" ); |
72 | 99 | |
73 | | - //Append icon elements |
74 | | - this._createIcons(); |
| 100 | + self._createIcons(); |
| 101 | + self.resize(); |
| 102 | + |
| 103 | + // ARIA |
| 104 | + self.element.attr( "role", "tablist" ); |
75 | 105 | |
76 | | - this.resize(); |
77 | | - |
78 | | - //ARIA |
79 | | - this.element.attr('role','tablist'); |
80 | | - |
81 | | - this.headers |
82 | | - .attr('role','tab') |
83 | | - .bind('keydown', function(event) { return self._keydown(event); }) |
| 106 | + self.headers |
| 107 | + .attr( "role", "tab" ) |
| 108 | + .bind( "keydown.accordion", function( event ) { |
| 109 | + return self._keydown( event ); |
| 110 | + }) |
84 | 111 | .next() |
85 | | - .attr('role','tabpanel'); |
| 112 | + .attr( "role", "tabpanel" ); |
86 | 113 | |
87 | | - this.headers |
88 | | - .not(this.active || "") |
89 | | - .attr('aria-expanded','false') |
90 | | - .attr("tabIndex", "-1") |
| 114 | + self.headers |
| 115 | + .not( self.active || "" ) |
| 116 | + .attr({ |
| 117 | + "aria-expanded": "false", |
| 118 | + "aria-selected": "false", |
| 119 | + tabIndex: -1 |
| 120 | + }) |
91 | 121 | .next() |
92 | | - .hide(); |
| 122 | + .hide(); |
93 | 123 | |
94 | 124 | // make sure at least one header is in the tab order |
95 | | - if (!this.active.length) { |
96 | | - this.headers.eq(0).attr('tabIndex','0'); |
| 125 | + if ( !self.active.length ) { |
| 126 | + self.headers.eq( 0 ).attr( "tabIndex", 0 ); |
97 | 127 | } else { |
98 | | - this.active |
99 | | - .attr('aria-expanded','true') |
100 | | - .attr('tabIndex', '0'); |
| 128 | + self.active |
| 129 | + .attr({ |
| 130 | + "aria-expanded": "true", |
| 131 | + "aria-selected": "true", |
| 132 | + tabIndex: 0 |
| 133 | + }); |
101 | 134 | } |
102 | 135 | |
103 | | - // only need links in taborder for Safari |
104 | | - if (!$.browser.safari) |
105 | | - this.headers.find('a').attr('tabIndex','-1'); |
| 136 | + // only need links in tab order for Safari |
| 137 | + if ( !$.browser.safari ) { |
| 138 | + self.headers.find( "a" ).attr( "tabIndex", -1 ); |
| 139 | + } |
106 | 140 | |
107 | | - if (o.event) { |
108 | | - this.headers.bind((o.event) + ".accordion", function(event) { |
109 | | - self._clickHandler.call(self, event, this); |
| 141 | + if ( options.event ) { |
| 142 | + self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { |
| 143 | + self._clickHandler.call( self, event, this ); |
110 | 144 | event.preventDefault(); |
111 | 145 | }); |
112 | 146 | } |
| 147 | + }, |
113 | 148 | |
114 | | - }, |
115 | | - |
116 | 149 | _createIcons: function() { |
117 | | - var o = this.options; |
118 | | - if (o.icons) { |
119 | | - $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers); |
120 | | - this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected); |
121 | | - this.element.addClass("ui-accordion-icons"); |
| 150 | + var options = this.options; |
| 151 | + if ( options.icons ) { |
| 152 | + $( "<span></span>" ) |
| 153 | + .addClass( "ui-icon " + options.icons.header ) |
| 154 | + .prependTo( this.headers ); |
| 155 | + this.active.children( ".ui-icon" ) |
| 156 | + .toggleClass(options.icons.header) |
| 157 | + .toggleClass(options.icons.headerSelected); |
| 158 | + this.element.addClass( "ui-accordion-icons" ); |
122 | 159 | } |
123 | 160 | }, |
124 | | - |
| 161 | + |
125 | 162 | _destroyIcons: function() { |
126 | | - this.headers.children(".ui-icon").remove(); |
127 | | - this.element.removeClass("ui-accordion-icons"); |
| 163 | + this.headers.children( ".ui-icon" ).remove(); |
| 164 | + this.element.removeClass( "ui-accordion-icons" ); |
128 | 165 | }, |
129 | 166 | |
130 | 167 | destroy: function() { |
131 | | - var o = this.options; |
| 168 | + var options = this.options; |
132 | 169 | |
133 | 170 | this.element |
134 | | - .removeClass("ui-accordion ui-widget ui-helper-reset") |
135 | | - .removeAttr("role") |
136 | | - .unbind('.accordion') |
137 | | - .removeData('accordion'); |
| 171 | + .removeClass( "ui-accordion ui-widget ui-helper-reset" ) |
| 172 | + .removeAttr( "role" ); |
138 | 173 | |
139 | 174 | this.headers |
140 | | - .unbind(".accordion") |
141 | | - .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") |
142 | | - .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex"); |
| 175 | + .unbind( ".accordion" ) |
| 176 | + .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" ) |
| 177 | + .removeAttr( "role" ) |
| 178 | + .removeAttr( "aria-expanded" ) |
| 179 | + .removeAttr( "aria-selected" ) |
| 180 | + .removeAttr( "tabIndex" ); |
143 | 181 | |
144 | | - this.headers.find("a").removeAttr("tabIndex"); |
| 182 | + this.headers.find( "a" ).removeAttr( "tabIndex" ); |
145 | 183 | this._destroyIcons(); |
146 | | - var 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"); |
147 | | - if (o.autoHeight || o.fillHeight) { |
148 | | - contents.css("height", ""); |
| 184 | + var contents = this.headers.next() |
| 185 | + .css( "display", "" ) |
| 186 | + .removeAttr( "role" ) |
| 187 | + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); |
| 188 | + if ( options.autoHeight || options.fillHeight ) { |
| 189 | + contents.css( "height", "" ); |
149 | 190 | } |
150 | 191 | |
151 | | - return this; |
| 192 | + return $.Widget.prototype.destroy.call( this ); |
152 | 193 | }, |
153 | | - |
154 | | - _setOption: function(key, value) { |
155 | | - $.Widget.prototype._setOption.apply(this, arguments); |
| 194 | + |
| 195 | + _setOption: function( key, value ) { |
| 196 | + $.Widget.prototype._setOption.apply( this, arguments ); |
156 | 197 | |
157 | | - if (key == "active") { |
158 | | - this.activate(value); |
| 198 | + if ( key == "active" ) { |
| 199 | + this.activate( value ); |
159 | 200 | } |
160 | | - if (key == "icons") { |
| 201 | + if ( key == "icons" ) { |
161 | 202 | this._destroyIcons(); |
162 | | - if (value) { |
| 203 | + if ( value ) { |
163 | 204 | this._createIcons(); |
164 | 205 | } |
165 | 206 | } |
166 | | - |
| 207 | + // #5332 - opacity doesn't cascade to positioned elements in IE |
| 208 | + // so we need to add the disabled class to the headers and panels |
| 209 | + if ( key == "disabled" ) { |
| 210 | + this.headers.add(this.headers.next()) |
| 211 | + [ value ? "addClass" : "removeClass" ]( |
| 212 | + "ui-accordion-disabled ui-state-disabled" ); |
| 213 | + } |
167 | 214 | }, |
168 | 215 | |
169 | | - _keydown: function(event) { |
170 | | - |
171 | | - var o = this.options, keyCode = $.ui.keyCode; |
172 | | - |
173 | | - if (o.disabled || event.altKey || event.ctrlKey) |
| 216 | + _keydown: function( event ) { |
| 217 | + if ( this.options.disabled || event.altKey || event.ctrlKey ) { |
174 | 218 | return; |
| 219 | + } |
175 | 220 | |
176 | | - var length = this.headers.length; |
177 | | - var currentIndex = this.headers.index(event.target); |
178 | | - var toFocus = false; |
| 221 | + var keyCode = $.ui.keyCode, |
| 222 | + length = this.headers.length, |
| 223 | + currentIndex = this.headers.index( event.target ), |
| 224 | + toFocus = false; |
179 | 225 | |
180 | | - switch(event.keyCode) { |
| 226 | + switch ( event.keyCode ) { |
181 | 227 | case keyCode.RIGHT: |
182 | 228 | case keyCode.DOWN: |
183 | | - toFocus = this.headers[(currentIndex + 1) % length]; |
| 229 | + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; |
184 | 230 | break; |
185 | 231 | case keyCode.LEFT: |
186 | 232 | case keyCode.UP: |
187 | | - toFocus = this.headers[(currentIndex - 1 + length) % length]; |
| 233 | + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; |
188 | 234 | break; |
189 | 235 | case keyCode.SPACE: |
190 | 236 | case keyCode.ENTER: |
191 | | - this._clickHandler({ target: event.target }, event.target); |
| 237 | + this._clickHandler( { target: event.target }, event.target ); |
192 | 238 | event.preventDefault(); |
193 | 239 | } |
194 | 240 | |
195 | | - if (toFocus) { |
196 | | - $(event.target).attr('tabIndex','-1'); |
197 | | - $(toFocus).attr('tabIndex','0'); |
| 241 | + if ( toFocus ) { |
| 242 | + $( event.target ).attr( "tabIndex", -1 ); |
| 243 | + $( toFocus ).attr( "tabIndex", 0 ); |
198 | 244 | toFocus.focus(); |
199 | 245 | return false; |
200 | 246 | } |
201 | 247 | |
202 | 248 | return true; |
203 | | - |
204 | 249 | }, |
205 | 250 | |
206 | 251 | resize: function() { |
| 252 | + var options = this.options, |
| 253 | + maxHeight; |
207 | 254 | |
208 | | - var o = this.options, maxHeight; |
| 255 | + if ( options.fillSpace ) { |
| 256 | + if ( $.browser.msie ) { |
| 257 | + var defOverflow = this.element.parent().css( "overflow" ); |
| 258 | + this.element.parent().css( "overflow", "hidden"); |
| 259 | + } |
| 260 | + maxHeight = this.element.parent().height(); |
| 261 | + if ($.browser.msie) { |
| 262 | + this.element.parent().css( "overflow", defOverflow ); |
| 263 | + } |
209 | 264 | |
210 | | - if (o.fillSpace) { |
211 | | - |
212 | | - if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); } |
213 | | - maxHeight = this.element.parent().height(); |
214 | | - if($.browser.msie) { this.element.parent().css('overflow', defOverflow); } |
215 | | - |
216 | 265 | this.headers.each(function() { |
217 | | - maxHeight -= $(this).outerHeight(true); |
| 266 | + maxHeight -= $( this ).outerHeight( true ); |
218 | 267 | }); |
219 | 268 | |
220 | | - this.headers.next().each(function() { |
221 | | - $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height())); |
222 | | - }).css('overflow', 'auto'); |
223 | | - |
224 | | - } else if ( o.autoHeight ) { |
| 269 | + this.headers.next() |
| 270 | + .each(function() { |
| 271 | + $( this ).height( Math.max( 0, maxHeight - |
| 272 | + $( this ).innerHeight() + $( this ).height() ) ); |
| 273 | + }) |
| 274 | + .css( "overflow", "auto" ); |
| 275 | + } else if ( options.autoHeight ) { |
225 | 276 | maxHeight = 0; |
226 | | - this.headers.next().each(function() { |
227 | | - maxHeight = Math.max(maxHeight, $(this).height()); |
228 | | - }).height(maxHeight); |
| 277 | + this.headers.next() |
| 278 | + .each(function() { |
| 279 | + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); |
| 280 | + }) |
| 281 | + .height( maxHeight ); |
229 | 282 | } |
230 | 283 | |
231 | 284 | return this; |
232 | 285 | }, |
233 | 286 | |
234 | | - activate: function(index) { |
| 287 | + activate: function( index ) { |
235 | 288 | // TODO this gets called on init, changing the option without an explicit call for that |
236 | 289 | this.options.active = index; |
237 | 290 | // call clickHandler with custom event |
238 | | - var active = this._findActive(index)[0]; |
239 | | - this._clickHandler({ target: active }, active); |
| 291 | + var active = this._findActive( index )[ 0 ]; |
| 292 | + this._clickHandler( { target: active }, active ); |
240 | 293 | |
241 | 294 | return this; |
242 | 295 | }, |
243 | 296 | |
244 | | - _findActive: function(selector) { |
| 297 | + _findActive: function( selector ) { |
245 | 298 | return selector |
246 | | - ? typeof selector == "number" |
247 | | - ? this.headers.filter(":eq(" + selector + ")") |
248 | | - : this.headers.not(this.headers.not(selector)) |
| 299 | + ? typeof selector === "number" |
| 300 | + ? this.headers.filter( ":eq(" + selector + ")" ) |
| 301 | + : this.headers.not( this.headers.not( selector ) ) |
249 | 302 | : selector === false |
250 | | - ? $([]) |
251 | | - : this.headers.filter(":eq(0)"); |
| 303 | + ? $( [] ) |
| 304 | + : this.headers.filter( ":eq(0)" ); |
252 | 305 | }, |
253 | 306 | |
254 | | - // TODO isn't event.target enough? why the seperate target argument? |
255 | | - _clickHandler: function(event, target) { |
256 | | - |
257 | | - var o = this.options; |
258 | | - if (o.disabled) |
| 307 | + // TODO isn't event.target enough? why the separate target argument? |
| 308 | + _clickHandler: function( event, target ) { |
| 309 | + var options = this.options; |
| 310 | + if ( options.disabled ) { |
259 | 311 | return; |
| 312 | + } |
260 | 313 | |
261 | 314 | // called only when using activate(false) to close all parts programmatically |
262 | | - if (!event.target) { |
263 | | - if (!o.collapsible) |
| 315 | + if ( !event.target ) { |
| 316 | + if ( !options.collapsible ) { |
264 | 317 | return; |
265 | | - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") |
266 | | - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); |
267 | | - this.active.next().addClass('ui-accordion-content-active'); |
| 318 | + } |
| 319 | + this.active |
| 320 | + .removeClass( "ui-state-active ui-corner-top" ) |
| 321 | + .addClass( "ui-state-default ui-corner-all" ) |
| 322 | + .children( ".ui-icon" ) |
| 323 | + .removeClass( options.icons.headerSelected ) |
| 324 | + .addClass( options.icons.header ); |
| 325 | + this.active.next().addClass( "ui-accordion-content-active" ); |
268 | 326 | var toHide = this.active.next(), |
269 | 327 | data = { |
270 | | - options: o, |
271 | | - newHeader: $([]), |
272 | | - oldHeader: o.active, |
273 | | - newContent: $([]), |
| 328 | + options: options, |
| 329 | + newHeader: $( [] ), |
| 330 | + oldHeader: options.active, |
| 331 | + newContent: $( [] ), |
274 | 332 | oldContent: toHide |
275 | 333 | }, |
276 | | - toShow = (this.active = $([])); |
277 | | - this._toggle(toShow, toHide, data); |
| 334 | + toShow = ( this.active = $( [] ) ); |
| 335 | + this._toggle( toShow, toHide, data ); |
278 | 336 | return; |
279 | 337 | } |
280 | 338 | |
281 | 339 | // get the click target |
282 | | - var clicked = $(event.currentTarget || target); |
283 | | - var clickedIsActive = clicked[0] == this.active[0]; |
284 | | - |
| 340 | + var clicked = $( event.currentTarget || target ), |
| 341 | + clickedIsActive = clicked[0] === this.active[0]; |
| 342 | + |
285 | 343 | // TODO the option is changed, is that correct? |
286 | 344 | // TODO if it is correct, shouldn't that happen after determining that the click is valid? |
287 | | - o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked); |
| 345 | + options.active = options.collapsible && clickedIsActive ? |
| 346 | + false : |
| 347 | + this.headers.index( clicked ); |
288 | 348 | |
289 | 349 | // if animations are still active, or the active header is the target, ignore click |
290 | | - if (this.running || (!o.collapsible && clickedIsActive)) { |
| 350 | + if ( this.running || ( !options.collapsible && clickedIsActive ) ) { |
291 | 351 | return; |
292 | 352 | } |
293 | 353 | |
294 | | - // switch classes |
295 | | - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") |
296 | | - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); |
297 | | - if (!clickedIsActive) { |
298 | | - clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top") |
299 | | - .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected); |
300 | | - clicked.next().addClass('ui-accordion-content-active'); |
301 | | - } |
302 | | - |
303 | 354 | // find elements to show and hide |
304 | | - var toShow = clicked.next(), |
| 355 | + var active = this.active, |
| 356 | + toShow = clicked.next(), |
305 | 357 | toHide = this.active.next(), |
306 | 358 | data = { |
307 | | - options: o, |
308 | | - newHeader: clickedIsActive && o.collapsible ? $([]) : clicked, |
| 359 | + options: options, |
| 360 | + newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, |
309 | 361 | oldHeader: this.active, |
310 | | - newContent: clickedIsActive && o.collapsible ? $([]) : toShow, |
| 362 | + newContent: clickedIsActive && options.collapsible ? $([]) : toShow, |
311 | 363 | oldContent: toHide |
312 | 364 | }, |
313 | 365 | down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); |
314 | 366 | |
| 367 | + // when the call to ._toggle() comes after the class changes |
| 368 | + // it causes a very odd bug in IE 8 (see #6720) |
315 | 369 | this.active = clickedIsActive ? $([]) : clicked; |
316 | | - this._toggle(toShow, toHide, data, clickedIsActive, down); |
| 370 | + this._toggle( toShow, toHide, data, clickedIsActive, down ); |
317 | 371 | |
| 372 | + // switch classes |
| 373 | + active |
| 374 | + .removeClass( "ui-state-active ui-corner-top" ) |
| 375 | + .addClass( "ui-state-default ui-corner-all" ) |
| 376 | + .children( ".ui-icon" ) |
| 377 | + .removeClass( options.icons.headerSelected ) |
| 378 | + .addClass( options.icons.header ); |
| 379 | + if ( !clickedIsActive ) { |
| 380 | + clicked |
| 381 | + .removeClass( "ui-state-default ui-corner-all" ) |
| 382 | + .addClass( "ui-state-active ui-corner-top" ) |
| 383 | + .children( ".ui-icon" ) |
| 384 | + .removeClass( options.icons.header ) |
| 385 | + .addClass( options.icons.headerSelected ); |
| 386 | + clicked |
| 387 | + .next() |
| 388 | + .addClass( "ui-accordion-content-active" ); |
| 389 | + } |
| 390 | + |
318 | 391 | return; |
319 | | - |
320 | 392 | }, |
321 | 393 | |
322 | | - _toggle: function(toShow, toHide, data, clickedIsActive, down) { |
| 394 | + _toggle: function( toShow, toHide, data, clickedIsActive, down ) { |
| 395 | + var self = this, |
| 396 | + options = self.options; |
323 | 397 | |
324 | | - var o = this.options, self = this; |
| 398 | + self.toShow = toShow; |
| 399 | + self.toHide = toHide; |
| 400 | + self.data = data; |
325 | 401 | |
326 | | - this.toShow = toShow; |
327 | | - this.toHide = toHide; |
328 | | - this.data = data; |
| 402 | + var complete = function() { |
| 403 | + if ( !self ) { |
| 404 | + return; |
| 405 | + } |
| 406 | + return self._completed.apply( self, arguments ); |
| 407 | + }; |
329 | 408 | |
330 | | - var complete = function() { if(!self) return; return self._completed.apply(self, arguments); }; |
331 | | - |
332 | 409 | // trigger changestart event |
333 | | - this._trigger("changestart", null, this.data); |
| 410 | + self._trigger( "changestart", null, self.data ); |
334 | 411 | |
335 | 412 | // count elements to animate |
336 | | - this.running = toHide.size() === 0 ? toShow.size() : toHide.size(); |
| 413 | + self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); |
337 | 414 | |
338 | | - if (o.animated) { |
339 | | - |
| 415 | + if ( options.animated ) { |
340 | 416 | var animOptions = {}; |
341 | 417 | |
342 | | - if ( o.collapsible && clickedIsActive ) { |
| 418 | + if ( options.collapsible && clickedIsActive ) { |
343 | 419 | animOptions = { |
344 | | - toShow: $([]), |
| 420 | + toShow: $( [] ), |
345 | 421 | toHide: toHide, |
346 | 422 | complete: complete, |
347 | 423 | down: down, |
348 | | - autoHeight: o.autoHeight || o.fillSpace |
| 424 | + autoHeight: options.autoHeight || options.fillSpace |
349 | 425 | }; |
350 | 426 | } else { |
351 | 427 | animOptions = { |
— | — | @@ -352,101 +428,120 @@ |
353 | 429 | toHide: toHide, |
354 | 430 | complete: complete, |
355 | 431 | down: down, |
356 | | - autoHeight: o.autoHeight || o.fillSpace |
| 432 | + autoHeight: options.autoHeight || options.fillSpace |
357 | 433 | }; |
358 | 434 | } |
359 | 435 | |
360 | | - if (!o.proxied) { |
361 | | - o.proxied = o.animated; |
| 436 | + if ( !options.proxied ) { |
| 437 | + options.proxied = options.animated; |
362 | 438 | } |
363 | 439 | |
364 | | - if (!o.proxiedDuration) { |
365 | | - o.proxiedDuration = o.duration; |
| 440 | + if ( !options.proxiedDuration ) { |
| 441 | + options.proxiedDuration = options.duration; |
366 | 442 | } |
367 | 443 | |
368 | | - o.animated = $.isFunction(o.proxied) ? |
369 | | - o.proxied(animOptions) : o.proxied; |
| 444 | + options.animated = $.isFunction( options.proxied ) ? |
| 445 | + options.proxied( animOptions ) : |
| 446 | + options.proxied; |
370 | 447 | |
371 | | - o.duration = $.isFunction(o.proxiedDuration) ? |
372 | | - o.proxiedDuration(animOptions) : o.proxiedDuration; |
| 448 | + options.duration = $.isFunction( options.proxiedDuration ) ? |
| 449 | + options.proxiedDuration( animOptions ) : |
| 450 | + options.proxiedDuration; |
373 | 451 | |
374 | 452 | var animations = $.ui.accordion.animations, |
375 | | - duration = o.duration, |
376 | | - easing = o.animated; |
| 453 | + duration = options.duration, |
| 454 | + easing = options.animated; |
377 | 455 | |
378 | | - if (easing && !animations[easing] && !$.easing[easing]) { |
379 | | - easing = 'slide'; |
| 456 | + if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { |
| 457 | + easing = "slide"; |
380 | 458 | } |
381 | | - if (!animations[easing]) { |
382 | | - animations[easing] = function(options) { |
383 | | - this.slide(options, { |
| 459 | + if ( !animations[ easing ] ) { |
| 460 | + animations[ easing ] = function( options ) { |
| 461 | + this.slide( options, { |
384 | 462 | easing: easing, |
385 | 463 | duration: duration || 700 |
386 | 464 | }); |
387 | 465 | }; |
388 | 466 | } |
389 | 467 | |
390 | | - animations[easing](animOptions); |
391 | | - |
| 468 | + animations[ easing ]( animOptions ); |
392 | 469 | } else { |
393 | | - |
394 | | - if (o.collapsible && clickedIsActive) { |
| 470 | + if ( options.collapsible && clickedIsActive ) { |
395 | 471 | toShow.toggle(); |
396 | 472 | } else { |
397 | 473 | toHide.hide(); |
398 | 474 | toShow.show(); |
399 | 475 | } |
400 | 476 | |
401 | | - complete(true); |
402 | | - |
| 477 | + complete( true ); |
403 | 478 | } |
404 | 479 | |
405 | 480 | // TODO assert that the blur and focus triggers are really necessary, remove otherwise |
406 | | - toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur(); |
407 | | - toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus(); |
408 | | - |
| 481 | + toHide.prev() |
| 482 | + .attr({ |
| 483 | + "aria-expanded": "false", |
| 484 | + "aria-selected": "false", |
| 485 | + tabIndex: -1 |
| 486 | + }) |
| 487 | + .blur(); |
| 488 | + toShow.prev() |
| 489 | + .attr({ |
| 490 | + "aria-expanded": "true", |
| 491 | + "aria-selected": "true", |
| 492 | + tabIndex: 0 |
| 493 | + }) |
| 494 | + .focus(); |
409 | 495 | }, |
410 | 496 | |
411 | | - _completed: function(cancel) { |
412 | | - |
413 | | - var o = this.options; |
414 | | - |
| 497 | + _completed: function( cancel ) { |
415 | 498 | this.running = cancel ? 0 : --this.running; |
416 | | - if (this.running) return; |
| 499 | + if ( this.running ) { |
| 500 | + return; |
| 501 | + } |
417 | 502 | |
418 | | - if (o.clearStyle) { |
419 | | - this.toShow.add(this.toHide).css({ |
| 503 | + if ( this.options.clearStyle ) { |
| 504 | + this.toShow.add( this.toHide ).css({ |
420 | 505 | height: "", |
421 | 506 | overflow: "" |
422 | 507 | }); |
423 | 508 | } |
424 | | - |
| 509 | + |
425 | 510 | // other classes are removed before the animation; this one needs to stay until completed |
426 | | - this.toHide.removeClass("ui-accordion-content-active"); |
| 511 | + this.toHide.removeClass( "ui-accordion-content-active" ); |
| 512 | + // Work around for rendering bug in IE (#5421) |
| 513 | + if ( this.toHide.length ) { |
| 514 | + this.toHide.parent()[0].className = this.toHide.parent()[0].className; |
| 515 | + } |
427 | 516 | |
428 | | - this._trigger('change', null, this.data); |
| 517 | + this._trigger( "change", null, this.data ); |
429 | 518 | } |
430 | | - |
431 | 519 | }); |
432 | 520 | |
433 | | - |
434 | | -$.extend($.ui.accordion, { |
435 | | - version: "1.8.2", |
| 521 | +$.extend( $.ui.accordion, { |
| 522 | + version: "1.8.11", |
436 | 523 | animations: { |
437 | | - slide: function(options, additions) { |
| 524 | + slide: function( options, additions ) { |
438 | 525 | options = $.extend({ |
439 | 526 | easing: "swing", |
440 | 527 | duration: 300 |
441 | | - }, options, additions); |
| 528 | + }, options, additions ); |
442 | 529 | if ( !options.toHide.size() ) { |
443 | | - options.toShow.animate({height: "show"}, options); |
| 530 | + options.toShow.animate({ |
| 531 | + height: "show", |
| 532 | + paddingTop: "show", |
| 533 | + paddingBottom: "show" |
| 534 | + }, options ); |
444 | 535 | return; |
445 | 536 | } |
446 | 537 | if ( !options.toShow.size() ) { |
447 | | - options.toHide.animate({height: "hide"}, options); |
| 538 | + options.toHide.animate({ |
| 539 | + height: "hide", |
| 540 | + paddingTop: "hide", |
| 541 | + paddingBottom: "hide" |
| 542 | + }, options ); |
448 | 543 | return; |
449 | 544 | } |
450 | | - var overflow = options.toShow.css('overflow'), |
| 545 | + var overflow = options.toShow.css( "overflow" ), |
451 | 546 | percentDone = 0, |
452 | 547 | showProps = {}, |
453 | 548 | hideProps = {}, |
— | — | @@ -455,45 +550,57 @@ |
456 | 551 | // fix width before calculating height of hidden element |
457 | 552 | var s = options.toShow; |
458 | 553 | originalWidth = s[0].style.width; |
459 | | - s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) ); |
460 | | - |
461 | | - $.each(fxAttrs, function(i, prop) { |
462 | | - hideProps[prop] = 'hide'; |
463 | | - |
464 | | - var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/); |
465 | | - showProps[prop] = { |
466 | | - value: parts[1], |
467 | | - unit: parts[2] || 'px' |
| 554 | + s.width( parseInt( s.parent().width(), 10 ) |
| 555 | + - parseInt( s.css( "paddingLeft" ), 10 ) |
| 556 | + - parseInt( s.css( "paddingRight" ), 10 ) |
| 557 | + - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) |
| 558 | + - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) ); |
| 559 | + |
| 560 | + $.each( fxAttrs, function( i, prop ) { |
| 561 | + hideProps[ prop ] = "hide"; |
| 562 | + |
| 563 | + var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); |
| 564 | + showProps[ prop ] = { |
| 565 | + value: parts[ 1 ], |
| 566 | + unit: parts[ 2 ] || "px" |
468 | 567 | }; |
469 | 568 | }); |
470 | | - options.toShow.css({ height: 0, overflow: 'hidden' }).show(); |
471 | | - options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{ |
472 | | - step: function(now, settings) { |
| 569 | + options.toShow.css({ height: 0, overflow: "hidden" }).show(); |
| 570 | + options.toHide |
| 571 | + .filter( ":hidden" ) |
| 572 | + .each( options.complete ) |
| 573 | + .end() |
| 574 | + .filter( ":visible" ) |
| 575 | + .animate( hideProps, { |
| 576 | + step: function( now, settings ) { |
473 | 577 | // only calculate the percent when animating height |
474 | 578 | // IE gets very inconsistent results when animating elements |
475 | 579 | // with small values, which is common for padding |
476 | | - if (settings.prop == 'height') { |
| 580 | + if ( settings.prop == "height" ) { |
477 | 581 | percentDone = ( settings.end - settings.start === 0 ) ? 0 : |
478 | | - (settings.now - settings.start) / (settings.end - settings.start); |
| 582 | + ( settings.now - settings.start ) / ( settings.end - settings.start ); |
479 | 583 | } |
480 | | - |
481 | | - options.toShow[0].style[settings.prop] = |
482 | | - (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; |
| 584 | + |
| 585 | + options.toShow[ 0 ].style[ settings.prop ] = |
| 586 | + ( percentDone * showProps[ settings.prop ].value ) |
| 587 | + + showProps[ settings.prop ].unit; |
483 | 588 | }, |
484 | 589 | duration: options.duration, |
485 | 590 | easing: options.easing, |
486 | 591 | complete: function() { |
487 | 592 | if ( !options.autoHeight ) { |
488 | | - options.toShow.css("height", ""); |
| 593 | + options.toShow.css( "height", "" ); |
489 | 594 | } |
490 | | - options.toShow.css("width", originalWidth); |
491 | | - options.toShow.css({overflow: overflow}); |
| 595 | + options.toShow.css({ |
| 596 | + width: originalWidth, |
| 597 | + overflow: overflow |
| 598 | + }); |
492 | 599 | options.complete(); |
493 | 600 | } |
494 | 601 | }); |
495 | 602 | }, |
496 | | - bounceslide: function(options) { |
497 | | - this.slide(options, { |
| 603 | + bounceslide: function( options ) { |
| 604 | + this.slide( options, { |
498 | 605 | easing: options.down ? "easeOutBounce" : "swing", |
499 | 606 | duration: options.down ? 1000 : 200 |
500 | 607 | }); |
— | — | @@ -501,4 +608,4 @@ |
502 | 609 | } |
503 | 610 | }); |
504 | 611 | |
505 | | -})(jQuery); |
| 612 | +})( jQuery ); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.autocomplete.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Autocomplete 1.8.2 |
| 3 | + * jQuery UI Autocomplete 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Autocomplete |
10 | 10 | * |
— | — | @@ -12,16 +12,32 @@ |
13 | 13 | * jquery.ui.widget.js |
14 | 14 | * jquery.ui.position.js |
15 | 15 | */ |
16 | | -(function( $ ) { |
| 16 | +(function( $, undefined ) { |
17 | 17 | |
| 18 | +// used to prevent race conditions with remote data sources |
| 19 | +var requestIndex = 0; |
| 20 | + |
18 | 21 | $.widget( "ui.autocomplete", { |
19 | 22 | options: { |
| 23 | + appendTo: "body", |
| 24 | + autoFocus: false, |
| 25 | + delay: 300, |
20 | 26 | minLength: 1, |
21 | | - delay: 300 |
| 27 | + position: { |
| 28 | + my: "left top", |
| 29 | + at: "left bottom", |
| 30 | + collision: "none" |
| 31 | + }, |
| 32 | + source: null |
22 | 33 | }, |
| 34 | + |
| 35 | + pending: 0, |
| 36 | + |
23 | 37 | _create: function() { |
24 | 38 | var self = this, |
25 | | - doc = this.element[ 0 ].ownerDocument; |
| 39 | + doc = this.element[ 0 ].ownerDocument, |
| 40 | + suppressKeyPress; |
| 41 | + |
26 | 42 | this.element |
27 | 43 | .addClass( "ui-autocomplete-input" ) |
28 | 44 | .attr( "autocomplete", "off" ) |
— | — | @@ -32,6 +48,11 @@ |
33 | 49 | "aria-haspopup": "true" |
34 | 50 | }) |
35 | 51 | .bind( "keydown.autocomplete", function( event ) { |
| 52 | + if ( self.options.disabled || self.element.attr( "readonly" ) ) { |
| 53 | + return; |
| 54 | + } |
| 55 | + |
| 56 | + suppressKeyPress = false; |
36 | 57 | var keyCode = $.ui.keyCode; |
37 | 58 | switch( event.keyCode ) { |
38 | 59 | case keyCode.PAGE_UP: |
— | — | @@ -52,8 +73,11 @@ |
53 | 74 | break; |
54 | 75 | case keyCode.ENTER: |
55 | 76 | case keyCode.NUMPAD_ENTER: |
56 | | - // when menu is open or has focus |
| 77 | + // when menu is open and has focus |
57 | 78 | if ( self.menu.active ) { |
| 79 | + // #6055 - Opera still allows the keypress to occur |
| 80 | + // which causes forms to submit |
| 81 | + suppressKeyPress = true; |
58 | 82 | event.preventDefault(); |
59 | 83 | } |
60 | 84 | //passthrough - ENTER and TAB both select the current element |
— | — | @@ -67,33 +91,38 @@ |
68 | 92 | self.element.val( self.term ); |
69 | 93 | self.close( event ); |
70 | 94 | break; |
71 | | - case keyCode.LEFT: |
72 | | - case keyCode.RIGHT: |
73 | | - case keyCode.SHIFT: |
74 | | - case keyCode.CONTROL: |
75 | | - case keyCode.ALT: |
76 | | - case keyCode.COMMAND: |
77 | | - case keyCode.COMMAND_RIGHT: |
78 | | - case keyCode.INSERT: |
79 | | - case keyCode.CAPS_LOCK: |
80 | | - case keyCode.END: |
81 | | - case keyCode.HOME: |
82 | | - // ignore metakeys (shift, ctrl, alt) |
83 | | - break; |
84 | 95 | default: |
85 | 96 | // keypress is triggered before the input value is changed |
86 | 97 | clearTimeout( self.searching ); |
87 | 98 | self.searching = setTimeout(function() { |
88 | | - self.search( null, event ); |
| 99 | + // only search if the value has changed |
| 100 | + if ( self.term != self.element.val() ) { |
| 101 | + self.selectedItem = null; |
| 102 | + self.search( null, event ); |
| 103 | + } |
89 | 104 | }, self.options.delay ); |
90 | 105 | break; |
91 | 106 | } |
92 | 107 | }) |
| 108 | + .bind( "keypress.autocomplete", function( event ) { |
| 109 | + if ( suppressKeyPress ) { |
| 110 | + suppressKeyPress = false; |
| 111 | + event.preventDefault(); |
| 112 | + } |
| 113 | + }) |
93 | 114 | .bind( "focus.autocomplete", function() { |
| 115 | + if ( self.options.disabled ) { |
| 116 | + return; |
| 117 | + } |
| 118 | + |
94 | 119 | self.selectedItem = null; |
95 | 120 | self.previous = self.element.val(); |
96 | 121 | }) |
97 | 122 | .bind( "blur.autocomplete", function( event ) { |
| 123 | + if ( self.options.disabled ) { |
| 124 | + return; |
| 125 | + } |
| 126 | + |
98 | 127 | clearTimeout( self.searching ); |
99 | 128 | // clicks on the menu (or a button to trigger a search) will cause a blur event |
100 | 129 | self.closing = setTimeout(function() { |
— | — | @@ -107,9 +136,26 @@ |
108 | 137 | }; |
109 | 138 | this.menu = $( "<ul></ul>" ) |
110 | 139 | .addClass( "ui-autocomplete" ) |
111 | | - .appendTo( "body", doc ) |
| 140 | + .appendTo( $( this.options.appendTo || "body", doc )[0] ) |
112 | 141 | // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) |
113 | | - .mousedown(function() { |
| 142 | + .mousedown(function( event ) { |
| 143 | + // clicking on the scrollbar causes focus to shift to the body |
| 144 | + // but we can't detect a mouseup or a click immediately afterward |
| 145 | + // so we have to track the next mousedown and close the menu if |
| 146 | + // the user clicks somewhere outside of the autocomplete |
| 147 | + var menuElement = self.menu.element[ 0 ]; |
| 148 | + if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { |
| 149 | + setTimeout(function() { |
| 150 | + $( document ).one( 'mousedown', function( event ) { |
| 151 | + if ( event.target !== self.element[ 0 ] && |
| 152 | + event.target !== menuElement && |
| 153 | + !$.ui.contains( menuElement, event.target ) ) { |
| 154 | + self.close(); |
| 155 | + } |
| 156 | + }); |
| 157 | + }, 1 ); |
| 158 | + } |
| 159 | + |
114 | 160 | // use another timeout to make sure the blur-event-handler on the input was already triggered |
115 | 161 | setTimeout(function() { |
116 | 162 | clearTimeout( self.closing ); |
— | — | @@ -118,7 +164,7 @@ |
119 | 165 | .menu({ |
120 | 166 | focus: function( event, ui ) { |
121 | 167 | var item = ui.item.data( "item.autocomplete" ); |
122 | | - if ( false !== self._trigger( "focus", null, { item: item } ) ) { |
| 168 | + if ( false !== self._trigger( "focus", event, { item: item } ) ) { |
123 | 169 | // use value to match what will end up in the input, if it was a key event |
124 | 170 | if ( /^key/.test(event.originalEvent.type) ) { |
125 | 171 | self.element.val( item.value ); |
— | — | @@ -126,21 +172,37 @@ |
127 | 173 | } |
128 | 174 | }, |
129 | 175 | selected: function( event, ui ) { |
130 | | - var item = ui.item.data( "item.autocomplete" ); |
131 | | - if ( false !== self._trigger( "select", event, { item: item } ) ) { |
132 | | - self.element.val( item.value ); |
133 | | - } |
134 | | - self.close( event ); |
| 176 | + var item = ui.item.data( "item.autocomplete" ), |
| 177 | + previous = self.previous; |
| 178 | + |
135 | 179 | // only trigger when focus was lost (click on menu) |
136 | | - var previous = self.previous; |
137 | 180 | if ( self.element[0] !== doc.activeElement ) { |
138 | 181 | self.element.focus(); |
139 | 182 | self.previous = previous; |
| 183 | + // #6109 - IE triggers two focus events and the second |
| 184 | + // is asynchronous, so we need to reset the previous |
| 185 | + // term synchronously and asynchronously :-( |
| 186 | + setTimeout(function() { |
| 187 | + self.previous = previous; |
| 188 | + self.selectedItem = item; |
| 189 | + }, 1); |
140 | 190 | } |
| 191 | + |
| 192 | + if ( false !== self._trigger( "select", event, { item: item } ) ) { |
| 193 | + self.element.val( item.value ); |
| 194 | + } |
| 195 | + // reset the term after the select event |
| 196 | + // this allows custom select handling to work properly |
| 197 | + self.term = self.element.val(); |
| 198 | + |
| 199 | + self.close( event ); |
141 | 200 | self.selectedItem = item; |
142 | 201 | }, |
143 | 202 | blur: function( event, ui ) { |
144 | | - if ( self.menu.element.is(":visible") ) { |
| 203 | + // don't set the value of the text field if it's already correct |
| 204 | + // this prevents moving the cursor unnecessarily |
| 205 | + if ( self.menu.element.is(":visible") && |
| 206 | + ( self.element.val() !== self.term ) ) { |
145 | 207 | self.element.val( self.term ); |
146 | 208 | } |
147 | 209 | } |
— | — | @@ -166,15 +228,22 @@ |
167 | 229 | $.Widget.prototype.destroy.call( this ); |
168 | 230 | }, |
169 | 231 | |
170 | | - _setOption: function( key ) { |
| 232 | + _setOption: function( key, value ) { |
171 | 233 | $.Widget.prototype._setOption.apply( this, arguments ); |
172 | 234 | if ( key === "source" ) { |
173 | 235 | this._initSource(); |
174 | 236 | } |
| 237 | + if ( key === "appendTo" ) { |
| 238 | + this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) |
| 239 | + } |
| 240 | + if ( key === "disabled" && value && this.xhr ) { |
| 241 | + this.xhr.abort(); |
| 242 | + } |
175 | 243 | }, |
176 | 244 | |
177 | 245 | _initSource: function() { |
178 | | - var array, |
| 246 | + var self = this, |
| 247 | + array, |
179 | 248 | url; |
180 | 249 | if ( $.isArray(this.options.source) ) { |
181 | 250 | array = this.options.source; |
— | — | @@ -184,7 +253,25 @@ |
185 | 254 | } else if ( typeof this.options.source === "string" ) { |
186 | 255 | url = this.options.source; |
187 | 256 | this.source = function( request, response ) { |
188 | | - $.getJSON( url, request, response ); |
| 257 | + if ( self.xhr ) { |
| 258 | + self.xhr.abort(); |
| 259 | + } |
| 260 | + self.xhr = $.ajax({ |
| 261 | + url: url, |
| 262 | + data: request, |
| 263 | + dataType: "json", |
| 264 | + autocompleteRequest: ++requestIndex, |
| 265 | + success: function( data, status ) { |
| 266 | + if ( this.autocompleteRequest === requestIndex ) { |
| 267 | + response( data ); |
| 268 | + } |
| 269 | + }, |
| 270 | + error: function() { |
| 271 | + if ( this.autocompleteRequest === requestIndex ) { |
| 272 | + response( [] ); |
| 273 | + } |
| 274 | + } |
| 275 | + }); |
189 | 276 | }; |
190 | 277 | } else { |
191 | 278 | this.source = this.options.source; |
— | — | @@ -193,12 +280,16 @@ |
194 | 281 | |
195 | 282 | search: function( value, event ) { |
196 | 283 | value = value != null ? value : this.element.val(); |
| 284 | + |
| 285 | + // always save the actual value, not the one passed as an argument |
| 286 | + this.term = this.element.val(); |
| 287 | + |
197 | 288 | if ( value.length < this.options.minLength ) { |
198 | 289 | return this.close( event ); |
199 | 290 | } |
200 | 291 | |
201 | 292 | clearTimeout( this.closing ); |
202 | | - if ( this._trigger("search") === false ) { |
| 293 | + if ( this._trigger( "search", event ) === false ) { |
203 | 294 | return; |
204 | 295 | } |
205 | 296 | |
— | — | @@ -206,31 +297,32 @@ |
207 | 298 | }, |
208 | 299 | |
209 | 300 | _search: function( value ) { |
210 | | - this.term = this.element |
211 | | - .addClass( "ui-autocomplete-loading" ) |
212 | | - // always save the actual value, not the one passed as an argument |
213 | | - .val(); |
| 301 | + this.pending++; |
| 302 | + this.element.addClass( "ui-autocomplete-loading" ); |
214 | 303 | |
215 | 304 | this.source( { term: value }, this.response ); |
216 | 305 | }, |
217 | 306 | |
218 | 307 | _response: function( content ) { |
219 | | - if ( content.length ) { |
| 308 | + if ( !this.options.disabled && content && content.length ) { |
220 | 309 | content = this._normalize( content ); |
221 | 310 | this._suggest( content ); |
222 | 311 | this._trigger( "open" ); |
223 | 312 | } else { |
224 | 313 | this.close(); |
225 | 314 | } |
226 | | - this.element.removeClass( "ui-autocomplete-loading" ); |
| 315 | + this.pending--; |
| 316 | + if ( !this.pending ) { |
| 317 | + this.element.removeClass( "ui-autocomplete-loading" ); |
| 318 | + } |
227 | 319 | }, |
228 | 320 | |
229 | 321 | close: function( event ) { |
230 | 322 | clearTimeout( this.closing ); |
231 | 323 | if ( this.menu.element.is(":visible") ) { |
232 | | - this._trigger( "close", event ); |
233 | 324 | this.menu.element.hide(); |
234 | 325 | this.menu.deactivate(); |
| 326 | + this._trigger( "close", event ); |
235 | 327 | } |
236 | 328 | }, |
237 | 329 | |
— | — | @@ -261,26 +353,33 @@ |
262 | 354 | |
263 | 355 | _suggest: function( items ) { |
264 | 356 | var ul = this.menu.element |
265 | | - .empty() |
266 | | - .zIndex( this.element.zIndex() + 1 ), |
267 | | - menuWidth, |
268 | | - textWidth; |
| 357 | + .empty() |
| 358 | + .zIndex( this.element.zIndex() + 1 ); |
269 | 359 | this._renderMenu( ul, items ); |
270 | 360 | // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate |
271 | 361 | this.menu.deactivate(); |
272 | 362 | this.menu.refresh(); |
273 | | - this.menu.element.show().position({ |
274 | | - my: "left top", |
275 | | - at: "left bottom", |
276 | | - of: this.element, |
277 | | - collision: "none" |
278 | | - }); |
279 | 363 | |
280 | | - menuWidth = ul.width( "" ).width(); |
281 | | - textWidth = this.element.width(); |
282 | | - ul.width( Math.max( menuWidth, textWidth ) ); |
| 364 | + // size and position menu |
| 365 | + ul.show(); |
| 366 | + this._resizeMenu(); |
| 367 | + ul.position( $.extend({ |
| 368 | + of: this.element |
| 369 | + }, this.options.position )); |
| 370 | + |
| 371 | + if ( this.options.autoFocus ) { |
| 372 | + this.menu.next( new $.Event("mouseover") ); |
| 373 | + } |
283 | 374 | }, |
284 | | - |
| 375 | + |
| 376 | + _resizeMenu: function() { |
| 377 | + var ul = this.menu.element; |
| 378 | + ul.outerWidth( Math.max( |
| 379 | + ul.width( "" ).outerWidth(), |
| 380 | + this.element.outerWidth() |
| 381 | + ) ); |
| 382 | + }, |
| 383 | + |
285 | 384 | _renderMenu: function( ul, items ) { |
286 | 385 | var self = this; |
287 | 386 | $.each( items, function( index, item ) { |
— | — | @@ -291,7 +390,7 @@ |
292 | 391 | _renderItem: function( ul, item) { |
293 | 392 | return $( "<li></li>" ) |
294 | 393 | .data( "item.autocomplete", item ) |
295 | | - .append( "<a>" + item.label + "</a>" ) |
| 394 | + .append( $( "<a></a>" ).text( item.label ) ) |
296 | 395 | .appendTo( ul ); |
297 | 396 | }, |
298 | 397 | |
— | — | @@ -316,7 +415,7 @@ |
317 | 416 | |
318 | 417 | $.extend( $.ui.autocomplete, { |
319 | 418 | escapeRegex: function( value ) { |
320 | | - return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" ); |
| 419 | + return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); |
321 | 420 | }, |
322 | 421 | filter: function(array, term) { |
323 | 422 | var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); |
— | — | @@ -335,9 +434,9 @@ |
336 | 435 | * it for the next release. You're welcome to give it a try anyway and give us feedback, |
337 | 436 | * as long as you're okay with migrating your code later on. We can help with that, too. |
338 | 437 | * |
339 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
340 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
341 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 438 | + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) |
| 439 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 440 | + * http://jquery.org/license |
342 | 441 | * |
343 | 442 | * http://docs.jquery.com/UI/Menu |
344 | 443 | * |
— | — | @@ -395,7 +494,7 @@ |
396 | 495 | elementHeight = this.element.height(); |
397 | 496 | if (offset < 0) { |
398 | 497 | this.element.attr("scrollTop", scroll + offset); |
399 | | - } else if (offset > elementHeight) { |
| 498 | + } else if (offset >= elementHeight) { |
400 | 499 | this.element.attr("scrollTop", scroll + offset - elementHeight + item.height()); |
401 | 500 | } |
402 | 501 | } |
— | — | @@ -426,11 +525,11 @@ |
427 | 526 | }, |
428 | 527 | |
429 | 528 | first: function() { |
430 | | - return this.active && !this.active.prev().length; |
| 529 | + return this.active && !this.active.prevAll(".ui-menu-item").length; |
431 | 530 | }, |
432 | 531 | |
433 | 532 | last: function() { |
434 | | - return this.active && !this.active.next().length; |
| 533 | + return this.active && !this.active.nextAll(".ui-menu-item").length; |
435 | 534 | }, |
436 | 535 | |
437 | 536 | move: function(direction, edge, event) { |
— | — | @@ -451,12 +550,12 @@ |
452 | 551 | if (this.hasScroll()) { |
453 | 552 | // TODO merge with no-scroll-else |
454 | 553 | if (!this.active || this.last()) { |
455 | | - this.activate(event, this.element.children(":first")); |
| 554 | + this.activate(event, this.element.children(".ui-menu-item:first")); |
456 | 555 | return; |
457 | 556 | } |
458 | 557 | var base = this.active.offset().top, |
459 | 558 | height = this.element.height(), |
460 | | - result = this.element.children("li").filter(function() { |
| 559 | + result = this.element.children(".ui-menu-item").filter(function() { |
461 | 560 | var close = $(this).offset().top - base - height + $(this).height(); |
462 | 561 | // TODO improve approximation |
463 | 562 | return close < 10 && close > -10; |
— | — | @@ -464,11 +563,12 @@ |
465 | 564 | |
466 | 565 | // TODO try to catch this earlier when scrollTop indicates the last page anyway |
467 | 566 | if (!result.length) { |
468 | | - result = this.element.children(":last"); |
| 567 | + result = this.element.children(".ui-menu-item:last"); |
469 | 568 | } |
470 | 569 | this.activate(event, result); |
471 | 570 | } else { |
472 | | - this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last")); |
| 571 | + this.activate(event, this.element.children(".ui-menu-item") |
| 572 | + .filter(!this.active || this.last() ? ":first" : ":last")); |
473 | 573 | } |
474 | 574 | }, |
475 | 575 | |
— | — | @@ -477,13 +577,13 @@ |
478 | 578 | if (this.hasScroll()) { |
479 | 579 | // TODO merge with no-scroll-else |
480 | 580 | if (!this.active || this.first()) { |
481 | | - this.activate(event, this.element.children(":last")); |
| 581 | + this.activate(event, this.element.children(".ui-menu-item:last")); |
482 | 582 | return; |
483 | 583 | } |
484 | 584 | |
485 | 585 | var base = this.active.offset().top, |
486 | 586 | height = this.element.height(); |
487 | | - result = this.element.children("li").filter(function() { |
| 587 | + result = this.element.children(".ui-menu-item").filter(function() { |
488 | 588 | var close = $(this).offset().top - base + height - $(this).height(); |
489 | 589 | // TODO improve approximation |
490 | 590 | return close < 10 && close > -10; |
— | — | @@ -491,11 +591,12 @@ |
492 | 592 | |
493 | 593 | // TODO try to catch this earlier when scrollTop indicates the last page anyway |
494 | 594 | if (!result.length) { |
495 | | - result = this.element.children(":first"); |
| 595 | + result = this.element.children(".ui-menu-item:first"); |
496 | 596 | } |
497 | 597 | this.activate(event, result); |
498 | 598 | } else { |
499 | | - this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first")); |
| 599 | + this.activate(event, this.element.children(".ui-menu-item") |
| 600 | + .filter(!this.active || this.first() ? ":last" : ":first")); |
500 | 601 | } |
501 | 602 | }, |
502 | 603 | |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.selectable.js |
— | — | @@ -1,10 +1,9 @@ |
2 | | - |
3 | 2 | /* |
4 | | - * jQuery UI Selectable 1.8.2 |
| 3 | + * jQuery UI Selectable 1.8.11 |
5 | 4 | * |
6 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
7 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
8 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
9 | 8 | * |
10 | 9 | * http://docs.jquery.com/UI/Selectables |
11 | 10 | * |
— | — | @@ -13,7 +12,7 @@ |
14 | 13 | * jquery.ui.mouse.js |
15 | 14 | * jquery.ui.widget.js |
16 | 15 | */ |
17 | | -(function($) { |
| 16 | +(function( $, undefined ) { |
18 | 17 | |
19 | 18 | $.widget("ui.selectable", $.ui.mouse, { |
20 | 19 | options: { |
— | — | @@ -90,8 +89,6 @@ |
91 | 90 | $(options.appendTo).append(this.helper); |
92 | 91 | // position helper (lasso) |
93 | 92 | this.helper.css({ |
94 | | - "z-index": 100, |
95 | | - "position": "absolute", |
96 | 93 | "left": event.clientX, |
97 | 94 | "top": event.clientY, |
98 | 95 | "width": 0, |
— | — | @@ -263,7 +260,7 @@ |
264 | 261 | }); |
265 | 262 | |
266 | 263 | $.extend($.ui.selectable, { |
267 | | - version: "1.8.2" |
| 264 | + version: "1.8.11" |
268 | 265 | }); |
269 | 266 | |
270 | 267 | })(jQuery); |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.position.js |
— | — | @@ -1,20 +1,19 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Position 1.8.2 |
| 3 | + * jQuery UI Position 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Position |
10 | 10 | */ |
11 | | -(function( $ ) { |
| 11 | +(function( $, undefined ) { |
12 | 12 | |
13 | 13 | $.ui = $.ui || {}; |
14 | 14 | |
15 | 15 | var horizontalPositions = /left|center|right/, |
16 | | - horizontalDefault = "center", |
17 | 16 | verticalPositions = /top|center|bottom/, |
18 | | - verticalDefault = "center", |
| 17 | + center = "center", |
19 | 18 | _position = $.fn.position, |
20 | 19 | _offset = $.fn.offset; |
21 | 20 | |
— | — | @@ -27,21 +26,23 @@ |
28 | 27 | options = $.extend( {}, options ); |
29 | 28 | |
30 | 29 | var target = $( options.of ), |
| 30 | + targetElem = target[0], |
31 | 31 | collision = ( options.collision || "flip" ).split( " " ), |
32 | 32 | offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], |
33 | 33 | targetWidth, |
34 | 34 | targetHeight, |
35 | 35 | basePosition; |
36 | 36 | |
37 | | - if ( options.of.nodeType === 9 ) { |
| 37 | + if ( targetElem.nodeType === 9 ) { |
38 | 38 | targetWidth = target.width(); |
39 | 39 | targetHeight = target.height(); |
40 | 40 | basePosition = { top: 0, left: 0 }; |
41 | | - } else if ( options.of.scrollTo && options.of.document ) { |
| 41 | + // TODO: use $.isWindow() in 1.9 |
| 42 | + } else if ( targetElem.setTimeout ) { |
42 | 43 | targetWidth = target.width(); |
43 | 44 | targetHeight = target.height(); |
44 | 45 | basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; |
45 | | - } else if ( options.of.preventDefault ) { |
| 46 | + } else if ( targetElem.preventDefault ) { |
46 | 47 | // force left top to allow flipping |
47 | 48 | options.at = "left top"; |
48 | 49 | targetWidth = targetHeight = 0; |
— | — | @@ -58,13 +59,13 @@ |
59 | 60 | var pos = ( options[this] || "" ).split( " " ); |
60 | 61 | if ( pos.length === 1) { |
61 | 62 | pos = horizontalPositions.test( pos[0] ) ? |
62 | | - pos.concat( [verticalDefault] ) : |
| 63 | + pos.concat( [center] ) : |
63 | 64 | verticalPositions.test( pos[0] ) ? |
64 | | - [ horizontalDefault ].concat( pos ) : |
65 | | - [ horizontalDefault, verticalDefault ]; |
| 65 | + [ center ].concat( pos ) : |
| 66 | + [ center, center ]; |
66 | 67 | } |
67 | | - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault; |
68 | | - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault; |
| 68 | + pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; |
| 69 | + pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; |
69 | 70 | options[ this ] = pos; |
70 | 71 | }); |
71 | 72 | |
— | — | @@ -82,13 +83,13 @@ |
83 | 84 | |
84 | 85 | if ( options.at[0] === "right" ) { |
85 | 86 | basePosition.left += targetWidth; |
86 | | - } else if (options.at[0] === horizontalDefault ) { |
| 87 | + } else if ( options.at[0] === center ) { |
87 | 88 | basePosition.left += targetWidth / 2; |
88 | 89 | } |
89 | 90 | |
90 | 91 | if ( options.at[1] === "bottom" ) { |
91 | 92 | basePosition.top += targetHeight; |
92 | | - } else if ( options.at[1] === verticalDefault ) { |
| 93 | + } else if ( options.at[1] === center ) { |
93 | 94 | basePosition.top += targetHeight / 2; |
94 | 95 | } |
95 | 96 | |
— | — | @@ -99,24 +100,36 @@ |
100 | 101 | var elem = $( this ), |
101 | 102 | elemWidth = elem.outerWidth(), |
102 | 103 | elemHeight = elem.outerHeight(), |
103 | | - position = $.extend( {}, basePosition ); |
| 104 | + marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, |
| 105 | + marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, |
| 106 | + collisionWidth = elemWidth + marginLeft + |
| 107 | + ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ), |
| 108 | + collisionHeight = elemHeight + marginTop + |
| 109 | + ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), |
| 110 | + position = $.extend( {}, basePosition ), |
| 111 | + collisionPosition; |
104 | 112 | |
105 | 113 | if ( options.my[0] === "right" ) { |
106 | 114 | position.left -= elemWidth; |
107 | | - } else if ( options.my[0] === horizontalDefault ) { |
| 115 | + } else if ( options.my[0] === center ) { |
108 | 116 | position.left -= elemWidth / 2; |
109 | 117 | } |
110 | 118 | |
111 | 119 | if ( options.my[1] === "bottom" ) { |
112 | 120 | position.top -= elemHeight; |
113 | | - } else if ( options.my[1] === verticalDefault ) { |
| 121 | + } else if ( options.my[1] === center ) { |
114 | 122 | position.top -= elemHeight / 2; |
115 | 123 | } |
116 | 124 | |
117 | 125 | // prevent fractions (see #5280) |
118 | | - position.left = parseInt( position.left ); |
119 | | - position.top = parseInt( position.top ); |
| 126 | + position.left = Math.round( position.left ); |
| 127 | + position.top = Math.round( position.top ); |
120 | 128 | |
| 129 | + collisionPosition = { |
| 130 | + left: position.left - marginLeft, |
| 131 | + top: position.top - marginTop |
| 132 | + }; |
| 133 | + |
121 | 134 | $.each( [ "left", "top" ], function( i, dir ) { |
122 | 135 | if ( $.ui.position[ collision[i] ] ) { |
123 | 136 | $.ui.position[ collision[i] ][ dir ]( position, { |
— | — | @@ -124,6 +137,9 @@ |
125 | 138 | targetHeight: targetHeight, |
126 | 139 | elemWidth: elemWidth, |
127 | 140 | elemHeight: elemHeight, |
| 141 | + collisionPosition: collisionPosition, |
| 142 | + collisionWidth: collisionWidth, |
| 143 | + collisionHeight: collisionHeight, |
128 | 144 | offset: offset, |
129 | 145 | my: options.my, |
130 | 146 | at: options.at |
— | — | @@ -142,41 +158,44 @@ |
143 | 159 | fit: { |
144 | 160 | left: function( position, data ) { |
145 | 161 | var win = $( window ), |
146 | | - over = position.left + data.elemWidth - win.width() - win.scrollLeft(); |
147 | | - position.left = over > 0 ? position.left - over : Math.max( 0, position.left ); |
| 162 | + over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); |
| 163 | + position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); |
148 | 164 | }, |
149 | 165 | top: function( position, data ) { |
150 | 166 | var win = $( window ), |
151 | | - over = position.top + data.elemHeight - win.height() - win.scrollTop(); |
152 | | - position.top = over > 0 ? position.top - over : Math.max( 0, position.top ); |
| 167 | + over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); |
| 168 | + position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); |
153 | 169 | } |
154 | 170 | }, |
155 | 171 | |
156 | 172 | flip: { |
157 | 173 | left: function( position, data ) { |
158 | | - if ( data.at[0] === "center" ) { |
| 174 | + if ( data.at[0] === center ) { |
159 | 175 | return; |
160 | 176 | } |
161 | 177 | var win = $( window ), |
162 | | - over = position.left + data.elemWidth - win.width() - win.scrollLeft(), |
| 178 | + over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), |
163 | 179 | myOffset = data.my[ 0 ] === "left" ? |
164 | 180 | -data.elemWidth : |
165 | 181 | data.my[ 0 ] === "right" ? |
166 | 182 | data.elemWidth : |
167 | 183 | 0, |
| 184 | + atOffset = data.at[ 0 ] === "left" ? |
| 185 | + data.targetWidth : |
| 186 | + -data.targetWidth, |
168 | 187 | offset = -2 * data.offset[ 0 ]; |
169 | | - position.left += position.left < 0 ? |
170 | | - myOffset + data.targetWidth + offset : |
| 188 | + position.left += data.collisionPosition.left < 0 ? |
| 189 | + myOffset + atOffset + offset : |
171 | 190 | over > 0 ? |
172 | | - myOffset - data.targetWidth + offset : |
| 191 | + myOffset + atOffset + offset : |
173 | 192 | 0; |
174 | 193 | }, |
175 | 194 | top: function( position, data ) { |
176 | | - if ( data.at[1] === "center" ) { |
| 195 | + if ( data.at[1] === center ) { |
177 | 196 | return; |
178 | 197 | } |
179 | 198 | var win = $( window ), |
180 | | - over = position.top + data.elemHeight - win.height() - win.scrollTop(), |
| 199 | + over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), |
181 | 200 | myOffset = data.my[ 1 ] === "top" ? |
182 | 201 | -data.elemHeight : |
183 | 202 | data.my[ 1 ] === "bottom" ? |
— | — | @@ -186,8 +205,8 @@ |
187 | 206 | data.targetHeight : |
188 | 207 | -data.targetHeight, |
189 | 208 | offset = -2 * data.offset[ 1 ]; |
190 | | - position.top += position.top < 0 ? |
191 | | - myOffset + data.targetHeight + offset : |
| 209 | + position.top += data.collisionPosition.top < 0 ? |
| 210 | + myOffset + atOffset + offset : |
192 | 211 | over > 0 ? |
193 | 212 | myOffset + atOffset + offset : |
194 | 213 | 0; |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.droppable.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Droppable 1.8.2 |
| 3 | + * jQuery UI Droppable 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Droppables |
10 | 10 | * |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * jquery.ui.mouse.js |
15 | 15 | * jquery.ui.draggable.js |
16 | 16 | */ |
17 | | -(function($) { |
| 17 | +(function( $, undefined ) { |
18 | 18 | |
19 | 19 | $.widget("ui.droppable", { |
20 | 20 | widgetEventPrefix: "drop", |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | }); |
149 | 149 | |
150 | 150 | $.extend($.ui.droppable, { |
151 | | - version: "1.8.2" |
| 151 | + version: "1.8.11" |
152 | 152 | }); |
153 | 153 | |
154 | 154 | $.ui.intersect = function(draggable, droppable, toleranceMode) { |
— | — | @@ -161,8 +161,8 @@ |
162 | 162 | |
163 | 163 | switch (toleranceMode) { |
164 | 164 | case 'fit': |
165 | | - return (l < x1 && x2 < r |
166 | | - && t < y1 && y2 < b); |
| 165 | + return (l <= x1 && x2 <= r |
| 166 | + && t <= y1 && y2 <= b); |
167 | 167 | break; |
168 | 168 | case 'intersect': |
169 | 169 | return (l < x1 + (draggable.helperProportions.width / 2) // Right Half |
— | — | @@ -212,11 +212,11 @@ |
213 | 213 | 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 |
214 | 214 | m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue |
215 | 215 | |
| 216 | + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables |
| 217 | + |
216 | 218 | m[i].offset = m[i].element.offset(); |
217 | 219 | m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; |
218 | 220 | |
219 | | - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables |
220 | | - |
221 | 221 | } |
222 | 222 | |
223 | 223 | }, |
Index: trunk/phase3/resources/jquery.ui/jquery.ui.draggable.js |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | /* |
3 | | - * jQuery UI Draggable 1.8.2 |
| 3 | + * jQuery UI Draggable 1.8.11 |
4 | 4 | * |
5 | | - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
6 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
7 | | - * and GPL (GPL-LICENSE.txt) licenses. |
| 5 | + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) |
| 6 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
| 7 | + * http://jquery.org/license |
8 | 8 | * |
9 | 9 | * http://docs.jquery.com/UI/Draggables |
10 | 10 | * |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * jquery.ui.mouse.js |
14 | 14 | * jquery.ui.widget.js |
15 | 15 | */ |
16 | | -(function($) { |
| 16 | +(function( $, undefined ) { |
17 | 17 | |
18 | 18 | $.widget("ui.draggable", $.ui.mouse, { |
19 | 19 | widgetEventPrefix: "drag", |
— | — | @@ -192,8 +192,8 @@ |
193 | 193 | this.dropped = false; |
194 | 194 | } |
195 | 195 | |
196 | | - //if the original element is removed, don't bother to continue |
197 | | - if(!this.element[0] || !this.element[0].parentNode) |
| 196 | + //if the original element is removed, don't bother to continue if helper is set to "original" |
| 197 | + if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") |
198 | 198 | return false; |
199 | 199 | |
200 | 200 | if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { |
— | — | @@ -317,7 +317,9 @@ |
318 | 318 | _cacheMargins: function() { |
319 | 319 | this.margins = { |
320 | 320 | left: (parseInt(this.element.css("marginLeft"),10) || 0), |
321 | | - top: (parseInt(this.element.css("marginTop"),10) || 0) |
| 321 | + top: (parseInt(this.element.css("marginTop"),10) || 0), |
| 322 | + right: (parseInt(this.element.css("marginRight"),10) || 0), |
| 323 | + bottom: (parseInt(this.element.css("marginBottom"),10) || 0) |
322 | 324 | }; |
323 | 325 | }, |
324 | 326 | |
— | — | @@ -333,10 +335,10 @@ |
334 | 336 | var o = this.options; |
335 | 337 | if(o.containment == 'parent') o.containment = this.helper[0].parentNode; |
336 | 338 | if(o.containment == 'document' || o.containment == 'window') this.containment = [ |
337 | | - 0 - this.offset.relative.left - this.offset.parent.left, |
338 | | - 0 - this.offset.relative.top - this.offset.parent.top, |
339 | | - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, |
340 | | - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top |
| 339 | + (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left, |
| 340 | + (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top, |
| 341 | + (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, |
| 342 | + (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top |
341 | 343 | ]; |
342 | 344 | |
343 | 345 | if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { |
— | — | @@ -345,10 +347,10 @@ |
346 | 348 | var over = ($(ce).css("overflow") != 'hidden'); |
347 | 349 | |
348 | 350 | this.containment = [ |
349 | | - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, |
350 | | - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, |
351 | | - 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, |
352 | | - 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 |
| 351 | + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), |
| 352 | + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), |
| 353 | + 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 - this.margins.right, |
| 354 | + 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 - this.margins.bottom |
353 | 355 | ]; |
354 | 356 | } else if(o.containment.constructor == Array) { |
355 | 357 | this.containment = o.containment; |
— | — | @@ -459,7 +461,7 @@ |
460 | 462 | }); |
461 | 463 | |
462 | 464 | $.extend($.ui.draggable, { |
463 | | - version: "1.8.2" |
| 465 | + version: "1.8.11" |
464 | 466 | }); |
465 | 467 | |
466 | 468 | $.ui.plugin.add("draggable", "connectToSortable", { |
— | — | @@ -475,7 +477,7 @@ |
476 | 478 | instance: sortable, |
477 | 479 | shouldRevert: sortable.options.revert |
478 | 480 | }); |
479 | | - sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache |
| 481 | + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). |
480 | 482 | sortable._trigger("activate", event, uiSortable); |
481 | 483 | } |
482 | 484 | }); |