vendor: 4,899 bytes, lines 1-143
1/*! jQuery UI - v1.12.0 - 2016-07-08 2* http://jqueryui.com 3* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 4* Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 6(function( factory ) { 7 if ( typeof define === "function" && define.amd ) { 8 9 // AMD. Register as an anonymous module. 10 define([ "jquery" ], factory ); 11 } else { 12 13 // Browser globals 14 factory( jQuery ); 15 } 16}(function( $ ) { 17 18$.ui = $.ui || {}; 19 20var version = $.ui.version = "1.12.0"; 21 22 23/*! 24 * jQuery UI Widget 1.12.0 25 * http://jqueryui.com 26 * 27 * Copyright jQuery Foundation and other contributors 28 * Released under the MIT license. 29 * http://jquery.org/license 30 */ 31 32//>>label: Widget 33//>>group: Core 34//>>description: Provides a factory for creating stateful widgets with a common API. 35//>>docs: http://api.jqueryui.com/jQuery.widget/ 36//>>demos: http://jqueryui.com/widget/ 37 38 39 40var widgetUuid = 0; 41var widgetSlice = Array.prototype.slice; 42 43$.cleanData = ( function( orig ) { 44 return function( elems ) { 45 var events, elem, i; 46 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 47 try { 48 49 // Only trigger remove when necessary to save time 50 events = $._data( elem, "events" ); 51 if ( events && events.remove ) { 52 $( elem ).triggerHandler( "remove" ); 53 } 54 55 // Http://bugs.jquery.com/ticket/8235 56 } catch ( e ) {} 57 } 58 orig( elems ); 59 }; 60} )( $.cleanData ); 61 62$.widget = function( name, base, prototype ) { 63 var existingConstructor, constructor, basePrototype; 64 65 // ProxiedPrototype allows the provided prototype to remain unmodified 66 // so that it can be used as a mixin for multiple widgets (#8876) 67 var proxiedPrototype = {}; 68 69 var namespace = name.split( "." )[ 0 ]; 70 name = name.split( "." )[ 1 ]; 71 var fullName = namespace + "-" + name; 72 73 if ( !prototype ) { 74 prototype = base; 75 base = $.Widget; 76 } 77 78 if ( $.isArray( prototype ) ) { 79 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 80 } 81 82 // Create selector for plugin 83 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 84 return !!$.data( elem, fullName ); 85 }; 86 87 $[ namespace ] = $[ namespace ] || {}; 88 existingConstructor = $[ namespace ][ name ]; 89 constructor = $[ namespace ][ name ] = function( options, element ) { 90 91 // Allow instantiation without "new" keyword 92 if ( !this._createWidget ) { 93 return new constructor( options, element ); 94 } 95 96 // Allow instantiation without initializing for simple inheritance 97 // must use "new" keyword (the code above always passes args) 98 if ( arguments.length ) { 99 this._createWidget( options, element ); 100 } 101 }; 102 103 // Extend with the existing constructor to carry over any static properties 104 $.extend( constructor, existingConstructor, { 105 version: prototype.version, 106 107 // Copy the object used to create the prototype in case we need to 108 // redefine the widget later 109 _proto: $.extend( {}, prototype ), 110 111 // Track widgets that inherit from this widget in case this widget is 112 // redefined after a widget inherits from it 113 _childConstructors: [] 114 } ); 115 116 basePrototype = new base(); 117 118 // We need to make the options hash a property directly on the new instance 119 // otherwise we'll modify the options hash on the prototype that we're 120 // inheriting from 121 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 122 $.each( prototype, function( prop, value ) { 123 if ( !$.isFunction( value ) ) { 124 proxiedPrototype[ prop ] = value; 125 return; 126 } 127 proxiedPrototype[ prop ] = ( function() { 128 function _super() { 129 return base.prototype[ prop ].apply( this, arguments ); 130 } 131 132 function _superApply( args ) { 133 return base.prototype[ prop ].apply( this, args ); 134 } 135 136 return function() { 137 var __super = this._super; 138 var __superApply = this._superApply; 139 var returnValue; 140 141 this._super = _super; 142 this._superApply = _superApply; 143
vendor: 5,050 bytes, lines 144-323
144 returnValue = value.apply( this, arguments ); 145 146 this._super = __super; 147 this._superApply = __superApply; 148 149 return returnValue; 150 }; 151 } )(); 152 } ); 153 constructor.prototype = $.widget.extend( basePrototype, { 154 155 // TODO: remove support for widgetEventPrefix 156 // always use the name + a colon as the prefix, e.g., draggable:start 157 // don't prefix for widgets that aren't DOM-based 158 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 159 }, proxiedPrototype, { 160 constructor: constructor, 161 namespace: namespace, 162 widgetName: name, 163 widgetFullName: fullName 164 } ); 165 166 // If this widget is being redefined then we need to find all widgets that 167 // are inheriting from it and redefine all of them so that they inherit from 168 // the new version of this widget. We're essentially trying to replace one 169 // level in the prototype chain. 170 if ( existingConstructor ) { 171 $.each( existingConstructor._childConstructors, function( i, child ) { 172 var childPrototype = child.prototype; 173 174 // Redefine the child widget using the same prototype that was 175 // originally used, but inherit from the new version of the base 176 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 177 child._proto ); 178 } ); 179 180 // Remove the list of existing child constructors from the old constructor 181 // so the old child constructors can be garbage collected 182 delete existingConstructor._childConstructors; 183 } else { 184 base._childConstructors.push( constructor ); 185 } 186 187 $.widget.bridge( name, constructor ); 188 189 return constructor; 190}; 191 192$.widget.extend = function( target ) { 193 var input = widgetSlice.call( arguments, 1 ); 194 var inputIndex = 0; 195 var inputLength = input.length; 196 var key; 197 var value; 198 199 for ( ; inputIndex < inputLength; inputIndex++ ) { 200 for ( key in input[ inputIndex ] ) { 201 value = input[ inputIndex ][ key ]; 202 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 203 204 // Clone objects 205 if ( $.isPlainObject( value ) ) { 206 target[ key ] = $.isPlainObject( target[ key ] ) ? 207 $.widget.extend( {}, target[ key ], value ) : 208 209 // Don't extend strings, arrays, etc. with objects 210 $.widget.extend( {}, value ); 211 212 // Copy everything else by reference 213 } else { 214 target[ key ] = value; 215 } 216 } 217 } 218 } 219 return target; 220}; 221 222$.widget.bridge = function( name, object ) { 223 var fullName = object.prototype.widgetFullName || name; 224 $.fn[ name ] = function( options ) { 225 var isMethodCall = typeof options === "string"; 226 var args = widgetSlice.call( arguments, 1 ); 227 var returnValue = this; 228 229 if ( isMethodCall ) { 230 this.each( function() { 231 var methodValue; 232 var instance = $.data( this, fullName ); 233 234 if ( options === "instance" ) { 235 returnValue = instance; 236 return false; 237 } 238 239 if ( !instance ) { 240 return $.error( "cannot call methods on " + name + 241 " prior to initialization; " + 242 "attempted to call method '" + options + "'" ); 243 } 244 245 if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { 246 return $.error( "no such method '" + options + "' for " + name + 247 " widget instance" ); 248 } 249 250 methodValue = instance[ options ].apply( instance, args ); 251 252 if ( methodValue !== instance && methodValue !== undefined ) { 253 returnValue = methodValue && methodValue.jquery ? 254 returnValue.pushStack( methodValue.get() ) : 255 methodValue; 256 return false; 257 } 258 } ); 259 } else { 260 261 // Allow multiple hashes to be passed on init 262 if ( args.length ) { 263 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 264 } 265 266 this.each( function() { 267 var instance = $.data( this, fullName ); 268 if ( instance ) { 269 instance.option( options || {} ); 270 if ( instance._init ) { 271 instance._init(); 272 } 273 } else { 274 $.data( this, fullName, new object( options, this ) ); 275 } 276 } ); 277 } 278 279 return returnValue; 280 }; 281}; 282 283$.Widget = function( /* options, element */ ) {}; 284$.Widget._childConstructors = []; 285 286$.Widget.prototype = { 287 widgetName: "widget", 288 widgetEventPrefix: "", 289 defaultElement: "<div>", 290 291 options: { 292 classes: {}, 293 disabled: false, 294 295 // Callbacks 296 create: null 297 }, 298 299 _createWidget: function( options, element ) { 300 element = $( element || this.defaultElement || this )[ 0 ]; 301 this.element = $( element ); 302 this.uuid = widgetUuid++; 303 this.eventNamespace = "." + this.widgetName + this.uuid; 304 305 this.bindings = $(); 306 this.hoverable = $(); 307 this.focusable = $(); 308 this.classesElementLookup = {}; 309 310 if ( element !== this ) { 311 $.data( element, this.widgetFullName, this ); 312 this._on( true, this.element, { 313 remove: function( event ) { 314 if ( event.target === element ) { 315 this.destroy(); 316 } 317 } 318 } ); 319 this.document = $( element.style ? 320 321 // Element within the document 322 element.ownerDocument : 323
vendor: 10,819 bytes, lines 324-709
324 // Element is window or document 325 element.document || element ); 326 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 327 } 328 329 this.options = $.widget.extend( {}, 330 this.options, 331 this._getCreateOptions(), 332 options ); 333 334 this._create(); 335 336 if ( this.options.disabled ) { 337 this._setOptionDisabled( this.options.disabled ); 338 } 339 340 this._trigger( "create", null, this._getCreateEventData() ); 341 this._init(); 342 }, 343 344 _getCreateOptions: function() { 345 return {}; 346 }, 347 348 _getCreateEventData: $.noop, 349 350 _create: $.noop, 351 352 _init: $.noop, 353 354 destroy: function() { 355 var that = this; 356 357 this._destroy(); 358 $.each( this.classesElementLookup, function( key, value ) { 359 that._removeClass( value, key ); 360 } ); 361 362 // We can probably remove the unbind calls in 2.0 363 // all event bindings should go through this._on() 364 this.element 365 .off( this.eventNamespace ) 366 .removeData( this.widgetFullName ); 367 this.widget() 368 .off( this.eventNamespace ) 369 .removeAttr( "aria-disabled" ); 370 371 // Clean up events and states 372 this.bindings.off( this.eventNamespace ); 373 }, 374 375 _destroy: $.noop, 376 377 widget: function() { 378 return this.element; 379 }, 380 381 option: function( key, value ) { 382 var options = key; 383 var parts; 384 var curOption; 385 var i; 386 387 if ( arguments.length === 0 ) { 388 389 // Don't return a reference to the internal hash 390 return $.widget.extend( {}, this.options ); 391 } 392 393 if ( typeof key === "string" ) { 394 395 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 396 options = {}; 397 parts = key.split( "." ); 398 key = parts.shift(); 399 if ( parts.length ) { 400 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 401 for ( i = 0; i < parts.length - 1; i++ ) { 402 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 403 curOption = curOption[ parts[ i ] ]; 404 } 405 key = parts.pop(); 406 if ( arguments.length === 1 ) { 407 return curOption[ key ] === undefined ? null : curOption[ key ]; 408 } 409 curOption[ key ] = value; 410 } else { 411 if ( arguments.length === 1 ) { 412 return this.options[ key ] === undefined ? null : this.options[ key ]; 413 } 414 options[ key ] = value; 415 } 416 } 417 418 this._setOptions( options ); 419 420 return this; 421 }, 422 423 _setOptions: function( options ) { 424 var key; 425 426 for ( key in options ) { 427 this._setOption( key, options[ key ] ); 428 } 429 430 return this; 431 }, 432 433 _setOption: function( key, value ) { 434 if ( key === "classes" ) { 435 this._setOptionClasses( value ); 436 } 437 438 this.options[ key ] = value; 439 440 if ( key === "disabled" ) { 441 this._setOptionDisabled( value ); 442 } 443 444 return this; 445 }, 446 447 _setOptionClasses: function( value ) { 448 var classKey, elements, currentElements; 449 450 for ( classKey in value ) { 451 currentElements = this.classesElementLookup[ classKey ]; 452 if ( value[ classKey ] === this.options.classes[ classKey ] || 453 !currentElements || 454 !currentElements.length ) { 455 continue; 456 } 457 458 // We are doing this to create a new jQuery object because the _removeClass() call 459 // on the next line is going to destroy the reference to the current elements being 460 // tracked. We need to save a copy of this collection so that we can add the new classes 461 // below. 462 elements = $( currentElements.get() ); 463 this._removeClass( currentElements, classKey ); 464 465 // We don't use _addClass() here, because that uses this.options.classes 466 // for generating the string of classes. We want to use the value passed in from 467 // _setOption(), this is the new value of the classes option which was passed to 468 // _setOption(). We pass this value directly to _classes(). 469 elements.addClass( this._classes( { 470 element: elements, 471 keys: classKey, 472 classes: value, 473 add: true 474 } ) ); 475 } 476 }, 477 478 _setOptionDisabled: function( value ) { 479 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 480 481 // If the widget is becoming disabled, then nothing is interactive 482 if ( value ) { 483 this._removeClass( this.hoverable, null, "ui-state-hover" ); 484 this._removeClass( this.focusable, null, "ui-state-focus" ); 485 } 486 }, 487 488 enable: function() { 489 return this._setOptions( { disabled: false } ); 490 }, 491 492 disable: function() { 493 return this._setOptions( { disabled: true } ); 494 }, 495 496 _classes: function( options ) { 497 var full = []; 498 var that = this; 499 500 options = $.extend( { 501 element: this.element, 502 classes: this.options.classes || {} 503 }, options ); 504 505 function processClassString( classes, checkOption ) { 506 var current, i; 507 for ( i = 0; i < classes.length; i++ ) { 508 current = that.classesElementLookup[ classes[ i ] ] || $(); 509 if ( options.add ) { 510 current = $( $.unique( current.get().concat( options.element.get() ) ) ); 511 } else { 512 current = $( current.not( options.element ).get() ); 513 } 514 that.classesElementLookup[ classes[ i ] ] = current; 515 full.push( classes[ i ] ); 516 if ( checkOption && options.classes[ classes[ i ] ] ) { 517 full.push( options.classes[ classes[ i ] ] ); 518 } 519 } 520 } 521 522 if ( options.keys ) { 523 processClassString( options.keys.match( /\S+/g ) || [], true ); 524 } 525 if ( options.extra ) { 526 processClassString( options.extra.match( /\S+/g ) || [] ); 527 } 528 529 return full.join( " " ); 530 }, 531 532 _removeClass: function( element, keys, extra ) { 533 return this._toggleClass( element, keys, extra, false ); 534 }, 535 536 _addClass: function( element, keys, extra ) { 537 return this._toggleClass( element, keys, extra, true ); 538 }, 539 540 _toggleClass: function( element, keys, extra, add ) { 541 add = ( typeof add === "boolean" ) ? add : extra; 542 var shift = ( typeof element === "string" || element === null ), 543 options = { 544 extra: shift ? keys : extra, 545 keys: shift ? element : keys, 546 element: shift ? this.element : element, 547 add: add 548 }; 549 options.element.toggleClass( this._classes( options ), add ); 550 return this; 551 }, 552 553 _on: function( suppressDisabledCheck, element, handlers ) { 554 var delegateElement; 555 var instance = this; 556 557 // No suppressDisabledCheck flag, shuffle arguments 558 if ( typeof suppressDisabledCheck !== "boolean" ) { 559 handlers = element; 560 element = suppressDisabledCheck; 561 suppressDisabledCheck = false; 562 } 563 564 // No element argument, shuffle and use this.element 565 if ( !handlers ) { 566 handlers = element; 567 element = this.element; 568 delegateElement = this.widget(); 569 } else { 570 element = delegateElement = $( element ); 571 this.bindings = this.bindings.add( element ); 572 } 573 574 $.each( handlers, function( event, handler ) { 575 function handlerProxy() { 576 577 // Allow widgets to customize the disabled handling 578 // - disabled as an array instead of boolean 579 // - disabled class as method for disabling individual parts 580 if ( !suppressDisabledCheck && 581 ( instance.options.disabled === true || 582 $( this ).hasClass( "ui-state-disabled" ) ) ) { 583 return; 584 } 585 return ( typeof handler === "string" ? instance[ handler ] : handler ) 586 .apply( instance, arguments ); 587 } 588 589 // Copy the guid so direct unbinding works 590 if ( typeof handler !== "string" ) { 591 handlerProxy.guid = handler.guid = 592 handler.guid || handlerProxy.guid || $.guid++; 593 } 594 595 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 596 var eventName = match[ 1 ] + instance.eventNamespace; 597 var selector = match[ 2 ]; 598 599 if ( selector ) { 600 delegateElement.on( eventName, selector, handlerProxy ); 601 } else { 602 element.on( eventName, handlerProxy ); 603 } 604 } ); 605 }, 606 607 _off: function( element, eventName ) { 608 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 609 this.eventNamespace; 610 element.off( eventName ).off( eventName ); 611 612 // Clear the stack to avoid memory leaks (#10056) 613 this.bindings = $( this.bindings.not( element ).get() ); 614 this.focusable = $( this.focusable.not( element ).get() ); 615 this.hoverable = $( this.hoverable.not( element ).get() ); 616 }, 617 618 _delay: function( handler, delay ) { 619 function handlerProxy() { 620 return ( typeof handler === "string" ? instance[ handler ] : handler ) 621 .apply( instance, arguments ); 622 } 623 var instance = this; 624 return setTimeout( handlerProxy, delay || 0 ); 625 }, 626 627 _hoverable: function( element ) { 628 this.hoverable = this.hoverable.add( element ); 629 this._on( element, { 630 mouseenter: function( event ) { 631 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 632 }, 633 mouseleave: function( event ) { 634 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 635 } 636 } ); 637 }, 638 639 _focusable: function( element ) { 640 this.focusable = this.focusable.add( element ); 641 this._on( element, { 642 focusin: function( event ) { 643 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 644 }, 645 focusout: function( event ) { 646 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 647 } 648 } ); 649 }, 650 651 _trigger: function( type, event, data ) { 652 var prop, orig; 653 var callback = this.options[ type ]; 654 655 data = data || {}; 656 event = $.Event( event ); 657 event.type = ( type === this.widgetEventPrefix ? 658 type : 659 this.widgetEventPrefix + type ).toLowerCase(); 660 661 // The original event may come from any element 662 // so we need to reset the target on the new event 663 event.target = this.element[ 0 ]; 664 665 // Copy original event properties over to the new event 666 orig = event.originalEvent; 667 if ( orig ) { 668 for ( prop in orig ) { 669 if ( !( prop in event ) ) { 670 event[ prop ] = orig[ prop ]; 671 } 672 } 673 } 674 675 this.element.trigger( event, data ); 676 return !( $.isFunction( callback ) && 677 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 678 event.isDefaultPrevented() ); 679 } 680}; 681 682$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 683 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 684 if ( typeof options === "string" ) { 685 options = { effect: options }; 686 } 687 688 var hasOptions; 689 var effectName = !options ? 690 method : 691 options === true || typeof options === "number" ? 692 defaultEffect : 693 options.effect || defaultEffect; 694 695 options = options || {}; 696 if ( typeof options === "number" ) { 697 options = { duration: options }; 698 } 699 700 hasOptions = !$.isEmptyObject( options ); 701 options.complete = callback; 702 703 if ( options.delay ) { 704 element.delay( options.delay ); 705 } 706 707 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 708 element[ method ]( options ); 709 } else if ( effectName !== method && element[ effectName ] ) {
vendor: 5,394 bytes, lines 710-910
710 element[ effectName ]( options.duration, options.easing, callback ); 711 } else { 712 element.queue( function( next ) { 713 $( this )[ method ](); 714 if ( callback ) { 715 callback.call( element[ 0 ] ); 716 } 717 next(); 718 } ); 719 } 720 }; 721} ); 722 723var widget = $.widget; 724 725 726/*! 727 * jQuery UI Position 1.12.0 728 * http://jqueryui.com 729 * 730 * Copyright jQuery Foundation and other contributors 731 * Released under the MIT license. 732 * http://jquery.org/license 733 * 734 * http://api.jqueryui.com/position/ 735 */ 736 737//>>label: Position 738//>>group: Core 739//>>description: Positions elements relative to other elements. 740//>>docs: http://api.jqueryui.com/position/ 741//>>demos: http://jqueryui.com/position/ 742 743 744( function() { 745var cachedScrollbarWidth, supportsOffsetFractions, 746 max = Math.max, 747 abs = Math.abs, 748 round = Math.round, 749 rhorizontal = /left|center|right/, 750 rvertical = /top|center|bottom/, 751 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 752 rposition = /^\w+/, 753 rpercent = /%$/, 754 _position = $.fn.position; 755 756// Support: IE <=9 only 757supportsOffsetFractions = function() { 758 var element = $( "<div>" ) 759 .css( "position", "absolute" ) 760 .appendTo( "body" ) 761 .offset( { 762 top: 1.5, 763 left: 1.5 764 } ), 765 support = element.offset().top === 1.5; 766 767 element.remove(); 768 769 supportsOffsetFractions = function() { 770 return support; 771 }; 772 773 return support; 774}; 775 776function getOffsets( offsets, width, height ) { 777 return [ 778 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 779 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 780 ]; 781} 782 783function parseCss( element, property ) { 784 return parseInt( $.css( element, property ), 10 ) || 0; 785} 786 787function getDimensions( elem ) { 788 var raw = elem[ 0 ]; 789 if ( raw.nodeType === 9 ) { 790 return { 791 width: elem.width(), 792 height: elem.height(), 793 offset: { top: 0, left: 0 } 794 }; 795 } 796 if ( $.isWindow( raw ) ) { 797 return { 798 width: elem.width(), 799 height: elem.height(), 800 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 801 }; 802 } 803 if ( raw.preventDefault ) { 804 return { 805 width: 0, 806 height: 0, 807 offset: { top: raw.pageY, left: raw.pageX } 808 }; 809 } 810 return { 811 width: elem.outerWidth(), 812 height: elem.outerHeight(), 813 offset: elem.offset() 814 }; 815} 816 817$.position = { 818 scrollbarWidth: function() { 819 if ( cachedScrollbarWidth !== undefined ) { 820 return cachedScrollbarWidth; 821 } 822 var w1, w2, 823 div = $( "<div " + 824 "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" + 825 "<div style='height:100px;width:auto;'></div></div>" ), 826 innerDiv = div.children()[ 0 ]; 827 828 $( "body" ).append( div ); 829 w1 = innerDiv.offsetWidth; 830 div.css( "overflow", "scroll" ); 831 832 w2 = innerDiv.offsetWidth; 833 834 if ( w1 === w2 ) { 835 w2 = div[ 0 ].clientWidth; 836 } 837 838 div.remove(); 839 840 return ( cachedScrollbarWidth = w1 - w2 ); 841 }, 842 getScrollInfo: function( within ) { 843 var overflowX = within.isWindow || within.isDocument ? "" : 844 within.element.css( "overflow-x" ), 845 overflowY = within.isWindow || within.isDocument ? "" : 846 within.element.css( "overflow-y" ), 847 hasOverflowX = overflowX === "scroll" || 848 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 849 hasOverflowY = overflowY === "scroll" || 850 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 851 return { 852 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 853 height: hasOverflowX ? $.position.scrollbarWidth() : 0 854 }; 855 }, 856 getWithinInfo: function( element ) { 857 var withinElement = $( element || window ), 858 isWindow = $.isWindow( withinElement[ 0 ] ), 859 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 860 hasOffset = !isWindow && !isDocument; 861 return { 862 element: withinElement, 863 isWindow: isWindow, 864 isDocument: isDocument, 865 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 866 scrollLeft: withinElement.scrollLeft(), 867 scrollTop: withinElement.scrollTop(), 868 width: withinElement.outerWidth(), 869 height: withinElement.outerHeight() 870 }; 871 } 872}; 873 874$.fn.position = function( options ) { 875 if ( !options || !options.of ) { 876 return _position.apply( this, arguments ); 877 } 878 879 // Make a copy, we don't want to modify arguments 880 options = $.extend( {}, options ); 881 882 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 883 target = $( options.of ), 884 within = $.position.getWithinInfo( options.within ), 885 scrollInfo = $.position.getScrollInfo( within ), 886 collision = ( options.collision || "flip" ).split( " " ), 887 offsets = {}; 888 889 dimensions = getDimensions( target ); 890 if ( target[ 0 ].preventDefault ) { 891 892 // Force left top to allow flipping 893 options.at = "left top"; 894 } 895 targetWidth = dimensions.width; 896 targetHeight = dimensions.height; 897 targetOffset = dimensions.offset; 898 899 // Clone to reuse original targetOffset later 900 basePosition = $.extend( {}, targetOffset ); 901 902 // Force my and at to have valid horizontal and vertical positions 903 // if a value is missing or invalid, it will be converted to center 904 $.each( [ "my", "at" ], function() { 905 var pos = ( options[ this ] || "" ).split( " " ), 906 horizontalOffset, 907 verticalOffset; 908 909 if ( pos.length === 1 ) { 910 pos = rhorizontal.test( pos[ 0 ] ) ?
vendor: 4,528 bytes, lines 911-1057
911 pos.concat( [ "center" ] ) : 912 rvertical.test( pos[ 0 ] ) ? 913 [ "center" ].concat( pos ) : 914 [ "center", "center" ]; 915 } 916 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 917 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 918 919 // Calculate offsets 920 horizontalOffset = roffset.exec( pos[ 0 ] ); 921 verticalOffset = roffset.exec( pos[ 1 ] ); 922 offsets[ this ] = [ 923 horizontalOffset ? horizontalOffset[ 0 ] : 0, 924 verticalOffset ? verticalOffset[ 0 ] : 0 925 ]; 926 927 // Reduce to just the positions without the offsets 928 options[ this ] = [ 929 rposition.exec( pos[ 0 ] )[ 0 ], 930 rposition.exec( pos[ 1 ] )[ 0 ] 931 ]; 932 } ); 933 934 // Normalize collision option 935 if ( collision.length === 1 ) { 936 collision[ 1 ] = collision[ 0 ]; 937 } 938 939 if ( options.at[ 0 ] === "right" ) { 940 basePosition.left += targetWidth; 941 } else if ( options.at[ 0 ] === "center" ) { 942 basePosition.left += targetWidth / 2; 943 } 944 945 if ( options.at[ 1 ] === "bottom" ) { 946 basePosition.top += targetHeight; 947 } else if ( options.at[ 1 ] === "center" ) { 948 basePosition.top += targetHeight / 2; 949 } 950 951 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 952 basePosition.left += atOffset[ 0 ]; 953 basePosition.top += atOffset[ 1 ]; 954 955 return this.each( function() { 956 var collisionPosition, using, 957 elem = $( this ), 958 elemWidth = elem.outerWidth(), 959 elemHeight = elem.outerHeight(), 960 marginLeft = parseCss( this, "marginLeft" ), 961 marginTop = parseCss( this, "marginTop" ), 962 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 963 scrollInfo.width, 964 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 965 scrollInfo.height, 966 position = $.extend( {}, basePosition ), 967 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 968 969 if ( options.my[ 0 ] === "right" ) { 970 position.left -= elemWidth; 971 } else if ( options.my[ 0 ] === "center" ) { 972 position.left -= elemWidth / 2; 973 } 974 975 if ( options.my[ 1 ] === "bottom" ) { 976 position.top -= elemHeight; 977 } else if ( options.my[ 1 ] === "center" ) { 978 position.top -= elemHeight / 2; 979 } 980 981 position.left += myOffset[ 0 ]; 982 position.top += myOffset[ 1 ]; 983 984 // If the browser doesn't support fractions, then round for consistent results 985 if ( !supportsOffsetFractions() ) { 986 position.left = round( position.left ); 987 position.top = round( position.top ); 988 } 989 990 collisionPosition = { 991 marginLeft: marginLeft, 992 marginTop: marginTop 993 }; 994 995 $.each( [ "left", "top" ], function( i, dir ) { 996 if ( $.ui.position[ collision[ i ] ] ) { 997 $.ui.position[ collision[ i ] ][ dir ]( position, { 998 targetWidth: targetWidth, 999 targetHeight: targetHeight, 1000 elemWidth: elemWidth, 1001 elemHeight: elemHeight, 1002 collisionPosition: collisionPosition, 1003 collisionWidth: collisionWidth, 1004 collisionHeight: collisionHeight, 1005 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1006 my: options.my, 1007 at: options.at, 1008 within: within, 1009 elem: elem 1010 } ); 1011 } 1012 } ); 1013 1014 if ( options.using ) { 1015 1016 // Adds feedback as second argument to using callback, if present 1017 using = function( props ) { 1018 var left = targetOffset.left - position.left, 1019 right = left + targetWidth - elemWidth, 1020 top = targetOffset.top - position.top, 1021 bottom = top + targetHeight - elemHeight, 1022 feedback = { 1023 target: { 1024 element: target, 1025 left: targetOffset.left, 1026 top: targetOffset.top, 1027 width: targetWidth, 1028 height: targetHeight 1029 }, 1030 element: { 1031 element: elem, 1032 left: position.left, 1033 top: position.top, 1034 width: elemWidth, 1035 height: elemHeight 1036 }, 1037 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1038 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1039 }; 1040 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1041 feedback.horizontal = "center"; 1042 } 1043 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1044 feedback.vertical = "middle"; 1045 } 1046 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1047 feedback.important = "horizontal"; 1048 } else { 1049 feedback.important = "vertical"; 1050 } 1051 options.using.call( this, props, feedback ); 1052 }; 1053 } 1054 1055 elem.offset( $.extend( position, { using: using } ) ); 1056 } ); 1057};
vendor: 6,169 bytes, lines 1058-1243
1058 1059$.ui.position = { 1060 fit: { 1061 left: function( position, data ) { 1062 var within = data.within, 1063 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1064 outerWidth = within.width, 1065 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1066 overLeft = withinOffset - collisionPosLeft, 1067 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1068 newOverRight; 1069 1070 // Element is wider than within 1071 if ( data.collisionWidth > outerWidth ) { 1072 1073 // Element is initially over the left side of within 1074 if ( overLeft > 0 && overRight <= 0 ) { 1075 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1076 withinOffset; 1077 position.left += overLeft - newOverRight; 1078 1079 // Element is initially over right side of within 1080 } else if ( overRight > 0 && overLeft <= 0 ) { 1081 position.left = withinOffset; 1082 1083 // Element is initially over both left and right sides of within 1084 } else { 1085 if ( overLeft > overRight ) { 1086 position.left = withinOffset + outerWidth - data.collisionWidth; 1087 } else { 1088 position.left = withinOffset; 1089 } 1090 } 1091 1092 // Too far left -> align with left edge 1093 } else if ( overLeft > 0 ) { 1094 position.left += overLeft; 1095 1096 // Too far right -> align with right edge 1097 } else if ( overRight > 0 ) { 1098 position.left -= overRight; 1099 1100 // Adjust based on position and margin 1101 } else { 1102 position.left = max( position.left - collisionPosLeft, position.left ); 1103 } 1104 }, 1105 top: function( position, data ) { 1106 var within = data.within, 1107 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1108 outerHeight = data.within.height, 1109 collisionPosTop = position.top - data.collisionPosition.marginTop, 1110 overTop = withinOffset - collisionPosTop, 1111 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1112 newOverBottom; 1113 1114 // Element is taller than within 1115 if ( data.collisionHeight > outerHeight ) { 1116 1117 // Element is initially over the top of within 1118 if ( overTop > 0 && overBottom <= 0 ) { 1119 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1120 withinOffset; 1121 position.top += overTop - newOverBottom; 1122 1123 // Element is initially over bottom of within 1124 } else if ( overBottom > 0 && overTop <= 0 ) { 1125 position.top = withinOffset; 1126 1127 // Element is initially over both top and bottom of within 1128 } else { 1129 if ( overTop > overBottom ) { 1130 position.top = withinOffset + outerHeight - data.collisionHeight; 1131 } else { 1132 position.top = withinOffset; 1133 } 1134 } 1135 1136 // Too far up -> align with top 1137 } else if ( overTop > 0 ) { 1138 position.top += overTop; 1139 1140 // Too far down -> align with bottom edge 1141 } else if ( overBottom > 0 ) { 1142 position.top -= overBottom; 1143 1144 // Adjust based on position and margin 1145 } else { 1146 position.top = max( position.top - collisionPosTop, position.top ); 1147 } 1148 } 1149 }, 1150 flip: { 1151 left: function( position, data ) { 1152 var within = data.within, 1153 withinOffset = within.offset.left + within.scrollLeft, 1154 outerWidth = within.width, 1155 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1156 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1157 overLeft = collisionPosLeft - offsetLeft, 1158 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1159 myOffset = data.my[ 0 ] === "left" ? 1160 -data.elemWidth : 1161 data.my[ 0 ] === "right" ? 1162 data.elemWidth : 1163 0, 1164 atOffset = data.at[ 0 ] === "left" ? 1165 data.targetWidth : 1166 data.at[ 0 ] === "right" ? 1167 -data.targetWidth : 1168 0, 1169 offset = -2 * data.offset[ 0 ], 1170 newOverRight, 1171 newOverLeft; 1172 1173 if ( overLeft < 0 ) { 1174 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1175 outerWidth - withinOffset; 1176 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1177 position.left += myOffset + atOffset + offset; 1178 } 1179 } else if ( overRight > 0 ) { 1180 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1181 atOffset + offset - offsetLeft; 1182 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1183 position.left += myOffset + atOffset + offset; 1184 } 1185 } 1186 }, 1187 top: function( position, data ) { 1188 var within = data.within, 1189 withinOffset = within.offset.top + within.scrollTop, 1190 outerHeight = within.height, 1191 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1192 collisionPosTop = position.top - data.collisionPosition.marginTop, 1193 overTop = collisionPosTop - offsetTop, 1194 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1195 top = data.my[ 1 ] === "top", 1196 myOffset = top ? 1197 -data.elemHeight : 1198 data.my[ 1 ] === "bottom" ? 1199 data.elemHeight : 1200 0, 1201 atOffset = data.at[ 1 ] === "top" ? 1202 data.targetHeight : 1203 data.at[ 1 ] === "bottom" ? 1204 -data.targetHeight : 1205 0, 1206 offset = -2 * data.offset[ 1 ], 1207 newOverTop, 1208 newOverBottom; 1209 if ( overTop < 0 ) { 1210 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1211 outerHeight - withinOffset; 1212 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1213 position.top += myOffset + atOffset + offset; 1214 } 1215 } else if ( overBottom > 0 ) { 1216 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1217 offset - offsetTop; 1218 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1219 position.top += myOffset + atOffset + offset; 1220 } 1221 } 1222 } 1223 }, 1224 flipfit: { 1225 left: function() { 1226 $.ui.position.flip.left.apply( this, arguments ); 1227 $.ui.position.fit.left.apply( this, arguments ); 1228 }, 1229 top: function() { 1230 $.ui.position.flip.top.apply( this, arguments ); 1231 $.ui.position.fit.top.apply( this, arguments ); 1232 } 1233 } 1234}; 1235 1236} )(); 1237 1238var position = $.ui.position; 1239 1240 1241/*! 1242 * jQuery UI :data 1.12.0 1243 * http://jqueryui.com
vendor: 5,137 bytes, lines 1244-1449
1244 * 1245 * Copyright jQuery Foundation and other contributors 1246 * Released under the MIT license. 1247 * http://jquery.org/license 1248 */ 1249 1250//>>label: :data Selector 1251//>>group: Core 1252//>>description: Selects elements which have data stored under the specified key. 1253//>>docs: http://api.jqueryui.com/data-selector/ 1254 1255 1256var data = $.extend( $.expr[ ":" ], { 1257 data: $.expr.createPseudo ? 1258 $.expr.createPseudo( function( dataName ) { 1259 return function( elem ) { 1260 return !!$.data( elem, dataName ); 1261 }; 1262 } ) : 1263 1264 // Support: jQuery <1.8 1265 function( elem, i, match ) { 1266 return !!$.data( elem, match[ 3 ] ); 1267 } 1268} ); 1269 1270/*! 1271 * jQuery UI Disable Selection 1.12.0 1272 * http://jqueryui.com 1273 * 1274 * Copyright jQuery Foundation and other contributors 1275 * Released under the MIT license. 1276 * http://jquery.org/license 1277 */ 1278 1279//>>label: disableSelection 1280//>>group: Core 1281//>>description: Disable selection of text content within the set of matched elements. 1282//>>docs: http://api.jqueryui.com/disableSelection/ 1283 1284// This file is deprecated 1285 1286 1287var disableSelection = $.fn.extend( { 1288 disableSelection: ( function() { 1289 var eventType = "onselectstart" in document.createElement( "div" ) ? 1290 "selectstart" : 1291 "mousedown"; 1292 1293 return function() { 1294 return this.on( eventType + ".ui-disableSelection", function( event ) { 1295 event.preventDefault(); 1296 } ); 1297 }; 1298 } )(), 1299 1300 enableSelection: function() { 1301 return this.off( ".ui-disableSelection" ); 1302 } 1303} ); 1304 1305 1306/*! 1307 * jQuery UI Effects 1.12.0 1308 * http://jqueryui.com 1309 * 1310 * Copyright jQuery Foundation and other contributors 1311 * Released under the MIT license. 1312 * http://jquery.org/license 1313 */ 1314 1315//>>label: Effects Core 1316//>>group: Effects 1317// jscs:disable maximumLineLength 1318//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 1319// jscs:enable maximumLineLength 1320//>>docs: http://api.jqueryui.com/category/effects-core/ 1321//>>demos: http://jqueryui.com/effect/ 1322 1323 1324 1325var dataSpace = "ui-effects-", 1326 dataSpaceStyle = "ui-effects-style", 1327 dataSpaceAnimated = "ui-effects-animated", 1328 1329 // Create a local jQuery because jQuery Color relies on it and the 1330 // global may not exist with AMD and a custom build (#10199) 1331 jQuery = $; 1332 1333$.effects = { 1334 effect: {} 1335}; 1336 1337/*! 1338 * jQuery Color Animations v2.1.2 1339 * https://github.com/jquery/jquery-color 1340 * 1341 * Copyright 2014 jQuery Foundation and other contributors 1342 * Released under the MIT license. 1343 * http://jquery.org/license 1344 * 1345 * Date: Wed Jan 16 08:47:09 2013 -0600 1346 */ 1347( function( jQuery, undefined ) { 1348 1349 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1350 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1351 1352 // Plusequals test for += 100 -= 100 1353 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1354 1355 // A set of RE's that can match strings and generate color tuples. 1356 stringParsers = [ { 1357 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1358 parse: function( execResult ) { 1359 return [ 1360 execResult[ 1 ], 1361 execResult[ 2 ], 1362 execResult[ 3 ], 1363 execResult[ 4 ] 1364 ]; 1365 } 1366 }, { 1367 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1368 parse: function( execResult ) { 1369 return [ 1370 execResult[ 1 ] * 2.55, 1371 execResult[ 2 ] * 2.55, 1372 execResult[ 3 ] * 2.55, 1373 execResult[ 4 ] 1374 ]; 1375 } 1376 }, { 1377 1378 // This regex ignores A-F because it's compared against an already lowercased string 1379 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 1380 parse: function( execResult ) { 1381 return [ 1382 parseInt( execResult[ 1 ], 16 ), 1383 parseInt( execResult[ 2 ], 16 ), 1384 parseInt( execResult[ 3 ], 16 ) 1385 ]; 1386 } 1387 }, { 1388 1389 // This regex ignores A-F because it's compared against an already lowercased string 1390 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 1391 parse: function( execResult ) { 1392 return [ 1393 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 1394 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 1395 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) 1396 ]; 1397 } 1398 }, { 1399 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1400 space: "hsla", 1401 parse: function( execResult ) { 1402 return [ 1403 execResult[ 1 ], 1404 execResult[ 2 ] / 100, 1405 execResult[ 3 ] / 100, 1406 execResult[ 4 ] 1407 ]; 1408 } 1409 } ], 1410 1411 // JQuery.Color( ) 1412 color = jQuery.Color = function( color, green, blue, alpha ) { 1413 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 1414 }, 1415 spaces = { 1416 rgba: { 1417 props: { 1418 red: { 1419 idx: 0, 1420 type: "byte" 1421 }, 1422 green: { 1423 idx: 1, 1424 type: "byte" 1425 }, 1426 blue: { 1427 idx: 2, 1428 type: "byte" 1429 } 1430 } 1431 }, 1432 1433 hsla: { 1434 props: { 1435 hue: { 1436 idx: 0, 1437 type: "degrees" 1438 }, 1439 saturation: { 1440 idx: 1, 1441 type: "percent" 1442 }, 1443 lightness: { 1444 idx: 2, 1445 type: "percent" 1446 } 1447 } 1448 } 1449 },
vendor: 18,301 bytes, lines 1450-2172
1450 propTypes = { 1451 "byte": { 1452 floor: true, 1453 max: 255 1454 }, 1455 "percent": { 1456 max: 1 1457 }, 1458 "degrees": { 1459 mod: 360, 1460 floor: true 1461 } 1462 }, 1463 support = color.support = {}, 1464 1465 // Element for support tests 1466 supportElem = jQuery( "<p>" )[ 0 ], 1467 1468 // Colors = jQuery.Color.names 1469 colors, 1470 1471 // Local aliases of functions called often 1472 each = jQuery.each; 1473 1474// Determine rgba support immediately 1475supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1476support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 1477 1478// Define cache name and alpha properties 1479// for rgba and hsla spaces 1480each( spaces, function( spaceName, space ) { 1481 space.cache = "_" + spaceName; 1482 space.props.alpha = { 1483 idx: 3, 1484 type: "percent", 1485 def: 1 1486 }; 1487} ); 1488 1489function clamp( value, prop, allowEmpty ) { 1490 var type = propTypes[ prop.type ] || {}; 1491 1492 if ( value == null ) { 1493 return ( allowEmpty || !prop.def ) ? null : prop.def; 1494 } 1495 1496 // ~~ is an short way of doing floor for positive numbers 1497 value = type.floor ? ~~value : parseFloat( value ); 1498 1499 // IE will pass in empty strings as value for alpha, 1500 // which will hit this case 1501 if ( isNaN( value ) ) { 1502 return prop.def; 1503 } 1504 1505 if ( type.mod ) { 1506 1507 // We add mod before modding to make sure that negatives values 1508 // get converted properly: -10 -> 350 1509 return ( value + type.mod ) % type.mod; 1510 } 1511 1512 // For now all property types without mod have min and max 1513 return 0 > value ? 0 : type.max < value ? type.max : value; 1514} 1515 1516function stringParse( string ) { 1517 var inst = color(), 1518 rgba = inst._rgba = []; 1519 1520 string = string.toLowerCase(); 1521 1522 each( stringParsers, function( i, parser ) { 1523 var parsed, 1524 match = parser.re.exec( string ), 1525 values = match && parser.parse( match ), 1526 spaceName = parser.space || "rgba"; 1527 1528 if ( values ) { 1529 parsed = inst[ spaceName ]( values ); 1530 1531 // If this was an rgba parse the assignment might happen twice 1532 // oh well.... 1533 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 1534 rgba = inst._rgba = parsed._rgba; 1535 1536 // Exit each( stringParsers ) here because we matched 1537 return false; 1538 } 1539 } ); 1540 1541 // Found a stringParser that handled it 1542 if ( rgba.length ) { 1543 1544 // If this came from a parsed string, force "transparent" when alpha is 0 1545 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 1546 if ( rgba.join() === "0,0,0,0" ) { 1547 jQuery.extend( rgba, colors.transparent ); 1548 } 1549 return inst; 1550 } 1551 1552 // Named colors 1553 return colors[ string ]; 1554} 1555 1556color.fn = jQuery.extend( color.prototype, { 1557 parse: function( red, green, blue, alpha ) { 1558 if ( red === undefined ) { 1559 this._rgba = [ null, null, null, null ]; 1560 return this; 1561 } 1562 if ( red.jquery || red.nodeType ) { 1563 red = jQuery( red ).css( green ); 1564 green = undefined; 1565 } 1566 1567 var inst = this, 1568 type = jQuery.type( red ), 1569 rgba = this._rgba = []; 1570 1571 // More than 1 argument specified - assume ( red, green, blue, alpha ) 1572 if ( green !== undefined ) { 1573 red = [ red, green, blue, alpha ]; 1574 type = "array"; 1575 } 1576 1577 if ( type === "string" ) { 1578 return this.parse( stringParse( red ) || colors._default ); 1579 } 1580 1581 if ( type === "array" ) { 1582 each( spaces.rgba.props, function( key, prop ) { 1583 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 1584 } ); 1585 return this; 1586 } 1587 1588 if ( type === "object" ) { 1589 if ( red instanceof color ) { 1590 each( spaces, function( spaceName, space ) { 1591 if ( red[ space.cache ] ) { 1592 inst[ space.cache ] = red[ space.cache ].slice(); 1593 } 1594 } ); 1595 } else { 1596 each( spaces, function( spaceName, space ) { 1597 var cache = space.cache; 1598 each( space.props, function( key, prop ) { 1599 1600 // If the cache doesn't exist, and we know how to convert 1601 if ( !inst[ cache ] && space.to ) { 1602 1603 // If the value was null, we don't need to copy it 1604 // if the key was alpha, we don't need to copy it either 1605 if ( key === "alpha" || red[ key ] == null ) { 1606 return; 1607 } 1608 inst[ cache ] = space.to( inst._rgba ); 1609 } 1610 1611 // This is the only case where we allow nulls for ALL properties. 1612 // call clamp with alwaysAllowEmpty 1613 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 1614 } ); 1615 1616 // Everything defined but alpha? 1617 if ( inst[ cache ] && 1618 jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 1619 1620 // Use the default of 1 1621 inst[ cache ][ 3 ] = 1; 1622 if ( space.from ) { 1623 inst._rgba = space.from( inst[ cache ] ); 1624 } 1625 } 1626 } ); 1627 } 1628 return this; 1629 } 1630 }, 1631 is: function( compare ) { 1632 var is = color( compare ), 1633 same = true, 1634 inst = this; 1635 1636 each( spaces, function( _, space ) { 1637 var localCache, 1638 isCache = is[ space.cache ]; 1639 if ( isCache ) { 1640 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 1641 each( space.props, function( _, prop ) { 1642 if ( isCache[ prop.idx ] != null ) { 1643 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 1644 return same; 1645 } 1646 } ); 1647 } 1648 return same; 1649 } ); 1650 return same; 1651 }, 1652 _space: function() { 1653 var used = [], 1654 inst = this; 1655 each( spaces, function( spaceName, space ) { 1656 if ( inst[ space.cache ] ) { 1657 used.push( spaceName ); 1658 } 1659 } ); 1660 return used.pop(); 1661 }, 1662 transition: function( other, distance ) { 1663 var end = color( other ), 1664 spaceName = end._space(), 1665 space = spaces[ spaceName ], 1666 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 1667 start = startColor[ space.cache ] || space.to( startColor._rgba ), 1668 result = start.slice(); 1669 1670 end = end[ space.cache ]; 1671 each( space.props, function( key, prop ) { 1672 var index = prop.idx, 1673 startValue = start[ index ], 1674 endValue = end[ index ], 1675 type = propTypes[ prop.type ] || {}; 1676 1677 // If null, don't override start value 1678 if ( endValue === null ) { 1679 return; 1680 } 1681 1682 // If null - use end 1683 if ( startValue === null ) { 1684 result[ index ] = endValue; 1685 } else { 1686 if ( type.mod ) { 1687 if ( endValue - startValue > type.mod / 2 ) { 1688 startValue += type.mod; 1689 } else if ( startValue - endValue > type.mod / 2 ) { 1690 startValue -= type.mod; 1691 } 1692 } 1693 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 1694 } 1695 } ); 1696 return this[ spaceName ]( result ); 1697 }, 1698 blend: function( opaque ) { 1699 1700 // If we are already opaque - return ourself 1701 if ( this._rgba[ 3 ] === 1 ) { 1702 return this; 1703 } 1704 1705 var rgb = this._rgba.slice(), 1706 a = rgb.pop(), 1707 blend = color( opaque )._rgba; 1708 1709 return color( jQuery.map( rgb, function( v, i ) { 1710 return ( 1 - a ) * blend[ i ] + a * v; 1711 } ) ); 1712 }, 1713 toRgbaString: function() { 1714 var prefix = "rgba(", 1715 rgba = jQuery.map( this._rgba, function( v, i ) { 1716 return v == null ? ( i > 2 ? 1 : 0 ) : v; 1717 } ); 1718 1719 if ( rgba[ 3 ] === 1 ) { 1720 rgba.pop(); 1721 prefix = "rgb("; 1722 } 1723 1724 return prefix + rgba.join() + ")"; 1725 }, 1726 toHslaString: function() { 1727 var prefix = "hsla(", 1728 hsla = jQuery.map( this.hsla(), function( v, i ) { 1729 if ( v == null ) { 1730 v = i > 2 ? 1 : 0; 1731 } 1732 1733 // Catch 1 and 2 1734 if ( i && i < 3 ) { 1735 v = Math.round( v * 100 ) + "%"; 1736 } 1737 return v; 1738 } ); 1739 1740 if ( hsla[ 3 ] === 1 ) { 1741 hsla.pop(); 1742 prefix = "hsl("; 1743 } 1744 return prefix + hsla.join() + ")"; 1745 }, 1746 toHexString: function( includeAlpha ) { 1747 var rgba = this._rgba.slice(), 1748 alpha = rgba.pop(); 1749 1750 if ( includeAlpha ) { 1751 rgba.push( ~~( alpha * 255 ) ); 1752 } 1753 1754 return "#" + jQuery.map( rgba, function( v ) { 1755 1756 // Default to 0 when nulls exist 1757 v = ( v || 0 ).toString( 16 ); 1758 return v.length === 1 ? "0" + v : v; 1759 } ).join( "" ); 1760 }, 1761 toString: function() { 1762 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 1763 } 1764} ); 1765color.fn.parse.prototype = color.fn; 1766 1767// Hsla conversions adapted from: 1768// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 1769 1770function hue2rgb( p, q, h ) { 1771 h = ( h + 1 ) % 1; 1772 if ( h * 6 < 1 ) { 1773 return p + ( q - p ) * h * 6; 1774 } 1775 if ( h * 2 < 1 ) { 1776 return q; 1777 } 1778 if ( h * 3 < 2 ) { 1779 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 1780 } 1781 return p; 1782} 1783 1784spaces.hsla.to = function( rgba ) { 1785 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 1786 return [ null, null, null, rgba[ 3 ] ]; 1787 } 1788 var r = rgba[ 0 ] / 255, 1789 g = rgba[ 1 ] / 255, 1790 b = rgba[ 2 ] / 255, 1791 a = rgba[ 3 ], 1792 max = Math.max( r, g, b ), 1793 min = Math.min( r, g, b ), 1794 diff = max - min, 1795 add = max + min, 1796 l = add * 0.5, 1797 h, s; 1798 1799 if ( min === max ) { 1800 h = 0; 1801 } else if ( r === max ) { 1802 h = ( 60 * ( g - b ) / diff ) + 360; 1803 } else if ( g === max ) { 1804 h = ( 60 * ( b - r ) / diff ) + 120; 1805 } else { 1806 h = ( 60 * ( r - g ) / diff ) + 240; 1807 } 1808 1809 // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 1810 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 1811 if ( diff === 0 ) { 1812 s = 0; 1813 } else if ( l <= 0.5 ) { 1814 s = diff / add; 1815 } else { 1816 s = diff / ( 2 - add ); 1817 } 1818 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 1819}; 1820 1821spaces.hsla.from = function( hsla ) { 1822 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 1823 return [ null, null, null, hsla[ 3 ] ]; 1824 } 1825 var h = hsla[ 0 ] / 360, 1826 s = hsla[ 1 ], 1827 l = hsla[ 2 ], 1828 a = hsla[ 3 ], 1829 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 1830 p = 2 * l - q; 1831 1832 return [ 1833 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 1834 Math.round( hue2rgb( p, q, h ) * 255 ), 1835 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 1836 a 1837 ]; 1838}; 1839 1840each( spaces, function( spaceName, space ) { 1841 var props = space.props, 1842 cache = space.cache, 1843 to = space.to, 1844 from = space.from; 1845 1846 // Makes rgba() and hsla() 1847 color.fn[ spaceName ] = function( value ) { 1848 1849 // Generate a cache for this space if it doesn't exist 1850 if ( to && !this[ cache ] ) { 1851 this[ cache ] = to( this._rgba ); 1852 } 1853 if ( value === undefined ) { 1854 return this[ cache ].slice(); 1855 } 1856 1857 var ret, 1858 type = jQuery.type( value ), 1859 arr = ( type === "array" || type === "object" ) ? value : arguments, 1860 local = this[ cache ].slice(); 1861 1862 each( props, function( key, prop ) { 1863 var val = arr[ type === "object" ? key : prop.idx ]; 1864 if ( val == null ) { 1865 val = local[ prop.idx ]; 1866 } 1867 local[ prop.idx ] = clamp( val, prop ); 1868 } ); 1869 1870 if ( from ) { 1871 ret = color( from( local ) ); 1872 ret[ cache ] = local; 1873 return ret; 1874 } else { 1875 return color( local ); 1876 } 1877 }; 1878 1879 // Makes red() green() blue() alpha() hue() saturation() lightness() 1880 each( props, function( key, prop ) { 1881 1882 // Alpha is included in more than one space 1883 if ( color.fn[ key ] ) { 1884 return; 1885 } 1886 color.fn[ key ] = function( value ) { 1887 var vtype = jQuery.type( value ), 1888 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), 1889 local = this[ fn ](), 1890 cur = local[ prop.idx ], 1891 match; 1892 1893 if ( vtype === "undefined" ) { 1894 return cur; 1895 } 1896 1897 if ( vtype === "function" ) { 1898 value = value.call( this, cur ); 1899 vtype = jQuery.type( value ); 1900 } 1901 if ( value == null && prop.empty ) { 1902 return this; 1903 } 1904 if ( vtype === "string" ) { 1905 match = rplusequals.exec( value ); 1906 if ( match ) { 1907 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 1908 } 1909 } 1910 local[ prop.idx ] = value; 1911 return this[ fn ]( local ); 1912 }; 1913 } ); 1914} ); 1915 1916// Add cssHook and .fx.step function for each named hook. 1917// accept a space separated string of properties 1918color.hook = function( hook ) { 1919 var hooks = hook.split( " " ); 1920 each( hooks, function( i, hook ) { 1921 jQuery.cssHooks[ hook ] = { 1922 set: function( elem, value ) { 1923 var parsed, curElem, 1924 backgroundColor = ""; 1925 1926 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || 1927 ( parsed = stringParse( value ) ) ) ) { 1928 value = color( parsed || value ); 1929 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 1930 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 1931 while ( 1932 ( backgroundColor === "" || backgroundColor === "transparent" ) && 1933 curElem && curElem.style 1934 ) { 1935 try { 1936 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 1937 curElem = curElem.parentNode; 1938 } catch ( e ) { 1939 } 1940 } 1941 1942 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 1943 backgroundColor : 1944 "_default" ); 1945 } 1946 1947 value = value.toRgbaString(); 1948 } 1949 try { 1950 elem.style[ hook ] = value; 1951 } catch ( e ) { 1952 1953 // Wrapped to prevent IE from throwing errors on "invalid" values like 1954 // 'auto' or 'inherit' 1955 } 1956 } 1957 }; 1958 jQuery.fx.step[ hook ] = function( fx ) { 1959 if ( !fx.colorInit ) { 1960 fx.start = color( fx.elem, hook ); 1961 fx.end = color( fx.end ); 1962 fx.colorInit = true; 1963 } 1964 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 1965 }; 1966 } ); 1967 1968}; 1969 1970color.hook( stepHooks ); 1971 1972jQuery.cssHooks.borderColor = { 1973 expand: function( value ) { 1974 var expanded = {}; 1975 1976 each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { 1977 expanded[ "border" + part + "Color" ] = value; 1978 } ); 1979 return expanded; 1980 } 1981}; 1982 1983// Basic color names only. 1984// Usage of any of the other color names requires adding yourself or including 1985// jquery.color.svg-names.js. 1986colors = jQuery.Color.names = { 1987 1988 // 4.1. Basic color keywords 1989 aqua: "#00ffff", 1990 black: "#000000", 1991 blue: "#0000ff", 1992 fuchsia: "#ff00ff", 1993 gray: "#808080", 1994 green: "#008000", 1995 lime: "#00ff00", 1996 maroon: "#800000", 1997 navy: "#000080", 1998 olive: "#808000", 1999 purple: "#800080", 2000 red: "#ff0000", 2001 silver: "#c0c0c0", 2002 teal: "#008080", 2003 white: "#ffffff", 2004 yellow: "#ffff00", 2005 2006 // 4.2.3. "transparent" color keyword 2007 transparent: [ null, null, null, 0 ], 2008 2009 _default: "#ffffff" 2010}; 2011 2012} )( jQuery ); 2013 2014/******************************************************************************/ 2015/****************************** CLASS ANIMATIONS ******************************/ 2016/******************************************************************************/ 2017( function() { 2018 2019var classAnimationActions = [ "add", "remove", "toggle" ], 2020 shorthandStyles = { 2021 border: 1, 2022 borderBottom: 1, 2023 borderColor: 1, 2024 borderLeft: 1, 2025 borderRight: 1, 2026 borderTop: 1, 2027 borderWidth: 1, 2028 margin: 1, 2029 padding: 1 2030 }; 2031 2032$.each( 2033 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 2034 function( _, prop ) { 2035 $.fx.step[ prop ] = function( fx ) { 2036 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 2037 jQuery.style( fx.elem, prop, fx.end ); 2038 fx.setAttr = true; 2039 } 2040 }; 2041 } 2042); 2043 2044function getElementStyles( elem ) { 2045 var key, len, 2046 style = elem.ownerDocument.defaultView ? 2047 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 2048 elem.currentStyle, 2049 styles = {}; 2050 2051 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 2052 len = style.length; 2053 while ( len-- ) { 2054 key = style[ len ]; 2055 if ( typeof style[ key ] === "string" ) { 2056 styles[ $.camelCase( key ) ] = style[ key ]; 2057 } 2058 } 2059 2060 // Support: Opera, IE <9 2061 } else { 2062 for ( key in style ) { 2063 if ( typeof style[ key ] === "string" ) { 2064 styles[ key ] = style[ key ]; 2065 } 2066 } 2067 } 2068 2069 return styles; 2070} 2071 2072function styleDifference( oldStyle, newStyle ) { 2073 var diff = {}, 2074 name, value; 2075 2076 for ( name in newStyle ) { 2077 value = newStyle[ name ]; 2078 if ( oldStyle[ name ] !== value ) { 2079 if ( !shorthandStyles[ name ] ) { 2080 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 2081 diff[ name ] = value; 2082 } 2083 } 2084 } 2085 } 2086 2087 return diff; 2088} 2089 2090// Support: jQuery <1.8 2091if ( !$.fn.addBack ) { 2092 $.fn.addBack = function( selector ) { 2093 return this.add( selector == null ? 2094 this.prevObject : this.prevObject.filter( selector ) 2095 ); 2096 }; 2097} 2098 2099$.effects.animateClass = function( value, duration, easing, callback ) { 2100 var o = $.speed( duration, easing, callback ); 2101 2102 return this.queue( function() { 2103 var animated = $( this ), 2104 baseClass = animated.attr( "class" ) || "", 2105 applyClassChange, 2106 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 2107 2108 // Map the animated objects to store the original styles. 2109 allAnimations = allAnimations.map( function() { 2110 var el = $( this ); 2111 return { 2112 el: el, 2113 start: getElementStyles( this ) 2114 }; 2115 } ); 2116 2117 // Apply class change 2118 applyClassChange = function() { 2119 $.each( classAnimationActions, function( i, action ) { 2120 if ( value[ action ] ) { 2121 animated[ action + "Class" ]( value[ action ] ); 2122 } 2123 } ); 2124 }; 2125 applyClassChange(); 2126 2127 // Map all animated objects again - calculate new styles and diff 2128 allAnimations = allAnimations.map( function() { 2129 this.end = getElementStyles( this.el[ 0 ] ); 2130 this.diff = styleDifference( this.start, this.end ); 2131 return this; 2132 } ); 2133 2134 // Apply original class 2135 animated.attr( "class", baseClass ); 2136 2137 // Map all animated objects again - this time collecting a promise 2138 allAnimations = allAnimations.map( function() { 2139 var styleInfo = this, 2140 dfd = $.Deferred(), 2141 opts = $.extend( {}, o, { 2142 queue: false, 2143 complete: function() { 2144 dfd.resolve( styleInfo ); 2145 } 2146 } ); 2147 2148 this.el.animate( this.diff, opts ); 2149 return dfd.promise(); 2150 } ); 2151 2152 // Once all animations have completed: 2153 $.when.apply( $, allAnimations.get() ).done( function() { 2154 2155 // Set the final class 2156 applyClassChange(); 2157 2158 // For each animated element, 2159 // clear all css properties that were animated 2160 $.each( arguments, function() { 2161 var el = this.el; 2162 $.each( this.diff, function( key ) { 2163 el.css( key, "" ); 2164 } ); 2165 } ); 2166 2167 // This is guarnteed to be there if you use jQuery.speed() 2168 // it also handles dequeuing the next anim... 2169 o.complete.call( animated[ 0 ] ); 2170 } ); 2171 } ); 2172};
vendor: 5,123 bytes, lines 2173-2353
2173 2174$.fn.extend( { 2175 addClass: ( function( orig ) { 2176 return function( classNames, speed, easing, callback ) { 2177 return speed ? 2178 $.effects.animateClass.call( this, 2179 { add: classNames }, speed, easing, callback ) : 2180 orig.apply( this, arguments ); 2181 }; 2182 } )( $.fn.addClass ), 2183 2184 removeClass: ( function( orig ) { 2185 return function( classNames, speed, easing, callback ) { 2186 return arguments.length > 1 ? 2187 $.effects.animateClass.call( this, 2188 { remove: classNames }, speed, easing, callback ) : 2189 orig.apply( this, arguments ); 2190 }; 2191 } )( $.fn.removeClass ), 2192 2193 toggleClass: ( function( orig ) { 2194 return function( classNames, force, speed, easing, callback ) { 2195 if ( typeof force === "boolean" || force === undefined ) { 2196 if ( !speed ) { 2197 2198 // Without speed parameter 2199 return orig.apply( this, arguments ); 2200 } else { 2201 return $.effects.animateClass.call( this, 2202 ( force ? { add: classNames } : { remove: classNames } ), 2203 speed, easing, callback ); 2204 } 2205 } else { 2206 2207 // Without force parameter 2208 return $.effects.animateClass.call( this, 2209 { toggle: classNames }, force, speed, easing ); 2210 } 2211 }; 2212 } )( $.fn.toggleClass ), 2213 2214 switchClass: function( remove, add, speed, easing, callback ) { 2215 return $.effects.animateClass.call( this, { 2216 add: add, 2217 remove: remove 2218 }, speed, easing, callback ); 2219 } 2220} ); 2221 2222} )(); 2223 2224/******************************************************************************/ 2225/*********************************** EFFECTS **********************************/ 2226/******************************************************************************/ 2227 2228( function() { 2229 2230if ( $.expr && $.expr.filters && $.expr.filters.animated ) { 2231 $.expr.filters.animated = ( function( orig ) { 2232 return function( elem ) { 2233 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 2234 }; 2235 } )( $.expr.filters.animated ); 2236} 2237 2238if ( $.uiBackCompat !== false ) { 2239 $.extend( $.effects, { 2240 2241 // Saves a set of properties in a data storage 2242 save: function( element, set ) { 2243 var i = 0, length = set.length; 2244 for ( ; i < length; i++ ) { 2245 if ( set[ i ] !== null ) { 2246 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 2247 } 2248 } 2249 }, 2250 2251 // Restores a set of previously saved properties from a data storage 2252 restore: function( element, set ) { 2253 var val, i = 0, length = set.length; 2254 for ( ; i < length; i++ ) { 2255 if ( set[ i ] !== null ) { 2256 val = element.data( dataSpace + set[ i ] ); 2257 element.css( set[ i ], val ); 2258 } 2259 } 2260 }, 2261 2262 setMode: function( el, mode ) { 2263 if ( mode === "toggle" ) { 2264 mode = el.is( ":hidden" ) ? "show" : "hide"; 2265 } 2266 return mode; 2267 }, 2268 2269 // Wraps the element around a wrapper that copies position properties 2270 createWrapper: function( element ) { 2271 2272 // If the element is already wrapped, return it 2273 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2274 return element.parent(); 2275 } 2276 2277 // Wrap the element 2278 var props = { 2279 width: element.outerWidth( true ), 2280 height: element.outerHeight( true ), 2281 "float": element.css( "float" ) 2282 }, 2283 wrapper = $( "<div></div>" ) 2284 .addClass( "ui-effects-wrapper" ) 2285 .css( { 2286 fontSize: "100%", 2287 background: "transparent", 2288 border: "none", 2289 margin: 0, 2290 padding: 0 2291 } ), 2292 2293 // Store the size in case width/height are defined in % - Fixes #5245 2294 size = { 2295 width: element.width(), 2296 height: element.height() 2297 }, 2298 active = document.activeElement; 2299 2300 // Support: Firefox 2301 // Firefox incorrectly exposes anonymous content 2302 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2303 try { 2304 active.id; 2305 } catch ( e ) { 2306 active = document.body; 2307 } 2308 2309 element.wrap( wrapper ); 2310 2311 // Fixes #7595 - Elements lose focus when wrapped. 2312 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2313 $( active ).trigger( "focus" ); 2314 } 2315 2316 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2317 // lose the reference to the wrapped element 2318 wrapper = element.parent(); 2319 2320 // Transfer positioning properties to the wrapper 2321 if ( element.css( "position" ) === "static" ) { 2322 wrapper.css( { position: "relative" } ); 2323 element.css( { position: "relative" } ); 2324 } else { 2325 $.extend( props, { 2326 position: element.css( "position" ), 2327 zIndex: element.css( "z-index" ) 2328 } ); 2329 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 2330 props[ pos ] = element.css( pos ); 2331 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 2332 props[ pos ] = "auto"; 2333 } 2334 } ); 2335 element.css( { 2336 position: "relative", 2337 top: 0, 2338 left: 0, 2339 right: "auto", 2340 bottom: "auto" 2341 } ); 2342 } 2343 element.css( size ); 2344 2345 return wrapper.css( props ).show(); 2346 }, 2347 2348 removeWrapper: function( element ) { 2349 var active = document.activeElement; 2350 2351 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2352 element.parent().replaceWith( element ); 2353
vendor: 16,572 bytes, lines 2354-2990
2354 // Fixes #7595 - Elements lose focus when wrapped. 2355 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2356 $( active ).trigger( "focus" ); 2357 } 2358 } 2359 2360 return element; 2361 } 2362 } ); 2363} 2364 2365$.extend( $.effects, { 2366 version: "1.12.0", 2367 2368 define: function( name, mode, effect ) { 2369 if ( !effect ) { 2370 effect = mode; 2371 mode = "effect"; 2372 } 2373 2374 $.effects.effect[ name ] = effect; 2375 $.effects.effect[ name ].mode = mode; 2376 2377 return effect; 2378 }, 2379 2380 scaledDimensions: function( element, percent, direction ) { 2381 if ( percent === 0 ) { 2382 return { 2383 height: 0, 2384 width: 0, 2385 outerHeight: 0, 2386 outerWidth: 0 2387 }; 2388 } 2389 2390 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 2391 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 2392 2393 return { 2394 height: element.height() * y, 2395 width: element.width() * x, 2396 outerHeight: element.outerHeight() * y, 2397 outerWidth: element.outerWidth() * x 2398 }; 2399 2400 }, 2401 2402 clipToBox: function( animation ) { 2403 return { 2404 width: animation.clip.right - animation.clip.left, 2405 height: animation.clip.bottom - animation.clip.top, 2406 left: animation.clip.left, 2407 top: animation.clip.top 2408 }; 2409 }, 2410 2411 // Injects recently queued functions to be first in line (after "inprogress") 2412 unshift: function( element, queueLength, count ) { 2413 var queue = element.queue(); 2414 2415 if ( queueLength > 1 ) { 2416 queue.splice.apply( queue, 2417 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 2418 } 2419 element.dequeue(); 2420 }, 2421 2422 saveStyle: function( element ) { 2423 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 2424 }, 2425 2426 restoreStyle: function( element ) { 2427 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 2428 element.removeData( dataSpaceStyle ); 2429 }, 2430 2431 mode: function( element, mode ) { 2432 var hidden = element.is( ":hidden" ); 2433 2434 if ( mode === "toggle" ) { 2435 mode = hidden ? "show" : "hide"; 2436 } 2437 if ( hidden ? mode === "hide" : mode === "show" ) { 2438 mode = "none"; 2439 } 2440 return mode; 2441 }, 2442 2443 // Translates a [top,left] array into a baseline value 2444 getBaseline: function( origin, original ) { 2445 var y, x; 2446 2447 switch ( origin[ 0 ] ) { 2448 case "top": 2449 y = 0; 2450 break; 2451 case "middle": 2452 y = 0.5; 2453 break; 2454 case "bottom": 2455 y = 1; 2456 break; 2457 default: 2458 y = origin[ 0 ] / original.height; 2459 } 2460 2461 switch ( origin[ 1 ] ) { 2462 case "left": 2463 x = 0; 2464 break; 2465 case "center": 2466 x = 0.5; 2467 break; 2468 case "right": 2469 x = 1; 2470 break; 2471 default: 2472 x = origin[ 1 ] / original.width; 2473 } 2474 2475 return { 2476 x: x, 2477 y: y 2478 }; 2479 }, 2480 2481 // Creates a placeholder element so that the original element can be made absolute 2482 createPlaceholder: function( element ) { 2483 var placeholder, 2484 cssPosition = element.css( "position" ), 2485 position = element.position(); 2486 2487 // Lock in margins first to account for form elements, which 2488 // will change margin if you explicitly set height 2489 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 2490 // Support: Safari 2491 element.css( { 2492 marginTop: element.css( "marginTop" ), 2493 marginBottom: element.css( "marginBottom" ), 2494 marginLeft: element.css( "marginLeft" ), 2495 marginRight: element.css( "marginRight" ) 2496 } ) 2497 .outerWidth( element.outerWidth() ) 2498 .outerHeight( element.outerHeight() ); 2499 2500 if ( /^(static|relative)/.test( cssPosition ) ) { 2501 cssPosition = "absolute"; 2502 2503 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 2504 2505 // Convert inline to inline block to account for inline elements 2506 // that turn to inline block based on content (like img) 2507 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 2508 "inline-block" : 2509 "block", 2510 visibility: "hidden", 2511 2512 // Margins need to be set to account for margin collapse 2513 marginTop: element.css( "marginTop" ), 2514 marginBottom: element.css( "marginBottom" ), 2515 marginLeft: element.css( "marginLeft" ), 2516 marginRight: element.css( "marginRight" ), 2517 "float": element.css( "float" ) 2518 } ) 2519 .outerWidth( element.outerWidth() ) 2520 .outerHeight( element.outerHeight() ) 2521 .addClass( "ui-effects-placeholder" ); 2522 2523 element.data( dataSpace + "placeholder", placeholder ); 2524 } 2525 2526 element.css( { 2527 position: cssPosition, 2528 left: position.left, 2529 top: position.top 2530 } ); 2531 2532 return placeholder; 2533 }, 2534 2535 removePlaceholder: function( element ) { 2536 var dataKey = dataSpace + "placeholder", 2537 placeholder = element.data( dataKey ); 2538 2539 if ( placeholder ) { 2540 placeholder.remove(); 2541 element.removeData( dataKey ); 2542 } 2543 }, 2544 2545 // Removes a placeholder if it exists and restores 2546 // properties that were modified during placeholder creation 2547 cleanUp: function( element ) { 2548 $.effects.restoreStyle( element ); 2549 $.effects.removePlaceholder( element ); 2550 }, 2551 2552 setTransition: function( element, list, factor, value ) { 2553 value = value || {}; 2554 $.each( list, function( i, x ) { 2555 var unit = element.cssUnit( x ); 2556 if ( unit[ 0 ] > 0 ) { 2557 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 2558 } 2559 } ); 2560 return value; 2561 } 2562} ); 2563 2564// Return an effect options object for the given parameters: 2565function _normalizeArguments( effect, options, speed, callback ) { 2566 2567 // Allow passing all options as the first parameter 2568 if ( $.isPlainObject( effect ) ) { 2569 options = effect; 2570 effect = effect.effect; 2571 } 2572 2573 // Convert to an object 2574 effect = { effect: effect }; 2575 2576 // Catch (effect, null, ...) 2577 if ( options == null ) { 2578 options = {}; 2579 } 2580 2581 // Catch (effect, callback) 2582 if ( $.isFunction( options ) ) { 2583 callback = options; 2584 speed = null; 2585 options = {}; 2586 } 2587 2588 // Catch (effect, speed, ?) 2589 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 2590 callback = speed; 2591 speed = options; 2592 options = {}; 2593 } 2594 2595 // Catch (effect, options, callback) 2596 if ( $.isFunction( speed ) ) { 2597 callback = speed; 2598 speed = null; 2599 } 2600 2601 // Add options to effect 2602 if ( options ) { 2603 $.extend( effect, options ); 2604 } 2605 2606 speed = speed || options.duration; 2607 effect.duration = $.fx.off ? 0 : 2608 typeof speed === "number" ? speed : 2609 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 2610 $.fx.speeds._default; 2611 2612 effect.complete = callback || options.complete; 2613 2614 return effect; 2615} 2616 2617function standardAnimationOption( option ) { 2618 2619 // Valid standard speeds (nothing, number, named speed) 2620 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 2621 return true; 2622 } 2623 2624 // Invalid strings - treat as "normal" speed 2625 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 2626 return true; 2627 } 2628 2629 // Complete callback 2630 if ( $.isFunction( option ) ) { 2631 return true; 2632 } 2633 2634 // Options hash (but not naming an effect) 2635 if ( typeof option === "object" && !option.effect ) { 2636 return true; 2637 } 2638 2639 // Didn't match any standard API 2640 return false; 2641} 2642 2643$.fn.extend( { 2644 effect: function( /* effect, options, speed, callback */ ) { 2645 var args = _normalizeArguments.apply( this, arguments ), 2646 effectMethod = $.effects.effect[ args.effect ], 2647 defaultMode = effectMethod.mode, 2648 queue = args.queue, 2649 queueName = queue || "fx", 2650 complete = args.complete, 2651 mode = args.mode, 2652 modes = [], 2653 prefilter = function( next ) { 2654 var el = $( this ), 2655 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 2656 2657 // Sentinel for duck-punching the :animated psuedo-selector 2658 el.data( dataSpaceAnimated, true ); 2659 2660 // Save effect mode for later use, 2661 // we can't just call $.effects.mode again later, 2662 // as the .show() below destroys the initial state 2663 modes.push( normalizedMode ); 2664 2665 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 2666 if ( defaultMode && ( normalizedMode === "show" || 2667 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 2668 el.show(); 2669 } 2670 2671 if ( !defaultMode || normalizedMode !== "none" ) { 2672 $.effects.saveStyle( el ); 2673 } 2674 2675 if ( $.isFunction( next ) ) { 2676 next(); 2677 } 2678 }; 2679 2680 if ( $.fx.off || !effectMethod ) { 2681 2682 // Delegate to the original method (e.g., .show()) if possible 2683 if ( mode ) { 2684 return this[ mode ]( args.duration, complete ); 2685 } else { 2686 return this.each( function() { 2687 if ( complete ) { 2688 complete.call( this ); 2689 } 2690 } ); 2691 } 2692 } 2693 2694 function run( next ) { 2695 var elem = $( this ); 2696 2697 function cleanup() { 2698 elem.removeData( dataSpaceAnimated ); 2699 2700 $.effects.cleanUp( elem ); 2701 2702 if ( args.mode === "hide" ) { 2703 elem.hide(); 2704 } 2705 2706 done(); 2707 } 2708 2709 function done() { 2710 if ( $.isFunction( complete ) ) { 2711 complete.call( elem[ 0 ] ); 2712 } 2713 2714 if ( $.isFunction( next ) ) { 2715 next(); 2716 } 2717 } 2718 2719 // Override mode option on a per element basis, 2720 // as toggle can be either show or hide depending on element state 2721 args.mode = modes.shift(); 2722 2723 if ( $.uiBackCompat !== false && !defaultMode ) { 2724 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 2725 2726 // Call the core method to track "olddisplay" properly 2727 elem[ mode ](); 2728 done(); 2729 } else { 2730 effectMethod.call( elem[ 0 ], args, done ); 2731 } 2732 } else { 2733 if ( args.mode === "none" ) { 2734 2735 // Call the core method to track "olddisplay" properly 2736 elem[ mode ](); 2737 done(); 2738 } else { 2739 effectMethod.call( elem[ 0 ], args, cleanup ); 2740 } 2741 } 2742 } 2743 2744 // Run prefilter on all elements first to ensure that 2745 // any showing or hiding happens before placeholder creation, 2746 // which ensures that any layout changes are correctly captured. 2747 return queue === false ? 2748 this.each( prefilter ).each( run ) : 2749 this.queue( queueName, prefilter ).queue( queueName, run ); 2750 }, 2751 2752 show: ( function( orig ) { 2753 return function( option ) { 2754 if ( standardAnimationOption( option ) ) { 2755 return orig.apply( this, arguments ); 2756 } else { 2757 var args = _normalizeArguments.apply( this, arguments ); 2758 args.mode = "show"; 2759 return this.effect.call( this, args ); 2760 } 2761 }; 2762 } )( $.fn.show ), 2763 2764 hide: ( function( orig ) { 2765 return function( option ) { 2766 if ( standardAnimationOption( option ) ) { 2767 return orig.apply( this, arguments ); 2768 } else { 2769 var args = _normalizeArguments.apply( this, arguments ); 2770 args.mode = "hide"; 2771 return this.effect.call( this, args ); 2772 } 2773 }; 2774 } )( $.fn.hide ), 2775 2776 toggle: ( function( orig ) { 2777 return function( option ) { 2778 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 2779 return orig.apply( this, arguments ); 2780 } else { 2781 var args = _normalizeArguments.apply( this, arguments ); 2782 args.mode = "toggle"; 2783 return this.effect.call( this, args ); 2784 } 2785 }; 2786 } )( $.fn.toggle ), 2787 2788 cssUnit: function( key ) { 2789 var style = this.css( key ), 2790 val = []; 2791 2792 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 2793 if ( style.indexOf( unit ) > 0 ) { 2794 val = [ parseFloat( style ), unit ]; 2795 } 2796 } ); 2797 return val; 2798 }, 2799 2800 cssClip: function( clipObj ) { 2801 if ( clipObj ) { 2802 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 2803 clipObj.bottom + "px " + clipObj.left + "px)" ); 2804 } 2805 return parseClip( this.css( "clip" ), this ); 2806 }, 2807 2808 transfer: function( options, done ) { 2809 var element = $( this ), 2810 target = $( options.to ), 2811 targetFixed = target.css( "position" ) === "fixed", 2812 body = $( "body" ), 2813 fixTop = targetFixed ? body.scrollTop() : 0, 2814 fixLeft = targetFixed ? body.scrollLeft() : 0, 2815 endPosition = target.offset(), 2816 animation = { 2817 top: endPosition.top - fixTop, 2818 left: endPosition.left - fixLeft, 2819 height: target.innerHeight(), 2820 width: target.innerWidth() 2821 }, 2822 startPosition = element.offset(), 2823 transfer = $( "<div class='ui-effects-transfer'></div>" ) 2824 .appendTo( "body" ) 2825 .addClass( options.className ) 2826 .css( { 2827 top: startPosition.top - fixTop, 2828 left: startPosition.left - fixLeft, 2829 height: element.innerHeight(), 2830 width: element.innerWidth(), 2831 position: targetFixed ? "fixed" : "absolute" 2832 } ) 2833 .animate( animation, options.duration, options.easing, function() { 2834 transfer.remove(); 2835 if ( $.isFunction( done ) ) { 2836 done(); 2837 } 2838 } ); 2839 } 2840} ); 2841 2842function parseClip( str, element ) { 2843 var outerWidth = element.outerWidth(), 2844 outerHeight = element.outerHeight(), 2845 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 2846 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 2847 2848 return { 2849 top: parseFloat( values[ 1 ] ) || 0, 2850 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 2851 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 2852 left: parseFloat( values[ 4 ] ) || 0 2853 }; 2854} 2855 2856$.fx.step.clip = function( fx ) { 2857 if ( !fx.clipInit ) { 2858 fx.start = $( fx.elem ).cssClip(); 2859 if ( typeof fx.end === "string" ) { 2860 fx.end = parseClip( fx.end, fx.elem ); 2861 } 2862 fx.clipInit = true; 2863 } 2864 2865 $( fx.elem ).cssClip( { 2866 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 2867 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 2868 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 2869 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 2870 } ); 2871}; 2872 2873} )(); 2874 2875/******************************************************************************/ 2876/*********************************** EASING ***********************************/ 2877/******************************************************************************/ 2878 2879( function() { 2880 2881// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 2882 2883var baseEasings = {}; 2884 2885$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 2886 baseEasings[ name ] = function( p ) { 2887 return Math.pow( p, i + 2 ); 2888 }; 2889} ); 2890 2891$.extend( baseEasings, { 2892 Sine: function( p ) { 2893 return 1 - Math.cos( p * Math.PI / 2 ); 2894 }, 2895 Circ: function( p ) { 2896 return 1 - Math.sqrt( 1 - p * p ); 2897 }, 2898 Elastic: function( p ) { 2899 return p === 0 || p === 1 ? p : 2900 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 2901 }, 2902 Back: function( p ) { 2903 return p * p * ( 3 * p - 2 ); 2904 }, 2905 Bounce: function( p ) { 2906 var pow2, 2907 bounce = 4; 2908 2909 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 2910 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 2911 } 2912} ); 2913 2914$.each( baseEasings, function( name, easeIn ) { 2915 $.easing[ "easeIn" + name ] = easeIn; 2916 $.easing[ "easeOut" + name ] = function( p ) { 2917 return 1 - easeIn( 1 - p ); 2918 }; 2919 $.easing[ "easeInOut" + name ] = function( p ) { 2920 return p < 0.5 ? 2921 easeIn( p * 2 ) / 2 : 2922 1 - easeIn( p * -2 + 2 ) / 2; 2923 }; 2924} ); 2925 2926} )(); 2927 2928var effect = $.effects; 2929 2930 2931/*! 2932 * jQuery UI Effects Blind 1.12.0 2933 * http://jqueryui.com 2934 * 2935 * Copyright jQuery Foundation and other contributors 2936 * Released under the MIT license. 2937 * http://jquery.org/license 2938 */ 2939 2940//>>label: Blind Effect 2941//>>group: Effects 2942//>>description: Blinds the element. 2943//>>docs: http://api.jqueryui.com/blind-effect/ 2944//>>demos: http://jqueryui.com/effect/ 2945 2946 2947 2948var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) { 2949 var map = { 2950 up: [ "bottom", "top" ], 2951 vertical: [ "bottom", "top" ], 2952 down: [ "top", "bottom" ], 2953 left: [ "right", "left" ], 2954 horizontal: [ "right", "left" ], 2955 right: [ "left", "right" ] 2956 }, 2957 element = $( this ), 2958 direction = options.direction || "up", 2959 start = element.cssClip(), 2960 animate = { clip: $.extend( {}, start ) }, 2961 placeholder = $.effects.createPlaceholder( element ); 2962 2963 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 2964 2965 if ( options.mode === "show" ) { 2966 element.cssClip( animate.clip ); 2967 if ( placeholder ) { 2968 placeholder.css( $.effects.clipToBox( animate ) ); 2969 } 2970 2971 animate.clip = start; 2972 } 2973 2974 if ( placeholder ) { 2975 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 2976 } 2977 2978 element.animate( animate, { 2979 queue: false, 2980 duration: options.duration, 2981 easing: options.easing, 2982 complete: done 2983 } ); 2984} ); 2985 2986 2987 2988/*! 2989 * jQuery UI Effects Bounce 1.12.0 2990 * http://jqueryui.com
vendor: 10,588 bytes, lines 2991-3397
2991 * 2992 * Copyright jQuery Foundation and other contributors 2993 * Released under the MIT license. 2994 * http://jquery.org/license 2995 */ 2996 2997//>>label: Bounce Effect 2998//>>group: Effects 2999//>>description: Bounces an element horizontally or vertically n times. 3000//>>docs: http://api.jqueryui.com/bounce-effect/ 3001//>>demos: http://jqueryui.com/effect/ 3002 3003 3004 3005var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) { 3006 var upAnim, downAnim, refValue, 3007 element = $( this ), 3008 3009 // Defaults: 3010 mode = options.mode, 3011 hide = mode === "hide", 3012 show = mode === "show", 3013 direction = options.direction || "up", 3014 distance = options.distance, 3015 times = options.times || 5, 3016 3017 // Number of internal animations 3018 anims = times * 2 + ( show || hide ? 1 : 0 ), 3019 speed = options.duration / anims, 3020 easing = options.easing, 3021 3022 // Utility: 3023 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3024 motion = ( direction === "up" || direction === "left" ), 3025 i = 0, 3026 3027 queuelen = element.queue().length; 3028 3029 $.effects.createPlaceholder( element ); 3030 3031 refValue = element.css( ref ); 3032 3033 // Default distance for the BIGGEST bounce is the outer Distance / 3 3034 if ( !distance ) { 3035 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 3036 } 3037 3038 if ( show ) { 3039 downAnim = { opacity: 1 }; 3040 downAnim[ ref ] = refValue; 3041 3042 // If we are showing, force opacity 0 and set the initial position 3043 // then do the "first" animation 3044 element 3045 .css( "opacity", 0 ) 3046 .css( ref, motion ? -distance * 2 : distance * 2 ) 3047 .animate( downAnim, speed, easing ); 3048 } 3049 3050 // Start at the smallest distance if we are hiding 3051 if ( hide ) { 3052 distance = distance / Math.pow( 2, times - 1 ); 3053 } 3054 3055 downAnim = {}; 3056 downAnim[ ref ] = refValue; 3057 3058 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3059 for ( ; i < times; i++ ) { 3060 upAnim = {}; 3061 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3062 3063 element 3064 .animate( upAnim, speed, easing ) 3065 .animate( downAnim, speed, easing ); 3066 3067 distance = hide ? distance * 2 : distance / 2; 3068 } 3069 3070 // Last Bounce when Hiding 3071 if ( hide ) { 3072 upAnim = { opacity: 0 }; 3073 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3074 3075 element.animate( upAnim, speed, easing ); 3076 } 3077 3078 element.queue( done ); 3079 3080 $.effects.unshift( element, queuelen, anims + 1 ); 3081} ); 3082 3083 3084/*! 3085 * jQuery UI Effects Clip 1.12.0 3086 * http://jqueryui.com 3087 * 3088 * Copyright jQuery Foundation and other contributors 3089 * Released under the MIT license. 3090 * http://jquery.org/license 3091 */ 3092 3093//>>label: Clip Effect 3094//>>group: Effects 3095//>>description: Clips the element on and off like an old TV. 3096//>>docs: http://api.jqueryui.com/clip-effect/ 3097//>>demos: http://jqueryui.com/effect/ 3098 3099 3100 3101var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) { 3102 var start, 3103 animate = {}, 3104 element = $( this ), 3105 direction = options.direction || "vertical", 3106 both = direction === "both", 3107 horizontal = both || direction === "horizontal", 3108 vertical = both || direction === "vertical"; 3109 3110 start = element.cssClip(); 3111 animate.clip = { 3112 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 3113 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 3114 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 3115 left: horizontal ? ( start.right - start.left ) / 2 : start.left 3116 }; 3117 3118 $.effects.createPlaceholder( element ); 3119 3120 if ( options.mode === "show" ) { 3121 element.cssClip( animate.clip ); 3122 animate.clip = start; 3123 } 3124 3125 element.animate( animate, { 3126 queue: false, 3127 duration: options.duration, 3128 easing: options.easing, 3129 complete: done 3130 } ); 3131 3132} ); 3133 3134 3135/*! 3136 * jQuery UI Effects Drop 1.12.0 3137 * http://jqueryui.com 3138 * 3139 * Copyright jQuery Foundation and other contributors 3140 * Released under the MIT license. 3141 * http://jquery.org/license 3142 */ 3143 3144//>>label: Drop Effect 3145//>>group: Effects 3146//>>description: Moves an element in one direction and hides it at the same time. 3147//>>docs: http://api.jqueryui.com/drop-effect/ 3148//>>demos: http://jqueryui.com/effect/ 3149 3150 3151 3152var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) { 3153 3154 var distance, 3155 element = $( this ), 3156 mode = options.mode, 3157 show = mode === "show", 3158 direction = options.direction || "left", 3159 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3160 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 3161 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 3162 animation = { 3163 opacity: 0 3164 }; 3165 3166 $.effects.createPlaceholder( element ); 3167 3168 distance = options.distance || 3169 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 3170 3171 animation[ ref ] = motion + distance; 3172 3173 if ( show ) { 3174 element.css( animation ); 3175 3176 animation[ ref ] = oppositeMotion + distance; 3177 animation.opacity = 1; 3178 } 3179 3180 // Animate 3181 element.animate( animation, { 3182 queue: false, 3183 duration: options.duration, 3184 easing: options.easing, 3185 complete: done 3186 } ); 3187} ); 3188 3189 3190/*! 3191 * jQuery UI Effects Explode 1.12.0 3192 * http://jqueryui.com 3193 * 3194 * Copyright jQuery Foundation and other contributors 3195 * Released under the MIT license. 3196 * http://jquery.org/license 3197 */ 3198 3199//>>label: Explode Effect 3200//>>group: Effects 3201// jscs:disable maximumLineLength 3202//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3203// jscs:enable maximumLineLength 3204//>>docs: http://api.jqueryui.com/explode-effect/ 3205//>>demos: http://jqueryui.com/effect/ 3206 3207 3208 3209var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) { 3210 3211 var i, j, left, top, mx, my, 3212 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 3213 cells = rows, 3214 element = $( this ), 3215 mode = options.mode, 3216 show = mode === "show", 3217 3218 // Show and then visibility:hidden the element before calculating offset 3219 offset = element.show().css( "visibility", "hidden" ).offset(), 3220 3221 // Width and height of a piece 3222 width = Math.ceil( element.outerWidth() / cells ), 3223 height = Math.ceil( element.outerHeight() / rows ), 3224 pieces = []; 3225 3226 // Children animate complete: 3227 function childComplete() { 3228 pieces.push( this ); 3229 if ( pieces.length === rows * cells ) { 3230 animComplete(); 3231 } 3232 } 3233 3234 // Clone the element for each row and cell. 3235 for ( i = 0; i < rows; i++ ) { // ===> 3236 top = offset.top + i * height; 3237 my = i - ( rows - 1 ) / 2; 3238 3239 for ( j = 0; j < cells; j++ ) { // ||| 3240 left = offset.left + j * width; 3241 mx = j - ( cells - 1 ) / 2; 3242 3243 // Create a clone of the now hidden main element that will be absolute positioned 3244 // within a wrapper div off the -left and -top equal to size of our pieces 3245 element 3246 .clone() 3247 .appendTo( "body" ) 3248 .wrap( "<div></div>" ) 3249 .css( { 3250 position: "absolute", 3251 visibility: "visible", 3252 left: -j * width, 3253 top: -i * height 3254 } ) 3255 3256 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3257 // where the original was located +left and +top equal to the size of pieces 3258 .parent() 3259 .addClass( "ui-effects-explode" ) 3260 .css( { 3261 position: "absolute", 3262 overflow: "hidden", 3263 width: width, 3264 height: height, 3265 left: left + ( show ? mx * width : 0 ), 3266 top: top + ( show ? my * height : 0 ), 3267 opacity: show ? 0 : 1 3268 } ) 3269 .animate( { 3270 left: left + ( show ? 0 : mx * width ), 3271 top: top + ( show ? 0 : my * height ), 3272 opacity: show ? 1 : 0 3273 }, options.duration || 500, options.easing, childComplete ); 3274 } 3275 } 3276 3277 function animComplete() { 3278 element.css( { 3279 visibility: "visible" 3280 } ); 3281 $( pieces ).remove(); 3282 done(); 3283 } 3284} ); 3285 3286 3287/*! 3288 * jQuery UI Effects Fade 1.12.0 3289 * http://jqueryui.com 3290 * 3291 * Copyright jQuery Foundation and other contributors 3292 * Released under the MIT license. 3293 * http://jquery.org/license 3294 */ 3295 3296//>>label: Fade Effect 3297//>>group: Effects 3298//>>description: Fades the element. 3299//>>docs: http://api.jqueryui.com/fade-effect/ 3300//>>demos: http://jqueryui.com/effect/ 3301 3302 3303 3304var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) { 3305 var show = options.mode === "show"; 3306 3307 $( this ) 3308 .css( "opacity", show ? 0 : 1 ) 3309 .animate( { 3310 opacity: show ? 1 : 0 3311 }, { 3312 queue: false, 3313 duration: options.duration, 3314 easing: options.easing, 3315 complete: done 3316 } ); 3317} ); 3318 3319 3320/*! 3321 * jQuery UI Effects Fold 1.12.0 3322 * http://jqueryui.com 3323 * 3324 * Copyright jQuery Foundation and other contributors 3325 * Released under the MIT license. 3326 * http://jquery.org/license 3327 */ 3328 3329//>>label: Fold Effect 3330//>>group: Effects 3331//>>description: Folds an element first horizontally and then vertically. 3332//>>docs: http://api.jqueryui.com/fold-effect/ 3333//>>demos: http://jqueryui.com/effect/ 3334 3335 3336 3337var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) { 3338 3339 // Create element 3340 var element = $( this ), 3341 mode = options.mode, 3342 show = mode === "show", 3343 hide = mode === "hide", 3344 size = options.size || 15, 3345 percent = /([0-9]+)%/.exec( size ), 3346 horizFirst = !!options.horizFirst, 3347 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 3348 duration = options.duration / 2, 3349 3350 placeholder = $.effects.createPlaceholder( element ), 3351 3352 start = element.cssClip(), 3353 animation1 = { clip: $.extend( {}, start ) }, 3354 animation2 = { clip: $.extend( {}, start ) }, 3355 3356 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 3357 3358 queuelen = element.queue().length; 3359 3360 if ( percent ) { 3361 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 3362 } 3363 animation1.clip[ ref[ 0 ] ] = size; 3364 animation2.clip[ ref[ 0 ] ] = size; 3365 animation2.clip[ ref[ 1 ] ] = 0; 3366 3367 if ( show ) { 3368 element.cssClip( animation2.clip ); 3369 if ( placeholder ) { 3370 placeholder.css( $.effects.clipToBox( animation2 ) ); 3371 } 3372 3373 animation2.clip = start; 3374 } 3375 3376 // Animate 3377 element 3378 .queue( function( next ) { 3379 if ( placeholder ) { 3380 placeholder 3381 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 3382 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 3383 } 3384 3385 next(); 3386 } ) 3387 .animate( animation1, duration, options.easing ) 3388 .animate( animation2, duration, options.easing ) 3389 .queue( done ); 3390 3391 $.effects.unshift( element, queuelen, 4 ); 3392} ); 3393 3394 3395/*! 3396 * jQuery UI Effects Highlight 1.12.0 3397 * http://jqueryui.com
vendor: 6,249 bytes, lines 3398-3617
3398 * 3399 * Copyright jQuery Foundation and other contributors 3400 * Released under the MIT license. 3401 * http://jquery.org/license 3402 */ 3403 3404//>>label: Highlight Effect 3405//>>group: Effects 3406//>>description: Highlights the background of an element in a defined color for a custom duration. 3407//>>docs: http://api.jqueryui.com/highlight-effect/ 3408//>>demos: http://jqueryui.com/effect/ 3409 3410 3411 3412var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) { 3413 var element = $( this ), 3414 animation = { 3415 backgroundColor: element.css( "backgroundColor" ) 3416 }; 3417 3418 if ( options.mode === "hide" ) { 3419 animation.opacity = 0; 3420 } 3421 3422 $.effects.saveStyle( element ); 3423 3424 element 3425 .css( { 3426 backgroundImage: "none", 3427 backgroundColor: options.color || "#ffff99" 3428 } ) 3429 .animate( animation, { 3430 queue: false, 3431 duration: options.duration, 3432 easing: options.easing, 3433 complete: done 3434 } ); 3435} ); 3436 3437 3438/*! 3439 * jQuery UI Effects Size 1.12.0 3440 * http://jqueryui.com 3441 * 3442 * Copyright jQuery Foundation and other contributors 3443 * Released under the MIT license. 3444 * http://jquery.org/license 3445 */ 3446 3447//>>label: Size Effect 3448//>>group: Effects 3449//>>description: Resize an element to a specified width and height. 3450//>>docs: http://api.jqueryui.com/size-effect/ 3451//>>demos: http://jqueryui.com/effect/ 3452 3453 3454 3455var effectsEffectSize = $.effects.define( "size", function( options, done ) { 3456 3457 // Create element 3458 var baseline, factor, temp, 3459 element = $( this ), 3460 3461 // Copy for children 3462 cProps = [ "fontSize" ], 3463 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 3464 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 3465 3466 // Set options 3467 mode = options.mode, 3468 restore = mode !== "effect", 3469 scale = options.scale || "both", 3470 origin = options.origin || [ "middle", "center" ], 3471 position = element.css( "position" ), 3472 pos = element.position(), 3473 original = $.effects.scaledDimensions( element ), 3474 from = options.from || original, 3475 to = options.to || $.effects.scaledDimensions( element, 0 ); 3476 3477 $.effects.createPlaceholder( element ); 3478 3479 if ( mode === "show" ) { 3480 temp = from; 3481 from = to; 3482 to = temp; 3483 } 3484 3485 // Set scaling factor 3486 factor = { 3487 from: { 3488 y: from.height / original.height, 3489 x: from.width / original.width 3490 }, 3491 to: { 3492 y: to.height / original.height, 3493 x: to.width / original.width 3494 } 3495 }; 3496 3497 // Scale the css box 3498 if ( scale === "box" || scale === "both" ) { 3499 3500 // Vertical props scaling 3501 if ( factor.from.y !== factor.to.y ) { 3502 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 3503 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 3504 } 3505 3506 // Horizontal props scaling 3507 if ( factor.from.x !== factor.to.x ) { 3508 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 3509 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 3510 } 3511 } 3512 3513 // Scale the content 3514 if ( scale === "content" || scale === "both" ) { 3515 3516 // Vertical props scaling 3517 if ( factor.from.y !== factor.to.y ) { 3518 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 3519 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 3520 } 3521 } 3522 3523 // Adjust the position properties based on the provided origin points 3524 if ( origin ) { 3525 baseline = $.effects.getBaseline( origin, original ); 3526 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 3527 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 3528 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 3529 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 3530 } 3531 element.css( from ); 3532 3533 // Animate the children if desired 3534 if ( scale === "content" || scale === "both" ) { 3535 3536 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 3537 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 3538 3539 // Only animate children with width attributes specified 3540 // TODO: is this right? should we include anything with css width specified as well 3541 element.find( "*[width]" ).each( function() { 3542 var child = $( this ), 3543 childOriginal = $.effects.scaledDimensions( child ), 3544 childFrom = { 3545 height: childOriginal.height * factor.from.y, 3546 width: childOriginal.width * factor.from.x, 3547 outerHeight: childOriginal.outerHeight * factor.from.y, 3548 outerWidth: childOriginal.outerWidth * factor.from.x 3549 }, 3550 childTo = { 3551 height: childOriginal.height * factor.to.y, 3552 width: childOriginal.width * factor.to.x, 3553 outerHeight: childOriginal.height * factor.to.y, 3554 outerWidth: childOriginal.width * factor.to.x 3555 }; 3556 3557 // Vertical props scaling 3558 if ( factor.from.y !== factor.to.y ) { 3559 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 3560 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 3561 } 3562 3563 // Horizontal props scaling 3564 if ( factor.from.x !== factor.to.x ) { 3565 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 3566 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 3567 } 3568 3569 if ( restore ) { 3570 $.effects.saveStyle( child ); 3571 } 3572 3573 // Animate children 3574 child.css( childFrom ); 3575 child.animate( childTo, options.duration, options.easing, function() { 3576 3577 // Restore children 3578 if ( restore ) { 3579 $.effects.restoreStyle( child ); 3580 } 3581 } ); 3582 } ); 3583 } 3584 3585 // Animate 3586 element.animate( to, { 3587 queue: false, 3588 duration: options.duration, 3589 easing: options.easing, 3590 complete: function() { 3591 3592 var offset = element.offset(); 3593 3594 if ( to.opacity === 0 ) { 3595 element.css( "opacity", from.opacity ); 3596 } 3597 3598 if ( !restore ) { 3599 element 3600 .css( "position", position === "static" ? "relative" : position ) 3601 .offset( offset ); 3602 3603 // Need to save style here so that automatic style restoration 3604 // doesn't restore to the original styles from before the animation. 3605 $.effects.saveStyle( element ); 3606 } 3607 3608 done(); 3609 } 3610 } ); 3611 3612} ); 3613 3614 3615/*! 3616 * jQuery UI Effects Scale 1.12.0 3617 * http://jqueryui.com
vendor: 4,797 bytes, lines 3618-3795
3618 * 3619 * Copyright jQuery Foundation and other contributors 3620 * Released under the MIT license. 3621 * http://jquery.org/license 3622 */ 3623 3624//>>label: Scale Effect 3625//>>group: Effects 3626//>>description: Grows or shrinks an element and its content. 3627//>>docs: http://api.jqueryui.com/scale-effect/ 3628//>>demos: http://jqueryui.com/effect/ 3629 3630 3631 3632var effectsEffectScale = $.effects.define( "scale", function( options, done ) { 3633 3634 // Create element 3635 var el = $( this ), 3636 mode = options.mode, 3637 percent = parseInt( options.percent, 10 ) || 3638 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 3639 3640 newOptions = $.extend( true, { 3641 from: $.effects.scaledDimensions( el ), 3642 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 3643 origin: options.origin || [ "middle", "center" ] 3644 }, options ); 3645 3646 // Fade option to support puff 3647 if ( options.fade ) { 3648 newOptions.from.opacity = 1; 3649 newOptions.to.opacity = 0; 3650 } 3651 3652 $.effects.effect.size.call( this, newOptions, done ); 3653} ); 3654 3655 3656/*! 3657 * jQuery UI Effects Puff 1.12.0 3658 * http://jqueryui.com 3659 * 3660 * Copyright jQuery Foundation and other contributors 3661 * Released under the MIT license. 3662 * http://jquery.org/license 3663 */ 3664 3665//>>label: Puff Effect 3666//>>group: Effects 3667//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 3668//>>docs: http://api.jqueryui.com/puff-effect/ 3669//>>demos: http://jqueryui.com/effect/ 3670 3671 3672 3673var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) { 3674 var newOptions = $.extend( true, {}, options, { 3675 fade: true, 3676 percent: parseInt( options.percent, 10 ) || 150 3677 } ); 3678 3679 $.effects.effect.scale.call( this, newOptions, done ); 3680} ); 3681 3682 3683/*! 3684 * jQuery UI Effects Pulsate 1.12.0 3685 * http://jqueryui.com 3686 * 3687 * Copyright jQuery Foundation and other contributors 3688 * Released under the MIT license. 3689 * http://jquery.org/license 3690 */ 3691 3692//>>label: Pulsate Effect 3693//>>group: Effects 3694//>>description: Pulsates an element n times by changing the opacity to zero and back. 3695//>>docs: http://api.jqueryui.com/pulsate-effect/ 3696//>>demos: http://jqueryui.com/effect/ 3697 3698 3699 3700var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) { 3701 var element = $( this ), 3702 mode = options.mode, 3703 show = mode === "show", 3704 hide = mode === "hide", 3705 showhide = show || hide, 3706 3707 // Showing or hiding leaves off the "last" animation 3708 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 3709 duration = options.duration / anims, 3710 animateTo = 0, 3711 i = 1, 3712 queuelen = element.queue().length; 3713 3714 if ( show || !element.is( ":visible" ) ) { 3715 element.css( "opacity", 0 ).show(); 3716 animateTo = 1; 3717 } 3718 3719 // Anims - 1 opacity "toggles" 3720 for ( ; i < anims; i++ ) { 3721 element.animate( { opacity: animateTo }, duration, options.easing ); 3722 animateTo = 1 - animateTo; 3723 } 3724 3725 element.animate( { opacity: animateTo }, duration, options.easing ); 3726 3727 element.queue( done ); 3728 3729 $.effects.unshift( element, queuelen, anims + 1 ); 3730} ); 3731 3732 3733/*! 3734 * jQuery UI Effects Shake 1.12.0 3735 * http://jqueryui.com 3736 * 3737 * Copyright jQuery Foundation and other contributors 3738 * Released under the MIT license. 3739 * http://jquery.org/license 3740 */ 3741 3742//>>label: Shake Effect 3743//>>group: Effects 3744//>>description: Shakes an element horizontally or vertically n times. 3745//>>docs: http://api.jqueryui.com/shake-effect/ 3746//>>demos: http://jqueryui.com/effect/ 3747 3748 3749 3750var effectsEffectShake = $.effects.define( "shake", function( options, done ) { 3751 3752 var i = 1, 3753 element = $( this ), 3754 direction = options.direction || "left", 3755 distance = options.distance || 20, 3756 times = options.times || 3, 3757 anims = times * 2 + 1, 3758 speed = Math.round( options.duration / anims ), 3759 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3760 positiveMotion = ( direction === "up" || direction === "left" ), 3761 animation = {}, 3762 animation1 = {}, 3763 animation2 = {}, 3764 3765 queuelen = element.queue().length; 3766 3767 $.effects.createPlaceholder( element ); 3768 3769 // Animation 3770 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 3771 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 3772 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 3773 3774 // Animate 3775 element.animate( animation, speed, options.easing ); 3776 3777 // Shakes 3778 for ( ; i < times; i++ ) { 3779 element 3780 .animate( animation1, speed, options.easing ) 3781 .animate( animation2, speed, options.easing ); 3782 } 3783 3784 element 3785 .animate( animation1, speed, options.easing ) 3786 .animate( animation, speed / 2, options.easing ) 3787 .queue( done ); 3788 3789 $.effects.unshift( element, queuelen, anims + 1 ); 3790} ); 3791 3792 3793/*! 3794 * jQuery UI Effects Slide 1.12.0 3795 * http://jqueryui.com
vendor: 4,781 bytes, lines 3796-3967
3796 * 3797 * Copyright jQuery Foundation and other contributors 3798 * Released under the MIT license. 3799 * http://jquery.org/license 3800 */ 3801 3802//>>label: Slide Effect 3803//>>group: Effects 3804//>>description: Slides an element in and out of the viewport. 3805//>>docs: http://api.jqueryui.com/slide-effect/ 3806//>>demos: http://jqueryui.com/effect/ 3807 3808 3809 3810var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) { 3811 var startClip, startRef, 3812 element = $( this ), 3813 map = { 3814 up: [ "bottom", "top" ], 3815 down: [ "top", "bottom" ], 3816 left: [ "right", "left" ], 3817 right: [ "left", "right" ] 3818 }, 3819 mode = options.mode, 3820 direction = options.direction || "left", 3821 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3822 positiveMotion = ( direction === "up" || direction === "left" ), 3823 distance = options.distance || 3824 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 3825 animation = {}; 3826 3827 $.effects.createPlaceholder( element ); 3828 3829 startClip = element.cssClip(); 3830 startRef = element.position()[ ref ]; 3831 3832 // Define hide animation 3833 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 3834 animation.clip = element.cssClip(); 3835 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 3836 3837 // Reverse the animation if we're showing 3838 if ( mode === "show" ) { 3839 element.cssClip( animation.clip ); 3840 element.css( ref, animation[ ref ] ); 3841 animation.clip = startClip; 3842 animation[ ref ] = startRef; 3843 } 3844 3845 // Actually animate 3846 element.animate( animation, { 3847 queue: false, 3848 duration: options.duration, 3849 easing: options.easing, 3850 complete: done 3851 } ); 3852} ); 3853 3854 3855/*! 3856 * jQuery UI Effects Transfer 1.12.0 3857 * http://jqueryui.com 3858 * 3859 * Copyright jQuery Foundation and other contributors 3860 * Released under the MIT license. 3861 * http://jquery.org/license 3862 */ 3863 3864//>>label: Transfer Effect 3865//>>group: Effects 3866//>>description: Displays a transfer effect from one element to another. 3867//>>docs: http://api.jqueryui.com/transfer-effect/ 3868//>>demos: http://jqueryui.com/effect/ 3869 3870 3871 3872var effect; 3873if ( $.uiBackCompat !== false ) { 3874 effect = $.effects.define( "transfer", function( options, done ) { 3875 $( this ).transfer( options, done ); 3876 } ); 3877} 3878var effectsEffectTransfer = effect; 3879 3880 3881/*! 3882 * jQuery UI Focusable 1.12.0 3883 * http://jqueryui.com 3884 * 3885 * Copyright jQuery Foundation and other contributors 3886 * Released under the MIT license. 3887 * http://jquery.org/license 3888 */ 3889 3890//>>label: :focusable Selector 3891//>>group: Core 3892//>>description: Selects elements which can be focused. 3893//>>docs: http://api.jqueryui.com/focusable-selector/ 3894 3895 3896 3897// Selectors 3898$.ui.focusable = function( element, hasTabindex ) { 3899 var map, mapName, img, focusableIfVisible, fieldset, 3900 nodeName = element.nodeName.toLowerCase(); 3901 3902 if ( "area" === nodeName ) { 3903 map = element.parentNode; 3904 mapName = map.name; 3905 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 3906 return false; 3907 } 3908 img = $( "img[usemap='#" + mapName + "']" ); 3909 return img.length > 0 && img.is( ":visible" ); 3910 } 3911 3912 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 3913 focusableIfVisible = !element.disabled; 3914 3915 if ( focusableIfVisible ) { 3916 3917 // Form controls within a disabled fieldset are disabled. 3918 // However, controls within the fieldset's legend do not get disabled. 3919 // Since controls generally aren't placed inside legends, we skip 3920 // this portion of the check. 3921 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 3922 if ( fieldset ) { 3923 focusableIfVisible = !fieldset.disabled; 3924 } 3925 } 3926 } else if ( "a" === nodeName ) { 3927 focusableIfVisible = element.href || hasTabindex; 3928 } else { 3929 focusableIfVisible = hasTabindex; 3930 } 3931 3932 return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); 3933}; 3934 3935// Support: IE 8 only 3936// IE 8 doesn't resolve inherit to visible/hidden for computed values 3937function visible( element ) { 3938 var visibility = element.css( "visibility" ); 3939 while ( visibility === "inherit" ) { 3940 element = element.parent(); 3941 visibility = element.css( "visibility" ); 3942 } 3943 return visibility !== "hidden"; 3944} 3945 3946$.extend( $.expr[ ":" ], { 3947 focusable: function( element ) { 3948 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 3949 } 3950} ); 3951 3952var focusable = $.ui.focusable; 3953 3954 3955 3956 3957// Support: IE8 Only 3958// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 3959// with a string, so we need to find the proper form. 3960var form = $.fn.form = function() { 3961 return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); 3962}; 3963 3964 3965/*! 3966 * jQuery UI Form Reset Mixin 1.12.0 3967 * http://jqueryui.com
vendor: 4,779 bytes, lines 3968-4155
3968 * 3969 * Copyright jQuery Foundation and other contributors 3970 * Released under the MIT license. 3971 * http://jquery.org/license 3972 */ 3973 3974//>>label: Form Reset Mixin 3975//>>group: Core 3976//>>description: Refresh input widgets when their form is reset 3977//>>docs: http://api.jqueryui.com/form-reset-mixin/ 3978 3979 3980 3981var formResetMixin = $.ui.formResetMixin = { 3982 _formResetHandler: function() { 3983 var form = $( this ); 3984 3985 // Wait for the form reset to actually happen before refreshing 3986 setTimeout( function() { 3987 var instances = form.data( "ui-form-reset-instances" ); 3988 $.each( instances, function() { 3989 this.refresh(); 3990 } ); 3991 } ); 3992 }, 3993 3994 _bindFormResetHandler: function() { 3995 this.form = this.element.form(); 3996 if ( !this.form.length ) { 3997 return; 3998 } 3999 4000 var instances = this.form.data( "ui-form-reset-instances" ) || []; 4001 if ( !instances.length ) { 4002 4003 // We don't use _on() here because we use a single event handler per form 4004 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 4005 } 4006 instances.push( this ); 4007 this.form.data( "ui-form-reset-instances", instances ); 4008 }, 4009 4010 _unbindFormResetHandler: function() { 4011 if ( !this.form.length ) { 4012 return; 4013 } 4014 4015 var instances = this.form.data( "ui-form-reset-instances" ); 4016 instances.splice( $.inArray( this, instances ), 1 ); 4017 if ( instances.length ) { 4018 this.form.data( "ui-form-reset-instances", instances ); 4019 } else { 4020 this.form 4021 .removeData( "ui-form-reset-instances" ) 4022 .off( "reset.ui-form-reset" ); 4023 } 4024 } 4025}; 4026 4027 4028/*! 4029 * jQuery UI Support for jQuery core 1.7.x 1.12.0 4030 * http://jqueryui.com 4031 * 4032 * Copyright jQuery Foundation and other contributors 4033 * Released under the MIT license. 4034 * http://jquery.org/license 4035 * 4036 */ 4037 4038//>>label: jQuery 1.7 Support 4039//>>group: Core 4040//>>description: Support version 1.7.x of jQuery core 4041 4042 4043 4044// Support: jQuery 1.7 only 4045// Not a great way to check versions, but since we only support 1.7+ and only 4046// need to detect <1.8, this is a simple check that should suffice. Checking 4047// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 4048// and we'll never reach 1.70.0 (if we do, we certainly won't be supporting 4049// 1.7 anymore). See #11197 for why we're not using feature detection. 4050if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) { 4051 4052 // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() 4053 // Unlike jQuery Core 1.8+, these only support numeric values to set the 4054 // dimensions in pixels 4055 $.each( [ "Width", "Height" ], function( i, name ) { 4056 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 4057 type = name.toLowerCase(), 4058 orig = { 4059 innerWidth: $.fn.innerWidth, 4060 innerHeight: $.fn.innerHeight, 4061 outerWidth: $.fn.outerWidth, 4062 outerHeight: $.fn.outerHeight 4063 }; 4064 4065 function reduce( elem, size, border, margin ) { 4066 $.each( side, function() { 4067 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 4068 if ( border ) { 4069 size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 4070 } 4071 if ( margin ) { 4072 size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 4073 } 4074 } ); 4075 return size; 4076 } 4077 4078 $.fn[ "inner" + name ] = function( size ) { 4079 if ( size === undefined ) { 4080 return orig[ "inner" + name ].call( this ); 4081 } 4082 4083 return this.each( function() { 4084 $( this ).css( type, reduce( this, size ) + "px" ); 4085 } ); 4086 }; 4087 4088 $.fn[ "outer" + name ] = function( size, margin ) { 4089 if ( typeof size !== "number" ) { 4090 return orig[ "outer" + name ].call( this, size ); 4091 } 4092 4093 return this.each( function() { 4094 $( this ).css( type, reduce( this, size, true, margin ) + "px" ); 4095 } ); 4096 }; 4097 } ); 4098 4099 $.fn.addBack = function( selector ) { 4100 return this.add( selector == null ? 4101 this.prevObject : this.prevObject.filter( selector ) 4102 ); 4103 }; 4104} 4105 4106; 4107/*! 4108 * jQuery UI Keycode 1.12.0 4109 * http://jqueryui.com 4110 * 4111 * Copyright jQuery Foundation and other contributors 4112 * Released under the MIT license. 4113 * http://jquery.org/license 4114 */ 4115 4116//>>label: Keycode 4117//>>group: Core 4118//>>description: Provide keycodes as keynames 4119//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 4120 4121 4122var keycode = $.ui.keyCode = { 4123 BACKSPACE: 8, 4124 COMMA: 188, 4125 DELETE: 46, 4126 DOWN: 40, 4127 END: 35, 4128 ENTER: 13, 4129 ESCAPE: 27, 4130 HOME: 36, 4131 LEFT: 37, 4132 PAGE_DOWN: 34, 4133 PAGE_UP: 33, 4134 PERIOD: 190, 4135 RIGHT: 39, 4136 SPACE: 32, 4137 TAB: 9, 4138 UP: 38 4139}; 4140 4141 4142 4143 4144// Internal use only 4145var escapeSelector = $.ui.escapeSelector = ( function() { 4146 var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; 4147 return function( selector ) { 4148 return selector.replace( selectorEscape, "\\$1" ); 4149 }; 4150} )(); 4151 4152 4153/*! 4154 * jQuery UI Labels 1.12.0 4155 * http://jqueryui.com
vendor: 5,256 bytes, lines 4156-4359
4156 * 4157 * Copyright jQuery Foundation and other contributors 4158 * Released under the MIT license. 4159 * http://jquery.org/license 4160 */ 4161 4162//>>label: labels 4163//>>group: Core 4164//>>description: Find all the labels associated with a given input 4165//>>docs: http://api.jqueryui.com/labels/ 4166 4167 4168 4169var labels = $.fn.labels = function() { 4170 var ancestor, selector, id, labels, ancestors; 4171 4172 // Check control.labels first 4173 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 4174 return this.pushStack( this[ 0 ].labels ); 4175 } 4176 4177 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4178 // Above browsers do not support control.labels. Everything below is to support them 4179 // as well as document fragments. control.labels does not work on document fragments 4180 labels = this.eq( 0 ).parents( "label" ); 4181 4182 // Look for the label based on the id 4183 id = this.attr( "id" ); 4184 if ( id ) { 4185 4186 // We don't search against the document in case the element 4187 // is disconnected from the DOM 4188 ancestor = this.eq( 0 ).parents().last(); 4189 4190 // Get a full set of top level ancestors 4191 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 4192 4193 // Create a selector for the label based on the id 4194 selector = "label[for='" + $.ui.escapeSelector( id ) + "']"; 4195 4196 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 4197 4198 } 4199 4200 // Return whatever we have found for labels 4201 return this.pushStack( labels ); 4202}; 4203 4204 4205/*! 4206 * jQuery UI Scroll Parent 1.12.0 4207 * http://jqueryui.com 4208 * 4209 * Copyright jQuery Foundation and other contributors 4210 * Released under the MIT license. 4211 * http://jquery.org/license 4212 */ 4213 4214//>>label: scrollParent 4215//>>group: Core 4216//>>description: Get the closest ancestor element that is scrollable. 4217//>>docs: http://api.jqueryui.com/scrollParent/ 4218 4219 4220 4221var scrollParent = $.fn.scrollParent = function( includeHidden ) { 4222 var position = this.css( "position" ), 4223 excludeStaticParent = position === "absolute", 4224 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4225 scrollParent = this.parents().filter( function() { 4226 var parent = $( this ); 4227 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 4228 return false; 4229 } 4230 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 4231 parent.css( "overflow-x" ) ); 4232 } ).eq( 0 ); 4233 4234 return position === "fixed" || !scrollParent.length ? 4235 $( this[ 0 ].ownerDocument || document ) : 4236 scrollParent; 4237}; 4238 4239 4240/*! 4241 * jQuery UI Tabbable 1.12.0 4242 * http://jqueryui.com 4243 * 4244 * Copyright jQuery Foundation and other contributors 4245 * Released under the MIT license. 4246 * http://jquery.org/license 4247 */ 4248 4249//>>label: :tabbable Selector 4250//>>group: Core 4251//>>description: Selects elements which can be tabbed to. 4252//>>docs: http://api.jqueryui.com/tabbable-selector/ 4253 4254 4255 4256var tabbable = $.extend( $.expr[ ":" ], { 4257 tabbable: function( element ) { 4258 var tabIndex = $.attr( element, "tabindex" ), 4259 hasTabindex = tabIndex != null; 4260 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 4261 } 4262} ); 4263 4264 4265/*! 4266 * jQuery UI Unique ID 1.12.0 4267 * http://jqueryui.com 4268 * 4269 * Copyright jQuery Foundation and other contributors 4270 * Released under the MIT license. 4271 * http://jquery.org/license 4272 */ 4273 4274//>>label: uniqueId 4275//>>group: Core 4276//>>description: Functions to generate and remove uniqueId's 4277//>>docs: http://api.jqueryui.com/uniqueId/ 4278 4279 4280 4281var uniqueId = $.fn.extend( { 4282 uniqueId: ( function() { 4283 var uuid = 0; 4284 4285 return function() { 4286 return this.each( function() { 4287 if ( !this.id ) { 4288 this.id = "ui-id-" + ( ++uuid ); 4289 } 4290 } ); 4291 }; 4292 } )(), 4293 4294 removeUniqueId: function() { 4295 return this.each( function() { 4296 if ( /^ui-id-\d+$/.test( this.id ) ) { 4297 $( this ).removeAttr( "id" ); 4298 } 4299 } ); 4300 } 4301} ); 4302 4303 4304/*! 4305 * jQuery UI Accordion 1.12.0 4306 * http://jqueryui.com 4307 * 4308 * Copyright jQuery Foundation and other contributors 4309 * Released under the MIT license. 4310 * http://jquery.org/license 4311 */ 4312 4313//>>label: Accordion 4314//>>group: Widgets 4315// jscs:disable maximumLineLength 4316//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4317// jscs:enable maximumLineLength 4318//>>docs: http://api.jqueryui.com/accordion/ 4319//>>demos: http://jqueryui.com/accordion/ 4320//>>css.structure: ../../themes/base/core.css 4321//>>css.structure: ../../themes/base/accordion.css 4322//>>css.theme: ../../themes/base/theme.css 4323 4324 4325 4326var widgetsAccordion = $.widget( "ui.accordion", { 4327 version: "1.12.0", 4328 options: { 4329 active: 0, 4330 animate: {}, 4331 classes: { 4332 "ui-accordion-header": "ui-corner-top", 4333 "ui-accordion-header-collapsed": "ui-corner-all", 4334 "ui-accordion-content": "ui-corner-bottom" 4335 }, 4336 collapsible: false, 4337 event: "click", 4338 header: "> li > :first-child, > :not(li):even", 4339 heightStyle: "auto", 4340 icons: { 4341 activeHeader: "ui-icon-triangle-1-s", 4342 header: "ui-icon-triangle-1-e" 4343 }, 4344 4345 // Callbacks 4346 activate: null, 4347 beforeActivate: null 4348 }, 4349 4350 hideProps: { 4351 borderTopWidth: "hide", 4352 borderBottomWidth: "hide", 4353 paddingTop: "hide", 4354 paddingBottom: "hide", 4355 height: "hide" 4356 }, 4357 4358 showProps: { 4359 borderTopWidth: "show",
vendor: 5,248 bytes, lines 4360-4562
4360 borderBottomWidth: "show", 4361 paddingTop: "show", 4362 paddingBottom: "show", 4363 height: "show" 4364 }, 4365 4366 _create: function() { 4367 var options = this.options; 4368 4369 this.prevShow = this.prevHide = $(); 4370 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 4371 this.element.attr( "role", "tablist" ); 4372 4373 // Don't allow collapsible: false and active: false / null 4374 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 4375 options.active = 0; 4376 } 4377 4378 this._processPanels(); 4379 4380 // handle negative values 4381 if ( options.active < 0 ) { 4382 options.active += this.headers.length; 4383 } 4384 this._refresh(); 4385 }, 4386 4387 _getCreateEventData: function() { 4388 return { 4389 header: this.active, 4390 panel: !this.active.length ? $() : this.active.next() 4391 }; 4392 }, 4393 4394 _createIcons: function() { 4395 var icon, children, 4396 icons = this.options.icons; 4397 4398 if ( icons ) { 4399 icon = $( "<span>" ); 4400 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 4401 icon.prependTo( this.headers ); 4402 children = this.active.children( ".ui-accordion-header-icon" ); 4403 this._removeClass( children, icons.header ) 4404 ._addClass( children, null, icons.activeHeader ) 4405 ._addClass( this.headers, "ui-accordion-icons" ); 4406 } 4407 }, 4408 4409 _destroyIcons: function() { 4410 this._removeClass( this.headers, "ui-accordion-icons" ); 4411 this.headers.children( ".ui-accordion-header-icon" ).remove(); 4412 }, 4413 4414 _destroy: function() { 4415 var contents; 4416 4417 // Clean up main element 4418 this.element.removeAttr( "role" ); 4419 4420 // Clean up headers 4421 this.headers 4422 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 4423 .removeUniqueId(); 4424 4425 this._destroyIcons(); 4426 4427 // Clean up content panels 4428 contents = this.headers.next() 4429 .css( "display", "" ) 4430 .removeAttr( "role aria-hidden aria-labelledby" ) 4431 .removeUniqueId(); 4432 4433 if ( this.options.heightStyle !== "content" ) { 4434 contents.css( "height", "" ); 4435 } 4436 }, 4437 4438 _setOption: function( key, value ) { 4439 if ( key === "active" ) { 4440 4441 // _activate() will handle invalid values and update this.options 4442 this._activate( value ); 4443 return; 4444 } 4445 4446 if ( key === "event" ) { 4447 if ( this.options.event ) { 4448 this._off( this.headers, this.options.event ); 4449 } 4450 this._setupEvents( value ); 4451 } 4452 4453 this._super( key, value ); 4454 4455 // Setting collapsible: false while collapsed; open first panel 4456 if ( key === "collapsible" && !value && this.options.active === false ) { 4457 this._activate( 0 ); 4458 } 4459 4460 if ( key === "icons" ) { 4461 this._destroyIcons(); 4462 if ( value ) { 4463 this._createIcons(); 4464 } 4465 } 4466 }, 4467 4468 _setOptionDisabled: function( value ) { 4469 this._super( value ); 4470 4471 this.element.attr( "aria-disabled", value ); 4472 4473 // Support: IE8 Only 4474 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 4475 // so we need to add the disabled class to the headers and panels 4476 this._toggleClass( null, "ui-state-disabled", !!value ); 4477 this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", 4478 !!value ); 4479 }, 4480 4481 _keydown: function( event ) { 4482 if ( event.altKey || event.ctrlKey ) { 4483 return; 4484 } 4485 4486 var keyCode = $.ui.keyCode, 4487 length = this.headers.length, 4488 currentIndex = this.headers.index( event.target ), 4489 toFocus = false; 4490 4491 switch ( event.keyCode ) { 4492 case keyCode.RIGHT: 4493 case keyCode.DOWN: 4494 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 4495 break; 4496 case keyCode.LEFT: 4497 case keyCode.UP: 4498 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 4499 break; 4500 case keyCode.SPACE: 4501 case keyCode.ENTER: 4502 this._eventHandler( event ); 4503 break; 4504 case keyCode.HOME: 4505 toFocus = this.headers[ 0 ]; 4506 break; 4507 case keyCode.END: 4508 toFocus = this.headers[ length - 1 ]; 4509 break; 4510 } 4511 4512 if ( toFocus ) { 4513 $( event.target ).attr( "tabIndex", -1 ); 4514 $( toFocus ).attr( "tabIndex", 0 ); 4515 $( toFocus ).trigger( "focus" ); 4516 event.preventDefault(); 4517 } 4518 }, 4519 4520 _panelKeyDown: function( event ) { 4521 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 4522 $( event.currentTarget ).prev().trigger( "focus" ); 4523 } 4524 }, 4525 4526 refresh: function() { 4527 var options = this.options; 4528 this._processPanels(); 4529 4530 // Was collapsed or no panel 4531 if ( ( options.active === false && options.collapsible === true ) || 4532 !this.headers.length ) { 4533 options.active = false; 4534 this.active = $(); 4535 4536 // active false only when collapsible is true 4537 } else if ( options.active === false ) { 4538 this._activate( 0 ); 4539 4540 // was active, but active panel is gone 4541 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 4542 4543 // all remaining panel are disabled 4544 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 4545 options.active = false; 4546 this.active = $(); 4547 4548 // activate previous panel 4549 } else { 4550 this._activate( Math.max( 0, options.active - 1 ) ); 4551 } 4552 4553 // was active, active panel still exists 4554 } else { 4555 4556 // make sure active index is correct 4557 options.active = this.headers.index( this.active ); 4558 } 4559 4560 this._destroyIcons(); 4561 4562 this._refresh();
vendor: 6,800 bytes, lines 4563-4800
4563 }, 4564 4565 _processPanels: function() { 4566 var prevHeaders = this.headers, 4567 prevPanels = this.panels; 4568 4569 this.headers = this.element.find( this.options.header ); 4570 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 4571 "ui-state-default" ); 4572 4573 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 4574 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 4575 4576 // Avoid memory leaks (#10056) 4577 if ( prevPanels ) { 4578 this._off( prevHeaders.not( this.headers ) ); 4579 this._off( prevPanels.not( this.panels ) ); 4580 } 4581 }, 4582 4583 _refresh: function() { 4584 var maxHeight, 4585 options = this.options, 4586 heightStyle = options.heightStyle, 4587 parent = this.element.parent(); 4588 4589 this.active = this._findActive( options.active ); 4590 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 4591 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 4592 this._addClass( this.active.next(), "ui-accordion-content-active" ); 4593 this.active.next().show(); 4594 4595 this.headers 4596 .attr( "role", "tab" ) 4597 .each( function() { 4598 var header = $( this ), 4599 headerId = header.uniqueId().attr( "id" ), 4600 panel = header.next(), 4601 panelId = panel.uniqueId().attr( "id" ); 4602 header.attr( "aria-controls", panelId ); 4603 panel.attr( "aria-labelledby", headerId ); 4604 } ) 4605 .next() 4606 .attr( "role", "tabpanel" ); 4607 4608 this.headers 4609 .not( this.active ) 4610 .attr( { 4611 "aria-selected": "false", 4612 "aria-expanded": "false", 4613 tabIndex: -1 4614 } ) 4615 .next() 4616 .attr( { 4617 "aria-hidden": "true" 4618 } ) 4619 .hide(); 4620 4621 // Make sure at least one header is in the tab order 4622 if ( !this.active.length ) { 4623 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 4624 } else { 4625 this.active.attr( { 4626 "aria-selected": "true", 4627 "aria-expanded": "true", 4628 tabIndex: 0 4629 } ) 4630 .next() 4631 .attr( { 4632 "aria-hidden": "false" 4633 } ); 4634 } 4635 4636 this._createIcons(); 4637 4638 this._setupEvents( options.event ); 4639 4640 if ( heightStyle === "fill" ) { 4641 maxHeight = parent.height(); 4642 this.element.siblings( ":visible" ).each( function() { 4643 var elem = $( this ), 4644 position = elem.css( "position" ); 4645 4646 if ( position === "absolute" || position === "fixed" ) { 4647 return; 4648 } 4649 maxHeight -= elem.outerHeight( true ); 4650 } ); 4651 4652 this.headers.each( function() { 4653 maxHeight -= $( this ).outerHeight( true ); 4654 } ); 4655 4656 this.headers.next() 4657 .each( function() { 4658 $( this ).height( Math.max( 0, maxHeight - 4659 $( this ).innerHeight() + $( this ).height() ) ); 4660 } ) 4661 .css( "overflow", "auto" ); 4662 } else if ( heightStyle === "auto" ) { 4663 maxHeight = 0; 4664 this.headers.next() 4665 .each( function() { 4666 var isVisible = $( this ).is( ":visible" ); 4667 if ( !isVisible ) { 4668 $( this ).show(); 4669 } 4670 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 4671 if ( !isVisible ) { 4672 $( this ).hide(); 4673 } 4674 } ) 4675 .height( maxHeight ); 4676 } 4677 }, 4678 4679 _activate: function( index ) { 4680 var active = this._findActive( index )[ 0 ]; 4681 4682 // Trying to activate the already active panel 4683 if ( active === this.active[ 0 ] ) { 4684 return; 4685 } 4686 4687 // Trying to collapse, simulate a click on the currently active header 4688 active = active || this.active[ 0 ]; 4689 4690 this._eventHandler( { 4691 target: active, 4692 currentTarget: active, 4693 preventDefault: $.noop 4694 } ); 4695 }, 4696 4697 _findActive: function( selector ) { 4698 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 4699 }, 4700 4701 _setupEvents: function( event ) { 4702 var events = { 4703 keydown: "_keydown" 4704 }; 4705 if ( event ) { 4706 $.each( event.split( " " ), function( index, eventName ) { 4707 events[ eventName ] = "_eventHandler"; 4708 } ); 4709 } 4710 4711 this._off( this.headers.add( this.headers.next() ) ); 4712 this._on( this.headers, events ); 4713 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 4714 this._hoverable( this.headers ); 4715 this._focusable( this.headers ); 4716 }, 4717 4718 _eventHandler: function( event ) { 4719 var activeChildren, clickedChildren, 4720 options = this.options, 4721 active = this.active, 4722 clicked = $( event.currentTarget ), 4723 clickedIsActive = clicked[ 0 ] === active[ 0 ], 4724 collapsing = clickedIsActive && options.collapsible, 4725 toShow = collapsing ? $() : clicked.next(), 4726 toHide = active.next(), 4727 eventData = { 4728 oldHeader: active, 4729 oldPanel: toHide, 4730 newHeader: collapsing ? $() : clicked, 4731 newPanel: toShow 4732 }; 4733 4734 event.preventDefault(); 4735 4736 if ( 4737 4738 // click on active header, but not collapsible 4739 ( clickedIsActive && !options.collapsible ) || 4740 4741 // allow canceling activation 4742 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 4743 return; 4744 } 4745 4746 options.active = collapsing ? false : this.headers.index( clicked ); 4747 4748 // When the call to ._toggle() comes after the class changes 4749 // it causes a very odd bug in IE 8 (see #6720) 4750 this.active = clickedIsActive ? $() : clicked; 4751 this._toggle( eventData ); 4752 4753 // Switch classes 4754 // corner classes on the previously active header stay after the animation 4755 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 4756 if ( options.icons ) { 4757 activeChildren = active.children( ".ui-accordion-header-icon" ); 4758 this._removeClass( activeChildren, null, options.icons.activeHeader ) 4759 ._addClass( activeChildren, null, options.icons.header ); 4760 } 4761 4762 if ( !clickedIsActive ) { 4763 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 4764 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 4765 if ( options.icons ) { 4766 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 4767 this._removeClass( clickedChildren, null, options.icons.header ) 4768 ._addClass( clickedChildren, null, options.icons.activeHeader ); 4769 } 4770 4771 this._addClass( clicked.next(), "ui-accordion-content-active" ); 4772 } 4773 }, 4774 4775 _toggle: function( data ) { 4776 var toShow = data.newPanel, 4777 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 4778 4779 // Handle activating a panel during the animation for another activation 4780 this.prevShow.add( this.prevHide ).stop( true, true ); 4781 this.prevShow = toShow; 4782 this.prevHide = toHide; 4783 4784 if ( this.options.animate ) { 4785 this._animate( toShow, toHide, data ); 4786 } else { 4787 toHide.hide(); 4788 toShow.show(); 4789 this._toggleComplete( data ); 4790 } 4791 4792 toHide.attr( { 4793 "aria-hidden": "true" 4794 } ); 4795 toHide.prev().attr( { 4796 "aria-selected": "false", 4797 "aria-expanded": "false" 4798 } ); 4799 4800 // if we're switching panels, remove the old header from the tab order
vendor: 7,571 bytes, lines 4801-5071
4801 // if we're opening from collapsed state, remove the previous header from the tab order 4802 // if we're collapsing, then keep the collapsing header in the tab order 4803 if ( toShow.length && toHide.length ) { 4804 toHide.prev().attr( { 4805 "tabIndex": -1, 4806 "aria-expanded": "false" 4807 } ); 4808 } else if ( toShow.length ) { 4809 this.headers.filter( function() { 4810 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 4811 } ) 4812 .attr( "tabIndex", -1 ); 4813 } 4814 4815 toShow 4816 .attr( "aria-hidden", "false" ) 4817 .prev() 4818 .attr( { 4819 "aria-selected": "true", 4820 "aria-expanded": "true", 4821 tabIndex: 0 4822 } ); 4823 }, 4824 4825 _animate: function( toShow, toHide, data ) { 4826 var total, easing, duration, 4827 that = this, 4828 adjust = 0, 4829 boxSizing = toShow.css( "box-sizing" ), 4830 down = toShow.length && 4831 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 4832 animate = this.options.animate || {}, 4833 options = down && animate.down || animate, 4834 complete = function() { 4835 that._toggleComplete( data ); 4836 }; 4837 4838 if ( typeof options === "number" ) { 4839 duration = options; 4840 } 4841 if ( typeof options === "string" ) { 4842 easing = options; 4843 } 4844 4845 // fall back from options to animation in case of partial down settings 4846 easing = easing || options.easing || animate.easing; 4847 duration = duration || options.duration || animate.duration; 4848 4849 if ( !toHide.length ) { 4850 return toShow.animate( this.showProps, duration, easing, complete ); 4851 } 4852 if ( !toShow.length ) { 4853 return toHide.animate( this.hideProps, duration, easing, complete ); 4854 } 4855 4856 total = toShow.show().outerHeight(); 4857 toHide.animate( this.hideProps, { 4858 duration: duration, 4859 easing: easing, 4860 step: function( now, fx ) { 4861 fx.now = Math.round( now ); 4862 } 4863 } ); 4864 toShow 4865 .hide() 4866 .animate( this.showProps, { 4867 duration: duration, 4868 easing: easing, 4869 complete: complete, 4870 step: function( now, fx ) { 4871 fx.now = Math.round( now ); 4872 if ( fx.prop !== "height" ) { 4873 if ( boxSizing === "content-box" ) { 4874 adjust += fx.now; 4875 } 4876 } else if ( that.options.heightStyle !== "content" ) { 4877 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 4878 adjust = 0; 4879 } 4880 } 4881 } ); 4882 }, 4883 4884 _toggleComplete: function( data ) { 4885 var toHide = data.oldPanel, 4886 prev = toHide.prev(); 4887 4888 this._removeClass( toHide, "ui-accordion-content-active" ); 4889 this._removeClass( prev, "ui-accordion-header-active" ) 4890 ._addClass( prev, "ui-accordion-header-collapsed" ); 4891 4892 // Work around for rendering bug in IE (#5421) 4893 if ( toHide.length ) { 4894 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; 4895 } 4896 this._trigger( "activate", null, data ); 4897 } 4898} ); 4899 4900 4901 4902var safeActiveElement = $.ui.safeActiveElement = function( document ) { 4903 var activeElement; 4904 4905 // Support: IE 9 only 4906 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 4907 try { 4908 activeElement = document.activeElement; 4909 } catch ( error ) { 4910 activeElement = document.body; 4911 } 4912 4913 // Support: IE 9 - 11 only 4914 // IE may return null instead of an element 4915 // Interestingly, this only seems to occur when NOT in an iframe 4916 if ( !activeElement ) { 4917 activeElement = document.body; 4918 } 4919 4920 // Support: IE 11 only 4921 // IE11 returns a seemingly empty object in some cases when accessing 4922 // document.activeElement from an <iframe> 4923 if ( !activeElement.nodeName ) { 4924 activeElement = document.body; 4925 } 4926 4927 return activeElement; 4928}; 4929 4930 4931/*! 4932 * jQuery UI Menu 1.12.0 4933 * http://jqueryui.com 4934 * 4935 * Copyright jQuery Foundation and other contributors 4936 * Released under the MIT license. 4937 * http://jquery.org/license 4938 */ 4939 4940//>>label: Menu 4941//>>group: Widgets 4942//>>description: Creates nestable menus. 4943//>>docs: http://api.jqueryui.com/menu/ 4944//>>demos: http://jqueryui.com/menu/ 4945//>>css.structure: ../../themes/base/core.css 4946//>>css.structure: ../../themes/base/menu.css 4947//>>css.theme: ../../themes/base/theme.css 4948 4949 4950 4951var widgetsMenu = $.widget( "ui.menu", { 4952 version: "1.12.0", 4953 defaultElement: "<ul>", 4954 delay: 300, 4955 options: { 4956 icons: { 4957 submenu: "ui-icon-caret-1-e" 4958 }, 4959 items: "> *", 4960 menus: "ul", 4961 position: { 4962 my: "left top", 4963 at: "right top" 4964 }, 4965 role: "menu", 4966 4967 // Callbacks 4968 blur: null, 4969 focus: null, 4970 select: null 4971 }, 4972 4973 _create: function() { 4974 this.activeMenu = this.element; 4975 4976 // Flag used to prevent firing of the click handler 4977 // as the event bubbles up through nested menus 4978 this.mouseHandled = false; 4979 this.element 4980 .uniqueId() 4981 .attr( { 4982 role: this.options.role, 4983 tabIndex: 0 4984 } ); 4985 4986 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 4987 this._on( { 4988 4989 // Prevent focus from sticking to links inside menu after clicking 4990 // them (focus should always stay on UL during navigation). 4991 "mousedown .ui-menu-item": function( event ) { 4992 event.preventDefault(); 4993 }, 4994 "click .ui-menu-item": function( event ) { 4995 var target = $( event.target ); 4996 var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 4997 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 4998 this.select( event ); 4999 5000 // Only set the mouseHandled flag if the event will bubble, see #9469. 5001 if ( !event.isPropagationStopped() ) { 5002 this.mouseHandled = true; 5003 } 5004 5005 // Open submenu on click 5006 if ( target.has( ".ui-menu" ).length ) { 5007 this.expand( event ); 5008 } else if ( !this.element.is( ":focus" ) && 5009 active.closest( ".ui-menu" ).length ) { 5010 5011 // Redirect focus to the menu 5012 this.element.trigger( "focus", [ true ] ); 5013 5014 // If the active item is on the top level, let it stay active. 5015 // Otherwise, blur the active item since it is no longer visible. 5016 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 5017 clearTimeout( this.timer ); 5018 } 5019 } 5020 } 5021 }, 5022 "mouseenter .ui-menu-item": function( event ) { 5023 5024 // Ignore mouse events while typeahead is active, see #10458. 5025 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5026 // is over an item in the menu 5027 if ( this.previousFilter ) { 5028 return; 5029 } 5030 5031 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 5032 target = $( event.currentTarget ); 5033 5034 // Ignore bubbled events on parent items, see #11641 5035 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 5036 return; 5037 } 5038 5039 // Remove ui-state-active class from siblings of the newly focused menu item 5040 // to avoid a jump caused by adjacent elements both having a class with a border 5041 this._removeClass( target.siblings().children( ".ui-state-active" ), 5042 null, "ui-state-active" ); 5043 this.focus( event, target ); 5044 }, 5045 mouseleave: "collapseAll", 5046 "mouseleave .ui-menu": "collapseAll", 5047 focus: function( event, keepActiveItem ) { 5048 5049 // If there's already an active item, keep it active 5050 // If not, activate the first item 5051 var item = this.active || this.element.find( this.options.items ).eq( 0 ); 5052 5053 if ( !keepActiveItem ) { 5054 this.focus( event, item ); 5055 } 5056 }, 5057 blur: function( event ) { 5058 this._delay( function() { 5059 var notContained = !$.contains( 5060 this.element[ 0 ], 5061 $.ui.safeActiveElement( this.document[ 0 ] ) 5062 ); 5063 if ( notContained ) { 5064 this.collapseAll( event ); 5065 } 5066 } ); 5067 }, 5068 keydown: "_keydown" 5069 } ); 5070 5071 this.refresh();
vendor: 4,279 bytes, lines 5072-5232
5072 5073 // Clicks outside of a menu collapse any open menus 5074 this._on( this.document, { 5075 click: function( event ) { 5076 if ( this._closeOnDocumentClick( event ) ) { 5077 this.collapseAll( event ); 5078 } 5079 5080 // Reset the mouseHandled flag 5081 this.mouseHandled = false; 5082 } 5083 } ); 5084 }, 5085 5086 _destroy: function() { 5087 var items = this.element.find( ".ui-menu-item" ) 5088 .removeAttr( "role aria-disabled" ), 5089 submenus = items.children( ".ui-menu-item-wrapper" ) 5090 .removeUniqueId() 5091 .removeAttr( "tabIndex role aria-haspopup" ); 5092 5093 // Destroy (sub)menus 5094 this.element 5095 .removeAttr( "aria-activedescendant" ) 5096 .find( ".ui-menu" ).addBack() 5097 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5098 "tabIndex" ) 5099 .removeUniqueId() 5100 .show(); 5101 5102 submenus.children().each( function() { 5103 var elem = $( this ); 5104 if ( elem.data( "ui-menu-submenu-caret" ) ) { 5105 elem.remove(); 5106 } 5107 } ); 5108 }, 5109 5110 _keydown: function( event ) { 5111 var match, prev, character, skip, 5112 preventDefault = true; 5113 5114 switch ( event.keyCode ) { 5115 case $.ui.keyCode.PAGE_UP: 5116 this.previousPage( event ); 5117 break; 5118 case $.ui.keyCode.PAGE_DOWN: 5119 this.nextPage( event ); 5120 break; 5121 case $.ui.keyCode.HOME: 5122 this._move( "first", "first", event ); 5123 break; 5124 case $.ui.keyCode.END: 5125 this._move( "last", "last", event ); 5126 break; 5127 case $.ui.keyCode.UP: 5128 this.previous( event ); 5129 break; 5130 case $.ui.keyCode.DOWN: 5131 this.next( event ); 5132 break; 5133 case $.ui.keyCode.LEFT: 5134 this.collapse( event ); 5135 break; 5136 case $.ui.keyCode.RIGHT: 5137 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5138 this.expand( event ); 5139 } 5140 break; 5141 case $.ui.keyCode.ENTER: 5142 case $.ui.keyCode.SPACE: 5143 this._activate( event ); 5144 break; 5145 case $.ui.keyCode.ESCAPE: 5146 this.collapse( event ); 5147 break; 5148 default: 5149 preventDefault = false; 5150 prev = this.previousFilter || ""; 5151 character = String.fromCharCode( event.keyCode ); 5152 skip = false; 5153 5154 clearTimeout( this.filterTimer ); 5155 5156 if ( character === prev ) { 5157 skip = true; 5158 } else { 5159 character = prev + character; 5160 } 5161 5162 match = this._filterMenuItems( character ); 5163 match = skip && match.index( this.active.next() ) !== -1 ? 5164 this.active.nextAll( ".ui-menu-item" ) : 5165 match; 5166 5167 // If no matches on the current filter, reset to the last character pressed 5168 // to move down the menu to the first item that starts with that character 5169 if ( !match.length ) { 5170 character = String.fromCharCode( event.keyCode ); 5171 match = this._filterMenuItems( character ); 5172 } 5173 5174 if ( match.length ) { 5175 this.focus( event, match ); 5176 this.previousFilter = character; 5177 this.filterTimer = this._delay( function() { 5178 delete this.previousFilter; 5179 }, 1000 ); 5180 } else { 5181 delete this.previousFilter; 5182 } 5183 } 5184 5185 if ( preventDefault ) { 5186 event.preventDefault(); 5187 } 5188 }, 5189 5190 _activate: function( event ) { 5191 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5192 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 5193 this.expand( event ); 5194 } else { 5195 this.select( event ); 5196 } 5197 } 5198 }, 5199 5200 refresh: function() { 5201 var menus, items, newSubmenus, newItems, newWrappers, 5202 that = this, 5203 icon = this.options.icons.submenu, 5204 submenus = this.element.find( this.options.menus ); 5205 5206 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 5207 5208 // Initialize nested menus 5209 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 5210 .hide() 5211 .attr( { 5212 role: this.options.role, 5213 "aria-hidden": "true", 5214 "aria-expanded": "false" 5215 } ) 5216 .each( function() { 5217 var menu = $( this ), 5218 item = menu.prev(), 5219 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 5220 5221 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 5222 item 5223 .attr( "aria-haspopup", "true" ) 5224 .prepend( submenuCaret ); 5225 menu.attr( "aria-labelledby", item.attr( "id" ) ); 5226 } ); 5227 5228 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 5229 5230 menus = submenus.add( this.element ); 5231 items = menus.find( this.options.items ); 5232
vendor: 4,715 bytes, lines 5233-5395
5233 // Initialize menu-items containing spaces and/or dashes only as dividers 5234 items.not( ".ui-menu-item" ).each( function() { 5235 var item = $( this ); 5236 if ( that._isDivider( item ) ) { 5237 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 5238 } 5239 } ); 5240 5241 // Don't refresh list items that are already adapted 5242 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 5243 newWrappers = newItems.children() 5244 .not( ".ui-menu" ) 5245 .uniqueId() 5246 .attr( { 5247 tabIndex: -1, 5248 role: this._itemRole() 5249 } ); 5250 this._addClass( newItems, "ui-menu-item" ) 5251 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 5252 5253 // Add aria-disabled attribute to any disabled menu item 5254 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 5255 5256 // If the active item has been removed, blur the menu 5257 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5258 this.blur(); 5259 } 5260 }, 5261 5262 _itemRole: function() { 5263 return { 5264 menu: "menuitem", 5265 listbox: "option" 5266 }[ this.options.role ]; 5267 }, 5268 5269 _setOption: function( key, value ) { 5270 if ( key === "icons" ) { 5271 var icons = this.element.find( ".ui-menu-icon" ); 5272 this._removeClass( icons, null, this.options.icons.submenu ) 5273 ._addClass( icons, null, value.submenu ); 5274 } 5275 this._super( key, value ); 5276 }, 5277 5278 _setOptionDisabled: function( value ) { 5279 this._super( value ); 5280 5281 this.element.attr( "aria-disabled", String( value ) ); 5282 this._toggleClass( null, "ui-state-disabled", !!value ); 5283 }, 5284 5285 focus: function( event, item ) { 5286 var nested, focused, activeParent; 5287 this.blur( event, event && event.type === "focus" ); 5288 5289 this._scrollIntoView( item ); 5290 5291 this.active = item.first(); 5292 5293 focused = this.active.children( ".ui-menu-item-wrapper" ); 5294 this._addClass( focused, null, "ui-state-active" ); 5295 5296 // Only update aria-activedescendant if there's a role 5297 // otherwise we assume focus is managed elsewhere 5298 if ( this.options.role ) { 5299 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 5300 } 5301 5302 // Highlight active parent menu item, if any 5303 activeParent = this.active 5304 .parent() 5305 .closest( ".ui-menu-item" ) 5306 .children( ".ui-menu-item-wrapper" ); 5307 this._addClass( activeParent, null, "ui-state-active" ); 5308 5309 if ( event && event.type === "keydown" ) { 5310 this._close(); 5311 } else { 5312 this.timer = this._delay( function() { 5313 this._close(); 5314 }, this.delay ); 5315 } 5316 5317 nested = item.children( ".ui-menu" ); 5318 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 5319 this._startOpening( nested ); 5320 } 5321 this.activeMenu = item.parent(); 5322 5323 this._trigger( "focus", event, { item: item } ); 5324 }, 5325 5326 _scrollIntoView: function( item ) { 5327 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5328 if ( this._hasScroll() ) { 5329 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 5330 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 5331 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5332 scroll = this.activeMenu.scrollTop(); 5333 elementHeight = this.activeMenu.height(); 5334 itemHeight = item.outerHeight(); 5335 5336 if ( offset < 0 ) { 5337 this.activeMenu.scrollTop( scroll + offset ); 5338 } else if ( offset + itemHeight > elementHeight ) { 5339 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 5340 } 5341 } 5342 }, 5343 5344 blur: function( event, fromFocus ) { 5345 if ( !fromFocus ) { 5346 clearTimeout( this.timer ); 5347 } 5348 5349 if ( !this.active ) { 5350 return; 5351 } 5352 5353 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 5354 null, "ui-state-active" ); 5355 5356 this._trigger( "blur", event, { item: this.active } ); 5357 this.active = null; 5358 }, 5359 5360 _startOpening: function( submenu ) { 5361 clearTimeout( this.timer ); 5362 5363 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5364 // shift in the submenu position when mousing over the caret icon 5365 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 5366 return; 5367 } 5368 5369 this.timer = this._delay( function() { 5370 this._close(); 5371 this._open( submenu ); 5372 }, this.delay ); 5373 }, 5374 5375 _open: function( submenu ) { 5376 var position = $.extend( { 5377 of: this.active 5378 }, this.options.position ); 5379 5380 clearTimeout( this.timer ); 5381 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 5382 .hide() 5383 .attr( "aria-hidden", "true" ); 5384 5385 submenu 5386 .show() 5387 .removeAttr( "aria-hidden" ) 5388 .attr( "aria-expanded", "true" ) 5389 .position( position ); 5390 }, 5391 5392 collapseAll: function( event, all ) { 5393 clearTimeout( this.timer ); 5394 this.timer = this._delay( function() { 5395
vendor: 36,931 bytes, lines 5396-6715
5396 // If we were passed an event, look for the submenu that contains the event 5397 var currentMenu = all ? this.element : 5398 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 5399 5400 // If we found no valid submenu ancestor, use the main menu to close all 5401 // sub menus anyway 5402 if ( !currentMenu.length ) { 5403 currentMenu = this.element; 5404 } 5405 5406 this._close( currentMenu ); 5407 5408 this.blur( event ); 5409 5410 // Work around active item staying active after menu is blurred 5411 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 5412 5413 this.activeMenu = currentMenu; 5414 }, this.delay ); 5415 }, 5416 5417 // With no arguments, closes the currently active menu - if nothing is active 5418 // it closes all menus. If passed an argument, it will search for menus BELOW 5419 _close: function( startMenu ) { 5420 if ( !startMenu ) { 5421 startMenu = this.active ? this.active.parent() : this.element; 5422 } 5423 5424 startMenu.find( ".ui-menu" ) 5425 .hide() 5426 .attr( "aria-hidden", "true" ) 5427 .attr( "aria-expanded", "false" ); 5428 }, 5429 5430 _closeOnDocumentClick: function( event ) { 5431 return !$( event.target ).closest( ".ui-menu" ).length; 5432 }, 5433 5434 _isDivider: function( item ) { 5435 5436 // Match hyphen, em dash, en dash 5437 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 5438 }, 5439 5440 collapse: function( event ) { 5441 var newItem = this.active && 5442 this.active.parent().closest( ".ui-menu-item", this.element ); 5443 if ( newItem && newItem.length ) { 5444 this._close(); 5445 this.focus( event, newItem ); 5446 } 5447 }, 5448 5449 expand: function( event ) { 5450 var newItem = this.active && 5451 this.active 5452 .children( ".ui-menu " ) 5453 .find( this.options.items ) 5454 .first(); 5455 5456 if ( newItem && newItem.length ) { 5457 this._open( newItem.parent() ); 5458 5459 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 5460 this._delay( function() { 5461 this.focus( event, newItem ); 5462 } ); 5463 } 5464 }, 5465 5466 next: function( event ) { 5467 this._move( "next", "first", event ); 5468 }, 5469 5470 previous: function( event ) { 5471 this._move( "prev", "last", event ); 5472 }, 5473 5474 isFirstItem: function() { 5475 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 5476 }, 5477 5478 isLastItem: function() { 5479 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 5480 }, 5481 5482 _move: function( direction, filter, event ) { 5483 var next; 5484 if ( this.active ) { 5485 if ( direction === "first" || direction === "last" ) { 5486 next = this.active 5487 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 5488 .eq( -1 ); 5489 } else { 5490 next = this.active 5491 [ direction + "All" ]( ".ui-menu-item" ) 5492 .eq( 0 ); 5493 } 5494 } 5495 if ( !next || !next.length || !this.active ) { 5496 next = this.activeMenu.find( this.options.items )[ filter ](); 5497 } 5498 5499 this.focus( event, next ); 5500 }, 5501 5502 nextPage: function( event ) { 5503 var item, base, height; 5504 5505 if ( !this.active ) { 5506 this.next( event ); 5507 return; 5508 } 5509 if ( this.isLastItem() ) { 5510 return; 5511 } 5512 if ( this._hasScroll() ) { 5513 base = this.active.offset().top; 5514 height = this.element.height(); 5515 this.active.nextAll( ".ui-menu-item" ).each( function() { 5516 item = $( this ); 5517 return item.offset().top - base - height < 0; 5518 } ); 5519 5520 this.focus( event, item ); 5521 } else { 5522 this.focus( event, this.activeMenu.find( this.options.items ) 5523 [ !this.active ? "first" : "last" ]() ); 5524 } 5525 }, 5526 5527 previousPage: function( event ) { 5528 var item, base, height; 5529 if ( !this.active ) { 5530 this.next( event ); 5531 return; 5532 } 5533 if ( this.isFirstItem() ) { 5534 return; 5535 } 5536 if ( this._hasScroll() ) { 5537 base = this.active.offset().top; 5538 height = this.element.height(); 5539 this.active.prevAll( ".ui-menu-item" ).each( function() { 5540 item = $( this ); 5541 return item.offset().top - base + height > 0; 5542 } ); 5543 5544 this.focus( event, item ); 5545 } else { 5546 this.focus( event, this.activeMenu.find( this.options.items ).first() ); 5547 } 5548 }, 5549 5550 _hasScroll: function() { 5551 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 5552 }, 5553 5554 select: function( event ) { 5555 5556 // TODO: It should never be possible to not have an active item at this 5557 // point, but the tests don't trigger mouseenter before click. 5558 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 5559 var ui = { item: this.active }; 5560 if ( !this.active.has( ".ui-menu" ).length ) { 5561 this.collapseAll( event, true ); 5562 } 5563 this._trigger( "select", event, ui ); 5564 }, 5565 5566 _filterMenuItems: function( character ) { 5567 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 5568 regex = new RegExp( "^" + escapedCharacter, "i" ); 5569 5570 return this.activeMenu 5571 .find( this.options.items ) 5572 5573 // Only match on items, not dividers or other content (#10571) 5574 .filter( ".ui-menu-item" ) 5575 .filter( function() { 5576 return regex.test( 5577 $.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 5578 } ); 5579 } 5580} ); 5581 5582 5583/*! 5584 * jQuery UI Autocomplete 1.12.0 5585 * http://jqueryui.com 5586 * 5587 * Copyright jQuery Foundation and other contributors 5588 * Released under the MIT license. 5589 * http://jquery.org/license 5590 */ 5591 5592//>>label: Autocomplete 5593//>>group: Widgets 5594//>>description: Lists suggested words as the user is typing. 5595//>>docs: http://api.jqueryui.com/autocomplete/ 5596//>>demos: http://jqueryui.com/autocomplete/ 5597//>>css.structure: ../../themes/base/core.css 5598//>>css.structure: ../../themes/base/autocomplete.css 5599//>>css.theme: ../../themes/base/theme.css 5600 5601 5602 5603$.widget( "ui.autocomplete", { 5604 version: "1.12.0", 5605 defaultElement: "<input>", 5606 options: { 5607 appendTo: null, 5608 autoFocus: false, 5609 delay: 300, 5610 minLength: 1, 5611 position: { 5612 my: "left top", 5613 at: "left bottom", 5614 collision: "none" 5615 }, 5616 source: null, 5617 5618 // Callbacks 5619 change: null, 5620 close: null, 5621 focus: null, 5622 open: null, 5623 response: null, 5624 search: null, 5625 select: null 5626 }, 5627 5628 requestIndex: 0, 5629 pending: 0, 5630 5631 _create: function() { 5632 5633 // Some browsers only repeat keydown events, not keypress events, 5634 // so we use the suppressKeyPress flag to determine if we've already 5635 // handled the keydown event. #7269 5636 // Unfortunately the code for & in keypress is the same as the up arrow, 5637 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 5638 // events when we know the keydown event was used to modify the 5639 // search term. #7799 5640 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 5641 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 5642 isTextarea = nodeName === "textarea", 5643 isInput = nodeName === "input"; 5644 5645 // Textareas are always multi-line 5646 // Inputs are always single-line, even if inside a contentEditable element 5647 // IE also treats inputs as contentEditable 5648 // All other element types are determined by whether or not they're contentEditable 5649 this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); 5650 5651 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 5652 this.isNewMenu = true; 5653 5654 this._addClass( "ui-autocomplete-input" ); 5655 this.element.attr( "autocomplete", "off" ); 5656 5657 this._on( this.element, { 5658 keydown: function( event ) { 5659 if ( this.element.prop( "readOnly" ) ) { 5660 suppressKeyPress = true; 5661 suppressInput = true; 5662 suppressKeyPressRepeat = true; 5663 return; 5664 } 5665 5666 suppressKeyPress = false; 5667 suppressInput = false; 5668 suppressKeyPressRepeat = false; 5669 var keyCode = $.ui.keyCode; 5670 switch ( event.keyCode ) { 5671 case keyCode.PAGE_UP: 5672 suppressKeyPress = true; 5673 this._move( "previousPage", event ); 5674 break; 5675 case keyCode.PAGE_DOWN: 5676 suppressKeyPress = true; 5677 this._move( "nextPage", event ); 5678 break; 5679 case keyCode.UP: 5680 suppressKeyPress = true; 5681 this._keyEvent( "previous", event ); 5682 break; 5683 case keyCode.DOWN: 5684 suppressKeyPress = true; 5685 this._keyEvent( "next", event ); 5686 break; 5687 case keyCode.ENTER: 5688 5689 // when menu is open and has focus 5690 if ( this.menu.active ) { 5691 5692 // #6055 - Opera still allows the keypress to occur 5693 // which causes forms to submit 5694 suppressKeyPress = true; 5695 event.preventDefault(); 5696 this.menu.select( event ); 5697 } 5698 break; 5699 case keyCode.TAB: 5700 if ( this.menu.active ) { 5701 this.menu.select( event ); 5702 } 5703 break; 5704 case keyCode.ESCAPE: 5705 if ( this.menu.element.is( ":visible" ) ) { 5706 if ( !this.isMultiLine ) { 5707 this._value( this.term ); 5708 } 5709 this.close( event ); 5710 5711 // Different browsers have different default behavior for escape 5712 // Single press can mean undo or clear 5713 // Double press in IE means clear the whole form 5714 event.preventDefault(); 5715 } 5716 break; 5717 default: 5718 suppressKeyPressRepeat = true; 5719 5720 // search timeout should be triggered before the input value is changed 5721 this._searchTimeout( event ); 5722 break; 5723 } 5724 }, 5725 keypress: function( event ) { 5726 if ( suppressKeyPress ) { 5727 suppressKeyPress = false; 5728 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 5729 event.preventDefault(); 5730 } 5731 return; 5732 } 5733 if ( suppressKeyPressRepeat ) { 5734 return; 5735 } 5736 5737 // Replicate some key handlers to allow them to repeat in Firefox and Opera 5738 var keyCode = $.ui.keyCode; 5739 switch ( event.keyCode ) { 5740 case keyCode.PAGE_UP: 5741 this._move( "previousPage", event ); 5742 break; 5743 case keyCode.PAGE_DOWN: 5744 this._move( "nextPage", event ); 5745 break; 5746 case keyCode.UP: 5747 this._keyEvent( "previous", event ); 5748 break; 5749 case keyCode.DOWN: 5750 this._keyEvent( "next", event ); 5751 break; 5752 } 5753 }, 5754 input: function( event ) { 5755 if ( suppressInput ) { 5756 suppressInput = false; 5757 event.preventDefault(); 5758 return; 5759 } 5760 this._searchTimeout( event ); 5761 }, 5762 focus: function() { 5763 this.selectedItem = null; 5764 this.previous = this._value(); 5765 }, 5766 blur: function( event ) { 5767 if ( this.cancelBlur ) { 5768 delete this.cancelBlur; 5769 return; 5770 } 5771 5772 clearTimeout( this.searching ); 5773 this.close( event ); 5774 this._change( event ); 5775 } 5776 } ); 5777 5778 this._initSource(); 5779 this.menu = $( "<ul>" ) 5780 .appendTo( this._appendTo() ) 5781 .menu( { 5782 5783 // disable ARIA support, the live region takes care of that 5784 role: null 5785 } ) 5786 .hide() 5787 .menu( "instance" ); 5788 5789 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 5790 this._on( this.menu.element, { 5791 mousedown: function( event ) { 5792 5793 // prevent moving focus out of the text field 5794 event.preventDefault(); 5795 5796 // IE doesn't prevent moving focus even with event.preventDefault() 5797 // so we set a flag to know when we should ignore the blur event 5798 this.cancelBlur = true; 5799 this._delay( function() { 5800 delete this.cancelBlur; 5801 5802 // Support: IE 8 only 5803 // Right clicking a menu item or selecting text from the menu items will 5804 // result in focus moving out of the input. However, we've already received 5805 // and ignored the blur event because of the cancelBlur flag set above. So 5806 // we restore focus to ensure that the menu closes properly based on the user's 5807 // next actions. 5808 if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { 5809 this.element.trigger( "focus" ); 5810 } 5811 } ); 5812 }, 5813 menufocus: function( event, ui ) { 5814 var label, item; 5815 5816 // support: Firefox 5817 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 5818 if ( this.isNewMenu ) { 5819 this.isNewMenu = false; 5820 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 5821 this.menu.blur(); 5822 5823 this.document.one( "mousemove", function() { 5824 $( event.target ).trigger( event.originalEvent ); 5825 } ); 5826 5827 return; 5828 } 5829 } 5830 5831 item = ui.item.data( "ui-autocomplete-item" ); 5832 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 5833 5834 // use value to match what will end up in the input, if it was a key event 5835 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 5836 this._value( item.value ); 5837 } 5838 } 5839 5840 // Announce the value in the liveRegion 5841 label = ui.item.attr( "aria-label" ) || item.value; 5842 if ( label && $.trim( label ).length ) { 5843 this.liveRegion.children().hide(); 5844 $( "<div>" ).text( label ).appendTo( this.liveRegion ); 5845 } 5846 }, 5847 menuselect: function( event, ui ) { 5848 var item = ui.item.data( "ui-autocomplete-item" ), 5849 previous = this.previous; 5850 5851 // Only trigger when focus was lost (click on menu) 5852 if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { 5853 this.element.trigger( "focus" ); 5854 this.previous = previous; 5855 5856 // #6109 - IE triggers two focus events and the second 5857 // is asynchronous, so we need to reset the previous 5858 // term synchronously and asynchronously :-( 5859 this._delay( function() { 5860 this.previous = previous; 5861 this.selectedItem = item; 5862 } ); 5863 } 5864 5865 if ( false !== this._trigger( "select", event, { item: item } ) ) { 5866 this._value( item.value ); 5867 } 5868 5869 // reset the term after the select event 5870 // this allows custom select handling to work properly 5871 this.term = this._value(); 5872 5873 this.close( event ); 5874 this.selectedItem = item; 5875 } 5876 } ); 5877 5878 this.liveRegion = $( "<div>", { 5879 role: "status", 5880 "aria-live": "assertive", 5881 "aria-relevant": "additions" 5882 } ) 5883 .appendTo( this.document[ 0 ].body ); 5884 5885 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 5886 5887 // Turning off autocomplete prevents the browser from remembering the 5888 // value when navigating through history, so we re-enable autocomplete 5889 // if the page is unloaded before the widget is destroyed. #7790 5890 this._on( this.window, { 5891 beforeunload: function() { 5892 this.element.removeAttr( "autocomplete" ); 5893 } 5894 } ); 5895 }, 5896 5897 _destroy: function() { 5898 clearTimeout( this.searching ); 5899 this.element.removeAttr( "autocomplete" ); 5900 this.menu.element.remove(); 5901 this.liveRegion.remove(); 5902 }, 5903 5904 _setOption: function( key, value ) { 5905 this._super( key, value ); 5906 if ( key === "source" ) { 5907 this._initSource(); 5908 } 5909 if ( key === "appendTo" ) { 5910 this.menu.element.appendTo( this._appendTo() ); 5911 } 5912 if ( key === "disabled" && value && this.xhr ) { 5913 this.xhr.abort(); 5914 } 5915 }, 5916 5917 _isEventTargetInWidget: function( event ) { 5918 var menuElement = this.menu.element[ 0 ]; 5919 5920 return event.target === this.element[ 0 ] || 5921 event.target === menuElement || 5922 $.contains( menuElement, event.target ); 5923 }, 5924 5925 _closeOnClickOutside: function( event ) { 5926 if ( !this._isEventTargetInWidget( event ) ) { 5927 this.close(); 5928 } 5929 }, 5930 5931 _appendTo: function() { 5932 var element = this.options.appendTo; 5933 5934 if ( element ) { 5935 element = element.jquery || element.nodeType ? 5936 $( element ) : 5937 this.document.find( element ).eq( 0 ); 5938 } 5939 5940 if ( !element || !element[ 0 ] ) { 5941 element = this.element.closest( ".ui-front, dialog" ); 5942 } 5943 5944 if ( !element.length ) { 5945 element = this.document[ 0 ].body; 5946 } 5947 5948 return element; 5949 }, 5950 5951 _initSource: function() { 5952 var array, url, 5953 that = this; 5954 if ( $.isArray( this.options.source ) ) { 5955 array = this.options.source; 5956 this.source = function( request, response ) { 5957 response( $.ui.autocomplete.filter( array, request.term ) ); 5958 }; 5959 } else if ( typeof this.options.source === "string" ) { 5960 url = this.options.source; 5961 this.source = function( request, response ) { 5962 if ( that.xhr ) { 5963 that.xhr.abort(); 5964 } 5965 that.xhr = $.ajax( { 5966 url: url, 5967 data: request, 5968 dataType: "json", 5969 success: function( data ) { 5970 response( data ); 5971 }, 5972 error: function() { 5973 response( [] ); 5974 } 5975 } ); 5976 }; 5977 } else { 5978 this.source = this.options.source; 5979 } 5980 }, 5981 5982 _searchTimeout: function( event ) { 5983 clearTimeout( this.searching ); 5984 this.searching = this._delay( function() { 5985 5986 // Search if the value has changed, or if the user retypes the same value (see #7434) 5987 var equalValues = this.term === this._value(), 5988 menuVisible = this.menu.element.is( ":visible" ), 5989 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 5990 5991 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 5992 this.selectedItem = null; 5993 this.search( null, event ); 5994 } 5995 }, this.options.delay ); 5996 }, 5997 5998 search: function( value, event ) { 5999 value = value != null ? value : this._value(); 6000 6001 // Always save the actual value, not the one passed as an argument 6002 this.term = this._value(); 6003 6004 if ( value.length < this.options.minLength ) { 6005 return this.close( event ); 6006 } 6007 6008 if ( this._trigger( "search", event ) === false ) { 6009 return; 6010 } 6011 6012 return this._search( value ); 6013 }, 6014 6015 _search: function( value ) { 6016 this.pending++; 6017 this._addClass( "ui-autocomplete-loading" ); 6018 this.cancelSearch = false; 6019 6020 this.source( { term: value }, this._response() ); 6021 }, 6022 6023 _response: function() { 6024 var index = ++this.requestIndex; 6025 6026 return $.proxy( function( content ) { 6027 if ( index === this.requestIndex ) { 6028 this.__response( content ); 6029 } 6030 6031 this.pending--; 6032 if ( !this.pending ) { 6033 this._removeClass( "ui-autocomplete-loading" ); 6034 } 6035 }, this ); 6036 }, 6037 6038 __response: function( content ) { 6039 if ( content ) { 6040 content = this._normalize( content ); 6041 } 6042 this._trigger( "response", null, { content: content } ); 6043 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 6044 this._suggest( content ); 6045 this._trigger( "open" ); 6046 } else { 6047 6048 // use ._close() instead of .close() so we don't cancel future searches 6049 this._close(); 6050 } 6051 }, 6052 6053 close: function( event ) { 6054 this.cancelSearch = true; 6055 this._close( event ); 6056 }, 6057 6058 _close: function( event ) { 6059 6060 // Remove the handler that closes the menu on outside clicks 6061 this._off( this.document, "mousedown" ); 6062 6063 if ( this.menu.element.is( ":visible" ) ) { 6064 this.menu.element.hide(); 6065 this.menu.blur(); 6066 this.isNewMenu = true; 6067 this._trigger( "close", event ); 6068 } 6069 }, 6070 6071 _change: function( event ) { 6072 if ( this.previous !== this._value() ) { 6073 this._trigger( "change", event, { item: this.selectedItem } ); 6074 } 6075 }, 6076 6077 _normalize: function( items ) { 6078 6079 // assume all items have the right format when the first item is complete 6080 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 6081 return items; 6082 } 6083 return $.map( items, function( item ) { 6084 if ( typeof item === "string" ) { 6085 return { 6086 label: item, 6087 value: item 6088 }; 6089 } 6090 return $.extend( {}, item, { 6091 label: item.label || item.value, 6092 value: item.value || item.label 6093 } ); 6094 } ); 6095 }, 6096 6097 _suggest: function( items ) { 6098 var ul = this.menu.element.empty(); 6099 this._renderMenu( ul, items ); 6100 this.isNewMenu = true; 6101 this.menu.refresh(); 6102 6103 // Size and position menu 6104 ul.show(); 6105 this._resizeMenu(); 6106 ul.position( $.extend( { 6107 of: this.element 6108 }, this.options.position ) ); 6109 6110 if ( this.options.autoFocus ) { 6111 this.menu.next(); 6112 } 6113 6114 // Listen for interactions outside of the widget (#6642) 6115 this._on( this.document, { 6116 mousedown: "_closeOnClickOutside" 6117 } ); 6118 }, 6119 6120 _resizeMenu: function() { 6121 var ul = this.menu.element; 6122 ul.outerWidth( Math.max( 6123 6124 // Firefox wraps long text (possibly a rounding bug) 6125 // so we add 1px to avoid the wrapping (#7513) 6126 ul.width( "" ).outerWidth() + 1, 6127 this.element.outerWidth() 6128 ) ); 6129 }, 6130 6131 _renderMenu: function( ul, items ) { 6132 var that = this; 6133 $.each( items, function( index, item ) { 6134 that._renderItemData( ul, item ); 6135 } ); 6136 }, 6137 6138 _renderItemData: function( ul, item ) { 6139 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 6140 }, 6141 6142 _renderItem: function( ul, item ) { 6143 return $( "<li>" ) 6144 .append( $( "<div>" ).text( item.label ) ) 6145 .appendTo( ul ); 6146 }, 6147 6148 _move: function( direction, event ) { 6149 if ( !this.menu.element.is( ":visible" ) ) { 6150 this.search( null, event ); 6151 return; 6152 } 6153 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 6154 this.menu.isLastItem() && /^next/.test( direction ) ) { 6155 6156 if ( !this.isMultiLine ) { 6157 this._value( this.term ); 6158 } 6159 6160 this.menu.blur(); 6161 return; 6162 } 6163 this.menu[ direction ]( event ); 6164 }, 6165 6166 widget: function() { 6167 return this.menu.element; 6168 }, 6169 6170 _value: function() { 6171 return this.valueMethod.apply( this.element, arguments ); 6172 }, 6173 6174 _keyEvent: function( keyEvent, event ) { 6175 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6176 this._move( keyEvent, event ); 6177 6178 // Prevents moving cursor to beginning/end of the text field in some browsers 6179 event.preventDefault(); 6180 } 6181 }, 6182 6183 // Support: Chrome <=50 6184 // We should be able to just use this.element.prop( "isContentEditable" ) 6185 // but hidden elements always report false in Chrome. 6186 // https://code.google.com/p/chromium/issues/detail?id=313082 6187 _isContentEditable: function( element ) { 6188 if ( !element.length ) { 6189 return false; 6190 } 6191 6192 var editable = element.prop( "contentEditable" ); 6193 6194 if ( editable === "inherit" ) { 6195 return this._isContentEditable( element.parent() ); 6196 } 6197 6198 return editable === "true"; 6199 } 6200} ); 6201 6202$.extend( $.ui.autocomplete, { 6203 escapeRegex: function( value ) { 6204 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 6205 }, 6206 filter: function( array, term ) { 6207 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 6208 return $.grep( array, function( value ) { 6209 return matcher.test( value.label || value.value || value ); 6210 } ); 6211 } 6212} ); 6213 6214// Live region extension, adding a `messages` option 6215// NOTE: This is an experimental API. We are still investigating 6216// a full solution for string manipulation and internationalization. 6217$.widget( "ui.autocomplete", $.ui.autocomplete, { 6218 options: { 6219 messages: { 6220 noResults: "No search results.", 6221 results: function( amount ) { 6222 return amount + ( amount > 1 ? " results are" : " result is" ) + 6223 " available, use up and down arrow keys to navigate."; 6224 } 6225 } 6226 }, 6227 6228 __response: function( content ) { 6229 var message; 6230 this._superApply( arguments ); 6231 if ( this.options.disabled || this.cancelSearch ) { 6232 return; 6233 } 6234 if ( content && content.length ) { 6235 message = this.options.messages.results( content.length ); 6236 } else { 6237 message = this.options.messages.noResults; 6238 } 6239 this.liveRegion.children().hide(); 6240 $( "<div>" ).text( message ).appendTo( this.liveRegion ); 6241 } 6242} ); 6243 6244var widgetsAutocomplete = $.ui.autocomplete; 6245 6246 6247/*! 6248 * jQuery UI Controlgroup 1.12.0 6249 * http://jqueryui.com 6250 * 6251 * Copyright jQuery Foundation and other contributors 6252 * Released under the MIT license. 6253 * http://jquery.org/license 6254 */ 6255 6256//>>label: Controlgroup 6257//>>group: Widgets 6258//>>description: Visually groups form control widgets 6259//>>docs: http://api.jqueryui.com/controlgroup/ 6260//>>demos: http://jqueryui.com/controlgroup/ 6261//>>css.structure: ../../themes/base/core.css 6262//>>css.structure: ../../themes/base/controlgroup.css 6263//>>css.theme: ../../themes/base/theme.css 6264 6265 6266var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6267 6268var widgetsControlgroup = $.widget( "ui.controlgroup", { 6269 version: "1.12.0", 6270 defaultElement: "<div>", 6271 options: { 6272 direction: "horizontal", 6273 disabled: null, 6274 onlyVisible: true, 6275 items: { 6276 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6277 "controlgroupLabel": ".ui-controlgroup-label", 6278 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6279 "selectmenu": "select", 6280 "spinner": ".ui-spinner-input" 6281 } 6282 }, 6283 6284 _create: function() { 6285 this._enhance(); 6286 }, 6287 6288 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6289 _enhance: function() { 6290 this.element.attr( "role", "toolbar" ); 6291 this.refresh(); 6292 }, 6293 6294 _destroy: function() { 6295 this._callChildMethod( "destroy" ); 6296 this.childWidgets.removeData( "ui-controlgroup-data" ); 6297 this.element.removeAttr( "role" ); 6298 if ( this.options.items.controlgroupLabel ) { 6299 this.element 6300 .find( this.options.items.controlgroupLabel ) 6301 .find( ".ui-controlgroup-label-contents" ) 6302 .contents().unwrap(); 6303 } 6304 }, 6305 6306 _initWidgets: function() { 6307 var that = this, 6308 childWidgets = []; 6309 6310 // First we iterate over each of the items options 6311 $.each( this.options.items, function( widget, selector ) { 6312 var labels; 6313 var options = {}; 6314 6315 6316 // Make sure the widget has a selector set 6317 if ( !selector ) { 6318 return; 6319 } 6320 6321 if ( widget === "controlgroupLabel" ) { 6322 labels = that.element.find( selector ); 6323 labels.each( function() { 6324 var element = $( this ); 6325 6326 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 6327 return; 6328 } 6329 element.contents() 6330 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 6331 } ); 6332 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 6333 childWidgets = childWidgets.concat( labels.get() ); 6334 return; 6335 } 6336 6337 // Make sure the widget actually exists 6338 if ( !$.fn[ widget ] ) { 6339 return; 6340 } 6341 6342 // We assume everything is in the middle to start because we can't determine 6343 // first / last elements until all enhancments are done. 6344 if ( that[ "_" + widget + "Options" ] ) { 6345 options = that[ "_" + widget + "Options" ]( "middle" ); 6346 } 6347 6348 // Find instances of this widget inside controlgroup and init them 6349 that.element 6350 .find( selector ) 6351 .each( function() { 6352 var element = $( this ); 6353 var instance = element[ widget ]( "instance" ); 6354 6355 // We need to clone the default options for this type of widget to avoid 6356 // polluting the variable options which has a wider scope than a single widget. 6357 var instanceOptions = $.widget.extend( {}, options ); 6358 6359 // If the button is the child of a spinner ignore it 6360 // TODO: Find a more generic solution 6361 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 6362 return; 6363 } 6364 6365 // Create the widget if it doesn't exist 6366 if ( !instance ) { 6367 instance = element[ widget ]()[ widget ]( "instance" ); 6368 } 6369 if ( instance ) { 6370 instanceOptions.classes = 6371 that._resolveClassesValues( instanceOptions.classes, instance ); 6372 } 6373 element[ widget ]( instanceOptions ); 6374 6375 // Store an instance of the controlgroup to be able to reference 6376 // from the outermost element for changing options and refresh 6377 var widgetElement = element[ widget ]( "widget" ); 6378 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 6379 instance ? instance : element[ widget ]( "instance" ) ); 6380 6381 childWidgets.push( widgetElement[ 0 ] ); 6382 } ); 6383 } ); 6384 6385 this.childWidgets = $( $.unique( childWidgets ) ); 6386 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 6387 }, 6388 6389 _callChildMethod: function( method ) { 6390 this.childWidgets.each( function() { 6391 var element = $( this ), 6392 data = element.data( "ui-controlgroup-data" ); 6393 if ( data && data[ method ] ) { 6394 data[ method ](); 6395 } 6396 } ); 6397 }, 6398 6399 _updateCornerClass: function( element, position ) { 6400 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6401 var add = this._buildSimpleOptions( position, "label" ).classes.label; 6402 6403 this._removeClass( element, null, remove ); 6404 this._addClass( element, null, add ); 6405 }, 6406 6407 _buildSimpleOptions: function( position, key ) { 6408 var direction = this.options.direction === "vertical"; 6409 var result = { 6410 classes: {} 6411 }; 6412 result.classes[ key ] = { 6413 "middle": "", 6414 "first": "ui-corner-" + ( direction ? "top" : "left" ), 6415 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 6416 "only": "ui-corner-all" 6417 }[ position ]; 6418 6419 return result; 6420 }, 6421 6422 _spinnerOptions: function( position ) { 6423 var options = this._buildSimpleOptions( position, "ui-spinner" ); 6424 6425 options.classes[ "ui-spinner-up" ] = ""; 6426 options.classes[ "ui-spinner-down" ] = ""; 6427 6428 return options; 6429 }, 6430 6431 _buttonOptions: function( position ) { 6432 return this._buildSimpleOptions( position, "ui-button" ); 6433 }, 6434 6435 _checkboxradioOptions: function( position ) { 6436 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 6437 }, 6438 6439 _selectmenuOptions: function( position ) { 6440 var direction = this.options.direction === "vertical"; 6441 return { 6442 width: direction ? "auto" : false, 6443 classes: { 6444 middle: { 6445 "ui-selectmenu-button-open": "", 6446 "ui-selectmenu-button-closed": "" 6447 }, 6448 first: { 6449 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 6450 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 6451 }, 6452 last: { 6453 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 6454 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 6455 }, 6456 only: { 6457 "ui-selectmenu-button-open": "ui-corner-top", 6458 "ui-selectmenu-button-closed": "ui-corner-all" 6459 } 6460 6461 }[ position ] 6462 }; 6463 }, 6464 6465 _resolveClassesValues: function( classes, instance ) { 6466 var result = {}; 6467 $.each( classes, function( key ) { 6468 var current = instance.options.classes[ key ] || ""; 6469 current = current.replace( controlgroupCornerRegex, "" ).trim(); 6470 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 6471 } ); 6472 return result; 6473 }, 6474 6475 _setOption: function( key, value ) { 6476 if ( key === "direction" ) { 6477 this._removeClass( "ui-controlgroup-" + this.options.direction ); 6478 } 6479 6480 this._super( key, value ); 6481 if ( key === "disabled" ) { 6482 this._callChildMethod( value ? "disable" : "enable" ); 6483 return; 6484 } 6485 6486 this.refresh(); 6487 }, 6488 6489 refresh: function() { 6490 var children, 6491 that = this; 6492 6493 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 6494 6495 if ( this.options.direction === "horizontal" ) { 6496 this._addClass( null, "ui-helper-clearfix" ); 6497 } 6498 this._initWidgets(); 6499 6500 children = this.childWidgets; 6501 6502 // We filter here because we need to track all childWidgets not just the visible ones 6503 if ( this.options.onlyVisible ) { 6504 children = children.filter( ":visible" ); 6505 } 6506 6507 if ( children.length ) { 6508 6509 // We do this last because we need to make sure all enhancment is done 6510 // before determining first and last 6511 $.each( [ "first", "last" ], function( index, value ) { 6512 var instance = children[ value ]().data( "ui-controlgroup-data" ); 6513 6514 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 6515 var options = that[ "_" + instance.widgetName + "Options" ]( 6516 children.length === 1 ? "only" : value 6517 ); 6518 options.classes = that._resolveClassesValues( options.classes, instance ); 6519 instance.element[ instance.widgetName ]( options ); 6520 } else { 6521 that._updateCornerClass( children[ value ](), value ); 6522 } 6523 } ); 6524 6525 // Finally call the refresh method on each of the child widgets. 6526 this._callChildMethod( "refresh" ); 6527 } 6528 } 6529} ); 6530 6531/*! 6532 * jQuery UI Checkboxradio 1.12.0 6533 * http://jqueryui.com 6534 * 6535 * Copyright jQuery Foundation and other contributors 6536 * Released under the MIT license. 6537 * http://jquery.org/license 6538 */ 6539 6540//>>label: Checkboxradio 6541//>>group: Widgets 6542//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 6543//>>docs: http://api.jqueryui.com/checkboxradio/ 6544//>>demos: http://jqueryui.com/checkboxradio/ 6545//>>css.structure: ../../themes/base/core.css 6546//>>css.structure: ../../themes/base/button.css 6547//>>css.structure: ../../themes/base/checkboxradio.css 6548//>>css.theme: ../../themes/base/theme.css 6549 6550 6551 6552$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 6553 version: "1.12.0", 6554 options: { 6555 disabled: null, 6556 label: null, 6557 icon: true, 6558 classes: { 6559 "ui-checkboxradio-label": "ui-corner-all", 6560 "ui-checkboxradio-icon": "ui-corner-all" 6561 } 6562 }, 6563 6564 _getCreateOptions: function() { 6565 var disabled, labels; 6566 var that = this; 6567 var options = this._super() || {}; 6568 6569 // We read the type here, because it makes more sense to throw a element type error first, 6570 // rather then the error for lack of a label. Often if its the wrong type, it 6571 // won't have a label (e.g. calling on a div, btn, etc) 6572 this._readType(); 6573 6574 labels = this.element.labels(); 6575 6576 // If there are multiple labels, use the last one 6577 this.label = $( labels[ labels.length - 1 ] ); 6578 if ( !this.label.length ) { 6579 $.error( "No label found for checkboxradio widget" ); 6580 } 6581 6582 this.originalLabel = ""; 6583 6584 6585 // We need to get the label text but this may also need to make sure it does not contain the 6586 // input itself. 6587 this.label.contents().not( this.element ).each( function() { 6588 6589 // The label contents could be text, html, or a mix. We concat each element to get a 6590 // string representation of the label, without the input as part of it. 6591 that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML; 6592 } ); 6593 6594 // Set the label option if we found label text 6595 if ( this.originalLabel ) { 6596 options.label = this.originalLabel; 6597 } 6598 6599 disabled = this.element[ 0 ].disabled; 6600 if ( disabled != null ) { 6601 options.disabled = disabled; 6602 } 6603 return options; 6604 }, 6605 6606 _create: function() { 6607 var checked = this.element[ 0 ].checked; 6608 6609 this._bindFormResetHandler(); 6610 6611 if ( this.options.disabled == null ) { 6612 this.options.disabled = this.element[ 0 ].disabled; 6613 } 6614 6615 this._setOption( "disabled", this.options.disabled ); 6616 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 6617 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 6618 6619 if ( this.type === "radio" ) { 6620 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 6621 } 6622 6623 if ( this.options.label && this.options.label !== this.originalLabel ) { 6624 this._updateLabel(); 6625 } else if ( this.originalLabel ) { 6626 this.options.label = this.originalLabel; 6627 } 6628 6629 this._enhance(); 6630 6631 if ( checked ) { 6632 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 6633 if ( this.icon ) { 6634 this._addClass( this.icon, null, "ui-state-hover" ); 6635 } 6636 } 6637 6638 this._on( { 6639 change: "_toggleClasses", 6640 focus: function() { 6641 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 6642 }, 6643 blur: function() { 6644 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 6645 } 6646 } ); 6647 }, 6648 6649 _readType: function() { 6650 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 6651 this.type = this.element[ 0 ].type; 6652 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 6653 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 6654 " and element.type=" + this.type ); 6655 } 6656 }, 6657 6658 // Support jQuery Mobile enhanced option 6659 _enhance: function() { 6660 this._updateIcon( this.element[ 0 ].checked ); 6661 }, 6662 6663 widget: function() { 6664 return this.label; 6665 }, 6666 6667 _getRadioGroup: function() { 6668 var group; 6669 var name = this.element[ 0 ].name; 6670 var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']"; 6671 6672 if ( !name ) { 6673 return $( [] ); 6674 } 6675 6676 if ( this.form.length ) { 6677 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 6678 } else { 6679 6680 // Not inside a form, check all inputs that also are not inside a form 6681 group = $( nameSelector ).filter( function() { 6682 return $( this ).form().length === 0; 6683 } ); 6684 } 6685 6686 return group.not( this.element ); 6687 }, 6688 6689 _toggleClasses: function() { 6690 var checked = this.element[ 0 ].checked; 6691 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 6692 6693 if ( this.options.icon && this.type === "checkbox" ) { 6694 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 6695 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 6696 } 6697 6698 if ( this.type === "radio" ) { 6699 this._getRadioGroup() 6700 .each( function() { 6701 var instance = $( this ).checkboxradio( "instance" ); 6702 6703 if ( instance ) { 6704 instance._removeClass( instance.label, 6705 "ui-checkboxradio-checked", "ui-state-active" ); 6706 } 6707 } ); 6708 } 6709 }, 6710 6711 _destroy: function() { 6712 this._unbindFormResetHandler(); 6713 6714 if ( this.icon ) { 6715 this.icon.remove();
vendor: 4,505 bytes, lines 6716-6881
6716 this.iconSpace.remove(); 6717 } 6718 }, 6719 6720 _setOption: function( key, value ) { 6721 6722 // We don't allow the value to be set to nothing 6723 if ( key === "label" && !value ) { 6724 return; 6725 } 6726 6727 this._super( key, value ); 6728 6729 if ( key === "disabled" ) { 6730 this._toggleClass( this.label, null, "ui-state-disabled", value ); 6731 this.element[ 0 ].disabled = value; 6732 6733 // Don't refresh when setting disabled 6734 return; 6735 } 6736 this.refresh(); 6737 }, 6738 6739 _updateIcon: function( checked ) { 6740 var toAdd = "ui-icon ui-icon-background "; 6741 6742 if ( this.options.icon ) { 6743 if ( !this.icon ) { 6744 this.icon = $( "<span>" ); 6745 this.iconSpace = $( "<span> </span>" ); 6746 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 6747 } 6748 6749 if ( this.type === "checkbox" ) { 6750 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 6751 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 6752 } else { 6753 toAdd += "ui-icon-blank"; 6754 } 6755 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 6756 if ( !checked ) { 6757 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 6758 } 6759 this.icon.prependTo( this.label ).after( this.iconSpace ); 6760 } else if ( this.icon !== undefined ) { 6761 this.icon.remove(); 6762 this.iconSpace.remove(); 6763 delete this.icon; 6764 } 6765 }, 6766 6767 _updateLabel: function() { 6768 6769 // Remove the contents of the label ( minus the icon, icon space, and input ) 6770 this.label.contents().not( this.element.add( this.icon ).add( this.iconSpace ) ).remove(); 6771 this.label.append( this.options.label ); 6772 }, 6773 6774 refresh: function() { 6775 var checked = this.element[ 0 ].checked, 6776 isDisabled = this.element[ 0 ].disabled; 6777 6778 this._updateIcon( checked ); 6779 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 6780 if ( this.options.label !== null ) { 6781 this._updateLabel(); 6782 } 6783 6784 if ( isDisabled !== this.options.disabled ) { 6785 this._setOptions( { "disabled": isDisabled } ); 6786 } 6787 } 6788 6789} ] ); 6790 6791var widgetsCheckboxradio = $.ui.checkboxradio; 6792 6793 6794/*! 6795 * jQuery UI Button 1.12.0 6796 * http://jqueryui.com 6797 * 6798 * Copyright jQuery Foundation and other contributors 6799 * Released under the MIT license. 6800 * http://jquery.org/license 6801 */ 6802 6803//>>label: Button 6804//>>group: Widgets 6805//>>description: Enhances a form with themeable buttons. 6806//>>docs: http://api.jqueryui.com/button/ 6807//>>demos: http://jqueryui.com/button/ 6808//>>css.structure: ../../themes/base/core.css 6809//>>css.structure: ../../themes/base/button.css 6810//>>css.theme: ../../themes/base/theme.css 6811 6812 6813 6814$.widget( "ui.button", { 6815 version: "1.12.0", 6816 defaultElement: "<button>", 6817 options: { 6818 classes: { 6819 "ui-button": "ui-corner-all" 6820 }, 6821 disabled: null, 6822 icon: null, 6823 iconPosition: "beginning", 6824 label: null, 6825 showLabel: true 6826 }, 6827 6828 _getCreateOptions: function() { 6829 var disabled, 6830 6831 // This is to support cases like in jQuery Mobile where the base widget does have 6832 // an implementation of _getCreateOptions 6833 options = this._super() || {}; 6834 6835 this.isInput = this.element.is( "input" ); 6836 6837 disabled = this.element[ 0 ].disabled; 6838 if ( disabled != null ) { 6839 options.disabled = disabled; 6840 } 6841 6842 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 6843 if ( this.originalLabel ) { 6844 options.label = this.originalLabel; 6845 } 6846 6847 return options; 6848 }, 6849 6850 _create: function() { 6851 if ( !this.option.showLabel & !this.options.icon ) { 6852 this.options.showLabel = true; 6853 } 6854 6855 // We have to check the option again here even though we did in _getCreateOptions, 6856 // because null may have been passed on init which would override what was set in 6857 // _getCreateOptions 6858 if ( this.options.disabled == null ) { 6859 this.options.disabled = this.element[ 0 ].disabled || false; 6860 } 6861 6862 this.hasTitle = !!this.element.attr( "title" ); 6863 6864 // Check to see if the label needs to be set or if its already correct 6865 if ( this.options.label && this.options.label !== this.originalLabel ) { 6866 if ( this.isInput ) { 6867 this.element.val( this.options.label ); 6868 } else { 6869 this.element.html( this.options.label ); 6870 } 6871 } 6872 this._addClass( "ui-button", "ui-widget" ); 6873 this._setOption( "disabled", this.options.disabled ); 6874 this._enhance(); 6875 6876 if ( this.element.is( "a" ) ) { 6877 this._on( { 6878 "keyup": function( event ) { 6879 if ( event.keyCode === $.ui.keyCode.SPACE ) { 6880 event.preventDefault(); 6881
vendor: 7,743 bytes, lines 6882-7164
6882 // Support: PhantomJS <= 1.9, IE 8 Only 6883 // If a native click is available use it so we actually cause navigation 6884 // otherwise just trigger a click event 6885 if ( this.element[ 0 ].click ) { 6886 this.element[ 0 ].click(); 6887 } else { 6888 this.element.trigger( "click" ); 6889 } 6890 } 6891 } 6892 } ); 6893 } 6894 }, 6895 6896 _enhance: function() { 6897 if ( !this.element.is( "button" ) ) { 6898 this.element.attr( "role", "button" ); 6899 } 6900 6901 if ( this.options.icon ) { 6902 this._updateIcon( "icon", this.options.icon ); 6903 this._updateTooltip(); 6904 } 6905 }, 6906 6907 _updateTooltip: function() { 6908 this.title = this.element.attr( "title" ); 6909 6910 if ( !this.options.showLabel && !this.title ) { 6911 this.element.attr( "title", this.options.label ); 6912 } 6913 }, 6914 6915 _updateIcon: function( option, value ) { 6916 var icon = option !== "iconPosition", 6917 position = icon ? this.options.iconPosition : value, 6918 displayBlock = position === "top" || position === "bottom"; 6919 6920 // Create icon 6921 if ( !this.icon ) { 6922 this.icon = $( "<span>" ); 6923 6924 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 6925 6926 if ( !this.options.showLabel ) { 6927 this._addClass( "ui-button-icon-only" ); 6928 } 6929 } else if ( icon ) { 6930 6931 // If we are updating the icon remove the old icon class 6932 this._removeClass( this.icon, null, this.options.icon ); 6933 } 6934 6935 // If we are updating the icon add the new icon class 6936 if ( icon ) { 6937 this._addClass( this.icon, null, value ); 6938 } 6939 6940 this._attachIcon( position ); 6941 6942 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 6943 // the iconSpace if there is one. 6944 if ( displayBlock ) { 6945 this._addClass( this.icon, null, "ui-widget-icon-block" ); 6946 if ( this.iconSpace ) { 6947 this.iconSpace.remove(); 6948 } 6949 } else { 6950 6951 // Position is beginning or end so remove the ui-widget-icon-block class and add the 6952 // space if it does not exist 6953 if ( !this.iconSpace ) { 6954 this.iconSpace = $( "<span> </span>" ); 6955 this._addClass( this.iconSpace, "ui-button-icon-space" ); 6956 } 6957 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 6958 this._attachIconSpace( position ); 6959 } 6960 }, 6961 6962 _destroy: function() { 6963 this.element.removeAttr( "role" ); 6964 6965 if ( this.icon ) { 6966 this.icon.remove(); 6967 } 6968 if ( this.iconSpace ) { 6969 this.iconSpace.remove(); 6970 } 6971 if ( !this.hasTitle ) { 6972 this.element.removeAttr( "title" ); 6973 } 6974 }, 6975 6976 _attachIconSpace: function( iconPosition ) { 6977 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 6978 }, 6979 6980 _attachIcon: function( iconPosition ) { 6981 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 6982 }, 6983 6984 _setOptions: function( options ) { 6985 var newShowLabel = options.showLabel === undefined ? 6986 this.options.showLabel : 6987 options.showLabel, 6988 newIcon = options.icon === undefined ? this.options.icon : options.icon; 6989 6990 if ( !newShowLabel && !newIcon ) { 6991 options.showLabel = true; 6992 } 6993 this._super( options ); 6994 }, 6995 6996 _setOption: function( key, value ) { 6997 if ( key === "icon" ) { 6998 if ( value ) { 6999 this._updateIcon( key, value ); 7000 } else if ( this.icon ) { 7001 this.icon.remove(); 7002 if ( this.iconSpace ) { 7003 this.iconSpace.remove(); 7004 } 7005 } 7006 } 7007 7008 if ( key === "iconPosition" ) { 7009 this._updateIcon( key, value ); 7010 } 7011 7012 // Make sure we can't end up with a button that has neither text nor icon 7013 if ( key === "showLabel" ) { 7014 this._toggleClass( "ui-button-icon-only", null, !value ); 7015 this._updateTooltip(); 7016 } 7017 7018 if ( key === "label" ) { 7019 if ( this.isInput ) { 7020 this.element.val( value ); 7021 } else { 7022 7023 // If there is an icon, append it, else nothing then append the value 7024 // this avoids removal of the icon when setting label text 7025 this.element.html( value ); 7026 if ( this.icon ) { 7027 this._attachIcon( this.options.iconPosition ); 7028 this._attachIconSpace( this.options.iconPosition ); 7029 } 7030 } 7031 } 7032 7033 this._super( key, value ); 7034 7035 if ( key === "disabled" ) { 7036 this._toggleClass( null, "ui-state-disabled", value ); 7037 this.element[ 0 ].disabled = value; 7038 if ( value ) { 7039 this.element.blur(); 7040 } 7041 } 7042 }, 7043 7044 refresh: function() { 7045 7046 // Make sure to only check disabled if its an element that supports this otherwise 7047 // check for the disabled class to determine state 7048 var isDisabled = this.element.is( "input, button" ) ? 7049 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 7050 7051 if ( isDisabled !== this.options.disabled ) { 7052 this._setOptions( { disabled: isDisabled } ); 7053 } 7054 7055 this._updateTooltip(); 7056 } 7057} ); 7058 7059// DEPRECATED 7060if ( $.uiBackCompat !== false ) { 7061 7062 // Text and Icons options 7063 $.widget( "ui.button", $.ui.button, { 7064 options: { 7065 text: true, 7066 icons: { 7067 primary: null, 7068 secondary: null 7069 } 7070 }, 7071 7072 _create: function() { 7073 if ( this.options.showLabel && !this.options.text ) { 7074 this.options.showLabel = this.options.text; 7075 } 7076 if ( !this.options.showLabel && this.options.text ) { 7077 this.options.text = this.options.showLabel; 7078 } 7079 if ( !this.options.icon && ( this.options.icons.primary || 7080 this.options.icons.secondary ) ) { 7081 if ( this.options.icons.primary ) { 7082 this.options.icon = this.options.icons.primary; 7083 } else { 7084 this.options.icon = this.options.icons.secondary; 7085 this.options.iconPosition = "end"; 7086 } 7087 } else if ( this.options.icon ) { 7088 this.options.icons.primary = this.options.icon; 7089 } 7090 this._super(); 7091 }, 7092 7093 _setOption: function( key, value ) { 7094 if ( key === "text" ) { 7095 this._super( "showLabel", value ); 7096 return; 7097 } 7098 if ( key === "showLabel" ) { 7099 this.options.text = value; 7100 } 7101 if ( key === "icon" ) { 7102 this.options.icons.primary = value; 7103 } 7104 if ( key === "icons" ) { 7105 if ( value.primary ) { 7106 this._super( "icon", value.primary ); 7107 this._super( "iconPosition", "beginning" ); 7108 } else if ( value.secondary ) { 7109 this._super( "icon", value.secondary ); 7110 this._super( "iconPosition", "end" ); 7111 } 7112 } 7113 this._superApply( arguments ); 7114 } 7115 } ); 7116 7117 $.fn.button = ( function( orig ) { 7118 return function() { 7119 if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) || 7120 ( this.length && this[ 0 ].tagName === "INPUT" && ( 7121 this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio" 7122 ) ) ) { 7123 return orig.apply( this, arguments ); 7124 } 7125 if ( !$.ui.checkboxradio ) { 7126 $.error( "Checkboxradio widget missing" ); 7127 } 7128 if ( arguments.length === 0 ) { 7129 return this.checkboxradio( { 7130 "icon": false 7131 } ); 7132 } 7133 return this.checkboxradio.apply( this, arguments ); 7134 }; 7135 } )( $.fn.button ); 7136 7137 $.fn.buttonset = function() { 7138 if ( !$.ui.controlgroup ) { 7139 $.error( "Controlgroup widget missing" ); 7140 } 7141 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 7142 return this.controlgroup.apply( this, 7143 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 7144 } 7145 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 7146 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 7147 } 7148 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 7149 arguments[ 0 ].items = { 7150 button: arguments[ 0 ].items 7151 }; 7152 } 7153 return this.controlgroup.apply( this, arguments ); 7154 }; 7155} 7156 7157var widgetsButton = $.ui.button; 7158 7159 7160// jscs:disable maximumLineLength 7161/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ 7162/*! 7163 * jQuery UI Datepicker 1.12.0 7164 * http://jqueryui.com
vendor: 4,553 bytes, lines 7165-7251
7165 * 7166 * Copyright jQuery Foundation and other contributors 7167 * Released under the MIT license. 7168 * http://jquery.org/license 7169 */ 7170 7171//>>label: Datepicker 7172//>>group: Widgets 7173//>>description: Displays a calendar from an input or inline for selecting dates. 7174//>>docs: http://api.jqueryui.com/datepicker/ 7175//>>demos: http://jqueryui.com/datepicker/ 7176//>>css.structure: ../../themes/base/core.css 7177//>>css.structure: ../../themes/base/datepicker.css 7178//>>css.theme: ../../themes/base/theme.css 7179 7180 7181 7182$.extend( $.ui, { datepicker: { version: "1.12.0" } } ); 7183 7184var datepicker_instActive; 7185 7186function datepicker_getZindex( elem ) { 7187 var position, value; 7188 while ( elem.length && elem[ 0 ] !== document ) { 7189 7190 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7191 // This makes behavior of this function consistent across browsers 7192 // WebKit always returns auto if the element is positioned 7193 position = elem.css( "position" ); 7194 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 7195 7196 // IE returns 0 when zIndex is not specified 7197 // other browsers return a string 7198 // we ignore the case of nested elements with an explicit value of 0 7199 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7200 value = parseInt( elem.css( "zIndex" ), 10 ); 7201 if ( !isNaN( value ) && value !== 0 ) { 7202 return value; 7203 } 7204 } 7205 elem = elem.parent(); 7206 } 7207 7208 return 0; 7209} 7210/* Date picker manager. 7211 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7212 Settings for (groups of) date pickers are maintained in an instance object, 7213 allowing multiple different settings on the same page. */ 7214 7215function Datepicker() { 7216 this._curInst = null; // The current instance in use 7217 this._keyEvent = false; // If the last event was a key event 7218 this._disabledInputs = []; // List of date picker inputs that have been disabled 7219 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7220 this._inDialog = false; // True if showing within a "dialog", false if not 7221 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7222 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7223 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7224 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7225 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7226 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7227 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7228 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7229 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7230 this.regional = []; // Available regional settings, indexed by language code 7231 this.regional[ "" ] = { // Default regional settings 7232 closeText: "Done", // Display text for close link 7233 prevText: "Prev", // Display text for previous month link 7234 nextText: "Next", // Display text for next month link 7235 currentText: "Today", // Display text for current month link 7236 monthNames: [ "January","February","March","April","May","June", 7237 "July","August","September","October","November","December" ], // Names of months for drop-down and formatting 7238 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 7239 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 7240 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 7241 dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday 7242 weekHeader: "Wk", // Column header for week of the year 7243 dateFormat: "mm/dd/yy", // See format options on parseDate 7244 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7245 isRTL: false, // True if right-to-left language, false if left-to-right 7246 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7247 yearSuffix: "" // Additional text to append to the year in the month headers 7248 }; 7249 this._defaults = { // Global defaults for all the date picker instances 7250 showOn: "focus", // "focus" for popup on focus, 7251 // "button" for trigger button, or "both" for either
vendor: 6,761 bytes, lines 7252-7384
7252 showAnim: "fadeIn", // Name of jQuery animation for popup 7253 showOptions: {}, // Options for enhanced animations 7254 defaultDate: null, // Used when field is blank: actual date, 7255 // +/-number for offset from today, null for today 7256 appendText: "", // Display text following the input box, e.g. showing the format 7257 buttonText: "...", // Text for trigger button 7258 buttonImage: "", // URL for trigger button image 7259 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7260 hideIfNoPrevNext: false, // True to hide next/previous month links 7261 // if not applicable, false to just disable them 7262 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7263 gotoCurrent: false, // True if today link goes back to current selection instead 7264 changeMonth: false, // True if month can be selected directly, false if only prev/next 7265 changeYear: false, // True if year can be selected directly, false if only prev/next 7266 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7267 // either relative to today's year (-nn:+nn), relative to currently displayed year 7268 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7269 showOtherMonths: false, // True to show dates in other months, false to leave blank 7270 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7271 showWeek: false, // True to show week of the year, false to not show it 7272 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7273 // takes a Date and returns the number of the week for it 7274 shortYearCutoff: "+10", // Short year values < this are in the current century, 7275 // > this are in the previous century, 7276 // string value starting with "+" for current year + value 7277 minDate: null, // The earliest selectable date, or null for no limit 7278 maxDate: null, // The latest selectable date, or null for no limit 7279 duration: "fast", // Duration of display/closure 7280 beforeShowDay: null, // Function that takes a date and returns an array with 7281 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7282 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7283 beforeShow: null, // Function that takes an input field and 7284 // returns a set of custom settings for the date picker 7285 onSelect: null, // Define a callback function when a date is selected 7286 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7287 onClose: null, // Define a callback function when the datepicker is closed 7288 numberOfMonths: 1, // Number of months to show at a time 7289 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7290 stepMonths: 1, // Number of months to step back/forward 7291 stepBigMonths: 12, // Number of months to step back/forward for the big links 7292 altField: "", // Selector for an alternate field to store selected dates into 7293 altFormat: "", // The date format to use for the alternate field 7294 constrainInput: true, // The input is constrained by the current date format 7295 showButtonPanel: false, // True to show button panel, false to not show it 7296 autoSize: false, // True to size the input for the date format, false to leave as is 7297 disabled: false // The initial disabled state 7298 }; 7299 $.extend( this._defaults, this.regional[ "" ] ); 7300 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 7301 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 7302 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 7303} 7304 7305$.extend( Datepicker.prototype, { 7306 /* Class name added to elements to indicate already configured with a date picker. */ 7307 markerClassName: "hasDatepicker", 7308 7309 //Keep track of the maximum number of rows displayed (see #7043) 7310 maxRows: 4, 7311 7312 // TODO rename to "widget" when switching to widget factory 7313 _widgetDatepicker: function() { 7314 return this.dpDiv; 7315 }, 7316 7317 /* Override the default settings for all instances of the date picker. 7318 * @param settings object - the new settings to use as defaults (anonymous object) 7319 * @return the manager object 7320 */ 7321 setDefaults: function( settings ) { 7322 datepicker_extendRemove( this._defaults, settings || {} ); 7323 return this; 7324 }, 7325 7326 /* Attach the date picker to a jQuery selection. 7327 * @param target element - the target input field or division or span 7328 * @param settings object - the new settings to use for this date picker instance (anonymous) 7329 */ 7330 _attachDatepicker: function( target, settings ) { 7331 var nodeName, inline, inst; 7332 nodeName = target.nodeName.toLowerCase(); 7333 inline = ( nodeName === "div" || nodeName === "span" ); 7334 if ( !target.id ) { 7335 this.uuid += 1; 7336 target.id = "dp" + this.uuid; 7337 } 7338 inst = this._newInst( $( target ), inline ); 7339 inst.settings = $.extend( {}, settings || {} ); 7340 if ( nodeName === "input" ) { 7341 this._connectDatepicker( target, inst ); 7342 } else if ( inline ) { 7343 this._inlineDatepicker( target, inst ); 7344 } 7345 }, 7346 7347 /* Create a new instance object. */ 7348 _newInst: function( target, inline ) { 7349 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 7350 return { id: id, input: target, // associated target 7351 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 7352 drawMonth: 0, drawYear: 0, // month being drawn 7353 inline: inline, // is datepicker inline or not 7354 dpDiv: ( !inline ? this.dpDiv : // presentation div 7355 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 7356 }, 7357 7358 /* Attach the date picker to an input field. */ 7359 _connectDatepicker: function( target, inst ) { 7360 var input = $( target ); 7361 inst.append = $( [] ); 7362 inst.trigger = $( [] ); 7363 if ( input.hasClass( this.markerClassName ) ) { 7364 return; 7365 } 7366 this._attachments( input, inst ); 7367 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 7368 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 7369 this._autoSize( inst ); 7370 $.data( target, "datepicker", inst ); 7371 7372 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 7373 if ( inst.settings.disabled ) { 7374 this._disableDatepicker( target ); 7375 } 7376 }, 7377 7378 /* Make attachments based on settings. */ 7379 _attachments: function( input, inst ) { 7380 var showOn, buttonText, buttonImage, 7381 appendText = this._get( inst, "appendText" ), 7382 isRTL = this._get( inst, "isRTL" ); 7383 7384 if ( inst.append ) {
vendor: 6,192 bytes, lines 7385-7542
7385 inst.append.remove(); 7386 } 7387 if ( appendText ) { 7388 inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" ); 7389 input[ isRTL ? "before" : "after" ]( inst.append ); 7390 } 7391 7392 input.off( "focus", this._showDatepicker ); 7393 7394 if ( inst.trigger ) { 7395 inst.trigger.remove(); 7396 } 7397 7398 showOn = this._get( inst, "showOn" ); 7399 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 7400 input.on( "focus", this._showDatepicker ); 7401 } 7402 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 7403 buttonText = this._get( inst, "buttonText" ); 7404 buttonImage = this._get( inst, "buttonImage" ); 7405 inst.trigger = $( this._get( inst, "buttonImageOnly" ) ? 7406 $( "<img/>" ).addClass( this._triggerClass ). 7407 attr( { src: buttonImage, alt: buttonText, title: buttonText } ) : 7408 $( "<button type='button'></button>" ).addClass( this._triggerClass ). 7409 html( !buttonImage ? buttonText : $( "<img/>" ).attr( 7410 { src:buttonImage, alt:buttonText, title:buttonText } ) ) ); 7411 input[ isRTL ? "before" : "after" ]( inst.trigger ); 7412 inst.trigger.on( "click", function() { 7413 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 7414 $.datepicker._hideDatepicker(); 7415 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 7416 $.datepicker._hideDatepicker(); 7417 $.datepicker._showDatepicker( input[ 0 ] ); 7418 } else { 7419 $.datepicker._showDatepicker( input[ 0 ] ); 7420 } 7421 return false; 7422 } ); 7423 } 7424 }, 7425 7426 /* Apply the maximum length for the date format. */ 7427 _autoSize: function( inst ) { 7428 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 7429 var findMax, max, maxI, i, 7430 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 7431 dateFormat = this._get( inst, "dateFormat" ); 7432 7433 if ( dateFormat.match( /[DM]/ ) ) { 7434 findMax = function( names ) { 7435 max = 0; 7436 maxI = 0; 7437 for ( i = 0; i < names.length; i++ ) { 7438 if ( names[ i ].length > max ) { 7439 max = names[ i ].length; 7440 maxI = i; 7441 } 7442 } 7443 return maxI; 7444 }; 7445 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 7446 "monthNames" : "monthNamesShort" ) ) ) ); 7447 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 7448 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 7449 } 7450 inst.input.attr( "size", this._formatDate( inst, date ).length ); 7451 } 7452 }, 7453 7454 /* Attach an inline date picker to a div. */ 7455 _inlineDatepicker: function( target, inst ) { 7456 var divSpan = $( target ); 7457 if ( divSpan.hasClass( this.markerClassName ) ) { 7458 return; 7459 } 7460 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 7461 $.data( target, "datepicker", inst ); 7462 this._setDate( inst, this._getDefaultDate( inst ), true ); 7463 this._updateDatepicker( inst ); 7464 this._updateAlternate( inst ); 7465 7466 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 7467 if ( inst.settings.disabled ) { 7468 this._disableDatepicker( target ); 7469 } 7470 7471 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 7472 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 7473 inst.dpDiv.css( "display", "block" ); 7474 }, 7475 7476 /* Pop-up the date picker in a "dialog" box. 7477 * @param input element - ignored 7478 * @param date string or Date - the initial date to display 7479 * @param onSelect function - the function to call when a date is selected 7480 * @param settings object - update the dialog date picker instance's settings (anonymous object) 7481 * @param pos int[2] - coordinates for the dialog's position within the screen or 7482 * event - with x/y coordinates or 7483 * leave empty for default (screen centre) 7484 * @return the manager object 7485 */ 7486 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 7487 var id, browserWidth, browserHeight, scrollX, scrollY, 7488 inst = this._dialogInst; // internal instance 7489 7490 if ( !inst ) { 7491 this.uuid += 1; 7492 id = "dp" + this.uuid; 7493 this._dialogInput = $( "<input type='text' id='" + id + 7494 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 7495 this._dialogInput.on( "keydown", this._doKeyDown ); 7496 $( "body" ).append( this._dialogInput ); 7497 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 7498 inst.settings = {}; 7499 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7500 } 7501 datepicker_extendRemove( inst.settings, settings || {} ); 7502 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 7503 this._dialogInput.val( date ); 7504 7505 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 7506 if ( !this._pos ) { 7507 browserWidth = document.documentElement.clientWidth; 7508 browserHeight = document.documentElement.clientHeight; 7509 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 7510 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 7511 this._pos = // should use actual width/height below 7512 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 7513 } 7514 7515 // Move input on screen for focus, but hidden behind dialog 7516 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 7517 inst.settings.onSelect = onSelect; 7518 this._inDialog = true; 7519 this.dpDiv.addClass( this._dialogClass ); 7520 this._showDatepicker( this._dialogInput[ 0 ] ); 7521 if ( $.blockUI ) { 7522 $.blockUI( this.dpDiv ); 7523 } 7524 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7525 return this; 7526 }, 7527 7528 /* Detach a datepicker from its control. 7529 * @param target element - the target input field or division or span 7530 */ 7531 _destroyDatepicker: function( target ) { 7532 var nodeName, 7533 $target = $( target ), 7534 inst = $.data( target, "datepicker" ); 7535 7536 if ( !$target.hasClass( this.markerClassName ) ) { 7537 return; 7538 } 7539 7540 nodeName = target.nodeName.toLowerCase(); 7541 $.removeData( target, "datepicker" ); 7542 if ( nodeName === "input" ) {
vendor: 12,111 bytes, lines 7543-7883
7543 inst.append.remove(); 7544 inst.trigger.remove(); 7545 $target.removeClass( this.markerClassName ). 7546 off( "focus", this._showDatepicker ). 7547 off( "keydown", this._doKeyDown ). 7548 off( "keypress", this._doKeyPress ). 7549 off( "keyup", this._doKeyUp ); 7550 } else if ( nodeName === "div" || nodeName === "span" ) { 7551 $target.removeClass( this.markerClassName ).empty(); 7552 } 7553 7554 if ( datepicker_instActive === inst ) { 7555 datepicker_instActive = null; 7556 } 7557 }, 7558 7559 /* Enable the date picker to a jQuery selection. 7560 * @param target element - the target input field or division or span 7561 */ 7562 _enableDatepicker: function( target ) { 7563 var nodeName, inline, 7564 $target = $( target ), 7565 inst = $.data( target, "datepicker" ); 7566 7567 if ( !$target.hasClass( this.markerClassName ) ) { 7568 return; 7569 } 7570 7571 nodeName = target.nodeName.toLowerCase(); 7572 if ( nodeName === "input" ) { 7573 target.disabled = false; 7574 inst.trigger.filter( "button" ). 7575 each( function() { this.disabled = false; } ).end(). 7576 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 7577 } else if ( nodeName === "div" || nodeName === "span" ) { 7578 inline = $target.children( "." + this._inlineClass ); 7579 inline.children().removeClass( "ui-state-disabled" ); 7580 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7581 prop( "disabled", false ); 7582 } 7583 this._disabledInputs = $.map( this._disabledInputs, 7584 function( value ) { return ( value === target ? null : value ); } ); // delete entry 7585 }, 7586 7587 /* Disable the date picker to a jQuery selection. 7588 * @param target element - the target input field or division or span 7589 */ 7590 _disableDatepicker: function( target ) { 7591 var nodeName, inline, 7592 $target = $( target ), 7593 inst = $.data( target, "datepicker" ); 7594 7595 if ( !$target.hasClass( this.markerClassName ) ) { 7596 return; 7597 } 7598 7599 nodeName = target.nodeName.toLowerCase(); 7600 if ( nodeName === "input" ) { 7601 target.disabled = true; 7602 inst.trigger.filter( "button" ). 7603 each( function() { this.disabled = true; } ).end(). 7604 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 7605 } else if ( nodeName === "div" || nodeName === "span" ) { 7606 inline = $target.children( "." + this._inlineClass ); 7607 inline.children().addClass( "ui-state-disabled" ); 7608 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7609 prop( "disabled", true ); 7610 } 7611 this._disabledInputs = $.map( this._disabledInputs, 7612 function( value ) { return ( value === target ? null : value ); } ); // delete entry 7613 this._disabledInputs[ this._disabledInputs.length ] = target; 7614 }, 7615 7616 /* Is the first field in a jQuery collection disabled as a datepicker? 7617 * @param target element - the target input field or division or span 7618 * @return boolean - true if disabled, false if enabled 7619 */ 7620 _isDisabledDatepicker: function( target ) { 7621 if ( !target ) { 7622 return false; 7623 } 7624 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 7625 if ( this._disabledInputs[ i ] === target ) { 7626 return true; 7627 } 7628 } 7629 return false; 7630 }, 7631 7632 /* Retrieve the instance data for the target control. 7633 * @param target element - the target input field or division or span 7634 * @return object - the associated instance data 7635 * @throws error if a jQuery problem getting data 7636 */ 7637 _getInst: function( target ) { 7638 try { 7639 return $.data( target, "datepicker" ); 7640 } 7641 catch ( err ) { 7642 throw "Missing instance data for this datepicker"; 7643 } 7644 }, 7645 7646 /* Update or retrieve the settings for a date picker attached to an input field or division. 7647 * @param target element - the target input field or division or span 7648 * @param name object - the new settings to update or 7649 * string - the name of the setting to change or retrieve, 7650 * when retrieving also "all" for all instance settings or 7651 * "defaults" for all global defaults 7652 * @param value any - the new value for the setting 7653 * (omit if above is an object or to retrieve a value) 7654 */ 7655 _optionDatepicker: function( target, name, value ) { 7656 var settings, date, minDate, maxDate, 7657 inst = this._getInst( target ); 7658 7659 if ( arguments.length === 2 && typeof name === "string" ) { 7660 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 7661 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 7662 this._get( inst, name ) ) : null ) ); 7663 } 7664 7665 settings = name || {}; 7666 if ( typeof name === "string" ) { 7667 settings = {}; 7668 settings[ name ] = value; 7669 } 7670 7671 if ( inst ) { 7672 if ( this._curInst === inst ) { 7673 this._hideDatepicker(); 7674 } 7675 7676 date = this._getDateDatepicker( target, true ); 7677 minDate = this._getMinMaxDate( inst, "min" ); 7678 maxDate = this._getMinMaxDate( inst, "max" ); 7679 datepicker_extendRemove( inst.settings, settings ); 7680 7681 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 7682 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 7683 inst.settings.minDate = this._formatDate( inst, minDate ); 7684 } 7685 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 7686 inst.settings.maxDate = this._formatDate( inst, maxDate ); 7687 } 7688 if ( "disabled" in settings ) { 7689 if ( settings.disabled ) { 7690 this._disableDatepicker( target ); 7691 } else { 7692 this._enableDatepicker( target ); 7693 } 7694 } 7695 this._attachments( $( target ), inst ); 7696 this._autoSize( inst ); 7697 this._setDate( inst, date ); 7698 this._updateAlternate( inst ); 7699 this._updateDatepicker( inst ); 7700 } 7701 }, 7702 7703 // Change method deprecated 7704 _changeDatepicker: function( target, name, value ) { 7705 this._optionDatepicker( target, name, value ); 7706 }, 7707 7708 /* Redraw the date picker attached to an input field or division. 7709 * @param target element - the target input field or division or span 7710 */ 7711 _refreshDatepicker: function( target ) { 7712 var inst = this._getInst( target ); 7713 if ( inst ) { 7714 this._updateDatepicker( inst ); 7715 } 7716 }, 7717 7718 /* Set the dates for a jQuery selection. 7719 * @param target element - the target input field or division or span 7720 * @param date Date - the new date 7721 */ 7722 _setDateDatepicker: function( target, date ) { 7723 var inst = this._getInst( target ); 7724 if ( inst ) { 7725 this._setDate( inst, date ); 7726 this._updateDatepicker( inst ); 7727 this._updateAlternate( inst ); 7728 } 7729 }, 7730 7731 /* Get the date(s) for the first entry in a jQuery selection. 7732 * @param target element - the target input field or division or span 7733 * @param noDefault boolean - true if no default date is to be used 7734 * @return Date - the current date 7735 */ 7736 _getDateDatepicker: function( target, noDefault ) { 7737 var inst = this._getInst( target ); 7738 if ( inst && !inst.inline ) { 7739 this._setDateFromField( inst, noDefault ); 7740 } 7741 return ( inst ? this._getDate( inst ) : null ); 7742 }, 7743 7744 /* Handle keystrokes. */ 7745 _doKeyDown: function( event ) { 7746 var onSelect, dateStr, sel, 7747 inst = $.datepicker._getInst( event.target ), 7748 handled = true, 7749 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 7750 7751 inst._keyEvent = true; 7752 if ( $.datepicker._datepickerShowing ) { 7753 switch ( event.keyCode ) { 7754 case 9: $.datepicker._hideDatepicker(); 7755 handled = false; 7756 break; // hide on tab out 7757 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 7758 $.datepicker._currentClass + ")", inst.dpDiv ); 7759 if ( sel[ 0 ] ) { 7760 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 7761 } 7762 7763 onSelect = $.datepicker._get( inst, "onSelect" ); 7764 if ( onSelect ) { 7765 dateStr = $.datepicker._formatDate( inst ); 7766 7767 // Trigger custom callback 7768 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 7769 } else { 7770 $.datepicker._hideDatepicker(); 7771 } 7772 7773 return false; // don't submit the form 7774 case 27: $.datepicker._hideDatepicker(); 7775 break; // hide on escape 7776 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7777 -$.datepicker._get( inst, "stepBigMonths" ) : 7778 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7779 break; // previous month/year on page up/+ ctrl 7780 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7781 +$.datepicker._get( inst, "stepBigMonths" ) : 7782 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7783 break; // next month/year on page down/+ ctrl 7784 case 35: if ( event.ctrlKey || event.metaKey ) { 7785 $.datepicker._clearDate( event.target ); 7786 } 7787 handled = event.ctrlKey || event.metaKey; 7788 break; // clear on ctrl or command +end 7789 case 36: if ( event.ctrlKey || event.metaKey ) { 7790 $.datepicker._gotoToday( event.target ); 7791 } 7792 handled = event.ctrlKey || event.metaKey; 7793 break; // current on ctrl or command +home 7794 case 37: if ( event.ctrlKey || event.metaKey ) { 7795 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 7796 } 7797 handled = event.ctrlKey || event.metaKey; 7798 7799 // -1 day on ctrl or command +left 7800 if ( event.originalEvent.altKey ) { 7801 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7802 -$.datepicker._get( inst, "stepBigMonths" ) : 7803 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7804 } 7805 7806 // next month/year on alt +left on Mac 7807 break; 7808 case 38: if ( event.ctrlKey || event.metaKey ) { 7809 $.datepicker._adjustDate( event.target, -7, "D" ); 7810 } 7811 handled = event.ctrlKey || event.metaKey; 7812 break; // -1 week on ctrl or command +up 7813 case 39: if ( event.ctrlKey || event.metaKey ) { 7814 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 7815 } 7816 handled = event.ctrlKey || event.metaKey; 7817 7818 // +1 day on ctrl or command +right 7819 if ( event.originalEvent.altKey ) { 7820 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7821 +$.datepicker._get( inst, "stepBigMonths" ) : 7822 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7823 } 7824 7825 // next month/year on alt +right 7826 break; 7827 case 40: if ( event.ctrlKey || event.metaKey ) { 7828 $.datepicker._adjustDate( event.target, +7, "D" ); 7829 } 7830 handled = event.ctrlKey || event.metaKey; 7831 break; // +1 week on ctrl or command +down 7832 default: handled = false; 7833 } 7834 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 7835 $.datepicker._showDatepicker( this ); 7836 } else { 7837 handled = false; 7838 } 7839 7840 if ( handled ) { 7841 event.preventDefault(); 7842 event.stopPropagation(); 7843 } 7844 }, 7845 7846 /* Filter entered characters - based on date format. */ 7847 _doKeyPress: function( event ) { 7848 var chars, chr, 7849 inst = $.datepicker._getInst( event.target ); 7850 7851 if ( $.datepicker._get( inst, "constrainInput" ) ) { 7852 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 7853 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 7854 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 7855 } 7856 }, 7857 7858 /* Synchronise manual entry and field/alternate field. */ 7859 _doKeyUp: function( event ) { 7860 var date, 7861 inst = $.datepicker._getInst( event.target ); 7862 7863 if ( inst.input.val() !== inst.lastVal ) { 7864 try { 7865 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 7866 ( inst.input ? inst.input.val() : null ), 7867 $.datepicker._getFormatConfig( inst ) ); 7868 7869 if ( date ) { // only if valid 7870 $.datepicker._setDateFromField( inst ); 7871 $.datepicker._updateAlternate( inst ); 7872 $.datepicker._updateDatepicker( inst ); 7873 } 7874 } 7875 catch ( err ) { 7876 } 7877 } 7878 return true; 7879 }, 7880 7881 /* Pop-up the date picker for a given input field. 7882 * If false returned from beforeShow event handler do not show. 7883 * @param input element - the input field attached to the date picker or
vendor: 1,885 bytes, lines 7884-7941
7884 * event - if triggered by focus 7885 */ 7886 _showDatepicker: function( input ) { 7887 input = input.target || input; 7888 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 7889 input = $( "input", input.parentNode )[ 0 ]; 7890 } 7891 7892 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 7893 return; 7894 } 7895 7896 var inst, beforeShow, beforeShowSettings, isFixed, 7897 offset, showAnim, duration; 7898 7899 inst = $.datepicker._getInst( input ); 7900 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 7901 $.datepicker._curInst.dpDiv.stop( true, true ); 7902 if ( inst && $.datepicker._datepickerShowing ) { 7903 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 7904 } 7905 } 7906 7907 beforeShow = $.datepicker._get( inst, "beforeShow" ); 7908 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 7909 if ( beforeShowSettings === false ) { 7910 return; 7911 } 7912 datepicker_extendRemove( inst.settings, beforeShowSettings ); 7913 7914 inst.lastVal = null; 7915 $.datepicker._lastInput = input; 7916 $.datepicker._setDateFromField( inst ); 7917 7918 if ( $.datepicker._inDialog ) { // hide cursor 7919 input.value = ""; 7920 } 7921 if ( !$.datepicker._pos ) { // position below input 7922 $.datepicker._pos = $.datepicker._findPos( input ); 7923 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 7924 } 7925 7926 isFixed = false; 7927 $( input ).parents().each( function() { 7928 isFixed |= $( this ).css( "position" ) === "fixed"; 7929 return !isFixed; 7930 } ); 7931 7932 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 7933 $.datepicker._pos = null; 7934 7935 //to avoid flashes on Firefox 7936 inst.dpDiv.empty(); 7937 7938 // determine sizing offscreen 7939 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 7940 $.datepicker._updateDatepicker( inst ); 7941
vendor: 12,839 bytes, lines 7942-8295
7942 // fix width for dynamic number of date pickers 7943 // and adjust position before showing 7944 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 7945 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 7946 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 7947 left: offset.left + "px", top: offset.top + "px" } ); 7948 7949 if ( !inst.inline ) { 7950 showAnim = $.datepicker._get( inst, "showAnim" ); 7951 duration = $.datepicker._get( inst, "duration" ); 7952 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 7953 $.datepicker._datepickerShowing = true; 7954 7955 if ( $.effects && $.effects.effect[ showAnim ] ) { 7956 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 7957 } else { 7958 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 7959 } 7960 7961 if ( $.datepicker._shouldFocusInput( inst ) ) { 7962 inst.input.trigger( "focus" ); 7963 } 7964 7965 $.datepicker._curInst = inst; 7966 } 7967 }, 7968 7969 /* Generate the date picker content. */ 7970 _updateDatepicker: function( inst ) { 7971 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 7972 datepicker_instActive = inst; // for delegate hover events 7973 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 7974 this._attachHandlers( inst ); 7975 7976 var origyearshtml, 7977 numMonths = this._getNumberOfMonths( inst ), 7978 cols = numMonths[ 1 ], 7979 width = 17, 7980 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); 7981 7982 if ( activeCell.length > 0 ) { 7983 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 7984 } 7985 7986 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 7987 if ( cols > 1 ) { 7988 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 7989 } 7990 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 7991 "Class" ]( "ui-datepicker-multi" ); 7992 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 7993 "Class" ]( "ui-datepicker-rtl" ); 7994 7995 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 7996 inst.input.trigger( "focus" ); 7997 } 7998 7999 // Deffered render of the years select (to avoid flashes on Firefox) 8000 if ( inst.yearshtml ) { 8001 origyearshtml = inst.yearshtml; 8002 setTimeout( function() { 8003 8004 //assure that inst.yearshtml didn't change. 8005 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 8006 inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml ); 8007 } 8008 origyearshtml = inst.yearshtml = null; 8009 }, 0 ); 8010 } 8011 }, 8012 8013 // #6694 - don't focus the input if it's already focused 8014 // this breaks the change event in IE 8015 // Support: IE and jQuery <1.9 8016 _shouldFocusInput: function( inst ) { 8017 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); 8018 }, 8019 8020 /* Check positioning to remain on screen. */ 8021 _checkOffset: function( inst, offset, isFixed ) { 8022 var dpWidth = inst.dpDiv.outerWidth(), 8023 dpHeight = inst.dpDiv.outerHeight(), 8024 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8025 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8026 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 8027 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 8028 8029 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 8030 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 8031 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 8032 8033 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8034 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 8035 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 8036 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 8037 Math.abs( dpHeight + inputHeight ) : 0 ); 8038 8039 return offset; 8040 }, 8041 8042 /* Find an object's position on the screen. */ 8043 _findPos: function( obj ) { 8044 var position, 8045 inst = this._getInst( obj ), 8046 isRTL = this._get( inst, "isRTL" ); 8047 8048 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) { 8049 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 8050 } 8051 8052 position = $( obj ).offset(); 8053 return [ position.left, position.top ]; 8054 }, 8055 8056 /* Hide the date picker from view. 8057 * @param input element - the input field attached to the date picker 8058 */ 8059 _hideDatepicker: function( input ) { 8060 var showAnim, duration, postProcess, onClose, 8061 inst = this._curInst; 8062 8063 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 8064 return; 8065 } 8066 8067 if ( this._datepickerShowing ) { 8068 showAnim = this._get( inst, "showAnim" ); 8069 duration = this._get( inst, "duration" ); 8070 postProcess = function() { 8071 $.datepicker._tidyDialog( inst ); 8072 }; 8073 8074 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 8075 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { 8076 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 8077 } else { 8078 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 8079 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 8080 } 8081 8082 if ( !showAnim ) { 8083 postProcess(); 8084 } 8085 this._datepickerShowing = false; 8086 8087 onClose = this._get( inst, "onClose" ); 8088 if ( onClose ) { 8089 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 8090 } 8091 8092 this._lastInput = null; 8093 if ( this._inDialog ) { 8094 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 8095 if ( $.blockUI ) { 8096 $.unblockUI(); 8097 $( "body" ).append( this.dpDiv ); 8098 } 8099 } 8100 this._inDialog = false; 8101 } 8102 }, 8103 8104 /* Tidy up after a dialog display. */ 8105 _tidyDialog: function( inst ) { 8106 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 8107 }, 8108 8109 /* Close date picker if clicked elsewhere. */ 8110 _checkExternalClick: function( event ) { 8111 if ( !$.datepicker._curInst ) { 8112 return; 8113 } 8114 8115 var $target = $( event.target ), 8116 inst = $.datepicker._getInst( $target[ 0 ] ); 8117 8118 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 8119 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 8120 !$target.hasClass( $.datepicker.markerClassName ) && 8121 !$target.closest( "." + $.datepicker._triggerClass ).length && 8122 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 8123 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 8124 $.datepicker._hideDatepicker(); 8125 } 8126 }, 8127 8128 /* Adjust one of the date sub-fields. */ 8129 _adjustDate: function( id, offset, period ) { 8130 var target = $( id ), 8131 inst = this._getInst( target[ 0 ] ); 8132 8133 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 8134 return; 8135 } 8136 this._adjustInstDate( inst, offset + 8137 ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning 8138 period ); 8139 this._updateDatepicker( inst ); 8140 }, 8141 8142 /* Action for current link. */ 8143 _gotoToday: function( id ) { 8144 var date, 8145 target = $( id ), 8146 inst = this._getInst( target[ 0 ] ); 8147 8148 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 8149 inst.selectedDay = inst.currentDay; 8150 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8151 inst.drawYear = inst.selectedYear = inst.currentYear; 8152 } else { 8153 date = new Date(); 8154 inst.selectedDay = date.getDate(); 8155 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8156 inst.drawYear = inst.selectedYear = date.getFullYear(); 8157 } 8158 this._notifyChange( inst ); 8159 this._adjustDate( target ); 8160 }, 8161 8162 /* Action for selecting a new month/year. */ 8163 _selectMonthYear: function( id, select, period ) { 8164 var target = $( id ), 8165 inst = this._getInst( target[ 0 ] ); 8166 8167 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 8168 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 8169 parseInt( select.options[ select.selectedIndex ].value, 10 ); 8170 8171 this._notifyChange( inst ); 8172 this._adjustDate( target ); 8173 }, 8174 8175 /* Action for selecting a day. */ 8176 _selectDay: function( id, month, year, td ) { 8177 var inst, 8178 target = $( id ); 8179 8180 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 8181 return; 8182 } 8183 8184 inst = this._getInst( target[ 0 ] ); 8185 inst.selectedDay = inst.currentDay = $( "a", td ).html(); 8186 inst.selectedMonth = inst.currentMonth = month; 8187 inst.selectedYear = inst.currentYear = year; 8188 this._selectDate( id, this._formatDate( inst, 8189 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 8190 }, 8191 8192 /* Erase the input field and hide the date picker. */ 8193 _clearDate: function( id ) { 8194 var target = $( id ); 8195 this._selectDate( target, "" ); 8196 }, 8197 8198 /* Update the input field with the selected date. */ 8199 _selectDate: function( id, dateStr ) { 8200 var onSelect, 8201 target = $( id ), 8202 inst = this._getInst( target[ 0 ] ); 8203 8204 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 8205 if ( inst.input ) { 8206 inst.input.val( dateStr ); 8207 } 8208 this._updateAlternate( inst ); 8209 8210 onSelect = this._get( inst, "onSelect" ); 8211 if ( onSelect ) { 8212 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 8213 } else if ( inst.input ) { 8214 inst.input.trigger( "change" ); // fire the change event 8215 8216 } 8217 8218 if ( inst.inline ) { 8219 this._updateDatepicker( inst ); 8220 } else { 8221 this._hideDatepicker(); 8222 this._lastInput = inst.input[ 0 ]; 8223 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 8224 inst.input.trigger( "focus" ); // restore focus 8225 } 8226 this._lastInput = null; 8227 } 8228 }, 8229 8230 /* Update any alternate field to synchronise with the main field. */ 8231 _updateAlternate: function( inst ) { 8232 var altFormat, date, dateStr, 8233 altField = this._get( inst, "altField" ); 8234 8235 if ( altField ) { // update alternate field too 8236 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 8237 date = this._getDate( inst ); 8238 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 8239 $( altField ).val( dateStr ); 8240 } 8241 }, 8242 8243 /* Set as beforeShowDay function to prevent selection of weekends. 8244 * @param date Date - the date to customise 8245 * @return [boolean, string] - is this date selectable?, what is its CSS class? 8246 */ 8247 noWeekends: function( date ) { 8248 var day = date.getDay(); 8249 return [ ( day > 0 && day < 6 ), "" ]; 8250 }, 8251 8252 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 8253 * @param date Date - the date to get the week for 8254 * @return number - the number of the week within the year that contains this date 8255 */ 8256 iso8601Week: function( date ) { 8257 var time, 8258 checkDate = new Date( date.getTime() ); 8259 8260 // Find Thursday of this week starting on Monday 8261 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 8262 8263 time = checkDate.getTime(); 8264 checkDate.setMonth( 0 ); // Compare with Jan 1 8265 checkDate.setDate( 1 ); 8266 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 8267 }, 8268 8269 /* Parse a string value into a date object. 8270 * See formatDate below for the possible formats. 8271 * 8272 * @param format string - the expected format of the date 8273 * @param value string - the date in the above format 8274 * @param settings Object - attributes include: 8275 * shortYearCutoff number - the cutoff year for determining the century (optional) 8276 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8277 * dayNames string[7] - names of the days from Sunday (optional) 8278 * monthNamesShort string[12] - abbreviated names of the months (optional) 8279 * monthNames string[12] - names of the months (optional) 8280 * @return Date - the extracted date value or null if value is blank 8281 */ 8282 parseDate: function( format, value, settings ) { 8283 if ( format == null || value == null ) { 8284 throw "Invalid arguments"; 8285 } 8286 8287 value = ( typeof value === "object" ? value.toString() : value + "" ); 8288 if ( value === "" ) { 8289 return null; 8290 } 8291 8292 var iFormat, dim, extra, 8293 iValue = 0, 8294 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 8295 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 15,177 bytes, lines 8295-8771
8295: 8296 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 8297 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8298 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8299 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8300 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8301 year = -1, 8302 month = -1, 8303 day = -1, 8304 doy = -1, 8305 literal = false, 8306 date, 8307 8308 // Check whether a format character is doubled 8309 lookAhead = function( match ) { 8310 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8311 if ( matches ) { 8312 iFormat++; 8313 } 8314 return matches; 8315 }, 8316 8317 // Extract a number from the string value 8318 getNumber = function( match ) { 8319 var isDoubled = lookAhead( match ), 8320 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 8321 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 8322 minSize = ( match === "y" ? size : 1 ), 8323 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 8324 num = value.substring( iValue ).match( digits ); 8325 if ( !num ) { 8326 throw "Missing number at position " + iValue; 8327 } 8328 iValue += num[ 0 ].length; 8329 return parseInt( num[ 0 ], 10 ); 8330 }, 8331 8332 // Extract a name from the string value and convert to an index 8333 getName = function( match, shortNames, longNames ) { 8334 var index = -1, 8335 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 8336 return [ [ k, v ] ]; 8337 } ).sort( function( a, b ) { 8338 return -( a[ 1 ].length - b[ 1 ].length ); 8339 } ); 8340 8341 $.each( names, function( i, pair ) { 8342 var name = pair[ 1 ]; 8343 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 8344 index = pair[ 0 ]; 8345 iValue += name.length; 8346 return false; 8347 } 8348 } ); 8349 if ( index !== -1 ) { 8350 return index + 1; 8351 } else { 8352 throw "Unknown name at position " + iValue; 8353 } 8354 }, 8355 8356 // Confirm that a literal character matches the string value 8357 checkLiteral = function() { 8358 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 8359 throw "Unexpected literal at position " + iValue; 8360 } 8361 iValue++; 8362 }; 8363 8364 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8365 if ( literal ) { 8366 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8367 literal = false; 8368 } else { 8369 checkLiteral(); 8370 } 8371 } else { 8372 switch ( format.charAt( iFormat ) ) { 8373 case "d": 8374 day = getNumber( "d" ); 8375 break; 8376 case "D": 8377 getName( "D", dayNamesShort, dayNames ); 8378 break; 8379 case "o": 8380 doy = getNumber( "o" ); 8381 break; 8382 case "m": 8383 month = getNumber( "m" ); 8384 break; 8385 case "M": 8386 month = getName( "M", monthNamesShort, monthNames ); 8387 break; 8388 case "y": 8389 year = getNumber( "y" ); 8390 break; 8391 case "@": 8392 date = new Date( getNumber( "@" ) ); 8393 year = date.getFullYear(); 8394 month = date.getMonth() + 1; 8395 day = date.getDate(); 8396 break; 8397 case "!": 8398 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 8399 year = date.getFullYear(); 8400 month = date.getMonth() + 1; 8401 day = date.getDate(); 8402 break; 8403 case "'": 8404 if ( lookAhead( "'" ) ) { 8405 checkLiteral(); 8406 } else { 8407 literal = true; 8408 } 8409 break; 8410 default: 8411 checkLiteral(); 8412 } 8413 } 8414 } 8415 8416 if ( iValue < value.length ) { 8417 extra = value.substr( iValue ); 8418 if ( !/^\s+/.test( extra ) ) { 8419 throw "Extra/unparsed characters found in date: " + extra; 8420 } 8421 } 8422 8423 if ( year === -1 ) { 8424 year = new Date().getFullYear(); 8425 } else if ( year < 100 ) { 8426 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 8427 ( year <= shortYearCutoff ? 0 : -100 ); 8428 } 8429 8430 if ( doy > -1 ) { 8431 month = 1; 8432 day = doy; 8433 do { 8434 dim = this._getDaysInMonth( year, month - 1 ); 8435 if ( day <= dim ) { 8436 break; 8437 } 8438 month++; 8439 day -= dim; 8440 } while ( true ); 8441 } 8442 8443 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 8444 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 8445 throw "Invalid date"; // E.g. 31/02/00 8446 } 8447 return date; 8448 }, 8449 8450 /* Standard date formats. */ 8451 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 8452 COOKIE: "D, dd M yy", 8453 ISO_8601: "yy-mm-dd", 8454 RFC_822: "D, d M y", 8455 RFC_850: "DD, dd-M-y", 8456 RFC_1036: "D, d M y", 8457 RFC_1123: "D, d M yy", 8458 RFC_2822: "D, d M yy", 8459 RSS: "D, d M y", // RFC 822 8460 TICKS: "!", 8461 TIMESTAMP: "@", 8462 W3C: "yy-mm-dd", // ISO 8601 8463 8464 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 8465 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 8466 8467 /* Format a date object into a string value. 8468 * The format can be combinations of the following: 8469 * d - day of month (no leading zero) 8470 * dd - day of month (two digit) 8471 * o - day of year (no leading zeros) 8472 * oo - day of year (three digit) 8473 * D - day name short 8474 * DD - day name long 8475 * m - month of year (no leading zero) 8476 * mm - month of year (two digit) 8477 * M - month name short 8478 * MM - month name long 8479 * y - year (two digit) 8480 * yy - year (four digit) 8481 * @ - Unix timestamp (ms since 01/01/1970) 8482 * ! - Windows ticks (100ns since 01/01/0001) 8483 * "..." - literal text 8484 * '' - single quote 8485 * 8486 * @param format string - the desired format of the date 8487 * @param date Date - the date value to format 8488 * @param settings Object - attributes include: 8489 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8490 * dayNames string[7] - names of the days from Sunday (optional) 8491 * monthNamesShort string[12] - abbreviated names of the months (optional) 8492 * monthNames string[12] - names of the months (optional) 8493 * @return string - the date in the above format 8494 */ 8495 formatDate: function( format, date, settings ) { 8496 if ( !date ) { 8497 return ""; 8498 } 8499 8500 var iFormat, 8501 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8502 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8503 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8504 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8505 8506 // Check whether a format character is doubled 8507 lookAhead = function( match ) { 8508 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8509 if ( matches ) { 8510 iFormat++; 8511 } 8512 return matches; 8513 }, 8514 8515 // Format a number, with leading zero if necessary 8516 formatNumber = function( match, value, len ) { 8517 var num = "" + value; 8518 if ( lookAhead( match ) ) { 8519 while ( num.length < len ) { 8520 num = "0" + num; 8521 } 8522 } 8523 return num; 8524 }, 8525 8526 // Format a name, short or long as requested 8527 formatName = function( match, value, shortNames, longNames ) { 8528 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 8529 }, 8530 output = "", 8531 literal = false; 8532 8533 if ( date ) { 8534 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8535 if ( literal ) { 8536 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8537 literal = false; 8538 } else { 8539 output += format.charAt( iFormat ); 8540 } 8541 } else { 8542 switch ( format.charAt( iFormat ) ) { 8543 case "d": 8544 output += formatNumber( "d", date.getDate(), 2 ); 8545 break; 8546 case "D": 8547 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 8548 break; 8549 case "o": 8550 output += formatNumber( "o", 8551 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 8552 break; 8553 case "m": 8554 output += formatNumber( "m", date.getMonth() + 1, 2 ); 8555 break; 8556 case "M": 8557 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 8558 break; 8559 case "y": 8560 output += ( lookAhead( "y" ) ? date.getFullYear() : 8561 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 8562 break; 8563 case "@": 8564 output += date.getTime(); 8565 break; 8566 case "!": 8567 output += date.getTime() * 10000 + this._ticksTo1970; 8568 break; 8569 case "'": 8570 if ( lookAhead( "'" ) ) { 8571 output += "'"; 8572 } else { 8573 literal = true; 8574 } 8575 break; 8576 default: 8577 output += format.charAt( iFormat ); 8578 } 8579 } 8580 } 8581 } 8582 return output; 8583 }, 8584 8585 /* Extract all possible characters from the date format. */ 8586 _possibleChars: function( format ) { 8587 var iFormat, 8588 chars = "", 8589 literal = false, 8590 8591 // Check whether a format character is doubled 8592 lookAhead = function( match ) { 8593 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8594 if ( matches ) { 8595 iFormat++; 8596 } 8597 return matches; 8598 }; 8599 8600 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8601 if ( literal ) { 8602 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8603 literal = false; 8604 } else { 8605 chars += format.charAt( iFormat ); 8606 } 8607 } else { 8608 switch ( format.charAt( iFormat ) ) { 8609 case "d": case "m": case "y": case "@": 8610 chars += "0123456789"; 8611 break; 8612 case "D": case "M": 8613 return null; // Accept anything 8614 case "'": 8615 if ( lookAhead( "'" ) ) { 8616 chars += "'"; 8617 } else { 8618 literal = true; 8619 } 8620 break; 8621 default: 8622 chars += format.charAt( iFormat ); 8623 } 8624 } 8625 } 8626 return chars; 8627 }, 8628 8629 /* Get a setting value, defaulting if necessary. */ 8630 _get: function( inst, name ) { 8631 return inst.settings[ name ] !== undefined ? 8632 inst.settings[ name ] : this._defaults[ name ]; 8633 }, 8634 8635 /* Parse existing date and initialise date picker. */ 8636 _setDateFromField: function( inst, noDefault ) { 8637 if ( inst.input.val() === inst.lastVal ) { 8638 return; 8639 } 8640 8641 var dateFormat = this._get( inst, "dateFormat" ), 8642 dates = inst.lastVal = inst.input ? inst.input.val() : null, 8643 defaultDate = this._getDefaultDate( inst ), 8644 date = defaultDate, 8645 settings = this._getFormatConfig( inst ); 8646 8647 try { 8648 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 8649 } catch ( event ) { 8650 dates = ( noDefault ? "" : dates ); 8651 } 8652 inst.selectedDay = date.getDate(); 8653 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8654 inst.drawYear = inst.selectedYear = date.getFullYear(); 8655 inst.currentDay = ( dates ? date.getDate() : 0 ); 8656 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 8657 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 8658 this._adjustInstDate( inst ); 8659 }, 8660 8661 /* Retrieve the default date shown on opening. */ 8662 _getDefaultDate: function( inst ) { 8663 return this._restrictMinMax( inst, 8664 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 8665 }, 8666 8667 /* A date may be specified as an exact value or a relative one. */ 8668 _determineDate: function( inst, date, defaultDate ) { 8669 var offsetNumeric = function( offset ) { 8670 var date = new Date(); 8671 date.setDate( date.getDate() + offset ); 8672 return date; 8673 }, 8674 offsetString = function( offset ) { 8675 try { 8676 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8677 offset, $.datepicker._getFormatConfig( inst ) ); 8678 } 8679 catch ( e ) { 8680 8681 // Ignore 8682 } 8683 8684 var date = ( offset.toLowerCase().match( /^c/ ) ? 8685 $.datepicker._getDate( inst ) : null ) || new Date(), 8686 year = date.getFullYear(), 8687 month = date.getMonth(), 8688 day = date.getDate(), 8689 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 8690 matches = pattern.exec( offset ); 8691 8692 while ( matches ) { 8693 switch ( matches[ 2 ] || "d" ) { 8694 case "d" : case "D" : 8695 day += parseInt( matches[ 1 ], 10 ); break; 8696 case "w" : case "W" : 8697 day += parseInt( matches[ 1 ], 10 ) * 7; break; 8698 case "m" : case "M" : 8699 month += parseInt( matches[ 1 ], 10 ); 8700 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8701 break; 8702 case "y": case "Y" : 8703 year += parseInt( matches[ 1 ], 10 ); 8704 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8705 break; 8706 } 8707 matches = pattern.exec( offset ); 8708 } 8709 return new Date( year, month, day ); 8710 }, 8711 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 8712 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 8713 8714 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 8715 if ( newDate ) { 8716 newDate.setHours( 0 ); 8717 newDate.setMinutes( 0 ); 8718 newDate.setSeconds( 0 ); 8719 newDate.setMilliseconds( 0 ); 8720 } 8721 return this._daylightSavingAdjust( newDate ); 8722 }, 8723 8724 /* Handle switch to/from daylight saving. 8725 * Hours may be non-zero on daylight saving cut-over: 8726 * > 12 when midnight changeover, but then cannot generate 8727 * midnight datetime, so jump to 1AM, otherwise reset. 8728 * @param date (Date) the date to check 8729 * @return (Date) the corrected date 8730 */ 8731 _daylightSavingAdjust: function( date ) { 8732 if ( !date ) { 8733 return null; 8734 } 8735 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 8736 return date; 8737 }, 8738 8739 /* Set the date(s) directly. */ 8740 _setDate: function( inst, date, noChange ) { 8741 var clear = !date, 8742 origMonth = inst.selectedMonth, 8743 origYear = inst.selectedYear, 8744 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 8745 8746 inst.selectedDay = inst.currentDay = newDate.getDate(); 8747 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 8748 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 8749 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 8750 this._notifyChange( inst ); 8751 } 8752 this._adjustInstDate( inst ); 8753 if ( inst.input ) { 8754 inst.input.val( clear ? "" : this._formatDate( inst ) ); 8755 } 8756 }, 8757 8758 /* Retrieve the date(s) directly. */ 8759 _getDate: function( inst ) { 8760 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 8761 this._daylightSavingAdjust( new Date( 8762 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 8763 return startDate; 8764 }, 8765 8766 /* Attach the onxxx handlers. These are declared statically so 8767 * they work with static code transformers like Caja. 8768 */ 8769 _attachHandlers: function( inst ) { 8770 var stepMonths = this._get( inst, "stepMonths" ), 8771 id = "#" + inst.id.replace( /\\\\/g, "\\" );
vendor: 42,089 bytes, lines 8772-9957
8772 inst.dpDiv.find( "[data-handler]" ).map( function() { 8773 var handler = { 8774 prev: function() { 8775 $.datepicker._adjustDate( id, -stepMonths, "M" ); 8776 }, 8777 next: function() { 8778 $.datepicker._adjustDate( id, +stepMonths, "M" ); 8779 }, 8780 hide: function() { 8781 $.datepicker._hideDatepicker(); 8782 }, 8783 today: function() { 8784 $.datepicker._gotoToday( id ); 8785 }, 8786 selectDay: function() { 8787 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 8788 return false; 8789 }, 8790 selectMonth: function() { 8791 $.datepicker._selectMonthYear( id, this, "M" ); 8792 return false; 8793 }, 8794 selectYear: function() { 8795 $.datepicker._selectMonthYear( id, this, "Y" ); 8796 return false; 8797 } 8798 }; 8799 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 8800 } ); 8801 }, 8802 8803 /* Generate the HTML for the current state of the date picker. */ 8804 _generateHTML: function( inst ) { 8805 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 8806 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 8807 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 8808 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 8809 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 8810 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 8811 tempDate = new Date(), 8812 today = this._daylightSavingAdjust( 8813 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 8814 isRTL = this._get( inst, "isRTL" ), 8815 showButtonPanel = this._get( inst, "showButtonPanel" ), 8816 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 8817 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 8818 numMonths = this._getNumberOfMonths( inst ), 8819 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 8820 stepMonths = this._get( inst, "stepMonths" ), 8821 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 8822 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 8823 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 8824 minDate = this._getMinMaxDate( inst, "min" ), 8825 maxDate = this._getMinMaxDate( inst, "max" ), 8826 drawMonth = inst.drawMonth - showCurrentAtPos, 8827 drawYear = inst.drawYear; 8828 8829 if ( drawMonth < 0 ) { 8830 drawMonth += 12; 8831 drawYear--; 8832 } 8833 if ( maxDate ) { 8834 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 8835 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 8836 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 8837 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 8838 drawMonth--; 8839 if ( drawMonth < 0 ) { 8840 drawMonth = 11; 8841 drawYear--; 8842 } 8843 } 8844 } 8845 inst.drawMonth = drawMonth; 8846 inst.drawYear = drawYear; 8847 8848 prevText = this._get( inst, "prevText" ); 8849 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 8850 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 8851 this._getFormatConfig( inst ) ) ); 8852 8853 prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ? 8854 "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + 8855 " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" : 8856 ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) ); 8857 8858 nextText = this._get( inst, "nextText" ); 8859 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 8860 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 8861 this._getFormatConfig( inst ) ) ); 8862 8863 next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ? 8864 "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + 8865 " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" : 8866 ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) ); 8867 8868 currentText = this._get( inst, "currentText" ); 8869 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 8870 currentText = ( !navigationAsDateFormat ? currentText : 8871 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 8872 8873 controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + 8874 this._get( inst, "closeText" ) + "</button>" : "" ); 8875 8876 buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) + 8877 ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + 8878 ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : ""; 8879 8880 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 8881 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 8882 8883 showWeek = this._get( inst, "showWeek" ); 8884 dayNames = this._get( inst, "dayNames" ); 8885 dayNamesMin = this._get( inst, "dayNamesMin" ); 8886 monthNames = this._get( inst, "monthNames" ); 8887 monthNamesShort = this._get( inst, "monthNamesShort" ); 8888 beforeShowDay = this._get( inst, "beforeShowDay" ); 8889 showOtherMonths = this._get( inst, "showOtherMonths" ); 8890 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 8891 defaultDate = this._getDefaultDate( inst ); 8892 html = ""; 8893 8894 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 8895 group = ""; 8896 this.maxRows = 4; 8897 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 8898 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 8899 cornerClass = " ui-corner-all"; 8900 calender = ""; 8901 if ( isMultiMonth ) { 8902 calender += "<div class='ui-datepicker-group"; 8903 if ( numMonths[ 1 ] > 1 ) { 8904 switch ( col ) { 8905 case 0: calender += " ui-datepicker-group-first"; 8906 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 8907 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 8908 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 8909 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 8910 } 8911 } 8912 calender += "'>"; 8913 } 8914 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 8915 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 8916 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 8917 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 8918 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 8919 "</div><table class='ui-datepicker-calendar'><thead>" + 8920 "<tr>"; 8921 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 8922 for ( dow = 0; dow < 7; dow++ ) { // days of the week 8923 day = ( dow + firstDay ) % 7; 8924 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 8925 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 8926 } 8927 calender += thead + "</tr></thead><tbody>"; 8928 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 8929 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 8930 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 8931 } 8932 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 8933 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 8934 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 8935 this.maxRows = numRows; 8936 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 8937 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 8938 calender += "<tr>"; 8939 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 8940 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 8941 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 8942 daySettings = ( beforeShowDay ? 8943 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 8944 otherMonth = ( printDate.getMonth() !== drawMonth ); 8945 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 8946 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 8947 tbody += "<td class='" + 8948 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 8949 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 8950 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 8951 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 8952 8953 // or defaultDate is current printedDate and defaultDate is selectedDate 8954 " " + this._dayOverClass : "" ) + // highlight selected day 8955 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 8956 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 8957 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 8958 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 8959 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 8960 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 8961 ( otherMonth && !showOtherMonths ? " " : // display for other months 8962 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 8963 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 8964 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 8965 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 8966 "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 8967 printDate.setDate( printDate.getDate() + 1 ); 8968 printDate = this._daylightSavingAdjust( printDate ); 8969 } 8970 calender += tbody + "</tr>"; 8971 } 8972 drawMonth++; 8973 if ( drawMonth > 11 ) { 8974 drawMonth = 0; 8975 drawYear++; 8976 } 8977 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 8978 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 8979 group += calender; 8980 } 8981 html += group; 8982 } 8983 html += buttonPanel; 8984 inst._keyEvent = false; 8985 return html; 8986 }, 8987 8988 /* Generate the month and year header. */ 8989 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 8990 secondary, monthNames, monthNamesShort ) { 8991 8992 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 8993 changeMonth = this._get( inst, "changeMonth" ), 8994 changeYear = this._get( inst, "changeYear" ), 8995 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 8996 html = "<div class='ui-datepicker-title'>", 8997 monthHtml = ""; 8998 8999 // Month selection 9000 if ( secondary || !changeMonth ) { 9001 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 9002 } else { 9003 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 9004 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 9005 monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; 9006 for ( month = 0; month < 12; month++ ) { 9007 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 9008 monthHtml += "<option value='" + month + "'" + 9009 ( month === drawMonth ? " selected='selected'" : "" ) + 9010 ">" + monthNamesShort[ month ] + "</option>"; 9011 } 9012 } 9013 monthHtml += "</select>"; 9014 } 9015 9016 if ( !showMonthAfterYear ) { 9017 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 9018 } 9019 9020 // Year selection 9021 if ( !inst.yearshtml ) { 9022 inst.yearshtml = ""; 9023 if ( secondary || !changeYear ) { 9024 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 9025 } else { 9026 9027 // determine range of years to display 9028 years = this._get( inst, "yearRange" ).split( ":" ); 9029 thisYear = new Date().getFullYear(); 9030 determineYear = function( value ) { 9031 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 9032 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 9033 parseInt( value, 10 ) ) ); 9034 return ( isNaN( year ) ? thisYear : year ); 9035 }; 9036 year = determineYear( years[ 0 ] ); 9037 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 9038 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 9039 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 9040 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; 9041 for ( ; year <= endYear; year++ ) { 9042 inst.yearshtml += "<option value='" + year + "'" + 9043 ( year === drawYear ? " selected='selected'" : "" ) + 9044 ">" + year + "</option>"; 9045 } 9046 inst.yearshtml += "</select>"; 9047 9048 html += inst.yearshtml; 9049 inst.yearshtml = null; 9050 } 9051 } 9052 9053 html += this._get( inst, "yearSuffix" ); 9054 if ( showMonthAfterYear ) { 9055 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 9056 } 9057 html += "</div>"; // Close datepicker_header 9058 return html; 9059 }, 9060 9061 /* Adjust one of the date sub-fields. */ 9062 _adjustInstDate: function( inst, offset, period ) { 9063 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 9064 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 9065 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 9066 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 9067 9068 inst.selectedDay = date.getDate(); 9069 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9070 inst.drawYear = inst.selectedYear = date.getFullYear(); 9071 if ( period === "M" || period === "Y" ) { 9072 this._notifyChange( inst ); 9073 } 9074 }, 9075 9076 /* Ensure a date is within any min/max bounds. */ 9077 _restrictMinMax: function( inst, date ) { 9078 var minDate = this._getMinMaxDate( inst, "min" ), 9079 maxDate = this._getMinMaxDate( inst, "max" ), 9080 newDate = ( minDate && date < minDate ? minDate : date ); 9081 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 9082 }, 9083 9084 /* Notify change of month/year. */ 9085 _notifyChange: function( inst ) { 9086 var onChange = this._get( inst, "onChangeMonthYear" ); 9087 if ( onChange ) { 9088 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 9089 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 9090 } 9091 }, 9092 9093 /* Determine the number of months to show. */ 9094 _getNumberOfMonths: function( inst ) { 9095 var numMonths = this._get( inst, "numberOfMonths" ); 9096 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 9097 }, 9098 9099 /* Determine the current maximum date - ensure no time components are set. */ 9100 _getMinMaxDate: function( inst, minMax ) { 9101 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 9102 }, 9103 9104 /* Find the number of days in a given month. */ 9105 _getDaysInMonth: function( year, month ) { 9106 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 9107 }, 9108 9109 /* Find the day of the week of the first of a month. */ 9110 _getFirstDayOfMonth: function( year, month ) { 9111 return new Date( year, month, 1 ).getDay(); 9112 }, 9113 9114 /* Determines if we should allow a "next/prev" month display change. */ 9115 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 9116 var numMonths = this._getNumberOfMonths( inst ), 9117 date = this._daylightSavingAdjust( new Date( curYear, 9118 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 9119 9120 if ( offset < 0 ) { 9121 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 9122 } 9123 return this._isInRange( inst, date ); 9124 }, 9125 9126 /* Is the given date in the accepted range? */ 9127 _isInRange: function( inst, date ) { 9128 var yearSplit, currentYear, 9129 minDate = this._getMinMaxDate( inst, "min" ), 9130 maxDate = this._getMinMaxDate( inst, "max" ), 9131 minYear = null, 9132 maxYear = null, 9133 years = this._get( inst, "yearRange" ); 9134 if ( years ) { 9135 yearSplit = years.split( ":" ); 9136 currentYear = new Date().getFullYear(); 9137 minYear = parseInt( yearSplit[ 0 ], 10 ); 9138 maxYear = parseInt( yearSplit[ 1 ], 10 ); 9139 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 9140 minYear += currentYear; 9141 } 9142 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 9143 maxYear += currentYear; 9144 } 9145 } 9146 9147 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 9148 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 9149 ( !minYear || date.getFullYear() >= minYear ) && 9150 ( !maxYear || date.getFullYear() <= maxYear ) ); 9151 }, 9152 9153 /* Provide the configuration settings for formatting/parsing. */ 9154 _getFormatConfig: function( inst ) { 9155 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 9156 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 9157 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 9158 return { shortYearCutoff: shortYearCutoff, 9159 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 9160 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 9161 }, 9162 9163 /* Format the given date for display. */ 9164 _formatDate: function( inst, day, month, year ) { 9165 if ( !day ) { 9166 inst.currentDay = inst.selectedDay; 9167 inst.currentMonth = inst.selectedMonth; 9168 inst.currentYear = inst.selectedYear; 9169 } 9170 var date = ( day ? ( typeof day === "object" ? day : 9171 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 9172 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 9173 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 9174 } 9175} ); 9176 9177/* 9178 * Bind hover events for datepicker elements. 9179 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 9180 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 9181 */ 9182function datepicker_bindHover( dpDiv ) { 9183 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 9184 return dpDiv.on( "mouseout", selector, function() { 9185 $( this ).removeClass( "ui-state-hover" ); 9186 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9187 $( this ).removeClass( "ui-datepicker-prev-hover" ); 9188 } 9189 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9190 $( this ).removeClass( "ui-datepicker-next-hover" ); 9191 } 9192 } ) 9193 .on( "mouseover", selector, datepicker_handleMouseover ); 9194} 9195 9196function datepicker_handleMouseover() { 9197 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 9198 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 9199 $( this ).addClass( "ui-state-hover" ); 9200 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9201 $( this ).addClass( "ui-datepicker-prev-hover" ); 9202 } 9203 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9204 $( this ).addClass( "ui-datepicker-next-hover" ); 9205 } 9206 } 9207} 9208 9209/* jQuery extend now ignores nulls! */ 9210function datepicker_extendRemove( target, props ) { 9211 $.extend( target, props ); 9212 for ( var name in props ) { 9213 if ( props[ name ] == null ) { 9214 target[ name ] = props[ name ]; 9215 } 9216 } 9217 return target; 9218} 9219 9220/* Invoke the datepicker functionality. 9221 @param options string - a command, optionally followed by additional parameters or 9222 Object - settings for attaching new datepicker functionality 9223 @return jQuery object */ 9224$.fn.datepicker = function( options ) { 9225 9226 /* Verify an empty collection wasn't passed - Fixes #6976 */ 9227 if ( !this.length ) { 9228 return this; 9229 } 9230 9231 /* Initialise the date picker. */ 9232 if ( !$.datepicker.initialized ) { 9233 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 9234 $.datepicker.initialized = true; 9235 } 9236 9237 /* Append datepicker main container to body if not exist. */ 9238 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 9239 $( "body" ).append( $.datepicker.dpDiv ); 9240 } 9241 9242 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 9243 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 9244 return $.datepicker[ "_" + options + "Datepicker" ]. 9245 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9246 } 9247 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 9248 return $.datepicker[ "_" + options + "Datepicker" ]. 9249 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9250 } 9251 return this.each( function() { 9252 typeof options === "string" ? 9253 $.datepicker[ "_" + options + "Datepicker" ]. 9254 apply( $.datepicker, [ this ].concat( otherArgs ) ) : 9255 $.datepicker._attachDatepicker( this, options ); 9256 } ); 9257}; 9258 9259$.datepicker = new Datepicker(); // singleton instance 9260$.datepicker.initialized = false; 9261$.datepicker.uuid = new Date().getTime(); 9262$.datepicker.version = "1.12.0"; 9263 9264var widgetsDatepicker = $.datepicker; 9265 9266 9267 9268 9269// This file is deprecated 9270var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 9271 9272/*! 9273 * jQuery UI Mouse 1.12.0 9274 * http://jqueryui.com 9275 * 9276 * Copyright jQuery Foundation and other contributors 9277 * Released under the MIT license. 9278 * http://jquery.org/license 9279 */ 9280 9281//>>label: Mouse 9282//>>group: Widgets 9283//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 9284//>>docs: http://api.jqueryui.com/mouse/ 9285 9286 9287 9288var mouseHandled = false; 9289$( document ).on( "mouseup", function() { 9290 mouseHandled = false; 9291} ); 9292 9293var widgetsMouse = $.widget( "ui.mouse", { 9294 version: "1.12.0", 9295 options: { 9296 cancel: "input, textarea, button, select, option", 9297 distance: 1, 9298 delay: 0 9299 }, 9300 _mouseInit: function() { 9301 var that = this; 9302 9303 this.element 9304 .on( "mousedown." + this.widgetName, function( event ) { 9305 return that._mouseDown( event ); 9306 } ) 9307 .on( "click." + this.widgetName, function( event ) { 9308 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 9309 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 9310 event.stopImmediatePropagation(); 9311 return false; 9312 } 9313 } ); 9314 9315 this.started = false; 9316 }, 9317 9318 // TODO: make sure destroying one instance of mouse doesn't mess with 9319 // other instances of mouse 9320 _mouseDestroy: function() { 9321 this.element.off( "." + this.widgetName ); 9322 if ( this._mouseMoveDelegate ) { 9323 this.document 9324 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9325 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9326 } 9327 }, 9328 9329 _mouseDown: function( event ) { 9330 9331 // don't let more than one widget handle mouseStart 9332 if ( mouseHandled ) { 9333 return; 9334 } 9335 9336 this._mouseMoved = false; 9337 9338 // We may have missed mouseup (out of window) 9339 ( this._mouseStarted && this._mouseUp( event ) ); 9340 9341 this._mouseDownEvent = event; 9342 9343 var that = this, 9344 btnIsLeft = ( event.which === 1 ), 9345 9346 // event.target.nodeName works around a bug in IE 8 with 9347 // disabled inputs (#7620) 9348 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 9349 $( event.target ).closest( this.options.cancel ).length : false ); 9350 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 9351 return true; 9352 } 9353 9354 this.mouseDelayMet = !this.options.delay; 9355 if ( !this.mouseDelayMet ) { 9356 this._mouseDelayTimer = setTimeout( function() { 9357 that.mouseDelayMet = true; 9358 }, this.options.delay ); 9359 } 9360 9361 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 9362 this._mouseStarted = ( this._mouseStart( event ) !== false ); 9363 if ( !this._mouseStarted ) { 9364 event.preventDefault(); 9365 return true; 9366 } 9367 } 9368 9369 // Click event may never have fired (Gecko & Opera) 9370 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 9371 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 9372 } 9373 9374 // These delegates are required to keep context 9375 this._mouseMoveDelegate = function( event ) { 9376 return that._mouseMove( event ); 9377 }; 9378 this._mouseUpDelegate = function( event ) { 9379 return that._mouseUp( event ); 9380 }; 9381 9382 this.document 9383 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9384 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9385 9386 event.preventDefault(); 9387 9388 mouseHandled = true; 9389 return true; 9390 }, 9391 9392 _mouseMove: function( event ) { 9393 9394 // Only check for mouseups outside the document if you've moved inside the document 9395 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 9396 // fire a mousemove event if content is placed under the cursor. See #7778 9397 // Support: IE <9 9398 if ( this._mouseMoved ) { 9399 9400 // IE mouseup check - mouseup happened when mouse was out of window 9401 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 9402 !event.button ) { 9403 return this._mouseUp( event ); 9404 9405 // Iframe mouseup check - mouseup occurred in another document 9406 } else if ( !event.which ) { 9407 9408 // Support: Safari <=8 - 9 9409 // Safari sets which to 0 if you press any of the following keys 9410 // during a drag (#14461) 9411 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 9412 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 9413 this.ignoreMissingWhich = true; 9414 } else if ( !this.ignoreMissingWhich ) { 9415 return this._mouseUp( event ); 9416 } 9417 } 9418 } 9419 9420 if ( event.which || event.button ) { 9421 this._mouseMoved = true; 9422 } 9423 9424 if ( this._mouseStarted ) { 9425 this._mouseDrag( event ); 9426 return event.preventDefault(); 9427 } 9428 9429 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 9430 this._mouseStarted = 9431 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 9432 ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) ); 9433 } 9434 9435 return !this._mouseStarted; 9436 }, 9437 9438 _mouseUp: function( event ) { 9439 this.document 9440 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9441 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9442 9443 if ( this._mouseStarted ) { 9444 this._mouseStarted = false; 9445 9446 if ( event.target === this._mouseDownEvent.target ) { 9447 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 9448 } 9449 9450 this._mouseStop( event ); 9451 } 9452 9453 if ( this._mouseDelayTimer ) { 9454 clearTimeout( this._mouseDelayTimer ); 9455 delete this._mouseDelayTimer; 9456 } 9457 9458 this.ignoreMissingWhich = false; 9459 mouseHandled = false; 9460 event.preventDefault(); 9461 }, 9462 9463 _mouseDistanceMet: function( event ) { 9464 return ( Math.max( 9465 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 9466 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 9467 ) >= this.options.distance 9468 ); 9469 }, 9470 9471 _mouseDelayMet: function( /* event */ ) { 9472 return this.mouseDelayMet; 9473 }, 9474 9475 // These are placeholder methods, to be overriden by extending plugin 9476 _mouseStart: function( /* event */ ) {}, 9477 _mouseDrag: function( /* event */ ) {}, 9478 _mouseStop: function( /* event */ ) {}, 9479 _mouseCapture: function( /* event */ ) { return true; } 9480} ); 9481 9482 9483 9484 9485// $.ui.plugin is deprecated. Use $.widget() extensions instead. 9486var plugin = $.ui.plugin = { 9487 add: function( module, option, set ) { 9488 var i, 9489 proto = $.ui[ module ].prototype; 9490 for ( i in set ) { 9491 proto.plugins[ i ] = proto.plugins[ i ] || []; 9492 proto.plugins[ i ].push( [ option, set[ i ] ] ); 9493 } 9494 }, 9495 call: function( instance, name, args, allowDisconnected ) { 9496 var i, 9497 set = instance.plugins[ name ]; 9498 9499 if ( !set ) { 9500 return; 9501 } 9502 9503 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 9504 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 9505 return; 9506 } 9507 9508 for ( i = 0; i < set.length; i++ ) { 9509 if ( instance.options[ set[ i ][ 0 ] ] ) { 9510 set[ i ][ 1 ].apply( instance.element, args ); 9511 } 9512 } 9513 } 9514}; 9515 9516 9517 9518var safeBlur = $.ui.safeBlur = function( element ) { 9519 9520 // Support: IE9 - 10 only 9521 // If the <body> is blurred, IE will switch windows, see #9420 9522 if ( element && element.nodeName.toLowerCase() !== "body" ) { 9523 $( element ).trigger( "blur" ); 9524 } 9525}; 9526 9527 9528/*! 9529 * jQuery UI Draggable 1.12.0 9530 * http://jqueryui.com 9531 * 9532 * Copyright jQuery Foundation and other contributors 9533 * Released under the MIT license. 9534 * http://jquery.org/license 9535 */ 9536 9537//>>label: Draggable 9538//>>group: Interactions 9539//>>description: Enables dragging functionality for any element. 9540//>>docs: http://api.jqueryui.com/draggable/ 9541//>>demos: http://jqueryui.com/draggable/ 9542//>>css.structure: ../../themes/base/draggable.css 9543 9544 9545 9546$.widget( "ui.draggable", $.ui.mouse, { 9547 version: "1.12.0", 9548 widgetEventPrefix: "drag", 9549 options: { 9550 addClasses: true, 9551 appendTo: "parent", 9552 axis: false, 9553 connectToSortable: false, 9554 containment: false, 9555 cursor: "auto", 9556 cursorAt: false, 9557 grid: false, 9558 handle: false, 9559 helper: "original", 9560 iframeFix: false, 9561 opacity: false, 9562 refreshPositions: false, 9563 revert: false, 9564 revertDuration: 500, 9565 scope: "default", 9566 scroll: true, 9567 scrollSensitivity: 20, 9568 scrollSpeed: 20, 9569 snap: false, 9570 snapMode: "both", 9571 snapTolerance: 20, 9572 stack: false, 9573 zIndex: false, 9574 9575 // Callbacks 9576 drag: null, 9577 start: null, 9578 stop: null 9579 }, 9580 _create: function() { 9581 9582 if ( this.options.helper === "original" ) { 9583 this._setPositionRelative(); 9584 } 9585 if ( this.options.addClasses ) { 9586 this._addClass( "ui-draggable" ); 9587 } 9588 this._setHandleClassName(); 9589 9590 this._mouseInit(); 9591 }, 9592 9593 _setOption: function( key, value ) { 9594 this._super( key, value ); 9595 if ( key === "handle" ) { 9596 this._removeHandleClassName(); 9597 this._setHandleClassName(); 9598 } 9599 }, 9600 9601 _destroy: function() { 9602 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 9603 this.destroyOnClear = true; 9604 return; 9605 } 9606 this._removeHandleClassName(); 9607 this._mouseDestroy(); 9608 }, 9609 9610 _mouseCapture: function( event ) { 9611 var o = this.options; 9612 9613 this._blurActiveElement( event ); 9614 9615 // Among others, prevent a drag on a resizable-handle 9616 if ( this.helper || o.disabled || 9617 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 9618 return false; 9619 } 9620 9621 //Quit if we're not on a valid handle 9622 this.handle = this._getHandle( event ); 9623 if ( !this.handle ) { 9624 return false; 9625 } 9626 9627 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 9628 9629 return true; 9630 9631 }, 9632 9633 _blockFrames: function( selector ) { 9634 this.iframeBlocks = this.document.find( selector ).map( function() { 9635 var iframe = $( this ); 9636 9637 return $( "<div>" ) 9638 .css( "position", "absolute" ) 9639 .appendTo( iframe.parent() ) 9640 .outerWidth( iframe.outerWidth() ) 9641 .outerHeight( iframe.outerHeight() ) 9642 .offset( iframe.offset() )[ 0 ]; 9643 } ); 9644 }, 9645 9646 _unblockFrames: function() { 9647 if ( this.iframeBlocks ) { 9648 this.iframeBlocks.remove(); 9649 delete this.iframeBlocks; 9650 } 9651 }, 9652 9653 _blurActiveElement: function( event ) { 9654 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 9655 target = $( event.target ); 9656 9657 // Only blur if the event occurred on an element that is: 9658 // 1) within the draggable handle 9659 // 2) but not within the currently focused element 9660 // See #10527, #12472 9661 if ( this._getHandle( event ) && target.closest( activeElement ).length ) { 9662 return; 9663 } 9664 9665 // Blur any element that currently has focus, see #4261 9666 $.ui.safeBlur( activeElement ); 9667 }, 9668 9669 _mouseStart: function( event ) { 9670 9671 var o = this.options; 9672 9673 //Create and append the visible helper 9674 this.helper = this._createHelper( event ); 9675 9676 this._addClass( this.helper, "ui-draggable-dragging" ); 9677 9678 //Cache the helper size 9679 this._cacheHelperProportions(); 9680 9681 //If ddmanager is used for droppables, set the global draggable 9682 if ( $.ui.ddmanager ) { 9683 $.ui.ddmanager.current = this; 9684 } 9685 9686 /* 9687 * - Position generation - 9688 * This block generates everything position related - it's the core of draggables. 9689 */ 9690 9691 //Cache the margins of the original element 9692 this._cacheMargins(); 9693 9694 //Store the helper's css position 9695 this.cssPosition = this.helper.css( "position" ); 9696 this.scrollParent = this.helper.scrollParent( true ); 9697 this.offsetParent = this.helper.offsetParent(); 9698 this.hasFixedAncestor = this.helper.parents().filter( function() { 9699 return $( this ).css( "position" ) === "fixed"; 9700 } ).length > 0; 9701 9702 //The element's absolute position on the page minus margins 9703 this.positionAbs = this.element.offset(); 9704 this._refreshOffsets( event ); 9705 9706 //Generate the original position 9707 this.originalPosition = this.position = this._generatePosition( event, false ); 9708 this.originalPageX = event.pageX; 9709 this.originalPageY = event.pageY; 9710 9711 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 9712 ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); 9713 9714 //Set a containment if given in the options 9715 this._setContainment(); 9716 9717 //Trigger event + callbacks 9718 if ( this._trigger( "start", event ) === false ) { 9719 this._clear(); 9720 return false; 9721 } 9722 9723 //Recache the helper size 9724 this._cacheHelperProportions(); 9725 9726 //Prepare the droppable offsets 9727 if ( $.ui.ddmanager && !o.dropBehaviour ) { 9728 $.ui.ddmanager.prepareOffsets( this, event ); 9729 } 9730 9731 // Execute the drag once - this causes the helper not to be visible before getting its 9732 // correct position 9733 this._mouseDrag( event, true ); 9734 9735 // If the ddmanager is used for droppables, inform the manager that dragging has started 9736 // (see #5003) 9737 if ( $.ui.ddmanager ) { 9738 $.ui.ddmanager.dragStart( this, event ); 9739 } 9740 9741 return true; 9742 }, 9743 9744 _refreshOffsets: function( event ) { 9745 this.offset = { 9746 top: this.positionAbs.top - this.margins.top, 9747 left: this.positionAbs.left - this.margins.left, 9748 scroll: false, 9749 parent: this._getParentOffset(), 9750 relative: this._getRelativeOffset() 9751 }; 9752 9753 this.offset.click = { 9754 left: event.pageX - this.offset.left, 9755 top: event.pageY - this.offset.top 9756 }; 9757 }, 9758 9759 _mouseDrag: function( event, noPropagation ) { 9760 9761 // reset any necessary cached properties (see #5009) 9762 if ( this.hasFixedAncestor ) { 9763 this.offset.parent = this._getParentOffset(); 9764 } 9765 9766 //Compute the helpers position 9767 this.position = this._generatePosition( event, true ); 9768 this.positionAbs = this._convertPositionTo( "absolute" ); 9769 9770 //Call plugins and callbacks and use the resulting position if something is returned 9771 if ( !noPropagation ) { 9772 var ui = this._uiHash(); 9773 if ( this._trigger( "drag", event, ui ) === false ) { 9774 this._mouseUp( new $.Event( "mouseup", event ) ); 9775 return false; 9776 } 9777 this.position = ui.position; 9778 } 9779 9780 this.helper[ 0 ].style.left = this.position.left + "px"; 9781 this.helper[ 0 ].style.top = this.position.top + "px"; 9782 9783 if ( $.ui.ddmanager ) { 9784 $.ui.ddmanager.drag( this, event ); 9785 } 9786 9787 return false; 9788 }, 9789 9790 _mouseStop: function( event ) { 9791 9792 //If we are using droppables, inform the manager about the drop 9793 var that = this, 9794 dropped = false; 9795 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 9796 dropped = $.ui.ddmanager.drop( this, event ); 9797 } 9798 9799 //if a drop comes from outside (a sortable) 9800 if ( this.dropped ) { 9801 dropped = this.dropped; 9802 this.dropped = false; 9803 } 9804 9805 if ( ( this.options.revert === "invalid" && !dropped ) || 9806 ( this.options.revert === "valid" && dropped ) || 9807 this.options.revert === true || ( $.isFunction( this.options.revert ) && 9808 this.options.revert.call( this.element, dropped ) ) 9809 ) { 9810 $( this.helper ).animate( 9811 this.originalPosition, 9812 parseInt( this.options.revertDuration, 10 ), 9813 function() { 9814 if ( that._trigger( "stop", event ) !== false ) { 9815 that._clear(); 9816 } 9817 } 9818 ); 9819 } else { 9820 if ( this._trigger( "stop", event ) !== false ) { 9821 this._clear(); 9822 } 9823 } 9824 9825 return false; 9826 }, 9827 9828 _mouseUp: function( event ) { 9829 this._unblockFrames(); 9830 9831 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 9832 // (see #5003) 9833 if ( $.ui.ddmanager ) { 9834 $.ui.ddmanager.dragStop( this, event ); 9835 } 9836 9837 // Only need to focus if the event occurred on the draggable itself, see #10527 9838 if ( this.handleElement.is( event.target ) ) { 9839 9840 // The interaction is over; whether or not the click resulted in a drag, 9841 // focus the element 9842 this.element.trigger( "focus" ); 9843 } 9844 9845 return $.ui.mouse.prototype._mouseUp.call( this, event ); 9846 }, 9847 9848 cancel: function() { 9849 9850 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 9851 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 9852 } else { 9853 this._clear(); 9854 } 9855 9856 return this; 9857 9858 }, 9859 9860 _getHandle: function( event ) { 9861 return this.options.handle ? 9862 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 9863 true; 9864 }, 9865 9866 _setHandleClassName: function() { 9867 this.handleElement = this.options.handle ? 9868 this.element.find( this.options.handle ) : this.element; 9869 this._addClass( this.handleElement, "ui-draggable-handle" ); 9870 }, 9871 9872 _removeHandleClassName: function() { 9873 this._removeClass( this.handleElement, "ui-draggable-handle" ); 9874 }, 9875 9876 _createHelper: function( event ) { 9877 9878 var o = this.options, 9879 helperIsFunction = $.isFunction( o.helper ), 9880 helper = helperIsFunction ? 9881 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 9882 ( o.helper === "clone" ? 9883 this.element.clone().removeAttr( "id" ) : 9884 this.element ); 9885 9886 if ( !helper.parents( "body" ).length ) { 9887 helper.appendTo( ( o.appendTo === "parent" ? 9888 this.element[ 0 ].parentNode : 9889 o.appendTo ) ); 9890 } 9891 9892 // Http://bugs.jqueryui.com/ticket/9446 9893 // a helper function can return the original element 9894 // which wouldn't have been set to relative in _create 9895 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 9896 this._setPositionRelative(); 9897 } 9898 9899 if ( helper[ 0 ] !== this.element[ 0 ] && 9900 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 9901 helper.css( "position", "absolute" ); 9902 } 9903 9904 return helper; 9905 9906 }, 9907 9908 _setPositionRelative: function() { 9909 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 9910 this.element[ 0 ].style.position = "relative"; 9911 } 9912 }, 9913 9914 _adjustOffsetFromHelper: function( obj ) { 9915 if ( typeof obj === "string" ) { 9916 obj = obj.split( " " ); 9917 } 9918 if ( $.isArray( obj ) ) { 9919 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 9920 } 9921 if ( "left" in obj ) { 9922 this.offset.click.left = obj.left + this.margins.left; 9923 } 9924 if ( "right" in obj ) { 9925 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 9926 } 9927 if ( "top" in obj ) { 9928 this.offset.click.top = obj.top + this.margins.top; 9929 } 9930 if ( "bottom" in obj ) { 9931 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 9932 } 9933 }, 9934 9935 _isRootNode: function( element ) { 9936 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 9937 }, 9938 9939 _getParentOffset: function() { 9940 9941 //Get the offsetParent and cache its position 9942 var po = this.offsetParent.offset(), 9943 document = this.document[ 0 ]; 9944 9945 // This is a special case where we need to modify a offset calculated on start, since the 9946 // following happened: 9947 // 1. The position of the helper is absolute, so it's position is calculated based on the 9948 // next positioned parent 9949 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 9950 // the document, which means that the scroll is included in the initial calculation of the 9951 // offset of the parent, and never recalculated upon drag 9952 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 9953 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 9954 po.left += this.scrollParent.scrollLeft(); 9955 po.top += this.scrollParent.scrollTop(); 9956 } 9957
vendor: 13,156 bytes, lines 9958-10386
9958 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 9959 po = { top: 0, left: 0 }; 9960 } 9961 9962 return { 9963 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 9964 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 9965 }; 9966 9967 }, 9968 9969 _getRelativeOffset: function() { 9970 if ( this.cssPosition !== "relative" ) { 9971 return { top: 0, left: 0 }; 9972 } 9973 9974 var p = this.element.position(), 9975 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 9976 9977 return { 9978 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 9979 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 9980 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 9981 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 9982 }; 9983 9984 }, 9985 9986 _cacheMargins: function() { 9987 this.margins = { 9988 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 9989 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 9990 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 9991 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 9992 }; 9993 }, 9994 9995 _cacheHelperProportions: function() { 9996 this.helperProportions = { 9997 width: this.helper.outerWidth(), 9998 height: this.helper.outerHeight() 9999 }; 10000 }, 10001 10002 _setContainment: function() { 10003 10004 var isUserScrollable, c, ce, 10005 o = this.options, 10006 document = this.document[ 0 ]; 10007 10008 this.relativeContainer = null; 10009 10010 if ( !o.containment ) { 10011 this.containment = null; 10012 return; 10013 } 10014 10015 if ( o.containment === "window" ) { 10016 this.containment = [ 10017 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 10018 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 10019 $( window ).scrollLeft() + $( window ).width() - 10020 this.helperProportions.width - this.margins.left, 10021 $( window ).scrollTop() + 10022 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 10023 this.helperProportions.height - this.margins.top 10024 ]; 10025 return; 10026 } 10027 10028 if ( o.containment === "document" ) { 10029 this.containment = [ 10030 0, 10031 0, 10032 $( document ).width() - this.helperProportions.width - this.margins.left, 10033 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 10034 this.helperProportions.height - this.margins.top 10035 ]; 10036 return; 10037 } 10038 10039 if ( o.containment.constructor === Array ) { 10040 this.containment = o.containment; 10041 return; 10042 } 10043 10044 if ( o.containment === "parent" ) { 10045 o.containment = this.helper[ 0 ].parentNode; 10046 } 10047 10048 c = $( o.containment ); 10049 ce = c[ 0 ]; 10050 10051 if ( !ce ) { 10052 return; 10053 } 10054 10055 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 10056 10057 this.containment = [ 10058 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 10059 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 10060 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 10061 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 10062 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 10063 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 10064 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 10065 this.helperProportions.width - 10066 this.margins.left - 10067 this.margins.right, 10068 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 10069 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 10070 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 10071 this.helperProportions.height - 10072 this.margins.top - 10073 this.margins.bottom 10074 ]; 10075 this.relativeContainer = c; 10076 }, 10077 10078 _convertPositionTo: function( d, pos ) { 10079 10080 if ( !pos ) { 10081 pos = this.position; 10082 } 10083 10084 var mod = d === "absolute" ? 1 : -1, 10085 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10086 10087 return { 10088 top: ( 10089 10090 // The absolute mouse position 10091 pos.top + 10092 10093 // Only for relative positioned nodes: Relative offset from element to offset parent 10094 this.offset.relative.top * mod + 10095 10096 // The offsetParent's offset without borders (offset + border) 10097 this.offset.parent.top * mod - 10098 ( ( this.cssPosition === "fixed" ? 10099 -this.offset.scroll.top : 10100 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 10101 ), 10102 left: ( 10103 10104 // The absolute mouse position 10105 pos.left + 10106 10107 // Only for relative positioned nodes: Relative offset from element to offset parent 10108 this.offset.relative.left * mod + 10109 10110 // The offsetParent's offset without borders (offset + border) 10111 this.offset.parent.left * mod - 10112 ( ( this.cssPosition === "fixed" ? 10113 -this.offset.scroll.left : 10114 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 10115 ) 10116 }; 10117 10118 }, 10119 10120 _generatePosition: function( event, constrainPosition ) { 10121 10122 var containment, co, top, left, 10123 o = this.options, 10124 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 10125 pageX = event.pageX, 10126 pageY = event.pageY; 10127 10128 // Cache the scroll 10129 if ( !scrollIsRootNode || !this.offset.scroll ) { 10130 this.offset.scroll = { 10131 top: this.scrollParent.scrollTop(), 10132 left: this.scrollParent.scrollLeft() 10133 }; 10134 } 10135 10136 /* 10137 * - Position constraining - 10138 * Constrain the position to a mix of grid, containment. 10139 */ 10140 10141 // If we are not dragging yet, we won't check for options 10142 if ( constrainPosition ) { 10143 if ( this.containment ) { 10144 if ( this.relativeContainer ) { 10145 co = this.relativeContainer.offset(); 10146 containment = [ 10147 this.containment[ 0 ] + co.left, 10148 this.containment[ 1 ] + co.top, 10149 this.containment[ 2 ] + co.left, 10150 this.containment[ 3 ] + co.top 10151 ]; 10152 } else { 10153 containment = this.containment; 10154 } 10155 10156 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 10157 pageX = containment[ 0 ] + this.offset.click.left; 10158 } 10159 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 10160 pageY = containment[ 1 ] + this.offset.click.top; 10161 } 10162 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 10163 pageX = containment[ 2 ] + this.offset.click.left; 10164 } 10165 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 10166 pageY = containment[ 3 ] + this.offset.click.top; 10167 } 10168 } 10169 10170 if ( o.grid ) { 10171 10172 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 10173 // argument errors in IE (see ticket #6950) 10174 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 10175 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 10176 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 10177 top - this.offset.click.top > containment[ 3 ] ) ? 10178 top : 10179 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 10180 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 10181 10182 left = o.grid[ 0 ] ? this.originalPageX + 10183 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 10184 this.originalPageX; 10185 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 10186 left - this.offset.click.left > containment[ 2 ] ) ? 10187 left : 10188 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 10189 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 10190 } 10191 10192 if ( o.axis === "y" ) { 10193 pageX = this.originalPageX; 10194 } 10195 10196 if ( o.axis === "x" ) { 10197 pageY = this.originalPageY; 10198 } 10199 } 10200 10201 return { 10202 top: ( 10203 10204 // The absolute mouse position 10205 pageY - 10206 10207 // Click offset (relative to the element) 10208 this.offset.click.top - 10209 10210 // Only for relative positioned nodes: Relative offset from element to offset parent 10211 this.offset.relative.top - 10212 10213 // The offsetParent's offset without borders (offset + border) 10214 this.offset.parent.top + 10215 ( this.cssPosition === "fixed" ? 10216 -this.offset.scroll.top : 10217 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 10218 ), 10219 left: ( 10220 10221 // The absolute mouse position 10222 pageX - 10223 10224 // Click offset (relative to the element) 10225 this.offset.click.left - 10226 10227 // Only for relative positioned nodes: Relative offset from element to offset parent 10228 this.offset.relative.left - 10229 10230 // The offsetParent's offset without borders (offset + border) 10231 this.offset.parent.left + 10232 ( this.cssPosition === "fixed" ? 10233 -this.offset.scroll.left : 10234 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 10235 ) 10236 }; 10237 10238 }, 10239 10240 _clear: function() { 10241 this._removeClass( this.helper, "ui-draggable-dragging" ); 10242 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 10243 this.helper.remove(); 10244 } 10245 this.helper = null; 10246 this.cancelHelperRemoval = false; 10247 if ( this.destroyOnClear ) { 10248 this.destroy(); 10249 } 10250 }, 10251 10252 // From now on bulk stuff - mainly helpers 10253 10254 _trigger: function( type, event, ui ) { 10255 ui = ui || this._uiHash(); 10256 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 10257 10258 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 10259 if ( /^(drag|start|stop)/.test( type ) ) { 10260 this.positionAbs = this._convertPositionTo( "absolute" ); 10261 ui.offset = this.positionAbs; 10262 } 10263 return $.Widget.prototype._trigger.call( this, type, event, ui ); 10264 }, 10265 10266 plugins: {}, 10267 10268 _uiHash: function() { 10269 return { 10270 helper: this.helper, 10271 position: this.position, 10272 originalPosition: this.originalPosition, 10273 offset: this.positionAbs 10274 }; 10275 } 10276 10277} ); 10278 10279$.ui.plugin.add( "draggable", "connectToSortable", { 10280 start: function( event, ui, draggable ) { 10281 var uiSortable = $.extend( {}, ui, { 10282 item: draggable.element 10283 } ); 10284 10285 draggable.sortables = []; 10286 $( draggable.options.connectToSortable ).each( function() { 10287 var sortable = $( this ).sortable( "instance" ); 10288 10289 if ( sortable && !sortable.options.disabled ) { 10290 draggable.sortables.push( sortable ); 10291 10292 // RefreshPositions is called at drag start to refresh the containerCache 10293 // which is used in drag. This ensures it's initialized and synchronized 10294 // with any changes that might have happened on the page since initialization. 10295 sortable.refreshPositions(); 10296 sortable._trigger( "activate", event, uiSortable ); 10297 } 10298 } ); 10299 }, 10300 stop: function( event, ui, draggable ) { 10301 var uiSortable = $.extend( {}, ui, { 10302 item: draggable.element 10303 } ); 10304 10305 draggable.cancelHelperRemoval = false; 10306 10307 $.each( draggable.sortables, function() { 10308 var sortable = this; 10309 10310 if ( sortable.isOver ) { 10311 sortable.isOver = 0; 10312 10313 // Allow this sortable to handle removing the helper 10314 draggable.cancelHelperRemoval = true; 10315 sortable.cancelHelperRemoval = false; 10316 10317 // Use _storedCSS To restore properties in the sortable, 10318 // as this also handles revert (#9675) since the draggable 10319 // may have modified them in unexpected ways (#8809) 10320 sortable._storedCSS = { 10321 position: sortable.placeholder.css( "position" ), 10322 top: sortable.placeholder.css( "top" ), 10323 left: sortable.placeholder.css( "left" ) 10324 }; 10325 10326 sortable._mouseStop( event ); 10327 10328 // Once drag has ended, the sortable should return to using 10329 // its original helper, not the shared helper from draggable 10330 sortable.options.helper = sortable.options._helper; 10331 } else { 10332 10333 // Prevent this Sortable from removing the helper. 10334 // However, don't set the draggable to remove the helper 10335 // either as another connected Sortable may yet handle the removal. 10336 sortable.cancelHelperRemoval = true; 10337 10338 sortable._trigger( "deactivate", event, uiSortable ); 10339 } 10340 } ); 10341 }, 10342 drag: function( event, ui, draggable ) { 10343 $.each( draggable.sortables, function() { 10344 var innermostIntersecting = false, 10345 sortable = this; 10346 10347 // Copy over variables that sortable's _intersectsWith uses 10348 sortable.positionAbs = draggable.positionAbs; 10349 sortable.helperProportions = draggable.helperProportions; 10350 sortable.offset.click = draggable.offset.click; 10351 10352 if ( sortable._intersectsWith( sortable.containerCache ) ) { 10353 innermostIntersecting = true; 10354 10355 $.each( draggable.sortables, function() { 10356 10357 // Copy over variables that sortable's _intersectsWith uses 10358 this.positionAbs = draggable.positionAbs; 10359 this.helperProportions = draggable.helperProportions; 10360 this.offset.click = draggable.offset.click; 10361 10362 if ( this !== sortable && 10363 this._intersectsWith( this.containerCache ) && 10364 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 10365 innermostIntersecting = false; 10366 } 10367 10368 return innermostIntersecting; 10369 } ); 10370 } 10371 10372 if ( innermostIntersecting ) { 10373 10374 // If it intersects, we use a little isOver variable and set it once, 10375 // so that the move-in stuff gets fired only once. 10376 if ( !sortable.isOver ) { 10377 sortable.isOver = 1; 10378 10379 // Store draggable's parent in case we need to reappend to it later. 10380 draggable._parent = ui.helper.parent(); 10381 10382 sortable.currentItem = ui.helper 10383 .appendTo( sortable.element ) 10384 .data( "ui-sortable-item", true ); 10385 10386 // Store helper option to later restore it
vendor: 11,429 bytes, lines 10387-10761
10387 sortable.options._helper = sortable.options.helper; 10388 10389 sortable.options.helper = function() { 10390 return ui.helper[ 0 ]; 10391 }; 10392 10393 // Fire the start events of the sortable with our passed browser event, 10394 // and our own helper (so it doesn't create a new one) 10395 event.target = sortable.currentItem[ 0 ]; 10396 sortable._mouseCapture( event, true ); 10397 sortable._mouseStart( event, true, true ); 10398 10399 // Because the browser event is way off the new appended portlet, 10400 // modify necessary variables to reflect the changes 10401 sortable.offset.click.top = draggable.offset.click.top; 10402 sortable.offset.click.left = draggable.offset.click.left; 10403 sortable.offset.parent.left -= draggable.offset.parent.left - 10404 sortable.offset.parent.left; 10405 sortable.offset.parent.top -= draggable.offset.parent.top - 10406 sortable.offset.parent.top; 10407 10408 draggable._trigger( "toSortable", event ); 10409 10410 // Inform draggable that the helper is in a valid drop zone, 10411 // used solely in the revert option to handle "valid/invalid". 10412 draggable.dropped = sortable.element; 10413 10414 // Need to refreshPositions of all sortables in the case that 10415 // adding to one sortable changes the location of the other sortables (#9675) 10416 $.each( draggable.sortables, function() { 10417 this.refreshPositions(); 10418 } ); 10419 10420 // Hack so receive/update callbacks work (mostly) 10421 draggable.currentItem = draggable.element; 10422 sortable.fromOutside = draggable; 10423 } 10424 10425 if ( sortable.currentItem ) { 10426 sortable._mouseDrag( event ); 10427 10428 // Copy the sortable's position because the draggable's can potentially reflect 10429 // a relative position, while sortable is always absolute, which the dragged 10430 // element has now become. (#8809) 10431 ui.position = sortable.position; 10432 } 10433 } else { 10434 10435 // If it doesn't intersect with the sortable, and it intersected before, 10436 // we fake the drag stop of the sortable, but make sure it doesn't remove 10437 // the helper by using cancelHelperRemoval. 10438 if ( sortable.isOver ) { 10439 10440 sortable.isOver = 0; 10441 sortable.cancelHelperRemoval = true; 10442 10443 // Calling sortable's mouseStop would trigger a revert, 10444 // so revert must be temporarily false until after mouseStop is called. 10445 sortable.options._revert = sortable.options.revert; 10446 sortable.options.revert = false; 10447 10448 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 10449 sortable._mouseStop( event, true ); 10450 10451 // Restore sortable behaviors that were modfied 10452 // when the draggable entered the sortable area (#9481) 10453 sortable.options.revert = sortable.options._revert; 10454 sortable.options.helper = sortable.options._helper; 10455 10456 if ( sortable.placeholder ) { 10457 sortable.placeholder.remove(); 10458 } 10459 10460 // Restore and recalculate the draggable's offset considering the sortable 10461 // may have modified them in unexpected ways. (#8809, #10669) 10462 ui.helper.appendTo( draggable._parent ); 10463 draggable._refreshOffsets( event ); 10464 ui.position = draggable._generatePosition( event, true ); 10465 10466 draggable._trigger( "fromSortable", event ); 10467 10468 // Inform draggable that the helper is no longer in a valid drop zone 10469 draggable.dropped = false; 10470 10471 // Need to refreshPositions of all sortables just in case removing 10472 // from one sortable changes the location of other sortables (#9675) 10473 $.each( draggable.sortables, function() { 10474 this.refreshPositions(); 10475 } ); 10476 } 10477 } 10478 } ); 10479 } 10480} ); 10481 10482$.ui.plugin.add( "draggable", "cursor", { 10483 start: function( event, ui, instance ) { 10484 var t = $( "body" ), 10485 o = instance.options; 10486 10487 if ( t.css( "cursor" ) ) { 10488 o._cursor = t.css( "cursor" ); 10489 } 10490 t.css( "cursor", o.cursor ); 10491 }, 10492 stop: function( event, ui, instance ) { 10493 var o = instance.options; 10494 if ( o._cursor ) { 10495 $( "body" ).css( "cursor", o._cursor ); 10496 } 10497 } 10498} ); 10499 10500$.ui.plugin.add( "draggable", "opacity", { 10501 start: function( event, ui, instance ) { 10502 var t = $( ui.helper ), 10503 o = instance.options; 10504 if ( t.css( "opacity" ) ) { 10505 o._opacity = t.css( "opacity" ); 10506 } 10507 t.css( "opacity", o.opacity ); 10508 }, 10509 stop: function( event, ui, instance ) { 10510 var o = instance.options; 10511 if ( o._opacity ) { 10512 $( ui.helper ).css( "opacity", o._opacity ); 10513 } 10514 } 10515} ); 10516 10517$.ui.plugin.add( "draggable", "scroll", { 10518 start: function( event, ui, i ) { 10519 if ( !i.scrollParentNotHidden ) { 10520 i.scrollParentNotHidden = i.helper.scrollParent( false ); 10521 } 10522 10523 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 10524 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 10525 i.overflowOffset = i.scrollParentNotHidden.offset(); 10526 } 10527 }, 10528 drag: function( event, ui, i ) { 10529 10530 var o = i.options, 10531 scrolled = false, 10532 scrollParent = i.scrollParentNotHidden[ 0 ], 10533 document = i.document[ 0 ]; 10534 10535 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 10536 if ( !o.axis || o.axis !== "x" ) { 10537 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 10538 o.scrollSensitivity ) { 10539 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 10540 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 10541 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 10542 } 10543 } 10544 10545 if ( !o.axis || o.axis !== "y" ) { 10546 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 10547 o.scrollSensitivity ) { 10548 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 10549 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 10550 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 10551 } 10552 } 10553 10554 } else { 10555 10556 if ( !o.axis || o.axis !== "x" ) { 10557 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 10558 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 10559 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 10560 o.scrollSensitivity ) { 10561 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 10562 } 10563 } 10564 10565 if ( !o.axis || o.axis !== "y" ) { 10566 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 10567 scrolled = $( document ).scrollLeft( 10568 $( document ).scrollLeft() - o.scrollSpeed 10569 ); 10570 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 10571 o.scrollSensitivity ) { 10572 scrolled = $( document ).scrollLeft( 10573 $( document ).scrollLeft() + o.scrollSpeed 10574 ); 10575 } 10576 } 10577 10578 } 10579 10580 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 10581 $.ui.ddmanager.prepareOffsets( i, event ); 10582 } 10583 10584 } 10585} ); 10586 10587$.ui.plugin.add( "draggable", "snap", { 10588 start: function( event, ui, i ) { 10589 10590 var o = i.options; 10591 10592 i.snapElements = []; 10593 10594 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 10595 .each( function() { 10596 var $t = $( this ), 10597 $o = $t.offset(); 10598 if ( this !== i.element[ 0 ] ) { 10599 i.snapElements.push( { 10600 item: this, 10601 width: $t.outerWidth(), height: $t.outerHeight(), 10602 top: $o.top, left: $o.left 10603 } ); 10604 } 10605 } ); 10606 10607 }, 10608 drag: function( event, ui, inst ) { 10609 10610 var ts, bs, ls, rs, l, r, t, b, i, first, 10611 o = inst.options, 10612 d = o.snapTolerance, 10613 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 10614 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 10615 10616 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 10617 10618 l = inst.snapElements[ i ].left - inst.margins.left; 10619 r = l + inst.snapElements[ i ].width; 10620 t = inst.snapElements[ i ].top - inst.margins.top; 10621 b = t + inst.snapElements[ i ].height; 10622 10623 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 10624 !$.contains( inst.snapElements[ i ].item.ownerDocument, 10625 inst.snapElements[ i ].item ) ) { 10626 if ( inst.snapElements[ i ].snapping ) { 10627 ( inst.options.snap.release && 10628 inst.options.snap.release.call( 10629 inst.element, 10630 event, 10631 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 10632 ) ); 10633 } 10634 inst.snapElements[ i ].snapping = false; 10635 continue; 10636 } 10637 10638 if ( o.snapMode !== "inner" ) { 10639 ts = Math.abs( t - y2 ) <= d; 10640 bs = Math.abs( b - y1 ) <= d; 10641 ls = Math.abs( l - x2 ) <= d; 10642 rs = Math.abs( r - x1 ) <= d; 10643 if ( ts ) { 10644 ui.position.top = inst._convertPositionTo( "relative", { 10645 top: t - inst.helperProportions.height, 10646 left: 0 10647 } ).top; 10648 } 10649 if ( bs ) { 10650 ui.position.top = inst._convertPositionTo( "relative", { 10651 top: b, 10652 left: 0 10653 } ).top; 10654 } 10655 if ( ls ) { 10656 ui.position.left = inst._convertPositionTo( "relative", { 10657 top: 0, 10658 left: l - inst.helperProportions.width 10659 } ).left; 10660 } 10661 if ( rs ) { 10662 ui.position.left = inst._convertPositionTo( "relative", { 10663 top: 0, 10664 left: r 10665 } ).left; 10666 } 10667 } 10668 10669 first = ( ts || bs || ls || rs ); 10670 10671 if ( o.snapMode !== "outer" ) { 10672 ts = Math.abs( t - y1 ) <= d; 10673 bs = Math.abs( b - y2 ) <= d; 10674 ls = Math.abs( l - x1 ) <= d; 10675 rs = Math.abs( r - x2 ) <= d; 10676 if ( ts ) { 10677 ui.position.top = inst._convertPositionTo( "relative", { 10678 top: t, 10679 left: 0 10680 } ).top; 10681 } 10682 if ( bs ) { 10683 ui.position.top = inst._convertPositionTo( "relative", { 10684 top: b - inst.helperProportions.height, 10685 left: 0 10686 } ).top; 10687 } 10688 if ( ls ) { 10689 ui.position.left = inst._convertPositionTo( "relative", { 10690 top: 0, 10691 left: l 10692 } ).left; 10693 } 10694 if ( rs ) { 10695 ui.position.left = inst._convertPositionTo( "relative", { 10696 top: 0, 10697 left: r - inst.helperProportions.width 10698 } ).left; 10699 } 10700 } 10701 10702 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 10703 ( inst.options.snap.snap && 10704 inst.options.snap.snap.call( 10705 inst.element, 10706 event, 10707 $.extend( inst._uiHash(), { 10708 snapItem: inst.snapElements[ i ].item 10709 } ) ) ); 10710 } 10711 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 10712 10713 } 10714 10715 } 10716} ); 10717 10718$.ui.plugin.add( "draggable", "stack", { 10719 start: function( event, ui, instance ) { 10720 var min, 10721 o = instance.options, 10722 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 10723 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 10724 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 10725 } ); 10726 10727 if ( !group.length ) { return; } 10728 10729 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 10730 $( group ).each( function( i ) { 10731 $( this ).css( "zIndex", min + i ); 10732 } ); 10733 this.css( "zIndex", ( min + group.length ) ); 10734 } 10735} ); 10736 10737$.ui.plugin.add( "draggable", "zIndex", { 10738 start: function( event, ui, instance ) { 10739 var t = $( ui.helper ), 10740 o = instance.options; 10741 10742 if ( t.css( "zIndex" ) ) { 10743 o._zIndex = t.css( "zIndex" ); 10744 } 10745 t.css( "zIndex", o.zIndex ); 10746 }, 10747 stop: function( event, ui, instance ) { 10748 var o = instance.options; 10749 10750 if ( o._zIndex ) { 10751 $( ui.helper ).css( "zIndex", o._zIndex ); 10752 } 10753 } 10754} ); 10755 10756var widgetsDraggable = $.ui.draggable; 10757 10758 10759/*! 10760 * jQuery UI Resizable 1.12.0 10761 * http://jqueryui.com
vendor: 6,932 bytes, lines 10762-11040
10762 * 10763 * Copyright jQuery Foundation and other contributors 10764 * Released under the MIT license. 10765 * http://jquery.org/license 10766 */ 10767 10768//>>label: Resizable 10769//>>group: Interactions 10770//>>description: Enables resize functionality for any element. 10771//>>docs: http://api.jqueryui.com/resizable/ 10772//>>demos: http://jqueryui.com/resizable/ 10773//>>css.structure: ../../themes/base/core.css 10774//>>css.structure: ../../themes/base/resizable.css 10775//>>css.theme: ../../themes/base/theme.css 10776 10777 10778 10779$.widget( "ui.resizable", $.ui.mouse, { 10780 version: "1.12.0", 10781 widgetEventPrefix: "resize", 10782 options: { 10783 alsoResize: false, 10784 animate: false, 10785 animateDuration: "slow", 10786 animateEasing: "swing", 10787 aspectRatio: false, 10788 autoHide: false, 10789 classes: { 10790 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 10791 }, 10792 containment: false, 10793 ghost: false, 10794 grid: false, 10795 handles: "e,s,se", 10796 helper: false, 10797 maxHeight: null, 10798 maxWidth: null, 10799 minHeight: 10, 10800 minWidth: 10, 10801 10802 // See #7960 10803 zIndex: 90, 10804 10805 // Callbacks 10806 resize: null, 10807 start: null, 10808 stop: null 10809 }, 10810 10811 _num: function( value ) { 10812 return parseFloat( value ) || 0; 10813 }, 10814 10815 _isNumber: function( value ) { 10816 return !isNaN( parseFloat( value ) ); 10817 }, 10818 10819 _hasScroll: function( el, a ) { 10820 10821 if ( $( el ).css( "overflow" ) === "hidden" ) { 10822 return false; 10823 } 10824 10825 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 10826 has = false; 10827 10828 if ( el[ scroll ] > 0 ) { 10829 return true; 10830 } 10831 10832 // TODO: determine which cases actually cause this to happen 10833 // if the element doesn't have the scroll set, see if it's possible to 10834 // set the scroll 10835 el[ scroll ] = 1; 10836 has = ( el[ scroll ] > 0 ); 10837 el[ scroll ] = 0; 10838 return has; 10839 }, 10840 10841 _create: function() { 10842 10843 var margins, 10844 o = this.options, 10845 that = this; 10846 this._addClass( "ui-resizable" ); 10847 10848 $.extend( this, { 10849 _aspectRatio: !!( o.aspectRatio ), 10850 aspectRatio: o.aspectRatio, 10851 originalElement: this.element, 10852 _proportionallyResizeElements: [], 10853 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 10854 } ); 10855 10856 // Wrap the element if it cannot hold child nodes 10857 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 10858 10859 this.element.wrap( 10860 $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( { 10861 position: this.element.css( "position" ), 10862 width: this.element.outerWidth(), 10863 height: this.element.outerHeight(), 10864 top: this.element.css( "top" ), 10865 left: this.element.css( "left" ) 10866 } ) 10867 ); 10868 10869 this.element = this.element.parent().data( 10870 "ui-resizable", this.element.resizable( "instance" ) 10871 ); 10872 10873 this.elementIsWrapper = true; 10874 10875 margins = { 10876 marginTop: this.originalElement.css( "marginTop" ), 10877 marginRight: this.originalElement.css( "marginRight" ), 10878 marginBottom: this.originalElement.css( "marginBottom" ), 10879 marginLeft: this.originalElement.css( "marginLeft" ) 10880 }; 10881 10882 this.element.css( margins ); 10883 this.originalElement.css( "margin", 0 ); 10884 10885 // support: Safari 10886 // Prevent Safari textarea resize 10887 this.originalResizeStyle = this.originalElement.css( "resize" ); 10888 this.originalElement.css( "resize", "none" ); 10889 10890 this._proportionallyResizeElements.push( this.originalElement.css( { 10891 position: "static", 10892 zoom: 1, 10893 display: "block" 10894 } ) ); 10895 10896 // Support: IE9 10897 // avoid IE jump (hard set the margin) 10898 this.originalElement.css( margins ); 10899 10900 this._proportionallyResize(); 10901 } 10902 10903 this._setupHandles(); 10904 10905 if ( o.autoHide ) { 10906 $( this.element ) 10907 .on( "mouseenter", function() { 10908 if ( o.disabled ) { 10909 return; 10910 } 10911 that._removeClass( "ui-resizable-autohide" ); 10912 that._handles.show(); 10913 } ) 10914 .on( "mouseleave", function() { 10915 if ( o.disabled ) { 10916 return; 10917 } 10918 if ( !that.resizing ) { 10919 that._addClass( "ui-resizable-autohide" ); 10920 that._handles.hide(); 10921 } 10922 } ); 10923 } 10924 10925 this._mouseInit(); 10926 }, 10927 10928 _destroy: function() { 10929 10930 this._mouseDestroy(); 10931 10932 var wrapper, 10933 _destroy = function( exp ) { 10934 $( exp ) 10935 .removeData( "resizable" ) 10936 .removeData( "ui-resizable" ) 10937 .off( ".resizable" ) 10938 .find( ".ui-resizable-handle" ) 10939 .remove(); 10940 }; 10941 10942 // TODO: Unwrap at same DOM position 10943 if ( this.elementIsWrapper ) { 10944 _destroy( this.element ); 10945 wrapper = this.element; 10946 this.originalElement.css( { 10947 position: wrapper.css( "position" ), 10948 width: wrapper.outerWidth(), 10949 height: wrapper.outerHeight(), 10950 top: wrapper.css( "top" ), 10951 left: wrapper.css( "left" ) 10952 } ).insertAfter( wrapper ); 10953 wrapper.remove(); 10954 } 10955 10956 this.originalElement.css( "resize", this.originalResizeStyle ); 10957 _destroy( this.originalElement ); 10958 10959 return this; 10960 }, 10961 10962 _setOption: function( key, value ) { 10963 this._super( key, value ); 10964 10965 switch ( key ) { 10966 case "handles": 10967 this._removeHandles(); 10968 this._setupHandles(); 10969 break; 10970 default: 10971 break; 10972 } 10973 }, 10974 10975 _setupHandles: function() { 10976 var o = this.options, handle, i, n, hname, axis, that = this; 10977 this.handles = o.handles || 10978 ( !$( ".ui-resizable-handle", this.element ).length ? 10979 "e,s,se" : { 10980 n: ".ui-resizable-n", 10981 e: ".ui-resizable-e", 10982 s: ".ui-resizable-s", 10983 w: ".ui-resizable-w", 10984 se: ".ui-resizable-se", 10985 sw: ".ui-resizable-sw", 10986 ne: ".ui-resizable-ne", 10987 nw: ".ui-resizable-nw" 10988 } ); 10989 10990 this._handles = $(); 10991 if ( this.handles.constructor === String ) { 10992 10993 if ( this.handles === "all" ) { 10994 this.handles = "n,e,s,w,se,sw,ne,nw"; 10995 } 10996 10997 n = this.handles.split( "," ); 10998 this.handles = {}; 10999 11000 for ( i = 0; i < n.length; i++ ) { 11001 11002 handle = $.trim( n[ i ] ); 11003 hname = "ui-resizable-" + handle; 11004 axis = $( "<div>" ); 11005 this._addClass( axis, "ui-resizable-handle " + hname ); 11006 11007 axis.css( { zIndex: o.zIndex } ); 11008 11009 this.handles[ handle ] = ".ui-resizable-" + handle; 11010 this.element.append( axis ); 11011 } 11012 11013 } 11014 11015 this._renderAxis = function( target ) { 11016 11017 var i, axis, padPos, padWrapper; 11018 11019 target = target || this.element; 11020 11021 for ( i in this.handles ) { 11022 11023 if ( this.handles[ i ].constructor === String ) { 11024 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 11025 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 11026 this.handles[ i ] = $( this.handles[ i ] ); 11027 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 11028 } 11029 11030 if ( this.elementIsWrapper && 11031 this.originalElement[ 0 ] 11032 .nodeName 11033 .match( /^(textarea|input|select|button)$/i ) ) { 11034 axis = $( this.handles[ i ], this.element ); 11035 11036 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 11037 axis.outerHeight() : 11038 axis.outerWidth(); 11039 11040 padPos = [ "padding",
vendor: 4,678 bytes, lines 11041-11221
11041 /ne|nw|n/.test( i ) ? "Top" : 11042 /se|sw|s/.test( i ) ? "Bottom" : 11043 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 11044 11045 target.css( padPos, padWrapper ); 11046 11047 this._proportionallyResize(); 11048 } 11049 11050 this._handles = this._handles.add( this.handles[ i ] ); 11051 } 11052 }; 11053 11054 // TODO: make renderAxis a prototype function 11055 this._renderAxis( this.element ); 11056 11057 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 11058 this._handles.disableSelection(); 11059 11060 this._handles.on( "mouseover", function() { 11061 if ( !that.resizing ) { 11062 if ( this.className ) { 11063 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 11064 } 11065 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 11066 } 11067 } ); 11068 11069 if ( o.autoHide ) { 11070 this._handles.hide(); 11071 this._addClass( "ui-resizable-autohide" ); 11072 } 11073 }, 11074 11075 _removeHandles: function() { 11076 this._handles.remove(); 11077 }, 11078 11079 _mouseCapture: function( event ) { 11080 var i, handle, 11081 capture = false; 11082 11083 for ( i in this.handles ) { 11084 handle = $( this.handles[ i ] )[ 0 ]; 11085 if ( handle === event.target || $.contains( handle, event.target ) ) { 11086 capture = true; 11087 } 11088 } 11089 11090 return !this.options.disabled && capture; 11091 }, 11092 11093 _mouseStart: function( event ) { 11094 11095 var curleft, curtop, cursor, 11096 o = this.options, 11097 el = this.element; 11098 11099 this.resizing = true; 11100 11101 this._renderProxy(); 11102 11103 curleft = this._num( this.helper.css( "left" ) ); 11104 curtop = this._num( this.helper.css( "top" ) ); 11105 11106 if ( o.containment ) { 11107 curleft += $( o.containment ).scrollLeft() || 0; 11108 curtop += $( o.containment ).scrollTop() || 0; 11109 } 11110 11111 this.offset = this.helper.offset(); 11112 this.position = { left: curleft, top: curtop }; 11113 11114 this.size = this._helper ? { 11115 width: this.helper.width(), 11116 height: this.helper.height() 11117 } : { 11118 width: el.width(), 11119 height: el.height() 11120 }; 11121 11122 this.originalSize = this._helper ? { 11123 width: el.outerWidth(), 11124 height: el.outerHeight() 11125 } : { 11126 width: el.width(), 11127 height: el.height() 11128 }; 11129 11130 this.sizeDiff = { 11131 width: el.outerWidth() - el.width(), 11132 height: el.outerHeight() - el.height() 11133 }; 11134 11135 this.originalPosition = { left: curleft, top: curtop }; 11136 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 11137 11138 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 11139 o.aspectRatio : 11140 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 11141 11142 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 11143 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 11144 11145 this._addClass( "ui-resizable-resizing" ); 11146 this._propagate( "start", event ); 11147 return true; 11148 }, 11149 11150 _mouseDrag: function( event ) { 11151 11152 var data, props, 11153 smp = this.originalMousePosition, 11154 a = this.axis, 11155 dx = ( event.pageX - smp.left ) || 0, 11156 dy = ( event.pageY - smp.top ) || 0, 11157 trigger = this._change[ a ]; 11158 11159 this._updatePrevProperties(); 11160 11161 if ( !trigger ) { 11162 return false; 11163 } 11164 11165 data = trigger.apply( this, [ event, dx, dy ] ); 11166 11167 this._updateVirtualBoundaries( event.shiftKey ); 11168 if ( this._aspectRatio || event.shiftKey ) { 11169 data = this._updateRatio( data, event ); 11170 } 11171 11172 data = this._respectSize( data, event ); 11173 11174 this._updateCache( data ); 11175 11176 this._propagate( "resize", event ); 11177 11178 props = this._applyChanges(); 11179 11180 if ( !this._helper && this._proportionallyResizeElements.length ) { 11181 this._proportionallyResize(); 11182 } 11183 11184 if ( !$.isEmptyObject( props ) ) { 11185 this._updatePrevProperties(); 11186 this._trigger( "resize", event, this.ui() ); 11187 this._applyChanges(); 11188 } 11189 11190 return false; 11191 }, 11192 11193 _mouseStop: function( event ) { 11194 11195 this.resizing = false; 11196 var pr, ista, soffseth, soffsetw, s, left, top, 11197 o = this.options, that = this; 11198 11199 if ( this._helper ) { 11200 11201 pr = this._proportionallyResizeElements; 11202 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 11203 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 11204 soffsetw = ista ? 0 : that.sizeDiff.width; 11205 11206 s = { 11207 width: ( that.helper.width() - soffsetw ), 11208 height: ( that.helper.height() - soffseth ) 11209 }; 11210 left = ( parseFloat( that.element.css( "left" ) ) + 11211 ( that.position.left - that.originalPosition.left ) ) || null; 11212 top = ( parseFloat( that.element.css( "top" ) ) + 11213 ( that.position.top - that.originalPosition.top ) ) || null; 11214 11215 if ( !o.animate ) { 11216 this.element.css( $.extend( s, { top: top, left: left } ) ); 11217 } 11218 11219 that.helper.height( that.size.height ); 11220 that.helper.width( that.size.width ); 11221
vendor: 6,168 bytes, lines 11222-11462
11222 if ( this._helper && !o.animate ) { 11223 this._proportionallyResize(); 11224 } 11225 } 11226 11227 $( "body" ).css( "cursor", "auto" ); 11228 11229 this._removeClass( "ui-resizable-resizing" ); 11230 11231 this._propagate( "stop", event ); 11232 11233 if ( this._helper ) { 11234 this.helper.remove(); 11235 } 11236 11237 return false; 11238 11239 }, 11240 11241 _updatePrevProperties: function() { 11242 this.prevPosition = { 11243 top: this.position.top, 11244 left: this.position.left 11245 }; 11246 this.prevSize = { 11247 width: this.size.width, 11248 height: this.size.height 11249 }; 11250 }, 11251 11252 _applyChanges: function() { 11253 var props = {}; 11254 11255 if ( this.position.top !== this.prevPosition.top ) { 11256 props.top = this.position.top + "px"; 11257 } 11258 if ( this.position.left !== this.prevPosition.left ) { 11259 props.left = this.position.left + "px"; 11260 } 11261 if ( this.size.width !== this.prevSize.width ) { 11262 props.width = this.size.width + "px"; 11263 } 11264 if ( this.size.height !== this.prevSize.height ) { 11265 props.height = this.size.height + "px"; 11266 } 11267 11268 this.helper.css( props ); 11269 11270 return props; 11271 }, 11272 11273 _updateVirtualBoundaries: function( forceAspectRatio ) { 11274 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 11275 o = this.options; 11276 11277 b = { 11278 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 11279 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 11280 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 11281 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 11282 }; 11283 11284 if ( this._aspectRatio || forceAspectRatio ) { 11285 pMinWidth = b.minHeight * this.aspectRatio; 11286 pMinHeight = b.minWidth / this.aspectRatio; 11287 pMaxWidth = b.maxHeight * this.aspectRatio; 11288 pMaxHeight = b.maxWidth / this.aspectRatio; 11289 11290 if ( pMinWidth > b.minWidth ) { 11291 b.minWidth = pMinWidth; 11292 } 11293 if ( pMinHeight > b.minHeight ) { 11294 b.minHeight = pMinHeight; 11295 } 11296 if ( pMaxWidth < b.maxWidth ) { 11297 b.maxWidth = pMaxWidth; 11298 } 11299 if ( pMaxHeight < b.maxHeight ) { 11300 b.maxHeight = pMaxHeight; 11301 } 11302 } 11303 this._vBoundaries = b; 11304 }, 11305 11306 _updateCache: function( data ) { 11307 this.offset = this.helper.offset(); 11308 if ( this._isNumber( data.left ) ) { 11309 this.position.left = data.left; 11310 } 11311 if ( this._isNumber( data.top ) ) { 11312 this.position.top = data.top; 11313 } 11314 if ( this._isNumber( data.height ) ) { 11315 this.size.height = data.height; 11316 } 11317 if ( this._isNumber( data.width ) ) { 11318 this.size.width = data.width; 11319 } 11320 }, 11321 11322 _updateRatio: function( data ) { 11323 11324 var cpos = this.position, 11325 csize = this.size, 11326 a = this.axis; 11327 11328 if ( this._isNumber( data.height ) ) { 11329 data.width = ( data.height * this.aspectRatio ); 11330 } else if ( this._isNumber( data.width ) ) { 11331 data.height = ( data.width / this.aspectRatio ); 11332 } 11333 11334 if ( a === "sw" ) { 11335 data.left = cpos.left + ( csize.width - data.width ); 11336 data.top = null; 11337 } 11338 if ( a === "nw" ) { 11339 data.top = cpos.top + ( csize.height - data.height ); 11340 data.left = cpos.left + ( csize.width - data.width ); 11341 } 11342 11343 return data; 11344 }, 11345 11346 _respectSize: function( data ) { 11347 11348 var o = this._vBoundaries, 11349 a = this.axis, 11350 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 11351 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 11352 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 11353 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 11354 dw = this.originalPosition.left + this.originalSize.width, 11355 dh = this.originalPosition.top + this.originalSize.height, 11356 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 11357 if ( isminw ) { 11358 data.width = o.minWidth; 11359 } 11360 if ( isminh ) { 11361 data.height = o.minHeight; 11362 } 11363 if ( ismaxw ) { 11364 data.width = o.maxWidth; 11365 } 11366 if ( ismaxh ) { 11367 data.height = o.maxHeight; 11368 } 11369 11370 if ( isminw && cw ) { 11371 data.left = dw - o.minWidth; 11372 } 11373 if ( ismaxw && cw ) { 11374 data.left = dw - o.maxWidth; 11375 } 11376 if ( isminh && ch ) { 11377 data.top = dh - o.minHeight; 11378 } 11379 if ( ismaxh && ch ) { 11380 data.top = dh - o.maxHeight; 11381 } 11382 11383 // Fixing jump error on top/left - bug #2330 11384 if ( !data.width && !data.height && !data.left && data.top ) { 11385 data.top = null; 11386 } else if ( !data.width && !data.height && !data.top && data.left ) { 11387 data.left = null; 11388 } 11389 11390 return data; 11391 }, 11392 11393 _getPaddingPlusBorderDimensions: function( element ) { 11394 var i = 0, 11395 widths = [], 11396 borders = [ 11397 element.css( "borderTopWidth" ), 11398 element.css( "borderRightWidth" ), 11399 element.css( "borderBottomWidth" ), 11400 element.css( "borderLeftWidth" ) 11401 ], 11402 paddings = [ 11403 element.css( "paddingTop" ), 11404 element.css( "paddingRight" ), 11405 element.css( "paddingBottom" ), 11406 element.css( "paddingLeft" ) 11407 ]; 11408 11409 for ( ; i < 4; i++ ) { 11410 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 11411 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 11412 } 11413 11414 return { 11415 height: widths[ 0 ] + widths[ 2 ], 11416 width: widths[ 1 ] + widths[ 3 ] 11417 }; 11418 }, 11419 11420 _proportionallyResize: function() { 11421 11422 if ( !this._proportionallyResizeElements.length ) { 11423 return; 11424 } 11425 11426 var prel, 11427 i = 0, 11428 element = this.helper || this.element; 11429 11430 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 11431 11432 prel = this._proportionallyResizeElements[ i ]; 11433 11434 // TODO: Seems like a bug to cache this.outerDimensions 11435 // considering that we are in a loop. 11436 if ( !this.outerDimensions ) { 11437 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 11438 } 11439 11440 prel.css( { 11441 height: ( element.height() - this.outerDimensions.height ) || 0, 11442 width: ( element.width() - this.outerDimensions.width ) || 0 11443 } ); 11444 11445 } 11446 11447 }, 11448 11449 _renderProxy: function() { 11450 11451 var el = this.element, o = this.options; 11452 this.elementOffset = el.offset(); 11453 11454 if ( this._helper ) { 11455 11456 this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" ); 11457 11458 this._addClass( this.helper, this._helper ); 11459 this.helper.css( { 11460 width: this.element.outerWidth(), 11461 height: this.element.outerHeight(), 11462 position: "absolute",
vendor: 1,421 bytes, lines 11463-11510
11463 left: this.elementOffset.left + "px", 11464 top: this.elementOffset.top + "px", 11465 zIndex: ++o.zIndex //TODO: Don't modify option 11466 } ); 11467 11468 this.helper 11469 .appendTo( "body" ) 11470 .disableSelection(); 11471 11472 } else { 11473 this.helper = this.element; 11474 } 11475 11476 }, 11477 11478 _change: { 11479 e: function( event, dx ) { 11480 return { width: this.originalSize.width + dx }; 11481 }, 11482 w: function( event, dx ) { 11483 var cs = this.originalSize, sp = this.originalPosition; 11484 return { left: sp.left + dx, width: cs.width - dx }; 11485 }, 11486 n: function( event, dx, dy ) { 11487 var cs = this.originalSize, sp = this.originalPosition; 11488 return { top: sp.top + dy, height: cs.height - dy }; 11489 }, 11490 s: function( event, dx, dy ) { 11491 return { height: this.originalSize.height + dy }; 11492 }, 11493 se: function( event, dx, dy ) { 11494 return $.extend( this._change.s.apply( this, arguments ), 11495 this._change.e.apply( this, [ event, dx, dy ] ) ); 11496 }, 11497 sw: function( event, dx, dy ) { 11498 return $.extend( this._change.s.apply( this, arguments ), 11499 this._change.w.apply( this, [ event, dx, dy ] ) ); 11500 }, 11501 ne: function( event, dx, dy ) { 11502 return $.extend( this._change.n.apply( this, arguments ), 11503 this._change.e.apply( this, [ event, dx, dy ] ) ); 11504 }, 11505 nw: function( event, dx, dy ) { 11506 return $.extend( this._change.n.apply( this, arguments ), 11507 this._change.w.apply( this, [ event, dx, dy ] ) ); 11508 } 11509 }, 11510
vendor: 9,740 bytes, lines 11511-11876
11511 _propagate: function( n, event ) { 11512 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 11513 ( n !== "resize" && this._trigger( n, event, this.ui() ) ); 11514 }, 11515 11516 plugins: {}, 11517 11518 ui: function() { 11519 return { 11520 originalElement: this.originalElement, 11521 element: this.element, 11522 helper: this.helper, 11523 position: this.position, 11524 size: this.size, 11525 originalSize: this.originalSize, 11526 originalPosition: this.originalPosition 11527 }; 11528 } 11529 11530} ); 11531 11532/* 11533 * Resizable Extensions 11534 */ 11535 11536$.ui.plugin.add( "resizable", "animate", { 11537 11538 stop: function( event ) { 11539 var that = $( this ).resizable( "instance" ), 11540 o = that.options, 11541 pr = that._proportionallyResizeElements, 11542 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 11543 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 11544 soffsetw = ista ? 0 : that.sizeDiff.width, 11545 style = { 11546 width: ( that.size.width - soffsetw ), 11547 height: ( that.size.height - soffseth ) 11548 }, 11549 left = ( parseFloat( that.element.css( "left" ) ) + 11550 ( that.position.left - that.originalPosition.left ) ) || null, 11551 top = ( parseFloat( that.element.css( "top" ) ) + 11552 ( that.position.top - that.originalPosition.top ) ) || null; 11553 11554 that.element.animate( 11555 $.extend( style, top && left ? { top: top, left: left } : {} ), { 11556 duration: o.animateDuration, 11557 easing: o.animateEasing, 11558 step: function() { 11559 11560 var data = { 11561 width: parseFloat( that.element.css( "width" ) ), 11562 height: parseFloat( that.element.css( "height" ) ), 11563 top: parseFloat( that.element.css( "top" ) ), 11564 left: parseFloat( that.element.css( "left" ) ) 11565 }; 11566 11567 if ( pr && pr.length ) { 11568 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 11569 } 11570 11571 // Propagating resize, and updating values for each animation step 11572 that._updateCache( data ); 11573 that._propagate( "resize", event ); 11574 11575 } 11576 } 11577 ); 11578 } 11579 11580} ); 11581 11582$.ui.plugin.add( "resizable", "containment", { 11583 11584 start: function() { 11585 var element, p, co, ch, cw, width, height, 11586 that = $( this ).resizable( "instance" ), 11587 o = that.options, 11588 el = that.element, 11589 oc = o.containment, 11590 ce = ( oc instanceof $ ) ? 11591 oc.get( 0 ) : 11592 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 11593 11594 if ( !ce ) { 11595 return; 11596 } 11597 11598 that.containerElement = $( ce ); 11599 11600 if ( /document/.test( oc ) || oc === document ) { 11601 that.containerOffset = { 11602 left: 0, 11603 top: 0 11604 }; 11605 that.containerPosition = { 11606 left: 0, 11607 top: 0 11608 }; 11609 11610 that.parentData = { 11611 element: $( document ), 11612 left: 0, 11613 top: 0, 11614 width: $( document ).width(), 11615 height: $( document ).height() || document.body.parentNode.scrollHeight 11616 }; 11617 } else { 11618 element = $( ce ); 11619 p = []; 11620 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 11621 p[ i ] = that._num( element.css( "padding" + name ) ); 11622 } ); 11623 11624 that.containerOffset = element.offset(); 11625 that.containerPosition = element.position(); 11626 that.containerSize = { 11627 height: ( element.innerHeight() - p[ 3 ] ), 11628 width: ( element.innerWidth() - p[ 1 ] ) 11629 }; 11630 11631 co = that.containerOffset; 11632 ch = that.containerSize.height; 11633 cw = that.containerSize.width; 11634 width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw ); 11635 height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ; 11636 11637 that.parentData = { 11638 element: ce, 11639 left: co.left, 11640 top: co.top, 11641 width: width, 11642 height: height 11643 }; 11644 } 11645 }, 11646 11647 resize: function( event ) { 11648 var woset, hoset, isParent, isOffsetRelative, 11649 that = $( this ).resizable( "instance" ), 11650 o = that.options, 11651 co = that.containerOffset, 11652 cp = that.position, 11653 pRatio = that._aspectRatio || event.shiftKey, 11654 cop = { 11655 top: 0, 11656 left: 0 11657 }, 11658 ce = that.containerElement, 11659 continueResize = true; 11660 11661 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 11662 cop = co; 11663 } 11664 11665 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 11666 that.size.width = that.size.width + 11667 ( that._helper ? 11668 ( that.position.left - co.left ) : 11669 ( that.position.left - cop.left ) ); 11670 11671 if ( pRatio ) { 11672 that.size.height = that.size.width / that.aspectRatio; 11673 continueResize = false; 11674 } 11675 that.position.left = o.helper ? co.left : 0; 11676 } 11677 11678 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 11679 that.size.height = that.size.height + 11680 ( that._helper ? 11681 ( that.position.top - co.top ) : 11682 that.position.top ); 11683 11684 if ( pRatio ) { 11685 that.size.width = that.size.height * that.aspectRatio; 11686 continueResize = false; 11687 } 11688 that.position.top = that._helper ? co.top : 0; 11689 } 11690 11691 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 11692 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 11693 11694 if ( isParent && isOffsetRelative ) { 11695 that.offset.left = that.parentData.left + that.position.left; 11696 that.offset.top = that.parentData.top + that.position.top; 11697 } else { 11698 that.offset.left = that.element.offset().left; 11699 that.offset.top = that.element.offset().top; 11700 } 11701 11702 woset = Math.abs( that.sizeDiff.width + 11703 ( that._helper ? 11704 that.offset.left - cop.left : 11705 ( that.offset.left - co.left ) ) ); 11706 11707 hoset = Math.abs( that.sizeDiff.height + 11708 ( that._helper ? 11709 that.offset.top - cop.top : 11710 ( that.offset.top - co.top ) ) ); 11711 11712 if ( woset + that.size.width >= that.parentData.width ) { 11713 that.size.width = that.parentData.width - woset; 11714 if ( pRatio ) { 11715 that.size.height = that.size.width / that.aspectRatio; 11716 continueResize = false; 11717 } 11718 } 11719 11720 if ( hoset + that.size.height >= that.parentData.height ) { 11721 that.size.height = that.parentData.height - hoset; 11722 if ( pRatio ) { 11723 that.size.width = that.size.height * that.aspectRatio; 11724 continueResize = false; 11725 } 11726 } 11727 11728 if ( !continueResize ) { 11729 that.position.left = that.prevPosition.left; 11730 that.position.top = that.prevPosition.top; 11731 that.size.width = that.prevSize.width; 11732 that.size.height = that.prevSize.height; 11733 } 11734 }, 11735 11736 stop: function() { 11737 var that = $( this ).resizable( "instance" ), 11738 o = that.options, 11739 co = that.containerOffset, 11740 cop = that.containerPosition, 11741 ce = that.containerElement, 11742 helper = $( that.helper ), 11743 ho = helper.offset(), 11744 w = helper.outerWidth() - that.sizeDiff.width, 11745 h = helper.outerHeight() - that.sizeDiff.height; 11746 11747 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 11748 $( this ).css( { 11749 left: ho.left - cop.left - co.left, 11750 width: w, 11751 height: h 11752 } ); 11753 } 11754 11755 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 11756 $( this ).css( { 11757 left: ho.left - cop.left - co.left, 11758 width: w, 11759 height: h 11760 } ); 11761 } 11762 } 11763} ); 11764 11765$.ui.plugin.add( "resizable", "alsoResize", { 11766 11767 start: function() { 11768 var that = $( this ).resizable( "instance" ), 11769 o = that.options; 11770 11771 $( o.alsoResize ).each( function() { 11772 var el = $( this ); 11773 el.data( "ui-resizable-alsoresize", { 11774 width: parseFloat( el.width() ), height: parseFloat( el.height() ), 11775 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 11776 } ); 11777 } ); 11778 }, 11779 11780 resize: function( event, ui ) { 11781 var that = $( this ).resizable( "instance" ), 11782 o = that.options, 11783 os = that.originalSize, 11784 op = that.originalPosition, 11785 delta = { 11786 height: ( that.size.height - os.height ) || 0, 11787 width: ( that.size.width - os.width ) || 0, 11788 top: ( that.position.top - op.top ) || 0, 11789 left: ( that.position.left - op.left ) || 0 11790 }; 11791 11792 $( o.alsoResize ).each( function() { 11793 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 11794 css = el.parents( ui.originalElement[ 0 ] ).length ? 11795 [ "width", "height" ] : 11796 [ "width", "height", "top", "left" ]; 11797 11798 $.each( css, function( i, prop ) { 11799 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 11800 if ( sum && sum >= 0 ) { 11801 style[ prop ] = sum || null; 11802 } 11803 } ); 11804 11805 el.css( style ); 11806 } ); 11807 }, 11808 11809 stop: function() { 11810 $( this ).removeData( "ui-resizable-alsoresize" ); 11811 } 11812} ); 11813 11814$.ui.plugin.add( "resizable", "ghost", { 11815 11816 start: function() { 11817 11818 var that = $( this ).resizable( "instance" ), cs = that.size; 11819 11820 that.ghost = that.originalElement.clone(); 11821 that.ghost.css( { 11822 opacity: 0.25, 11823 display: "block", 11824 position: "relative", 11825 height: cs.height, 11826 width: cs.width, 11827 margin: 0, 11828 left: 0, 11829 top: 0 11830 } ); 11831 11832 that._addClass( that.ghost, "ui-resizable-ghost" ); 11833 11834 // DEPRECATED 11835 // TODO: remove after 1.12 11836 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { 11837 11838 // Ghost option 11839 that.ghost.addClass( this.options.ghost ); 11840 } 11841 11842 that.ghost.appendTo( that.helper ); 11843 11844 }, 11845 11846 resize: function() { 11847 var that = $( this ).resizable( "instance" ); 11848 if ( that.ghost ) { 11849 that.ghost.css( { 11850 position: "relative", 11851 height: that.size.height, 11852 width: that.size.width 11853 } ); 11854 } 11855 }, 11856 11857 stop: function() { 11858 var that = $( this ).resizable( "instance" ); 11859 if ( that.ghost && that.helper ) { 11860 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 11861 } 11862 } 11863 11864} ); 11865 11866$.ui.plugin.add( "resizable", "grid", { 11867 11868 resize: function() { 11869 var outerDimensions, 11870 that = $( this ).resizable( "instance" ), 11871 o = that.options, 11872 cs = that.size, 11873 os = that.originalSize, 11874 op = that.originalPosition, 11875 a = that.axis, 11876 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
vendor: 4,400 bytes, lines 11877-12057
11877 gridX = ( grid[ 0 ] || 1 ), 11878 gridY = ( grid[ 1 ] || 1 ), 11879 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 11880 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 11881 newWidth = os.width + ox, 11882 newHeight = os.height + oy, 11883 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 11884 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 11885 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 11886 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 11887 11888 o.grid = grid; 11889 11890 if ( isMinWidth ) { 11891 newWidth += gridX; 11892 } 11893 if ( isMinHeight ) { 11894 newHeight += gridY; 11895 } 11896 if ( isMaxWidth ) { 11897 newWidth -= gridX; 11898 } 11899 if ( isMaxHeight ) { 11900 newHeight -= gridY; 11901 } 11902 11903 if ( /^(se|s|e)$/.test( a ) ) { 11904 that.size.width = newWidth; 11905 that.size.height = newHeight; 11906 } else if ( /^(ne)$/.test( a ) ) { 11907 that.size.width = newWidth; 11908 that.size.height = newHeight; 11909 that.position.top = op.top - oy; 11910 } else if ( /^(sw)$/.test( a ) ) { 11911 that.size.width = newWidth; 11912 that.size.height = newHeight; 11913 that.position.left = op.left - ox; 11914 } else { 11915 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 11916 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 11917 } 11918 11919 if ( newHeight - gridY > 0 ) { 11920 that.size.height = newHeight; 11921 that.position.top = op.top - oy; 11922 } else { 11923 newHeight = gridY - outerDimensions.height; 11924 that.size.height = newHeight; 11925 that.position.top = op.top + os.height - newHeight; 11926 } 11927 if ( newWidth - gridX > 0 ) { 11928 that.size.width = newWidth; 11929 that.position.left = op.left - ox; 11930 } else { 11931 newWidth = gridX - outerDimensions.width; 11932 that.size.width = newWidth; 11933 that.position.left = op.left + os.width - newWidth; 11934 } 11935 } 11936 } 11937 11938} ); 11939 11940var widgetsResizable = $.ui.resizable; 11941 11942 11943/*! 11944 * jQuery UI Dialog 1.12.0 11945 * http://jqueryui.com 11946 * 11947 * Copyright jQuery Foundation and other contributors 11948 * Released under the MIT license. 11949 * http://jquery.org/license 11950 */ 11951 11952//>>label: Dialog 11953//>>group: Widgets 11954//>>description: Displays customizable dialog windows. 11955//>>docs: http://api.jqueryui.com/dialog/ 11956//>>demos: http://jqueryui.com/dialog/ 11957//>>css.structure: ../../themes/base/core.css 11958//>>css.structure: ../../themes/base/dialog.css 11959//>>css.theme: ../../themes/base/theme.css 11960 11961 11962 11963$.widget( "ui.dialog", { 11964 version: "1.12.0", 11965 options: { 11966 appendTo: "body", 11967 autoOpen: true, 11968 buttons: [], 11969 classes: { 11970 "ui-dialog": "ui-corner-all", 11971 "ui-dialog-titlebar": "ui-corner-all" 11972 }, 11973 closeOnEscape: true, 11974 closeText: "Close", 11975 draggable: true, 11976 hide: null, 11977 height: "auto", 11978 maxHeight: null, 11979 maxWidth: null, 11980 minHeight: 150, 11981 minWidth: 150, 11982 modal: false, 11983 position: { 11984 my: "center", 11985 at: "center", 11986 of: window, 11987 collision: "fit", 11988 11989 // Ensure the titlebar is always visible 11990 using: function( pos ) { 11991 var topOffset = $( this ).css( pos ).offset().top; 11992 if ( topOffset < 0 ) { 11993 $( this ).css( "top", pos.top - topOffset ); 11994 } 11995 } 11996 }, 11997 resizable: true, 11998 show: null, 11999 title: null, 12000 width: 300, 12001 12002 // Callbacks 12003 beforeClose: null, 12004 close: null, 12005 drag: null, 12006 dragStart: null, 12007 dragStop: null, 12008 focus: null, 12009 open: null, 12010 resize: null, 12011 resizeStart: null, 12012 resizeStop: null 12013 }, 12014 12015 sizeRelatedOptions: { 12016 buttons: true, 12017 height: true, 12018 maxHeight: true, 12019 maxWidth: true, 12020 minHeight: true, 12021 minWidth: true, 12022 width: true 12023 }, 12024 12025 resizableRelatedOptions: { 12026 maxHeight: true, 12027 maxWidth: true, 12028 minHeight: true, 12029 minWidth: true 12030 }, 12031 12032 _create: function() { 12033 this.originalCss = { 12034 display: this.element[ 0 ].style.display, 12035 width: this.element[ 0 ].style.width, 12036 minHeight: this.element[ 0 ].style.minHeight, 12037 maxHeight: this.element[ 0 ].style.maxHeight, 12038 height: this.element[ 0 ].style.height 12039 }; 12040 this.originalPosition = { 12041 parent: this.element.parent(), 12042 index: this.element.parent().children().index( this.element ) 12043 }; 12044 this.originalTitle = this.element.attr( "title" ); 12045 if ( this.options.title == null && this.originalTitle != null ) { 12046 this.options.title = this.originalTitle; 12047 } 12048 12049 // Dialogs can't be disabled 12050 if ( this.options.disabled ) { 12051 this.options.disabled = false; 12052 } 12053 12054 this._createWrapper(); 12055 12056 this.element 12057 .show()
vendor: 34,007 bytes, lines 12058-13331
12058 .removeAttr( "title" ) 12059 .appendTo( this.uiDialog ); 12060 12061 this._addClass( "ui-dialog-content", "ui-widget-content" ); 12062 12063 this._createTitlebar(); 12064 this._createButtonPane(); 12065 12066 if ( this.options.draggable && $.fn.draggable ) { 12067 this._makeDraggable(); 12068 } 12069 if ( this.options.resizable && $.fn.resizable ) { 12070 this._makeResizable(); 12071 } 12072 12073 this._isOpen = false; 12074 12075 this._trackFocus(); 12076 }, 12077 12078 _init: function() { 12079 if ( this.options.autoOpen ) { 12080 this.open(); 12081 } 12082 }, 12083 12084 _appendTo: function() { 12085 var element = this.options.appendTo; 12086 if ( element && ( element.jquery || element.nodeType ) ) { 12087 return $( element ); 12088 } 12089 return this.document.find( element || "body" ).eq( 0 ); 12090 }, 12091 12092 _destroy: function() { 12093 var next, 12094 originalPosition = this.originalPosition; 12095 12096 this._untrackInstance(); 12097 this._destroyOverlay(); 12098 12099 this.element 12100 .removeUniqueId() 12101 .css( this.originalCss ) 12102 12103 // Without detaching first, the following becomes really slow 12104 .detach(); 12105 12106 this.uiDialog.remove(); 12107 12108 if ( this.originalTitle ) { 12109 this.element.attr( "title", this.originalTitle ); 12110 } 12111 12112 next = originalPosition.parent.children().eq( originalPosition.index ); 12113 12114 // Don't try to place the dialog next to itself (#8613) 12115 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 12116 next.before( this.element ); 12117 } else { 12118 originalPosition.parent.append( this.element ); 12119 } 12120 }, 12121 12122 widget: function() { 12123 return this.uiDialog; 12124 }, 12125 12126 disable: $.noop, 12127 enable: $.noop, 12128 12129 close: function( event ) { 12130 var that = this; 12131 12132 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 12133 return; 12134 } 12135 12136 this._isOpen = false; 12137 this._focusedElement = null; 12138 this._destroyOverlay(); 12139 this._untrackInstance(); 12140 12141 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 12142 12143 // Hiding a focused element doesn't trigger blur in WebKit 12144 // so in case we have nothing to focus on, explicitly blur the active element 12145 // https://bugs.webkit.org/show_bug.cgi?id=47182 12146 $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12147 } 12148 12149 this._hide( this.uiDialog, this.options.hide, function() { 12150 that._trigger( "close", event ); 12151 } ); 12152 }, 12153 12154 isOpen: function() { 12155 return this._isOpen; 12156 }, 12157 12158 moveToTop: function() { 12159 this._moveToTop(); 12160 }, 12161 12162 _moveToTop: function( event, silent ) { 12163 var moved = false, 12164 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 12165 return +$( this ).css( "z-index" ); 12166 } ).get(), 12167 zIndexMax = Math.max.apply( null, zIndices ); 12168 12169 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 12170 this.uiDialog.css( "z-index", zIndexMax + 1 ); 12171 moved = true; 12172 } 12173 12174 if ( moved && !silent ) { 12175 this._trigger( "focus", event ); 12176 } 12177 return moved; 12178 }, 12179 12180 open: function() { 12181 var that = this; 12182 if ( this._isOpen ) { 12183 if ( this._moveToTop() ) { 12184 this._focusTabbable(); 12185 } 12186 return; 12187 } 12188 12189 this._isOpen = true; 12190 this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12191 12192 this._size(); 12193 this._position(); 12194 this._createOverlay(); 12195 this._moveToTop( null, true ); 12196 12197 // Ensure the overlay is moved to the top with the dialog, but only when 12198 // opening. The overlay shouldn't move after the dialog is open so that 12199 // modeless dialogs opened after the modal dialog stack properly. 12200 if ( this.overlay ) { 12201 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 12202 } 12203 12204 this._show( this.uiDialog, this.options.show, function() { 12205 that._focusTabbable(); 12206 that._trigger( "focus" ); 12207 } ); 12208 12209 // Track the dialog immediately upon openening in case a focus event 12210 // somehow occurs outside of the dialog before an element inside the 12211 // dialog is focused (#10152) 12212 this._makeFocusTarget(); 12213 12214 this._trigger( "open" ); 12215 }, 12216 12217 _focusTabbable: function() { 12218 12219 // Set focus to the first match: 12220 // 1. An element that was focused previously 12221 // 2. First element inside the dialog matching [autofocus] 12222 // 3. Tabbable element inside the content element 12223 // 4. Tabbable element inside the buttonpane 12224 // 5. The close button 12225 // 6. The dialog itself 12226 var hasFocus = this._focusedElement; 12227 if ( !hasFocus ) { 12228 hasFocus = this.element.find( "[autofocus]" ); 12229 } 12230 if ( !hasFocus.length ) { 12231 hasFocus = this.element.find( ":tabbable" ); 12232 } 12233 if ( !hasFocus.length ) { 12234 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 12235 } 12236 if ( !hasFocus.length ) { 12237 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 12238 } 12239 if ( !hasFocus.length ) { 12240 hasFocus = this.uiDialog; 12241 } 12242 hasFocus.eq( 0 ).trigger( "focus" ); 12243 }, 12244 12245 _keepFocus: function( event ) { 12246 function checkFocus() { 12247 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 12248 isActive = this.uiDialog[ 0 ] === activeElement || 12249 $.contains( this.uiDialog[ 0 ], activeElement ); 12250 if ( !isActive ) { 12251 this._focusTabbable(); 12252 } 12253 } 12254 event.preventDefault(); 12255 checkFocus.call( this ); 12256 12257 // support: IE 12258 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12259 // so we check again later 12260 this._delay( checkFocus ); 12261 }, 12262 12263 _createWrapper: function() { 12264 this.uiDialog = $( "<div>" ) 12265 .hide() 12266 .attr( { 12267 12268 // Setting tabIndex makes the div focusable 12269 tabIndex: -1, 12270 role: "dialog" 12271 } ) 12272 .appendTo( this._appendTo() ); 12273 12274 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 12275 this._on( this.uiDialog, { 12276 keydown: function( event ) { 12277 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12278 event.keyCode === $.ui.keyCode.ESCAPE ) { 12279 event.preventDefault(); 12280 this.close( event ); 12281 return; 12282 } 12283 12284 // Prevent tabbing out of dialogs 12285 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 12286 return; 12287 } 12288 var tabbables = this.uiDialog.find( ":tabbable" ), 12289 first = tabbables.filter( ":first" ), 12290 last = tabbables.filter( ":last" ); 12291 12292 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 12293 !event.shiftKey ) { 12294 this._delay( function() { 12295 first.trigger( "focus" ); 12296 } ); 12297 event.preventDefault(); 12298 } else if ( ( event.target === first[ 0 ] || 12299 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 12300 this._delay( function() { 12301 last.trigger( "focus" ); 12302 } ); 12303 event.preventDefault(); 12304 } 12305 }, 12306 mousedown: function( event ) { 12307 if ( this._moveToTop( event ) ) { 12308 this._focusTabbable(); 12309 } 12310 } 12311 } ); 12312 12313 // We assume that any existing aria-describedby attribute means 12314 // that the dialog content is marked up properly 12315 // otherwise we brute force the content as the description 12316 if ( !this.element.find( "[aria-describedby]" ).length ) { 12317 this.uiDialog.attr( { 12318 "aria-describedby": this.element.uniqueId().attr( "id" ) 12319 } ); 12320 } 12321 }, 12322 12323 _createTitlebar: function() { 12324 var uiDialogTitle; 12325 12326 this.uiDialogTitlebar = $( "<div>" ); 12327 this._addClass( this.uiDialogTitlebar, 12328 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 12329 this._on( this.uiDialogTitlebar, { 12330 mousedown: function( event ) { 12331 12332 // Don't prevent click on close button (#8838) 12333 // Focusing a dialog that is partially scrolled out of view 12334 // causes the browser to scroll it into view, preventing the click event 12335 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 12336 12337 // Dialog isn't getting focus when dragging (#8063) 12338 this.uiDialog.trigger( "focus" ); 12339 } 12340 } 12341 } ); 12342 12343 // Support: IE 12344 // Use type="button" to prevent enter keypresses in textboxes from closing the 12345 // dialog in IE (#9312) 12346 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 12347 .button( { 12348 label: $( "<a>" ).text( this.options.closeText ).html(), 12349 icon: "ui-icon-closethick", 12350 showLabel: false 12351 } ) 12352 .appendTo( this.uiDialogTitlebar ); 12353 12354 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 12355 this._on( this.uiDialogTitlebarClose, { 12356 click: function( event ) { 12357 event.preventDefault(); 12358 this.close( event ); 12359 } 12360 } ); 12361 12362 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 12363 this._addClass( uiDialogTitle, "ui-dialog-title" ); 12364 this._title( uiDialogTitle ); 12365 12366 this.uiDialogTitlebar.prependTo( this.uiDialog ); 12367 12368 this.uiDialog.attr( { 12369 "aria-labelledby": uiDialogTitle.attr( "id" ) 12370 } ); 12371 }, 12372 12373 _title: function( title ) { 12374 if ( this.options.title ) { 12375 title.text( this.options.title ); 12376 } else { 12377 title.html( " " ); 12378 } 12379 }, 12380 12381 _createButtonPane: function() { 12382 this.uiDialogButtonPane = $( "<div>" ); 12383 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 12384 "ui-widget-content ui-helper-clearfix" ); 12385 12386 this.uiButtonSet = $( "<div>" ) 12387 .appendTo( this.uiDialogButtonPane ); 12388 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 12389 12390 this._createButtons(); 12391 }, 12392 12393 _createButtons: function() { 12394 var that = this, 12395 buttons = this.options.buttons; 12396 12397 // If we already have a button pane, remove it 12398 this.uiDialogButtonPane.remove(); 12399 this.uiButtonSet.empty(); 12400 12401 if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) { 12402 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 12403 return; 12404 } 12405 12406 $.each( buttons, function( name, props ) { 12407 var click, buttonOptions; 12408 props = $.isFunction( props ) ? 12409 { click: props, text: name } : 12410 props; 12411 12412 // Default to a non-submitting button 12413 props = $.extend( { type: "button" }, props ); 12414 12415 // Change the context for the click callback to be the main element 12416 click = props.click; 12417 buttonOptions = { 12418 icon: props.icon, 12419 iconPosition: props.iconPosition, 12420 showLabel: props.showLabel 12421 }; 12422 12423 delete props.click; 12424 delete props.icon; 12425 delete props.iconPosition; 12426 delete props.showLabel; 12427 12428 $( "<button></button>", props ) 12429 .button( buttonOptions ) 12430 .appendTo( that.uiButtonSet ) 12431 .on( "click", function() { 12432 click.apply( that.element[ 0 ], arguments ); 12433 } ); 12434 } ); 12435 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 12436 this.uiDialogButtonPane.appendTo( this.uiDialog ); 12437 }, 12438 12439 _makeDraggable: function() { 12440 var that = this, 12441 options = this.options; 12442 12443 function filteredUi( ui ) { 12444 return { 12445 position: ui.position, 12446 offset: ui.offset 12447 }; 12448 } 12449 12450 this.uiDialog.draggable( { 12451 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12452 handle: ".ui-dialog-titlebar", 12453 containment: "document", 12454 start: function( event, ui ) { 12455 that._addClass( $( this ), "ui-dialog-dragging" ); 12456 that._blockFrames(); 12457 that._trigger( "dragStart", event, filteredUi( ui ) ); 12458 }, 12459 drag: function( event, ui ) { 12460 that._trigger( "drag", event, filteredUi( ui ) ); 12461 }, 12462 stop: function( event, ui ) { 12463 var left = ui.offset.left - that.document.scrollLeft(), 12464 top = ui.offset.top - that.document.scrollTop(); 12465 12466 options.position = { 12467 my: "left top", 12468 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12469 "top" + ( top >= 0 ? "+" : "" ) + top, 12470 of: that.window 12471 }; 12472 that._removeClass( $( this ), "ui-dialog-dragging" ); 12473 that._unblockFrames(); 12474 that._trigger( "dragStop", event, filteredUi( ui ) ); 12475 } 12476 } ); 12477 }, 12478 12479 _makeResizable: function() { 12480 var that = this, 12481 options = this.options, 12482 handles = options.resizable, 12483 12484 // .ui-resizable has position: relative defined in the stylesheet 12485 // but dialogs have to use absolute or fixed positioning 12486 position = this.uiDialog.css( "position" ), 12487 resizeHandles = typeof handles === "string" ? 12488 handles : 12489 "n,e,s,w,se,sw,ne,nw"; 12490 12491 function filteredUi( ui ) { 12492 return { 12493 originalPosition: ui.originalPosition, 12494 originalSize: ui.originalSize, 12495 position: ui.position, 12496 size: ui.size 12497 }; 12498 } 12499 12500 this.uiDialog.resizable( { 12501 cancel: ".ui-dialog-content", 12502 containment: "document", 12503 alsoResize: this.element, 12504 maxWidth: options.maxWidth, 12505 maxHeight: options.maxHeight, 12506 minWidth: options.minWidth, 12507 minHeight: this._minHeight(), 12508 handles: resizeHandles, 12509 start: function( event, ui ) { 12510 that._addClass( $( this ), "ui-dialog-resizing" ); 12511 that._blockFrames(); 12512 that._trigger( "resizeStart", event, filteredUi( ui ) ); 12513 }, 12514 resize: function( event, ui ) { 12515 that._trigger( "resize", event, filteredUi( ui ) ); 12516 }, 12517 stop: function( event, ui ) { 12518 var offset = that.uiDialog.offset(), 12519 left = offset.left - that.document.scrollLeft(), 12520 top = offset.top - that.document.scrollTop(); 12521 12522 options.height = that.uiDialog.height(); 12523 options.width = that.uiDialog.width(); 12524 options.position = { 12525 my: "left top", 12526 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12527 "top" + ( top >= 0 ? "+" : "" ) + top, 12528 of: that.window 12529 }; 12530 that._removeClass( $( this ), "ui-dialog-resizing" ); 12531 that._unblockFrames(); 12532 that._trigger( "resizeStop", event, filteredUi( ui ) ); 12533 } 12534 } ) 12535 .css( "position", position ); 12536 }, 12537 12538 _trackFocus: function() { 12539 this._on( this.widget(), { 12540 focusin: function( event ) { 12541 this._makeFocusTarget(); 12542 this._focusedElement = $( event.target ); 12543 } 12544 } ); 12545 }, 12546 12547 _makeFocusTarget: function() { 12548 this._untrackInstance(); 12549 this._trackingInstances().unshift( this ); 12550 }, 12551 12552 _untrackInstance: function() { 12553 var instances = this._trackingInstances(), 12554 exists = $.inArray( this, instances ); 12555 if ( exists !== -1 ) { 12556 instances.splice( exists, 1 ); 12557 } 12558 }, 12559 12560 _trackingInstances: function() { 12561 var instances = this.document.data( "ui-dialog-instances" ); 12562 if ( !instances ) { 12563 instances = []; 12564 this.document.data( "ui-dialog-instances", instances ); 12565 } 12566 return instances; 12567 }, 12568 12569 _minHeight: function() { 12570 var options = this.options; 12571 12572 return options.height === "auto" ? 12573 options.minHeight : 12574 Math.min( options.minHeight, options.height ); 12575 }, 12576 12577 _position: function() { 12578 12579 // Need to show the dialog to get the actual offset in the position plugin 12580 var isVisible = this.uiDialog.is( ":visible" ); 12581 if ( !isVisible ) { 12582 this.uiDialog.show(); 12583 } 12584 this.uiDialog.position( this.options.position ); 12585 if ( !isVisible ) { 12586 this.uiDialog.hide(); 12587 } 12588 }, 12589 12590 _setOptions: function( options ) { 12591 var that = this, 12592 resize = false, 12593 resizableOptions = {}; 12594 12595 $.each( options, function( key, value ) { 12596 that._setOption( key, value ); 12597 12598 if ( key in that.sizeRelatedOptions ) { 12599 resize = true; 12600 } 12601 if ( key in that.resizableRelatedOptions ) { 12602 resizableOptions[ key ] = value; 12603 } 12604 } ); 12605 12606 if ( resize ) { 12607 this._size(); 12608 this._position(); 12609 } 12610 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12611 this.uiDialog.resizable( "option", resizableOptions ); 12612 } 12613 }, 12614 12615 _setOption: function( key, value ) { 12616 var isDraggable, isResizable, 12617 uiDialog = this.uiDialog; 12618 12619 if ( key === "disabled" ) { 12620 return; 12621 } 12622 12623 this._super( key, value ); 12624 12625 if ( key === "appendTo" ) { 12626 this.uiDialog.appendTo( this._appendTo() ); 12627 } 12628 12629 if ( key === "buttons" ) { 12630 this._createButtons(); 12631 } 12632 12633 if ( key === "closeText" ) { 12634 this.uiDialogTitlebarClose.button( { 12635 12636 // Ensure that we always pass a string 12637 label: $( "<a>" ).text( "" + this.options.closeText ).html() 12638 } ); 12639 } 12640 12641 if ( key === "draggable" ) { 12642 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 12643 if ( isDraggable && !value ) { 12644 uiDialog.draggable( "destroy" ); 12645 } 12646 12647 if ( !isDraggable && value ) { 12648 this._makeDraggable(); 12649 } 12650 } 12651 12652 if ( key === "position" ) { 12653 this._position(); 12654 } 12655 12656 if ( key === "resizable" ) { 12657 12658 // currently resizable, becoming non-resizable 12659 isResizable = uiDialog.is( ":data(ui-resizable)" ); 12660 if ( isResizable && !value ) { 12661 uiDialog.resizable( "destroy" ); 12662 } 12663 12664 // Currently resizable, changing handles 12665 if ( isResizable && typeof value === "string" ) { 12666 uiDialog.resizable( "option", "handles", value ); 12667 } 12668 12669 // Currently non-resizable, becoming resizable 12670 if ( !isResizable && value !== false ) { 12671 this._makeResizable(); 12672 } 12673 } 12674 12675 if ( key === "title" ) { 12676 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 12677 } 12678 }, 12679 12680 _size: function() { 12681 12682 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12683 // divs will both have width and height set, so we need to reset them 12684 var nonContentHeight, minContentHeight, maxContentHeight, 12685 options = this.options; 12686 12687 // Reset content sizing 12688 this.element.show().css( { 12689 width: "auto", 12690 minHeight: 0, 12691 maxHeight: "none", 12692 height: 0 12693 } ); 12694 12695 if ( options.minWidth > options.width ) { 12696 options.width = options.minWidth; 12697 } 12698 12699 // Reset wrapper sizing 12700 // determine the height of all the non-content elements 12701 nonContentHeight = this.uiDialog.css( { 12702 height: "auto", 12703 width: options.width 12704 } ) 12705 .outerHeight(); 12706 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 12707 maxContentHeight = typeof options.maxHeight === "number" ? 12708 Math.max( 0, options.maxHeight - nonContentHeight ) : 12709 "none"; 12710 12711 if ( options.height === "auto" ) { 12712 this.element.css( { 12713 minHeight: minContentHeight, 12714 maxHeight: maxContentHeight, 12715 height: "auto" 12716 } ); 12717 } else { 12718 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 12719 } 12720 12721 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12722 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 12723 } 12724 }, 12725 12726 _blockFrames: function() { 12727 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 12728 var iframe = $( this ); 12729 12730 return $( "<div>" ) 12731 .css( { 12732 position: "absolute", 12733 width: iframe.outerWidth(), 12734 height: iframe.outerHeight() 12735 } ) 12736 .appendTo( iframe.parent() ) 12737 .offset( iframe.offset() )[ 0 ]; 12738 } ); 12739 }, 12740 12741 _unblockFrames: function() { 12742 if ( this.iframeBlocks ) { 12743 this.iframeBlocks.remove(); 12744 delete this.iframeBlocks; 12745 } 12746 }, 12747 12748 _allowInteraction: function( event ) { 12749 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 12750 return true; 12751 } 12752 12753 // TODO: Remove hack when datepicker implements 12754 // the .ui-front logic (#8989) 12755 return !!$( event.target ).closest( ".ui-datepicker" ).length; 12756 }, 12757 12758 _createOverlay: function() { 12759 if ( !this.options.modal ) { 12760 return; 12761 } 12762 12763 // We use a delay in case the overlay is created from an 12764 // event that we're going to be cancelling (#2804) 12765 var isOpening = true; 12766 this._delay( function() { 12767 isOpening = false; 12768 } ); 12769 12770 if ( !this.document.data( "ui-dialog-overlays" ) ) { 12771 12772 // Prevent use of anchors and inputs 12773 // Using _on() for an event handler shared across many instances is 12774 // safe because the dialogs stack and must be closed in reverse order 12775 this._on( this.document, { 12776 focusin: function( event ) { 12777 if ( isOpening ) { 12778 return; 12779 } 12780 12781 if ( !this._allowInteraction( event ) ) { 12782 event.preventDefault(); 12783 this._trackingInstances()[ 0 ]._focusTabbable(); 12784 } 12785 } 12786 } ); 12787 } 12788 12789 this.overlay = $( "<div>" ) 12790 .appendTo( this._appendTo() ); 12791 12792 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 12793 this._on( this.overlay, { 12794 mousedown: "_keepFocus" 12795 } ); 12796 this.document.data( "ui-dialog-overlays", 12797 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 12798 }, 12799 12800 _destroyOverlay: function() { 12801 if ( !this.options.modal ) { 12802 return; 12803 } 12804 12805 if ( this.overlay ) { 12806 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 12807 12808 if ( !overlays ) { 12809 this._off( this.document, "focusin" ); 12810 this.document.removeData( "ui-dialog-overlays" ); 12811 } else { 12812 this.document.data( "ui-dialog-overlays", overlays ); 12813 } 12814 12815 this.overlay.remove(); 12816 this.overlay = null; 12817 } 12818 } 12819} ); 12820 12821// DEPRECATED 12822// TODO: switch return back to widget declaration at top of file when this is removed 12823if ( $.uiBackCompat !== false ) { 12824 12825 // Backcompat for dialogClass option 12826 $.widget( "ui.dialog", $.ui.dialog, { 12827 options: { 12828 dialogClass: "" 12829 }, 12830 _createWrapper: function() { 12831 this._super(); 12832 this.uiDialog.addClass( this.options.dialogClass ); 12833 }, 12834 _setOption: function( key, value ) { 12835 if ( key === "dialogClass" ) { 12836 this.uiDialog 12837 .removeClass( this.options.dialogClass ) 12838 .addClass( value ); 12839 } 12840 this._superApply( arguments ); 12841 } 12842 } ); 12843} 12844 12845var widgetsDialog = $.ui.dialog; 12846 12847 12848/*! 12849 * jQuery UI Droppable 1.12.0 12850 * http://jqueryui.com 12851 * 12852 * Copyright jQuery Foundation and other contributors 12853 * Released under the MIT license. 12854 * http://jquery.org/license 12855 */ 12856 12857//>>label: Droppable 12858//>>group: Interactions 12859//>>description: Enables drop targets for draggable elements. 12860//>>docs: http://api.jqueryui.com/droppable/ 12861//>>demos: http://jqueryui.com/droppable/ 12862 12863 12864 12865$.widget( "ui.droppable", { 12866 version: "1.12.0", 12867 widgetEventPrefix: "drop", 12868 options: { 12869 accept: "*", 12870 addClasses: true, 12871 greedy: false, 12872 scope: "default", 12873 tolerance: "intersect", 12874 12875 // Callbacks 12876 activate: null, 12877 deactivate: null, 12878 drop: null, 12879 out: null, 12880 over: null 12881 }, 12882 _create: function() { 12883 12884 var proportions, 12885 o = this.options, 12886 accept = o.accept; 12887 12888 this.isover = false; 12889 this.isout = true; 12890 12891 this.accept = $.isFunction( accept ) ? accept : function( d ) { 12892 return d.is( accept ); 12893 }; 12894 12895 this.proportions = function( /* valueToWrite */ ) { 12896 if ( arguments.length ) { 12897 12898 // Store the droppable's proportions 12899 proportions = arguments[ 0 ]; 12900 } else { 12901 12902 // Retrieve or derive the droppable's proportions 12903 return proportions ? 12904 proportions : 12905 proportions = { 12906 width: this.element[ 0 ].offsetWidth, 12907 height: this.element[ 0 ].offsetHeight 12908 }; 12909 } 12910 }; 12911 12912 this._addToManager( o.scope ); 12913 12914 o.addClasses && this._addClass( "ui-droppable" ); 12915 12916 }, 12917 12918 _addToManager: function( scope ) { 12919 12920 // Add the reference and positions to the manager 12921 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 12922 $.ui.ddmanager.droppables[ scope ].push( this ); 12923 }, 12924 12925 _splice: function( drop ) { 12926 var i = 0; 12927 for ( ; i < drop.length; i++ ) { 12928 if ( drop[ i ] === this ) { 12929 drop.splice( i, 1 ); 12930 } 12931 } 12932 }, 12933 12934 _destroy: function() { 12935 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 12936 12937 this._splice( drop ); 12938 }, 12939 12940 _setOption: function( key, value ) { 12941 12942 if ( key === "accept" ) { 12943 this.accept = $.isFunction( value ) ? value : function( d ) { 12944 return d.is( value ); 12945 }; 12946 } else if ( key === "scope" ) { 12947 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 12948 12949 this._splice( drop ); 12950 this._addToManager( value ); 12951 } 12952 12953 this._super( key, value ); 12954 }, 12955 12956 _activate: function( event ) { 12957 var draggable = $.ui.ddmanager.current; 12958 12959 this._addActiveClass(); 12960 if ( draggable ) { 12961 this._trigger( "activate", event, this.ui( draggable ) ); 12962 } 12963 }, 12964 12965 _deactivate: function( event ) { 12966 var draggable = $.ui.ddmanager.current; 12967 12968 this._removeActiveClass(); 12969 if ( draggable ) { 12970 this._trigger( "deactivate", event, this.ui( draggable ) ); 12971 } 12972 }, 12973 12974 _over: function( event ) { 12975 12976 var draggable = $.ui.ddmanager.current; 12977 12978 // Bail if draggable and droppable are same element 12979 if ( !draggable || ( draggable.currentItem || 12980 draggable.element )[ 0 ] === this.element[ 0 ] ) { 12981 return; 12982 } 12983 12984 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 12985 draggable.element ) ) ) { 12986 this._addHoverClass(); 12987 this._trigger( "over", event, this.ui( draggable ) ); 12988 } 12989 12990 }, 12991 12992 _out: function( event ) { 12993 12994 var draggable = $.ui.ddmanager.current; 12995 12996 // Bail if draggable and droppable are same element 12997 if ( !draggable || ( draggable.currentItem || 12998 draggable.element )[ 0 ] === this.element[ 0 ] ) { 12999 return; 13000 } 13001 13002 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 13003 draggable.element ) ) ) { 13004 this._removeHoverClass(); 13005 this._trigger( "out", event, this.ui( draggable ) ); 13006 } 13007 13008 }, 13009 13010 _drop: function( event, custom ) { 13011 13012 var draggable = custom || $.ui.ddmanager.current, 13013 childrenIntersection = false; 13014 13015 // Bail if draggable and droppable are same element 13016 if ( !draggable || ( draggable.currentItem || 13017 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13018 return false; 13019 } 13020 13021 this.element 13022 .find( ":data(ui-droppable)" ) 13023 .not( ".ui-draggable-dragging" ) 13024 .each( function() { 13025 var inst = $( this ).droppable( "instance" ); 13026 if ( 13027 inst.options.greedy && 13028 !inst.options.disabled && 13029 inst.options.scope === draggable.options.scope && 13030 inst.accept.call( 13031 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 13032 ) && 13033 intersect( 13034 draggable, 13035 $.extend( inst, { offset: inst.element.offset() } ), 13036 inst.options.tolerance, event 13037 ) 13038 ) { 13039 childrenIntersection = true; 13040 return false; } 13041 } ); 13042 if ( childrenIntersection ) { 13043 return false; 13044 } 13045 13046 if ( this.accept.call( this.element[ 0 ], 13047 ( draggable.currentItem || draggable.element ) ) ) { 13048 this._removeActiveClass(); 13049 this._removeHoverClass(); 13050 13051 this._trigger( "drop", event, this.ui( draggable ) ); 13052 return this.element; 13053 } 13054 13055 return false; 13056 13057 }, 13058 13059 ui: function( c ) { 13060 return { 13061 draggable: ( c.currentItem || c.element ), 13062 helper: c.helper, 13063 position: c.position, 13064 offset: c.positionAbs 13065 }; 13066 }, 13067 13068 // Extension points just to make backcompat sane and avoid duplicating logic 13069 // TODO: Remove in 1.13 along with call to it below 13070 _addHoverClass: function() { 13071 this._addClass( "ui-droppable-hover" ); 13072 }, 13073 13074 _removeHoverClass: function() { 13075 this._removeClass( "ui-droppable-hover" ); 13076 }, 13077 13078 _addActiveClass: function() { 13079 this._addClass( "ui-droppable-active" ); 13080 }, 13081 13082 _removeActiveClass: function() { 13083 this._removeClass( "ui-droppable-active" ); 13084 } 13085} ); 13086 13087var intersect = $.ui.intersect = ( function() { 13088 function isOverAxis( x, reference, size ) { 13089 return ( x >= reference ) && ( x < ( reference + size ) ); 13090 } 13091 13092 return function( draggable, droppable, toleranceMode, event ) { 13093 13094 if ( !droppable.offset ) { 13095 return false; 13096 } 13097 13098 var x1 = ( draggable.positionAbs || 13099 draggable.position.absolute ).left + draggable.margins.left, 13100 y1 = ( draggable.positionAbs || 13101 draggable.position.absolute ).top + draggable.margins.top, 13102 x2 = x1 + draggable.helperProportions.width, 13103 y2 = y1 + draggable.helperProportions.height, 13104 l = droppable.offset.left, 13105 t = droppable.offset.top, 13106 r = l + droppable.proportions().width, 13107 b = t + droppable.proportions().height; 13108 13109 switch ( toleranceMode ) { 13110 case "fit": 13111 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 13112 case "intersect": 13113 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 13114 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 13115 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 13116 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 13117 case "pointer": 13118 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 13119 isOverAxis( event.pageX, l, droppable.proportions().width ); 13120 case "touch": 13121 return ( 13122 ( y1 >= t && y1 <= b ) || // Top edge touching 13123 ( y2 >= t && y2 <= b ) || // Bottom edge touching 13124 ( y1 < t && y2 > b ) // Surrounded vertically 13125 ) && ( 13126 ( x1 >= l && x1 <= r ) || // Left edge touching 13127 ( x2 >= l && x2 <= r ) || // Right edge touching 13128 ( x1 < l && x2 > r ) // Surrounded horizontally 13129 ); 13130 default: 13131 return false; 13132 } 13133 }; 13134} )(); 13135 13136/* 13137 This manager tracks offsets of draggables and droppables 13138*/ 13139$.ui.ddmanager = { 13140 current: null, 13141 droppables: { "default": [] }, 13142 prepareOffsets: function( t, event ) { 13143 13144 var i, j, 13145 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 13146 type = event ? event.type : null, // workaround for #2317 13147 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 13148 13149 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 13150 13151 // No disabled and non-accepted 13152 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 13153 ( t.currentItem || t.element ) ) ) ) { 13154 continue; 13155 } 13156 13157 // Filter out elements in the current dragged item 13158 for ( j = 0; j < list.length; j++ ) { 13159 if ( list[ j ] === m[ i ].element[ 0 ] ) { 13160 m[ i ].proportions().height = 0; 13161 continue droppablesLoop; 13162 } 13163 } 13164 13165 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 13166 if ( !m[ i ].visible ) { 13167 continue; 13168 } 13169 13170 // Activate the droppable if used directly from draggables 13171 if ( type === "mousedown" ) { 13172 m[ i ]._activate.call( m[ i ], event ); 13173 } 13174 13175 m[ i ].offset = m[ i ].element.offset(); 13176 m[ i ].proportions( { 13177 width: m[ i ].element[ 0 ].offsetWidth, 13178 height: m[ i ].element[ 0 ].offsetHeight 13179 } ); 13180 13181 } 13182 13183 }, 13184 drop: function( draggable, event ) { 13185 13186 var dropped = false; 13187 13188 // Create a copy of the droppables in case the list changes during the drop (#9116) 13189 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 13190 13191 if ( !this.options ) { 13192 return; 13193 } 13194 if ( !this.options.disabled && this.visible && 13195 intersect( draggable, this, this.options.tolerance, event ) ) { 13196 dropped = this._drop.call( this, event ) || dropped; 13197 } 13198 13199 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 13200 ( draggable.currentItem || draggable.element ) ) ) { 13201 this.isout = true; 13202 this.isover = false; 13203 this._deactivate.call( this, event ); 13204 } 13205 13206 } ); 13207 return dropped; 13208 13209 }, 13210 dragStart: function( draggable, event ) { 13211 13212 // Listen for scrolling so that if the dragging causes scrolling the position of the 13213 // droppables can be recalculated (see #5003) 13214 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 13215 if ( !draggable.options.refreshPositions ) { 13216 $.ui.ddmanager.prepareOffsets( draggable, event ); 13217 } 13218 } ); 13219 }, 13220 drag: function( draggable, event ) { 13221 13222 // If you have a highly dynamic page, you might try this option. It renders positions 13223 // every time you move the mouse. 13224 if ( draggable.options.refreshPositions ) { 13225 $.ui.ddmanager.prepareOffsets( draggable, event ); 13226 } 13227 13228 // Run through all droppables and check their positions based on specific tolerance options 13229 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 13230 13231 if ( this.options.disabled || this.greedyChild || !this.visible ) { 13232 return; 13233 } 13234 13235 var parentInstance, scope, parent, 13236 intersects = intersect( draggable, this, this.options.tolerance, event ), 13237 c = !intersects && this.isover ? 13238 "isout" : 13239 ( intersects && !this.isover ? "isover" : null ); 13240 if ( !c ) { 13241 return; 13242 } 13243 13244 if ( this.options.greedy ) { 13245 13246 // find droppable parents with same scope 13247 scope = this.options.scope; 13248 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 13249 return $( this ).droppable( "instance" ).options.scope === scope; 13250 } ); 13251 13252 if ( parent.length ) { 13253 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 13254 parentInstance.greedyChild = ( c === "isover" ); 13255 } 13256 } 13257 13258 // We just moved into a greedy child 13259 if ( parentInstance && c === "isover" ) { 13260 parentInstance.isover = false; 13261 parentInstance.isout = true; 13262 parentInstance._out.call( parentInstance, event ); 13263 } 13264 13265 this[ c ] = true; 13266 this[ c === "isout" ? "isover" : "isout" ] = false; 13267 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 13268 13269 // We just moved out of a greedy child 13270 if ( parentInstance && c === "isout" ) { 13271 parentInstance.isout = false; 13272 parentInstance.isover = true; 13273 parentInstance._over.call( parentInstance, event ); 13274 } 13275 } ); 13276 13277 }, 13278 dragStop: function( draggable, event ) { 13279 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 13280 13281 // Call prepareOffsets one final time since IE does not fire return scroll events when 13282 // overflow was caused by drag (see #5003) 13283 if ( !draggable.options.refreshPositions ) { 13284 $.ui.ddmanager.prepareOffsets( draggable, event ); 13285 } 13286 } 13287}; 13288 13289// DEPRECATED 13290// TODO: switch return back to widget declaration at top of file when this is removed 13291if ( $.uiBackCompat !== false ) { 13292 13293 // Backcompat for activeClass and hoverClass options 13294 $.widget( "ui.droppable", $.ui.droppable, { 13295 options: { 13296 hoverClass: false, 13297 activeClass: false 13298 }, 13299 _addActiveClass: function() { 13300 this._super(); 13301 if ( this.options.activeClass ) { 13302 this.element.addClass( this.options.activeClass ); 13303 } 13304 }, 13305 _removeActiveClass: function() { 13306 this._super(); 13307 if ( this.options.activeClass ) { 13308 this.element.removeClass( this.options.activeClass ); 13309 } 13310 }, 13311 _addHoverClass: function() { 13312 this._super(); 13313 if ( this.options.hoverClass ) { 13314 this.element.addClass( this.options.hoverClass ); 13315 } 13316 }, 13317 _removeHoverClass: function() { 13318 this._super(); 13319 if ( this.options.hoverClass ) { 13320 this.element.removeClass( this.options.hoverClass ); 13321 } 13322 } 13323 } ); 13324} 13325 13326var widgetsDroppable = $.ui.droppable; 13327 13328 13329/*! 13330 * jQuery UI Progressbar 1.12.0 13331 * http://jqueryui.com
vendor: 12,231 bytes, lines 13332-13790
13332 * 13333 * Copyright jQuery Foundation and other contributors 13334 * Released under the MIT license. 13335 * http://jquery.org/license 13336 */ 13337 13338//>>label: Progressbar 13339//>>group: Widgets 13340// jscs:disable maximumLineLength 13341//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 13342// jscs:enable maximumLineLength 13343//>>docs: http://api.jqueryui.com/progressbar/ 13344//>>demos: http://jqueryui.com/progressbar/ 13345//>>css.structure: ../../themes/base/core.css 13346//>>css.structure: ../../themes/base/progressbar.css 13347//>>css.theme: ../../themes/base/theme.css 13348 13349 13350 13351var widgetsProgressbar = $.widget( "ui.progressbar", { 13352 version: "1.12.0", 13353 options: { 13354 classes: { 13355 "ui-progressbar": "ui-corner-all", 13356 "ui-progressbar-value": "ui-corner-left", 13357 "ui-progressbar-complete": "ui-corner-right" 13358 }, 13359 max: 100, 13360 value: 0, 13361 13362 change: null, 13363 complete: null 13364 }, 13365 13366 min: 0, 13367 13368 _create: function() { 13369 13370 // Constrain initial value 13371 this.oldValue = this.options.value = this._constrainedValue(); 13372 13373 this.element.attr( { 13374 13375 // Only set static values; aria-valuenow and aria-valuemax are 13376 // set inside _refreshValue() 13377 role: "progressbar", 13378 "aria-valuemin": this.min 13379 } ); 13380 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 13381 13382 this.valueDiv = $( "<div>" ).appendTo( this.element ); 13383 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 13384 this._refreshValue(); 13385 }, 13386 13387 _destroy: function() { 13388 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 13389 13390 this.valueDiv.remove(); 13391 }, 13392 13393 value: function( newValue ) { 13394 if ( newValue === undefined ) { 13395 return this.options.value; 13396 } 13397 13398 this.options.value = this._constrainedValue( newValue ); 13399 this._refreshValue(); 13400 }, 13401 13402 _constrainedValue: function( newValue ) { 13403 if ( newValue === undefined ) { 13404 newValue = this.options.value; 13405 } 13406 13407 this.indeterminate = newValue === false; 13408 13409 // Sanitize value 13410 if ( typeof newValue !== "number" ) { 13411 newValue = 0; 13412 } 13413 13414 return this.indeterminate ? false : 13415 Math.min( this.options.max, Math.max( this.min, newValue ) ); 13416 }, 13417 13418 _setOptions: function( options ) { 13419 13420 // Ensure "value" option is set after other values (like max) 13421 var value = options.value; 13422 delete options.value; 13423 13424 this._super( options ); 13425 13426 this.options.value = this._constrainedValue( value ); 13427 this._refreshValue(); 13428 }, 13429 13430 _setOption: function( key, value ) { 13431 if ( key === "max" ) { 13432 13433 // Don't allow a max less than min 13434 value = Math.max( this.min, value ); 13435 } 13436 this._super( key, value ); 13437 }, 13438 13439 _setOptionDisabled: function( value ) { 13440 this._super( value ); 13441 13442 this.element.attr( "aria-disabled", value ); 13443 this._toggleClass( null, "ui-state-disabled", !!value ); 13444 }, 13445 13446 _percentage: function() { 13447 return this.indeterminate ? 13448 100 : 13449 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 13450 }, 13451 13452 _refreshValue: function() { 13453 var value = this.options.value, 13454 percentage = this._percentage(); 13455 13456 this.valueDiv 13457 .toggle( this.indeterminate || value > this.min ) 13458 .width( percentage.toFixed( 0 ) + "%" ); 13459 13460 this 13461 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 13462 value === this.options.max ) 13463 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 13464 13465 if ( this.indeterminate ) { 13466 this.element.removeAttr( "aria-valuenow" ); 13467 if ( !this.overlayDiv ) { 13468 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 13469 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 13470 } 13471 } else { 13472 this.element.attr( { 13473 "aria-valuemax": this.options.max, 13474 "aria-valuenow": value 13475 } ); 13476 if ( this.overlayDiv ) { 13477 this.overlayDiv.remove(); 13478 this.overlayDiv = null; 13479 } 13480 } 13481 13482 if ( this.oldValue !== value ) { 13483 this.oldValue = value; 13484 this._trigger( "change" ); 13485 } 13486 if ( value === this.options.max ) { 13487 this._trigger( "complete" ); 13488 } 13489 } 13490} ); 13491 13492 13493/*! 13494 * jQuery UI Selectable 1.12.0 13495 * http://jqueryui.com 13496 * 13497 * Copyright jQuery Foundation and other contributors 13498 * Released under the MIT license. 13499 * http://jquery.org/license 13500 */ 13501 13502//>>label: Selectable 13503//>>group: Interactions 13504//>>description: Allows groups of elements to be selected with the mouse. 13505//>>docs: http://api.jqueryui.com/selectable/ 13506//>>demos: http://jqueryui.com/selectable/ 13507//>>css.structure: ../../themes/base/selectable.css 13508 13509 13510 13511var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { 13512 version: "1.12.0", 13513 options: { 13514 appendTo: "body", 13515 autoRefresh: true, 13516 distance: 0, 13517 filter: "*", 13518 tolerance: "touch", 13519 13520 // Callbacks 13521 selected: null, 13522 selecting: null, 13523 start: null, 13524 stop: null, 13525 unselected: null, 13526 unselecting: null 13527 }, 13528 _create: function() { 13529 var that = this; 13530 13531 this._addClass( "ui-selectable" ); 13532 13533 this.dragged = false; 13534 13535 // Cache selectee children based on filter 13536 this.refresh = function() { 13537 that.elementPos = $( that.element[ 0 ] ).offset(); 13538 that.selectees = $( that.options.filter, that.element[ 0 ] ); 13539 that._addClass( that.selectees, "ui-selectee" ); 13540 that.selectees.each( function() { 13541 var $this = $( this ), 13542 selecteeOffset = $this.offset(), 13543 pos = { 13544 left: selecteeOffset.left - that.elementPos.left, 13545 top: selecteeOffset.top - that.elementPos.top 13546 }; 13547 $.data( this, "selectable-item", { 13548 element: this, 13549 $element: $this, 13550 left: pos.left, 13551 top: pos.top, 13552 right: pos.left + $this.outerWidth(), 13553 bottom: pos.top + $this.outerHeight(), 13554 startselected: false, 13555 selected: $this.hasClass( "ui-selected" ), 13556 selecting: $this.hasClass( "ui-selecting" ), 13557 unselecting: $this.hasClass( "ui-unselecting" ) 13558 } ); 13559 } ); 13560 }; 13561 this.refresh(); 13562 13563 this._mouseInit(); 13564 13565 this.helper = $( "<div>" ); 13566 this._addClass( this.helper, "ui-selectable-helper" ); 13567 }, 13568 13569 _destroy: function() { 13570 this.selectees.removeData( "selectable-item" ); 13571 this._mouseDestroy(); 13572 }, 13573 13574 _mouseStart: function( event ) { 13575 var that = this, 13576 options = this.options; 13577 13578 this.opos = [ event.pageX, event.pageY ]; 13579 this.elementPos = $( this.element[ 0 ] ).offset(); 13580 13581 if ( this.options.disabled ) { 13582 return; 13583 } 13584 13585 this.selectees = $( options.filter, this.element[ 0 ] ); 13586 13587 this._trigger( "start", event ); 13588 13589 $( options.appendTo ).append( this.helper ); 13590 13591 // position helper (lasso) 13592 this.helper.css( { 13593 "left": event.pageX, 13594 "top": event.pageY, 13595 "width": 0, 13596 "height": 0 13597 } ); 13598 13599 if ( options.autoRefresh ) { 13600 this.refresh(); 13601 } 13602 13603 this.selectees.filter( ".ui-selected" ).each( function() { 13604 var selectee = $.data( this, "selectable-item" ); 13605 selectee.startselected = true; 13606 if ( !event.metaKey && !event.ctrlKey ) { 13607 that._removeClass( selectee.$element, "ui-selected" ); 13608 selectee.selected = false; 13609 that._addClass( selectee.$element, "ui-unselecting" ); 13610 selectee.unselecting = true; 13611 13612 // selectable UNSELECTING callback 13613 that._trigger( "unselecting", event, { 13614 unselecting: selectee.element 13615 } ); 13616 } 13617 } ); 13618 13619 $( event.target ).parents().addBack().each( function() { 13620 var doSelect, 13621 selectee = $.data( this, "selectable-item" ); 13622 if ( selectee ) { 13623 doSelect = ( !event.metaKey && !event.ctrlKey ) || 13624 !selectee.$element.hasClass( "ui-selected" ); 13625 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 13626 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 13627 selectee.unselecting = !doSelect; 13628 selectee.selecting = doSelect; 13629 selectee.selected = doSelect; 13630 13631 // selectable (UN)SELECTING callback 13632 if ( doSelect ) { 13633 that._trigger( "selecting", event, { 13634 selecting: selectee.element 13635 } ); 13636 } else { 13637 that._trigger( "unselecting", event, { 13638 unselecting: selectee.element 13639 } ); 13640 } 13641 return false; 13642 } 13643 } ); 13644 13645 }, 13646 13647 _mouseDrag: function( event ) { 13648 13649 this.dragged = true; 13650 13651 if ( this.options.disabled ) { 13652 return; 13653 } 13654 13655 var tmp, 13656 that = this, 13657 options = this.options, 13658 x1 = this.opos[ 0 ], 13659 y1 = this.opos[ 1 ], 13660 x2 = event.pageX, 13661 y2 = event.pageY; 13662 13663 if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; } 13664 if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; } 13665 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 13666 13667 this.selectees.each( function() { 13668 var selectee = $.data( this, "selectable-item" ), 13669 hit = false, 13670 offset = {}; 13671 13672 //prevent helper from being selected if appendTo: selectable 13673 if ( !selectee || selectee.element === that.element[ 0 ] ) { 13674 return; 13675 } 13676 13677 offset.left = selectee.left + that.elementPos.left; 13678 offset.right = selectee.right + that.elementPos.left; 13679 offset.top = selectee.top + that.elementPos.top; 13680 offset.bottom = selectee.bottom + that.elementPos.top; 13681 13682 if ( options.tolerance === "touch" ) { 13683 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 13684 offset.bottom < y1 ) ); 13685 } else if ( options.tolerance === "fit" ) { 13686 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 13687 offset.bottom < y2 ); 13688 } 13689 13690 if ( hit ) { 13691 13692 // SELECT 13693 if ( selectee.selected ) { 13694 that._removeClass( selectee.$element, "ui-selected" ); 13695 selectee.selected = false; 13696 } 13697 if ( selectee.unselecting ) { 13698 that._removeClass( selectee.$element, "ui-unselecting" ); 13699 selectee.unselecting = false; 13700 } 13701 if ( !selectee.selecting ) { 13702 that._addClass( selectee.$element, "ui-selecting" ); 13703 selectee.selecting = true; 13704 13705 // selectable SELECTING callback 13706 that._trigger( "selecting", event, { 13707 selecting: selectee.element 13708 } ); 13709 } 13710 } else { 13711 13712 // UNSELECT 13713 if ( selectee.selecting ) { 13714 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 13715 that._removeClass( selectee.$element, "ui-selecting" ); 13716 selectee.selecting = false; 13717 that._addClass( selectee.$element, "ui-selected" ); 13718 selectee.selected = true; 13719 } else { 13720 that._removeClass( selectee.$element, "ui-selecting" ); 13721 selectee.selecting = false; 13722 if ( selectee.startselected ) { 13723 that._addClass( selectee.$element, "ui-unselecting" ); 13724 selectee.unselecting = true; 13725 } 13726 13727 // selectable UNSELECTING callback 13728 that._trigger( "unselecting", event, { 13729 unselecting: selectee.element 13730 } ); 13731 } 13732 } 13733 if ( selectee.selected ) { 13734 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 13735 that._removeClass( selectee.$element, "ui-selected" ); 13736 selectee.selected = false; 13737 13738 that._addClass( selectee.$element, "ui-unselecting" ); 13739 selectee.unselecting = true; 13740 13741 // selectable UNSELECTING callback 13742 that._trigger( "unselecting", event, { 13743 unselecting: selectee.element 13744 } ); 13745 } 13746 } 13747 } 13748 } ); 13749 13750 return false; 13751 }, 13752 13753 _mouseStop: function( event ) { 13754 var that = this; 13755 13756 this.dragged = false; 13757 13758 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 13759 var selectee = $.data( this, "selectable-item" ); 13760 that._removeClass( selectee.$element, "ui-unselecting" ); 13761 selectee.unselecting = false; 13762 selectee.startselected = false; 13763 that._trigger( "unselected", event, { 13764 unselected: selectee.element 13765 } ); 13766 } ); 13767 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 13768 var selectee = $.data( this, "selectable-item" ); 13769 that._removeClass( selectee.$element, "ui-selecting" ) 13770 ._addClass( selectee.$element, "ui-selected" ); 13771 selectee.selecting = false; 13772 selectee.selected = true; 13773 selectee.startselected = true; 13774 that._trigger( "selected", event, { 13775 selected: selectee.element 13776 } ); 13777 } ); 13778 this._trigger( "stop", event ); 13779 13780 this.helper.remove(); 13781 13782 return false; 13783 } 13784 13785} ); 13786 13787 13788/*! 13789 * jQuery UI Selectmenu 1.12.0 13790 * http://jqueryui.com
vendor: 5,543 bytes, lines 13791-13997
13791 * 13792 * Copyright jQuery Foundation and other contributors 13793 * Released under the MIT license. 13794 * http://jquery.org/license 13795 */ 13796 13797//>>label: Selectmenu 13798//>>group: Widgets 13799// jscs:disable maximumLineLength 13800//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. 13801// jscs:enable maximumLineLength 13802//>>docs: http://api.jqueryui.com/selectmenu/ 13803//>>demos: http://jqueryui.com/selectmenu/ 13804//>>css.structure: ../../themes/base/core.css 13805//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 13806//>>css.theme: ../../themes/base/theme.css 13807 13808 13809 13810var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 13811 version: "1.12.0", 13812 defaultElement: "<select>", 13813 options: { 13814 appendTo: null, 13815 classes: { 13816 "ui-selectmenu-button-open": "ui-corner-top", 13817 "ui-selectmenu-button-closed": "ui-corner-all" 13818 }, 13819 disabled: null, 13820 icons: { 13821 button: "ui-icon-triangle-1-s" 13822 }, 13823 position: { 13824 my: "left top", 13825 at: "left bottom", 13826 collision: "none" 13827 }, 13828 width: false, 13829 13830 // Callbacks 13831 change: null, 13832 close: null, 13833 focus: null, 13834 open: null, 13835 select: null 13836 }, 13837 13838 _create: function() { 13839 var selectmenuId = this.element.uniqueId().attr( "id" ); 13840 this.ids = { 13841 element: selectmenuId, 13842 button: selectmenuId + "-button", 13843 menu: selectmenuId + "-menu" 13844 }; 13845 13846 this._drawButton(); 13847 this._drawMenu(); 13848 this._bindFormResetHandler(); 13849 13850 this._rendered = false; 13851 this.menuItems = $(); 13852 }, 13853 13854 _drawButton: function() { 13855 var icon, 13856 that = this, 13857 item = this._parseOption( 13858 this.element.find( "option:selected" ), 13859 this.element[ 0 ].selectedIndex 13860 ); 13861 13862 // Associate existing label with the new button 13863 this.labels = this.element.labels().attr( "for", this.ids.button ); 13864 this._on( this.labels, { 13865 click: function( event ) { 13866 this.button.focus(); 13867 event.preventDefault(); 13868 } 13869 } ); 13870 13871 // Hide original select element 13872 this.element.hide(); 13873 13874 // Create button 13875 this.button = $( "<span>", { 13876 tabindex: this.options.disabled ? -1 : 0, 13877 id: this.ids.button, 13878 role: "combobox", 13879 "aria-expanded": "false", 13880 "aria-autocomplete": "list", 13881 "aria-owns": this.ids.menu, 13882 "aria-haspopup": "true", 13883 title: this.element.attr( "title" ) 13884 } ) 13885 .insertAfter( this.element ); 13886 13887 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 13888 "ui-button ui-widget" ); 13889 13890 icon = $( "<span>" ).appendTo( this.button ); 13891 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 13892 this.buttonItem = this._renderButtonItem( item ) 13893 .appendTo( this.button ); 13894 13895 if ( this.options.width !== false ) { 13896 this._resizeButton(); 13897 } 13898 13899 this._on( this.button, this._buttonEvents ); 13900 this.button.one( "focusin", function() { 13901 13902 // Delay rendering the menu items until the button receives focus. 13903 // The menu may have already been rendered via a programmatic open. 13904 if ( !that._rendered ) { 13905 that._refreshMenu(); 13906 } 13907 } ); 13908 }, 13909 13910 _drawMenu: function() { 13911 var that = this; 13912 13913 // Create menu 13914 this.menu = $( "<ul>", { 13915 "aria-hidden": "true", 13916 "aria-labelledby": this.ids.button, 13917 id: this.ids.menu 13918 } ); 13919 13920 // Wrap menu 13921 this.menuWrap = $( "<div>" ).append( this.menu ); 13922 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 13923 this.menuWrap.appendTo( this._appendTo() ); 13924 13925 // Initialize menu widget 13926 this.menuInstance = this.menu 13927 .menu( { 13928 classes: { 13929 "ui-menu": "ui-corner-bottom" 13930 }, 13931 role: "listbox", 13932 select: function( event, ui ) { 13933 event.preventDefault(); 13934 13935 // Support: IE8 13936 // If the item was selected via a click, the text selection 13937 // will be destroyed in IE 13938 that._setSelection(); 13939 13940 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 13941 }, 13942 focus: function( event, ui ) { 13943 var item = ui.item.data( "ui-selectmenu-item" ); 13944 13945 // Prevent inital focus from firing and check if its a newly focused item 13946 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 13947 that._trigger( "focus", event, { item: item } ); 13948 if ( !that.isOpen ) { 13949 that._select( item, event ); 13950 } 13951 } 13952 that.focusIndex = item.index; 13953 13954 that.button.attr( "aria-activedescendant", 13955 that.menuItems.eq( item.index ).attr( "id" ) ); 13956 } 13957 } ) 13958 .menu( "instance" ); 13959 13960 // Don't close the menu on mouseleave 13961 this.menuInstance._off( this.menu, "mouseleave" ); 13962 13963 // Cancel the menu's collapseAll on document click 13964 this.menuInstance._closeOnDocumentClick = function() { 13965 return false; 13966 }; 13967 13968 // Selects often contain empty items, but never contain dividers 13969 this.menuInstance._isDivider = function() { 13970 return false; 13971 }; 13972 }, 13973 13974 refresh: function() { 13975 this._refreshMenu(); 13976 this.buttonItem.replaceWith( 13977 this.buttonItem = this._renderButtonItem( 13978 13979 // Fall back to an empty object in case there are no options 13980 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 13981 ) 13982 ); 13983 if ( this.options.width === null ) { 13984 this._resizeButton(); 13985 } 13986 }, 13987 13988 _refreshMenu: function() { 13989 var item, 13990 options = this.element.find( "option" ); 13991 13992 this.menu.empty(); 13993 13994 this._parseOptions( options ); 13995 this._renderMenu( this.menu, this.items ); 13996 13997 this.menuInstance.refresh();
vendor: 9,769 bytes, lines 13998-14405
13998 this.menuItems = this.menu.find( "li" ) 13999 .not( ".ui-selectmenu-optgroup" ) 14000 .find( ".ui-menu-item-wrapper" ); 14001 14002 this._rendered = true; 14003 14004 if ( !options.length ) { 14005 return; 14006 } 14007 14008 item = this._getSelectedItem(); 14009 14010 // Update the menu to have the correct item focused 14011 this.menuInstance.focus( null, item ); 14012 this._setAria( item.data( "ui-selectmenu-item" ) ); 14013 14014 // Set disabled state 14015 this._setOption( "disabled", this.element.prop( "disabled" ) ); 14016 }, 14017 14018 open: function( event ) { 14019 if ( this.options.disabled ) { 14020 return; 14021 } 14022 14023 // If this is the first time the menu is being opened, render the items 14024 if ( !this._rendered ) { 14025 this._refreshMenu(); 14026 } else { 14027 14028 // Menu clears focus on close, reset focus to selected item 14029 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 14030 this.menuInstance.focus( null, this._getSelectedItem() ); 14031 } 14032 14033 // If there are no options, don't open the menu 14034 if ( !this.menuItems.length ) { 14035 return; 14036 } 14037 14038 this.isOpen = true; 14039 this._toggleAttr(); 14040 this._resizeMenu(); 14041 this._position(); 14042 14043 this._on( this.document, this._documentClick ); 14044 14045 this._trigger( "open", event ); 14046 }, 14047 14048 _position: function() { 14049 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 14050 }, 14051 14052 close: function( event ) { 14053 if ( !this.isOpen ) { 14054 return; 14055 } 14056 14057 this.isOpen = false; 14058 this._toggleAttr(); 14059 14060 this.range = null; 14061 this._off( this.document ); 14062 14063 this._trigger( "close", event ); 14064 }, 14065 14066 widget: function() { 14067 return this.button; 14068 }, 14069 14070 menuWidget: function() { 14071 return this.menu; 14072 }, 14073 14074 _renderButtonItem: function( item ) { 14075 var buttonItem = $( "<span>" ); 14076 14077 this._setText( buttonItem, item.label ); 14078 this._addClass( buttonItem, "ui-selectmenu-text" ); 14079 14080 return buttonItem; 14081 }, 14082 14083 _renderMenu: function( ul, items ) { 14084 var that = this, 14085 currentOptgroup = ""; 14086 14087 $.each( items, function( index, item ) { 14088 var li; 14089 14090 if ( item.optgroup !== currentOptgroup ) { 14091 li = $( "<li>", { 14092 text: item.optgroup 14093 } ); 14094 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 14095 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 14096 " ui-state-disabled" : 14097 "" ) ); 14098 14099 li.appendTo( ul ); 14100 14101 currentOptgroup = item.optgroup; 14102 } 14103 14104 that._renderItemData( ul, item ); 14105 } ); 14106 }, 14107 14108 _renderItemData: function( ul, item ) { 14109 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 14110 }, 14111 14112 _renderItem: function( ul, item ) { 14113 var li = $( "<li>" ), 14114 wrapper = $( "<div>", { 14115 title: item.element.attr( "title" ) 14116 } ); 14117 14118 if ( item.disabled ) { 14119 this._addClass( li, null, "ui-state-disabled" ); 14120 } 14121 this._setText( wrapper, item.label ); 14122 14123 return li.append( wrapper ).appendTo( ul ); 14124 }, 14125 14126 _setText: function( element, value ) { 14127 if ( value ) { 14128 element.text( value ); 14129 } else { 14130 element.html( " " ); 14131 } 14132 }, 14133 14134 _move: function( direction, event ) { 14135 var item, next, 14136 filter = ".ui-menu-item"; 14137 14138 if ( this.isOpen ) { 14139 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 14140 } else { 14141 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14142 filter += ":not(.ui-state-disabled)"; 14143 } 14144 14145 if ( direction === "first" || direction === "last" ) { 14146 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 14147 } else { 14148 next = item[ direction + "All" ]( filter ).eq( 0 ); 14149 } 14150 14151 if ( next.length ) { 14152 this.menuInstance.focus( event, next ); 14153 } 14154 }, 14155 14156 _getSelectedItem: function() { 14157 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14158 }, 14159 14160 _toggle: function( event ) { 14161 this[ this.isOpen ? "close" : "open" ]( event ); 14162 }, 14163 14164 _setSelection: function() { 14165 var selection; 14166 14167 if ( !this.range ) { 14168 return; 14169 } 14170 14171 if ( window.getSelection ) { 14172 selection = window.getSelection(); 14173 selection.removeAllRanges(); 14174 selection.addRange( this.range ); 14175 14176 // Support: IE8 14177 } else { 14178 this.range.select(); 14179 } 14180 14181 // Support: IE 14182 // Setting the text selection kills the button focus in IE, but 14183 // restoring the focus doesn't kill the selection. 14184 this.button.focus(); 14185 }, 14186 14187 _documentClick: { 14188 mousedown: function( event ) { 14189 if ( !this.isOpen ) { 14190 return; 14191 } 14192 14193 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 14194 $.ui.escapeSelector( this.ids.button ) ).length ) { 14195 this.close( event ); 14196 } 14197 } 14198 }, 14199 14200 _buttonEvents: { 14201 14202 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 14203 mousedown: function() { 14204 var selection; 14205 14206 if ( window.getSelection ) { 14207 selection = window.getSelection(); 14208 if ( selection.rangeCount ) { 14209 this.range = selection.getRangeAt( 0 ); 14210 } 14211 14212 // Support: IE8 14213 } else { 14214 this.range = document.selection.createRange(); 14215 } 14216 }, 14217 14218 click: function( event ) { 14219 this._setSelection(); 14220 this._toggle( event ); 14221 }, 14222 14223 keydown: function( event ) { 14224 var preventDefault = true; 14225 switch ( event.keyCode ) { 14226 case $.ui.keyCode.TAB: 14227 case $.ui.keyCode.ESCAPE: 14228 this.close( event ); 14229 preventDefault = false; 14230 break; 14231 case $.ui.keyCode.ENTER: 14232 if ( this.isOpen ) { 14233 this._selectFocusedItem( event ); 14234 } 14235 break; 14236 case $.ui.keyCode.UP: 14237 if ( event.altKey ) { 14238 this._toggle( event ); 14239 } else { 14240 this._move( "prev", event ); 14241 } 14242 break; 14243 case $.ui.keyCode.DOWN: 14244 if ( event.altKey ) { 14245 this._toggle( event ); 14246 } else { 14247 this._move( "next", event ); 14248 } 14249 break; 14250 case $.ui.keyCode.SPACE: 14251 if ( this.isOpen ) { 14252 this._selectFocusedItem( event ); 14253 } else { 14254 this._toggle( event ); 14255 } 14256 break; 14257 case $.ui.keyCode.LEFT: 14258 this._move( "prev", event ); 14259 break; 14260 case $.ui.keyCode.RIGHT: 14261 this._move( "next", event ); 14262 break; 14263 case $.ui.keyCode.HOME: 14264 case $.ui.keyCode.PAGE_UP: 14265 this._move( "first", event ); 14266 break; 14267 case $.ui.keyCode.END: 14268 case $.ui.keyCode.PAGE_DOWN: 14269 this._move( "last", event ); 14270 break; 14271 default: 14272 this.menu.trigger( event ); 14273 preventDefault = false; 14274 } 14275 14276 if ( preventDefault ) { 14277 event.preventDefault(); 14278 } 14279 } 14280 }, 14281 14282 _selectFocusedItem: function( event ) { 14283 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 14284 if ( !item.hasClass( "ui-state-disabled" ) ) { 14285 this._select( item.data( "ui-selectmenu-item" ), event ); 14286 } 14287 }, 14288 14289 _select: function( item, event ) { 14290 var oldIndex = this.element[ 0 ].selectedIndex; 14291 14292 // Change native select element 14293 this.element[ 0 ].selectedIndex = item.index; 14294 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 14295 this._setAria( item ); 14296 this._trigger( "select", event, { item: item } ); 14297 14298 if ( item.index !== oldIndex ) { 14299 this._trigger( "change", event, { item: item } ); 14300 } 14301 14302 this.close( event ); 14303 }, 14304 14305 _setAria: function( item ) { 14306 var id = this.menuItems.eq( item.index ).attr( "id" ); 14307 14308 this.button.attr( { 14309 "aria-labelledby": id, 14310 "aria-activedescendant": id 14311 } ); 14312 this.menu.attr( "aria-activedescendant", id ); 14313 }, 14314 14315 _setOption: function( key, value ) { 14316 if ( key === "icons" ) { 14317 var icon = this.button.find( "span.ui-icon" ); 14318 this._removeClass( icon, null, this.options.icons.button ) 14319 ._addClass( icon, null, value.button ); 14320 } 14321 14322 this._super( key, value ); 14323 14324 if ( key === "appendTo" ) { 14325 this.menuWrap.appendTo( this._appendTo() ); 14326 } 14327 14328 if ( key === "width" ) { 14329 this._resizeButton(); 14330 } 14331 }, 14332 14333 _setOptionDisabled: function( value ) { 14334 this._super( value ); 14335 14336 this.menuInstance.option( "disabled", value ); 14337 this.button.attr( "aria-disabled", value ); 14338 this._toggleClass( this.button, null, "ui-state-disabled", value ); 14339 14340 this.element.prop( "disabled", value ); 14341 if ( value ) { 14342 this.button.attr( "tabindex", -1 ); 14343 this.close(); 14344 } else { 14345 this.button.attr( "tabindex", 0 ); 14346 } 14347 }, 14348 14349 _appendTo: function() { 14350 var element = this.options.appendTo; 14351 14352 if ( element ) { 14353 element = element.jquery || element.nodeType ? 14354 $( element ) : 14355 this.document.find( element ).eq( 0 ); 14356 } 14357 14358 if ( !element || !element[ 0 ] ) { 14359 element = this.element.closest( ".ui-front, dialog" ); 14360 } 14361 14362 if ( !element.length ) { 14363 element = this.document[ 0 ].body; 14364 } 14365 14366 return element; 14367 }, 14368 14369 _toggleAttr: function() { 14370 this.button.attr( "aria-expanded", this.isOpen ); 14371 14372 // We can't use two _toggleClass() calls here, because we need to make sure 14373 // we always remove classes first and add them second, otherwise if both classes have the 14374 // same theme class, it will be removed after we add it. 14375 this._removeClass( this.button, "ui-selectmenu-button-" + 14376 ( this.isOpen ? "closed" : "open" ) ) 14377 ._addClass( this.button, "ui-selectmenu-button-" + 14378 ( this.isOpen ? "open" : "closed" ) ) 14379 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 14380 14381 this.menu.attr( "aria-hidden", !this.isOpen ); 14382 }, 14383 14384 _resizeButton: function() { 14385 var width = this.options.width; 14386 14387 // For `width: false`, just remove inline style and stop 14388 if ( width === false ) { 14389 this.button.css( "width", "" ); 14390 return; 14391 } 14392 14393 // For `width: null`, match the width of the original element 14394 if ( width === null ) { 14395 width = this.element.show().outerWidth(); 14396 this.element.hide(); 14397 } 14398 14399 this.button.outerWidth( width ); 14400 }, 14401 14402 _resizeMenu: function() { 14403 this.menu.outerWidth( Math.max( 14404 this.button.outerWidth(), 14405
vendor: 5,356 bytes, lines 14406-14617
14406 // Support: IE10 14407 // IE10 wraps long text (possibly a rounding bug) 14408 // so we add 1px to avoid the wrapping 14409 this.menu.width( "" ).outerWidth() + 1 14410 ) ); 14411 }, 14412 14413 _getCreateOptions: function() { 14414 var options = this._super(); 14415 14416 options.disabled = this.element.prop( "disabled" ); 14417 14418 return options; 14419 }, 14420 14421 _parseOptions: function( options ) { 14422 var that = this, 14423 data = []; 14424 options.each( function( index, item ) { 14425 data.push( that._parseOption( $( item ), index ) ); 14426 } ); 14427 this.items = data; 14428 }, 14429 14430 _parseOption: function( option, index ) { 14431 var optgroup = option.parent( "optgroup" ); 14432 14433 return { 14434 element: option, 14435 index: index, 14436 value: option.val(), 14437 label: option.text(), 14438 optgroup: optgroup.attr( "label" ) || "", 14439 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 14440 }; 14441 }, 14442 14443 _destroy: function() { 14444 this._unbindFormResetHandler(); 14445 this.menuWrap.remove(); 14446 this.button.remove(); 14447 this.element.show(); 14448 this.element.removeUniqueId(); 14449 this.labels.attr( "for", this.ids.element ); 14450 } 14451} ] ); 14452 14453 14454/*! 14455 * jQuery UI Slider 1.12.0 14456 * http://jqueryui.com 14457 * 14458 * Copyright jQuery Foundation and other contributors 14459 * Released under the MIT license. 14460 * http://jquery.org/license 14461 */ 14462 14463//>>label: Slider 14464//>>group: Widgets 14465//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 14466//>>docs: http://api.jqueryui.com/slider/ 14467//>>demos: http://jqueryui.com/slider/ 14468//>>css.structure: ../../themes/base/core.css 14469//>>css.structure: ../../themes/base/slider.css 14470//>>css.theme: ../../themes/base/theme.css 14471 14472 14473 14474var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { 14475 version: "1.12.0", 14476 widgetEventPrefix: "slide", 14477 14478 options: { 14479 animate: false, 14480 classes: { 14481 "ui-slider": "ui-corner-all", 14482 "ui-slider-handle": "ui-corner-all", 14483 14484 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 14485 // element, but worked best visually with a variety of themes 14486 "ui-slider-range": "ui-corner-all ui-widget-header" 14487 }, 14488 distance: 0, 14489 max: 100, 14490 min: 0, 14491 orientation: "horizontal", 14492 range: false, 14493 step: 1, 14494 value: 0, 14495 values: null, 14496 14497 // Callbacks 14498 change: null, 14499 slide: null, 14500 start: null, 14501 stop: null 14502 }, 14503 14504 // Number of pages in a slider 14505 // (how many times can you page up/down to go through the whole range) 14506 numPages: 5, 14507 14508 _create: function() { 14509 this._keySliding = false; 14510 this._mouseSliding = false; 14511 this._animateOff = true; 14512 this._handleIndex = null; 14513 this._detectOrientation(); 14514 this._mouseInit(); 14515 this._calculateNewMax(); 14516 14517 this._addClass( "ui-slider ui-slider-" + this.orientation, 14518 "ui-widget ui-widget-content" ); 14519 14520 this._refresh(); 14521 14522 this._animateOff = false; 14523 }, 14524 14525 _refresh: function() { 14526 this._createRange(); 14527 this._createHandles(); 14528 this._setupEvents(); 14529 this._refreshValue(); 14530 }, 14531 14532 _createHandles: function() { 14533 var i, handleCount, 14534 options = this.options, 14535 existingHandles = this.element.find( ".ui-slider-handle" ), 14536 handle = "<span tabindex='0'></span>", 14537 handles = []; 14538 14539 handleCount = ( options.values && options.values.length ) || 1; 14540 14541 if ( existingHandles.length > handleCount ) { 14542 existingHandles.slice( handleCount ).remove(); 14543 existingHandles = existingHandles.slice( 0, handleCount ); 14544 } 14545 14546 for ( i = existingHandles.length; i < handleCount; i++ ) { 14547 handles.push( handle ); 14548 } 14549 14550 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 14551 14552 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 14553 14554 this.handle = this.handles.eq( 0 ); 14555 14556 this.handles.each( function( i ) { 14557 $( this ).data( "ui-slider-handle-index", i ); 14558 } ); 14559 }, 14560 14561 _createRange: function() { 14562 var options = this.options; 14563 14564 if ( options.range ) { 14565 if ( options.range === true ) { 14566 if ( !options.values ) { 14567 options.values = [ this._valueMin(), this._valueMin() ]; 14568 } else if ( options.values.length && options.values.length !== 2 ) { 14569 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 14570 } else if ( $.isArray( options.values ) ) { 14571 options.values = options.values.slice( 0 ); 14572 } 14573 } 14574 14575 if ( !this.range || !this.range.length ) { 14576 this.range = $( "<div>" ) 14577 .appendTo( this.element ); 14578 14579 this._addClass( this.range, "ui-slider-range" ); 14580 } else { 14581 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 14582 14583 // Handle range switching from true to min/max 14584 this.range.css( { 14585 "left": "", 14586 "bottom": "" 14587 } ); 14588 } 14589 if ( options.range === "min" || options.range === "max" ) { 14590 this._addClass( this.range, "ui-slider-range-" + options.range ); 14591 } 14592 } else { 14593 if ( this.range ) { 14594 this.range.remove(); 14595 } 14596 this.range = null; 14597 } 14598 }, 14599 14600 _setupEvents: function() { 14601 this._off( this.handles ); 14602 this._on( this.handles, this._handleEvents ); 14603 this._hoverable( this.handles ); 14604 this._focusable( this.handles ); 14605 }, 14606 14607 _destroy: function() { 14608 this.handles.remove(); 14609 if ( this.range ) { 14610 this.range.remove(); 14611 } 14612 14613 this._mouseDestroy(); 14614 }, 14615 14616 _mouseCapture: function( event ) { 14617 var position, normValue, distance, closestHandle, index, allowed, offset, mou
vendor: 15,762 bytes, lines 14617-15190
14617seOverHandle, 14618 that = this, 14619 o = this.options; 14620 14621 if ( o.disabled ) { 14622 return false; 14623 } 14624 14625 this.elementSize = { 14626 width: this.element.outerWidth(), 14627 height: this.element.outerHeight() 14628 }; 14629 this.elementOffset = this.element.offset(); 14630 14631 position = { x: event.pageX, y: event.pageY }; 14632 normValue = this._normValueFromMouse( position ); 14633 distance = this._valueMax() - this._valueMin() + 1; 14634 this.handles.each( function( i ) { 14635 var thisDistance = Math.abs( normValue - that.values( i ) ); 14636 if ( ( distance > thisDistance ) || 14637 ( distance === thisDistance && 14638 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 14639 distance = thisDistance; 14640 closestHandle = $( this ); 14641 index = i; 14642 } 14643 } ); 14644 14645 allowed = this._start( event, index ); 14646 if ( allowed === false ) { 14647 return false; 14648 } 14649 this._mouseSliding = true; 14650 14651 this._handleIndex = index; 14652 14653 this._addClass( closestHandle, null, "ui-state-active" ); 14654 closestHandle.trigger( "focus" ); 14655 14656 offset = closestHandle.offset(); 14657 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 14658 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 14659 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 14660 top: event.pageY - offset.top - 14661 ( closestHandle.height() / 2 ) - 14662 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 14663 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 14664 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 14665 }; 14666 14667 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 14668 this._slide( event, index, normValue ); 14669 } 14670 this._animateOff = true; 14671 return true; 14672 }, 14673 14674 _mouseStart: function() { 14675 return true; 14676 }, 14677 14678 _mouseDrag: function( event ) { 14679 var position = { x: event.pageX, y: event.pageY }, 14680 normValue = this._normValueFromMouse( position ); 14681 14682 this._slide( event, this._handleIndex, normValue ); 14683 14684 return false; 14685 }, 14686 14687 _mouseStop: function( event ) { 14688 this._removeClass( this.handles, null, "ui-state-active" ); 14689 this._mouseSliding = false; 14690 14691 this._stop( event, this._handleIndex ); 14692 this._change( event, this._handleIndex ); 14693 14694 this._handleIndex = null; 14695 this._clickOffset = null; 14696 this._animateOff = false; 14697 14698 return false; 14699 }, 14700 14701 _detectOrientation: function() { 14702 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 14703 }, 14704 14705 _normValueFromMouse: function( position ) { 14706 var pixelTotal, 14707 pixelMouse, 14708 percentMouse, 14709 valueTotal, 14710 valueMouse; 14711 14712 if ( this.orientation === "horizontal" ) { 14713 pixelTotal = this.elementSize.width; 14714 pixelMouse = position.x - this.elementOffset.left - 14715 ( this._clickOffset ? this._clickOffset.left : 0 ); 14716 } else { 14717 pixelTotal = this.elementSize.height; 14718 pixelMouse = position.y - this.elementOffset.top - 14719 ( this._clickOffset ? this._clickOffset.top : 0 ); 14720 } 14721 14722 percentMouse = ( pixelMouse / pixelTotal ); 14723 if ( percentMouse > 1 ) { 14724 percentMouse = 1; 14725 } 14726 if ( percentMouse < 0 ) { 14727 percentMouse = 0; 14728 } 14729 if ( this.orientation === "vertical" ) { 14730 percentMouse = 1 - percentMouse; 14731 } 14732 14733 valueTotal = this._valueMax() - this._valueMin(); 14734 valueMouse = this._valueMin() + percentMouse * valueTotal; 14735 14736 return this._trimAlignValue( valueMouse ); 14737 }, 14738 14739 _uiHash: function( index, value, values ) { 14740 var uiHash = { 14741 handle: this.handles[ index ], 14742 handleIndex: index, 14743 value: value !== undefined ? value : this.value() 14744 }; 14745 14746 if ( this._hasMultipleValues() ) { 14747 uiHash.value = value !== undefined ? value : this.values( index ); 14748 uiHash.values = values || this.values(); 14749 } 14750 14751 return uiHash; 14752 }, 14753 14754 _hasMultipleValues: function() { 14755 return this.options.values && this.options.values.length; 14756 }, 14757 14758 _start: function( event, index ) { 14759 return this._trigger( "start", event, this._uiHash( index ) ); 14760 }, 14761 14762 _slide: function( event, index, newVal ) { 14763 var allowed, otherVal, 14764 currentValue = this.value(), 14765 newValues = this.values(); 14766 14767 if ( this._hasMultipleValues() ) { 14768 otherVal = this.values( index ? 0 : 1 ); 14769 currentValue = this.values( index ); 14770 14771 if ( this.options.values.length === 2 && this.options.range === true ) { 14772 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 14773 } 14774 14775 newValues[ index ] = newVal; 14776 } 14777 14778 if ( newVal === currentValue ) { 14779 return; 14780 } 14781 14782 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 14783 14784 // A slide can be canceled by returning false from the slide callback 14785 if ( allowed === false ) { 14786 return; 14787 } 14788 14789 if ( this._hasMultipleValues() ) { 14790 this.values( index, newVal ); 14791 } else { 14792 this.value( newVal ); 14793 } 14794 }, 14795 14796 _stop: function( event, index ) { 14797 this._trigger( "stop", event, this._uiHash( index ) ); 14798 }, 14799 14800 _change: function( event, index ) { 14801 if ( !this._keySliding && !this._mouseSliding ) { 14802 14803 //store the last changed value index for reference when handles overlap 14804 this._lastChangedValue = index; 14805 this._trigger( "change", event, this._uiHash( index ) ); 14806 } 14807 }, 14808 14809 value: function( newValue ) { 14810 if ( arguments.length ) { 14811 this.options.value = this._trimAlignValue( newValue ); 14812 this._refreshValue(); 14813 this._change( null, 0 ); 14814 return; 14815 } 14816 14817 return this._value(); 14818 }, 14819 14820 values: function( index, newValue ) { 14821 var vals, 14822 newValues, 14823 i; 14824 14825 if ( arguments.length > 1 ) { 14826 this.options.values[ index ] = this._trimAlignValue( newValue ); 14827 this._refreshValue(); 14828 this._change( null, index ); 14829 return; 14830 } 14831 14832 if ( arguments.length ) { 14833 if ( $.isArray( arguments[ 0 ] ) ) { 14834 vals = this.options.values; 14835 newValues = arguments[ 0 ]; 14836 for ( i = 0; i < vals.length; i += 1 ) { 14837 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 14838 this._change( null, i ); 14839 } 14840 this._refreshValue(); 14841 } else { 14842 if ( this._hasMultipleValues() ) { 14843 return this._values( index ); 14844 } else { 14845 return this.value(); 14846 } 14847 } 14848 } else { 14849 return this._values(); 14850 } 14851 }, 14852 14853 _setOption: function( key, value ) { 14854 var i, 14855 valsLength = 0; 14856 14857 if ( key === "range" && this.options.range === true ) { 14858 if ( value === "min" ) { 14859 this.options.value = this._values( 0 ); 14860 this.options.values = null; 14861 } else if ( value === "max" ) { 14862 this.options.value = this._values( this.options.values.length - 1 ); 14863 this.options.values = null; 14864 } 14865 } 14866 14867 if ( $.isArray( this.options.values ) ) { 14868 valsLength = this.options.values.length; 14869 } 14870 14871 this._super( key, value ); 14872 14873 switch ( key ) { 14874 case "orientation": 14875 this._detectOrientation(); 14876 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 14877 ._addClass( "ui-slider-" + this.orientation ); 14878 this._refreshValue(); 14879 if ( this.options.range ) { 14880 this._refreshRange( value ); 14881 } 14882 14883 // Reset positioning from previous orientation 14884 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 14885 break; 14886 case "value": 14887 this._animateOff = true; 14888 this._refreshValue(); 14889 this._change( null, 0 ); 14890 this._animateOff = false; 14891 break; 14892 case "values": 14893 this._animateOff = true; 14894 this._refreshValue(); 14895 14896 // Start from the last handle to prevent unreachable handles (#9046) 14897 for ( i = valsLength - 1; i >= 0; i-- ) { 14898 this._change( null, i ); 14899 } 14900 this._animateOff = false; 14901 break; 14902 case "step": 14903 case "min": 14904 case "max": 14905 this._animateOff = true; 14906 this._calculateNewMax(); 14907 this._refreshValue(); 14908 this._animateOff = false; 14909 break; 14910 case "range": 14911 this._animateOff = true; 14912 this._refresh(); 14913 this._animateOff = false; 14914 break; 14915 } 14916 }, 14917 14918 _setOptionDisabled: function( value ) { 14919 this._super( value ); 14920 14921 this._toggleClass( null, "ui-state-disabled", !!value ); 14922 }, 14923 14924 //internal value getter 14925 // _value() returns value trimmed by min and max, aligned by step 14926 _value: function() { 14927 var val = this.options.value; 14928 val = this._trimAlignValue( val ); 14929 14930 return val; 14931 }, 14932 14933 //internal values getter 14934 // _values() returns array of values trimmed by min and max, aligned by step 14935 // _values( index ) returns single value trimmed by min and max, aligned by step 14936 _values: function( index ) { 14937 var val, 14938 vals, 14939 i; 14940 14941 if ( arguments.length ) { 14942 val = this.options.values[ index ]; 14943 val = this._trimAlignValue( val ); 14944 14945 return val; 14946 } else if ( this._hasMultipleValues() ) { 14947 14948 // .slice() creates a copy of the array 14949 // this copy gets trimmed by min and max and then returned 14950 vals = this.options.values.slice(); 14951 for ( i = 0; i < vals.length; i += 1 ) { 14952 vals[ i ] = this._trimAlignValue( vals[ i ] ); 14953 } 14954 14955 return vals; 14956 } else { 14957 return []; 14958 } 14959 }, 14960 14961 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 14962 _trimAlignValue: function( val ) { 14963 if ( val <= this._valueMin() ) { 14964 return this._valueMin(); 14965 } 14966 if ( val >= this._valueMax() ) { 14967 return this._valueMax(); 14968 } 14969 var step = ( this.options.step > 0 ) ? this.options.step : 1, 14970 valModStep = ( val - this._valueMin() ) % step, 14971 alignValue = val - valModStep; 14972 14973 if ( Math.abs( valModStep ) * 2 >= step ) { 14974 alignValue += ( valModStep > 0 ) ? step : ( -step ); 14975 } 14976 14977 // Since JavaScript has problems with large floats, round 14978 // the final value to 5 digits after the decimal point (see #4124) 14979 return parseFloat( alignValue.toFixed( 5 ) ); 14980 }, 14981 14982 _calculateNewMax: function() { 14983 var max = this.options.max, 14984 min = this._valueMin(), 14985 step = this.options.step, 14986 aboveMin = Math.round( ( max - min ) / step ) * step; 14987 max = aboveMin + min; 14988 if ( max > this.options.max ) { 14989 14990 //If max is not divisible by step, rounding off may increase its value 14991 max -= step; 14992 } 14993 this.max = parseFloat( max.toFixed( this._precision() ) ); 14994 }, 14995 14996 _precision: function() { 14997 var precision = this._precisionOf( this.options.step ); 14998 if ( this.options.min !== null ) { 14999 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 15000 } 15001 return precision; 15002 }, 15003 15004 _precisionOf: function( num ) { 15005 var str = num.toString(), 15006 decimal = str.indexOf( "." ); 15007 return decimal === -1 ? 0 : str.length - decimal - 1; 15008 }, 15009 15010 _valueMin: function() { 15011 return this.options.min; 15012 }, 15013 15014 _valueMax: function() { 15015 return this.max; 15016 }, 15017 15018 _refreshRange: function( orientation ) { 15019 if ( orientation === "vertical" ) { 15020 this.range.css( { "width": "", "left": "" } ); 15021 } 15022 if ( orientation === "horizontal" ) { 15023 this.range.css( { "height": "", "bottom": "" } ); 15024 } 15025 }, 15026 15027 _refreshValue: function() { 15028 var lastValPercent, valPercent, value, valueMin, valueMax, 15029 oRange = this.options.range, 15030 o = this.options, 15031 that = this, 15032 animate = ( !this._animateOff ) ? o.animate : false, 15033 _set = {}; 15034 15035 if ( this._hasMultipleValues() ) { 15036 this.handles.each( function( i ) { 15037 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 15038 that._valueMin() ) * 100; 15039 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15040 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15041 if ( that.options.range === true ) { 15042 if ( that.orientation === "horizontal" ) { 15043 if ( i === 0 ) { 15044 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15045 left: valPercent + "%" 15046 }, o.animate ); 15047 } 15048 if ( i === 1 ) { 15049 that.range[ animate ? "animate" : "css" ]( { 15050 width: ( valPercent - lastValPercent ) + "%" 15051 }, { 15052 queue: false, 15053 duration: o.animate 15054 } ); 15055 } 15056 } else { 15057 if ( i === 0 ) { 15058 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15059 bottom: ( valPercent ) + "%" 15060 }, o.animate ); 15061 } 15062 if ( i === 1 ) { 15063 that.range[ animate ? "animate" : "css" ]( { 15064 height: ( valPercent - lastValPercent ) + "%" 15065 }, { 15066 queue: false, 15067 duration: o.animate 15068 } ); 15069 } 15070 } 15071 } 15072 lastValPercent = valPercent; 15073 } ); 15074 } else { 15075 value = this.value(); 15076 valueMin = this._valueMin(); 15077 valueMax = this._valueMax(); 15078 valPercent = ( valueMax !== valueMin ) ? 15079 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 15080 0; 15081 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15082 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15083 15084 if ( oRange === "min" && this.orientation === "horizontal" ) { 15085 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15086 width: valPercent + "%" 15087 }, o.animate ); 15088 } 15089 if ( oRange === "max" && this.orientation === "horizontal" ) { 15090 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15091 width: ( 100 - valPercent ) + "%" 15092 }, o.animate ); 15093 } 15094 if ( oRange === "min" && this.orientation === "vertical" ) { 15095 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15096 height: valPercent + "%" 15097 }, o.animate ); 15098 } 15099 if ( oRange === "max" && this.orientation === "vertical" ) { 15100 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15101 height: ( 100 - valPercent ) + "%" 15102 }, o.animate ); 15103 } 15104 } 15105 }, 15106 15107 _handleEvents: { 15108 keydown: function( event ) { 15109 var allowed, curVal, newVal, step, 15110 index = $( event.target ).data( "ui-slider-handle-index" ); 15111 15112 switch ( event.keyCode ) { 15113 case $.ui.keyCode.HOME: 15114 case $.ui.keyCode.END: 15115 case $.ui.keyCode.PAGE_UP: 15116 case $.ui.keyCode.PAGE_DOWN: 15117 case $.ui.keyCode.UP: 15118 case $.ui.keyCode.RIGHT: 15119 case $.ui.keyCode.DOWN: 15120 case $.ui.keyCode.LEFT: 15121 event.preventDefault(); 15122 if ( !this._keySliding ) { 15123 this._keySliding = true; 15124 this._addClass( $( event.target ), null, "ui-state-active" ); 15125 allowed = this._start( event, index ); 15126 if ( allowed === false ) { 15127 return; 15128 } 15129 } 15130 break; 15131 } 15132 15133 step = this.options.step; 15134 if ( this._hasMultipleValues() ) { 15135 curVal = newVal = this.values( index ); 15136 } else { 15137 curVal = newVal = this.value(); 15138 } 15139 15140 switch ( event.keyCode ) { 15141 case $.ui.keyCode.HOME: 15142 newVal = this._valueMin(); 15143 break; 15144 case $.ui.keyCode.END: 15145 newVal = this._valueMax(); 15146 break; 15147 case $.ui.keyCode.PAGE_UP: 15148 newVal = this._trimAlignValue( 15149 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 15150 ); 15151 break; 15152 case $.ui.keyCode.PAGE_DOWN: 15153 newVal = this._trimAlignValue( 15154 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 15155 break; 15156 case $.ui.keyCode.UP: 15157 case $.ui.keyCode.RIGHT: 15158 if ( curVal === this._valueMax() ) { 15159 return; 15160 } 15161 newVal = this._trimAlignValue( curVal + step ); 15162 break; 15163 case $.ui.keyCode.DOWN: 15164 case $.ui.keyCode.LEFT: 15165 if ( curVal === this._valueMin() ) { 15166 return; 15167 } 15168 newVal = this._trimAlignValue( curVal - step ); 15169 break; 15170 } 15171 15172 this._slide( event, index, newVal ); 15173 }, 15174 keyup: function( event ) { 15175 var index = $( event.target ).data( "ui-slider-handle-index" ); 15176 15177 if ( this._keySliding ) { 15178 this._keySliding = false; 15179 this._stop( event, index ); 15180 this._change( event, index ); 15181 this._removeClass( $( event.target ), null, "ui-state-active" ); 15182 } 15183 } 15184 } 15185} ); 15186 15187 15188/*! 15189 * jQuery UI Sortable 1.12.0 15190 * http://jqueryui.com
vendor: 6,330 bytes, lines 15191-15438
15191 * 15192 * Copyright jQuery Foundation and other contributors 15193 * Released under the MIT license. 15194 * http://jquery.org/license 15195 */ 15196 15197//>>label: Sortable 15198//>>group: Interactions 15199//>>description: Enables items in a list to be sorted using the mouse. 15200//>>docs: http://api.jqueryui.com/sortable/ 15201//>>demos: http://jqueryui.com/sortable/ 15202//>>css.structure: ../../themes/base/sortable.css 15203 15204 15205 15206var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { 15207 version: "1.12.0", 15208 widgetEventPrefix: "sort", 15209 ready: false, 15210 options: { 15211 appendTo: "parent", 15212 axis: false, 15213 connectWith: false, 15214 containment: false, 15215 cursor: "auto", 15216 cursorAt: false, 15217 dropOnEmpty: true, 15218 forcePlaceholderSize: false, 15219 forceHelperSize: false, 15220 grid: false, 15221 handle: false, 15222 helper: "original", 15223 items: "> *", 15224 opacity: false, 15225 placeholder: false, 15226 revert: false, 15227 scroll: true, 15228 scrollSensitivity: 20, 15229 scrollSpeed: 20, 15230 scope: "default", 15231 tolerance: "intersect", 15232 zIndex: 1000, 15233 15234 // Callbacks 15235 activate: null, 15236 beforeStop: null, 15237 change: null, 15238 deactivate: null, 15239 out: null, 15240 over: null, 15241 receive: null, 15242 remove: null, 15243 sort: null, 15244 start: null, 15245 stop: null, 15246 update: null 15247 }, 15248 15249 _isOverAxis: function( x, reference, size ) { 15250 return ( x >= reference ) && ( x < ( reference + size ) ); 15251 }, 15252 15253 _isFloating: function( item ) { 15254 return ( /left|right/ ).test( item.css( "float" ) ) || 15255 ( /inline|table-cell/ ).test( item.css( "display" ) ); 15256 }, 15257 15258 _create: function() { 15259 this.containerCache = {}; 15260 this._addClass( "ui-sortable" ); 15261 15262 //Get the items 15263 this.refresh(); 15264 15265 //Let's determine the parent's offset 15266 this.offset = this.element.offset(); 15267 15268 //Initialize mouse events for interaction 15269 this._mouseInit(); 15270 15271 this._setHandleClassName(); 15272 15273 //We're ready to go 15274 this.ready = true; 15275 15276 }, 15277 15278 _setOption: function( key, value ) { 15279 this._super( key, value ); 15280 15281 if ( key === "handle" ) { 15282 this._setHandleClassName(); 15283 } 15284 }, 15285 15286 _setHandleClassName: function() { 15287 var that = this; 15288 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 15289 $.each( this.items, function() { 15290 that._addClass( 15291 this.instance.options.handle ? 15292 this.item.find( this.instance.options.handle ) : 15293 this.item, 15294 "ui-sortable-handle" 15295 ); 15296 } ); 15297 }, 15298 15299 _destroy: function() { 15300 this._mouseDestroy(); 15301 15302 for ( var i = this.items.length - 1; i >= 0; i-- ) { 15303 this.items[ i ].item.removeData( this.widgetName + "-item" ); 15304 } 15305 15306 return this; 15307 }, 15308 15309 _mouseCapture: function( event, overrideHandle ) { 15310 var currentItem = null, 15311 validHandle = false, 15312 that = this; 15313 15314 if ( this.reverting ) { 15315 return false; 15316 } 15317 15318 if ( this.options.disabled || this.options.type === "static" ) { 15319 return false; 15320 } 15321 15322 //We have to refresh the items data once first 15323 this._refreshItems( event ); 15324 15325 //Find out if the clicked node (or one of its parents) is a actual item in this.items 15326 $( event.target ).parents().each( function() { 15327 if ( $.data( this, that.widgetName + "-item" ) === that ) { 15328 currentItem = $( this ); 15329 return false; 15330 } 15331 } ); 15332 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 15333 currentItem = $( event.target ); 15334 } 15335 15336 if ( !currentItem ) { 15337 return false; 15338 } 15339 if ( this.options.handle && !overrideHandle ) { 15340 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 15341 if ( this === event.target ) { 15342 validHandle = true; 15343 } 15344 } ); 15345 if ( !validHandle ) { 15346 return false; 15347 } 15348 } 15349 15350 this.currentItem = currentItem; 15351 this._removeCurrentsFromItems(); 15352 return true; 15353 15354 }, 15355 15356 _mouseStart: function( event, overrideHandle, noActivation ) { 15357 15358 var i, body, 15359 o = this.options; 15360 15361 this.currentContainer = this; 15362 15363 //We only need to call refreshPositions, because the refreshItems call has been moved to 15364 // mouseCapture 15365 this.refreshPositions(); 15366 15367 //Create and append the visible helper 15368 this.helper = this._createHelper( event ); 15369 15370 //Cache the helper size 15371 this._cacheHelperProportions(); 15372 15373 /* 15374 * - Position generation - 15375 * This block generates everything position related - it's the core of draggables. 15376 */ 15377 15378 //Cache the margins of the original element 15379 this._cacheMargins(); 15380 15381 //Get the next scrolling parent 15382 this.scrollParent = this.helper.scrollParent(); 15383 15384 //The element's absolute position on the page minus margins 15385 this.offset = this.currentItem.offset(); 15386 this.offset = { 15387 top: this.offset.top - this.margins.top, 15388 left: this.offset.left - this.margins.left 15389 }; 15390 15391 $.extend( this.offset, { 15392 click: { //Where the click happened, relative to the element 15393 left: event.pageX - this.offset.left, 15394 top: event.pageY - this.offset.top 15395 }, 15396 parent: this._getParentOffset(), 15397 15398 // This is a relative to absolute position minus the actual position calculation - 15399 // only used for relative positioned helper 15400 relative: this._getRelativeOffset() 15401 } ); 15402 15403 // Only after we got the offset, we can change the helper's position to absolute 15404 // TODO: Still need to figure out a way to make relative sorting possible 15405 this.helper.css( "position", "absolute" ); 15406 this.cssPosition = this.helper.css( "position" ); 15407 15408 //Generate the original position 15409 this.originalPosition = this._generatePosition( event ); 15410 this.originalPageX = event.pageX; 15411 this.originalPageY = event.pageY; 15412 15413 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 15414 ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); 15415 15416 //Cache the former DOM position 15417 this.domPosition = { 15418 prev: this.currentItem.prev()[ 0 ], 15419 parent: this.currentItem.parent()[ 0 ] 15420 }; 15421 15422 // If the helper is not the original, hide the original so it's not playing any role during 15423 // the drag, won't cause anything bad this way 15424 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 15425 this.currentItem.hide(); 15426 } 15427 15428 //Create the placeholder 15429 this._createPlaceholder(); 15430 15431 //Set a containment if given in the options 15432 if ( o.containment ) { 15433 this._setContainment(); 15434 } 15435 15436 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 15437 body = this.document.find( "body" ); 15438
vendor: 9,591 bytes, lines 15439-15771
15439 // Support: IE 15440 this.storedCursor = body.css( "cursor" ); 15441 body.css( "cursor", o.cursor ); 15442 15443 this.storedStylesheet = 15444 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 15445 } 15446 15447 if ( o.opacity ) { // opacity option 15448 if ( this.helper.css( "opacity" ) ) { 15449 this._storedOpacity = this.helper.css( "opacity" ); 15450 } 15451 this.helper.css( "opacity", o.opacity ); 15452 } 15453 15454 if ( o.zIndex ) { // zIndex option 15455 if ( this.helper.css( "zIndex" ) ) { 15456 this._storedZIndex = this.helper.css( "zIndex" ); 15457 } 15458 this.helper.css( "zIndex", o.zIndex ); 15459 } 15460 15461 //Prepare scrolling 15462 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 15463 this.scrollParent[ 0 ].tagName !== "HTML" ) { 15464 this.overflowOffset = this.scrollParent.offset(); 15465 } 15466 15467 //Call callbacks 15468 this._trigger( "start", event, this._uiHash() ); 15469 15470 //Recache the helper size 15471 if ( !this._preserveHelperProportions ) { 15472 this._cacheHelperProportions(); 15473 } 15474 15475 //Post "activate" events to possible containers 15476 if ( !noActivation ) { 15477 for ( i = this.containers.length - 1; i >= 0; i-- ) { 15478 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 15479 } 15480 } 15481 15482 //Prepare possible droppables 15483 if ( $.ui.ddmanager ) { 15484 $.ui.ddmanager.current = this; 15485 } 15486 15487 if ( $.ui.ddmanager && !o.dropBehaviour ) { 15488 $.ui.ddmanager.prepareOffsets( this, event ); 15489 } 15490 15491 this.dragging = true; 15492 15493 this._addClass( this.helper, "ui-sortable-helper" ); 15494 15495 // Execute the drag once - this causes the helper not to be visiblebefore getting its 15496 // correct position 15497 this._mouseDrag( event ); 15498 return true; 15499 15500 }, 15501 15502 _mouseDrag: function( event ) { 15503 var i, item, itemElement, intersection, 15504 o = this.options, 15505 scrolled = false; 15506 15507 //Compute the helpers position 15508 this.position = this._generatePosition( event ); 15509 this.positionAbs = this._convertPositionTo( "absolute" ); 15510 15511 if ( !this.lastPositionAbs ) { 15512 this.lastPositionAbs = this.positionAbs; 15513 } 15514 15515 //Do scrolling 15516 if ( this.options.scroll ) { 15517 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 15518 this.scrollParent[ 0 ].tagName !== "HTML" ) { 15519 15520 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 15521 event.pageY < o.scrollSensitivity ) { 15522 this.scrollParent[ 0 ].scrollTop = 15523 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 15524 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 15525 this.scrollParent[ 0 ].scrollTop = 15526 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 15527 } 15528 15529 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 15530 event.pageX < o.scrollSensitivity ) { 15531 this.scrollParent[ 0 ].scrollLeft = scrolled = 15532 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 15533 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 15534 this.scrollParent[ 0 ].scrollLeft = scrolled = 15535 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 15536 } 15537 15538 } else { 15539 15540 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 15541 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 15542 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 15543 o.scrollSensitivity ) { 15544 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 15545 } 15546 15547 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 15548 scrolled = this.document.scrollLeft( 15549 this.document.scrollLeft() - o.scrollSpeed 15550 ); 15551 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 15552 o.scrollSensitivity ) { 15553 scrolled = this.document.scrollLeft( 15554 this.document.scrollLeft() + o.scrollSpeed 15555 ); 15556 } 15557 15558 } 15559 15560 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 15561 $.ui.ddmanager.prepareOffsets( this, event ); 15562 } 15563 } 15564 15565 //Regenerate the absolute position used for position checks 15566 this.positionAbs = this._convertPositionTo( "absolute" ); 15567 15568 //Set the helper position 15569 if ( !this.options.axis || this.options.axis !== "y" ) { 15570 this.helper[ 0 ].style.left = this.position.left + "px"; 15571 } 15572 if ( !this.options.axis || this.options.axis !== "x" ) { 15573 this.helper[ 0 ].style.top = this.position.top + "px"; 15574 } 15575 15576 //Rearrange 15577 for ( i = this.items.length - 1; i >= 0; i-- ) { 15578 15579 //Cache variables and intersection, continue if no intersection 15580 item = this.items[ i ]; 15581 itemElement = item.item[ 0 ]; 15582 intersection = this._intersectsWithPointer( item ); 15583 if ( !intersection ) { 15584 continue; 15585 } 15586 15587 // Only put the placeholder inside the current Container, skip all 15588 // items from other containers. This works because when moving 15589 // an item from one container to another the 15590 // currentContainer is switched before the placeholder is moved. 15591 // 15592 // Without this, moving items in "sub-sortables" can cause 15593 // the placeholder to jitter between the outer and inner container. 15594 if ( item.instance !== this.currentContainer ) { 15595 continue; 15596 } 15597 15598 // Cannot intersect with itself 15599 // no useless actions that have been done before 15600 // no action if the item moved is the parent of the item checked 15601 if ( itemElement !== this.currentItem[ 0 ] && 15602 this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement && 15603 !$.contains( this.placeholder[ 0 ], itemElement ) && 15604 ( this.options.type === "semi-dynamic" ? 15605 !$.contains( this.element[ 0 ], itemElement ) : 15606 true 15607 ) 15608 ) { 15609 15610 this.direction = intersection === 1 ? "down" : "up"; 15611 15612 if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) { 15613 this._rearrange( event, item ); 15614 } else { 15615 break; 15616 } 15617 15618 this._trigger( "change", event, this._uiHash() ); 15619 break; 15620 } 15621 } 15622 15623 //Post events to containers 15624 this._contactContainers( event ); 15625 15626 //Interconnect with droppables 15627 if ( $.ui.ddmanager ) { 15628 $.ui.ddmanager.drag( this, event ); 15629 } 15630 15631 //Call callbacks 15632 this._trigger( "sort", event, this._uiHash() ); 15633 15634 this.lastPositionAbs = this.positionAbs; 15635 return false; 15636 15637 }, 15638 15639 _mouseStop: function( event, noPropagation ) { 15640 15641 if ( !event ) { 15642 return; 15643 } 15644 15645 //If we are using droppables, inform the manager about the drop 15646 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 15647 $.ui.ddmanager.drop( this, event ); 15648 } 15649 15650 if ( this.options.revert ) { 15651 var that = this, 15652 cur = this.placeholder.offset(), 15653 axis = this.options.axis, 15654 animation = {}; 15655 15656 if ( !axis || axis === "x" ) { 15657 animation.left = cur.left - this.offset.parent.left - this.margins.left + 15658 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 15659 0 : 15660 this.offsetParent[ 0 ].scrollLeft 15661 ); 15662 } 15663 if ( !axis || axis === "y" ) { 15664 animation.top = cur.top - this.offset.parent.top - this.margins.top + 15665 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 15666 0 : 15667 this.offsetParent[ 0 ].scrollTop 15668 ); 15669 } 15670 this.reverting = true; 15671 $( this.helper ).animate( 15672 animation, 15673 parseInt( this.options.revert, 10 ) || 500, 15674 function() { 15675 that._clear( event ); 15676 } 15677 ); 15678 } else { 15679 this._clear( event, noPropagation ); 15680 } 15681 15682 return false; 15683 15684 }, 15685 15686 cancel: function() { 15687 15688 if ( this.dragging ) { 15689 15690 this._mouseUp( { target: null } ); 15691 15692 if ( this.options.helper === "original" ) { 15693 this.currentItem.css( this._storedCSS ); 15694 this._removeClass( this.currentItem, "ui-sortable-helper" ); 15695 } else { 15696 this.currentItem.show(); 15697 } 15698 15699 //Post deactivating events to containers 15700 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 15701 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 15702 if ( this.containers[ i ].containerCache.over ) { 15703 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 15704 this.containers[ i ].containerCache.over = 0; 15705 } 15706 } 15707 15708 } 15709 15710 if ( this.placeholder ) { 15711 15712 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 15713 // it unbinds ALL events from the original node! 15714 if ( this.placeholder[ 0 ].parentNode ) { 15715 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 15716 } 15717 if ( this.options.helper !== "original" && this.helper && 15718 this.helper[ 0 ].parentNode ) { 15719 this.helper.remove(); 15720 } 15721 15722 $.extend( this, { 15723 helper: null, 15724 dragging: false, 15725 reverting: false, 15726 _noFinalSort: null 15727 } ); 15728 15729 if ( this.domPosition.prev ) { 15730 $( this.domPosition.prev ).after( this.currentItem ); 15731 } else { 15732 $( this.domPosition.parent ).prepend( this.currentItem ); 15733 } 15734 } 15735 15736 return this; 15737 15738 }, 15739 15740 serialize: function( o ) { 15741 15742 var items = this._getItemsAsjQuery( o && o.connected ), 15743 str = []; 15744 o = o || {}; 15745 15746 $( items ).each( function() { 15747 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 15748 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 15749 if ( res ) { 15750 str.push( 15751 ( o.key || res[ 1 ] + "[]" ) + 15752 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 15753 } 15754 } ); 15755 15756 if ( !str.length && o.key ) { 15757 str.push( o.key + "=" ); 15758 } 15759 15760 return str.join( "&" ); 15761 15762 }, 15763 15764 toArray: function( o ) { 15765 15766 var items = this._getItemsAsjQuery( o && o.connected ), 15767 ret = []; 15768 15769 o = o || {}; 15770 15771 items.each( function() {
vendor: 19,871 bytes, lines 15772-16378
15772 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 15773 } ); 15774 return ret; 15775 15776 }, 15777 15778 /* Be careful with the following core functions */ 15779 _intersectsWith: function( item ) { 15780 15781 var x1 = this.positionAbs.left, 15782 x2 = x1 + this.helperProportions.width, 15783 y1 = this.positionAbs.top, 15784 y2 = y1 + this.helperProportions.height, 15785 l = item.left, 15786 r = l + item.width, 15787 t = item.top, 15788 b = t + item.height, 15789 dyClick = this.offset.click.top, 15790 dxClick = this.offset.click.left, 15791 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 15792 ( y1 + dyClick ) < b ), 15793 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 15794 ( x1 + dxClick ) < r ), 15795 isOverElement = isOverElementHeight && isOverElementWidth; 15796 15797 if ( this.options.tolerance === "pointer" || 15798 this.options.forcePointerForContainers || 15799 ( this.options.tolerance !== "pointer" && 15800 this.helperProportions[ this.floating ? "width" : "height" ] > 15801 item[ this.floating ? "width" : "height" ] ) 15802 ) { 15803 return isOverElement; 15804 } else { 15805 15806 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 15807 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 15808 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 15809 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 15810 15811 } 15812 }, 15813 15814 _intersectsWithPointer: function( item ) { 15815 var verticalDirection, horizontalDirection, 15816 isOverElementHeight = ( this.options.axis === "x" ) || 15817 this._isOverAxis( 15818 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 15819 isOverElementWidth = ( this.options.axis === "y" ) || 15820 this._isOverAxis( 15821 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 15822 isOverElement = isOverElementHeight && isOverElementWidth; 15823 15824 if ( !isOverElement ) { 15825 return false; 15826 } 15827 15828 verticalDirection = this._getDragVerticalDirection(); 15829 horizontalDirection = this._getDragHorizontalDirection(); 15830 15831 return this.floating ? 15832 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) 15833 : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 15834 15835 }, 15836 15837 _intersectsWithSides: function( item ) { 15838 15839 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 15840 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 15841 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 15842 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 15843 verticalDirection = this._getDragVerticalDirection(), 15844 horizontalDirection = this._getDragHorizontalDirection(); 15845 15846 if ( this.floating && horizontalDirection ) { 15847 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 15848 ( horizontalDirection === "left" && !isOverRightHalf ) ); 15849 } else { 15850 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 15851 ( verticalDirection === "up" && !isOverBottomHalf ) ); 15852 } 15853 15854 }, 15855 15856 _getDragVerticalDirection: function() { 15857 var delta = this.positionAbs.top - this.lastPositionAbs.top; 15858 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 15859 }, 15860 15861 _getDragHorizontalDirection: function() { 15862 var delta = this.positionAbs.left - this.lastPositionAbs.left; 15863 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 15864 }, 15865 15866 refresh: function( event ) { 15867 this._refreshItems( event ); 15868 this._setHandleClassName(); 15869 this.refreshPositions(); 15870 return this; 15871 }, 15872 15873 _connectWith: function() { 15874 var options = this.options; 15875 return options.connectWith.constructor === String ? 15876 [ options.connectWith ] : 15877 options.connectWith; 15878 }, 15879 15880 _getItemsAsjQuery: function( connected ) { 15881 15882 var i, j, cur, inst, 15883 items = [], 15884 queries = [], 15885 connectWith = this._connectWith(); 15886 15887 if ( connectWith && connected ) { 15888 for ( i = connectWith.length - 1; i >= 0; i-- ) { 15889 cur = $( connectWith[ i ], this.document[ 0 ] ); 15890 for ( j = cur.length - 1; j >= 0; j-- ) { 15891 inst = $.data( cur[ j ], this.widgetFullName ); 15892 if ( inst && inst !== this && !inst.options.disabled ) { 15893 queries.push( [ $.isFunction( inst.options.items ) ? 15894 inst.options.items.call( inst.element ) : 15895 $( inst.options.items, inst.element ) 15896 .not( ".ui-sortable-helper" ) 15897 .not( ".ui-sortable-placeholder" ), inst ] ); 15898 } 15899 } 15900 } 15901 } 15902 15903 queries.push( [ $.isFunction( this.options.items ) ? 15904 this.options.items 15905 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 15906 $( this.options.items, this.element ) 15907 .not( ".ui-sortable-helper" ) 15908 .not( ".ui-sortable-placeholder" ), this ] ); 15909 15910 function addItems() { 15911 items.push( this ); 15912 } 15913 for ( i = queries.length - 1; i >= 0; i-- ) { 15914 queries[ i ][ 0 ].each( addItems ); 15915 } 15916 15917 return $( items ); 15918 15919 }, 15920 15921 _removeCurrentsFromItems: function() { 15922 15923 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 15924 15925 this.items = $.grep( this.items, function( item ) { 15926 for ( var j = 0; j < list.length; j++ ) { 15927 if ( list[ j ] === item.item[ 0 ] ) { 15928 return false; 15929 } 15930 } 15931 return true; 15932 } ); 15933 15934 }, 15935 15936 _refreshItems: function( event ) { 15937 15938 this.items = []; 15939 this.containers = [ this ]; 15940 15941 var i, j, cur, inst, targetData, _queries, item, queriesLength, 15942 items = this.items, 15943 queries = [ [ $.isFunction( this.options.items ) ? 15944 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 15945 $( this.options.items, this.element ), this ] ], 15946 connectWith = this._connectWith(); 15947 15948 //Shouldn't be run the first time through due to massive slow-down 15949 if ( connectWith && this.ready ) { 15950 for ( i = connectWith.length - 1; i >= 0; i-- ) { 15951 cur = $( connectWith[ i ], this.document[ 0 ] ); 15952 for ( j = cur.length - 1; j >= 0; j-- ) { 15953 inst = $.data( cur[ j ], this.widgetFullName ); 15954 if ( inst && inst !== this && !inst.options.disabled ) { 15955 queries.push( [ $.isFunction( inst.options.items ) ? 15956 inst.options.items 15957 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 15958 $( inst.options.items, inst.element ), inst ] ); 15959 this.containers.push( inst ); 15960 } 15961 } 15962 } 15963 } 15964 15965 for ( i = queries.length - 1; i >= 0; i-- ) { 15966 targetData = queries[ i ][ 1 ]; 15967 _queries = queries[ i ][ 0 ]; 15968 15969 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 15970 item = $( _queries[ j ] ); 15971 15972 // Data for target checking (mouse manager) 15973 item.data( this.widgetName + "-item", targetData ); 15974 15975 items.push( { 15976 item: item, 15977 instance: targetData, 15978 width: 0, height: 0, 15979 left: 0, top: 0 15980 } ); 15981 } 15982 } 15983 15984 }, 15985 15986 refreshPositions: function( fast ) { 15987 15988 // Determine whether items are being displayed horizontally 15989 this.floating = this.items.length ? 15990 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 15991 false; 15992 15993 //This has to be redone because due to the item being moved out/into the offsetParent, 15994 // the offsetParent's position will change 15995 if ( this.offsetParent && this.helper ) { 15996 this.offset.parent = this._getParentOffset(); 15997 } 15998 15999 var i, item, t, p; 16000 16001 for ( i = this.items.length - 1; i >= 0; i-- ) { 16002 item = this.items[ i ]; 16003 16004 //We ignore calculating positions of all connected containers when we're not over them 16005 if ( item.instance !== this.currentContainer && this.currentContainer && 16006 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 16007 continue; 16008 } 16009 16010 t = this.options.toleranceElement ? 16011 $( this.options.toleranceElement, item.item ) : 16012 item.item; 16013 16014 if ( !fast ) { 16015 item.width = t.outerWidth(); 16016 item.height = t.outerHeight(); 16017 } 16018 16019 p = t.offset(); 16020 item.left = p.left; 16021 item.top = p.top; 16022 } 16023 16024 if ( this.options.custom && this.options.custom.refreshContainers ) { 16025 this.options.custom.refreshContainers.call( this ); 16026 } else { 16027 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16028 p = this.containers[ i ].element.offset(); 16029 this.containers[ i ].containerCache.left = p.left; 16030 this.containers[ i ].containerCache.top = p.top; 16031 this.containers[ i ].containerCache.width = 16032 this.containers[ i ].element.outerWidth(); 16033 this.containers[ i ].containerCache.height = 16034 this.containers[ i ].element.outerHeight(); 16035 } 16036 } 16037 16038 return this; 16039 }, 16040 16041 _createPlaceholder: function( that ) { 16042 that = that || this; 16043 var className, 16044 o = that.options; 16045 16046 if ( !o.placeholder || o.placeholder.constructor === String ) { 16047 className = o.placeholder; 16048 o.placeholder = { 16049 element: function() { 16050 16051 var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(), 16052 element = $( "<" + nodeName + ">", that.document[ 0 ] ); 16053 16054 that._addClass( element, "ui-sortable-placeholder", 16055 className || that.currentItem[ 0 ].className ) 16056 ._removeClass( element, "ui-sortable-helper" ); 16057 16058 if ( nodeName === "tbody" ) { 16059 that._createTrPlaceholder( 16060 that.currentItem.find( "tr" ).eq( 0 ), 16061 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 16062 ); 16063 } else if ( nodeName === "tr" ) { 16064 that._createTrPlaceholder( that.currentItem, element ); 16065 } else if ( nodeName === "img" ) { 16066 element.attr( "src", that.currentItem.attr( "src" ) ); 16067 } 16068 16069 if ( !className ) { 16070 element.css( "visibility", "hidden" ); 16071 } 16072 16073 return element; 16074 }, 16075 update: function( container, p ) { 16076 16077 // 1. If a className is set as 'placeholder option, we don't force sizes - 16078 // the class is responsible for that 16079 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 16080 // class name is specified 16081 if ( className && !o.forcePlaceholderSize ) { 16082 return; 16083 } 16084 16085 //If the element doesn't have a actual height by itself (without styles coming 16086 // from a stylesheet), it receives the inline height from the dragged item 16087 if ( !p.height() ) { 16088 p.height( 16089 that.currentItem.innerHeight() - 16090 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 16091 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 16092 } 16093 if ( !p.width() ) { 16094 p.width( 16095 that.currentItem.innerWidth() - 16096 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 16097 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 16098 } 16099 } 16100 }; 16101 } 16102 16103 //Create the placeholder 16104 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 16105 16106 //Append it after the actual current item 16107 that.currentItem.after( that.placeholder ); 16108 16109 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 16110 o.placeholder.update( that, that.placeholder ); 16111 16112 }, 16113 16114 _createTrPlaceholder: function( sourceTr, targetTr ) { 16115 var that = this; 16116 16117 sourceTr.children().each( function() { 16118 $( "<td> </td>", that.document[ 0 ] ) 16119 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 16120 .appendTo( targetTr ); 16121 } ); 16122 }, 16123 16124 _contactContainers: function( event ) { 16125 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 16126 floating, axis, 16127 innermostContainer = null, 16128 innermostIndex = null; 16129 16130 // Get innermost container that intersects with item 16131 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16132 16133 // Never consider a container that's located within the item itself 16134 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 16135 continue; 16136 } 16137 16138 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 16139 16140 // If we've already found a container and it's more "inner" than this, then continue 16141 if ( innermostContainer && 16142 $.contains( 16143 this.containers[ i ].element[ 0 ], 16144 innermostContainer.element[ 0 ] ) ) { 16145 continue; 16146 } 16147 16148 innermostContainer = this.containers[ i ]; 16149 innermostIndex = i; 16150 16151 } else { 16152 16153 // container doesn't intersect. trigger "out" event if necessary 16154 if ( this.containers[ i ].containerCache.over ) { 16155 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 16156 this.containers[ i ].containerCache.over = 0; 16157 } 16158 } 16159 16160 } 16161 16162 // If no intersecting containers found, return 16163 if ( !innermostContainer ) { 16164 return; 16165 } 16166 16167 // Move the item into the container if it's not there already 16168 if ( this.containers.length === 1 ) { 16169 if ( !this.containers[ innermostIndex ].containerCache.over ) { 16170 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 16171 this.containers[ innermostIndex ].containerCache.over = 1; 16172 } 16173 } else { 16174 16175 // When entering a new container, we will find the item with the least distance and 16176 // append our item near it 16177 dist = 10000; 16178 itemWithLeastDistance = null; 16179 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 16180 posProperty = floating ? "left" : "top"; 16181 sizeProperty = floating ? "width" : "height"; 16182 axis = floating ? "pageX" : "pageY"; 16183 16184 for ( j = this.items.length - 1; j >= 0; j-- ) { 16185 if ( !$.contains( 16186 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 16187 ) { 16188 continue; 16189 } 16190 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 16191 continue; 16192 } 16193 16194 cur = this.items[ j ].item.offset()[ posProperty ]; 16195 nearBottom = false; 16196 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 16197 nearBottom = true; 16198 } 16199 16200 if ( Math.abs( event[ axis ] - cur ) < dist ) { 16201 dist = Math.abs( event[ axis ] - cur ); 16202 itemWithLeastDistance = this.items[ j ]; 16203 this.direction = nearBottom ? "up" : "down"; 16204 } 16205 } 16206 16207 //Check if dropOnEmpty is enabled 16208 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 16209 return; 16210 } 16211 16212 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 16213 if ( !this.currentContainer.containerCache.over ) { 16214 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 16215 this.currentContainer.containerCache.over = 1; 16216 } 16217 return; 16218 } 16219 16220 itemWithLeastDistance ? 16221 this._rearrange( event, itemWithLeastDistance, null, true ) : 16222 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 16223 this._trigger( "change", event, this._uiHash() ); 16224 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 16225 this.currentContainer = this.containers[ innermostIndex ]; 16226 16227 //Update the placeholder 16228 this.options.placeholder.update( this.currentContainer, this.placeholder ); 16229 16230 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 16231 this.containers[ innermostIndex ].containerCache.over = 1; 16232 } 16233 16234 }, 16235 16236 _createHelper: function( event ) { 16237 16238 var o = this.options, 16239 helper = $.isFunction( o.helper ) ? 16240 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 16241 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 16242 16243 //Add the helper to the DOM if that didn't happen already 16244 if ( !helper.parents( "body" ).length ) { 16245 $( o.appendTo !== "parent" ? 16246 o.appendTo : 16247 this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] ); 16248 } 16249 16250 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 16251 this._storedCSS = { 16252 width: this.currentItem[ 0 ].style.width, 16253 height: this.currentItem[ 0 ].style.height, 16254 position: this.currentItem.css( "position" ), 16255 top: this.currentItem.css( "top" ), 16256 left: this.currentItem.css( "left" ) 16257 }; 16258 } 16259 16260 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 16261 helper.width( this.currentItem.width() ); 16262 } 16263 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 16264 helper.height( this.currentItem.height() ); 16265 } 16266 16267 return helper; 16268 16269 }, 16270 16271 _adjustOffsetFromHelper: function( obj ) { 16272 if ( typeof obj === "string" ) { 16273 obj = obj.split( " " ); 16274 } 16275 if ( $.isArray( obj ) ) { 16276 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 16277 } 16278 if ( "left" in obj ) { 16279 this.offset.click.left = obj.left + this.margins.left; 16280 } 16281 if ( "right" in obj ) { 16282 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 16283 } 16284 if ( "top" in obj ) { 16285 this.offset.click.top = obj.top + this.margins.top; 16286 } 16287 if ( "bottom" in obj ) { 16288 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 16289 } 16290 }, 16291 16292 _getParentOffset: function() { 16293 16294 //Get the offsetParent and cache its position 16295 this.offsetParent = this.helper.offsetParent(); 16296 var po = this.offsetParent.offset(); 16297 16298 // This is a special case where we need to modify a offset calculated on start, since the 16299 // following happened: 16300 // 1. The position of the helper is absolute, so it's position is calculated based on the 16301 // next positioned parent 16302 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 16303 // the document, which means that the scroll is included in the initial calculation of the 16304 // offset of the parent, and never recalculated upon drag 16305 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 16306 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 16307 po.left += this.scrollParent.scrollLeft(); 16308 po.top += this.scrollParent.scrollTop(); 16309 } 16310 16311 // This needs to be actually done for all browsers, since pageX/pageY includes this 16312 // information with an ugly IE fix 16313 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body || 16314 ( this.offsetParent[ 0 ].tagName && 16315 this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) { 16316 po = { top: 0, left: 0 }; 16317 } 16318 16319 return { 16320 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 16321 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 16322 }; 16323 16324 }, 16325 16326 _getRelativeOffset: function() { 16327 16328 if ( this.cssPosition === "relative" ) { 16329 var p = this.currentItem.position(); 16330 return { 16331 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 16332 this.scrollParent.scrollTop(), 16333 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 16334 this.scrollParent.scrollLeft() 16335 }; 16336 } else { 16337 return { top: 0, left: 0 }; 16338 } 16339 16340 }, 16341 16342 _cacheMargins: function() { 16343 this.margins = { 16344 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 16345 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 16346 }; 16347 }, 16348 16349 _cacheHelperProportions: function() { 16350 this.helperProportions = { 16351 width: this.helper.outerWidth(), 16352 height: this.helper.outerHeight() 16353 }; 16354 }, 16355 16356 _setContainment: function() { 16357 16358 var ce, co, over, 16359 o = this.options; 16360 if ( o.containment === "parent" ) { 16361 o.containment = this.helper[ 0 ].parentNode; 16362 } 16363 if ( o.containment === "document" || o.containment === "window" ) { 16364 this.containment = [ 16365 0 - this.offset.relative.left - this.offset.parent.left, 16366 0 - this.offset.relative.top - this.offset.parent.top, 16367 o.containment === "document" ? 16368 this.document.width() : 16369 this.window.width() - this.helperProportions.width - this.margins.left, 16370 ( o.containment === "document" ? 16371 ( this.document.height() || document.body.parentNode.scrollHeight ) : 16372 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 16373 ) - this.helperProportions.height - this.margins.top 16374 ]; 16375 } 16376 16377 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 16378 ce = $( o.containment )[ 0 ];
vendor: 2,296 bytes, lines 16379-16440
16379 co = $( o.containment ).offset(); 16380 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 16381 16382 this.containment = [ 16383 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 16384 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 16385 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 16386 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 16387 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 16388 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 16389 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 16390 this.helperProportions.width - this.margins.left, 16391 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 16392 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 16393 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 16394 16395 this.helperProportions.height - this.margins.top 16396 ]; 16397 } 16398 16399 }, 16400 16401 _convertPositionTo: function( d, pos ) { 16402 16403 if ( !pos ) { 16404 pos = this.position; 16405 } 16406 var mod = d === "absolute" ? 1 : -1, 16407 scroll = this.cssPosition === "absolute" && 16408 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16409 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 16410 this.offsetParent : 16411 this.scrollParent, 16412 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 16413 16414 return { 16415 top: ( 16416 16417 // The absolute mouse position 16418 pos.top + 16419 16420 // Only for relative positioned nodes: Relative offset from element to offset parent 16421 this.offset.relative.top * mod + 16422 16423 // The offsetParent's offset without borders (offset + border) 16424 this.offset.parent.top * mod - 16425 ( ( this.cssPosition === "fixed" ? 16426 -this.scrollParent.scrollTop() : 16427 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 16428 ), 16429 left: ( 16430 16431 // The absolute mouse position 16432 pos.left + 16433 16434 // Only for relative positioned nodes: Relative offset from element to offset parent 16435 this.offset.relative.left * mod + 16436 16437 // The offsetParent's offset without borders (offset + border) 16438 this.offset.parent.left * mod - 16439 ( ( this.cssPosition === "fixed" ? 16440 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 9,150 bytes, lines 16441-16725
16441 scroll.scrollLeft() ) * mod ) 16442 ) 16443 }; 16444 16445 }, 16446 16447 _generatePosition: function( event ) { 16448 16449 var top, left, 16450 o = this.options, 16451 pageX = event.pageX, 16452 pageY = event.pageY, 16453 scroll = this.cssPosition === "absolute" && 16454 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16455 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 16456 this.offsetParent : 16457 this.scrollParent, 16458 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 16459 16460 // This is another very weird special case that only happens for relative elements: 16461 // 1. If the css position is relative 16462 // 2. and the scroll parent is the document or similar to the offset parent 16463 // we have to refresh the relative offset during the scroll so there are no jumps 16464 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16465 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 16466 this.offset.relative = this._getRelativeOffset(); 16467 } 16468 16469 /* 16470 * - Position constraining - 16471 * Constrain the position to a mix of grid, containment. 16472 */ 16473 16474 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 16475 16476 if ( this.containment ) { 16477 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 16478 pageX = this.containment[ 0 ] + this.offset.click.left; 16479 } 16480 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 16481 pageY = this.containment[ 1 ] + this.offset.click.top; 16482 } 16483 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 16484 pageX = this.containment[ 2 ] + this.offset.click.left; 16485 } 16486 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 16487 pageY = this.containment[ 3 ] + this.offset.click.top; 16488 } 16489 } 16490 16491 if ( o.grid ) { 16492 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 16493 o.grid[ 1 ] ) * o.grid[ 1 ]; 16494 pageY = this.containment ? 16495 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 16496 top - this.offset.click.top <= this.containment[ 3 ] ) ? 16497 top : 16498 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 16499 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 16500 top; 16501 16502 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 16503 o.grid[ 0 ] ) * o.grid[ 0 ]; 16504 pageX = this.containment ? 16505 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 16506 left - this.offset.click.left <= this.containment[ 2 ] ) ? 16507 left : 16508 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 16509 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 16510 left; 16511 } 16512 16513 } 16514 16515 return { 16516 top: ( 16517 16518 // The absolute mouse position 16519 pageY - 16520 16521 // Click offset (relative to the element) 16522 this.offset.click.top - 16523 16524 // Only for relative positioned nodes: Relative offset from element to offset parent 16525 this.offset.relative.top - 16526 16527 // The offsetParent's offset without borders (offset + border) 16528 this.offset.parent.top + 16529 ( ( this.cssPosition === "fixed" ? 16530 -this.scrollParent.scrollTop() : 16531 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 16532 ), 16533 left: ( 16534 16535 // The absolute mouse position 16536 pageX - 16537 16538 // Click offset (relative to the element) 16539 this.offset.click.left - 16540 16541 // Only for relative positioned nodes: Relative offset from element to offset parent 16542 this.offset.relative.left - 16543 16544 // The offsetParent's offset without borders (offset + border) 16545 this.offset.parent.left + 16546 ( ( this.cssPosition === "fixed" ? 16547 -this.scrollParent.scrollLeft() : 16548 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 16549 ) 16550 }; 16551 16552 }, 16553 16554 _rearrange: function( event, i, a, hardRefresh ) { 16555 16556 a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) : 16557 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 16558 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 16559 16560 //Various things done here to improve the performance: 16561 // 1. we create a setTimeout, that calls refreshPositions 16562 // 2. on the instance, we have a counter variable, that get's higher after every append 16563 // 3. on the local scope, we copy the counter variable, and check in the timeout, 16564 // if it's still the same 16565 // 4. this lets only the last addition to the timeout stack through 16566 this.counter = this.counter ? ++this.counter : 1; 16567 var counter = this.counter; 16568 16569 this._delay( function() { 16570 if ( counter === this.counter ) { 16571 16572 //Precompute after each DOM insertion, NOT on mousemove 16573 this.refreshPositions( !hardRefresh ); 16574 } 16575 } ); 16576 16577 }, 16578 16579 _clear: function( event, noPropagation ) { 16580 16581 this.reverting = false; 16582 16583 // We delay all events that have to be triggered to after the point where the placeholder 16584 // has been removed and everything else normalized again 16585 var i, 16586 delayedTriggers = []; 16587 16588 // We first have to update the dom position of the actual currentItem 16589 // Note: don't do it if the current item is already removed (by a user), or it gets 16590 // reappended (see #4088) 16591 if ( !this._noFinalSort && this.currentItem.parent().length ) { 16592 this.placeholder.before( this.currentItem ); 16593 } 16594 this._noFinalSort = null; 16595 16596 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 16597 for ( i in this._storedCSS ) { 16598 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 16599 this._storedCSS[ i ] = ""; 16600 } 16601 } 16602 this.currentItem.css( this._storedCSS ); 16603 this._removeClass( this.currentItem, "ui-sortable-helper" ); 16604 } else { 16605 this.currentItem.show(); 16606 } 16607 16608 if ( this.fromOutside && !noPropagation ) { 16609 delayedTriggers.push( function( event ) { 16610 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 16611 } ); 16612 } 16613 if ( ( this.fromOutside || 16614 this.domPosition.prev !== 16615 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 16616 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 16617 16618 // Trigger update callback if the DOM position has changed 16619 delayedTriggers.push( function( event ) { 16620 this._trigger( "update", event, this._uiHash() ); 16621 } ); 16622 } 16623 16624 // Check if the items Container has Changed and trigger appropriate 16625 // events. 16626 if ( this !== this.currentContainer ) { 16627 if ( !noPropagation ) { 16628 delayedTriggers.push( function( event ) { 16629 this._trigger( "remove", event, this._uiHash() ); 16630 } ); 16631 delayedTriggers.push( ( function( c ) { 16632 return function( event ) { 16633 c._trigger( "receive", event, this._uiHash( this ) ); 16634 }; 16635 } ).call( this, this.currentContainer ) ); 16636 delayedTriggers.push( ( function( c ) { 16637 return function( event ) { 16638 c._trigger( "update", event, this._uiHash( this ) ); 16639 }; 16640 } ).call( this, this.currentContainer ) ); 16641 } 16642 } 16643 16644 //Post events to containers 16645 function delayEvent( type, instance, container ) { 16646 return function( event ) { 16647 container._trigger( type, event, instance._uiHash( instance ) ); 16648 }; 16649 } 16650 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16651 if ( !noPropagation ) { 16652 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 16653 } 16654 if ( this.containers[ i ].containerCache.over ) { 16655 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 16656 this.containers[ i ].containerCache.over = 0; 16657 } 16658 } 16659 16660 //Do what was originally in plugins 16661 if ( this.storedCursor ) { 16662 this.document.find( "body" ).css( "cursor", this.storedCursor ); 16663 this.storedStylesheet.remove(); 16664 } 16665 if ( this._storedOpacity ) { 16666 this.helper.css( "opacity", this._storedOpacity ); 16667 } 16668 if ( this._storedZIndex ) { 16669 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 16670 } 16671 16672 this.dragging = false; 16673 16674 if ( !noPropagation ) { 16675 this._trigger( "beforeStop", event, this._uiHash() ); 16676 } 16677 16678 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16679 // it unbinds ALL events from the original node! 16680 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 16681 16682 if ( !this.cancelHelperRemoval ) { 16683 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 16684 this.helper.remove(); 16685 } 16686 this.helper = null; 16687 } 16688 16689 if ( !noPropagation ) { 16690 for ( i = 0; i < delayedTriggers.length; i++ ) { 16691 16692 // Trigger all delayed events 16693 delayedTriggers[ i ].call( this, event ); 16694 } 16695 this._trigger( "stop", event, this._uiHash() ); 16696 } 16697 16698 this.fromOutside = false; 16699 return !this.cancelHelperRemoval; 16700 16701 }, 16702 16703 _trigger: function() { 16704 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 16705 this.cancel(); 16706 } 16707 }, 16708 16709 _uiHash: function( _inst ) { 16710 var inst = _inst || this; 16711 return { 16712 helper: inst.helper, 16713 placeholder: inst.placeholder || $( [] ), 16714 position: inst.position, 16715 originalPosition: inst.originalPosition, 16716 offset: inst.positionAbs, 16717 item: inst.currentItem, 16718 sender: _inst ? _inst.element : null 16719 }; 16720 } 16721 16722} ); 16723 16724 16725/*!
vendor: 4,521 bytes, lines 16726-16893
16726 * jQuery UI Spinner 1.12.0 16727 * http://jqueryui.com 16728 * 16729 * Copyright jQuery Foundation and other contributors 16730 * Released under the MIT license. 16731 * http://jquery.org/license 16732 */ 16733 16734//>>label: Spinner 16735//>>group: Widgets 16736//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 16737//>>docs: http://api.jqueryui.com/spinner/ 16738//>>demos: http://jqueryui.com/spinner/ 16739//>>css.structure: ../../themes/base/core.css 16740//>>css.structure: ../../themes/base/spinner.css 16741//>>css.theme: ../../themes/base/theme.css 16742 16743 16744 16745function spinnerModifer( fn ) { 16746 return function() { 16747 var previous = this.element.val(); 16748 fn.apply( this, arguments ); 16749 this._refresh(); 16750 if ( previous !== this.element.val() ) { 16751 this._trigger( "change" ); 16752 } 16753 }; 16754} 16755 16756$.widget( "ui.spinner", { 16757 version: "1.12.0", 16758 defaultElement: "<input>", 16759 widgetEventPrefix: "spin", 16760 options: { 16761 classes: { 16762 "ui-spinner": "ui-corner-all", 16763 "ui-spinner-down": "ui-corner-br", 16764 "ui-spinner-up": "ui-corner-tr" 16765 }, 16766 culture: null, 16767 icons: { 16768 down: "ui-icon-triangle-1-s", 16769 up: "ui-icon-triangle-1-n" 16770 }, 16771 incremental: true, 16772 max: null, 16773 min: null, 16774 numberFormat: null, 16775 page: 10, 16776 step: 1, 16777 16778 change: null, 16779 spin: null, 16780 start: null, 16781 stop: null 16782 }, 16783 16784 _create: function() { 16785 16786 // handle string values that need to be parsed 16787 this._setOption( "max", this.options.max ); 16788 this._setOption( "min", this.options.min ); 16789 this._setOption( "step", this.options.step ); 16790 16791 // Only format if there is a value, prevents the field from being marked 16792 // as invalid in Firefox, see #9573. 16793 if ( this.value() !== "" ) { 16794 16795 // Format the value, but don't constrain. 16796 this._value( this.element.val(), true ); 16797 } 16798 16799 16800 this._draw(); 16801 this._on( this._events ); 16802 this._refresh(); 16803 16804 // Turning off autocomplete prevents the browser from remembering the 16805 // value when navigating through history, so we re-enable autocomplete 16806 // if the page is unloaded before the widget is destroyed. #7790 16807 this._on( this.window, { 16808 beforeunload: function() { 16809 this.element.removeAttr( "autocomplete" ); 16810 } 16811 } ); 16812 }, 16813 16814 _getCreateOptions: function() { 16815 var options = this._super(); 16816 var element = this.element; 16817 16818 $.each( [ "min", "max", "step" ], function( i, option ) { 16819 var value = element.attr( option ); 16820 if ( value != null && value.length ) { 16821 options[ option ] = value; 16822 } 16823 } ); 16824 16825 return options; 16826 }, 16827 16828 _events: { 16829 keydown: function( event ) { 16830 if ( this._start( event ) && this._keydown( event ) ) { 16831 event.preventDefault(); 16832 } 16833 }, 16834 keyup: "_stop", 16835 focus: function() { 16836 this.previous = this.element.val(); 16837 }, 16838 blur: function( event ) { 16839 if ( this.cancelBlur ) { 16840 delete this.cancelBlur; 16841 return; 16842 } 16843 16844 this._stop(); 16845 this._refresh(); 16846 if ( this.previous !== this.element.val() ) { 16847 this._trigger( "change", event ); 16848 } 16849 }, 16850 mousewheel: function( event, delta ) { 16851 if ( !delta ) { 16852 return; 16853 } 16854 if ( !this.spinning && !this._start( event ) ) { 16855 return false; 16856 } 16857 16858 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 16859 clearTimeout( this.mousewheelTimer ); 16860 this.mousewheelTimer = this._delay( function() { 16861 if ( this.spinning ) { 16862 this._stop( event ); 16863 } 16864 }, 100 ); 16865 event.preventDefault(); 16866 }, 16867 "mousedown .ui-spinner-button": function( event ) { 16868 var previous; 16869 16870 // We never want the buttons to have focus; whenever the user is 16871 // interacting with the spinner, the focus should be on the input. 16872 // If the input is focused then this.previous is properly set from 16873 // when the input first received focus. If the input is not focused 16874 // then we need to set this.previous based on the value before spinning. 16875 previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ? 16876 this.previous : this.element.val(); 16877 function checkFocus() { 16878 var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ); 16879 if ( !isActive ) { 16880 this.element.trigger( "focus" ); 16881 this.previous = previous; 16882 16883 // support: IE 16884 // IE sets focus asynchronously, so we need to check if focus 16885 // moved off of the input because the user clicked on the button. 16886 this._delay( function() { 16887 this.previous = previous; 16888 } ); 16889 } 16890 } 16891 16892 // Ensure focus is on (or stays on) the text field 16893 event.preventDefault();
vendor: 5,988 bytes, lines 16894-17124
16894 checkFocus.call( this ); 16895 16896 // Support: IE 16897 // IE doesn't prevent moving focus even with event.preventDefault() 16898 // so we set a flag to know when we should ignore the blur event 16899 // and check (again) if focus moved off of the input. 16900 this.cancelBlur = true; 16901 this._delay( function() { 16902 delete this.cancelBlur; 16903 checkFocus.call( this ); 16904 } ); 16905 16906 if ( this._start( event ) === false ) { 16907 return; 16908 } 16909 16910 this._repeat( null, $( event.currentTarget ) 16911 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 16912 }, 16913 "mouseup .ui-spinner-button": "_stop", 16914 "mouseenter .ui-spinner-button": function( event ) { 16915 16916 // button will add ui-state-active if mouse was down while mouseleave and kept down 16917 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 16918 return; 16919 } 16920 16921 if ( this._start( event ) === false ) { 16922 return false; 16923 } 16924 this._repeat( null, $( event.currentTarget ) 16925 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 16926 }, 16927 16928 // TODO: do we really want to consider this a stop? 16929 // shouldn't we just stop the repeater and wait until mouseup before 16930 // we trigger the stop event? 16931 "mouseleave .ui-spinner-button": "_stop" 16932 }, 16933 16934 // Support mobile enhanced option and make backcompat more sane 16935 _enhance: function() { 16936 this.uiSpinner = this.element 16937 .attr( "autocomplete", "off" ) 16938 .wrap( "<span>" ) 16939 .parent() 16940 16941 // Add buttons 16942 .append( 16943 "<a></a><a></a>" 16944 ); 16945 }, 16946 16947 _draw: function() { 16948 this._enhance(); 16949 16950 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 16951 this._addClass( "ui-spinner-input" ); 16952 16953 this.element.attr( "role", "spinbutton" ); 16954 16955 // Button bindings 16956 this.buttons = this.uiSpinner.children( "a" ) 16957 .attr( "tabIndex", -1 ) 16958 .attr( "aria-hidden", true ) 16959 .button( { 16960 classes: { 16961 "ui-button": "" 16962 } 16963 } ); 16964 16965 // TODO: Right now button does not support classes this is already updated in button PR 16966 this._removeClass( this.buttons, "ui-corner-all" ); 16967 16968 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 16969 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 16970 this.buttons.first().button( { 16971 "icon": this.options.icons.up, 16972 "showLabel": false 16973 } ); 16974 this.buttons.last().button( { 16975 "icon": this.options.icons.down, 16976 "showLabel": false 16977 } ); 16978 16979 // IE 6 doesn't understand height: 50% for the buttons 16980 // unless the wrapper has an explicit height 16981 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 16982 this.uiSpinner.height() > 0 ) { 16983 this.uiSpinner.height( this.uiSpinner.height() ); 16984 } 16985 }, 16986 16987 _keydown: function( event ) { 16988 var options = this.options, 16989 keyCode = $.ui.keyCode; 16990 16991 switch ( event.keyCode ) { 16992 case keyCode.UP: 16993 this._repeat( null, 1, event ); 16994 return true; 16995 case keyCode.DOWN: 16996 this._repeat( null, -1, event ); 16997 return true; 16998 case keyCode.PAGE_UP: 16999 this._repeat( null, options.page, event ); 17000 return true; 17001 case keyCode.PAGE_DOWN: 17002 this._repeat( null, -options.page, event ); 17003 return true; 17004 } 17005 17006 return false; 17007 }, 17008 17009 _start: function( event ) { 17010 if ( !this.spinning && this._trigger( "start", event ) === false ) { 17011 return false; 17012 } 17013 17014 if ( !this.counter ) { 17015 this.counter = 1; 17016 } 17017 this.spinning = true; 17018 return true; 17019 }, 17020 17021 _repeat: function( i, steps, event ) { 17022 i = i || 500; 17023 17024 clearTimeout( this.timer ); 17025 this.timer = this._delay( function() { 17026 this._repeat( 40, steps, event ); 17027 }, i ); 17028 17029 this._spin( steps * this.options.step, event ); 17030 }, 17031 17032 _spin: function( step, event ) { 17033 var value = this.value() || 0; 17034 17035 if ( !this.counter ) { 17036 this.counter = 1; 17037 } 17038 17039 value = this._adjustValue( value + step * this._increment( this.counter ) ); 17040 17041 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 17042 this._value( value ); 17043 this.counter++; 17044 } 17045 }, 17046 17047 _increment: function( i ) { 17048 var incremental = this.options.incremental; 17049 17050 if ( incremental ) { 17051 return $.isFunction( incremental ) ? 17052 incremental( i ) : 17053 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 17054 } 17055 17056 return 1; 17057 }, 17058 17059 _precision: function() { 17060 var precision = this._precisionOf( this.options.step ); 17061 if ( this.options.min !== null ) { 17062 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 17063 } 17064 return precision; 17065 }, 17066 17067 _precisionOf: function( num ) { 17068 var str = num.toString(), 17069 decimal = str.indexOf( "." ); 17070 return decimal === -1 ? 0 : str.length - decimal - 1; 17071 }, 17072 17073 _adjustValue: function( value ) { 17074 var base, aboveMin, 17075 options = this.options; 17076 17077 // Make sure we're at a valid step 17078 // - find out where we are relative to the base (min or 0) 17079 base = options.min !== null ? options.min : 0; 17080 aboveMin = value - base; 17081 17082 // - round to the nearest step 17083 aboveMin = Math.round( aboveMin / options.step ) * options.step; 17084 17085 // - rounding is based on 0, so adjust back to our base 17086 value = base + aboveMin; 17087 17088 // Fix precision from bad JS floating point math 17089 value = parseFloat( value.toFixed( this._precision() ) ); 17090 17091 // Clamp the value 17092 if ( options.max !== null && value > options.max ) { 17093 return options.max; 17094 } 17095 if ( options.min !== null && value < options.min ) { 17096 return options.min; 17097 17098 } 17099 17100 return value; 17101 }, 17102 17103 _stop: function( event ) { 17104 if ( !this.spinning ) { 17105 return; 17106 } 17107 17108 clearTimeout( this.timer ); 17109 clearTimeout( this.mousewheelTimer ); 17110 this.counter = 0; 17111 this.spinning = false; 17112 this._trigger( "stop", event ); 17113 }, 17114 17115 _setOption: function( key, value ) { 17116 var prevValue, first, last; 17117 17118 if ( key === "culture" || key === "numberFormat" ) { 17119 prevValue = this._parse( this.element.val() ); 17120 this.options[ key ] = value; 17121 this.element.val( this._format( prevValue ) ); 17122 return; 17123 } 17124
vendor: 12,920 bytes, lines 17125-17621
17125 if ( key === "max" || key === "min" || key === "step" ) { 17126 if ( typeof value === "string" ) { 17127 value = this._parse( value ); 17128 } 17129 } 17130 if ( key === "icons" ) { 17131 first = this.buttons.first().find( ".ui-icon" ); 17132 this._removeClass( first, null, this.options.icons.up ); 17133 this._addClass( first, null, value.up ); 17134 last = this.buttons.last().find( ".ui-icon" ); 17135 this._removeClass( last, null, this.options.icons.down ); 17136 this._addClass( last, null, value.down ); 17137 } 17138 17139 this._super( key, value ); 17140 }, 17141 17142 _setOptionDisabled: function( value ) { 17143 this._super( value ); 17144 17145 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 17146 this.element.prop( "disabled", !!value ); 17147 this.buttons.button( value ? "disable" : "enable" ); 17148 }, 17149 17150 _setOptions: spinnerModifer( function( options ) { 17151 this._super( options ); 17152 } ), 17153 17154 _parse: function( val ) { 17155 if ( typeof val === "string" && val !== "" ) { 17156 val = window.Globalize && this.options.numberFormat ? 17157 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 17158 } 17159 return val === "" || isNaN( val ) ? null : val; 17160 }, 17161 17162 _format: function( value ) { 17163 if ( value === "" ) { 17164 return ""; 17165 } 17166 return window.Globalize && this.options.numberFormat ? 17167 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 17168 value; 17169 }, 17170 17171 _refresh: function() { 17172 this.element.attr( { 17173 "aria-valuemin": this.options.min, 17174 "aria-valuemax": this.options.max, 17175 17176 // TODO: what should we do with values that can't be parsed? 17177 "aria-valuenow": this._parse( this.element.val() ) 17178 } ); 17179 }, 17180 17181 isValid: function() { 17182 var value = this.value(); 17183 17184 // Null is invalid 17185 if ( value === null ) { 17186 return false; 17187 } 17188 17189 // If value gets adjusted, it's invalid 17190 return value === this._adjustValue( value ); 17191 }, 17192 17193 // Update the value without triggering change 17194 _value: function( value, allowAny ) { 17195 var parsed; 17196 if ( value !== "" ) { 17197 parsed = this._parse( value ); 17198 if ( parsed !== null ) { 17199 if ( !allowAny ) { 17200 parsed = this._adjustValue( parsed ); 17201 } 17202 value = this._format( parsed ); 17203 } 17204 } 17205 this.element.val( value ); 17206 this._refresh(); 17207 }, 17208 17209 _destroy: function() { 17210 this.element 17211 .prop( "disabled", false ) 17212 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 17213 17214 this.uiSpinner.replaceWith( this.element ); 17215 }, 17216 17217 stepUp: spinnerModifer( function( steps ) { 17218 this._stepUp( steps ); 17219 } ), 17220 _stepUp: function( steps ) { 17221 if ( this._start() ) { 17222 this._spin( ( steps || 1 ) * this.options.step ); 17223 this._stop(); 17224 } 17225 }, 17226 17227 stepDown: spinnerModifer( function( steps ) { 17228 this._stepDown( steps ); 17229 } ), 17230 _stepDown: function( steps ) { 17231 if ( this._start() ) { 17232 this._spin( ( steps || 1 ) * -this.options.step ); 17233 this._stop(); 17234 } 17235 }, 17236 17237 pageUp: spinnerModifer( function( pages ) { 17238 this._stepUp( ( pages || 1 ) * this.options.page ); 17239 } ), 17240 17241 pageDown: spinnerModifer( function( pages ) { 17242 this._stepDown( ( pages || 1 ) * this.options.page ); 17243 } ), 17244 17245 value: function( newVal ) { 17246 if ( !arguments.length ) { 17247 return this._parse( this.element.val() ); 17248 } 17249 spinnerModifer( this._value ).call( this, newVal ); 17250 }, 17251 17252 widget: function() { 17253 return this.uiSpinner; 17254 } 17255} ); 17256 17257// DEPRECATED 17258// TODO: switch return back to widget declaration at top of file when this is removed 17259if ( $.uiBackCompat !== false ) { 17260 17261 // Backcompat for spinner html extension points 17262 $.widget( "ui.spinner", $.ui.spinner, { 17263 _enhance: function() { 17264 this.uiSpinner = this.element 17265 .attr( "autocomplete", "off" ) 17266 .wrap( this._uiSpinnerHtml() ) 17267 .parent() 17268 17269 // Add buttons 17270 .append( this._buttonHtml() ); 17271 }, 17272 _uiSpinnerHtml: function() { 17273 return "<span>"; 17274 }, 17275 17276 _buttonHtml: function() { 17277 return "<a></a><a></a>"; 17278 } 17279 } ); 17280} 17281 17282var widgetsSpinner = $.ui.spinner; 17283 17284 17285/*! 17286 * jQuery UI Tabs 1.12.0 17287 * http://jqueryui.com 17288 * 17289 * Copyright jQuery Foundation and other contributors 17290 * Released under the MIT license. 17291 * http://jquery.org/license 17292 */ 17293 17294//>>label: Tabs 17295//>>group: Widgets 17296//>>description: Transforms a set of container elements into a tab structure. 17297//>>docs: http://api.jqueryui.com/tabs/ 17298//>>demos: http://jqueryui.com/tabs/ 17299//>>css.structure: ../../themes/base/core.css 17300//>>css.structure: ../../themes/base/tabs.css 17301//>>css.theme: ../../themes/base/theme.css 17302 17303 17304 17305$.widget( "ui.tabs", { 17306 version: "1.12.0", 17307 delay: 300, 17308 options: { 17309 active: null, 17310 classes: { 17311 "ui-tabs": "ui-corner-all", 17312 "ui-tabs-nav": "ui-corner-all", 17313 "ui-tabs-panel": "ui-corner-bottom", 17314 "ui-tabs-tab": "ui-corner-top" 17315 }, 17316 collapsible: false, 17317 event: "click", 17318 heightStyle: "content", 17319 hide: null, 17320 show: null, 17321 17322 // Callbacks 17323 activate: null, 17324 beforeActivate: null, 17325 beforeLoad: null, 17326 load: null 17327 }, 17328 17329 _isLocal: ( function() { 17330 var rhash = /#.*$/; 17331 17332 return function( anchor ) { 17333 var anchorUrl, locationUrl; 17334 17335 anchorUrl = anchor.href.replace( rhash, "" ); 17336 locationUrl = location.href.replace( rhash, "" ); 17337 17338 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 17339 try { 17340 anchorUrl = decodeURIComponent( anchorUrl ); 17341 } catch ( error ) {} 17342 try { 17343 locationUrl = decodeURIComponent( locationUrl ); 17344 } catch ( error ) {} 17345 17346 return anchor.hash.length > 1 && anchorUrl === locationUrl; 17347 }; 17348 } )(), 17349 17350 _create: function() { 17351 var that = this, 17352 options = this.options; 17353 17354 this.running = false; 17355 17356 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 17357 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 17358 17359 this._processTabs(); 17360 options.active = this._initialActive(); 17361 17362 // Take disabling tabs via class attribute from HTML 17363 // into account and update option properly. 17364 if ( $.isArray( options.disabled ) ) { 17365 options.disabled = $.unique( options.disabled.concat( 17366 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 17367 return that.tabs.index( li ); 17368 } ) 17369 ) ).sort(); 17370 } 17371 17372 // Check for length avoids error when initializing empty list 17373 if ( this.options.active !== false && this.anchors.length ) { 17374 this.active = this._findActive( options.active ); 17375 } else { 17376 this.active = $(); 17377 } 17378 17379 this._refresh(); 17380 17381 if ( this.active.length ) { 17382 this.load( options.active ); 17383 } 17384 }, 17385 17386 _initialActive: function() { 17387 var active = this.options.active, 17388 collapsible = this.options.collapsible, 17389 locationHash = location.hash.substring( 1 ); 17390 17391 if ( active === null ) { 17392 17393 // check the fragment identifier in the URL 17394 if ( locationHash ) { 17395 this.tabs.each( function( i, tab ) { 17396 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 17397 active = i; 17398 return false; 17399 } 17400 } ); 17401 } 17402 17403 // Check for a tab marked active via a class 17404 if ( active === null ) { 17405 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 17406 } 17407 17408 // No active tab, set to false 17409 if ( active === null || active === -1 ) { 17410 active = this.tabs.length ? 0 : false; 17411 } 17412 } 17413 17414 // Handle numbers: negative, out of range 17415 if ( active !== false ) { 17416 active = this.tabs.index( this.tabs.eq( active ) ); 17417 if ( active === -1 ) { 17418 active = collapsible ? false : 0; 17419 } 17420 } 17421 17422 // Don't allow collapsible: false and active: false 17423 if ( !collapsible && active === false && this.anchors.length ) { 17424 active = 0; 17425 } 17426 17427 return active; 17428 }, 17429 17430 _getCreateEventData: function() { 17431 return { 17432 tab: this.active, 17433 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 17434 }; 17435 }, 17436 17437 _tabKeydown: function( event ) { 17438 var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ), 17439 selectedIndex = this.tabs.index( focusedTab ), 17440 goingForward = true; 17441 17442 if ( this._handlePageNav( event ) ) { 17443 return; 17444 } 17445 17446 switch ( event.keyCode ) { 17447 case $.ui.keyCode.RIGHT: 17448 case $.ui.keyCode.DOWN: 17449 selectedIndex++; 17450 break; 17451 case $.ui.keyCode.UP: 17452 case $.ui.keyCode.LEFT: 17453 goingForward = false; 17454 selectedIndex--; 17455 break; 17456 case $.ui.keyCode.END: 17457 selectedIndex = this.anchors.length - 1; 17458 break; 17459 case $.ui.keyCode.HOME: 17460 selectedIndex = 0; 17461 break; 17462 case $.ui.keyCode.SPACE: 17463 17464 // Activate only, no collapsing 17465 event.preventDefault(); 17466 clearTimeout( this.activating ); 17467 this._activate( selectedIndex ); 17468 return; 17469 case $.ui.keyCode.ENTER: 17470 17471 // Toggle (cancel delayed activation, allow collapsing) 17472 event.preventDefault(); 17473 clearTimeout( this.activating ); 17474 17475 // Determine if we should collapse or activate 17476 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 17477 return; 17478 default: 17479 return; 17480 } 17481 17482 // Focus the appropriate tab, based on which key was pressed 17483 event.preventDefault(); 17484 clearTimeout( this.activating ); 17485 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 17486 17487 // Navigating with control/command key will prevent automatic activation 17488 if ( !event.ctrlKey && !event.metaKey ) { 17489 17490 // Update aria-selected immediately so that AT think the tab is already selected. 17491 // Otherwise AT may confuse the user by stating that they need to activate the tab, 17492 // but the tab will already be activated by the time the announcement finishes. 17493 focusedTab.attr( "aria-selected", "false" ); 17494 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 17495 17496 this.activating = this._delay( function() { 17497 this.option( "active", selectedIndex ); 17498 }, this.delay ); 17499 } 17500 }, 17501 17502 _panelKeydown: function( event ) { 17503 if ( this._handlePageNav( event ) ) { 17504 return; 17505 } 17506 17507 // Ctrl+up moves focus to the current tab 17508 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 17509 event.preventDefault(); 17510 this.active.trigger( "focus" ); 17511 } 17512 }, 17513 17514 // Alt+page up/down moves focus to the previous/next tab (and activates) 17515 _handlePageNav: function( event ) { 17516 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 17517 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 17518 return true; 17519 } 17520 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 17521 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 17522 return true; 17523 } 17524 }, 17525 17526 _findNextTab: function( index, goingForward ) { 17527 var lastTabIndex = this.tabs.length - 1; 17528 17529 function constrain() { 17530 if ( index > lastTabIndex ) { 17531 index = 0; 17532 } 17533 if ( index < 0 ) { 17534 index = lastTabIndex; 17535 } 17536 return index; 17537 } 17538 17539 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 17540 index = goingForward ? index + 1 : index - 1; 17541 } 17542 17543 return index; 17544 }, 17545 17546 _focusNextTab: function( index, goingForward ) { 17547 index = this._findNextTab( index, goingForward ); 17548 this.tabs.eq( index ).trigger( "focus" ); 17549 return index; 17550 }, 17551 17552 _setOption: function( key, value ) { 17553 if ( key === "active" ) { 17554 17555 // _activate() will handle invalid values and update this.options 17556 this._activate( value ); 17557 return; 17558 } 17559 17560 this._super( key, value ); 17561 17562 if ( key === "collapsible" ) { 17563 this._toggleClass( "ui-tabs-collapsible", null, value ); 17564 17565 // Setting collapsible: false while collapsed; open first panel 17566 if ( !value && this.options.active === false ) { 17567 this._activate( 0 ); 17568 } 17569 } 17570 17571 if ( key === "event" ) { 17572 this._setupEvents( value ); 17573 } 17574 17575 if ( key === "heightStyle" ) { 17576 this._setupHeightStyle( value ); 17577 } 17578 }, 17579 17580 _sanitizeSelector: function( hash ) { 17581 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 17582 }, 17583 17584 refresh: function() { 17585 var options = this.options, 17586 lis = this.tablist.children( ":has(a[href])" ); 17587 17588 // Get disabled tabs from class attribute from HTML 17589 // this will get converted to a boolean if needed in _refresh() 17590 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 17591 return lis.index( tab ); 17592 } ); 17593 17594 this._processTabs(); 17595 17596 // Was collapsed or no tabs 17597 if ( options.active === false || !this.anchors.length ) { 17598 options.active = false; 17599 this.active = $(); 17600 17601 // was active, but active tab is gone 17602 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 17603 17604 // all remaining tabs are disabled 17605 if ( this.tabs.length === options.disabled.length ) { 17606 options.active = false; 17607 this.active = $(); 17608 17609 // activate previous tab 17610 } else { 17611 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 17612 } 17613 17614 // was active, active tab still exists 17615 } else { 17616 17617 // make sure active index is correct 17618 options.active = this.tabs.index( this.active ); 17619 } 17620 17621 this._refresh();
vendor: 18,780 bytes, lines 17622-18324
17622 }, 17623 17624 _refresh: function() { 17625 this._setOptionDisabled( this.options.disabled ); 17626 this._setupEvents( this.options.event ); 17627 this._setupHeightStyle( this.options.heightStyle ); 17628 17629 this.tabs.not( this.active ).attr( { 17630 "aria-selected": "false", 17631 "aria-expanded": "false", 17632 tabIndex: -1 17633 } ); 17634 this.panels.not( this._getPanelForTab( this.active ) ) 17635 .hide() 17636 .attr( { 17637 "aria-hidden": "true" 17638 } ); 17639 17640 // Make sure one tab is in the tab order 17641 if ( !this.active.length ) { 17642 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 17643 } else { 17644 this.active 17645 .attr( { 17646 "aria-selected": "true", 17647 "aria-expanded": "true", 17648 tabIndex: 0 17649 } ); 17650 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 17651 this._getPanelForTab( this.active ) 17652 .show() 17653 .attr( { 17654 "aria-hidden": "false" 17655 } ); 17656 } 17657 }, 17658 17659 _processTabs: function() { 17660 var that = this, 17661 prevTabs = this.tabs, 17662 prevAnchors = this.anchors, 17663 prevPanels = this.panels; 17664 17665 this.tablist = this._getList().attr( "role", "tablist" ); 17666 this._addClass( this.tablist, "ui-tabs-nav", 17667 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 17668 17669 // Prevent users from focusing disabled tabs via click 17670 this.tablist 17671 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 17672 if ( $( this ).is( ".ui-state-disabled" ) ) { 17673 event.preventDefault(); 17674 } 17675 } ) 17676 17677 // Support: IE <9 17678 // Preventing the default action in mousedown doesn't prevent IE 17679 // from focusing the element, so if the anchor gets focused, blur. 17680 // We don't have to worry about focusing the previously focused 17681 // element since clicking on a non-focusable element should focus 17682 // the body anyway. 17683 .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 17684 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 17685 this.blur(); 17686 } 17687 } ); 17688 17689 this.tabs = this.tablist.find( "> li:has(a[href])" ) 17690 .attr( { 17691 role: "tab", 17692 tabIndex: -1 17693 } ); 17694 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 17695 17696 this.anchors = this.tabs.map( function() { 17697 return $( "a", this )[ 0 ]; 17698 } ) 17699 .attr( { 17700 role: "presentation", 17701 tabIndex: -1 17702 } ); 17703 this._addClass( this.anchors, "ui-tabs-anchor" ); 17704 17705 this.panels = $(); 17706 17707 this.anchors.each( function( i, anchor ) { 17708 var selector, panel, panelId, 17709 anchorId = $( anchor ).uniqueId().attr( "id" ), 17710 tab = $( anchor ).closest( "li" ), 17711 originalAriaControls = tab.attr( "aria-controls" ); 17712 17713 // Inline tab 17714 if ( that._isLocal( anchor ) ) { 17715 selector = anchor.hash; 17716 panelId = selector.substring( 1 ); 17717 panel = that.element.find( that._sanitizeSelector( selector ) ); 17718 17719 // remote tab 17720 } else { 17721 17722 // If the tab doesn't already have aria-controls, 17723 // generate an id by using a throw-away element 17724 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 17725 selector = "#" + panelId; 17726 panel = that.element.find( selector ); 17727 if ( !panel.length ) { 17728 panel = that._createPanel( panelId ); 17729 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 17730 } 17731 panel.attr( "aria-live", "polite" ); 17732 } 17733 17734 if ( panel.length ) { 17735 that.panels = that.panels.add( panel ); 17736 } 17737 if ( originalAriaControls ) { 17738 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 17739 } 17740 tab.attr( { 17741 "aria-controls": panelId, 17742 "aria-labelledby": anchorId 17743 } ); 17744 panel.attr( "aria-labelledby", anchorId ); 17745 } ); 17746 17747 this.panels.attr( "role", "tabpanel" ); 17748 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 17749 17750 // Avoid memory leaks (#10056) 17751 if ( prevTabs ) { 17752 this._off( prevTabs.not( this.tabs ) ); 17753 this._off( prevAnchors.not( this.anchors ) ); 17754 this._off( prevPanels.not( this.panels ) ); 17755 } 17756 }, 17757 17758 // Allow overriding how to find the list for rare usage scenarios (#7715) 17759 _getList: function() { 17760 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 17761 }, 17762 17763 _createPanel: function( id ) { 17764 return $( "<div>" ) 17765 .attr( "id", id ) 17766 .data( "ui-tabs-destroy", true ); 17767 }, 17768 17769 _setOptionDisabled: function( disabled ) { 17770 var currentItem, li, i; 17771 17772 if ( $.isArray( disabled ) ) { 17773 if ( !disabled.length ) { 17774 disabled = false; 17775 } else if ( disabled.length === this.anchors.length ) { 17776 disabled = true; 17777 } 17778 } 17779 17780 // Disable tabs 17781 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 17782 currentItem = $( li ); 17783 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 17784 currentItem.attr( "aria-disabled", "true" ); 17785 this._addClass( currentItem, null, "ui-state-disabled" ); 17786 } else { 17787 currentItem.removeAttr( "aria-disabled" ); 17788 this._removeClass( currentItem, null, "ui-state-disabled" ); 17789 } 17790 } 17791 17792 this.options.disabled = disabled; 17793 17794 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 17795 disabled === true ); 17796 }, 17797 17798 _setupEvents: function( event ) { 17799 var events = {}; 17800 if ( event ) { 17801 $.each( event.split( " " ), function( index, eventName ) { 17802 events[ eventName ] = "_eventHandler"; 17803 } ); 17804 } 17805 17806 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 17807 17808 // Always prevent the default action, even when disabled 17809 this._on( true, this.anchors, { 17810 click: function( event ) { 17811 event.preventDefault(); 17812 } 17813 } ); 17814 this._on( this.anchors, events ); 17815 this._on( this.tabs, { keydown: "_tabKeydown" } ); 17816 this._on( this.panels, { keydown: "_panelKeydown" } ); 17817 17818 this._focusable( this.tabs ); 17819 this._hoverable( this.tabs ); 17820 }, 17821 17822 _setupHeightStyle: function( heightStyle ) { 17823 var maxHeight, 17824 parent = this.element.parent(); 17825 17826 if ( heightStyle === "fill" ) { 17827 maxHeight = parent.height(); 17828 maxHeight -= this.element.outerHeight() - this.element.height(); 17829 17830 this.element.siblings( ":visible" ).each( function() { 17831 var elem = $( this ), 17832 position = elem.css( "position" ); 17833 17834 if ( position === "absolute" || position === "fixed" ) { 17835 return; 17836 } 17837 maxHeight -= elem.outerHeight( true ); 17838 } ); 17839 17840 this.element.children().not( this.panels ).each( function() { 17841 maxHeight -= $( this ).outerHeight( true ); 17842 } ); 17843 17844 this.panels.each( function() { 17845 $( this ).height( Math.max( 0, maxHeight - 17846 $( this ).innerHeight() + $( this ).height() ) ); 17847 } ) 17848 .css( "overflow", "auto" ); 17849 } else if ( heightStyle === "auto" ) { 17850 maxHeight = 0; 17851 this.panels.each( function() { 17852 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 17853 } ).height( maxHeight ); 17854 } 17855 }, 17856 17857 _eventHandler: function( event ) { 17858 var options = this.options, 17859 active = this.active, 17860 anchor = $( event.currentTarget ), 17861 tab = anchor.closest( "li" ), 17862 clickedIsActive = tab[ 0 ] === active[ 0 ], 17863 collapsing = clickedIsActive && options.collapsible, 17864 toShow = collapsing ? $() : this._getPanelForTab( tab ), 17865 toHide = !active.length ? $() : this._getPanelForTab( active ), 17866 eventData = { 17867 oldTab: active, 17868 oldPanel: toHide, 17869 newTab: collapsing ? $() : tab, 17870 newPanel: toShow 17871 }; 17872 17873 event.preventDefault(); 17874 17875 if ( tab.hasClass( "ui-state-disabled" ) || 17876 17877 // tab is already loading 17878 tab.hasClass( "ui-tabs-loading" ) || 17879 17880 // can't switch durning an animation 17881 this.running || 17882 17883 // click on active header, but not collapsible 17884 ( clickedIsActive && !options.collapsible ) || 17885 17886 // allow canceling activation 17887 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 17888 return; 17889 } 17890 17891 options.active = collapsing ? false : this.tabs.index( tab ); 17892 17893 this.active = clickedIsActive ? $() : tab; 17894 if ( this.xhr ) { 17895 this.xhr.abort(); 17896 } 17897 17898 if ( !toHide.length && !toShow.length ) { 17899 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 17900 } 17901 17902 if ( toShow.length ) { 17903 this.load( this.tabs.index( tab ), event ); 17904 } 17905 this._toggle( event, eventData ); 17906 }, 17907 17908 // Handles show/hide for selecting tabs 17909 _toggle: function( event, eventData ) { 17910 var that = this, 17911 toShow = eventData.newPanel, 17912 toHide = eventData.oldPanel; 17913 17914 this.running = true; 17915 17916 function complete() { 17917 that.running = false; 17918 that._trigger( "activate", event, eventData ); 17919 } 17920 17921 function show() { 17922 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 17923 17924 if ( toShow.length && that.options.show ) { 17925 that._show( toShow, that.options.show, complete ); 17926 } else { 17927 toShow.show(); 17928 complete(); 17929 } 17930 } 17931 17932 // Start out by hiding, then showing, then completing 17933 if ( toHide.length && this.options.hide ) { 17934 this._hide( toHide, this.options.hide, function() { 17935 that._removeClass( eventData.oldTab.closest( "li" ), 17936 "ui-tabs-active", "ui-state-active" ); 17937 show(); 17938 } ); 17939 } else { 17940 this._removeClass( eventData.oldTab.closest( "li" ), 17941 "ui-tabs-active", "ui-state-active" ); 17942 toHide.hide(); 17943 show(); 17944 } 17945 17946 toHide.attr( "aria-hidden", "true" ); 17947 eventData.oldTab.attr( { 17948 "aria-selected": "false", 17949 "aria-expanded": "false" 17950 } ); 17951 17952 // If we're switching tabs, remove the old tab from the tab order. 17953 // If we're opening from collapsed state, remove the previous tab from the tab order. 17954 // If we're collapsing, then keep the collapsing tab in the tab order. 17955 if ( toShow.length && toHide.length ) { 17956 eventData.oldTab.attr( "tabIndex", -1 ); 17957 } else if ( toShow.length ) { 17958 this.tabs.filter( function() { 17959 return $( this ).attr( "tabIndex" ) === 0; 17960 } ) 17961 .attr( "tabIndex", -1 ); 17962 } 17963 17964 toShow.attr( "aria-hidden", "false" ); 17965 eventData.newTab.attr( { 17966 "aria-selected": "true", 17967 "aria-expanded": "true", 17968 tabIndex: 0 17969 } ); 17970 }, 17971 17972 _activate: function( index ) { 17973 var anchor, 17974 active = this._findActive( index ); 17975 17976 // Trying to activate the already active panel 17977 if ( active[ 0 ] === this.active[ 0 ] ) { 17978 return; 17979 } 17980 17981 // Trying to collapse, simulate a click on the current active header 17982 if ( !active.length ) { 17983 active = this.active; 17984 } 17985 17986 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 17987 this._eventHandler( { 17988 target: anchor, 17989 currentTarget: anchor, 17990 preventDefault: $.noop 17991 } ); 17992 }, 17993 17994 _findActive: function( index ) { 17995 return index === false ? $() : this.tabs.eq( index ); 17996 }, 17997 17998 _getIndex: function( index ) { 17999 18000 // meta-function to give users option to provide a href string instead of a numerical index. 18001 if ( typeof index === "string" ) { 18002 index = this.anchors.index( this.anchors.filter( "[href$='" + 18003 $.ui.escapeSelector( index ) + "']" ) ); 18004 } 18005 18006 return index; 18007 }, 18008 18009 _destroy: function() { 18010 if ( this.xhr ) { 18011 this.xhr.abort(); 18012 } 18013 18014 this.tablist 18015 .removeAttr( "role" ) 18016 .off( this.eventNamespace ); 18017 18018 this.anchors 18019 .removeAttr( "role tabIndex" ) 18020 .removeUniqueId(); 18021 18022 this.tabs.add( this.panels ).each( function() { 18023 if ( $.data( this, "ui-tabs-destroy" ) ) { 18024 $( this ).remove(); 18025 } else { 18026 $( this ).removeAttr( "role tabIndex " + 18027 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 18028 } 18029 } ); 18030 18031 this.tabs.each( function() { 18032 var li = $( this ), 18033 prev = li.data( "ui-tabs-aria-controls" ); 18034 if ( prev ) { 18035 li 18036 .attr( "aria-controls", prev ) 18037 .removeData( "ui-tabs-aria-controls" ); 18038 } else { 18039 li.removeAttr( "aria-controls" ); 18040 } 18041 } ); 18042 18043 this.panels.show(); 18044 18045 if ( this.options.heightStyle !== "content" ) { 18046 this.panels.css( "height", "" ); 18047 } 18048 }, 18049 18050 enable: function( index ) { 18051 var disabled = this.options.disabled; 18052 if ( disabled === false ) { 18053 return; 18054 } 18055 18056 if ( index === undefined ) { 18057 disabled = false; 18058 } else { 18059 index = this._getIndex( index ); 18060 if ( $.isArray( disabled ) ) { 18061 disabled = $.map( disabled, function( num ) { 18062 return num !== index ? num : null; 18063 } ); 18064 } else { 18065 disabled = $.map( this.tabs, function( li, num ) { 18066 return num !== index ? num : null; 18067 } ); 18068 } 18069 } 18070 this._setOptionDisabled( disabled ); 18071 }, 18072 18073 disable: function( index ) { 18074 var disabled = this.options.disabled; 18075 if ( disabled === true ) { 18076 return; 18077 } 18078 18079 if ( index === undefined ) { 18080 disabled = true; 18081 } else { 18082 index = this._getIndex( index ); 18083 if ( $.inArray( index, disabled ) !== -1 ) { 18084 return; 18085 } 18086 if ( $.isArray( disabled ) ) { 18087 disabled = $.merge( [ index ], disabled ).sort(); 18088 } else { 18089 disabled = [ index ]; 18090 } 18091 } 18092 this._setOptionDisabled( disabled ); 18093 }, 18094 18095 load: function( index, event ) { 18096 index = this._getIndex( index ); 18097 var that = this, 18098 tab = this.tabs.eq( index ), 18099 anchor = tab.find( ".ui-tabs-anchor" ), 18100 panel = this._getPanelForTab( tab ), 18101 eventData = { 18102 tab: tab, 18103 panel: panel 18104 }, 18105 complete = function( jqXHR, status ) { 18106 if ( status === "abort" ) { 18107 that.panels.stop( false, true ); 18108 } 18109 18110 that._removeClass( tab, "ui-tabs-loading" ); 18111 panel.removeAttr( "aria-busy" ); 18112 18113 if ( jqXHR === that.xhr ) { 18114 delete that.xhr; 18115 } 18116 }; 18117 18118 // Not remote 18119 if ( this._isLocal( anchor[ 0 ] ) ) { 18120 return; 18121 } 18122 18123 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 18124 18125 // Support: jQuery <1.8 18126 // jQuery <1.8 returns false if the request is canceled in beforeSend, 18127 // but as of 1.8, $.ajax() always returns a jqXHR object. 18128 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 18129 this._addClass( tab, "ui-tabs-loading" ); 18130 panel.attr( "aria-busy", "true" ); 18131 18132 this.xhr 18133 .done( function( response, status, jqXHR ) { 18134 18135 // support: jQuery <1.8 18136 // http://bugs.jquery.com/ticket/11778 18137 setTimeout( function() { 18138 panel.html( response ); 18139 that._trigger( "load", event, eventData ); 18140 18141 complete( jqXHR, status ); 18142 }, 1 ); 18143 } ) 18144 .fail( function( jqXHR, status ) { 18145 18146 // support: jQuery <1.8 18147 // http://bugs.jquery.com/ticket/11778 18148 setTimeout( function() { 18149 complete( jqXHR, status ); 18150 }, 1 ); 18151 } ); 18152 } 18153 }, 18154 18155 _ajaxSettings: function( anchor, event, eventData ) { 18156 var that = this; 18157 return { 18158 url: anchor.attr( "href" ), 18159 beforeSend: function( jqXHR, settings ) { 18160 return that._trigger( "beforeLoad", event, 18161 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 18162 } 18163 }; 18164 }, 18165 18166 _getPanelForTab: function( tab ) { 18167 var id = $( tab ).attr( "aria-controls" ); 18168 return this.element.find( this._sanitizeSelector( "#" + id ) ); 18169 } 18170} ); 18171 18172// DEPRECATED 18173// TODO: Switch return back to widget declaration at top of file when this is removed 18174if ( $.uiBackCompat !== false ) { 18175 18176 // Backcompat for ui-tab class (now ui-tabs-tab) 18177 $.widget( "ui.tabs", $.ui.tabs, { 18178 _processTabs: function() { 18179 this._superApply( arguments ); 18180 this._addClass( this.tabs, "ui-tab" ); 18181 } 18182 } ); 18183} 18184 18185var widgetsTabs = $.ui.tabs; 18186 18187 18188/*! 18189 * jQuery UI Tooltip 1.12.0 18190 * http://jqueryui.com 18191 * 18192 * Copyright jQuery Foundation and other contributors 18193 * Released under the MIT license. 18194 * http://jquery.org/license 18195 */ 18196 18197//>>label: Tooltip 18198//>>group: Widgets 18199//>>description: Shows additional information for any element on hover or focus. 18200//>>docs: http://api.jqueryui.com/tooltip/ 18201//>>demos: http://jqueryui.com/tooltip/ 18202//>>css.structure: ../../themes/base/core.css 18203//>>css.structure: ../../themes/base/tooltip.css 18204//>>css.theme: ../../themes/base/theme.css 18205 18206 18207 18208$.widget( "ui.tooltip", { 18209 version: "1.12.0", 18210 options: { 18211 classes: { 18212 "ui-tooltip": "ui-corner-all ui-widget-shadow" 18213 }, 18214 content: function() { 18215 18216 // support: IE<9, Opera in jQuery <1.7 18217 // .text() can't accept undefined, so coerce to a string 18218 var title = $( this ).attr( "title" ) || ""; 18219 18220 // Escape title, since we're going from an attribute to raw HTML 18221 return $( "<a>" ).text( title ).html(); 18222 }, 18223 hide: true, 18224 18225 // Disabled elements have inconsistent behavior across browsers (#8661) 18226 items: "[title]:not([disabled])", 18227 position: { 18228 my: "left top+15", 18229 at: "left bottom", 18230 collision: "flipfit flip" 18231 }, 18232 show: true, 18233 track: false, 18234 18235 // Callbacks 18236 close: null, 18237 open: null 18238 }, 18239 18240 _addDescribedBy: function( elem, id ) { 18241 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 18242 describedby.push( id ); 18243 elem 18244 .data( "ui-tooltip-id", id ) 18245 .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); 18246 }, 18247 18248 _removeDescribedBy: function( elem ) { 18249 var id = elem.data( "ui-tooltip-id" ), 18250 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 18251 index = $.inArray( id, describedby ); 18252 18253 if ( index !== -1 ) { 18254 describedby.splice( index, 1 ); 18255 } 18256 18257 elem.removeData( "ui-tooltip-id" ); 18258 describedby = $.trim( describedby.join( " " ) ); 18259 if ( describedby ) { 18260 elem.attr( "aria-describedby", describedby ); 18261 } else { 18262 elem.removeAttr( "aria-describedby" ); 18263 } 18264 }, 18265 18266 _create: function() { 18267 this._on( { 18268 mouseover: "open", 18269 focusin: "open" 18270 } ); 18271 18272 // IDs of generated tooltips, needed for destroy 18273 this.tooltips = {}; 18274 18275 // IDs of parent tooltips where we removed the title attribute 18276 this.parents = {}; 18277 18278 // Append the aria-live region so tooltips announce correctly 18279 this.liveRegion = $( "<div>" ) 18280 .attr( { 18281 role: "log", 18282 "aria-live": "assertive", 18283 "aria-relevant": "additions" 18284 } ) 18285 .appendTo( this.document[ 0 ].body ); 18286 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 18287 18288 this.disabledTitles = $( [] ); 18289 }, 18290 18291 _setOption: function( key, value ) { 18292 var that = this; 18293 18294 this._super( key, value ); 18295 18296 if ( key === "content" ) { 18297 $.each( this.tooltips, function( id, tooltipData ) { 18298 that._updateContent( tooltipData.element ); 18299 } ); 18300 } 18301 }, 18302 18303 _setOptionDisabled: function( value ) { 18304 this[ value ? "_disable" : "_enable" ](); 18305 }, 18306 18307 _disable: function() { 18308 var that = this; 18309 18310 // Close open tooltips 18311 $.each( this.tooltips, function( id, tooltipData ) { 18312 var event = $.Event( "blur" ); 18313 event.target = event.currentTarget = tooltipData.element[ 0 ]; 18314 that.close( event, true ); 18315 } ); 18316 18317 // Remove title attributes to prevent native tooltips 18318 this.disabledTitles = this.disabledTitles.add( 18319 this.element.find( this.options.items ).addBack() 18320 .filter( function() { 18321 var element = $( this ); 18322 if ( element.is( "[title]" ) ) { 18323 return element 18324 .data( "ui-tooltip-title", element.attr( "title" ) )
vendor: 4,121 bytes, lines 18325-18461
18325 .removeAttr( "title" ); 18326 } 18327 } ) 18328 ); 18329 }, 18330 18331 _enable: function() { 18332 18333 // restore title attributes 18334 this.disabledTitles.each( function() { 18335 var element = $( this ); 18336 if ( element.data( "ui-tooltip-title" ) ) { 18337 element.attr( "title", element.data( "ui-tooltip-title" ) ); 18338 } 18339 } ); 18340 this.disabledTitles = $( [] ); 18341 }, 18342 18343 open: function( event ) { 18344 var that = this, 18345 target = $( event ? event.target : this.element ) 18346 18347 // we need closest here due to mouseover bubbling, 18348 18349 // but always pointing at the same event target 18350 .closest( this.options.items ); 18351 18352 // No element to show a tooltip for or the tooltip is already open 18353 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 18354 return; 18355 } 18356 18357 if ( target.attr( "title" ) ) { 18358 target.data( "ui-tooltip-title", target.attr( "title" ) ); 18359 } 18360 18361 target.data( "ui-tooltip-open", true ); 18362 18363 // Kill parent tooltips, custom or native, for hover 18364 if ( event && event.type === "mouseover" ) { 18365 target.parents().each( function() { 18366 var parent = $( this ), 18367 blurEvent; 18368 if ( parent.data( "ui-tooltip-open" ) ) { 18369 blurEvent = $.Event( "blur" ); 18370 blurEvent.target = blurEvent.currentTarget = this; 18371 that.close( blurEvent, true ); 18372 } 18373 if ( parent.attr( "title" ) ) { 18374 parent.uniqueId(); 18375 that.parents[ this.id ] = { 18376 element: this, 18377 title: parent.attr( "title" ) 18378 }; 18379 parent.attr( "title", "" ); 18380 } 18381 } ); 18382 } 18383 18384 this._registerCloseHandlers( event, target ); 18385 this._updateContent( target, event ); 18386 }, 18387 18388 _updateContent: function( target, event ) { 18389 var content, 18390 contentOption = this.options.content, 18391 that = this, 18392 eventType = event ? event.type : null; 18393 18394 if ( typeof contentOption === "string" || contentOption.nodeType || 18395 contentOption.jquery ) { 18396 return this._open( event, target, contentOption ); 18397 } 18398 18399 content = contentOption.call( target[ 0 ], function( response ) { 18400 18401 // IE may instantly serve a cached response for ajax requests 18402 // delay this call to _open so the other call to _open runs first 18403 that._delay( function() { 18404 18405 // Ignore async response if tooltip was closed already 18406 if ( !target.data( "ui-tooltip-open" ) ) { 18407 return; 18408 } 18409 18410 // JQuery creates a special event for focusin when it doesn't 18411 // exist natively. To improve performance, the native event 18412 // object is reused and the type is changed. Therefore, we can't 18413 // rely on the type being correct after the event finished 18414 // bubbling, so we set it back to the previous value. (#8740) 18415 if ( event ) { 18416 event.type = eventType; 18417 } 18418 this._open( event, target, response ); 18419 } ); 18420 } ); 18421 if ( content ) { 18422 this._open( event, target, content ); 18423 } 18424 }, 18425 18426 _open: function( event, target, content ) { 18427 var tooltipData, tooltip, delayedShow, a11yContent, 18428 positionOption = $.extend( {}, this.options.position ); 18429 18430 if ( !content ) { 18431 return; 18432 } 18433 18434 // Content can be updated multiple times. If the tooltip already 18435 // exists, then just update the content and bail. 18436 tooltipData = this._find( target ); 18437 if ( tooltipData ) { 18438 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 18439 return; 18440 } 18441 18442 // If we have a title, clear it to prevent the native tooltip 18443 // we have to check first to avoid defining a title if none exists 18444 // (we don't want to cause an element to start matching [title]) 18445 // 18446 // We use removeAttr only for key events, to allow IE to export the correct 18447 // accessible attributes. For mouse events, set to empty string to avoid 18448 // native tooltip showing up (happens only when removing inside mouseover). 18449 if ( target.is( "[title]" ) ) { 18450 if ( event && event.type === "mouseover" ) { 18451 target.attr( "title", "" ); 18452 } else { 18453 target.removeAttr( "title" ); 18454 } 18455 } 18456 18457 tooltipData = this._tooltip( target ); 18458 tooltip = tooltipData.tooltip; 18459 this._addDescribedBy( target, tooltip.attr( "id" ) ); 18460 tooltip.find( ".ui-tooltip-content" ).html( content ); 18461
vendor: 6,798 bytes, lines 18462-18694
18462 // Support: Voiceover on OS X, JAWS on IE <= 9 18463 // JAWS announces deletions even when aria-relevant="additions" 18464 // Voiceover will sometimes re-read the entire log region's contents from the beginning 18465 this.liveRegion.children().hide(); 18466 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 18467 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 18468 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 18469 a11yContent.appendTo( this.liveRegion ); 18470 18471 function position( event ) { 18472 positionOption.of = event; 18473 if ( tooltip.is( ":hidden" ) ) { 18474 return; 18475 } 18476 tooltip.position( positionOption ); 18477 } 18478 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 18479 this._on( this.document, { 18480 mousemove: position 18481 } ); 18482 18483 // trigger once to override element-relative positioning 18484 position( event ); 18485 } else { 18486 tooltip.position( $.extend( { 18487 of: target 18488 }, this.options.position ) ); 18489 } 18490 18491 tooltip.hide(); 18492 18493 this._show( tooltip, this.options.show ); 18494 18495 // Handle tracking tooltips that are shown with a delay (#8644). As soon 18496 // as the tooltip is visible, position the tooltip using the most recent 18497 // event. 18498 // Adds the check to add the timers only when both delay and track options are set (#14682) 18499 if ( this.options.track && this.options.show && this.options.show.delay ) { 18500 delayedShow = this.delayedShow = setInterval( function() { 18501 if ( tooltip.is( ":visible" ) ) { 18502 position( positionOption.of ); 18503 clearInterval( delayedShow ); 18504 } 18505 }, $.fx.interval ); 18506 } 18507 18508 this._trigger( "open", event, { tooltip: tooltip } ); 18509 }, 18510 18511 _registerCloseHandlers: function( event, target ) { 18512 var events = { 18513 keyup: function( event ) { 18514 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 18515 var fakeEvent = $.Event( event ); 18516 fakeEvent.currentTarget = target[ 0 ]; 18517 this.close( fakeEvent, true ); 18518 } 18519 } 18520 }; 18521 18522 // Only bind remove handler for delegated targets. Non-delegated 18523 // tooltips will handle this in destroy. 18524 if ( target[ 0 ] !== this.element[ 0 ] ) { 18525 events.remove = function() { 18526 this._removeTooltip( this._find( target ).tooltip ); 18527 }; 18528 } 18529 18530 if ( !event || event.type === "mouseover" ) { 18531 events.mouseleave = "close"; 18532 } 18533 if ( !event || event.type === "focusin" ) { 18534 events.focusout = "close"; 18535 } 18536 this._on( true, target, events ); 18537 }, 18538 18539 close: function( event ) { 18540 var tooltip, 18541 that = this, 18542 target = $( event ? event.currentTarget : this.element ), 18543 tooltipData = this._find( target ); 18544 18545 // The tooltip may already be closed 18546 if ( !tooltipData ) { 18547 18548 // We set ui-tooltip-open immediately upon open (in open()), but only set the 18549 // additional data once there's actually content to show (in _open()). So even if the 18550 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 18551 // the period between open() and _open(). 18552 target.removeData( "ui-tooltip-open" ); 18553 return; 18554 } 18555 18556 tooltip = tooltipData.tooltip; 18557 18558 // Disabling closes the tooltip, so we need to track when we're closing 18559 // to avoid an infinite loop in case the tooltip becomes disabled on close 18560 if ( tooltipData.closing ) { 18561 return; 18562 } 18563 18564 // Clear the interval for delayed tracking tooltips 18565 clearInterval( this.delayedShow ); 18566 18567 // Only set title if we had one before (see comment in _open()) 18568 // If the title attribute has changed since open(), don't restore 18569 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 18570 target.attr( "title", target.data( "ui-tooltip-title" ) ); 18571 } 18572 18573 this._removeDescribedBy( target ); 18574 18575 tooltipData.hiding = true; 18576 tooltip.stop( true ); 18577 this._hide( tooltip, this.options.hide, function() { 18578 that._removeTooltip( $( this ) ); 18579 } ); 18580 18581 target.removeData( "ui-tooltip-open" ); 18582 this._off( target, "mouseleave focusout keyup" ); 18583 18584 // Remove 'remove' binding only on delegated targets 18585 if ( target[ 0 ] !== this.element[ 0 ] ) { 18586 this._off( target, "remove" ); 18587 } 18588 this._off( this.document, "mousemove" ); 18589 18590 if ( event && event.type === "mouseleave" ) { 18591 $.each( this.parents, function( id, parent ) { 18592 $( parent.element ).attr( "title", parent.title ); 18593 delete that.parents[ id ]; 18594 } ); 18595 } 18596 18597 tooltipData.closing = true; 18598 this._trigger( "close", event, { tooltip: tooltip } ); 18599 if ( !tooltipData.hiding ) { 18600 tooltipData.closing = false; 18601 } 18602 }, 18603 18604 _tooltip: function( element ) { 18605 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 18606 content = $( "<div>" ).appendTo( tooltip ), 18607 id = tooltip.uniqueId().attr( "id" ); 18608 18609 this._addClass( content, "ui-tooltip-content" ); 18610 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 18611 18612 tooltip.appendTo( this._appendTo( element ) ); 18613 18614 return this.tooltips[ id ] = { 18615 element: element, 18616 tooltip: tooltip 18617 }; 18618 }, 18619 18620 _find: function( target ) { 18621 var id = target.data( "ui-tooltip-id" ); 18622 return id ? this.tooltips[ id ] : null; 18623 }, 18624 18625 _removeTooltip: function( tooltip ) { 18626 tooltip.remove(); 18627 delete this.tooltips[ tooltip.attr( "id" ) ]; 18628 }, 18629 18630 _appendTo: function( target ) { 18631 var element = target.closest( ".ui-front, dialog" ); 18632 18633 if ( !element.length ) { 18634 element = this.document[ 0 ].body; 18635 } 18636 18637 return element; 18638 }, 18639 18640 _destroy: function() { 18641 var that = this; 18642 18643 // Close open tooltips 18644 $.each( this.tooltips, function( id, tooltipData ) { 18645 18646 // Delegate to close method to handle common cleanup 18647 var event = $.Event( "blur" ), 18648 element = tooltipData.element; 18649 event.target = event.currentTarget = element[ 0 ]; 18650 that.close( event, true ); 18651 18652 // Remove immediately; destroying an open tooltip doesn't use the 18653 // hide animation 18654 $( "#" + id ).remove(); 18655 18656 // Restore the title 18657 if ( element.data( "ui-tooltip-title" ) ) { 18658 18659 // If the title attribute has changed since open(), don't restore 18660 if ( !element.attr( "title" ) ) { 18661 element.attr( "title", element.data( "ui-tooltip-title" ) ); 18662 } 18663 element.removeData( "ui-tooltip-title" ); 18664 } 18665 } ); 18666 this.liveRegion.remove(); 18667 } 18668} ); 18669 18670// DEPRECATED 18671// TODO: Switch return back to widget declaration at top of file when this is removed 18672if ( $.uiBackCompat !== false ) { 18673 18674 // Backcompat for tooltipClass option 18675 $.widget( "ui.tooltip", $.ui.tooltip, { 18676 options: { 18677 tooltipClass: null 18678 }, 18679 _tooltip: function() { 18680 var tooltipData = this._superApply( arguments ); 18681 if ( this.options.tooltipClass ) { 18682 tooltipData.tooltip.addClass( this.options.tooltipClass ); 18683 } 18684 return tooltipData; 18685 } 18686 } ); 18687} 18688 18689var widgetsTooltip = $.ui.tooltip; 18690 18691 18692 18693 18694}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.