vendor: 20,586 bytes, lines 1-730
1/*! jQuery UI - v1.12.1 - 2021-11-08 2* http://jqueryui.com 3* Includes: widget.js, data.js, jquery-1-7.js, scroll-parent.js, unique-id.js, widgets/draggable.js, widgets/mouse.js 4* Copyright jQuery Foundation and other contributors; Licensed MIT 5* 2021-11-08 JJY :: ëëê·¸ìë§ ì°ì´ë ì¤í¬ë¦½í¸ë§ ì¶ë ¤ì ì 리 í¨ */ 6 7(function( factory ) { 8 if ( typeof define === "function" && define.amd ) { 9 10 // AMD. Register as an anonymous module. 11 define([ "jquery" ], factory ); 12 } else { 13 14 // Browser globals 15 factory( jQuery ); 16 } 17}(function( $ ) { 18 19$.ui = $.ui || {}; 20 21var version = $.ui.version = "1.12.1"; 22 23 24/*! 25 * jQuery UI Widget 1.12.1 26 * http://jqueryui.com 27 * 28 * Copyright jQuery Foundation and other contributors 29 * Released under the MIT license. 30 * http://jquery.org/license 31 */ 32 33//>>label: Widget 34//>>group: Core 35//>>description: Provides a factory for creating stateful widgets with a common API. 36//>>docs: http://api.jqueryui.com/jQuery.widget/ 37//>>demos: http://jqueryui.com/widget/ 38 39 40 41var widgetUuid = 0; 42var widgetSlice = Array.prototype.slice; 43 44$.cleanData = ( function( orig ) { 45 return function( elems ) { 46 var events, elem, i; 47 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 48 try { 49 50 // Only trigger remove when necessary to save time 51 events = $._data( elem, "events" ); 52 if ( events && events.remove ) { 53 $( elem ).triggerHandler( "remove" ); 54 } 55 56 // Http://bugs.jquery.com/ticket/8235 57 } catch ( e ) {} 58 } 59 orig( elems ); 60 }; 61} )( $.cleanData ); 62 63$.widget = function( name, base, prototype ) { 64 var existingConstructor, constructor, basePrototype; 65 66 // ProxiedPrototype allows the provided prototype to remain unmodified 67 // so that it can be used as a mixin for multiple widgets (#8876) 68 var proxiedPrototype = {}; 69 70 var namespace = name.split( "." )[ 0 ]; 71 name = name.split( "." )[ 1 ]; 72 var fullName = namespace + "-" + name; 73 74 if ( !prototype ) { 75 prototype = base; 76 base = $.Widget; 77 } 78 79 if ( $.isArray( prototype ) ) { 80 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 81 } 82 83 // Create selector for plugin 84 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 85 return !!$.data( elem, fullName ); 86 }; 87 88 $[ namespace ] = $[ namespace ] || {}; 89 existingConstructor = $[ namespace ][ name ]; 90 constructor = $[ namespace ][ name ] = function( options, element ) { 91 92 // Allow instantiation without "new" keyword 93 if ( !this._createWidget ) { 94 return new constructor( options, element ); 95 } 96 97 // Allow instantiation without initializing for simple inheritance 98 // must use "new" keyword (the code above always passes args) 99 if ( arguments.length ) { 100 this._createWidget( options, element ); 101 } 102 }; 103 104 // Extend with the existing constructor to carry over any static properties 105 $.extend( constructor, existingConstructor, { 106 version: prototype.version, 107 108 // Copy the object used to create the prototype in case we need to 109 // redefine the widget later 110 _proto: $.extend( {}, prototype ), 111 112 // Track widgets that inherit from this widget in case this widget is 113 // redefined after a widget inherits from it 114 _childConstructors: [] 115 } ); 116 117 basePrototype = new base(); 118 119 // We need to make the options hash a property directly on the new instance 120 // otherwise we'll modify the options hash on the prototype that we're 121 // inheriting from 122 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 123 $.each( prototype, function( prop, value ) { 124 if ( !$.isFunction( value ) ) { 125 proxiedPrototype[ prop ] = value; 126 return; 127 } 128 proxiedPrototype[ prop ] = ( function() { 129 function _super() { 130 return base.prototype[ prop ].apply( this, arguments ); 131 } 132 133 function _superApply( args ) { 134 return base.prototype[ prop ].apply( this, args ); 135 } 136 137 return function() { 138 var __super = this._super; 139 var __superApply = this._superApply; 140 var returnValue; 141 142 this._super = _super; 143 this._superApply = _superApply; 144 145 returnValue = value.apply( this, arguments ); 146 147 this._super = __super; 148 this._superApply = __superApply; 149 150 return returnValue; 151 }; 152 } )(); 153 } ); 154 constructor.prototype = $.widget.extend( basePrototype, { 155 156 // TODO: remove support for widgetEventPrefix 157 // always use the name + a colon as the prefix, e.g., draggable:start 158 // don't prefix for widgets that aren't DOM-based 159 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 160 }, proxiedPrototype, { 161 constructor: constructor, 162 namespace: namespace, 163 widgetName: name, 164 widgetFullName: fullName 165 } ); 166 167 // If this widget is being redefined then we need to find all widgets that 168 // are inheriting from it and redefine all of them so that they inherit from 169 // the new version of this widget. We're essentially trying to replace one 170 // level in the prototype chain. 171 if ( existingConstructor ) { 172 $.each( existingConstructor._childConstructors, function( i, child ) { 173 var childPrototype = child.prototype; 174 175 // Redefine the child widget using the same prototype that was 176 // originally used, but inherit from the new version of the base 177 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 178 child._proto ); 179 } ); 180 181 // Remove the list of existing child constructors from the old constructor 182 // so the old child constructors can be garbage collected 183 delete existingConstructor._childConstructors; 184 } else { 185 base._childConstructors.push( constructor ); 186 } 187 188 $.widget.bridge( name, constructor ); 189 190 return constructor; 191}; 192 193$.widget.extend = function( target ) { 194 var input = widgetSlice.call( arguments, 1 ); 195 var inputIndex = 0; 196 var inputLength = input.length; 197 var key; 198 var value; 199 200 for ( ; inputIndex < inputLength; inputIndex++ ) { 201 for ( key in input[ inputIndex ] ) { 202 value = input[ inputIndex ][ key ]; 203 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 204 205 // Clone objects 206 if ( $.isPlainObject( value ) ) { 207 target[ key ] = $.isPlainObject( target[ key ] ) ? 208 $.widget.extend( {}, target[ key ], value ) : 209 210 // Don't extend strings, arrays, etc. with objects 211 $.widget.extend( {}, value ); 212 213 // Copy everything else by reference 214 } else { 215 target[ key ] = value; 216 } 217 } 218 } 219 } 220 return target; 221}; 222 223$.widget.bridge = function( name, object ) { 224 var fullName = object.prototype.widgetFullName || name; 225 $.fn[ name ] = function( options ) { 226 var isMethodCall = typeof options === "string"; 227 var args = widgetSlice.call( arguments, 1 ); 228 var returnValue = this; 229 230 if ( isMethodCall ) { 231 232 // If this is an empty collection, we need to have the instance method 233 // return undefined instead of the jQuery instance 234 if ( !this.length && options === "instance" ) { 235 returnValue = undefined; 236 } else { 237 this.each( function() { 238 var methodValue; 239 var instance = $.data( this, fullName ); 240 241 if ( options === "instance" ) { 242 returnValue = instance; 243 return false; 244 } 245 246 if ( !instance ) { 247 return $.error( "cannot call methods on " + name + 248 " prior to initialization; " + 249 "attempted to call method '" + options + "'" ); 250 } 251 252 if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { 253 return $.error( "no such method '" + options + "' for " + name + 254 " widget instance" ); 255 } 256 257 methodValue = instance[ options ].apply( instance, args ); 258 259 if ( methodValue !== instance && methodValue !== undefined ) { 260 returnValue = methodValue && methodValue.jquery ? 261 returnValue.pushStack( methodValue.get() ) : 262 methodValue; 263 return false; 264 } 265 } ); 266 } 267 } else { 268 269 // Allow multiple hashes to be passed on init 270 if ( args.length ) { 271 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 272 } 273 274 this.each( function() { 275 var instance = $.data( this, fullName ); 276 if ( instance ) { 277 instance.option( options || {} ); 278 if ( instance._init ) { 279 instance._init(); 280 } 281 } else { 282 $.data( this, fullName, new object( options, this ) ); 283 } 284 } ); 285 } 286 287 return returnValue; 288 }; 289}; 290 291$.Widget = function( /* options, element */ ) {}; 292$.Widget._childConstructors = []; 293 294$.Widget.prototype = { 295 widgetName: "widget", 296 widgetEventPrefix: "", 297 defaultElement: "<div>", 298 299 options: { 300 classes: {}, 301 disabled: false, 302 303 // Callbacks 304 create: null 305 }, 306 307 _createWidget: function( options, element ) { 308 element = $( element || this.defaultElement || this )[ 0 ]; 309 this.element = $( element ); 310 this.uuid = widgetUuid++; 311 this.eventNamespace = "." + this.widgetName + this.uuid; 312 313 this.bindings = $(); 314 this.hoverable = $(); 315 this.focusable = $(); 316 this.classesElementLookup = {}; 317 318 if ( element !== this ) { 319 $.data( element, this.widgetFullName, this ); 320 this._on( true, this.element, { 321 remove: function( event ) { 322 if ( event.target === element ) { 323 this.destroy(); 324 } 325 } 326 } ); 327 this.document = $( element.style ? 328 329 // Element within the document 330 element.ownerDocument : 331 332 // Element is window or document 333 element.document || element ); 334 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 335 } 336 337 this.options = $.widget.extend( {}, 338 this.options, 339 this._getCreateOptions(), 340 options ); 341 342 this._create(); 343 344 if ( this.options.disabled ) { 345 this._setOptionDisabled( this.options.disabled ); 346 } 347 348 this._trigger( "create", null, this._getCreateEventData() ); 349 this._init(); 350 }, 351 352 _getCreateOptions: function() { 353 return {}; 354 }, 355 356 _getCreateEventData: $.noop, 357 358 _create: $.noop, 359 360 _init: $.noop, 361 362 destroy: function() { 363 var that = this; 364 365 this._destroy(); 366 $.each( this.classesElementLookup, function( key, value ) { 367 that._removeClass( value, key ); 368 } ); 369 370 // We can probably remove the unbind calls in 2.0 371 // all event bindings should go through this._on() 372 this.element 373 .off( this.eventNamespace ) 374 .removeData( this.widgetFullName ); 375 this.widget() 376 .off( this.eventNamespace ) 377 .removeAttr( "aria-disabled" ); 378 379 // Clean up events and states 380 this.bindings.off( this.eventNamespace ); 381 }, 382 383 _destroy: $.noop, 384 385 widget: function() { 386 return this.element; 387 }, 388 389 option: function( key, value ) { 390 var options = key; 391 var parts; 392 var curOption; 393 var i; 394 395 if ( arguments.length === 0 ) { 396 397 // Don't return a reference to the internal hash 398 return $.widget.extend( {}, this.options ); 399 } 400 401 if ( typeof key === "string" ) { 402 403 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 404 options = {}; 405 parts = key.split( "." ); 406 key = parts.shift(); 407 if ( parts.length ) { 408 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 409 for ( i = 0; i < parts.length - 1; i++ ) { 410 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 411 curOption = curOption[ parts[ i ] ]; 412 } 413 key = parts.pop(); 414 if ( arguments.length === 1 ) { 415 return curOption[ key ] === undefined ? null : curOption[ key ]; 416 } 417 curOption[ key ] = value; 418 } else { 419 if ( arguments.length === 1 ) { 420 return this.options[ key ] === undefined ? null : this.options[ key ]; 421 } 422 options[ key ] = value; 423 } 424 } 425 426 this._setOptions( options ); 427 428 return this; 429 }, 430 431 _setOptions: function( options ) { 432 var key; 433 434 for ( key in options ) { 435 this._setOption( key, options[ key ] ); 436 } 437 438 return this; 439 }, 440 441 _setOption: function( key, value ) { 442 if ( key === "classes" ) { 443 this._setOptionClasses( value ); 444 } 445 446 this.options[ key ] = value; 447 448 if ( key === "disabled" ) { 449 this._setOptionDisabled( value ); 450 } 451 452 return this; 453 }, 454 455 _setOptionClasses: function( value ) { 456 var classKey, elements, currentElements; 457 458 for ( classKey in value ) { 459 currentElements = this.classesElementLookup[ classKey ]; 460 if ( value[ classKey ] === this.options.classes[ classKey ] || 461 !currentElements || 462 !currentElements.length ) { 463 continue; 464 } 465 466 // We are doing this to create a new jQuery object because the _removeClass() call 467 // on the next line is going to destroy the reference to the current elements being 468 // tracked. We need to save a copy of this collection so that we can add the new classes 469 // below. 470 elements = $( currentElements.get() ); 471 this._removeClass( currentElements, classKey ); 472 473 // We don't use _addClass() here, because that uses this.options.classes 474 // for generating the string of classes. We want to use the value passed in from 475 // _setOption(), this is the new value of the classes option which was passed to 476 // _setOption(). We pass this value directly to _classes(). 477 elements.addClass( this._classes( { 478 element: elements, 479 keys: classKey, 480 classes: value, 481 add: true 482 } ) ); 483 } 484 }, 485 486 _setOptionDisabled: function( value ) { 487 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 488 489 // If the widget is becoming disabled, then nothing is interactive 490 if ( value ) { 491 this._removeClass( this.hoverable, null, "ui-state-hover" ); 492 this._removeClass( this.focusable, null, "ui-state-focus" ); 493 } 494 }, 495 496 enable: function() { 497 return this._setOptions( { disabled: false } ); 498 }, 499 500 disable: function() { 501 return this._setOptions( { disabled: true } ); 502 }, 503 504 _classes: function( options ) { 505 var full = []; 506 var that = this; 507 508 options = $.extend( { 509 element: this.element, 510 classes: this.options.classes || {} 511 }, options ); 512 513 function processClassString( classes, checkOption ) { 514 var current, i; 515 for ( i = 0; i < classes.length; i++ ) { 516 current = that.classesElementLookup[ classes[ i ] ] || $(); 517 if ( options.add ) { 518 current = $( $.unique( current.get().concat( options.element.get() ) ) ); 519 } else { 520 current = $( current.not( options.element ).get() ); 521 } 522 that.classesElementLookup[ classes[ i ] ] = current; 523 full.push( classes[ i ] ); 524 if ( checkOption && options.classes[ classes[ i ] ] ) { 525 full.push( options.classes[ classes[ i ] ] ); 526 } 527 } 528 } 529 530 this._on( options.element, { 531 "remove": "_untrackClassesElement" 532 } ); 533 534 if ( options.keys ) { 535 processClassString( options.keys.match( /\S+/g ) || [], true ); 536 } 537 if ( options.extra ) { 538 processClassString( options.extra.match( /\S+/g ) || [] ); 539 } 540 541 return full.join( " " ); 542 }, 543 544 _untrackClassesElement: function( event ) { 545 var that = this; 546 $.each( that.classesElementLookup, function( key, value ) { 547 if ( $.inArray( event.target, value ) !== -1 ) { 548 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 549 } 550 } ); 551 }, 552 553 _removeClass: function( element, keys, extra ) { 554 return this._toggleClass( element, keys, extra, false ); 555 }, 556 557 _addClass: function( element, keys, extra ) { 558 return this._toggleClass( element, keys, extra, true ); 559 }, 560 561 _toggleClass: function( element, keys, extra, add ) { 562 add = ( typeof add === "boolean" ) ? add : extra; 563 var shift = ( typeof element === "string" || element === null ), 564 options = { 565 extra: shift ? keys : extra, 566 keys: shift ? element : keys, 567 element: shift ? this.element : element, 568 add: add 569 }; 570 options.element.toggleClass( this._classes( options ), add ); 571 return this; 572 }, 573 574 _on: function( suppressDisabledCheck, element, handlers ) { 575 var delegateElement; 576 var instance = this; 577 578 // No suppressDisabledCheck flag, shuffle arguments 579 if ( typeof suppressDisabledCheck !== "boolean" ) { 580 handlers = element; 581 element = suppressDisabledCheck; 582 suppressDisabledCheck = false; 583 } 584 585 // No element argument, shuffle and use this.element 586 if ( !handlers ) { 587 handlers = element; 588 element = this.element; 589 delegateElement = this.widget(); 590 } else { 591 element = delegateElement = $( element ); 592 this.bindings = this.bindings.add( element ); 593 } 594 595 $.each( handlers, function( event, handler ) { 596 function handlerProxy() { 597 598 // Allow widgets to customize the disabled handling 599 // - disabled as an array instead of boolean 600 // - disabled class as method for disabling individual parts 601 if ( !suppressDisabledCheck && 602 ( instance.options.disabled === true || 603 $( this ).hasClass( "ui-state-disabled" ) ) ) { 604 return; 605 } 606 return ( typeof handler === "string" ? instance[ handler ] : handler ) 607 .apply( instance, arguments ); 608 } 609 610 // Copy the guid so direct unbinding works 611 if ( typeof handler !== "string" ) { 612 handlerProxy.guid = handler.guid = 613 handler.guid || handlerProxy.guid || $.guid++; 614 } 615 616 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 617 var eventName = match[ 1 ] + instance.eventNamespace; 618 var selector = match[ 2 ]; 619 620 if ( selector ) { 621 delegateElement.on( eventName, selector, handlerProxy ); 622 } else { 623 element.on( eventName, handlerProxy ); 624 } 625 } ); 626 }, 627 628 _off: function( element, eventName ) { 629 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 630 this.eventNamespace; 631 element.off( eventName ).off( eventName ); 632 633 // Clear the stack to avoid memory leaks (#10056) 634 this.bindings = $( this.bindings.not( element ).get() ); 635 this.focusable = $( this.focusable.not( element ).get() ); 636 this.hoverable = $( this.hoverable.not( element ).get() ); 637 }, 638 639 _delay: function( handler, delay ) { 640 function handlerProxy() { 641 return ( typeof handler === "string" ? instance[ handler ] : handler ) 642 .apply( instance, arguments ); 643 } 644 var instance = this; 645 return setTimeout( handlerProxy, delay || 0 ); 646 }, 647 648 _hoverable: function( element ) { 649 this.hoverable = this.hoverable.add( element ); 650 this._on( element, { 651 mouseenter: function( event ) { 652 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 653 }, 654 mouseleave: function( event ) { 655 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 656 } 657 } ); 658 }, 659 660 _focusable: function( element ) { 661 this.focusable = this.focusable.add( element ); 662 this._on( element, { 663 focusin: function( event ) { 664 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 665 }, 666 focusout: function( event ) { 667 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 668 } 669 } ); 670 }, 671 672 _trigger: function( type, event, data ) { 673 var prop, orig; 674 var callback = this.options[ type ]; 675 676 data = data || {}; 677 event = $.Event( event ); 678 event.type = ( type === this.widgetEventPrefix ? 679 type : 680 this.widgetEventPrefix + type ).toLowerCase(); 681 682 // The original event may come from any element 683 // so we need to reset the target on the new event 684 event.target = this.element[ 0 ]; 685 686 // Copy original event properties over to the new event 687 orig = event.originalEvent; 688 if ( orig ) { 689 for ( prop in orig ) { 690 if ( !( prop in event ) ) { 691 event[ prop ] = orig[ prop ]; 692 } 693 } 694 } 695 696 this.element.trigger( event, data ); 697 return !( $.isFunction( callback ) && 698 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 699 event.isDefaultPrevented() ); 700 } 701}; 702 703$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 704 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 705 if ( typeof options === "string" ) { 706 options = { effect: options }; 707 } 708 709 var hasOptions; 710 var effectName = !options ? 711 method : 712 options === true || typeof options === "number" ? 713 defaultEffect : 714 options.effect || defaultEffect; 715 716 options = options || {}; 717 if ( typeof options === "number" ) { 718 options = { duration: options }; 719 } 720 721 hasOptions = !$.isEmptyObject( options ); 722 options.complete = callback; 723 724 if ( options.delay ) { 725 element.delay( options.delay ); 726 } 727 728 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 729 element[ method ]( options ); 730 } else if ( effectName !== method && element[ effectName ] ) {
vendor: 4,434 bytes, lines 731-892
731 element[ effectName ]( options.duration, options.easing, callback ); 732 } else { 733 element.queue( function( next ) { 734 $( this )[ method ](); 735 if ( callback ) { 736 callback.call( element[ 0 ] ); 737 } 738 next(); 739 } ); 740 } 741 }; 742} ); 743 744var widget = $.widget; 745 746 747/*! 748 * jQuery UI :data 1.12.1 749 * http://jqueryui.com 750 * 751 * Copyright jQuery Foundation and other contributors 752 * Released under the MIT license. 753 * http://jquery.org/license 754 */ 755 756//>>label: :data Selector 757//>>group: Core 758//>>description: Selects elements which have data stored under the specified key. 759//>>docs: http://api.jqueryui.com/data-selector/ 760 761 762var data = $.extend( $.expr[ ":" ], { 763 data: $.expr.createPseudo ? 764 $.expr.createPseudo( function( dataName ) { 765 return function( elem ) { 766 return !!$.data( elem, dataName ); 767 }; 768 } ) : 769 770 // Support: jQuery <1.8 771 function( elem, i, match ) { 772 return !!$.data( elem, match[ 3 ] ); 773 } 774} ); 775 776/*! 777 * jQuery UI Support for jQuery core 1.7.x 1.12.1 778 * http://jqueryui.com 779 * 780 * Copyright jQuery Foundation and other contributors 781 * Released under the MIT license. 782 * http://jquery.org/license 783 * 784 */ 785 786//>>label: jQuery 1.7 Support 787//>>group: Core 788//>>description: Support version 1.7.x of jQuery core 789 790 791 792// Support: jQuery 1.7 only 793// Not a great way to check versions, but since we only support 1.7+ and only 794// need to detect <1.8, this is a simple check that should suffice. Checking 795// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 796// and we'll never reach 1.70.0 (if we do, we certainly won't be supporting 797// 1.7 anymore). See #11197 for why we're not using feature detection. 798if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) { 799 800 // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() 801 // Unlike jQuery Core 1.8+, these only support numeric values to set the 802 // dimensions in pixels 803 $.each( [ "Width", "Height" ], function( i, name ) { 804 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 805 type = name.toLowerCase(), 806 orig = { 807 innerWidth: $.fn.innerWidth, 808 innerHeight: $.fn.innerHeight, 809 outerWidth: $.fn.outerWidth, 810 outerHeight: $.fn.outerHeight 811 }; 812 813 function reduce( elem, size, border, margin ) { 814 $.each( side, function() { 815 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 816 if ( border ) { 817 size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 818 } 819 if ( margin ) { 820 size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 821 } 822 } ); 823 return size; 824 } 825 826 $.fn[ "inner" + name ] = function( size ) { 827 if ( size === undefined ) { 828 return orig[ "inner" + name ].call( this ); 829 } 830 831 return this.each( function() { 832 $( this ).css( type, reduce( this, size ) + "px" ); 833 } ); 834 }; 835 836 $.fn[ "outer" + name ] = function( size, margin ) { 837 if ( typeof size !== "number" ) { 838 return orig[ "outer" + name ].call( this, size ); 839 } 840 841 return this.each( function() { 842 $( this ).css( type, reduce( this, size, true, margin ) + "px" ); 843 } ); 844 }; 845 } ); 846 847 $.fn.addBack = function( selector ) { 848 return this.add( selector == null ? 849 this.prevObject : this.prevObject.filter( selector ) 850 ); 851 }; 852} 853 854; 855/*! 856 * jQuery UI Scroll Parent 1.12.1 857 * http://jqueryui.com 858 * 859 * Copyright jQuery Foundation and other contributors 860 * Released under the MIT license. 861 * http://jquery.org/license 862 */ 863 864//>>label: scrollParent 865//>>group: Core 866//>>description: Get the closest ancestor element that is scrollable. 867//>>docs: http://api.jqueryui.com/scrollParent/ 868 869 870 871var scrollParent = $.fn.scrollParent = function( includeHidden ) { 872 var position = this.css( "position" ), 873 excludeStaticParent = position === "absolute", 874 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 875 scrollParent = this.parents().filter( function() { 876 var parent = $( this ); 877 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 878 return false; 879 } 880 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 881 parent.css( "overflow-x" ) ); 882 } ).eq( 0 ); 883 884 return position === "fixed" || !scrollParent.length ? 885 $( this[ 0 ].ownerDocument || document ) : 886 scrollParent; 887}; 888 889 890/*! 891 * jQuery UI Unique ID 1.12.1 892 * http://jqueryui.com
vendor: 8,773 bytes, lines 893-1222
893 * 894 * Copyright jQuery Foundation and other contributors 895 * Released under the MIT license. 896 * http://jquery.org/license 897 */ 898 899//>>label: uniqueId 900//>>group: Core 901//>>description: Functions to generate and remove uniqueId's 902//>>docs: http://api.jqueryui.com/uniqueId/ 903 904 905 906var uniqueId = $.fn.extend( { 907 uniqueId: ( function() { 908 var uuid = 0; 909 910 return function() { 911 return this.each( function() { 912 if ( !this.id ) { 913 this.id = "ui-id-" + ( ++uuid ); 914 } 915 } ); 916 }; 917 } )(), 918 919 removeUniqueId: function() { 920 return this.each( function() { 921 if ( /^ui-id-\d+$/.test( this.id ) ) { 922 $( this ).removeAttr( "id" ); 923 } 924 } ); 925 } 926} ); 927 928 929 930 931// This file is deprecated 932var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 933 934/*! 935 * jQuery UI Mouse 1.12.1 936 * http://jqueryui.com 937 * 938 * Copyright jQuery Foundation and other contributors 939 * Released under the MIT license. 940 * http://jquery.org/license 941 */ 942 943//>>label: Mouse 944//>>group: Widgets 945//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 946//>>docs: http://api.jqueryui.com/mouse/ 947 948 949 950var mouseHandled = false; 951$( document ).on( "mouseup", function() { 952 mouseHandled = false; 953} ); 954 955var widgetsMouse = $.widget( "ui.mouse", { 956 version: "1.12.1", 957 options: { 958 cancel: "input, textarea, button, select, option", 959 distance: 1, 960 delay: 0 961 }, 962 _mouseInit: function() { 963 var that = this; 964 965 this.element 966 .on( "mousedown." + this.widgetName, function( event ) { 967 return that._mouseDown( event ); 968 } ) 969 .on( "click." + this.widgetName, function( event ) { 970 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 971 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 972 event.stopImmediatePropagation(); 973 return false; 974 } 975 } ); 976 977 this.started = false; 978 }, 979 980 // TODO: make sure destroying one instance of mouse doesn't mess with 981 // other instances of mouse 982 _mouseDestroy: function() { 983 this.element.off( "." + this.widgetName ); 984 if ( this._mouseMoveDelegate ) { 985 this.document 986 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 987 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 988 } 989 }, 990 991 _mouseDown: function( event ) { 992 993 // don't let more than one widget handle mouseStart 994 if ( mouseHandled ) { 995 return; 996 } 997 998 this._mouseMoved = false; 999 1000 // We may have missed mouseup (out of window) 1001 ( this._mouseStarted && this._mouseUp( event ) ); 1002 1003 this._mouseDownEvent = event; 1004 1005 var that = this, 1006 btnIsLeft = ( event.which === 1 ), 1007 1008 // event.target.nodeName works around a bug in IE 8 with 1009 // disabled inputs (#7620) 1010 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 1011 $( event.target ).closest( this.options.cancel ).length : false ); 1012 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 1013 return true; 1014 } 1015 1016 this.mouseDelayMet = !this.options.delay; 1017 if ( !this.mouseDelayMet ) { 1018 this._mouseDelayTimer = setTimeout( function() { 1019 that.mouseDelayMet = true; 1020 }, this.options.delay ); 1021 } 1022 1023 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1024 this._mouseStarted = ( this._mouseStart( event ) !== false ); 1025 if ( !this._mouseStarted ) { 1026 event.preventDefault(); 1027 return true; 1028 } 1029 } 1030 1031 // Click event may never have fired (Gecko & Opera) 1032 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 1033 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 1034 } 1035 1036 // These delegates are required to keep context 1037 this._mouseMoveDelegate = function( event ) { 1038 return that._mouseMove( event ); 1039 }; 1040 this._mouseUpDelegate = function( event ) { 1041 return that._mouseUp( event ); 1042 }; 1043 1044 this.document 1045 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1046 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1047 1048 event.preventDefault(); 1049 1050 mouseHandled = true; 1051 return true; 1052 }, 1053 1054 _mouseMove: function( event ) { 1055 1056 // Only check for mouseups outside the document if you've moved inside the document 1057 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 1058 // fire a mousemove event if content is placed under the cursor. See #7778 1059 // Support: IE <9 1060 if ( this._mouseMoved ) { 1061 1062 // IE mouseup check - mouseup happened when mouse was out of window 1063 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 1064 !event.button ) { 1065 return this._mouseUp( event ); 1066 1067 // Iframe mouseup check - mouseup occurred in another document 1068 } else if ( !event.which ) { 1069 1070 // Support: Safari <=8 - 9 1071 // Safari sets which to 0 if you press any of the following keys 1072 // during a drag (#14461) 1073 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 1074 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 1075 this.ignoreMissingWhich = true; 1076 } else if ( !this.ignoreMissingWhich ) { 1077 return this._mouseUp( event ); 1078 } 1079 } 1080 } 1081 1082 if ( event.which || event.button ) { 1083 this._mouseMoved = true; 1084 } 1085 1086 if ( this._mouseStarted ) { 1087 this._mouseDrag( event ); 1088 return event.preventDefault(); 1089 } 1090 1091 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1092 this._mouseStarted = 1093 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 1094 ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) ); 1095 } 1096 1097 return !this._mouseStarted; 1098 }, 1099 1100 _mouseUp: function( event ) { 1101 this.document 1102 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1103 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1104 1105 if ( this._mouseStarted ) { 1106 this._mouseStarted = false; 1107 1108 if ( event.target === this._mouseDownEvent.target ) { 1109 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 1110 } 1111 1112 this._mouseStop( event ); 1113 } 1114 1115 if ( this._mouseDelayTimer ) { 1116 clearTimeout( this._mouseDelayTimer ); 1117 delete this._mouseDelayTimer; 1118 } 1119 1120 this.ignoreMissingWhich = false; 1121 mouseHandled = false; 1122 event.preventDefault(); 1123 }, 1124 1125 _mouseDistanceMet: function( event ) { 1126 return ( Math.max( 1127 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 1128 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 1129 ) >= this.options.distance 1130 ); 1131 }, 1132 1133 _mouseDelayMet: function( /* event */ ) { 1134 return this.mouseDelayMet; 1135 }, 1136 1137 // These are placeholder methods, to be overriden by extending plugin 1138 _mouseStart: function( /* event */ ) {}, 1139 _mouseDrag: function( /* event */ ) {}, 1140 _mouseStop: function( /* event */ ) {}, 1141 _mouseCapture: function( /* event */ ) { return true; } 1142} ); 1143 1144 1145 1146 1147// $.ui.plugin is deprecated. Use $.widget() extensions instead. 1148var plugin = $.ui.plugin = { 1149 add: function( module, option, set ) { 1150 var i, 1151 proto = $.ui[ module ].prototype; 1152 for ( i in set ) { 1153 proto.plugins[ i ] = proto.plugins[ i ] || []; 1154 proto.plugins[ i ].push( [ option, set[ i ] ] ); 1155 } 1156 }, 1157 call: function( instance, name, args, allowDisconnected ) { 1158 var i, 1159 set = instance.plugins[ name ]; 1160 1161 if ( !set ) { 1162 return; 1163 } 1164 1165 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 1166 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 1167 return; 1168 } 1169 1170 for ( i = 0; i < set.length; i++ ) { 1171 if ( instance.options[ set[ i ][ 0 ] ] ) { 1172 set[ i ][ 1 ].apply( instance.element, args ); 1173 } 1174 } 1175 } 1176}; 1177 1178 1179 1180var safeActiveElement = $.ui.safeActiveElement = function( document ) { 1181 var activeElement; 1182 1183 // Support: IE 9 only 1184 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 1185 try { 1186 activeElement = document.activeElement; 1187 } catch ( error ) { 1188 activeElement = document.body; 1189 } 1190 1191 // Support: IE 9 - 11 only 1192 // IE may return null instead of an element 1193 // Interestingly, this only seems to occur when NOT in an iframe 1194 if ( !activeElement ) { 1195 activeElement = document.body; 1196 } 1197 1198 // Support: IE 11 only 1199 // IE11 returns a seemingly empty object in some cases when accessing 1200 // document.activeElement from an <iframe> 1201 if ( !activeElement.nodeName ) { 1202 activeElement = document.body; 1203 } 1204 1205 return activeElement; 1206}; 1207 1208 1209 1210var safeBlur = $.ui.safeBlur = function( element ) { 1211 1212 // Support: IE9 - 10 only 1213 // If the <body> is blurred, IE will switch windows, see #9420 1214 if ( element && element.nodeName.toLowerCase() !== "body" ) { 1215 $( element ).trigger( "blur" ); 1216 } 1217}; 1218 1219 1220/*! 1221 * jQuery UI Draggable 1.12.1 1222 * http://jqueryui.com
vendor: 4,141 bytes, lines 1223-1391
1223 * 1224 * Copyright jQuery Foundation and other contributors 1225 * Released under the MIT license. 1226 * http://jquery.org/license 1227 */ 1228 1229//>>label: Draggable 1230//>>group: Interactions 1231//>>description: Enables dragging functionality for any element. 1232//>>docs: http://api.jqueryui.com/draggable/ 1233//>>demos: http://jqueryui.com/draggable/ 1234//>>css.structure: ../../themes/base/draggable.css 1235 1236 1237 1238$.widget( "ui.draggable", $.ui.mouse, { 1239 version: "1.12.1", 1240 widgetEventPrefix: "drag", 1241 options: { 1242 addClasses: true, 1243 appendTo: "parent", 1244 axis: false, 1245 connectToSortable: false, 1246 containment: false, 1247 cursor: "auto", 1248 cursorAt: false, 1249 grid: false, 1250 handle: false, 1251 helper: "original", 1252 iframeFix: false, 1253 opacity: false, 1254 refreshPositions: false, 1255 revert: false, 1256 revertDuration: 500, 1257 scope: "default", 1258 scroll: true, 1259 scrollSensitivity: 20, 1260 scrollSpeed: 20, 1261 snap: false, 1262 snapMode: "both", 1263 snapTolerance: 20, 1264 stack: false, 1265 zIndex: false, 1266 1267 // Callbacks 1268 drag: null, 1269 start: null, 1270 stop: null 1271 }, 1272 _create: function() { 1273 1274 if ( this.options.helper === "original" ) { 1275 this._setPositionRelative(); 1276 } 1277 if ( this.options.addClasses ) { 1278 this._addClass( "ui-draggable" ); 1279 } 1280 this._setHandleClassName(); 1281 1282 this._mouseInit(); 1283 }, 1284 1285 _setOption: function( key, value ) { 1286 this._super( key, value ); 1287 if ( key === "handle" ) { 1288 this._removeHandleClassName(); 1289 this._setHandleClassName(); 1290 } 1291 }, 1292 1293 _destroy: function() { 1294 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 1295 this.destroyOnClear = true; 1296 return; 1297 } 1298 this._removeHandleClassName(); 1299 this._mouseDestroy(); 1300 }, 1301 1302 _mouseCapture: function( event ) { 1303 var o = this.options; 1304 1305 // Among others, prevent a drag on a resizable-handle 1306 if ( this.helper || o.disabled || 1307 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 1308 return false; 1309 } 1310 1311 //Quit if we're not on a valid handle 1312 this.handle = this._getHandle( event ); 1313 if ( !this.handle ) { 1314 return false; 1315 } 1316 1317 this._blurActiveElement( event ); 1318 1319 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 1320 1321 return true; 1322 1323 }, 1324 1325 _blockFrames: function( selector ) { 1326 this.iframeBlocks = this.document.find( selector ).map( function() { 1327 var iframe = $( this ); 1328 1329 return $( "<div>" ) 1330 .css( "position", "absolute" ) 1331 .appendTo( iframe.parent() ) 1332 .outerWidth( iframe.outerWidth() ) 1333 .outerHeight( iframe.outerHeight() ) 1334 .offset( iframe.offset() )[ 0 ]; 1335 } ); 1336 }, 1337 1338 _unblockFrames: function() { 1339 if ( this.iframeBlocks ) { 1340 this.iframeBlocks.remove(); 1341 delete this.iframeBlocks; 1342 } 1343 }, 1344 1345 _blurActiveElement: function( event ) { 1346 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 1347 target = $( event.target ); 1348 1349 // Don't blur if the event occurred on an element that is within 1350 // the currently focused element 1351 // See #10527, #12472 1352 if ( target.closest( activeElement ).length ) { 1353 return; 1354 } 1355 1356 // Blur any element that currently has focus, see #4261 1357 $.ui.safeBlur( activeElement ); 1358 }, 1359 1360 _mouseStart: function( event ) { 1361 1362 var o = this.options; 1363 1364 //Create and append the visible helper 1365 this.helper = this._createHelper( event ); 1366 1367 this._addClass( this.helper, "ui-draggable-dragging" ); 1368 1369 //Cache the helper size 1370 this._cacheHelperProportions(); 1371 1372 //If ddmanager is used for droppables, set the global draggable 1373 if ( $.ui.ddmanager ) { 1374 $.ui.ddmanager.current = this; 1375 } 1376 1377 /* 1378 * - Position generation - 1379 * This block generates everything position related - it's the core of draggables. 1380 */ 1381 1382 //Cache the margins of the original element 1383 this._cacheMargins(); 1384 1385 //Store the helper's css position 1386 this.cssPosition = this.helper.css( "position" ); 1387 this.scrollParent = this.helper.scrollParent( true ); 1388 this.offsetParent = this.helper.offsetParent(); 1389 this.hasFixedAncestor = this.helper.parents().filter( function() { 1390 return $( this ).css( "position" ) === "fixed"; 1391 } ).length > 0;
vendor: 5,410 bytes, lines 1392-1584
1392 1393 //The element's absolute position on the page minus margins 1394 this.positionAbs = this.element.offset(); 1395 this._refreshOffsets( event ); 1396 1397 //Generate the original position 1398 this.originalPosition = this.position = this._generatePosition( event, false ); 1399 this.originalPageX = event.pageX; 1400 this.originalPageY = event.pageY; 1401 1402 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 1403 ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); 1404 1405 //Set a containment if given in the options 1406 this._setContainment(); 1407 1408 //Trigger event + callbacks 1409 if ( this._trigger( "start", event ) === false ) { 1410 this._clear(); 1411 return false; 1412 } 1413 1414 //Recache the helper size 1415 this._cacheHelperProportions(); 1416 1417 //Prepare the droppable offsets 1418 if ( $.ui.ddmanager && !o.dropBehaviour ) { 1419 $.ui.ddmanager.prepareOffsets( this, event ); 1420 } 1421 1422 // Execute the drag once - this causes the helper not to be visible before getting its 1423 // correct position 1424 this._mouseDrag( event, true ); 1425 1426 // If the ddmanager is used for droppables, inform the manager that dragging has started 1427 // (see #5003) 1428 if ( $.ui.ddmanager ) { 1429 $.ui.ddmanager.dragStart( this, event ); 1430 } 1431 1432 return true; 1433 }, 1434 1435 _refreshOffsets: function( event ) { 1436 this.offset = { 1437 top: this.positionAbs.top - this.margins.top, 1438 left: this.positionAbs.left - this.margins.left, 1439 scroll: false, 1440 parent: this._getParentOffset(), 1441 relative: this._getRelativeOffset() 1442 }; 1443 1444 this.offset.click = { 1445 left: event.pageX - this.offset.left, 1446 top: event.pageY - this.offset.top 1447 }; 1448 }, 1449 1450 _mouseDrag: function( event, noPropagation ) { 1451 1452 // reset any necessary cached properties (see #5009) 1453 if ( this.hasFixedAncestor ) { 1454 this.offset.parent = this._getParentOffset(); 1455 } 1456 1457 //Compute the helpers position 1458 this.position = this._generatePosition( event, true ); 1459 this.positionAbs = this._convertPositionTo( "absolute" ); 1460 1461 //Call plugins and callbacks and use the resulting position if something is returned 1462 if ( !noPropagation ) { 1463 var ui = this._uiHash(); 1464 if ( this._trigger( "drag", event, ui ) === false ) { 1465 this._mouseUp( new $.Event( "mouseup", event ) ); 1466 return false; 1467 } 1468 this.position = ui.position; 1469 } 1470 1471 this.helper[ 0 ].style.left = this.position.left + "px"; 1472 this.helper[ 0 ].style.top = this.position.top + "px"; 1473 1474 if ( $.ui.ddmanager ) { 1475 $.ui.ddmanager.drag( this, event ); 1476 } 1477 1478 return false; 1479 }, 1480 1481 _mouseStop: function( event ) { 1482 1483 //If we are using droppables, inform the manager about the drop 1484 var that = this, 1485 dropped = false; 1486 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 1487 dropped = $.ui.ddmanager.drop( this, event ); 1488 } 1489 1490 //if a drop comes from outside (a sortable) 1491 if ( this.dropped ) { 1492 dropped = this.dropped; 1493 this.dropped = false; 1494 } 1495 1496 if ( ( this.options.revert === "invalid" && !dropped ) || 1497 ( this.options.revert === "valid" && dropped ) || 1498 this.options.revert === true || ( $.isFunction( this.options.revert ) && 1499 this.options.revert.call( this.element, dropped ) ) 1500 ) { 1501 $( this.helper ).animate( 1502 this.originalPosition, 1503 parseInt( this.options.revertDuration, 10 ), 1504 function() { 1505 if ( that._trigger( "stop", event ) !== false ) { 1506 that._clear(); 1507 } 1508 } 1509 ); 1510 } else { 1511 if ( this._trigger( "stop", event ) !== false ) { 1512 this._clear(); 1513 } 1514 } 1515 1516 return false; 1517 }, 1518 1519 _mouseUp: function( event ) { 1520 this._unblockFrames(); 1521 1522 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 1523 // (see #5003) 1524 if ( $.ui.ddmanager ) { 1525 $.ui.ddmanager.dragStop( this, event ); 1526 } 1527 1528 // Only need to focus if the event occurred on the draggable itself, see #10527 1529 if ( this.handleElement.is( event.target ) ) { 1530 1531 // The interaction is over; whether or not the click resulted in a drag, 1532 // focus the element 1533 this.element.trigger( "focus" ); 1534 } 1535 1536 return $.ui.mouse.prototype._mouseUp.call( this, event ); 1537 }, 1538 1539 cancel: function() { 1540 1541 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 1542 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 1543 } else { 1544 this._clear(); 1545 } 1546 1547 return this; 1548 1549 }, 1550 1551 _getHandle: function( event ) { 1552 return this.options.handle ? 1553 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 1554 true; 1555 }, 1556 1557 _setHandleClassName: function() { 1558 this.handleElement = this.options.handle ? 1559 this.element.find( this.options.handle ) : this.element; 1560 this._addClass( this.handleElement, "ui-draggable-handle" ); 1561 }, 1562 1563 _removeHandleClassName: function() { 1564 this._removeClass( this.handleElement, "ui-draggable-handle" ); 1565 }, 1566 1567 _createHelper: function( event ) { 1568 1569 var o = this.options, 1570 helperIsFunction = $.isFunction( o.helper ), 1571 helper = helperIsFunction ? 1572 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 1573 ( o.helper === "clone" ? 1574 this.element.clone().removeAttr( "id" ) : 1575 this.element ); 1576 1577 if ( !helper.parents( "body" ).length ) { 1578 helper.appendTo( ( o.appendTo === "parent" ? 1579 this.element[ 0 ].parentNode : 1580 o.appendTo ) ); 1581 } 1582 1583 // Http://bugs.jqueryui.com/ticket/9446 1584 // a helper function can return the original element
vendor: 15,341 bytes, lines 1585-2077
1585 // which wouldn't have been set to relative in _create 1586 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 1587 this._setPositionRelative(); 1588 } 1589 1590 if ( helper[ 0 ] !== this.element[ 0 ] && 1591 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 1592 helper.css( "position", "absolute" ); 1593 } 1594 1595 return helper; 1596 1597 }, 1598 1599 _setPositionRelative: function() { 1600 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 1601 this.element[ 0 ].style.position = "relative"; 1602 } 1603 }, 1604 1605 _adjustOffsetFromHelper: function( obj ) { 1606 if ( typeof obj === "string" ) { 1607 obj = obj.split( " " ); 1608 } 1609 if ( $.isArray( obj ) ) { 1610 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 1611 } 1612 if ( "left" in obj ) { 1613 this.offset.click.left = obj.left + this.margins.left; 1614 } 1615 if ( "right" in obj ) { 1616 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 1617 } 1618 if ( "top" in obj ) { 1619 this.offset.click.top = obj.top + this.margins.top; 1620 } 1621 if ( "bottom" in obj ) { 1622 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 1623 } 1624 }, 1625 1626 _isRootNode: function( element ) { 1627 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 1628 }, 1629 1630 _getParentOffset: function() { 1631 1632 //Get the offsetParent and cache its position 1633 var po = this.offsetParent.offset(), 1634 document = this.document[ 0 ]; 1635 1636 // This is a special case where we need to modify a offset calculated on start, since the 1637 // following happened: 1638 // 1. The position of the helper is absolute, so it's position is calculated based on the 1639 // next positioned parent 1640 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 1641 // the document, which means that the scroll is included in the initial calculation of the 1642 // offset of the parent, and never recalculated upon drag 1643 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 1644 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 1645 po.left += this.scrollParent.scrollLeft(); 1646 po.top += this.scrollParent.scrollTop(); 1647 } 1648 1649 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 1650 po = { top: 0, left: 0 }; 1651 } 1652 1653 return { 1654 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 1655 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 1656 }; 1657 1658 }, 1659 1660 _getRelativeOffset: function() { 1661 if ( this.cssPosition !== "relative" ) { 1662 return { top: 0, left: 0 }; 1663 } 1664 1665 var p = this.element.position(), 1666 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 1667 1668 return { 1669 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 1670 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 1671 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 1672 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 1673 }; 1674 1675 }, 1676 1677 _cacheMargins: function() { 1678 this.margins = { 1679 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 1680 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 1681 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 1682 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 1683 }; 1684 }, 1685 1686 _cacheHelperProportions: function() { 1687 this.helperProportions = { 1688 width: this.helper.outerWidth(), 1689 height: this.helper.outerHeight() 1690 }; 1691 }, 1692 1693 _setContainment: function() { 1694 1695 var isUserScrollable, c, ce, 1696 o = this.options, 1697 document = this.document[ 0 ]; 1698 1699 this.relativeContainer = null; 1700 1701 if ( !o.containment ) { 1702 this.containment = null; 1703 return; 1704 } 1705 1706 if ( o.containment === "window" ) { 1707 this.containment = [ 1708 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 1709 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 1710 $( window ).scrollLeft() + $( window ).width() - 1711 this.helperProportions.width - this.margins.left, 1712 $( window ).scrollTop() + 1713 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 1714 this.helperProportions.height - this.margins.top 1715 ]; 1716 return; 1717 } 1718 1719 if ( o.containment === "document" ) { 1720 this.containment = [ 1721 0, 1722 0, 1723 $( document ).width() - this.helperProportions.width - this.margins.left, 1724 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 1725 this.helperProportions.height - this.margins.top 1726 ]; 1727 return; 1728 } 1729 1730 if ( o.containment.constructor === Array ) { 1731 this.containment = o.containment; 1732 return; 1733 } 1734 1735 if ( o.containment === "parent" ) { 1736 o.containment = this.helper[ 0 ].parentNode; 1737 } 1738 1739 c = $( o.containment ); 1740 ce = c[ 0 ]; 1741 1742 if ( !ce ) { 1743 return; 1744 } 1745 1746 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 1747 1748 this.containment = [ 1749 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 1750 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 1751 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 1752 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 1753 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 1754 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 1755 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 1756 this.helperProportions.width - 1757 this.margins.left - 1758 this.margins.right, 1759 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 1760 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 1761 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 1762 this.helperProportions.height - 1763 this.margins.top - 1764 this.margins.bottom 1765 ]; 1766 this.relativeContainer = c; 1767 }, 1768 1769 _convertPositionTo: function( d, pos ) { 1770 1771 if ( !pos ) { 1772 pos = this.position; 1773 } 1774 1775 var mod = d === "absolute" ? 1 : -1, 1776 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 1777 1778 return { 1779 top: ( 1780 1781 // The absolute mouse position 1782 pos.top + 1783 1784 // Only for relative positioned nodes: Relative offset from element to offset parent 1785 this.offset.relative.top * mod + 1786 1787 // The offsetParent's offset without borders (offset + border) 1788 this.offset.parent.top * mod - 1789 ( ( this.cssPosition === "fixed" ? 1790 -this.offset.scroll.top : 1791 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 1792 ), 1793 left: ( 1794 1795 // The absolute mouse position 1796 pos.left + 1797 1798 // Only for relative positioned nodes: Relative offset from element to offset parent 1799 this.offset.relative.left * mod + 1800 1801 // The offsetParent's offset without borders (offset + border) 1802 this.offset.parent.left * mod - 1803 ( ( this.cssPosition === "fixed" ? 1804 -this.offset.scroll.left : 1805 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 1806 ) 1807 }; 1808 1809 }, 1810 1811 _generatePosition: function( event, constrainPosition ) { 1812 1813 var containment, co, top, left, 1814 o = this.options, 1815 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 1816 pageX = event.pageX, 1817 pageY = event.pageY; 1818 1819 // Cache the scroll 1820 if ( !scrollIsRootNode || !this.offset.scroll ) { 1821 this.offset.scroll = { 1822 top: this.scrollParent.scrollTop(), 1823 left: this.scrollParent.scrollLeft() 1824 }; 1825 } 1826 1827 /* 1828 * - Position constraining - 1829 * Constrain the position to a mix of grid, containment. 1830 */ 1831 1832 // If we are not dragging yet, we won't check for options 1833 if ( constrainPosition ) { 1834 if ( this.containment ) { 1835 if ( this.relativeContainer ) { 1836 co = this.relativeContainer.offset(); 1837 containment = [ 1838 this.containment[ 0 ] + co.left, 1839 this.containment[ 1 ] + co.top, 1840 this.containment[ 2 ] + co.left, 1841 this.containment[ 3 ] + co.top 1842 ]; 1843 } else { 1844 containment = this.containment; 1845 } 1846 1847 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 1848 pageX = containment[ 0 ] + this.offset.click.left; 1849 } 1850 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 1851 pageY = containment[ 1 ] + this.offset.click.top; 1852 } 1853 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 1854 pageX = containment[ 2 ] + this.offset.click.left; 1855 } 1856 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 1857 pageY = containment[ 3 ] + this.offset.click.top; 1858 } 1859 } 1860 1861 if ( o.grid ) { 1862 1863 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 1864 // argument errors in IE (see ticket #6950) 1865 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 1866 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 1867 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 1868 top - this.offset.click.top > containment[ 3 ] ) ? 1869 top : 1870 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 1871 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 1872 1873 left = o.grid[ 0 ] ? this.originalPageX + 1874 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 1875 this.originalPageX; 1876 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 1877 left - this.offset.click.left > containment[ 2 ] ) ? 1878 left : 1879 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 1880 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 1881 } 1882 1883 if ( o.axis === "y" ) { 1884 pageX = this.originalPageX; 1885 } 1886 1887 if ( o.axis === "x" ) { 1888 pageY = this.originalPageY; 1889 } 1890 } 1891 1892 return { 1893 top: ( 1894 1895 // The absolute mouse position 1896 pageY - 1897 1898 // Click offset (relative to the element) 1899 this.offset.click.top - 1900 1901 // Only for relative positioned nodes: Relative offset from element to offset parent 1902 this.offset.relative.top - 1903 1904 // The offsetParent's offset without borders (offset + border) 1905 this.offset.parent.top + 1906 ( this.cssPosition === "fixed" ? 1907 -this.offset.scroll.top : 1908 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 1909 ), 1910 left: ( 1911 1912 // The absolute mouse position 1913 pageX - 1914 1915 // Click offset (relative to the element) 1916 this.offset.click.left - 1917 1918 // Only for relative positioned nodes: Relative offset from element to offset parent 1919 this.offset.relative.left - 1920 1921 // The offsetParent's offset without borders (offset + border) 1922 this.offset.parent.left + 1923 ( this.cssPosition === "fixed" ? 1924 -this.offset.scroll.left : 1925 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 1926 ) 1927 }; 1928 1929 }, 1930 1931 _clear: function() { 1932 this._removeClass( this.helper, "ui-draggable-dragging" ); 1933 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 1934 this.helper.remove(); 1935 } 1936 this.helper = null; 1937 this.cancelHelperRemoval = false; 1938 if ( this.destroyOnClear ) { 1939 this.destroy(); 1940 } 1941 }, 1942 1943 // From now on bulk stuff - mainly helpers 1944 1945 _trigger: function( type, event, ui ) { 1946 ui = ui || this._uiHash(); 1947 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 1948 1949 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 1950 if ( /^(drag|start|stop)/.test( type ) ) { 1951 this.positionAbs = this._convertPositionTo( "absolute" ); 1952 ui.offset = this.positionAbs; 1953 } 1954 return $.Widget.prototype._trigger.call( this, type, event, ui ); 1955 }, 1956 1957 plugins: {}, 1958 1959 _uiHash: function() { 1960 return { 1961 helper: this.helper, 1962 position: this.position, 1963 originalPosition: this.originalPosition, 1964 offset: this.positionAbs 1965 }; 1966 } 1967 1968} ); 1969 1970$.ui.plugin.add( "draggable", "connectToSortable", { 1971 start: function( event, ui, draggable ) { 1972 var uiSortable = $.extend( {}, ui, { 1973 item: draggable.element 1974 } ); 1975 1976 draggable.sortables = []; 1977 $( draggable.options.connectToSortable ).each( function() { 1978 var sortable = $( this ).sortable( "instance" ); 1979 1980 if ( sortable && !sortable.options.disabled ) { 1981 draggable.sortables.push( sortable ); 1982 1983 // RefreshPositions is called at drag start to refresh the containerCache 1984 // which is used in drag. This ensures it's initialized and synchronized 1985 // with any changes that might have happened on the page since initialization. 1986 sortable.refreshPositions(); 1987 sortable._trigger( "activate", event, uiSortable ); 1988 } 1989 } ); 1990 }, 1991 stop: function( event, ui, draggable ) { 1992 var uiSortable = $.extend( {}, ui, { 1993 item: draggable.element 1994 } ); 1995 1996 draggable.cancelHelperRemoval = false; 1997 1998 $.each( draggable.sortables, function() { 1999 var sortable = this; 2000 2001 if ( sortable.isOver ) { 2002 sortable.isOver = 0; 2003 2004 // Allow this sortable to handle removing the helper 2005 draggable.cancelHelperRemoval = true; 2006 sortable.cancelHelperRemoval = false; 2007 2008 // Use _storedCSS To restore properties in the sortable, 2009 // as this also handles revert (#9675) since the draggable 2010 // may have modified them in unexpected ways (#8809) 2011 sortable._storedCSS = { 2012 position: sortable.placeholder.css( "position" ), 2013 top: sortable.placeholder.css( "top" ), 2014 left: sortable.placeholder.css( "left" ) 2015 }; 2016 2017 sortable._mouseStop( event ); 2018 2019 // Once drag has ended, the sortable should return to using 2020 // its original helper, not the shared helper from draggable 2021 sortable.options.helper = sortable.options._helper; 2022 } else { 2023 2024 // Prevent this Sortable from removing the helper. 2025 // However, don't set the draggable to remove the helper 2026 // either as another connected Sortable may yet handle the removal. 2027 sortable.cancelHelperRemoval = true; 2028 2029 sortable._trigger( "deactivate", event, uiSortable ); 2030 } 2031 } ); 2032 }, 2033 drag: function( event, ui, draggable ) { 2034 $.each( draggable.sortables, function() { 2035 var innermostIntersecting = false, 2036 sortable = this; 2037 2038 // Copy over variables that sortable's _intersectsWith uses 2039 sortable.positionAbs = draggable.positionAbs; 2040 sortable.helperProportions = draggable.helperProportions; 2041 sortable.offset.click = draggable.offset.click; 2042 2043 if ( sortable._intersectsWith( sortable.containerCache ) ) { 2044 innermostIntersecting = true; 2045 2046 $.each( draggable.sortables, function() { 2047 2048 // Copy over variables that sortable's _intersectsWith uses 2049 this.positionAbs = draggable.positionAbs; 2050 this.helperProportions = draggable.helperProportions; 2051 this.offset.click = draggable.offset.click; 2052 2053 if ( this !== sortable && 2054 this._intersectsWith( this.containerCache ) && 2055 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 2056 innermostIntersecting = false; 2057 } 2058 2059 return innermostIntersecting; 2060 } ); 2061 } 2062 2063 if ( innermostIntersecting ) { 2064 2065 // If it intersects, we use a little isOver variable and set it once, 2066 // so that the move-in stuff gets fired only once. 2067 if ( !sortable.isOver ) { 2068 sortable.isOver = 1; 2069 2070 // Store draggable's parent in case we need to reappend to it later. 2071 draggable._parent = ui.helper.parent(); 2072 2073 sortable.currentItem = ui.helper 2074 .appendTo( sortable.element ) 2075 .data( "ui-sortable-item", true ); 2076 2077 // Store helper option to later restore it
vendor: 11,377 bytes, lines 2078-2452
2078 sortable.options._helper = sortable.options.helper; 2079 2080 sortable.options.helper = function() { 2081 return ui.helper[ 0 ]; 2082 }; 2083 2084 // Fire the start events of the sortable with our passed browser event, 2085 // and our own helper (so it doesn't create a new one) 2086 event.target = sortable.currentItem[ 0 ]; 2087 sortable._mouseCapture( event, true ); 2088 sortable._mouseStart( event, true, true ); 2089 2090 // Because the browser event is way off the new appended portlet, 2091 // modify necessary variables to reflect the changes 2092 sortable.offset.click.top = draggable.offset.click.top; 2093 sortable.offset.click.left = draggable.offset.click.left; 2094 sortable.offset.parent.left -= draggable.offset.parent.left - 2095 sortable.offset.parent.left; 2096 sortable.offset.parent.top -= draggable.offset.parent.top - 2097 sortable.offset.parent.top; 2098 2099 draggable._trigger( "toSortable", event ); 2100 2101 // Inform draggable that the helper is in a valid drop zone, 2102 // used solely in the revert option to handle "valid/invalid". 2103 draggable.dropped = sortable.element; 2104 2105 // Need to refreshPositions of all sortables in the case that 2106 // adding to one sortable changes the location of the other sortables (#9675) 2107 $.each( draggable.sortables, function() { 2108 this.refreshPositions(); 2109 } ); 2110 2111 // Hack so receive/update callbacks work (mostly) 2112 draggable.currentItem = draggable.element; 2113 sortable.fromOutside = draggable; 2114 } 2115 2116 if ( sortable.currentItem ) { 2117 sortable._mouseDrag( event ); 2118 2119 // Copy the sortable's position because the draggable's can potentially reflect 2120 // a relative position, while sortable is always absolute, which the dragged 2121 // element has now become. (#8809) 2122 ui.position = sortable.position; 2123 } 2124 } else { 2125 2126 // If it doesn't intersect with the sortable, and it intersected before, 2127 // we fake the drag stop of the sortable, but make sure it doesn't remove 2128 // the helper by using cancelHelperRemoval. 2129 if ( sortable.isOver ) { 2130 2131 sortable.isOver = 0; 2132 sortable.cancelHelperRemoval = true; 2133 2134 // Calling sortable's mouseStop would trigger a revert, 2135 // so revert must be temporarily false until after mouseStop is called. 2136 sortable.options._revert = sortable.options.revert; 2137 sortable.options.revert = false; 2138 2139 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 2140 sortable._mouseStop( event, true ); 2141 2142 // Restore sortable behaviors that were modfied 2143 // when the draggable entered the sortable area (#9481) 2144 sortable.options.revert = sortable.options._revert; 2145 sortable.options.helper = sortable.options._helper; 2146 2147 if ( sortable.placeholder ) { 2148 sortable.placeholder.remove(); 2149 } 2150 2151 // Restore and recalculate the draggable's offset considering the sortable 2152 // may have modified them in unexpected ways. (#8809, #10669) 2153 ui.helper.appendTo( draggable._parent ); 2154 draggable._refreshOffsets( event ); 2155 ui.position = draggable._generatePosition( event, true ); 2156 2157 draggable._trigger( "fromSortable", event ); 2158 2159 // Inform draggable that the helper is no longer in a valid drop zone 2160 draggable.dropped = false; 2161 2162 // Need to refreshPositions of all sortables just in case removing 2163 // from one sortable changes the location of other sortables (#9675) 2164 $.each( draggable.sortables, function() { 2165 this.refreshPositions(); 2166 } ); 2167 } 2168 } 2169 } ); 2170 } 2171} ); 2172 2173$.ui.plugin.add( "draggable", "cursor", { 2174 start: function( event, ui, instance ) { 2175 var t = $( "body" ), 2176 o = instance.options; 2177 2178 if ( t.css( "cursor" ) ) { 2179 o._cursor = t.css( "cursor" ); 2180 } 2181 t.css( "cursor", o.cursor ); 2182 }, 2183 stop: function( event, ui, instance ) { 2184 var o = instance.options; 2185 if ( o._cursor ) { 2186 $( "body" ).css( "cursor", o._cursor ); 2187 } 2188 } 2189} ); 2190 2191$.ui.plugin.add( "draggable", "opacity", { 2192 start: function( event, ui, instance ) { 2193 var t = $( ui.helper ), 2194 o = instance.options; 2195 if ( t.css( "opacity" ) ) { 2196 o._opacity = t.css( "opacity" ); 2197 } 2198 t.css( "opacity", o.opacity ); 2199 }, 2200 stop: function( event, ui, instance ) { 2201 var o = instance.options; 2202 if ( o._opacity ) { 2203 $( ui.helper ).css( "opacity", o._opacity ); 2204 } 2205 } 2206} ); 2207 2208$.ui.plugin.add( "draggable", "scroll", { 2209 start: function( event, ui, i ) { 2210 if ( !i.scrollParentNotHidden ) { 2211 i.scrollParentNotHidden = i.helper.scrollParent( false ); 2212 } 2213 2214 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 2215 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 2216 i.overflowOffset = i.scrollParentNotHidden.offset(); 2217 } 2218 }, 2219 drag: function( event, ui, i ) { 2220 2221 var o = i.options, 2222 scrolled = false, 2223 scrollParent = i.scrollParentNotHidden[ 0 ], 2224 document = i.document[ 0 ]; 2225 2226 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 2227 if ( !o.axis || o.axis !== "x" ) { 2228 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 2229 o.scrollSensitivity ) { 2230 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 2231 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 2232 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 2233 } 2234 } 2235 2236 if ( !o.axis || o.axis !== "y" ) { 2237 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 2238 o.scrollSensitivity ) { 2239 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 2240 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 2241 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 2242 } 2243 } 2244 2245 } else { 2246 2247 if ( !o.axis || o.axis !== "x" ) { 2248 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 2249 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 2250 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 2251 o.scrollSensitivity ) { 2252 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 2253 } 2254 } 2255 2256 if ( !o.axis || o.axis !== "y" ) { 2257 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 2258 scrolled = $( document ).scrollLeft( 2259 $( document ).scrollLeft() - o.scrollSpeed 2260 ); 2261 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 2262 o.scrollSensitivity ) { 2263 scrolled = $( document ).scrollLeft( 2264 $( document ).scrollLeft() + o.scrollSpeed 2265 ); 2266 } 2267 } 2268 2269 } 2270 2271 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 2272 $.ui.ddmanager.prepareOffsets( i, event ); 2273 } 2274 2275 } 2276} ); 2277 2278$.ui.plugin.add( "draggable", "snap", { 2279 start: function( event, ui, i ) { 2280 2281 var o = i.options; 2282 2283 i.snapElements = []; 2284 2285 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 2286 .each( function() { 2287 var $t = $( this ), 2288 $o = $t.offset(); 2289 if ( this !== i.element[ 0 ] ) { 2290 i.snapElements.push( { 2291 item: this, 2292 width: $t.outerWidth(), height: $t.outerHeight(), 2293 top: $o.top, left: $o.left 2294 } ); 2295 } 2296 } ); 2297 2298 }, 2299 drag: function( event, ui, inst ) { 2300 2301 var ts, bs, ls, rs, l, r, t, b, i, first, 2302 o = inst.options, 2303 d = o.snapTolerance, 2304 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 2305 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 2306 2307 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 2308 2309 l = inst.snapElements[ i ].left - inst.margins.left; 2310 r = l + inst.snapElements[ i ].width; 2311 t = inst.snapElements[ i ].top - inst.margins.top; 2312 b = t + inst.snapElements[ i ].height; 2313 2314 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 2315 !$.contains( inst.snapElements[ i ].item.ownerDocument, 2316 inst.snapElements[ i ].item ) ) { 2317 if ( inst.snapElements[ i ].snapping ) { 2318 ( inst.options.snap.release && 2319 inst.options.snap.release.call( 2320 inst.element, 2321 event, 2322 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 2323 ) ); 2324 } 2325 inst.snapElements[ i ].snapping = false; 2326 continue; 2327 } 2328 2329 if ( o.snapMode !== "inner" ) { 2330 ts = Math.abs( t - y2 ) <= d; 2331 bs = Math.abs( b - y1 ) <= d; 2332 ls = Math.abs( l - x2 ) <= d; 2333 rs = Math.abs( r - x1 ) <= d; 2334 if ( ts ) { 2335 ui.position.top = inst._convertPositionTo( "relative", { 2336 top: t - inst.helperProportions.height, 2337 left: 0 2338 } ).top; 2339 } 2340 if ( bs ) { 2341 ui.position.top = inst._convertPositionTo( "relative", { 2342 top: b, 2343 left: 0 2344 } ).top; 2345 } 2346 if ( ls ) { 2347 ui.position.left = inst._convertPositionTo( "relative", { 2348 top: 0, 2349 left: l - inst.helperProportions.width 2350 } ).left; 2351 } 2352 if ( rs ) { 2353 ui.position.left = inst._convertPositionTo( "relative", { 2354 top: 0, 2355 left: r 2356 } ).left; 2357 } 2358 } 2359 2360 first = ( ts || bs || ls || rs ); 2361 2362 if ( o.snapMode !== "outer" ) { 2363 ts = Math.abs( t - y1 ) <= d; 2364 bs = Math.abs( b - y2 ) <= d; 2365 ls = Math.abs( l - x1 ) <= d; 2366 rs = Math.abs( r - x2 ) <= d; 2367 if ( ts ) { 2368 ui.position.top = inst._convertPositionTo( "relative", { 2369 top: t, 2370 left: 0 2371 } ).top; 2372 } 2373 if ( bs ) { 2374 ui.position.top = inst._convertPositionTo( "relative", { 2375 top: b - inst.helperProportions.height, 2376 left: 0 2377 } ).top; 2378 } 2379 if ( ls ) { 2380 ui.position.left = inst._convertPositionTo( "relative", { 2381 top: 0, 2382 left: l 2383 } ).left; 2384 } 2385 if ( rs ) { 2386 ui.position.left = inst._convertPositionTo( "relative", { 2387 top: 0, 2388 left: r - inst.helperProportions.width 2389 } ).left; 2390 } 2391 } 2392 2393 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 2394 ( inst.options.snap.snap && 2395 inst.options.snap.snap.call( 2396 inst.element, 2397 event, 2398 $.extend( inst._uiHash(), { 2399 snapItem: inst.snapElements[ i ].item 2400 } ) ) ); 2401 } 2402 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 2403 2404 } 2405 2406 } 2407} ); 2408 2409$.ui.plugin.add( "draggable", "stack", { 2410 start: function( event, ui, instance ) { 2411 var min, 2412 o = instance.options, 2413 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 2414 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 2415 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 2416 } ); 2417 2418 if ( !group.length ) { return; } 2419 2420 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 2421 $( group ).each( function( i ) { 2422 $( this ).css( "zIndex", min + i ); 2423 } ); 2424 this.css( "zIndex", ( min + group.length ) ); 2425 } 2426} ); 2427 2428$.ui.plugin.add( "draggable", "zIndex", { 2429 start: function( event, ui, instance ) { 2430 var t = $( ui.helper ), 2431 o = instance.options; 2432 2433 if ( t.css( "zIndex" ) ) { 2434 o._zIndex = t.css( "zIndex" ); 2435 } 2436 t.css( "zIndex", o.zIndex ); 2437 }, 2438 stop: function( event, ui, instance ) { 2439 var o = instance.options; 2440 2441 if ( o._zIndex ) { 2442 $( ui.helper ).css( "zIndex", o._zIndex ); 2443 } 2444 } 2445} ); 2446 2447var widgetsDraggable = $.ui.draggable; 2448 2449 2450 2451 2452}));
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.