1( function( factory ) { 2 "use strict"; 3 4 if ( typeof define === "function" && define.amd ) { 5 6 // AMD. Register as an anonymous module. 7 define( [ "jquery" ], factory ); 8 } else { 9 10 // Browser globals 11 factory( jQuery ); 12 } 13} )( function( $ ) { 14"use strict"; 15 16$.ui = $.ui || {}; 17 18return $.ui.version = "1.14.1"; 19 20} ); 21 22 23/*! 24 * jQuery UI :data 1.14.1 25 * https://jqueryui.com 26 * 27 * Copyright OpenJS Foundation and other contributors 28 * Released under the MIT license. 29 * https://jquery.org/license 30 */ 31 32//>>label: :data Selector 33//>>group: Core 34//>>description: Selects elements which have data stored under the specified key. 35//>>docs: https://api.jqueryui.com/data-selector/ 36 37( function( factory ) { 38 "use strict"; 39 40 if ( typeof define === "function" && define.amd ) { 41 42 // AMD. Register as an anonymous module. 43 define( [ "jquery", "./version" ], factory ); 44 } else { 45 46 // Browser globals 47 factory( jQuery ); 48 } 49} )( function( $ ) { 50"use strict"; 51 52return $.extend( $.expr.pseudos, { 53 data: $.expr.createPseudo( function( dataName ) { 54 return function( elem ) { 55 return !!$.data( elem, dataName ); 56 }; 57 } ) 58} ); 59} ); 60 61 62/*! 63 * jQuery UI Disable Selection 1.14.1 64 * https://jqueryui.com 65 * 66 * Copyright OpenJS Foundation and other contributors 67 * Released under the MIT license. 68 * https://jquery.org/license 69 */ 70 71//>>label: disableSelection 72//>>group: Core 73//>>description: Disable selection of text content within the set of matched elements. 74//>>docs: https://api.jqueryui.com/disableSelection/ 75 76// This file is deprecated 77( function( factory ) { 78 "use strict"; 79 80 if ( typeof define === "function" && define.amd ) { 81 82 // AMD. Register as an anonymous module. 83 define( [ "jquery", "./version" ], factory ); 84 } else { 85 86 // Browser globals 87 factory( jQuery ); 88 } 89} )( function( $ ) { 90"use strict"; 91 92return $.fn.extend( { 93 disableSelection: ( function() { 94 var eventType = "onselectstart" in document.createElement( "div" ) ? 95 "selectstart" : 96 "mousedown"; 97 98 return function() { 99 return this.on( eventType + ".ui-disableSelection", function( event ) { 100 event.preventDefault(); 101 } ); 102 }; 103 } )(), 104 105 enableSelection: function() { 106 return this.off( ".ui-disableSelection" ); 107 } 108} ); 109 110} ); 111 112( function( factory ) { 113 "use strict"; 114 115 if ( typeof define === "function" && define.amd ) { 116 117 // AMD. Register as an anonymous module. 118 define( [ "jquery", "./version" ], factory ); 119 } else { 120 121 // Browser globals 122 factory( jQuery ); 123 } 124} )( function( $ ) { 125 "use strict"; 126 127// Create a local jQuery because jQuery Color relies on it and the 128// global may not exist with AMD and a custom build (#10199). 129// This module is a noop if used as a regular AMD module. 130// eslint-disable-next-line no-unused-vars 131var jQuery = $; 132 133} ); 134/*! 135 * jQuery Color Animations v3.0.0 136 * https://github.com/jquery/jquery-color 137 * 138 * Copyright OpenJS Foundation and other contributors 139 * Released under the MIT license. 140 * https://jquery.org/license 141 * 142 * Date: Wed May 15 16:49:44 2024 +0200 143 */ 144 145( function( root, factory ) { 146 "use strict"; 147 148 if ( typeof define === "function" && define.amd ) { 149 150 // AMD. Register as an anonymous module. 151 define( [ "jquery" ], factory ); 152 } else if ( typeof exports === "object" ) { 153 module.exports = factory( require( "jquery" ) ); 154 } else { 155 factory( root.jQuery ); 156 } 157} )( this, function( jQuery, undefined ) { 158 "use strict";
vendor: 15,687 bytes, lines 158-823
158 159 160 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 161 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 162 163 class2type = {}, 164 toString = class2type.toString, 165 166 // plusequals test for += 100 -= 100 167 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 168 169 // a set of RE's that can match strings and generate color tuples. 170 stringParsers = [ { 171 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 172 parse: function( execResult ) { 173 return [ 174 execResult[ 1 ], 175 execResult[ 2 ], 176 execResult[ 3 ], 177 execResult[ 4 ] 178 ]; 179 } 180 }, { 181 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 182 parse: function( execResult ) { 183 return [ 184 execResult[ 1 ] * 2.55, 185 execResult[ 2 ] * 2.55, 186 execResult[ 3 ] * 2.55, 187 execResult[ 4 ] 188 ]; 189 } 190 }, { 191 192 // this regex ignores A-F because it's compared against an already lowercased string 193 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 194 parse: function( execResult ) { 195 return [ 196 parseInt( execResult[ 1 ], 16 ), 197 parseInt( execResult[ 2 ], 16 ), 198 parseInt( execResult[ 3 ], 16 ), 199 execResult[ 4 ] ? 200 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 201 1 202 ]; 203 } 204 }, { 205 206 // this regex ignores A-F because it's compared against an already lowercased string 207 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 208 parse: function( execResult ) { 209 return [ 210 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 211 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 212 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 213 execResult[ 4 ] ? 214 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 215 .toFixed( 2 ) : 216 1 217 ]; 218 } 219 }, { 220 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 221 space: "hsla", 222 parse: function( execResult ) { 223 return [ 224 execResult[ 1 ], 225 execResult[ 2 ] / 100, 226 execResult[ 3 ] / 100, 227 execResult[ 4 ] 228 ]; 229 } 230 } ], 231 232 // jQuery.Color( ) 233 color = jQuery.Color = function( color, green, blue, alpha ) { 234 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 235 }, 236 spaces = { 237 rgba: { 238 props: { 239 red: { 240 idx: 0, 241 type: "byte" 242 }, 243 green: { 244 idx: 1, 245 type: "byte" 246 }, 247 blue: { 248 idx: 2, 249 type: "byte" 250 } 251 } 252 }, 253 254 hsla: { 255 props: { 256 hue: { 257 idx: 0, 258 type: "degrees" 259 }, 260 saturation: { 261 idx: 1, 262 type: "percent" 263 }, 264 lightness: { 265 idx: 2, 266 type: "percent" 267 } 268 } 269 } 270 }, 271 propTypes = { 272 "byte": { 273 floor: true, 274 max: 255 275 }, 276 "percent": { 277 max: 1 278 }, 279 "degrees": { 280 mod: 360, 281 floor: true 282 } 283 }, 284 285 // colors = jQuery.Color.names 286 colors, 287 288 // local aliases of functions called often 289 each = jQuery.each; 290 291// define cache name and alpha properties 292// for rgba and hsla spaces 293each( spaces, function( spaceName, space ) { 294 space.cache = "_" + spaceName; 295 space.props.alpha = { 296 idx: 3, 297 type: "percent", 298 def: 1 299 }; 300} ); 301 302// Populate the class2type map 303jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 304 function( _i, name ) { 305 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 306 } ); 307 308function getType( obj ) { 309 if ( obj == null ) { 310 return obj + ""; 311 } 312 313 return typeof obj === "object" ? 314 class2type[ toString.call( obj ) ] || "object" : 315 typeof obj; 316} 317 318function clamp( value, prop, allowEmpty ) { 319 var type = propTypes[ prop.type ] || {}; 320 321 if ( value == null ) { 322 return ( allowEmpty || !prop.def ) ? null : prop.def; 323 } 324 325 // ~~ is an short way of doing floor for positive numbers 326 value = type.floor ? ~~value : parseFloat( value ); 327 328 if ( type.mod ) { 329 330 // we add mod before modding to make sure that negatives values 331 // get converted properly: -10 -> 350 332 return ( value + type.mod ) % type.mod; 333 } 334 335 // for now all property types without mod have min and max 336 return Math.min( type.max, Math.max( 0, value ) ); 337} 338 339function stringParse( string ) { 340 var inst = color(), 341 rgba = inst._rgba = []; 342 343 string = string.toLowerCase(); 344 345 each( stringParsers, function( _i, parser ) { 346 var parsed, 347 match = parser.re.exec( string ), 348 values = match && parser.parse( match ), 349 spaceName = parser.space || "rgba"; 350 351 if ( values ) { 352 parsed = inst[ spaceName ]( values ); 353 354 // if this was an rgba parse the assignment might happen twice 355 // oh well.... 356 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 357 rgba = inst._rgba = parsed._rgba; 358 359 // exit each( stringParsers ) here because we matched 360 return false; 361 } 362 } ); 363 364 // Found a stringParser that handled it 365 if ( rgba.length ) { 366 367 // if this came from a parsed string, force "transparent" when alpha is 0 368 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 369 if ( rgba.join() === "0,0,0,0" ) { 370 jQuery.extend( rgba, colors.transparent ); 371 } 372 return inst; 373 } 374 375 // named colors 376 return colors[ string ]; 377} 378 379color.fn = jQuery.extend( color.prototype, { 380 parse: function( red, green, blue, alpha ) { 381 if ( red === undefined ) { 382 this._rgba = [ null, null, null, null ]; 383 return this; 384 } 385 if ( red.jquery || red.nodeType ) { 386 red = jQuery( red ).css( green ); 387 green = undefined; 388 } 389 390 var inst = this, 391 type = getType( red ), 392 rgba = this._rgba = []; 393 394 // more than 1 argument specified - assume ( red, green, blue, alpha ) 395 if ( green !== undefined ) { 396 red = [ red, green, blue, alpha ]; 397 type = "array"; 398 } 399 400 if ( type === "string" ) { 401 return this.parse( stringParse( red ) || colors._default ); 402 } 403 404 if ( type === "array" ) { 405 each( spaces.rgba.props, function( _key, prop ) { 406 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 407 } ); 408 return this; 409 } 410 411 if ( type === "object" ) { 412 if ( red instanceof color ) { 413 each( spaces, function( _spaceName, space ) { 414 if ( red[ space.cache ] ) { 415 inst[ space.cache ] = red[ space.cache ].slice(); 416 } 417 } ); 418 } else { 419 each( spaces, function( _spaceName, space ) { 420 var cache = space.cache; 421 each( space.props, function( key, prop ) { 422 423 // if the cache doesn't exist, and we know how to convert 424 if ( !inst[ cache ] && space.to ) { 425 426 // if the value was null, we don't need to copy it 427 // if the key was alpha, we don't need to copy it either 428 if ( key === "alpha" || red[ key ] == null ) { 429 return; 430 } 431 inst[ cache ] = space.to( inst._rgba ); 432 } 433 434 // this is the only case where we allow nulls for ALL properties. 435 // call clamp with alwaysAllowEmpty 436 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 437 } ); 438 439 // everything defined but alpha? 440 if ( inst[ cache ] && jQuery.inArray( 441 null, 442 inst[ cache ].slice( 0, 3 ) 443 ) < 0 ) { 444 445 // use the default of 1 446 if ( inst[ cache ][ 3 ] == null ) { 447 inst[ cache ][ 3 ] = 1; 448 } 449 450 if ( space.from ) { 451 inst._rgba = space.from( inst[ cache ] ); 452 } 453 } 454 } ); 455 } 456 return this; 457 } 458 }, 459 is: function( compare ) { 460 var is = color( compare ), 461 same = true, 462 inst = this; 463 464 each( spaces, function( _, space ) { 465 var localCache, 466 isCache = is[ space.cache ]; 467 if ( isCache ) { 468 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 469 each( space.props, function( _, prop ) { 470 if ( isCache[ prop.idx ] != null ) { 471 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 472 return same; 473 } 474 } ); 475 } 476 return same; 477 } ); 478 return same; 479 }, 480 _space: function() { 481 var used = [], 482 inst = this; 483 each( spaces, function( spaceName, space ) { 484 if ( inst[ space.cache ] ) { 485 used.push( spaceName ); 486 } 487 } ); 488 return used.pop(); 489 }, 490 transition: function( other, distance ) { 491 var end = color( other ), 492 spaceName = end._space(), 493 space = spaces[ spaceName ], 494 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 495 start = startColor[ space.cache ] || space.to( startColor._rgba ), 496 result = start.slice(); 497 498 end = end[ space.cache ]; 499 each( space.props, function( _key, prop ) { 500 var index = prop.idx, 501 startValue = start[ index ], 502 endValue = end[ index ], 503 type = propTypes[ prop.type ] || {}; 504 505 // if null, don't override start value 506 if ( endValue === null ) { 507 return; 508 } 509 510 // if null - use end 511 if ( startValue === null ) { 512 result[ index ] = endValue; 513 } else { 514 if ( type.mod ) { 515 if ( endValue - startValue > type.mod / 2 ) { 516 startValue += type.mod; 517 } else if ( startValue - endValue > type.mod / 2 ) { 518 startValue -= type.mod; 519 } 520 } 521 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 522 } 523 } ); 524 return this[ spaceName ]( result ); 525 }, 526 blend: function( opaque ) { 527 528 // if we are already opaque - return ourself 529 if ( this._rgba[ 3 ] === 1 ) { 530 return this; 531 } 532 533 var rgb = this._rgba.slice(), 534 a = rgb.pop(), 535 blend = color( opaque )._rgba; 536 537 return color( jQuery.map( rgb, function( v, i ) { 538 return ( 1 - a ) * blend[ i ] + a * v; 539 } ) ); 540 }, 541 toRgbaString: function() { 542 var prefix = "rgba(", 543 rgba = jQuery.map( this._rgba, function( v, i ) { 544 if ( v != null ) { 545 return v; 546 } 547 return i > 2 ? 1 : 0; 548 } ); 549 550 if ( rgba[ 3 ] === 1 ) { 551 rgba.pop(); 552 prefix = "rgb("; 553 } 554 555 return prefix + rgba.join( ", " ) + ")"; 556 }, 557 toHslaString: function() { 558 var prefix = "hsla(", 559 hsla = jQuery.map( this.hsla(), function( v, i ) { 560 if ( v == null ) { 561 v = i > 2 ? 1 : 0; 562 } 563 564 // catch 1 and 2 565 if ( i && i < 3 ) { 566 v = Math.round( v * 100 ) + "%"; 567 } 568 return v; 569 } ); 570 571 if ( hsla[ 3 ] === 1 ) { 572 hsla.pop(); 573 prefix = "hsl("; 574 } 575 return prefix + hsla.join( ", " ) + ")"; 576 }, 577 toHexString: function( includeAlpha ) { 578 var rgba = this._rgba.slice(), 579 alpha = rgba.pop(); 580 581 if ( includeAlpha ) { 582 rgba.push( ~~( alpha * 255 ) ); 583 } 584 585 return "#" + jQuery.map( rgba, function( v ) { 586 587 // default to 0 when nulls exist 588 return ( "0" + ( v || 0 ).toString( 16 ) ).substr( -2 ); 589 } ).join( "" ); 590 }, 591 toString: function() { 592 return this.toRgbaString(); 593 } 594} ); 595color.fn.parse.prototype = color.fn; 596 597// hsla conversions adapted from: 598// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 599 600function hue2rgb( p, q, h ) { 601 h = ( h + 1 ) % 1; 602 if ( h * 6 < 1 ) { 603 return p + ( q - p ) * h * 6; 604 } 605 if ( h * 2 < 1 ) { 606 return q; 607 } 608 if ( h * 3 < 2 ) { 609 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 610 } 611 return p; 612} 613 614spaces.hsla.to = function( rgba ) { 615 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 616 return [ null, null, null, rgba[ 3 ] ]; 617 } 618 var r = rgba[ 0 ] / 255, 619 g = rgba[ 1 ] / 255, 620 b = rgba[ 2 ] / 255, 621 a = rgba[ 3 ], 622 max = Math.max( r, g, b ), 623 min = Math.min( r, g, b ), 624 diff = max - min, 625 add = max + min, 626 l = add * 0.5, 627 h, s; 628 629 if ( min === max ) { 630 h = 0; 631 } else if ( r === max ) { 632 h = ( 60 * ( g - b ) / diff ) + 360; 633 } else if ( g === max ) { 634 h = ( 60 * ( b - r ) / diff ) + 120; 635 } else { 636 h = ( 60 * ( r - g ) / diff ) + 240; 637 } 638 639 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 640 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 641 if ( diff === 0 ) { 642 s = 0; 643 } else if ( l <= 0.5 ) { 644 s = diff / add; 645 } else { 646 s = diff / ( 2 - add ); 647 } 648 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 649}; 650 651spaces.hsla.from = function( hsla ) { 652 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 653 return [ null, null, null, hsla[ 3 ] ]; 654 } 655 var h = hsla[ 0 ] / 360, 656 s = hsla[ 1 ], 657 l = hsla[ 2 ], 658 a = hsla[ 3 ], 659 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 660 p = 2 * l - q; 661 662 return [ 663 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 664 Math.round( hue2rgb( p, q, h ) * 255 ), 665 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 666 a 667 ]; 668}; 669 670 671each( spaces, function( spaceName, space ) { 672 var props = space.props, 673 cache = space.cache, 674 to = space.to, 675 from = space.from; 676 677 // makes rgba() and hsla() 678 color.fn[ spaceName ] = function( value ) { 679 680 // generate a cache for this space if it doesn't exist 681 if ( to && !this[ cache ] ) { 682 this[ cache ] = to( this._rgba ); 683 } 684 if ( value === undefined ) { 685 return this[ cache ].slice(); 686 } 687 688 var ret, 689 type = getType( value ), 690 arr = ( type === "array" || type === "object" ) ? value : arguments, 691 local = this[ cache ].slice(); 692 693 each( props, function( key, prop ) { 694 var val = arr[ type === "object" ? key : prop.idx ]; 695 if ( val == null ) { 696 val = local[ prop.idx ]; 697 } 698 local[ prop.idx ] = clamp( val, prop ); 699 } ); 700 701 if ( from ) { 702 ret = color( from( local ) ); 703 ret[ cache ] = local; 704 return ret; 705 } else { 706 return color( local ); 707 } 708 }; 709 710 // makes red() green() blue() alpha() hue() saturation() lightness() 711 each( props, function( key, prop ) { 712 713 // alpha is included in more than one space 714 if ( color.fn[ key ] ) { 715 return; 716 } 717 color.fn[ key ] = function( value ) { 718 var local, cur, match, fn, 719 vtype = getType( value ); 720 721 if ( key === "alpha" ) { 722 fn = this._hsla ? "hsla" : "rgba"; 723 } else { 724 fn = spaceName; 725 } 726 local = this[ fn ](); 727 cur = local[ prop.idx ]; 728 729 if ( vtype === "undefined" ) { 730 return cur; 731 } 732 733 if ( vtype === "function" ) { 734 value = value.call( this, cur ); 735 vtype = getType( value ); 736 } 737 if ( value == null && prop.empty ) { 738 return this; 739 } 740 if ( vtype === "string" ) { 741 match = rplusequals.exec( value ); 742 if ( match ) { 743 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 744 } 745 } 746 local[ prop.idx ] = value; 747 return this[ fn ]( local ); 748 }; 749 } ); 750} ); 751 752// add cssHook and .fx.step function for each named hook. 753// accept a space separated string of properties 754color.hook = function( hook ) { 755 var hooks = hook.split( " " ); 756 each( hooks, function( _i, hook ) { 757 jQuery.cssHooks[ hook ] = { 758 set: function( elem, value ) { 759 var parsed; 760 761 if ( value !== "transparent" && 762 ( getType( value ) !== "string" || 763 ( parsed = stringParse( value ) ) ) ) { 764 value = color( parsed || value ); 765 value = value.toRgbaString(); 766 } 767 elem.style[ hook ] = value; 768 } 769 }; 770 jQuery.fx.step[ hook ] = function( fx ) { 771 if ( !fx.colorInit ) { 772 fx.start = color( fx.elem, hook ); 773 fx.end = color( fx.end ); 774 fx.colorInit = true; 775 } 776 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 777 }; 778 } ); 779 780}; 781 782color.hook( stepHooks ); 783 784jQuery.cssHooks.borderColor = { 785 expand: function( value ) { 786 var expanded = {}; 787 788 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 789 expanded[ "border" + part + "Color" ] = value; 790 } ); 791 return expanded; 792 } 793}; 794 795// Basic color names only. 796// Usage of any of the other color names requires adding yourself or including 797// jquery.color.svg-names.js. 798colors = jQuery.Color.names = { 799 800 // 4.1. Basic color keywords 801 aqua: "#00ffff", 802 black: "#000000", 803 blue: "#0000ff", 804 fuchsia: "#ff00ff", 805 gray: "#808080", 806 green: "#008000", 807 lime: "#00ff00", 808 maroon: "#800000", 809 navy: "#000080", 810 olive: "#808000", 811 purple: "#800080", 812 red: "#ff0000", 813 silver: "#c0c0c0", 814 teal: "#008080", 815 white: "#ffffff", 816 yellow: "#ffff00", 817 818 // 4.2.3. "transparent" color keyword 819 transparent: [ null, null, null, 0 ], 820 821 _default: "#ffffff" 822}; 823
824} ); 825 826 827 828 829/*! 830 * jQuery UI Effects 1.14.1 831 * https://jqueryui.com 832 * 833 * Copyright OpenJS Foundation and other contributors 834 * Released under the MIT license. 835 * https://jquery.org/license 836 */ 837 838//>>label: Effects Core 839//>>group: Effects 840/* eslint-disable max-len */ 841//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 842/* eslint-enable max-len */ 843//>>docs: https://api.jqueryui.com/category/effects-core/ 844//>>demos: https://jqueryui.com/effect/ 845 846( function( factory ) { 847 "use strict"; 848 849 if ( typeof define === "function" && define.amd ) { 850 851 // AMD. Register as an anonymous module. 852 define( [ 853 "jquery", 854 "./jquery-var-for-color", 855 "./vendor/jquery-color/jquery.color", 856 "./version" 857 ], factory ); 858 } else { 859 860 // Browser globals 861 factory( jQuery ); 862 } 863} )( function( $ ) { 864"use strict";
vendor: 7,424 bytes, lines 864-1151
864 865 866var dataSpace = "ui-effects-", 867 dataSpaceStyle = "ui-effects-style", 868 dataSpaceAnimated = "ui-effects-animated"; 869 870$.effects = { 871 effect: {} 872}; 873 874/******************************************************************************/ 875/****************************** CLASS ANIMATIONS ******************************/ 876/******************************************************************************/ 877( function() { 878 879var classAnimationActions = [ "add", "remove", "toggle" ], 880 shorthandStyles = { 881 border: 1, 882 borderBottom: 1, 883 borderColor: 1, 884 borderLeft: 1, 885 borderRight: 1, 886 borderTop: 1, 887 borderWidth: 1, 888 margin: 1, 889 padding: 1 890 }; 891 892$.each( 893 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 894 function( _, prop ) { 895 $.fx.step[ prop ] = function( fx ) { 896 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 897 jQuery.style( fx.elem, prop, fx.end ); 898 fx.setAttr = true; 899 } 900 }; 901 } 902); 903 904function camelCase( string ) { 905 return string.replace( /-([\da-z])/gi, function( all, letter ) { 906 return letter.toUpperCase(); 907 } ); 908} 909 910function getElementStyles( elem ) { 911 var key, len, 912 style = elem.ownerDocument.defaultView.getComputedStyle( elem ), 913 styles = {}; 914 915 len = style.length; 916 while ( len-- ) { 917 key = style[ len ]; 918 if ( typeof style[ key ] === "string" ) { 919 styles[ camelCase( key ) ] = style[ key ]; 920 } 921 } 922 923 return styles; 924} 925 926function styleDifference( oldStyle, newStyle ) { 927 var diff = {}, 928 name, value; 929 930 for ( name in newStyle ) { 931 value = newStyle[ name ]; 932 if ( oldStyle[ name ] !== value ) { 933 if ( !shorthandStyles[ name ] ) { 934 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 935 diff[ name ] = value; 936 } 937 } 938 } 939 } 940 941 return diff; 942} 943 944$.effects.animateClass = function( value, duration, easing, callback ) { 945 var o = $.speed( duration, easing, callback ); 946 947 return this.queue( function() { 948 var animated = $( this ), 949 baseClass = animated.attr( "class" ) || "", 950 applyClassChange, 951 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 952 953 // Map the animated objects to store the original styles. 954 allAnimations = allAnimations.map( function() { 955 var el = $( this ); 956 return { 957 el: el, 958 start: getElementStyles( this ) 959 }; 960 } ); 961 962 // Apply class change 963 applyClassChange = function() { 964 $.each( classAnimationActions, function( i, action ) { 965 if ( value[ action ] ) { 966 animated[ action + "Class" ]( value[ action ] ); 967 } 968 } ); 969 }; 970 applyClassChange(); 971 972 // Map all animated objects again - calculate new styles and diff 973 allAnimations = allAnimations.map( function() { 974 this.end = getElementStyles( this.el[ 0 ] ); 975 this.diff = styleDifference( this.start, this.end ); 976 return this; 977 } ); 978 979 // Apply original class 980 animated.attr( "class", baseClass ); 981 982 // Map all animated objects again - this time collecting a promise 983 allAnimations = allAnimations.map( function() { 984 var styleInfo = this, 985 dfd = $.Deferred(), 986 opts = $.extend( {}, o, { 987 queue: false, 988 complete: function() { 989 dfd.resolve( styleInfo ); 990 } 991 } ); 992 993 this.el.animate( this.diff, opts ); 994 return dfd.promise(); 995 } ); 996 997 // Once all animations have completed: 998 $.when.apply( $, allAnimations.get() ).done( function() { 999 1000 // Set the final class 1001 applyClassChange(); 1002 1003 // For each animated element, 1004 // clear all css properties that were animated 1005 $.each( arguments, function() { 1006 var el = this.el; 1007 $.each( this.diff, function( key ) { 1008 el.css( key, "" ); 1009 } ); 1010 } ); 1011 1012 // This is guarnteed to be there if you use jQuery.speed() 1013 // it also handles dequeuing the next anim... 1014 o.complete.call( animated[ 0 ] ); 1015 } ); 1016 } ); 1017}; 1018 1019$.fn.extend( { 1020 addClass: ( function( orig ) { 1021 return function( classNames, speed, easing, callback ) { 1022 return speed ? 1023 $.effects.animateClass.call( this, 1024 { add: classNames }, speed, easing, callback ) : 1025 orig.apply( this, arguments ); 1026 }; 1027 } )( $.fn.addClass ), 1028 1029 removeClass: ( function( orig ) { 1030 return function( classNames, speed, easing, callback ) { 1031 return arguments.length > 1 ? 1032 $.effects.animateClass.call( this, 1033 { remove: classNames }, speed, easing, callback ) : 1034 orig.apply( this, arguments ); 1035 }; 1036 } )( $.fn.removeClass ), 1037 1038 toggleClass: ( function( orig ) { 1039 return function( classNames, force, speed, easing, callback ) { 1040 if ( typeof force === "boolean" || force === undefined ) { 1041 if ( !speed ) { 1042 1043 // Without speed parameter 1044 return orig.apply( this, arguments ); 1045 } else { 1046 return $.effects.animateClass.call( this, 1047 ( force ? { add: classNames } : { remove: classNames } ), 1048 speed, easing, callback ); 1049 } 1050 } else { 1051 1052 // Without force parameter 1053 return $.effects.animateClass.call( this, 1054 { toggle: classNames }, force, speed, easing ); 1055 } 1056 }; 1057 } )( $.fn.toggleClass ), 1058 1059 switchClass: function( remove, add, speed, easing, callback ) { 1060 return $.effects.animateClass.call( this, { 1061 add: add, 1062 remove: remove 1063 }, speed, easing, callback ); 1064 } 1065} ); 1066 1067} )(); 1068 1069/******************************************************************************/ 1070/*********************************** EFFECTS **********************************/ 1071/******************************************************************************/ 1072 1073( function() { 1074 1075if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 1076 $.expr.pseudos.animated = ( function( orig ) { 1077 return function( elem ) { 1078 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 1079 }; 1080 } )( $.expr.pseudos.animated ); 1081} 1082 1083if ( $.uiBackCompat === true ) { 1084 $.extend( $.effects, { 1085 1086 // Saves a set of properties in a data storage 1087 save: function( element, set ) { 1088 var i = 0, length = set.length; 1089 for ( ; i < length; i++ ) { 1090 if ( set[ i ] !== null ) { 1091 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 1092 } 1093 } 1094 }, 1095 1096 // Restores a set of previously saved properties from a data storage 1097 restore: function( element, set ) { 1098 var val, i = 0, length = set.length; 1099 for ( ; i < length; i++ ) { 1100 if ( set[ i ] !== null ) { 1101 val = element.data( dataSpace + set[ i ] ); 1102 element.css( set[ i ], val ); 1103 } 1104 } 1105 }, 1106 1107 setMode: function( el, mode ) { 1108 if ( mode === "toggle" ) { 1109 mode = el.is( ":hidden" ) ? "show" : "hide"; 1110 } 1111 return mode; 1112 }, 1113 1114 // Wraps the element around a wrapper that copies position properties 1115 createWrapper: function( element ) { 1116 1117 // If the element is already wrapped, return it 1118 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1119 return element.parent(); 1120 } 1121 1122 // Wrap the element 1123 var props = { 1124 width: element.outerWidth( true ), 1125 height: element.outerHeight( true ), 1126 "float": element.css( "float" ) 1127 }, 1128 wrapper = $( "<div></div>" ) 1129 .addClass( "ui-effects-wrapper" ) 1130 .css( { 1131 fontSize: "100%", 1132 background: "transparent", 1133 border: "none", 1134 margin: 0, 1135 padding: 0 1136 } ), 1137 1138 // Store the size in case width/height are defined in % - Fixes #5245 1139 size = { 1140 width: element.width(), 1141 height: element.height() 1142 }, 1143 active = document.activeElement; 1144 1145 // Support: Firefox 1146 // Firefox incorrectly exposes anonymous content 1147 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 1148 try { 1149 // eslint-disable-next-line no-unused-expressions 1150 active.id; 1151 } catch (
vendor: 1,550 bytes, lines 1151-1212
1151e ) { 1152 active = document.body; 1153 } 1154 1155 element.wrap( wrapper ); 1156 1157 // Fixes #7595 - Elements lose focus when wrapped. 1158 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1159 $( active ).trigger( "focus" ); 1160 } 1161 1162 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 1163 // lose the reference to the wrapped element 1164 wrapper = element.parent(); 1165 1166 // Transfer positioning properties to the wrapper 1167 if ( element.css( "position" ) === "static" ) { 1168 wrapper.css( { position: "relative" } ); 1169 element.css( { position: "relative" } ); 1170 } else { 1171 $.extend( props, { 1172 position: element.css( "position" ), 1173 zIndex: element.css( "z-index" ) 1174 } ); 1175 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 1176 props[ pos ] = element.css( pos ); 1177 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 1178 props[ pos ] = "auto"; 1179 } 1180 } ); 1181 element.css( { 1182 position: "relative", 1183 top: 0, 1184 left: 0, 1185 right: "auto", 1186 bottom: "auto" 1187 } ); 1188 } 1189 element.css( size ); 1190 1191 return wrapper.css( props ).show(); 1192 }, 1193 1194 removeWrapper: function( element ) { 1195 var active = document.activeElement; 1196 1197 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1198 element.parent().replaceWith( element ); 1199 1200 // Fixes #7595 - Elements lose focus when wrapped. 1201 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1202 $( active ).trigger( "focus" ); 1203 } 1204 } 1205 1206 return element; 1207 } 1208 } ); 1209} 1210 1211$.extend( $.effects, { 1212 version: "1.14.1
vendor: 14,277 bytes, lines 1212-1775
1212", 1213 1214 define: function( name, mode, effect ) { 1215 if ( !effect ) { 1216 effect = mode; 1217 mode = "effect"; 1218 } 1219 1220 $.effects.effect[ name ] = effect; 1221 $.effects.effect[ name ].mode = mode; 1222 1223 return effect; 1224 }, 1225 1226 scaledDimensions: function( element, percent, direction ) { 1227 if ( percent === 0 ) { 1228 return { 1229 height: 0, 1230 width: 0, 1231 outerHeight: 0, 1232 outerWidth: 0 1233 }; 1234 } 1235 1236 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 1237 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 1238 1239 return { 1240 height: element.height() * y, 1241 width: element.width() * x, 1242 outerHeight: element.outerHeight() * y, 1243 outerWidth: element.outerWidth() * x 1244 }; 1245 1246 }, 1247 1248 clipToBox: function( animation ) { 1249 return { 1250 width: animation.clip.right - animation.clip.left, 1251 height: animation.clip.bottom - animation.clip.top, 1252 left: animation.clip.left, 1253 top: animation.clip.top 1254 }; 1255 }, 1256 1257 // Injects recently queued functions to be first in line (after "inprogress") 1258 unshift: function( element, queueLength, count ) { 1259 var queue = element.queue(); 1260 1261 if ( queueLength > 1 ) { 1262 queue.splice.apply( queue, 1263 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 1264 } 1265 element.dequeue(); 1266 }, 1267 1268 saveStyle: function( element ) { 1269 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 1270 }, 1271 1272 restoreStyle: function( element ) { 1273 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 1274 element.removeData( dataSpaceStyle ); 1275 }, 1276 1277 mode: function( element, mode ) { 1278 var hidden = element.is( ":hidden" ); 1279 1280 if ( mode === "toggle" ) { 1281 mode = hidden ? "show" : "hide"; 1282 } 1283 if ( hidden ? mode === "hide" : mode === "show" ) { 1284 mode = "none"; 1285 } 1286 return mode; 1287 }, 1288 1289 // Translates a [top,left] array into a baseline value 1290 getBaseline: function( origin, original ) { 1291 var y, x; 1292 1293 switch ( origin[ 0 ] ) { 1294 case "top": 1295 y = 0; 1296 break; 1297 case "middle": 1298 y = 0.5; 1299 break; 1300 case "bottom": 1301 y = 1; 1302 break; 1303 default: 1304 y = origin[ 0 ] / original.height; 1305 } 1306 1307 switch ( origin[ 1 ] ) { 1308 case "left": 1309 x = 0; 1310 break; 1311 case "center": 1312 x = 0.5; 1313 break; 1314 case "right": 1315 x = 1; 1316 break; 1317 default: 1318 x = origin[ 1 ] / original.width; 1319 } 1320 1321 return { 1322 x: x, 1323 y: y 1324 }; 1325 }, 1326 1327 // Creates a placeholder element so that the original element can be made absolute 1328 createPlaceholder: function( element ) { 1329 var placeholder, 1330 cssPosition = element.css( "position" ), 1331 position = element.position(); 1332 1333 // Lock in margins first to account for form elements, which 1334 // will change margin if you explicitly set height 1335 // see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 1336 // Support: Safari 1337 element.css( { 1338 marginTop: element.css( "marginTop" ), 1339 marginBottom: element.css( "marginBottom" ), 1340 marginLeft: element.css( "marginLeft" ), 1341 marginRight: element.css( "marginRight" ) 1342 } ) 1343 .outerWidth( element.outerWidth() ) 1344 .outerHeight( element.outerHeight() ); 1345 1346 if ( /^(static|relative)/.test( cssPosition ) ) { 1347 cssPosition = "absolute"; 1348 1349 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 1350 1351 // Convert inline to inline block to account for inline elements 1352 // that turn to inline block based on content (like img) 1353 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 1354 "inline-block" : 1355 "block", 1356 visibility: "hidden", 1357 1358 // Margins need to be set to account for margin collapse 1359 marginTop: element.css( "marginTop" ), 1360 marginBottom: element.css( "marginBottom" ), 1361 marginLeft: element.css( "marginLeft" ), 1362 marginRight: element.css( "marginRight" ), 1363 "float": element.css( "float" ) 1364 } ) 1365 .outerWidth( element.outerWidth() ) 1366 .outerHeight( element.outerHeight() ) 1367 .addClass( "ui-effects-placeholder" ); 1368 1369 element.data( dataSpace + "placeholder", placeholder ); 1370 } 1371 1372 element.css( { 1373 position: cssPosition, 1374 left: position.left, 1375 top: position.top 1376 } ); 1377 1378 return placeholder; 1379 }, 1380 1381 removePlaceholder: function( element ) { 1382 var dataKey = dataSpace + "placeholder", 1383 placeholder = element.data( dataKey ); 1384 1385 if ( placeholder ) { 1386 placeholder.remove(); 1387 element.removeData( dataKey ); 1388 } 1389 }, 1390 1391 // Removes a placeholder if it exists and restores 1392 // properties that were modified during placeholder creation 1393 cleanUp: function( element ) { 1394 $.effects.restoreStyle( element ); 1395 $.effects.removePlaceholder( element ); 1396 }, 1397 1398 setTransition: function( element, list, factor, value ) { 1399 value = value || {}; 1400 $.each( list, function( i, x ) { 1401 var unit = element.cssUnit( x ); 1402 if ( unit[ 0 ] > 0 ) { 1403 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 1404 } 1405 } ); 1406 return value; 1407 } 1408} ); 1409 1410// Return an effect options object for the given parameters: 1411function _normalizeArguments( effect, options, speed, callback ) { 1412 1413 // Allow passing all options as the first parameter 1414 if ( $.isPlainObject( effect ) ) { 1415 options = effect; 1416 effect = effect.effect; 1417 } 1418 1419 // Convert to an object 1420 effect = { effect: effect }; 1421 1422 // Catch (effect, null, ...) 1423 if ( options == null ) { 1424 options = {}; 1425 } 1426 1427 // Catch (effect, callback) 1428 if ( typeof options === "function" ) { 1429 callback = options; 1430 speed = null; 1431 options = {}; 1432 } 1433 1434 // Catch (effect, speed, ?) 1435 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 1436 callback = speed; 1437 speed = options; 1438 options = {}; 1439 } 1440 1441 // Catch (effect, options, callback) 1442 if ( typeof speed === "function" ) { 1443 callback = speed; 1444 speed = null; 1445 } 1446 1447 // Add options to effect 1448 if ( options ) { 1449 $.extend( effect, options ); 1450 } 1451 1452 speed = speed || options.duration; 1453 effect.duration = $.fx.off ? 0 : 1454 typeof speed === "number" ? speed : 1455 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 1456 $.fx.speeds._default; 1457 1458 effect.complete = callback || options.complete; 1459 1460 return effect; 1461} 1462 1463function standardAnimationOption( option ) { 1464 1465 // Valid standard speeds (nothing, number, named speed) 1466 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 1467 return true; 1468 } 1469 1470 // Invalid strings - treat as "normal" speed 1471 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 1472 return true; 1473 } 1474 1475 // Complete callback 1476 if ( typeof option === "function" ) { 1477 return true; 1478 } 1479 1480 // Options hash (but not naming an effect) 1481 if ( typeof option === "object" && !option.effect ) { 1482 return true; 1483 } 1484 1485 // Didn't match any standard API 1486 return false; 1487} 1488 1489$.fn.extend( { 1490 effect: function( /* effect, options, speed, callback */ ) { 1491 var args = _normalizeArguments.apply( this, arguments ), 1492 effectMethod = $.effects.effect[ args.effect ], 1493 defaultMode = effectMethod.mode, 1494 queue = args.queue, 1495 queueName = queue || "fx", 1496 complete = args.complete, 1497 mode = args.mode, 1498 modes = [], 1499 prefilter = function( next ) { 1500 var el = $( this ), 1501 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 1502 1503 // Sentinel for duck-punching the :animated pseudo-selector 1504 el.data( dataSpaceAnimated, true ); 1505 1506 // Save effect mode for later use, 1507 // we can't just call $.effects.mode again later, 1508 // as the .show() below destroys the initial state 1509 modes.push( normalizedMode ); 1510 1511 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 1512 if ( defaultMode && ( normalizedMode === "show" || 1513 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 1514 el.show(); 1515 } 1516 1517 if ( !defaultMode || normalizedMode !== "none" ) { 1518 $.effects.saveStyle( el ); 1519 } 1520 1521 if ( typeof next === "function" ) { 1522 next(); 1523 } 1524 }; 1525 1526 if ( $.fx.off || !effectMethod ) { 1527 1528 // Delegate to the original method (e.g., .show()) if possible 1529 if ( mode ) { 1530 return this[ mode ]( args.duration, complete ); 1531 } else { 1532 return this.each( function() { 1533 if ( complete ) { 1534 complete.call( this ); 1535 } 1536 } ); 1537 } 1538 } 1539 1540 function run( next ) { 1541 var elem = $( this ); 1542 1543 function cleanup() { 1544 elem.removeData( dataSpaceAnimated ); 1545 1546 $.effects.cleanUp( elem ); 1547 1548 if ( args.mode === "hide" ) { 1549 elem.hide(); 1550 } 1551 1552 done(); 1553 } 1554 1555 function done() { 1556 if ( typeof complete === "function" ) { 1557 complete.call( elem[ 0 ] ); 1558 } 1559 1560 if ( typeof next === "function" ) { 1561 next(); 1562 } 1563 } 1564 1565 // Override mode option on a per element basis, 1566 // as toggle can be either show or hide depending on element state 1567 args.mode = modes.shift(); 1568 1569 if ( $.uiBackCompat === true && !defaultMode ) { 1570 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 1571 1572 // Call the core method to track "olddisplay" properly 1573 elem[ mode ](); 1574 done(); 1575 } else { 1576 effectMethod.call( elem[ 0 ], args, done ); 1577 } 1578 } else { 1579 if ( args.mode === "none" ) { 1580 1581 // Call the core method to track "olddisplay" properly 1582 elem[ mode ](); 1583 done(); 1584 } else { 1585 effectMethod.call( elem[ 0 ], args, cleanup ); 1586 } 1587 } 1588 } 1589 1590 // Run prefilter on all elements first to ensure that 1591 // any showing or hiding happens before placeholder creation, 1592 // which ensures that any layout changes are correctly captured. 1593 return queue === false ? 1594 this.each( prefilter ).each( run ) : 1595 this.queue( queueName, prefilter ).queue( queueName, run ); 1596 }, 1597 1598 show: ( function( orig ) { 1599 return function( option ) { 1600 if ( standardAnimationOption( option ) ) { 1601 return orig.apply( this, arguments ); 1602 } else { 1603 var args = _normalizeArguments.apply( this, arguments ); 1604 args.mode = "show"; 1605 return this.effect.call( this, args ); 1606 } 1607 }; 1608 } )( $.fn.show ), 1609 1610 hide: ( function( orig ) { 1611 return function( option ) { 1612 if ( standardAnimationOption( option ) ) { 1613 return orig.apply( this, arguments ); 1614 } else { 1615 var args = _normalizeArguments.apply( this, arguments ); 1616 args.mode = "hide"; 1617 return this.effect.call( this, args ); 1618 } 1619 }; 1620 } )( $.fn.hide ), 1621 1622 toggle: ( function( orig ) { 1623 return function( option ) { 1624 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 1625 return orig.apply( this, arguments ); 1626 } else { 1627 var args = _normalizeArguments.apply( this, arguments ); 1628 args.mode = "toggle"; 1629 return this.effect.call( this, args ); 1630 } 1631 }; 1632 } )( $.fn.toggle ), 1633 1634 cssUnit: function( key ) { 1635 var style = this.css( key ), 1636 val = []; 1637 1638 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 1639 if ( style.indexOf( unit ) > 0 ) { 1640 val = [ parseFloat( style ), unit ]; 1641 } 1642 } ); 1643 return val; 1644 }, 1645 1646 cssClip: function( clipObj ) { 1647 if ( clipObj ) { 1648 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 1649 clipObj.bottom + "px " + clipObj.left + "px)" ); 1650 } 1651 return parseClip( this.css( "clip" ), this ); 1652 }, 1653 1654 transfer: function( options, done ) { 1655 var element = $( this ), 1656 target = $( options.to ), 1657 targetFixed = target.css( "position" ) === "fixed", 1658 body = $( "body" ), 1659 fixTop = targetFixed ? body.scrollTop() : 0, 1660 fixLeft = targetFixed ? body.scrollLeft() : 0, 1661 endPosition = target.offset(), 1662 animation = { 1663 top: endPosition.top - fixTop, 1664 left: endPosition.left - fixLeft, 1665 height: target.innerHeight(), 1666 width: target.innerWidth() 1667 }, 1668 startPosition = element.offset(), 1669 transfer = $( "<div class='ui-effects-transfer'></div>" ); 1670 1671 transfer 1672 .appendTo( "body" ) 1673 .addClass( options.className ) 1674 .css( { 1675 top: startPosition.top - fixTop, 1676 left: startPosition.left - fixLeft, 1677 height: element.innerHeight(), 1678 width: element.innerWidth(), 1679 position: targetFixed ? "fixed" : "absolute" 1680 } ) 1681 .animate( animation, options.duration, options.easing, function() { 1682 transfer.remove(); 1683 if ( typeof done === "function" ) { 1684 done(); 1685 } 1686 } ); 1687 } 1688} ); 1689 1690function parseClip( str, element ) { 1691 var outerWidth = element.outerWidth(), 1692 outerHeight = element.outerHeight(), 1693 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)\)$/, 1694 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 1695 1696 return { 1697 top: parseFloat( values[ 1 ] ) || 0, 1698 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 1699 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 1700 left: parseFloat( values[ 4 ] ) || 0 1701 }; 1702} 1703 1704$.fx.step.clip = function( fx ) { 1705 if ( !fx.clipInit ) { 1706 fx.start = $( fx.elem ).cssClip(); 1707 if ( typeof fx.end === "string" ) { 1708 fx.end = parseClip( fx.end, fx.elem ); 1709 } 1710 fx.clipInit = true; 1711 } 1712 1713 $( fx.elem ).cssClip( { 1714 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 1715 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 1716 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 1717 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 1718 } ); 1719}; 1720 1721} )(); 1722 1723/******************************************************************************/ 1724/*********************************** EASING ***********************************/ 1725/******************************************************************************/ 1726 1727( function() { 1728 1729// Based on easing equations from Robert Penner (http://robertpenner.com/easing) 1730 1731var baseEasings = {}; 1732 1733$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 1734 baseEasings[ name ] = function( p ) { 1735 return Math.pow( p, i + 2 ); 1736 }; 1737} ); 1738 1739$.extend( baseEasings, { 1740 Sine: function( p ) { 1741 return 1 - Math.cos( p * Math.PI / 2 ); 1742 }, 1743 Circ: function( p ) { 1744 return 1 - Math.sqrt( 1 - p * p ); 1745 }, 1746 Elastic: function( p ) { 1747 return p === 0 || p === 1 ? p : 1748 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 1749 }, 1750 Back: function( p ) { 1751 return p * p * ( 3 * p - 2 ); 1752 }, 1753 Bounce: function( p ) { 1754 var pow2, 1755 bounce = 4; 1756 1757 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 1758 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 1759 } 1760} ); 1761 1762$.each( baseEasings, function( name, easeIn ) { 1763 $.easing[ "easeIn" + name ] = easeIn; 1764 $.easing[ "easeOut" + name ] = function( p ) { 1765 return 1 - easeIn( 1 - p ); 1766 }; 1767 $.easing[ "easeInOut" + name ] = function( p ) { 1768 return p < 0.5 ? 1769 easeIn( p * 2 ) / 2 : 1770 1 - easeIn( p * -2 + 2 ) / 2; 1771 }; 1772} ); 1773 1774} )(); 1775
1776return $.effects; 1777 1778} ); 1779 1780 1781/*! 1782 * jQuery UI Focusable 1.14.1 1783 * https://jqueryui.com 1784 * 1785 * Copyright OpenJS Foundation and other contributors 1786 * Released under the MIT license. 1787 * https://jquery.org/license 1788 */ 1789 1790//>>label: :focusable Selector 1791//>>group: Core 1792//>>description: Selects elements which can be focused. 1793//>>docs: https://api.jqueryui.com/focusable-selector/ 1794 1795( function( factory ) { 1796 "use strict"; 1797 1798 if ( typeof define === "function" && define.amd ) { 1799 1800 // AMD. Register as an anonymous module. 1801 define( [ "jquery", "./version" ], factory ); 1802 } else { 1803 1804 // Browser globals 1805 factory( jQuery ); 1806 } 1807} )( function( $ ) { 1808"use strict"; 1809 1810// Selectors 1811$.ui.focusable = function( element, hasTabindex ) { 1812 var map, mapName, img, focusableIfVisible, fieldset, 1813 nodeName = element.nodeName.toLowerCase(); 1814 1815 if ( "area" === nodeName ) { 1816 map = element.parentNode; 1817 mapName = map.name; 1818 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 1819 return false;
vendor: 14,280 bytes, lines 1820-2407
1820 } 1821 img = $( "img[usemap='#" + mapName + "']" ); 1822 return img.length > 0 && img.is( ":visible" ); 1823 } 1824 1825 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 1826 focusableIfVisible = !element.disabled; 1827 1828 if ( focusableIfVisible ) { 1829 1830 // Form controls within a disabled fieldset are disabled. 1831 // However, controls within the fieldset's legend do not get disabled. 1832 // Since controls generally aren't placed inside legends, we skip 1833 // this portion of the check. 1834 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 1835 if ( fieldset ) { 1836 focusableIfVisible = !fieldset.disabled; 1837 } 1838 } 1839 } else if ( "a" === nodeName ) { 1840 focusableIfVisible = element.href || hasTabindex; 1841 } else { 1842 focusableIfVisible = hasTabindex; 1843 } 1844 1845 return focusableIfVisible && $( element ).is( ":visible" ) && 1846 $( element ).css( "visibility" ) === "visible"; 1847}; 1848 1849$.extend( $.expr.pseudos, { 1850 focusable: function( element ) { 1851 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 1852 } 1853} ); 1854 1855return $.ui.focusable; 1856 1857} ); 1858 1859 1860/*! 1861 * jQuery UI Form Reset Mixin 1.14.1 1862 * https://jqueryui.com 1863 * 1864 * Copyright OpenJS Foundation and other contributors 1865 * Released under the MIT license. 1866 * https://jquery.org/license 1867 */ 1868 1869//>>label: Form Reset Mixin 1870//>>group: Core 1871//>>description: Refresh input widgets when their form is reset 1872//>>docs: https://api.jqueryui.com/form-reset-mixin/ 1873 1874( function( factory ) { 1875 "use strict"; 1876 1877 if ( typeof define === "function" && define.amd ) { 1878 1879 // AMD. Register as an anonymous module. 1880 define( [ 1881 "jquery", 1882 "./version" 1883 ], factory ); 1884 } else { 1885 1886 // Browser globals 1887 factory( jQuery ); 1888 } 1889} )( function( $ ) { 1890"use strict"; 1891 1892return $.ui.formResetMixin = { 1893 _formResetHandler: function() { 1894 var form = $( this ); 1895 1896 // Wait for the form reset to actually happen before refreshing 1897 setTimeout( function() { 1898 var instances = form.data( "ui-form-reset-instances" ); 1899 $.each( instances, function() { 1900 this.refresh(); 1901 } ); 1902 } ); 1903 }, 1904 1905 _bindFormResetHandler: function() { 1906 this.form = $( this.element.prop( "form" ) ); 1907 if ( !this.form.length ) { 1908 return; 1909 } 1910 1911 var instances = this.form.data( "ui-form-reset-instances" ) || []; 1912 if ( !instances.length ) { 1913 1914 // We don't use _on() here because we use a single event handler per form 1915 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 1916 } 1917 instances.push( this ); 1918 this.form.data( "ui-form-reset-instances", instances ); 1919 }, 1920 1921 _unbindFormResetHandler: function() { 1922 if ( !this.form.length ) { 1923 return; 1924 } 1925 1926 var instances = this.form.data( "ui-form-reset-instances" ); 1927 instances.splice( $.inArray( this, instances ), 1 ); 1928 if ( instances.length ) { 1929 this.form.data( "ui-form-reset-instances", instances ); 1930 } else { 1931 this.form 1932 .removeData( "ui-form-reset-instances" ) 1933 .off( "reset.ui-form-reset" ); 1934 } 1935 } 1936}; 1937 1938} ); 1939 1940 1941/*! 1942 * jQuery UI Legacy jQuery Core patches 1.14.1 1943 * https://jqueryui.com 1944 * 1945 * Copyright OpenJS Foundation and other contributors 1946 * Released under the MIT license. 1947 * https://jquery.org/license 1948 * 1949 */ 1950 1951//>>label: Legacy jQuery Core patches 1952//>>group: Core 1953//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated) 1954 1955( function( factory ) { 1956"use strict"; 1957 1958 if ( typeof define === "function" && define.amd ) { 1959 1960 // AMD. Register as an anonymous module. 1961 define( [ "jquery", "./version" ], factory ); 1962 } else { 1963 1964 // Browser globals 1965 factory( jQuery ); 1966 } 1967} )( function( $ ) { 1968"use strict"; 1969 1970// Support: jQuery 2.2.x or older. 1971// This method has been defined in jQuery 3.0.0. 1972// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 1973if ( !$.escapeSelector ) { 1974 $.escapeSelector = function( id ) { 1975 return CSS.escape( id + "" ); 1976 }; 1977} 1978 1979// Support: jQuery 3.4.x or older 1980// These methods have been defined in jQuery 3.5.0. 1981if ( !$.fn.even || !$.fn.odd ) { 1982 $.fn.extend( { 1983 even: function() { 1984 return this.filter( function( i ) { 1985 return i % 2 === 0; 1986 } ); 1987 }, 1988 odd: function() { 1989 return this.filter( function( i ) { 1990 return i % 2 === 1; 1991 } ); 1992 } 1993 } ); 1994} 1995 1996} ); 1997 1998 1999/*! 2000 * jQuery UI Keycode 1.14.1 2001 * https://jqueryui.com 2002 * 2003 * Copyright OpenJS Foundation and other contributors 2004 * Released under the MIT license. 2005 * https://jquery.org/license 2006 */ 2007 2008//>>label: Keycode 2009//>>group: Core 2010//>>description: Provide keycodes as keynames 2011//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 2012 2013( function( factory ) { 2014 "use strict"; 2015 2016 if ( typeof define === "function" && define.amd ) { 2017 2018 // AMD. Register as an anonymous module. 2019 define( [ "jquery", "./version" ], factory ); 2020 } else { 2021 2022 // Browser globals 2023 factory( jQuery ); 2024 } 2025} )( function( $ ) { 2026"use strict"; 2027 2028return $.ui.keyCode = { 2029 BACKSPACE: 8, 2030 COMMA: 188, 2031 DELETE: 46, 2032 DOWN: 40, 2033 END: 35, 2034 ENTER: 13, 2035 ESCAPE: 27, 2036 HOME: 36, 2037 LEFT: 37, 2038 PAGE_DOWN: 34, 2039 PAGE_UP: 33, 2040 PERIOD: 190, 2041 RIGHT: 39, 2042 SPACE: 32, 2043 TAB: 9, 2044 UP: 38 2045}; 2046 2047} ); 2048 2049 2050/*! 2051 * jQuery UI Labels 1.14.1 2052 * https://jqueryui.com 2053 * 2054 * Copyright OpenJS Foundation and other contributors 2055 * Released under the MIT license. 2056 * https://jquery.org/license 2057 */ 2058 2059//>>label: labels 2060//>>group: Core 2061//>>description: Find all the labels associated with a given input 2062//>>docs: https://api.jqueryui.com/labels/ 2063 2064( function( factory ) { 2065 "use strict"; 2066 2067 if ( typeof define === "function" && define.amd ) { 2068 2069 // AMD. Register as an anonymous module. 2070 define( [ "jquery", "./version" ], factory ); 2071 } else { 2072 2073 // Browser globals 2074 factory( jQuery ); 2075 } 2076} )( function( $ ) { 2077"use strict"; 2078 2079return $.fn.labels = function() { 2080 var ancestor, selector, id, labels, ancestors; 2081 2082 if ( !this.length ) { 2083 return this.pushStack( [] ); 2084 } 2085 2086 // Check control.labels first 2087 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 2088 return this.pushStack( this[ 0 ].labels ); 2089 } 2090 2091 // If `control.labels` is empty - e.g. inside of document fragments - find 2092 // the labels manually 2093 labels = this.eq( 0 ).parents( "label" ); 2094 2095 // Look for the label based on the id 2096 id = this.attr( "id" ); 2097 if ( id ) { 2098 2099 // We don't search against the document in case the element 2100 // is disconnected from the DOM 2101 ancestor = this.eq( 0 ).parents().last(); 2102 2103 // Get a full set of top level ancestors 2104 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 2105 2106 // Create a selector for the label based on the id 2107 selector = "label[for='" + CSS.escape( id ) + "']"; 2108 2109 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 2110 2111 } 2112 2113 // Return whatever we have found for labels 2114 return this.pushStack( labels ); 2115}; 2116 2117} ); 2118 2119( function( factory ) { 2120 "use strict"; 2121 2122 if ( typeof define === "function" && define.amd ) { 2123 2124 // AMD. Register as an anonymous module. 2125 define( [ "jquery", "./version" ], factory ); 2126 } else { 2127 2128 // Browser globals 2129 factory( jQuery ); 2130 } 2131} )( function( $ ) { 2132"use strict"; 2133 2134// $.ui.plugin is deprecated. Use $.widget() extensions instead. 2135return $.ui.plugin = { 2136 add: function( module, option, set ) { 2137 var i, 2138 proto = $.ui[ module ].prototype; 2139 for ( i in set ) { 2140 proto.plugins[ i ] = proto.plugins[ i ] || []; 2141 proto.plugins[ i ].push( [ option, set[ i ] ] ); 2142 } 2143 }, 2144 call: function( instance, name, args, allowDisconnected ) { 2145 var i, 2146 set = instance.plugins[ name ]; 2147 2148 if ( !set ) { 2149 return; 2150 } 2151 2152 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 2153 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 2154 return; 2155 } 2156 2157 for ( i = 0; i < set.length; i++ ) { 2158 if ( instance.options[ set[ i ][ 0 ] ] ) { 2159 set[ i ][ 1 ].apply( instance.element, args ); 2160 } 2161 } 2162 } 2163}; 2164 2165} ); 2166 2167 2168/*! 2169 * jQuery UI Position 1.14.1 2170 * https://jqueryui.com 2171 * 2172 * Copyright OpenJS Foundation and other contributors 2173 * Released under the MIT license. 2174 * https://jquery.org/license 2175 * 2176 * https://api.jqueryui.com/position/ 2177 */ 2178 2179//>>label: Position 2180//>>group: Core 2181//>>description: Positions elements relative to other elements. 2182//>>docs: https://api.jqueryui.com/position/ 2183//>>demos: https://jqueryui.com/position/ 2184 2185( function( factory ) { 2186 "use strict"; 2187 2188 if ( typeof define === "function" && define.amd ) { 2189 2190 // AMD. Register as an anonymous module. 2191 define( [ "jquery", "./version" ], factory ); 2192 } else { 2193 2194 // Browser globals 2195 factory( jQuery ); 2196 } 2197} )( function( $ ) { 2198"use strict"; 2199 2200( function() { 2201var cachedScrollbarWidth, 2202 max = Math.max, 2203 abs = Math.abs, 2204 rhorizontal = /left|center|right/, 2205 rvertical = /top|center|bottom/, 2206 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 2207 rposition = /^\w+/, 2208 rpercent = /%$/, 2209 _position = $.fn.position; 2210 2211function getOffsets( offsets, width, height ) { 2212 return [ 2213 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 2214 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 2215 ]; 2216} 2217 2218function parseCss( element, property ) { 2219 return parseInt( $.css( element, property ), 10 ) || 0; 2220} 2221 2222function isWindow( obj ) { 2223 return obj != null && obj === obj.window; 2224} 2225 2226function getDimensions( elem ) { 2227 var raw = elem[ 0 ]; 2228 if ( raw.nodeType === 9 ) { 2229 return { 2230 width: elem.width(), 2231 height: elem.height(), 2232 offset: { top: 0, left: 0 } 2233 }; 2234 } 2235 if ( isWindow( raw ) ) { 2236 return { 2237 width: elem.width(), 2238 height: elem.height(), 2239 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 2240 }; 2241 } 2242 if ( raw.preventDefault ) { 2243 return { 2244 width: 0, 2245 height: 0, 2246 offset: { top: raw.pageY, left: raw.pageX } 2247 }; 2248 } 2249 return { 2250 width: elem.outerWidth(), 2251 height: elem.outerHeight(), 2252 offset: elem.offset() 2253 }; 2254} 2255 2256$.position = { 2257 scrollbarWidth: function() { 2258 if ( cachedScrollbarWidth !== undefined ) { 2259 return cachedScrollbarWidth; 2260 } 2261 var w1, w2, 2262 div = $( "<div style=" + 2263 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 2264 "<div style='height:300px;width:auto;'></div></div>" ), 2265 innerDiv = div.children()[ 0 ]; 2266 2267 $( "body" ).append( div ); 2268 w1 = innerDiv.offsetWidth; 2269 div.css( "overflow", "scroll" ); 2270 2271 w2 = innerDiv.offsetWidth; 2272 2273 if ( w1 === w2 ) { 2274 w2 = div[ 0 ].clientWidth; 2275 } 2276 2277 div.remove(); 2278 2279 return ( cachedScrollbarWidth = w1 - w2 ); 2280 }, 2281 getScrollInfo: function( within ) { 2282 var overflowX = within.isWindow || within.isDocument ? "" : 2283 within.element.css( "overflow-x" ), 2284 overflowY = within.isWindow || within.isDocument ? "" : 2285 within.element.css( "overflow-y" ), 2286 hasOverflowX = overflowX === "scroll" || 2287 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 2288 hasOverflowY = overflowY === "scroll" || 2289 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 2290 return { 2291 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 2292 height: hasOverflowX ? $.position.scrollbarWidth() : 0 2293 }; 2294 }, 2295 getWithinInfo: function( element ) { 2296 var withinElement = $( element || window ), 2297 isElemWindow = isWindow( withinElement[ 0 ] ), 2298 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 2299 hasOffset = !isElemWindow && !isDocument; 2300 return { 2301 element: withinElement, 2302 isWindow: isElemWindow, 2303 isDocument: isDocument, 2304 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 2305 scrollLeft: withinElement.scrollLeft(), 2306 scrollTop: withinElement.scrollTop(), 2307 width: withinElement.outerWidth(), 2308 height: withinElement.outerHeight() 2309 }; 2310 } 2311}; 2312 2313$.fn.position = function( options ) { 2314 if ( !options || !options.of ) { 2315 return _position.apply( this, arguments ); 2316 } 2317 2318 // Make a copy, we don't want to modify arguments 2319 options = $.extend( {}, options ); 2320 2321 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 2322 2323 // Make sure string options are treated as CSS selectors 2324 target = typeof options.of === "string" ? 2325 $( document ).find( options.of ) : 2326 $( options.of ), 2327 2328 within = $.position.getWithinInfo( options.within ), 2329 scrollInfo = $.position.getScrollInfo( within ), 2330 collision = ( options.collision || "flip" ).split( " " ), 2331 offsets = {}; 2332 2333 dimensions = getDimensions( target ); 2334 if ( target[ 0 ].preventDefault ) { 2335 2336 // Force left top to allow flipping 2337 options.at = "left top"; 2338 } 2339 targetWidth = dimensions.width; 2340 targetHeight = dimensions.height; 2341 targetOffset = dimensions.offset; 2342 2343 // Clone to reuse original targetOffset later 2344 basePosition = $.extend( {}, targetOffset ); 2345 2346 // Force my and at to have valid horizontal and vertical positions 2347 // if a value is missing or invalid, it will be converted to center 2348 $.each( [ "my", "at" ], function() { 2349 var pos = ( options[ this ] || "" ).split( " " ), 2350 horizontalOffset, 2351 verticalOffset; 2352 2353 if ( pos.length === 1 ) { 2354 pos = rhorizontal.test( pos[ 0 ] ) ? 2355 pos.concat( [ "center" ] ) : 2356 rvertical.test( pos[ 0 ] ) ? 2357 [ "center" ].concat( pos ) : 2358 [ "center", "center" ]; 2359 } 2360 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 2361 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 2362 2363 // Calculate offsets 2364 horizontalOffset = roffset.exec( pos[ 0 ] ); 2365 verticalOffset = roffset.exec( pos[ 1 ] ); 2366 offsets[ this ] = [ 2367 horizontalOffset ? horizontalOffset[ 0 ] : 0, 2368 verticalOffset ? verticalOffset[ 0 ] : 0 2369 ]; 2370 2371 // Reduce to just the positions without the offsets 2372 options[ this ] = [ 2373 rposition.exec( pos[ 0 ] )[ 0 ], 2374 rposition.exec( pos[ 1 ] )[ 0 ] 2375 ]; 2376 } ); 2377 2378 // Normalize collision option 2379 if ( collision.length === 1 ) { 2380 collision[ 1 ] = collision[ 0 ]; 2381 } 2382 2383 if ( options.at[ 0 ] === "right" ) { 2384 basePosition.left += targetWidth; 2385 } else if ( options.at[ 0 ] === "center" ) { 2386 basePosition.left += targetWidth / 2; 2387 } 2388 2389 if ( options.at[ 1 ] === "bottom" ) { 2390 basePosition.top += targetHeight; 2391 } else if ( options.at[ 1 ] === "center" ) { 2392 basePosition.top += targetHeight / 2; 2393 } 2394 2395 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 2396 basePosition.left += atOffset[ 0 ]; 2397 basePosition.top += atOffset[ 1 ]; 2398 2399 return this.each( function() { 2400 var collisionPosition, using, 2401 elem = $( this ), 2402 elemWidth = elem.outerWidth(), 2403 elemHeight = elem.outerHeight(), 2404 marginLeft = parseCss( this, "marginLeft" ), 2405 marginTop = parseCss( this, "marginTop" ), 2406 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 2407 scrollInfo.width,
vendor: 9,540 bytes, lines 2408-2717
2408 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 2409 scrollInfo.height, 2410 position = $.extend( {}, basePosition ), 2411 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 2412 2413 if ( options.my[ 0 ] === "right" ) { 2414 position.left -= elemWidth; 2415 } else if ( options.my[ 0 ] === "center" ) { 2416 position.left -= elemWidth / 2; 2417 } 2418 2419 if ( options.my[ 1 ] === "bottom" ) { 2420 position.top -= elemHeight; 2421 } else if ( options.my[ 1 ] === "center" ) { 2422 position.top -= elemHeight / 2; 2423 } 2424 2425 position.left += myOffset[ 0 ]; 2426 position.top += myOffset[ 1 ]; 2427 2428 collisionPosition = { 2429 marginLeft: marginLeft, 2430 marginTop: marginTop 2431 }; 2432 2433 $.each( [ "left", "top" ], function( i, dir ) { 2434 if ( $.ui.position[ collision[ i ] ] ) { 2435 $.ui.position[ collision[ i ] ][ dir ]( position, { 2436 targetWidth: targetWidth, 2437 targetHeight: targetHeight, 2438 elemWidth: elemWidth, 2439 elemHeight: elemHeight, 2440 collisionPosition: collisionPosition, 2441 collisionWidth: collisionWidth, 2442 collisionHeight: collisionHeight, 2443 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 2444 my: options.my, 2445 at: options.at, 2446 within: within, 2447 elem: elem 2448 } ); 2449 } 2450 } ); 2451 2452 if ( options.using ) { 2453 2454 // Adds feedback as second argument to using callback, if present 2455 using = function( props ) { 2456 var left = targetOffset.left - position.left, 2457 right = left + targetWidth - elemWidth, 2458 top = targetOffset.top - position.top, 2459 bottom = top + targetHeight - elemHeight, 2460 feedback = { 2461 target: { 2462 element: target, 2463 left: targetOffset.left, 2464 top: targetOffset.top, 2465 width: targetWidth, 2466 height: targetHeight 2467 }, 2468 element: { 2469 element: elem, 2470 left: position.left, 2471 top: position.top, 2472 width: elemWidth, 2473 height: elemHeight 2474 }, 2475 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 2476 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 2477 }; 2478 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 2479 feedback.horizontal = "center"; 2480 } 2481 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 2482 feedback.vertical = "middle"; 2483 } 2484 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 2485 feedback.important = "horizontal"; 2486 } else { 2487 feedback.important = "vertical"; 2488 } 2489 options.using.call( this, props, feedback ); 2490 }; 2491 } 2492 2493 elem.offset( $.extend( position, { using: using } ) ); 2494 } ); 2495}; 2496 2497$.ui.position = { 2498 fit: { 2499 left: function( position, data ) { 2500 var within = data.within, 2501 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 2502 outerWidth = within.width, 2503 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 2504 overLeft = withinOffset - collisionPosLeft, 2505 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 2506 newOverRight; 2507 2508 // Element is wider than within 2509 if ( data.collisionWidth > outerWidth ) { 2510 2511 // Element is initially over the left side of within 2512 if ( overLeft > 0 && overRight <= 0 ) { 2513 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 2514 withinOffset; 2515 position.left += overLeft - newOverRight; 2516 2517 // Element is initially over right side of within 2518 } else if ( overRight > 0 && overLeft <= 0 ) { 2519 position.left = withinOffset; 2520 2521 // Element is initially over both left and right sides of within 2522 } else { 2523 if ( overLeft > overRight ) { 2524 position.left = withinOffset + outerWidth - data.collisionWidth; 2525 } else { 2526 position.left = withinOffset; 2527 } 2528 } 2529 2530 // Too far left -> align with left edge 2531 } else if ( overLeft > 0 ) { 2532 position.left += overLeft; 2533 2534 // Too far right -> align with right edge 2535 } else if ( overRight > 0 ) { 2536 position.left -= overRight; 2537 2538 // Adjust based on position and margin 2539 } else { 2540 position.left = max( position.left - collisionPosLeft, position.left ); 2541 } 2542 }, 2543 top: function( position, data ) { 2544 var within = data.within, 2545 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 2546 outerHeight = data.within.height, 2547 collisionPosTop = position.top - data.collisionPosition.marginTop, 2548 overTop = withinOffset - collisionPosTop, 2549 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 2550 newOverBottom; 2551 2552 // Element is taller than within 2553 if ( data.collisionHeight > outerHeight ) { 2554 2555 // Element is initially over the top of within 2556 if ( overTop > 0 && overBottom <= 0 ) { 2557 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 2558 withinOffset; 2559 position.top += overTop - newOverBottom; 2560 2561 // Element is initially over bottom of within 2562 } else if ( overBottom > 0 && overTop <= 0 ) { 2563 position.top = withinOffset; 2564 2565 // Element is initially over both top and bottom of within 2566 } else { 2567 if ( overTop > overBottom ) { 2568 position.top = withinOffset + outerHeight - data.collisionHeight; 2569 } else { 2570 position.top = withinOffset; 2571 } 2572 } 2573 2574 // Too far up -> align with top 2575 } else if ( overTop > 0 ) { 2576 position.top += overTop; 2577 2578 // Too far down -> align with bottom edge 2579 } else if ( overBottom > 0 ) { 2580 position.top -= overBottom; 2581 2582 // Adjust based on position and margin 2583 } else { 2584 position.top = max( position.top - collisionPosTop, position.top ); 2585 } 2586 } 2587 }, 2588 flip: { 2589 left: function( position, data ) { 2590 var within = data.within, 2591 withinOffset = within.offset.left + within.scrollLeft, 2592 outerWidth = within.width, 2593 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 2594 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 2595 overLeft = collisionPosLeft - offsetLeft, 2596 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 2597 myOffset = data.my[ 0 ] === "left" ? 2598 -data.elemWidth : 2599 data.my[ 0 ] === "right" ? 2600 data.elemWidth : 2601 0, 2602 atOffset = data.at[ 0 ] === "left" ? 2603 data.targetWidth : 2604 data.at[ 0 ] === "right" ? 2605 -data.targetWidth : 2606 0, 2607 offset = -2 * data.offset[ 0 ], 2608 newOverRight, 2609 newOverLeft; 2610 2611 if ( overLeft < 0 ) { 2612 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 2613 outerWidth - withinOffset; 2614 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 2615 position.left += myOffset + atOffset + offset; 2616 } 2617 } else if ( overRight > 0 ) { 2618 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 2619 atOffset + offset - offsetLeft; 2620 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 2621 position.left += myOffset + atOffset + offset; 2622 } 2623 } 2624 }, 2625 top: function( position, data ) { 2626 var within = data.within, 2627 withinOffset = within.offset.top + within.scrollTop, 2628 outerHeight = within.height, 2629 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 2630 collisionPosTop = position.top - data.collisionPosition.marginTop, 2631 overTop = collisionPosTop - offsetTop, 2632 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 2633 top = data.my[ 1 ] === "top", 2634 myOffset = top ? 2635 -data.elemHeight : 2636 data.my[ 1 ] === "bottom" ? 2637 data.elemHeight : 2638 0, 2639 atOffset = data.at[ 1 ] === "top" ? 2640 data.targetHeight : 2641 data.at[ 1 ] === "bottom" ? 2642 -data.targetHeight : 2643 0, 2644 offset = -2 * data.offset[ 1 ], 2645 newOverTop, 2646 newOverBottom; 2647 if ( overTop < 0 ) { 2648 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 2649 outerHeight - withinOffset; 2650 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 2651 position.top += myOffset + atOffset + offset; 2652 } 2653 } else if ( overBottom > 0 ) { 2654 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 2655 offset - offsetTop; 2656 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 2657 position.top += myOffset + atOffset + offset; 2658 } 2659 } 2660 } 2661 }, 2662 flipfit: { 2663 left: function() { 2664 $.ui.position.flip.left.apply( this, arguments ); 2665 $.ui.position.fit.left.apply( this, arguments ); 2666 }, 2667 top: function() { 2668 $.ui.position.flip.top.apply( this, arguments ); 2669 $.ui.position.fit.top.apply( this, arguments ); 2670 } 2671 } 2672}; 2673 2674} )(); 2675 2676return $.ui.position; 2677 2678} ); 2679 2680 2681/*! 2682 * jQuery UI Scroll Parent 1.14.1 2683 * https://jqueryui.com 2684 * 2685 * Copyright OpenJS Foundation and other contributors 2686 * Released under the MIT license. 2687 * https://jquery.org/license 2688 */ 2689 2690//>>label: scrollParent 2691//>>group: Core 2692//>>description: Get the closest ancestor element that is scrollable. 2693//>>docs: https://api.jqueryui.com/scrollParent/ 2694 2695( function( factory ) { 2696 "use strict"; 2697 2698 if ( typeof define === "function" && define.amd ) { 2699 2700 // AMD. Register as an anonymous module. 2701 define( [ "jquery", "./version" ], factory ); 2702 } else { 2703 2704 // Browser globals 2705 factory( jQuery ); 2706 } 2707} )( function( $ ) { 2708"use strict"; 2709 2710return $.fn.scrollParent = function( includeHidden ) { 2711 var position = this.css( "position" ), 2712 excludeStaticParent = position === "absolute", 2713 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 2714 scrollParent = this.parents().filter( function() { 2715 var parent = $( this ); 2716 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 2717 return false;
2718 } 2719 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 2720 parent.css( "overflow-x" ) ); 2721 } ).eq( 0 ); 2722 2723 return position === "fixed" || !scrollParent.length ? 2724 $( this[ 0 ].ownerDocument || document ) : 2725 scrollParent; 2726}; 2727 2728} ); 2729 2730 2731 2732/*! 2733 * jQuery UI Tabbable 1.14.1 2734 * https://jqueryui.com 2735 * 2736 * Copyright OpenJS Foundation and other contributors 2737 * Released under the MIT license. 2738 * https://jquery.org/license 2739 */ 2740 2741//>>label: :tabbable Selector 2742//>>group: Core 2743//>>description: Selects elements which can be tabbed to. 2744//>>docs: https://api.jqueryui.com/tabbable-selector/ 2745 2746( function( factory ) { 2747 "use strict"; 2748 2749 if ( typeof define === "function" && define.amd ) { 2750 2751 // AMD. Register as an anonymous module. 2752 define( [ "jquery", "./version", "./focusable" ], factory ); 2753 } else { 2754 2755 // Browser globals 2756 factory( jQuery ); 2757 } 2758} )( function( $ ) { 2759"use strict"; 2760 2761return $.extend( $.expr.pseudos, { 2762 tabbable: function( element ) { 2763 var tabIndex = $.attr( element, "tabindex" ), 2764 hasTabindex = tabIndex != null; 2765 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 2766 } 2767} ); 2768 2769} ); 2770 2771 2772/*! 2773 * jQuery UI Unique ID 1.14.1 2774 * https://jqueryui.com 2775 * 2776 * Copyright OpenJS Foundation and other contributors 2777 * Released under the MIT license. 2778 * https://jquery.org/license 2779 */ 2780 2781//>>label: uniqueId 2782//>>group: Core 2783//>>description: Functions to generate and remove uniqueId's 2784//>>docs: https://api.jqueryui.com/uniqueId/ 2785 2786( function( factory ) { 2787 "use strict"; 2788 2789 if ( typeof define === "function" && define.amd ) { 2790 2791 // AMD. Register as an anonymous module. 2792 define( [ "jquery", "./version" ], factory ); 2793 } else { 2794 2795 // Browser globals 2796 factory( jQuery ); 2797 } 2798} )( function( $ ) { 2799"use strict"; 2800 2801return $.fn.extend( { 2802 uniqueId: ( function() { 2803 var uuid = 0; 2804 2805 return function() { 2806 return this.each( function() { 2807 if ( !this.id ) { 2808 this.id = "ui-id-" + ( ++uuid ); 2809 } 2810 } ); 2811 }; 2812 } )(), 2813 2814 removeUniqueId: function() { 2815 return this.each( function() { 2816 if ( /^ui-id-\d+$/.test( this.id ) ) { 2817 $( this ).removeAttr( "id" ); 2818 } 2819 } ); 2820 } 2821} ); 2822 2823} ); 2824 2825 2826/*! 2827 * jQuery UI Widget 1.14.1 2828 * https://jqueryui.com 2829 * 2830 * Copyright OpenJS Foundation and other contributors 2831 * Released under the MIT license. 2832 * https://jquery.org/license 2833 */ 2834 2835//>>label: Widget 2836//>>group: Core 2837//>>description: Provides a factory for creating stateful widgets with a common API. 2838//>>docs: https://api.jqueryui.com/jQuery.widget/ 2839//>>demos: https://jqueryui.com/widget/ 2840 2841( function( factory ) { 2842 "use strict"; 2843 2844 if ( typeof define === "function" && define.amd ) { 2845 2846 // AMD. Register as an anonymous module. 2847 define( [ "jquery", "./version" ], factory ); 2848 } else { 2849 2850 // Browser globals 2851 factory( jQuery ); 2852 } 2853} )( function( $ ) { 2854"use strict";
vendor: 19,709 bytes, lines 2854-3581
2854 2855 2856var widgetUuid = 0; 2857var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 2858var widgetSlice = Array.prototype.slice; 2859 2860$.cleanData = ( function( orig ) { 2861 return function( elems ) { 2862 var events, elem, i; 2863 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 2864 2865 // Only trigger remove when necessary to save time 2866 events = $._data( elem, "events" ); 2867 if ( events && events.remove ) { 2868 $( elem ).triggerHandler( "remove" ); 2869 } 2870 } 2871 orig( elems ); 2872 }; 2873} )( $.cleanData ); 2874 2875$.widget = function( name, base, prototype ) { 2876 var existingConstructor, constructor, basePrototype; 2877 2878 // ProxiedPrototype allows the provided prototype to remain unmodified 2879 // so that it can be used as a mixin for multiple widgets (#8876) 2880 var proxiedPrototype = {}; 2881 2882 var namespace = name.split( "." )[ 0 ]; 2883 name = name.split( "." )[ 1 ]; 2884 if ( name === "__proto__" || name === "constructor" ) { 2885 return $.error( "Invalid widget name: " + name ); 2886 } 2887 var fullName = namespace + "-" + name; 2888 2889 if ( !prototype ) { 2890 prototype = base; 2891 base = $.Widget; 2892 } 2893 2894 if ( Array.isArray( prototype ) ) { 2895 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 2896 } 2897 2898 // Create selector for plugin 2899 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 2900 return !!$.data( elem, fullName ); 2901 }; 2902 2903 $[ namespace ] = $[ namespace ] || {}; 2904 existingConstructor = $[ namespace ][ name ]; 2905 constructor = $[ namespace ][ name ] = function( options, element ) { 2906 2907 // Allow instantiation without "new" keyword 2908 if ( !this || !this._createWidget ) { 2909 return new constructor( options, element ); 2910 } 2911 2912 // Allow instantiation without initializing for simple inheritance 2913 // must use "new" keyword (the code above always passes args) 2914 if ( arguments.length ) { 2915 this._createWidget( options, element ); 2916 } 2917 }; 2918 2919 // Extend with the existing constructor to carry over any static properties 2920 $.extend( constructor, existingConstructor, { 2921 version: prototype.version, 2922 2923 // Copy the object used to create the prototype in case we need to 2924 // redefine the widget later 2925 _proto: $.extend( {}, prototype ), 2926 2927 // Track widgets that inherit from this widget in case this widget is 2928 // redefined after a widget inherits from it 2929 _childConstructors: [] 2930 } ); 2931 2932 basePrototype = new base(); 2933 2934 // We need to make the options hash a property directly on the new instance 2935 // otherwise we'll modify the options hash on the prototype that we're 2936 // inheriting from 2937 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 2938 $.each( prototype, function( prop, value ) { 2939 if ( typeof value !== "function" ) { 2940 proxiedPrototype[ prop ] = value; 2941 return; 2942 } 2943 proxiedPrototype[ prop ] = ( function() { 2944 function _super() { 2945 return base.prototype[ prop ].apply( this, arguments ); 2946 } 2947 2948 function _superApply( args ) { 2949 return base.prototype[ prop ].apply( this, args ); 2950 } 2951 2952 return function() { 2953 var __super = this._super; 2954 var __superApply = this._superApply; 2955 var returnValue; 2956 2957 this._super = _super; 2958 this._superApply = _superApply; 2959 2960 returnValue = value.apply( this, arguments ); 2961 2962 this._super = __super; 2963 this._superApply = __superApply; 2964 2965 return returnValue; 2966 }; 2967 } )(); 2968 } ); 2969 constructor.prototype = $.widget.extend( basePrototype, { 2970 2971 // TODO: remove support for widgetEventPrefix 2972 // always use the name + a colon as the prefix, e.g., draggable:start 2973 // don't prefix for widgets that aren't DOM-based 2974 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 2975 }, proxiedPrototype, { 2976 constructor: constructor, 2977 namespace: namespace, 2978 widgetName: name, 2979 widgetFullName: fullName 2980 } ); 2981 2982 // If this widget is being redefined then we need to find all widgets that 2983 // are inheriting from it and redefine all of them so that they inherit from 2984 // the new version of this widget. We're essentially trying to replace one 2985 // level in the prototype chain. 2986 if ( existingConstructor ) { 2987 $.each( existingConstructor._childConstructors, function( i, child ) { 2988 var childPrototype = child.prototype; 2989 2990 // Redefine the child widget using the same prototype that was 2991 // originally used, but inherit from the new version of the base 2992 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 2993 child._proto ); 2994 } ); 2995 2996 // Remove the list of existing child constructors from the old constructor 2997 // so the old child constructors can be garbage collected 2998 delete existingConstructor._childConstructors; 2999 } else { 3000 base._childConstructors.push( constructor ); 3001 } 3002 3003 $.widget.bridge( name, constructor ); 3004 3005 return constructor; 3006}; 3007 3008$.widget.extend = function( target ) { 3009 var input = widgetSlice.call( arguments, 1 ); 3010 var inputIndex = 0; 3011 var inputLength = input.length; 3012 var key; 3013 var value; 3014 3015 for ( ; inputIndex < inputLength; inputIndex++ ) { 3016 for ( key in input[ inputIndex ] ) { 3017 value = input[ inputIndex ][ key ]; 3018 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 3019 3020 // Clone objects 3021 if ( $.isPlainObject( value ) ) { 3022 target[ key ] = $.isPlainObject( target[ key ] ) ? 3023 $.widget.extend( {}, target[ key ], value ) : 3024 3025 // Don't extend strings, arrays, etc. with objects 3026 $.widget.extend( {}, value ); 3027 3028 // Copy everything else by reference 3029 } else { 3030 target[ key ] = value; 3031 } 3032 } 3033 } 3034 } 3035 return target; 3036}; 3037 3038$.widget.bridge = function( name, object ) { 3039 var fullName = object.prototype.widgetFullName || name; 3040 $.fn[ name ] = function( options ) { 3041 var isMethodCall = typeof options === "string"; 3042 var args = widgetSlice.call( arguments, 1 ); 3043 var returnValue = this; 3044 3045 if ( isMethodCall ) { 3046 3047 // If this is an empty collection, we need to have the instance method 3048 // return undefined instead of the jQuery instance 3049 if ( !this.length && options === "instance" ) { 3050 returnValue = undefined; 3051 } else { 3052 this.each( function() { 3053 var methodValue; 3054 var instance = $.data( this, fullName ); 3055 3056 if ( options === "instance" ) { 3057 returnValue = instance; 3058 return false; 3059 } 3060 3061 if ( !instance ) { 3062 return $.error( "cannot call methods on " + name + 3063 " prior to initialization; " + 3064 "attempted to call method '" + options + "'" ); 3065 } 3066 3067 if ( typeof instance[ options ] !== "function" || 3068 options.charAt( 0 ) === "_" ) { 3069 return $.error( "no such method '" + options + "' for " + name + 3070 " widget instance" ); 3071 } 3072 3073 methodValue = instance[ options ].apply( instance, args ); 3074 3075 if ( methodValue !== instance && methodValue !== undefined ) { 3076 returnValue = methodValue && methodValue.jquery ? 3077 returnValue.pushStack( methodValue.get() ) : 3078 methodValue; 3079 return false; 3080 } 3081 } ); 3082 } 3083 } else { 3084 3085 // Allow multiple hashes to be passed on init 3086 if ( args.length ) { 3087 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 3088 } 3089 3090 this.each( function() { 3091 var instance = $.data( this, fullName ); 3092 if ( instance ) { 3093 instance.option( options || {} ); 3094 if ( instance._init ) { 3095 instance._init(); 3096 } 3097 } else { 3098 $.data( this, fullName, new object( options, this ) ); 3099 } 3100 } ); 3101 } 3102 3103 return returnValue; 3104 }; 3105}; 3106 3107$.Widget = function( /* options, element */ ) {}; 3108$.Widget._childConstructors = []; 3109 3110$.Widget.prototype = { 3111 widgetName: "widget", 3112 widgetEventPrefix: "", 3113 defaultElement: "<div>", 3114 3115 options: { 3116 classes: {}, 3117 disabled: false, 3118 3119 // Callbacks 3120 create: null 3121 }, 3122 3123 _createWidget: function( options, element ) { 3124 element = $( element || this.defaultElement || this )[ 0 ]; 3125 this.element = $( element ); 3126 this.uuid = widgetUuid++; 3127 this.eventNamespace = "." + this.widgetName + this.uuid; 3128 3129 this.bindings = $(); 3130 this.hoverable = $(); 3131 this.focusable = $(); 3132 this.classesElementLookup = {}; 3133 3134 if ( element !== this ) { 3135 $.data( element, this.widgetFullName, this ); 3136 this._on( true, this.element, { 3137 remove: function( event ) { 3138 if ( event.target === element ) { 3139 this.destroy(); 3140 } 3141 } 3142 } ); 3143 this.document = $( element.style ? 3144 3145 // Element within the document 3146 element.ownerDocument : 3147 3148 // Element is window or document 3149 element.document || element ); 3150 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 3151 } 3152 3153 this.options = $.widget.extend( {}, 3154 this.options, 3155 this._getCreateOptions(), 3156 options ); 3157 3158 this._create(); 3159 3160 if ( this.options.disabled ) { 3161 this._setOptionDisabled( this.options.disabled ); 3162 } 3163 3164 this._trigger( "create", null, this._getCreateEventData() ); 3165 this._init(); 3166 }, 3167 3168 _getCreateOptions: function() { 3169 return {}; 3170 }, 3171 3172 _getCreateEventData: $.noop, 3173 3174 _create: $.noop, 3175 3176 _init: $.noop, 3177 3178 destroy: function() { 3179 var that = this; 3180 3181 this._destroy(); 3182 $.each( this.classesElementLookup, function( key, value ) { 3183 that._removeClass( value, key ); 3184 } ); 3185 3186 // We can probably remove the unbind calls in 2.0 3187 // all event bindings should go through this._on() 3188 this.element 3189 .off( this.eventNamespace ) 3190 .removeData( this.widgetFullName ); 3191 this.widget() 3192 .off( this.eventNamespace ) 3193 .removeAttr( "aria-disabled" ); 3194 3195 // Clean up events and states 3196 this.bindings.off( this.eventNamespace ); 3197 }, 3198 3199 _destroy: $.noop, 3200 3201 widget: function() { 3202 return this.element; 3203 }, 3204 3205 option: function( key, value ) { 3206 var options = key; 3207 var parts; 3208 var curOption; 3209 var i; 3210 3211 if ( arguments.length === 0 ) { 3212 3213 // Don't return a reference to the internal hash 3214 return $.widget.extend( {}, this.options ); 3215 } 3216 3217 if ( typeof key === "string" ) { 3218 3219 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 3220 options = {}; 3221 parts = key.split( "." ); 3222 key = parts.shift(); 3223 if ( parts.length ) { 3224 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 3225 for ( i = 0; i < parts.length - 1; i++ ) { 3226 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 3227 curOption = curOption[ parts[ i ] ]; 3228 } 3229 key = parts.pop(); 3230 if ( arguments.length === 1 ) { 3231 return curOption[ key ] === undefined ? null : curOption[ key ]; 3232 } 3233 curOption[ key ] = value; 3234 } else { 3235 if ( arguments.length === 1 ) { 3236 return this.options[ key ] === undefined ? null : this.options[ key ]; 3237 } 3238 options[ key ] = value; 3239 } 3240 } 3241 3242 this._setOptions( options ); 3243 3244 return this; 3245 }, 3246 3247 _setOptions: function( options ) { 3248 var key; 3249 3250 for ( key in options ) { 3251 this._setOption( key, options[ key ] ); 3252 } 3253 3254 return this; 3255 }, 3256 3257 _setOption: function( key, value ) { 3258 if ( key === "classes" ) { 3259 this._setOptionClasses( value ); 3260 } 3261 3262 this.options[ key ] = value; 3263 3264 if ( key === "disabled" ) { 3265 this._setOptionDisabled( value ); 3266 } 3267 3268 return this; 3269 }, 3270 3271 _setOptionClasses: function( value ) { 3272 var classKey, elements, currentElements; 3273 3274 for ( classKey in value ) { 3275 currentElements = this.classesElementLookup[ classKey ]; 3276 if ( value[ classKey ] === this.options.classes[ classKey ] || 3277 !currentElements || 3278 !currentElements.length ) { 3279 continue; 3280 } 3281 3282 // We are doing this to create a new jQuery object because the _removeClass() call 3283 // on the next line is going to destroy the reference to the current elements being 3284 // tracked. We need to save a copy of this collection so that we can add the new classes 3285 // below. 3286 elements = $( currentElements.get() ); 3287 this._removeClass( currentElements, classKey ); 3288 3289 // We don't use _addClass() here, because that uses this.options.classes 3290 // for generating the string of classes. We want to use the value passed in from 3291 // _setOption(), this is the new value of the classes option which was passed to 3292 // _setOption(). We pass this value directly to _classes(). 3293 elements.addClass( this._classes( { 3294 element: elements, 3295 keys: classKey, 3296 classes: value, 3297 add: true 3298 } ) ); 3299 } 3300 }, 3301 3302 _setOptionDisabled: function( value ) { 3303 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 3304 3305 // If the widget is becoming disabled, then nothing is interactive 3306 if ( value ) { 3307 this._removeClass( this.hoverable, null, "ui-state-hover" ); 3308 this._removeClass( this.focusable, null, "ui-state-focus" ); 3309 } 3310 }, 3311 3312 enable: function() { 3313 return this._setOptions( { disabled: false } ); 3314 }, 3315 3316 disable: function() { 3317 return this._setOptions( { disabled: true } ); 3318 }, 3319 3320 _classes: function( options ) { 3321 var full = []; 3322 var that = this; 3323 3324 options = $.extend( { 3325 element: this.element, 3326 classes: this.options.classes || {} 3327 }, options ); 3328 3329 function bindRemoveEvent() { 3330 var nodesToBind = []; 3331 3332 options.element.each( function( _, element ) { 3333 var isTracked = $.map( that.classesElementLookup, function( elements ) { 3334 return elements; 3335 } ) 3336 .some( function( elements ) { 3337 return elements.is( element ); 3338 } ); 3339 3340 if ( !isTracked ) { 3341 nodesToBind.push( element ); 3342 } 3343 } ); 3344 3345 that._on( $( nodesToBind ), { 3346 remove: "_untrackClassesElement" 3347 } ); 3348 } 3349 3350 function processClassString( classes, checkOption ) { 3351 var current, i; 3352 for ( i = 0; i < classes.length; i++ ) { 3353 current = that.classesElementLookup[ classes[ i ] ] || $(); 3354 if ( options.add ) { 3355 bindRemoveEvent(); 3356 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 3357 } else { 3358 current = $( current.not( options.element ).get() ); 3359 } 3360 that.classesElementLookup[ classes[ i ] ] = current; 3361 full.push( classes[ i ] ); 3362 if ( checkOption && options.classes[ classes[ i ] ] ) { 3363 full.push( options.classes[ classes[ i ] ] ); 3364 } 3365 } 3366 } 3367 3368 if ( options.keys ) { 3369 processClassString( options.keys.match( /\S+/g ) || [], true ); 3370 } 3371 if ( options.extra ) { 3372 processClassString( options.extra.match( /\S+/g ) || [] ); 3373 } 3374 3375 return full.join( " " ); 3376 }, 3377 3378 _untrackClassesElement: function( event ) { 3379 var that = this; 3380 $.each( that.classesElementLookup, function( key, value ) { 3381 if ( $.inArray( event.target, value ) !== -1 ) { 3382 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 3383 } 3384 } ); 3385 3386 this._off( $( event.target ) ); 3387 }, 3388 3389 _removeClass: function( element, keys, extra ) { 3390 return this._toggleClass( element, keys, extra, false ); 3391 }, 3392 3393 _addClass: function( element, keys, extra ) { 3394 return this._toggleClass( element, keys, extra, true ); 3395 }, 3396 3397 _toggleClass: function( element, keys, extra, add ) { 3398 add = ( typeof add === "boolean" ) ? add : extra; 3399 var shift = ( typeof element === "string" || element === null ), 3400 options = { 3401 extra: shift ? keys : extra, 3402 keys: shift ? element : keys, 3403 element: shift ? this.element : element, 3404 add: add 3405 }; 3406 options.element.toggleClass( this._classes( options ), add ); 3407 return this; 3408 }, 3409 3410 _on: function( suppressDisabledCheck, element, handlers ) { 3411 var delegateElement; 3412 var instance = this; 3413 3414 // No suppressDisabledCheck flag, shuffle arguments 3415 if ( typeof suppressDisabledCheck !== "boolean" ) { 3416 handlers = element; 3417 element = suppressDisabledCheck; 3418 suppressDisabledCheck = false; 3419 } 3420 3421 // No element argument, shuffle and use this.element 3422 if ( !handlers ) { 3423 handlers = element; 3424 element = this.element; 3425 delegateElement = this.widget(); 3426 } else { 3427 element = delegateElement = $( element ); 3428 this.bindings = this.bindings.add( element ); 3429 } 3430 3431 $.each( handlers, function( event, handler ) { 3432 function handlerProxy() { 3433 3434 // Allow widgets to customize the disabled handling 3435 // - disabled as an array instead of boolean 3436 // - disabled class as method for disabling individual parts 3437 if ( !suppressDisabledCheck && 3438 ( instance.options.disabled === true || 3439 $( this ).hasClass( "ui-state-disabled" ) ) ) { 3440 return; 3441 } 3442 return ( typeof handler === "string" ? instance[ handler ] : handler ) 3443 .apply( instance, arguments ); 3444 } 3445 3446 // Copy the guid so direct unbinding works 3447 if ( typeof handler !== "string" ) { 3448 handlerProxy.guid = handler.guid = 3449 handler.guid || handlerProxy.guid || $.guid++; 3450 } 3451 3452 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 3453 var eventName = match[ 1 ] + instance.eventNamespace; 3454 var selector = match[ 2 ]; 3455 3456 if ( selector ) { 3457 delegateElement.on( eventName, selector, handlerProxy ); 3458 } else { 3459 element.on( eventName, handlerProxy ); 3460 } 3461 } ); 3462 }, 3463 3464 _off: function( element, eventName ) { 3465 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 3466 this.eventNamespace; 3467 element.off( eventName ); 3468 3469 // Clear the stack to avoid memory leaks (#10056) 3470 this.bindings = $( this.bindings.not( element ).get() ); 3471 this.focusable = $( this.focusable.not( element ).get() ); 3472 this.hoverable = $( this.hoverable.not( element ).get() ); 3473 }, 3474 3475 _delay: function( handler, delay ) { 3476 function handlerProxy() { 3477 return ( typeof handler === "string" ? instance[ handler ] : handler ) 3478 .apply( instance, arguments ); 3479 } 3480 var instance = this; 3481 return setTimeout( handlerProxy, delay || 0 ); 3482 }, 3483 3484 _hoverable: function( element ) { 3485 this.hoverable = this.hoverable.add( element ); 3486 this._on( element, { 3487 mouseenter: function( event ) { 3488 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 3489 }, 3490 mouseleave: function( event ) { 3491 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 3492 } 3493 } ); 3494 }, 3495 3496 _focusable: function( element ) { 3497 this.focusable = this.focusable.add( element ); 3498 this._on( element, { 3499 focusin: function( event ) { 3500 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 3501 }, 3502 focusout: function( event ) { 3503 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 3504 } 3505 } ); 3506 }, 3507 3508 _trigger: function( type, event, data ) { 3509 var prop, orig; 3510 var callback = this.options[ type ]; 3511 3512 data = data || {}; 3513 event = $.Event( event ); 3514 event.type = ( type === this.widgetEventPrefix ? 3515 type : 3516 this.widgetEventPrefix + type ).toLowerCase(); 3517 3518 // The original event may come from any element 3519 // so we need to reset the target on the new event 3520 event.target = this.element[ 0 ]; 3521 3522 // Copy original event properties over to the new event 3523 orig = event.originalEvent; 3524 if ( orig ) { 3525 for ( prop in orig ) { 3526 if ( !( prop in event ) ) { 3527 event[ prop ] = orig[ prop ]; 3528 } 3529 } 3530 } 3531 3532 this.element.trigger( event, data ); 3533 return !( typeof callback === "function" && 3534 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 3535 event.isDefaultPrevented() ); 3536 } 3537}; 3538 3539$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 3540 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 3541 if ( typeof options === "string" ) { 3542 options = { effect: options }; 3543 } 3544 3545 var hasOptions; 3546 var effectName = !options ? 3547 method : 3548 options === true || typeof options === "number" ? 3549 defaultEffect : 3550 options.effect || defaultEffect; 3551 3552 options = options || {}; 3553 if ( typeof options === "number" ) { 3554 options = { duration: options }; 3555 } else if ( options === true ) { 3556 options = {}; 3557 } 3558 3559 hasOptions = !$.isEmptyObject( options ); 3560 options.complete = callback; 3561 3562 if ( options.delay ) { 3563 element.delay( options.delay ); 3564 } 3565 3566 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 3567 element[ method ]( options ); 3568 } else if ( effectName !== method && element[ effectName ] ) { 3569 element[ effectName ]( options.duration, options.easing, callback ); 3570 } else { 3571 element.queue( function( next ) { 3572 $( this )[ method ](); 3573 if ( callback ) { 3574 callback.call( element[ 0 ] ); 3575 } 3576 next(); 3577 } ); 3578 } 3579 }; 3580} ); 3581
vendor: 45,753 bytes, lines 3582-5514
3582return $.widget; 3583 3584} ); 3585 3586 3587 3588/*! 3589 * jQuery UI Effects Blind 1.14.1 3590 * https://jqueryui.com 3591 * 3592 * Copyright OpenJS Foundation and other contributors 3593 * Released under the MIT license. 3594 * https://jquery.org/license 3595 */ 3596 3597//>>label: Blind Effect 3598//>>group: Effects 3599//>>description: Blinds the element. 3600//>>docs: https://api.jqueryui.com/blind-effect/ 3601//>>demos: https://jqueryui.com/effect/ 3602 3603( function( factory ) { 3604 "use strict"; 3605 3606 if ( typeof define === "function" && define.amd ) { 3607 3608 // AMD. Register as an anonymous module. 3609 define( [ 3610 "jquery", 3611 "../version", 3612 "../effect" 3613 ], factory ); 3614 } else { 3615 3616 // Browser globals 3617 factory( jQuery ); 3618 } 3619} )( function( $ ) { 3620"use strict"; 3621 3622return $.effects.define( "blind", "hide", function( options, done ) { 3623 var map = { 3624 up: [ "bottom", "top" ], 3625 vertical: [ "bottom", "top" ], 3626 down: [ "top", "bottom" ], 3627 left: [ "right", "left" ], 3628 horizontal: [ "right", "left" ], 3629 right: [ "left", "right" ] 3630 }, 3631 element = $( this ), 3632 direction = options.direction || "up", 3633 start = element.cssClip(), 3634 animate = { clip: $.extend( {}, start ) }, 3635 placeholder = $.effects.createPlaceholder( element ); 3636 3637 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 3638 3639 if ( options.mode === "show" ) { 3640 element.cssClip( animate.clip ); 3641 if ( placeholder ) { 3642 placeholder.css( $.effects.clipToBox( animate ) ); 3643 } 3644 3645 animate.clip = start; 3646 } 3647 3648 if ( placeholder ) { 3649 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 3650 } 3651 3652 element.animate( animate, { 3653 queue: false, 3654 duration: options.duration, 3655 easing: options.easing, 3656 complete: done 3657 } ); 3658} ); 3659 3660} ); 3661 3662 3663 3664/*! 3665 * jQuery UI Effects Bounce 1.14.1 3666 * https://jqueryui.com 3667 * 3668 * Copyright OpenJS Foundation and other contributors 3669 * Released under the MIT license. 3670 * https://jquery.org/license 3671 */ 3672 3673//>>label: Bounce Effect 3674//>>group: Effects 3675//>>description: Bounces an element horizontally or vertically n times. 3676//>>docs: https://api.jqueryui.com/bounce-effect/ 3677//>>demos: https://jqueryui.com/effect/ 3678 3679( function( factory ) { 3680 "use strict"; 3681 3682 if ( typeof define === "function" && define.amd ) { 3683 3684 // AMD. Register as an anonymous module. 3685 define( [ 3686 "jquery", 3687 "../version", 3688 "../effect" 3689 ], factory ); 3690 } else { 3691 3692 // Browser globals 3693 factory( jQuery ); 3694 } 3695} )( function( $ ) { 3696"use strict"; 3697 3698return $.effects.define( "bounce", function( options, done ) { 3699 var upAnim, downAnim, refValue, 3700 element = $( this ), 3701 3702 // Defaults: 3703 mode = options.mode, 3704 hide = mode === "hide", 3705 show = mode === "show", 3706 direction = options.direction || "up", 3707 distance = options.distance, 3708 times = options.times || 5, 3709 3710 // Number of internal animations 3711 anims = times * 2 + ( show || hide ? 1 : 0 ), 3712 speed = options.duration / anims, 3713 easing = options.easing, 3714 3715 // Utility: 3716 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3717 motion = ( direction === "up" || direction === "left" ), 3718 i = 0, 3719 3720 queuelen = element.queue().length; 3721 3722 $.effects.createPlaceholder( element ); 3723 3724 refValue = element.css( ref ); 3725 3726 // Default distance for the BIGGEST bounce is the outer Distance / 3 3727 if ( !distance ) { 3728 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 3729 } 3730 3731 if ( show ) { 3732 downAnim = { opacity: 1 }; 3733 downAnim[ ref ] = refValue; 3734 3735 // If we are showing, force opacity 0 and set the initial position 3736 // then do the "first" animation 3737 element 3738 .css( "opacity", 0 ) 3739 .css( ref, motion ? -distance * 2 : distance * 2 ) 3740 .animate( downAnim, speed, easing ); 3741 } 3742 3743 // Start at the smallest distance if we are hiding 3744 if ( hide ) { 3745 distance = distance / Math.pow( 2, times - 1 ); 3746 } 3747 3748 downAnim = {}; 3749 downAnim[ ref ] = refValue; 3750 3751 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3752 for ( ; i < times; i++ ) { 3753 upAnim = {}; 3754 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3755 3756 element 3757 .animate( upAnim, speed, easing ) 3758 .animate( downAnim, speed, easing ); 3759 3760 distance = hide ? distance * 2 : distance / 2; 3761 } 3762 3763 // Last Bounce when Hiding 3764 if ( hide ) { 3765 upAnim = { opacity: 0 }; 3766 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3767 3768 element.animate( upAnim, speed, easing ); 3769 } 3770 3771 element.queue( done ); 3772 3773 $.effects.unshift( element, queuelen, anims + 1 ); 3774} ); 3775 3776} ); 3777 3778 3779 3780/*! 3781 * jQuery UI Effects Clip 1.14.1 3782 * https://jqueryui.com 3783 * 3784 * Copyright OpenJS Foundation and other contributors 3785 * Released under the MIT license. 3786 * https://jquery.org/license 3787 */ 3788 3789//>>label: Clip Effect 3790//>>group: Effects 3791//>>description: Clips the element on and off like an old TV. 3792//>>docs: https://api.jqueryui.com/clip-effect/ 3793//>>demos: https://jqueryui.com/effect/ 3794 3795( function( factory ) { 3796 "use strict"; 3797 3798 if ( typeof define === "function" && define.amd ) { 3799 3800 // AMD. Register as an anonymous module. 3801 define( [ 3802 "jquery", 3803 "../version", 3804 "../effect" 3805 ], factory ); 3806 } else { 3807 3808 // Browser globals 3809 factory( jQuery ); 3810 } 3811} )( function( $ ) { 3812"use strict"; 3813 3814return $.effects.define( "clip", "hide", function( options, done ) { 3815 var start, 3816 animate = {}, 3817 element = $( this ), 3818 direction = options.direction || "vertical", 3819 both = direction === "both", 3820 horizontal = both || direction === "horizontal", 3821 vertical = both || direction === "vertical"; 3822 3823 start = element.cssClip(); 3824 animate.clip = { 3825 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 3826 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 3827 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 3828 left: horizontal ? ( start.right - start.left ) / 2 : start.left 3829 }; 3830 3831 $.effects.createPlaceholder( element ); 3832 3833 if ( options.mode === "show" ) { 3834 element.cssClip( animate.clip ); 3835 animate.clip = start; 3836 } 3837 3838 element.animate( animate, { 3839 queue: false, 3840 duration: options.duration, 3841 easing: options.easing, 3842 complete: done 3843 } ); 3844 3845} ); 3846 3847} ); 3848 3849 3850 3851/*! 3852 * jQuery UI Effects Drop 1.14.1 3853 * https://jqueryui.com 3854 * 3855 * Copyright OpenJS Foundation and other contributors 3856 * Released under the MIT license. 3857 * https://jquery.org/license 3858 */ 3859 3860//>>label: Drop Effect 3861//>>group: Effects 3862//>>description: Moves an element in one direction and hides it at the same time. 3863//>>docs: https://api.jqueryui.com/drop-effect/ 3864//>>demos: https://jqueryui.com/effect/ 3865 3866( function( factory ) { 3867 "use strict"; 3868 3869 if ( typeof define === "function" && define.amd ) { 3870 3871 // AMD. Register as an anonymous module. 3872 define( [ 3873 "jquery", 3874 "../version", 3875 "../effect" 3876 ], factory ); 3877 } else { 3878 3879 // Browser globals 3880 factory( jQuery ); 3881 } 3882} )( function( $ ) { 3883"use strict"; 3884 3885return $.effects.define( "drop", "hide", function( options, done ) { 3886 3887 var distance, 3888 element = $( this ), 3889 mode = options.mode, 3890 show = mode === "show", 3891 direction = options.direction || "left", 3892 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3893 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 3894 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 3895 animation = { 3896 opacity: 0 3897 }; 3898 3899 $.effects.createPlaceholder( element ); 3900 3901 distance = options.distance || 3902 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 3903 3904 animation[ ref ] = motion + distance; 3905 3906 if ( show ) { 3907 element.css( animation ); 3908 3909 animation[ ref ] = oppositeMotion + distance; 3910 animation.opacity = 1; 3911 } 3912 3913 // Animate 3914 element.animate( animation, { 3915 queue: false, 3916 duration: options.duration, 3917 easing: options.easing, 3918 complete: done 3919 } ); 3920} ); 3921 3922} ); 3923 3924 3925 3926/*! 3927 * jQuery UI Effects Explode 1.14.1 3928 * https://jqueryui.com 3929 * 3930 * Copyright OpenJS Foundation and other contributors 3931 * Released under the MIT license. 3932 * https://jquery.org/license 3933 */ 3934 3935//>>label: Explode Effect 3936//>>group: Effects 3937/* eslint-disable max-len */ 3938//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3939/* eslint-enable max-len */ 3940//>>docs: https://api.jqueryui.com/explode-effect/ 3941//>>demos: https://jqueryui.com/effect/ 3942 3943( function( factory ) { 3944 "use strict"; 3945 3946 if ( typeof define === "function" && define.amd ) { 3947 3948 // AMD. Register as an anonymous module. 3949 define( [ 3950 "jquery", 3951 "../version", 3952 "../effect" 3953 ], factory ); 3954 } else { 3955 3956 // Browser globals 3957 factory( jQuery ); 3958 } 3959} )( function( $ ) { 3960"use strict"; 3961 3962return $.effects.define( "explode", "hide", function( options, done ) { 3963 3964 var i, j, left, top, mx, my, 3965 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 3966 cells = rows, 3967 element = $( this ), 3968 mode = options.mode, 3969 show = mode === "show", 3970 3971 // Show and then visibility:hidden the element before calculating offset 3972 offset = element.show().css( "visibility", "hidden" ).offset(), 3973 3974 // Width and height of a piece 3975 width = Math.ceil( element.outerWidth() / cells ), 3976 height = Math.ceil( element.outerHeight() / rows ), 3977 pieces = []; 3978 3979 // Children animate complete: 3980 function childComplete() { 3981 pieces.push( this ); 3982 if ( pieces.length === rows * cells ) { 3983 animComplete(); 3984 } 3985 } 3986 3987 // Clone the element for each row and cell. 3988 for ( i = 0; i < rows; i++ ) { // ===> 3989 top = offset.top + i * height; 3990 my = i - ( rows - 1 ) / 2; 3991 3992 for ( j = 0; j < cells; j++ ) { // ||| 3993 left = offset.left + j * width; 3994 mx = j - ( cells - 1 ) / 2; 3995 3996 // Create a clone of the now hidden main element that will be absolute positioned 3997 // within a wrapper div off the -left and -top equal to size of our pieces 3998 element 3999 .clone() 4000 .appendTo( "body" ) 4001 .wrap( "<div></div>" ) 4002 .css( { 4003 position: "absolute", 4004 visibility: "visible", 4005 left: -j * width, 4006 top: -i * height 4007 } ) 4008 4009 // Select the wrapper - make it overflow: hidden and absolute positioned based on 4010 // where the original was located +left and +top equal to the size of pieces 4011 .parent() 4012 .addClass( "ui-effects-explode" ) 4013 .css( { 4014 position: "absolute", 4015 overflow: "hidden", 4016 width: width, 4017 height: height, 4018 left: left + ( show ? mx * width : 0 ), 4019 top: top + ( show ? my * height : 0 ), 4020 opacity: show ? 0 : 1 4021 } ) 4022 .animate( { 4023 left: left + ( show ? 0 : mx * width ), 4024 top: top + ( show ? 0 : my * height ), 4025 opacity: show ? 1 : 0 4026 }, options.duration || 500, options.easing, childComplete ); 4027 } 4028 } 4029 4030 function animComplete() { 4031 element.css( { 4032 visibility: "visible" 4033 } ); 4034 $( pieces ).remove(); 4035 done(); 4036 } 4037} ); 4038 4039} ); 4040 4041 4042 4043/*! 4044 * jQuery UI Effects Fade 1.14.1 4045 * https://jqueryui.com 4046 * 4047 * Copyright OpenJS Foundation and other contributors 4048 * Released under the MIT license. 4049 * https://jquery.org/license 4050 */ 4051 4052//>>label: Fade Effect 4053//>>group: Effects 4054//>>description: Fades the element. 4055//>>docs: https://api.jqueryui.com/fade-effect/ 4056//>>demos: https://jqueryui.com/effect/ 4057 4058( function( factory ) { 4059 "use strict"; 4060 4061 if ( typeof define === "function" && define.amd ) { 4062 4063 // AMD. Register as an anonymous module. 4064 define( [ 4065 "jquery", 4066 "../version", 4067 "../effect" 4068 ], factory ); 4069 } else { 4070 4071 // Browser globals 4072 factory( jQuery ); 4073 } 4074} )( function( $ ) { 4075"use strict"; 4076 4077return $.effects.define( "fade", "toggle", function( options, done ) { 4078 var show = options.mode === "show"; 4079 4080 $( this ) 4081 .css( "opacity", show ? 0 : 1 ) 4082 .animate( { 4083 opacity: show ? 1 : 0 4084 }, { 4085 queue: false, 4086 duration: options.duration, 4087 easing: options.easing, 4088 complete: done 4089 } ); 4090} ); 4091 4092} ); 4093 4094 4095 4096/*! 4097 * jQuery UI Effects Fold 1.14.1 4098 * https://jqueryui.com 4099 * 4100 * Copyright OpenJS Foundation and other contributors 4101 * Released under the MIT license. 4102 * https://jquery.org/license 4103 */ 4104 4105//>>label: Fold Effect 4106//>>group: Effects 4107//>>description: Folds an element first horizontally and then vertically. 4108//>>docs: https://api.jqueryui.com/fold-effect/ 4109//>>demos: https://jqueryui.com/effect/ 4110 4111( function( factory ) { 4112 "use strict"; 4113 4114 if ( typeof define === "function" && define.amd ) { 4115 4116 // AMD. Register as an anonymous module. 4117 define( [ 4118 "jquery", 4119 "../version", 4120 "../effect" 4121 ], factory ); 4122 } else { 4123 4124 // Browser globals 4125 factory( jQuery ); 4126 } 4127} )( function( $ ) { 4128"use strict"; 4129 4130return $.effects.define( "fold", "hide", function( options, done ) { 4131 4132 // Create element 4133 var element = $( this ), 4134 mode = options.mode, 4135 show = mode === "show", 4136 hide = mode === "hide", 4137 size = options.size || 15, 4138 percent = /([0-9]+)%/.exec( size ), 4139 horizFirst = !!options.horizFirst, 4140 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 4141 duration = options.duration / 2, 4142 4143 placeholder = $.effects.createPlaceholder( element ), 4144 4145 start = element.cssClip(), 4146 animation1 = { clip: $.extend( {}, start ) }, 4147 animation2 = { clip: $.extend( {}, start ) }, 4148 4149 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 4150 4151 queuelen = element.queue().length; 4152 4153 if ( percent ) { 4154 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 4155 } 4156 animation1.clip[ ref[ 0 ] ] = size; 4157 animation2.clip[ ref[ 0 ] ] = size; 4158 animation2.clip[ ref[ 1 ] ] = 0; 4159 4160 if ( show ) { 4161 element.cssClip( animation2.clip ); 4162 if ( placeholder ) { 4163 placeholder.css( $.effects.clipToBox( animation2 ) ); 4164 } 4165 4166 animation2.clip = start; 4167 } 4168 4169 // Animate 4170 element 4171 .queue( function( next ) { 4172 if ( placeholder ) { 4173 placeholder 4174 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 4175 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 4176 } 4177 4178 next(); 4179 } ) 4180 .animate( animation1, duration, options.easing ) 4181 .animate( animation2, duration, options.easing ) 4182 .queue( done ); 4183 4184 $.effects.unshift( element, queuelen, 4 ); 4185} ); 4186 4187} ); 4188 4189 4190 4191/*! 4192 * jQuery UI Effects Highlight 1.14.1 4193 * https://jqueryui.com 4194 * 4195 * Copyright OpenJS Foundation and other contributors 4196 * Released under the MIT license. 4197 * https://jquery.org/license 4198 */ 4199 4200//>>label: Highlight Effect 4201//>>group: Effects 4202//>>description: Highlights the background of an element in a defined color for a custom duration. 4203//>>docs: https://api.jqueryui.com/highlight-effect/ 4204//>>demos: https://jqueryui.com/effect/ 4205 4206( function( factory ) { 4207 "use strict"; 4208 4209 if ( typeof define === "function" && define.amd ) { 4210 4211 // AMD. Register as an anonymous module. 4212 define( [ 4213 "jquery", 4214 "../version", 4215 "../effect" 4216 ], factory ); 4217 } else { 4218 4219 // Browser globals 4220 factory( jQuery ); 4221 } 4222} )( function( $ ) { 4223"use strict"; 4224 4225return $.effects.define( "highlight", "show", function( options, done ) { 4226 var element = $( this ), 4227 animation = { 4228 backgroundColor: element.css( "backgroundColor" ) 4229 }; 4230 4231 if ( options.mode === "hide" ) { 4232 animation.opacity = 0; 4233 } 4234 4235 $.effects.saveStyle( element ); 4236 4237 element 4238 .css( { 4239 backgroundImage: "none", 4240 backgroundColor: options.color || "#ffff99" 4241 } ) 4242 .animate( animation, { 4243 queue: false, 4244 duration: options.duration, 4245 easing: options.easing, 4246 complete: done 4247 } ); 4248} ); 4249 4250} ); 4251 4252 4253 4254/*! 4255 * jQuery UI Effects Size 1.14.1 4256 * https://jqueryui.com 4257 * 4258 * Copyright OpenJS Foundation and other contributors 4259 * Released under the MIT license. 4260 * https://jquery.org/license 4261 */ 4262 4263//>>label: Size Effect 4264//>>group: Effects 4265//>>description: Resize an element to a specified width and height. 4266//>>docs: https://api.jqueryui.com/size-effect/ 4267//>>demos: https://jqueryui.com/effect/ 4268 4269( function( factory ) { 4270 "use strict"; 4271 4272 if ( typeof define === "function" && define.amd ) { 4273 4274 // AMD. Register as an anonymous module. 4275 define( [ 4276 "jquery", 4277 "../version", 4278 "../effect" 4279 ], factory ); 4280 } else { 4281 4282 // Browser globals 4283 factory( jQuery ); 4284 } 4285} )( function( $ ) { 4286"use strict"; 4287 4288return $.effects.define( "size", function( options, done ) { 4289 4290 // Create element 4291 var baseline, factor, temp, 4292 element = $( this ), 4293 4294 // Copy for children 4295 cProps = [ "fontSize" ], 4296 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 4297 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 4298 4299 // Set options 4300 mode = options.mode, 4301 restore = mode !== "effect", 4302 scale = options.scale || "both", 4303 origin = options.origin || [ "middle", "center" ], 4304 position = element.css( "position" ), 4305 pos = element.position(), 4306 original = $.effects.scaledDimensions( element ), 4307 from = options.from || original, 4308 to = options.to || $.effects.scaledDimensions( element, 0 ); 4309 4310 $.effects.createPlaceholder( element ); 4311 4312 if ( mode === "show" ) { 4313 temp = from; 4314 from = to; 4315 to = temp; 4316 } 4317 4318 // Set scaling factor 4319 factor = { 4320 from: { 4321 y: from.height / original.height, 4322 x: from.width / original.width 4323 }, 4324 to: { 4325 y: to.height / original.height, 4326 x: to.width / original.width 4327 } 4328 }; 4329 4330 // Scale the css box 4331 if ( scale === "box" || scale === "both" ) { 4332 4333 // Vertical props scaling 4334 if ( factor.from.y !== factor.to.y ) { 4335 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 4336 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 4337 } 4338 4339 // Horizontal props scaling 4340 if ( factor.from.x !== factor.to.x ) { 4341 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 4342 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 4343 } 4344 } 4345 4346 // Scale the content 4347 if ( scale === "content" || scale === "both" ) { 4348 4349 // Vertical props scaling 4350 if ( factor.from.y !== factor.to.y ) { 4351 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 4352 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 4353 } 4354 } 4355 4356 // Adjust the position properties based on the provided origin points 4357 if ( origin ) { 4358 baseline = $.effects.getBaseline( origin, original ); 4359 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 4360 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 4361 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 4362 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 4363 } 4364 delete from.outerHeight; 4365 delete from.outerWidth; 4366 element.css( from ); 4367 4368 // Animate the children if desired 4369 if ( scale === "content" || scale === "both" ) { 4370 4371 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 4372 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 4373 4374 // Only animate children with width attributes specified 4375 // TODO: is this right? should we include anything with css width specified as well 4376 element.find( "*[width]" ).each( function() { 4377 var child = $( this ), 4378 childOriginal = $.effects.scaledDimensions( child ), 4379 childFrom = { 4380 height: childOriginal.height * factor.from.y, 4381 width: childOriginal.width * factor.from.x, 4382 outerHeight: childOriginal.outerHeight * factor.from.y, 4383 outerWidth: childOriginal.outerWidth * factor.from.x 4384 }, 4385 childTo = { 4386 height: childOriginal.height * factor.to.y, 4387 width: childOriginal.width * factor.to.x, 4388 outerHeight: childOriginal.height * factor.to.y, 4389 outerWidth: childOriginal.width * factor.to.x 4390 }; 4391 4392 // Vertical props scaling 4393 if ( factor.from.y !== factor.to.y ) { 4394 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 4395 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 4396 } 4397 4398 // Horizontal props scaling 4399 if ( factor.from.x !== factor.to.x ) { 4400 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 4401 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 4402 } 4403 4404 if ( restore ) { 4405 $.effects.saveStyle( child ); 4406 } 4407 4408 // Animate children 4409 child.css( childFrom ); 4410 child.animate( childTo, options.duration, options.easing, function() { 4411 4412 // Restore children 4413 if ( restore ) { 4414 $.effects.restoreStyle( child ); 4415 } 4416 } ); 4417 } ); 4418 } 4419 4420 // Animate 4421 element.animate( to, { 4422 queue: false, 4423 duration: options.duration, 4424 easing: options.easing, 4425 complete: function() { 4426 4427 var offset = element.offset(); 4428 4429 if ( to.opacity === 0 ) { 4430 element.css( "opacity", from.opacity ); 4431 } 4432 4433 if ( !restore ) { 4434 element 4435 .css( "position", position === "static" ? "relative" : position ) 4436 .offset( offset ); 4437 4438 // Need to save style here so that automatic style restoration 4439 // doesn't restore to the original styles from before the animation. 4440 $.effects.saveStyle( element ); 4441 } 4442 4443 done(); 4444 } 4445 } ); 4446 4447} ); 4448 4449} ); 4450 4451 4452 4453 4454/*! 4455 * jQuery UI Effects Scale 1.14.1 4456 * https://jqueryui.com 4457 * 4458 * Copyright OpenJS Foundation and other contributors 4459 * Released under the MIT license. 4460 * https://jquery.org/license 4461 */ 4462 4463//>>label: Scale Effect 4464//>>group: Effects 4465//>>description: Grows or shrinks an element and its content. 4466//>>docs: https://api.jqueryui.com/scale-effect/ 4467//>>demos: https://jqueryui.com/effect/ 4468 4469( function( factory ) { 4470 "use strict"; 4471 4472 if ( typeof define === "function" && define.amd ) { 4473 4474 // AMD. Register as an anonymous module. 4475 define( [ 4476 "jquery", 4477 "../version", 4478 "../effect", 4479 "./effect-size" 4480 ], factory ); 4481 } else { 4482 4483 // Browser globals 4484 factory( jQuery ); 4485 } 4486} )( function( $ ) { 4487"use strict"; 4488 4489return $.effects.define( "scale", function( options, done ) { 4490 4491 // Create element 4492 var el = $( this ), 4493 mode = options.mode, 4494 percent = parseInt( options.percent, 10 ) || 4495 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 4496 4497 newOptions = $.extend( true, { 4498 from: $.effects.scaledDimensions( el ), 4499 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 4500 origin: options.origin || [ "middle", "center" ] 4501 }, options ); 4502 4503 // Fade option to support puff 4504 if ( options.fade ) { 4505 newOptions.from.opacity = 1; 4506 newOptions.to.opacity = 0; 4507 } 4508 4509 $.effects.effect.size.call( this, newOptions, done ); 4510} ); 4511 4512} ); 4513 4514 4515 4516 4517/*! 4518 * jQuery UI Effects Puff 1.14.1 4519 * https://jqueryui.com 4520 * 4521 * Copyright OpenJS Foundation and other contributors 4522 * Released under the MIT license. 4523 * https://jquery.org/license 4524 */ 4525 4526//>>label: Puff Effect 4527//>>group: Effects 4528//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 4529//>>docs: https://api.jqueryui.com/puff-effect/ 4530//>>demos: https://jqueryui.com/effect/ 4531 4532( function( factory ) { 4533 "use strict"; 4534 4535 if ( typeof define === "function" && define.amd ) { 4536 4537 // AMD. Register as an anonymous module. 4538 define( [ 4539 "jquery", 4540 "../version", 4541 "../effect", 4542 "./effect-scale" 4543 ], factory ); 4544 } else { 4545 4546 // Browser globals 4547 factory( jQuery ); 4548 } 4549} )( function( $ ) { 4550"use strict"; 4551 4552return $.effects.define( "puff", "hide", function( options, done ) { 4553 var newOptions = $.extend( true, {}, options, { 4554 fade: true, 4555 percent: parseInt( options.percent, 10 ) || 150 4556 } ); 4557 4558 $.effects.effect.scale.call( this, newOptions, done ); 4559} ); 4560 4561} ); 4562 4563 4564 4565/*! 4566 * jQuery UI Effects Pulsate 1.14.1 4567 * https://jqueryui.com 4568 * 4569 * Copyright OpenJS Foundation and other contributors 4570 * Released under the MIT license. 4571 * https://jquery.org/license 4572 */ 4573 4574//>>label: Pulsate Effect 4575//>>group: Effects 4576//>>description: Pulsates an element n times by changing the opacity to zero and back. 4577//>>docs: https://api.jqueryui.com/pulsate-effect/ 4578//>>demos: https://jqueryui.com/effect/ 4579 4580( function( factory ) { 4581 "use strict"; 4582 4583 if ( typeof define === "function" && define.amd ) { 4584 4585 // AMD. Register as an anonymous module. 4586 define( [ 4587 "jquery", 4588 "../version", 4589 "../effect" 4590 ], factory ); 4591 } else { 4592 4593 // Browser globals 4594 factory( jQuery ); 4595 } 4596} )( function( $ ) { 4597"use strict"; 4598 4599return $.effects.define( "pulsate", "show", function( options, done ) { 4600 var element = $( this ), 4601 mode = options.mode, 4602 show = mode === "show", 4603 hide = mode === "hide", 4604 showhide = show || hide, 4605 4606 // Showing or hiding leaves off the "last" animation 4607 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 4608 duration = options.duration / anims, 4609 animateTo = 0, 4610 i = 1, 4611 queuelen = element.queue().length; 4612 4613 if ( show || !element.is( ":visible" ) ) { 4614 element.css( "opacity", 0 ).show(); 4615 animateTo = 1; 4616 } 4617 4618 // Anims - 1 opacity "toggles" 4619 for ( ; i < anims; i++ ) { 4620 element.animate( { opacity: animateTo }, duration, options.easing ); 4621 animateTo = 1 - animateTo; 4622 } 4623 4624 element.animate( { opacity: animateTo }, duration, options.easing ); 4625 4626 element.queue( done ); 4627 4628 $.effects.unshift( element, queuelen, anims + 1 ); 4629} ); 4630 4631} ); 4632 4633 4634 4635/*! 4636 * jQuery UI Effects Shake 1.14.1 4637 * https://jqueryui.com 4638 * 4639 * Copyright OpenJS Foundation and other contributors 4640 * Released under the MIT license. 4641 * https://jquery.org/license 4642 */ 4643 4644//>>label: Shake Effect 4645//>>group: Effects 4646//>>description: Shakes an element horizontally or vertically n times. 4647//>>docs: https://api.jqueryui.com/shake-effect/ 4648//>>demos: https://jqueryui.com/effect/ 4649 4650( function( factory ) { 4651 "use strict"; 4652 4653 if ( typeof define === "function" && define.amd ) { 4654 4655 // AMD. Register as an anonymous module. 4656 define( [ 4657 "jquery", 4658 "../version", 4659 "../effect" 4660 ], factory ); 4661 } else { 4662 4663 // Browser globals 4664 factory( jQuery ); 4665 } 4666} )( function( $ ) { 4667"use strict"; 4668 4669return $.effects.define( "shake", function( options, done ) { 4670 4671 var i = 1, 4672 element = $( this ), 4673 direction = options.direction || "left", 4674 distance = options.distance || 20, 4675 times = options.times || 3, 4676 anims = times * 2 + 1, 4677 speed = Math.round( options.duration / anims ), 4678 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 4679 positiveMotion = ( direction === "up" || direction === "left" ), 4680 animation = {}, 4681 animation1 = {}, 4682 animation2 = {}, 4683 4684 queuelen = element.queue().length; 4685 4686 $.effects.createPlaceholder( element ); 4687 4688 // Animation 4689 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 4690 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 4691 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 4692 4693 // Animate 4694 element.animate( animation, speed, options.easing ); 4695 4696 // Shakes 4697 for ( ; i < times; i++ ) { 4698 element 4699 .animate( animation1, speed, options.easing ) 4700 .animate( animation2, speed, options.easing ); 4701 } 4702 4703 element 4704 .animate( animation1, speed, options.easing ) 4705 .animate( animation, speed / 2, options.easing ) 4706 .queue( done ); 4707 4708 $.effects.unshift( element, queuelen, anims + 1 ); 4709} ); 4710 4711} ); 4712 4713 4714 4715/*! 4716 * jQuery UI Effects Slide 1.14.1 4717 * https://jqueryui.com 4718 * 4719 * Copyright OpenJS Foundation and other contributors 4720 * Released under the MIT license. 4721 * https://jquery.org/license 4722 */ 4723 4724//>>label: Slide Effect 4725//>>group: Effects 4726//>>description: Slides an element in and out of the viewport. 4727//>>docs: https://api.jqueryui.com/slide-effect/ 4728//>>demos: https://jqueryui.com/effect/ 4729 4730( function( factory ) { 4731 "use strict"; 4732 4733 if ( typeof define === "function" && define.amd ) { 4734 4735 // AMD. Register as an anonymous module. 4736 define( [ 4737 "jquery", 4738 "../version", 4739 "../effect" 4740 ], factory ); 4741 } else { 4742 4743 // Browser globals 4744 factory( jQuery ); 4745 } 4746} )( function( $ ) { 4747"use strict"; 4748 4749return $.effects.define( "slide", "show", function( options, done ) { 4750 var startClip, startRef, 4751 element = $( this ), 4752 map = { 4753 up: [ "bottom", "top" ], 4754 down: [ "top", "bottom" ], 4755 left: [ "right", "left" ], 4756 right: [ "left", "right" ] 4757 }, 4758 mode = options.mode, 4759 direction = options.direction || "left", 4760 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 4761 positiveMotion = ( direction === "up" || direction === "left" ), 4762 distance = options.distance || 4763 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 4764 animation = {}; 4765 4766 $.effects.createPlaceholder( element ); 4767 4768 startClip = element.cssClip(); 4769 startRef = element.position()[ ref ]; 4770 4771 // Define hide animation 4772 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 4773 animation.clip = element.cssClip(); 4774 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 4775 4776 // Reverse the animation if we're showing 4777 if ( mode === "show" ) { 4778 element.cssClip( animation.clip ); 4779 element.css( ref, animation[ ref ] ); 4780 animation.clip = startClip; 4781 animation[ ref ] = startRef; 4782 } 4783 4784 // Actually animate 4785 element.animate( animation, { 4786 queue: false, 4787 duration: options.duration, 4788 easing: options.easing, 4789 complete: done 4790 } ); 4791} ); 4792 4793} ); 4794 4795 4796 4797/*! 4798 * jQuery UI Effects Transfer 1.14.1 4799 * https://jqueryui.com 4800 * 4801 * Copyright OpenJS Foundation and other contributors 4802 * Released under the MIT license. 4803 * https://jquery.org/license 4804 */ 4805 4806//>>label: Transfer Effect 4807//>>group: Effects 4808//>>description: Displays a transfer effect from one element to another. 4809//>>docs: https://api.jqueryui.com/transfer-effect/ 4810//>>demos: https://jqueryui.com/effect/ 4811 4812( function( factory ) { 4813 "use strict"; 4814 4815 if ( typeof define === "function" && define.amd ) { 4816 4817 // AMD. Register as an anonymous module. 4818 define( [ 4819 "jquery", 4820 "../version", 4821 "../effect" 4822 ], factory ); 4823 } else { 4824 4825 // Browser globals 4826 factory( jQuery ); 4827 } 4828} )( function( $ ) { 4829"use strict"; 4830 4831var effect; 4832if ( $.uiBackCompat === true ) { 4833 effect = $.effects.define( "transfer", function( options, done ) { 4834 $( this ).transfer( options, done ); 4835 } ); 4836} 4837return effect; 4838 4839} ); 4840 4841 4842 4843 4844 4845/*! 4846 * jQuery UI Accordion 1.14.1 4847 * https://jqueryui.com 4848 * 4849 * Copyright OpenJS Foundation and other contributors 4850 * Released under the MIT license. 4851 * https://jquery.org/license 4852 */ 4853 4854//>>label: Accordion 4855//>>group: Widgets 4856/* eslint-disable max-len */ 4857//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4858/* eslint-enable max-len */ 4859//>>docs: https://api.jqueryui.com/accordion/ 4860//>>demos: https://jqueryui.com/accordion/ 4861//>>css.structure: ../../themes/base/core.css 4862//>>css.structure: ../../themes/base/accordion.css 4863//>>css.theme: ../../themes/base/theme.css 4864 4865( function( factory ) { 4866 "use strict"; 4867 4868 if ( typeof define === "function" && define.amd ) { 4869 4870 // AMD. Register as an anonymous module. 4871 define( [ 4872 "jquery", 4873 "../version", 4874 "../keycode", 4875 "../unique-id", 4876 "../widget" 4877 ], factory ); 4878 } else { 4879 4880 // Browser globals 4881 factory( jQuery ); 4882 } 4883} )( function( $ ) { 4884"use strict"; 4885 4886return $.widget( "ui.accordion", { 4887 version: "1.14.1", 4888 options: { 4889 active: 0, 4890 animate: {}, 4891 classes: { 4892 "ui-accordion-header": "ui-corner-top", 4893 "ui-accordion-header-collapsed": "ui-corner-all", 4894 "ui-accordion-content": "ui-corner-bottom" 4895 }, 4896 collapsible: false, 4897 event: "click", 4898 header: function( elem ) { 4899 return elem 4900 .find( "> li > :first-child" ) 4901 .add( 4902 elem.find( "> :not(li)" ) 4903 4904 // Support: jQuery <3.5 only 4905 // We could use `.even()` but that's unavailable in older jQuery. 4906 .filter( function( i ) { 4907 return i % 2 === 0; 4908 } ) 4909 ); 4910 }, 4911 heightStyle: "auto", 4912 icons: { 4913 activeHeader: "ui-icon-triangle-1-s", 4914 header: "ui-icon-triangle-1-e" 4915 }, 4916 4917 // Callbacks 4918 activate: null, 4919 beforeActivate: null 4920 }, 4921 4922 hideProps: { 4923 borderTopWidth: "hide", 4924 borderBottomWidth: "hide", 4925 paddingTop: "hide", 4926 paddingBottom: "hide", 4927 height: "hide" 4928 }, 4929 4930 showProps: { 4931 borderTopWidth: "show", 4932 borderBottomWidth: "show", 4933 paddingTop: "show", 4934 paddingBottom: "show", 4935 height: "show" 4936 }, 4937 4938 _create: function() { 4939 var options = this.options; 4940 4941 this.prevShow = this.prevHide = $(); 4942 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 4943 this.element.attr( "role", "tablist" ); 4944 4945 // Don't allow collapsible: false and active: false / null 4946 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 4947 options.active = 0; 4948 } 4949 4950 this._processPanels(); 4951 4952 // handle negative values 4953 if ( options.active < 0 ) { 4954 options.active += this.headers.length; 4955 } 4956 this._refresh(); 4957 }, 4958 4959 _getCreateEventData: function() { 4960 return { 4961 header: this.active, 4962 panel: !this.active.length ? $() : this.active.next() 4963 }; 4964 }, 4965 4966 _createIcons: function() { 4967 var icon, children, 4968 icons = this.options.icons; 4969 4970 if ( icons ) { 4971 icon = $( "<span>" ); 4972 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 4973 icon.prependTo( this.headers ); 4974 children = this.active.children( ".ui-accordion-header-icon" ); 4975 this._removeClass( children, icons.header ) 4976 ._addClass( children, null, icons.activeHeader ) 4977 ._addClass( this.headers, "ui-accordion-icons" ); 4978 } 4979 }, 4980 4981 _destroyIcons: function() { 4982 this._removeClass( this.headers, "ui-accordion-icons" ); 4983 this.headers.children( ".ui-accordion-header-icon" ).remove(); 4984 }, 4985 4986 _destroy: function() { 4987 var contents; 4988 4989 // Clean up main element 4990 this.element.removeAttr( "role" ); 4991 4992 // Clean up headers 4993 this.headers 4994 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 4995 .removeUniqueId(); 4996 4997 this._destroyIcons(); 4998 4999 // Clean up content panels 5000 contents = this.headers.next() 5001 .css( "display", "" ) 5002 .removeAttr( "role aria-hidden aria-labelledby" ) 5003 .removeUniqueId(); 5004 5005 if ( this.options.heightStyle !== "content" ) { 5006 contents.css( "height", "" ); 5007 } 5008 }, 5009 5010 _setOption: function( key, value ) { 5011 if ( key === "active" ) { 5012 5013 // _activate() will handle invalid values and update this.options 5014 this._activate( value ); 5015 return; 5016 } 5017 5018 if ( key === "event" ) { 5019 if ( this.options.event ) { 5020 this._off( this.headers, this.options.event ); 5021 } 5022 this._setupEvents( value ); 5023 } 5024 5025 this._super( key, value ); 5026 5027 // Setting collapsible: false while collapsed; open first panel 5028 if ( key === "collapsible" && !value && this.options.active === false ) { 5029 this._activate( 0 ); 5030 } 5031 5032 if ( key === "icons" ) { 5033 this._destroyIcons(); 5034 if ( value ) { 5035 this._createIcons(); 5036 } 5037 } 5038 }, 5039 5040 _setOptionDisabled: function( value ) { 5041 this._super( value ); 5042 5043 this.element.attr( "aria-disabled", value ); 5044 this._toggleClass( null, "ui-state-disabled", !!value ); 5045 }, 5046 5047 _keydown: function( event ) { 5048 if ( event.altKey || event.ctrlKey ) { 5049 return; 5050 } 5051 5052 var keyCode = $.ui.keyCode, 5053 length = this.headers.length, 5054 currentIndex = this.headers.index( event.target ), 5055 toFocus = false; 5056 5057 switch ( event.keyCode ) { 5058 case keyCode.RIGHT: 5059 case keyCode.DOWN: 5060 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 5061 break; 5062 case keyCode.LEFT: 5063 case keyCode.UP: 5064 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 5065 break; 5066 case keyCode.SPACE: 5067 case keyCode.ENTER: 5068 this._eventHandler( event ); 5069 break; 5070 case keyCode.HOME: 5071 toFocus = this.headers[ 0 ]; 5072 break; 5073 case keyCode.END: 5074 toFocus = this.headers[ length - 1 ]; 5075 break; 5076 } 5077 5078 if ( toFocus ) { 5079 $( event.target ).attr( "tabIndex", -1 ); 5080 $( toFocus ).attr( "tabIndex", 0 ); 5081 $( toFocus ).trigger( "focus" ); 5082 event.preventDefault(); 5083 } 5084 }, 5085 5086 _panelKeyDown: function( event ) { 5087 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 5088 $( event.currentTarget ).prev().trigger( "focus" ); 5089 } 5090 }, 5091 5092 refresh: function() { 5093 var options = this.options; 5094 this._processPanels(); 5095 5096 // Was collapsed or no panel 5097 if ( ( options.active === false && options.collapsible === true ) || 5098 !this.headers.length ) { 5099 options.active = false; 5100 this.active = $(); 5101 5102 // active false only when collapsible is true 5103 } else if ( options.active === false ) { 5104 this._activate( 0 ); 5105 5106 // was active, but active panel is gone 5107 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5108 5109 // all remaining panel are disabled 5110 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 5111 options.active = false; 5112 this.active = $(); 5113 5114 // activate previous panel 5115 } else { 5116 this._activate( Math.max( 0, options.active - 1 ) ); 5117 } 5118 5119 // was active, active panel still exists 5120 } else { 5121 5122 // make sure active index is correct 5123 options.active = this.headers.index( this.active ); 5124 } 5125 5126 this._destroyIcons(); 5127 5128 this._refresh(); 5129 }, 5130 5131 _processPanels: function() { 5132 var prevHeaders = this.headers, 5133 prevPanels = this.panels; 5134 5135 if ( typeof this.options.header === "function" ) { 5136 this.headers = this.options.header( this.element ); 5137 } else { 5138 this.headers = this.element.find( this.options.header ); 5139 } 5140 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 5141 "ui-state-default" ); 5142 5143 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 5144 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 5145 5146 // Avoid memory leaks (#10056) 5147 if ( prevPanels ) { 5148 this._off( prevHeaders.not( this.headers ) ); 5149 this._off( prevPanels.not( this.panels ) ); 5150 } 5151 }, 5152 5153 _refresh: function() { 5154 var maxHeight, 5155 options = this.options, 5156 heightStyle = options.heightStyle, 5157 parent = this.element.parent(); 5158 5159 this.active = this._findActive( options.active ); 5160 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 5161 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 5162 this._addClass( this.active.next(), "ui-accordion-content-active" ); 5163 this.active.next().show(); 5164 5165 this.headers 5166 .attr( "role", "tab" ) 5167 .each( function() { 5168 var header = $( this ), 5169 headerId = header.uniqueId().attr( "id" ), 5170 panel = header.next(), 5171 panelId = panel.uniqueId().attr( "id" ); 5172 header.attr( "aria-controls", panelId ); 5173 panel.attr( "aria-labelledby", headerId ); 5174 } ) 5175 .next() 5176 .attr( "role", "tabpanel" ); 5177 5178 this.headers 5179 .not( this.active ) 5180 .attr( { 5181 "aria-selected": "false", 5182 "aria-expanded": "false", 5183 tabIndex: -1 5184 } ) 5185 .next() 5186 .attr( { 5187 "aria-hidden": "true" 5188 } ) 5189 .hide(); 5190 5191 // Make sure at least one header is in the tab order 5192 if ( !this.active.length ) { 5193 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 5194 } else { 5195 this.active.attr( { 5196 "aria-selected": "true", 5197 "aria-expanded": "true", 5198 tabIndex: 0 5199 } ) 5200 .next() 5201 .attr( { 5202 "aria-hidden": "false" 5203 } ); 5204 } 5205 5206 this._createIcons(); 5207 5208 this._setupEvents( options.event ); 5209 5210 if ( heightStyle === "fill" ) { 5211 maxHeight = parent.height(); 5212 this.element.siblings( ":visible" ).each( function() { 5213 var elem = $( this ), 5214 position = elem.css( "position" ); 5215 5216 if ( position === "absolute" || position === "fixed" ) { 5217 return; 5218 } 5219 maxHeight -= elem.outerHeight( true ); 5220 } ); 5221 5222 this.headers.each( function() { 5223 maxHeight -= $( this ).outerHeight( true ); 5224 } ); 5225 5226 this.headers.next() 5227 .each( function() { 5228 $( this ).height( Math.max( 0, maxHeight - 5229 $( this ).innerHeight() + $( this ).height() ) ); 5230 } ) 5231 .css( "overflow", "auto" ); 5232 } else if ( heightStyle === "auto" ) { 5233 maxHeight = 0; 5234 this.headers.next() 5235 .each( function() { 5236 var isVisible = $( this ).is( ":visible" ); 5237 if ( !isVisible ) { 5238 $( this ).show(); 5239 } 5240 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 5241 if ( !isVisible ) { 5242 $( this ).hide(); 5243 } 5244 } ) 5245 .height( maxHeight ); 5246 } 5247 }, 5248 5249 _activate: function( index ) { 5250 var active = this._findActive( index )[ 0 ]; 5251 5252 // Trying to activate the already active panel 5253 if ( active === this.active[ 0 ] ) { 5254 return; 5255 } 5256 5257 // Trying to collapse, simulate a click on the currently active header 5258 active = active || this.active[ 0 ]; 5259 5260 this._eventHandler( { 5261 target: active, 5262 currentTarget: active, 5263 preventDefault: $.noop 5264 } ); 5265 }, 5266 5267 _findActive: function( selector ) { 5268 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 5269 }, 5270 5271 _setupEvents: function( event ) { 5272 var events = { 5273 keydown: "_keydown" 5274 }; 5275 if ( event ) { 5276 $.each( event.split( " " ), function( index, eventName ) { 5277 events[ eventName ] = "_eventHandler"; 5278 } ); 5279 } 5280 5281 this._off( this.headers.add( this.headers.next() ) ); 5282 this._on( this.headers, events ); 5283 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 5284 this._hoverable( this.headers ); 5285 this._focusable( this.headers ); 5286 }, 5287 5288 _eventHandler: function( event ) { 5289 var activeChildren, clickedChildren, 5290 options = this.options, 5291 active = this.active, 5292 clicked = $( event.currentTarget ), 5293 clickedIsActive = clicked[ 0 ] === active[ 0 ], 5294 collapsing = clickedIsActive && options.collapsible, 5295 toShow = collapsing ? $() : clicked.next(), 5296 toHide = active.next(), 5297 eventData = { 5298 oldHeader: active, 5299 oldPanel: toHide, 5300 newHeader: collapsing ? $() : clicked, 5301 newPanel: toShow 5302 }; 5303 5304 event.preventDefault(); 5305 5306 if ( 5307 5308 // click on active header, but not collapsible 5309 ( clickedIsActive && !options.collapsible ) || 5310 5311 // allow canceling activation 5312 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 5313 return; 5314 } 5315 5316 options.active = collapsing ? false : this.headers.index( clicked ); 5317 5318 // When the call to ._toggle() comes after the class changes 5319 // it causes a very odd bug in IE 8 (see #6720) 5320 this.active = clickedIsActive ? $() : clicked; 5321 this._toggle( eventData ); 5322 5323 // Switch classes 5324 // corner classes on the previously active header stay after the animation 5325 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 5326 if ( options.icons ) { 5327 activeChildren = active.children( ".ui-accordion-header-icon" ); 5328 this._removeClass( activeChildren, null, options.icons.activeHeader ) 5329 ._addClass( activeChildren, null, options.icons.header ); 5330 } 5331 5332 if ( !clickedIsActive ) { 5333 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 5334 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 5335 if ( options.icons ) { 5336 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 5337 this._removeClass( clickedChildren, null, options.icons.header ) 5338 ._addClass( clickedChildren, null, options.icons.activeHeader ); 5339 } 5340 5341 this._addClass( clicked.next(), "ui-accordion-content-active" ); 5342 } 5343 }, 5344 5345 _toggle: function( data ) { 5346 var toShow = data.newPanel, 5347 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 5348 5349 // Handle activating a panel during the animation for another activation 5350 this.prevShow.add( this.prevHide ).stop( true, true ); 5351 this.prevShow = toShow; 5352 this.prevHide = toHide; 5353 5354 if ( this.options.animate ) { 5355 this._animate( toShow, toHide, data ); 5356 } else { 5357 toHide.hide(); 5358 toShow.show(); 5359 this._toggleComplete( data ); 5360 } 5361 5362 toHide.attr( { 5363 "aria-hidden": "true" 5364 } ); 5365 toHide.prev().attr( { 5366 "aria-selected": "false", 5367 "aria-expanded": "false" 5368 } ); 5369 5370 // if we're switching panels, remove the old header from the tab order 5371 // if we're opening from collapsed state, remove the previous header from the tab order 5372 // if we're collapsing, then keep the collapsing header in the tab order 5373 if ( toShow.length && toHide.length ) { 5374 toHide.prev().attr( { 5375 "tabIndex": -1, 5376 "aria-expanded": "false" 5377 } ); 5378 } else if ( toShow.length ) { 5379 this.headers.filter( function() { 5380 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 5381 } ) 5382 .attr( "tabIndex", -1 ); 5383 } 5384 5385 toShow 5386 .attr( "aria-hidden", "false" ) 5387 .prev() 5388 .attr( { 5389 "aria-selected": "true", 5390 "aria-expanded": "true", 5391 tabIndex: 0 5392 } ); 5393 }, 5394 5395 _animate: function( toShow, toHide, data ) { 5396 var total, easing, duration, 5397 that = this, 5398 adjust = 0, 5399 boxSizing = toShow.css( "box-sizing" ), 5400 down = toShow.length && 5401 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 5402 animate = this.options.animate || {}, 5403 options = down && animate.down || animate, 5404 complete = function() { 5405 that._toggleComplete( data ); 5406 }; 5407 5408 if ( typeof options === "number" ) { 5409 duration = options; 5410 } 5411 if ( typeof options === "string" ) { 5412 easing = options; 5413 } 5414 5415 // fall back from options to animation in case of partial down settings 5416 easing = easing || options.easing || animate.easing; 5417 duration = duration || options.duration || animate.duration; 5418 5419 if ( !toHide.length ) { 5420 return toShow.animate( this.showProps, duration, easing, complete ); 5421 } 5422 if ( !toShow.length ) { 5423 return toHide.animate( this.hideProps, duration, easing, complete ); 5424 } 5425 5426 total = toShow.show().outerHeight(); 5427 toHide.animate( this.hideProps, { 5428 duration: duration, 5429 easing: easing, 5430 step: function( now, fx ) { 5431 fx.now = Math.round( now ); 5432 } 5433 } ); 5434 toShow 5435 .hide() 5436 .animate( this.showProps, { 5437 duration: duration, 5438 easing: easing, 5439 complete: complete, 5440 step: function( now, fx ) { 5441 fx.now = Math.round( now ); 5442 if ( fx.prop !== "height" ) { 5443 if ( boxSizing === "content-box" ) { 5444 adjust += fx.now; 5445 } 5446 } else if ( that.options.heightStyle !== "content" ) { 5447 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 5448 adjust = 0; 5449 } 5450 } 5451 } ); 5452 }, 5453 5454 _toggleComplete: function( data ) { 5455 var toHide = data.oldPanel, 5456 prev = toHide.prev(); 5457 5458 this._removeClass( toHide, "ui-accordion-content-active" ); 5459 this._removeClass( prev, "ui-accordion-header-active" ) 5460 ._addClass( prev, "ui-accordion-header-collapsed" ); 5461 5462 this._trigger( "activate", null, data ); 5463 } 5464} ); 5465 5466} ); 5467 5468 5469 5470 5471 5472 5473/*! 5474 * jQuery UI Menu 1.14.1 5475 * https://jqueryui.com 5476 * 5477 * Copyright OpenJS Foundation and other contributors 5478 * Released under the MIT license. 5479 * https://jquery.org/license 5480 */ 5481 5482//>>label: Menu 5483//>>group: Widgets 5484//>>description: Creates nestable menus. 5485//>>docs: https://api.jqueryui.com/menu/ 5486//>>demos: https://jqueryui.com/menu/ 5487//>>css.structure: ../../themes/base/core.css 5488//>>css.structure: ../../themes/base/menu.css 5489//>>css.theme: ../../themes/base/theme.css 5490 5491( function( factory ) { 5492 "use strict"; 5493 5494 if ( typeof define === "function" && define.amd ) { 5495 5496 // AMD. Register as an anonymous module. 5497 define( [ 5498 "jquery", 5499 "../keycode", 5500 "../position", 5501 "../unique-id", 5502 "../version", 5503 "../widget" 5504 ], factory ); 5505 } else { 5506 5507 // Browser globals 5508 factory( jQuery ); 5509 } 5510} )( function( $ ) { 5511"use strict"; 5512 5513return $.widget( "ui.menu", { 5514 version: "1.14.1
vendor: 5,700 bytes, lines 5514-5733
5514", 5515 defaultElement: "<ul>", 5516 delay: 300, 5517 options: { 5518 icons: { 5519 submenu: "ui-icon-caret-1-e" 5520 }, 5521 items: "> *", 5522 menus: "ul", 5523 position: { 5524 my: "left top", 5525 at: "right top" 5526 }, 5527 role: "menu", 5528 5529 // Callbacks 5530 blur: null, 5531 focus: null, 5532 select: null 5533 }, 5534 5535 _create: function() { 5536 this.activeMenu = this.element; 5537 5538 // Flag used to prevent firing of the click handler 5539 // as the event bubbles up through nested menus 5540 this.mouseHandled = false; 5541 this.lastMousePosition = { x: null, y: null }; 5542 this.element 5543 .uniqueId() 5544 .attr( { 5545 role: this.options.role, 5546 tabIndex: 0 5547 } ); 5548 5549 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 5550 this._on( { 5551 5552 // Prevent focus from sticking to links inside menu after clicking 5553 // them (focus should always stay on UL during navigation). 5554 "mousedown .ui-menu-item": function( event ) { 5555 event.preventDefault(); 5556 5557 this._activateItem( event ); 5558 }, 5559 "click .ui-menu-item": function( event ) { 5560 var target = $( event.target ); 5561 var active = $( this.document[ 0 ].activeElement ); 5562 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 5563 this.select( event ); 5564 5565 // Only set the mouseHandled flag if the event will bubble, see #9469. 5566 if ( !event.isPropagationStopped() ) { 5567 this.mouseHandled = true; 5568 } 5569 5570 // Open submenu on click 5571 if ( target.has( ".ui-menu" ).length ) { 5572 this.expand( event ); 5573 } else if ( !this.element.is( ":focus" ) && 5574 active.closest( ".ui-menu" ).length ) { 5575 5576 // Redirect focus to the menu 5577 this.element.trigger( "focus", [ true ] ); 5578 5579 // If the active item is on the top level, let it stay active. 5580 // Otherwise, blur the active item since it is no longer visible. 5581 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 5582 clearTimeout( this.timer ); 5583 } 5584 } 5585 } 5586 }, 5587 "mouseenter .ui-menu-item": "_activateItem", 5588 "mousemove .ui-menu-item": "_activateItem", 5589 mouseleave: "collapseAll", 5590 "mouseleave .ui-menu": "collapseAll", 5591 focus: function( event, keepActiveItem ) { 5592 5593 // If there's already an active item, keep it active 5594 // If not, activate the first item 5595 var item = this.active || this._menuItems().first(); 5596 5597 if ( !keepActiveItem ) { 5598 this.focus( event, item ); 5599 } 5600 }, 5601 blur: function( event ) { 5602 this._delay( function() { 5603 var notContained = !$.contains( 5604 this.element[ 0 ], 5605 this.document[ 0 ].activeElement 5606 ); 5607 if ( notContained ) { 5608 this.collapseAll( event ); 5609 } 5610 } ); 5611 }, 5612 keydown: "_keydown" 5613 } ); 5614 5615 this.refresh(); 5616 5617 // Clicks outside of a menu collapse any open menus 5618 this._on( this.document, { 5619 click: function( event ) { 5620 if ( this._closeOnDocumentClick( event ) ) { 5621 this.collapseAll( event, true ); 5622 } 5623 5624 // Reset the mouseHandled flag 5625 this.mouseHandled = false; 5626 } 5627 } ); 5628 }, 5629 5630 _activateItem: function( event ) { 5631 5632 // Ignore mouse events while typeahead is active, see #10458. 5633 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5634 // is over an item in the menu 5635 if ( this.previousFilter ) { 5636 return; 5637 } 5638 5639 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 5640 if ( event.clientX === this.lastMousePosition.x && 5641 event.clientY === this.lastMousePosition.y ) { 5642 return; 5643 } 5644 5645 this.lastMousePosition = { 5646 x: event.clientX, 5647 y: event.clientY 5648 }; 5649 5650 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 5651 target = $( event.currentTarget ); 5652 5653 // Ignore bubbled events on parent items, see #11641 5654 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 5655 return; 5656 } 5657 5658 // If the item is already active, there's nothing to do 5659 if ( target.is( ".ui-state-active" ) ) { 5660 return; 5661 } 5662 5663 // Remove ui-state-active class from siblings of the newly focused menu item 5664 // to avoid a jump caused by adjacent elements both having a class with a border 5665 this._removeClass( target.siblings().children( ".ui-state-active" ), 5666 null, "ui-state-active" ); 5667 this.focus( event, target ); 5668 }, 5669 5670 _destroy: function() { 5671 var items = this.element.find( ".ui-menu-item" ) 5672 .removeAttr( "role aria-disabled" ), 5673 submenus = items.children( ".ui-menu-item-wrapper" ) 5674 .removeUniqueId() 5675 .removeAttr( "tabIndex role aria-haspopup" ); 5676 5677 // Destroy (sub)menus 5678 this.element 5679 .removeAttr( "aria-activedescendant" ) 5680 .find( ".ui-menu" ).addBack() 5681 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5682 "tabIndex" ) 5683 .removeUniqueId() 5684 .show(); 5685 5686 submenus.children().each( function() { 5687 var elem = $( this ); 5688 if ( elem.data( "ui-menu-submenu-caret" ) ) { 5689 elem.remove(); 5690 } 5691 } ); 5692 }, 5693 5694 _keydown: function( event ) { 5695 var match, prev, character, skip, 5696 preventDefault = true; 5697 5698 switch ( event.keyCode ) { 5699 case $.ui.keyCode.PAGE_UP: 5700 this.previousPage( event ); 5701 break; 5702 case $.ui.keyCode.PAGE_DOWN: 5703 this.nextPage( event ); 5704 break; 5705 case $.ui.keyCode.HOME: 5706 this._move( "first", "first", event ); 5707 break; 5708 case $.ui.keyCode.END: 5709 this._move( "last", "last", event ); 5710 break; 5711 case $.ui.keyCode.UP: 5712 this.previous( event ); 5713 break; 5714 case $.ui.keyCode.DOWN: 5715 this.next( event ); 5716 break; 5717 case $.ui.keyCode.LEFT: 5718 this.collapse( event ); 5719 break; 5720 case $.ui.keyCode.RIGHT: 5721 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5722 this.expand( event ); 5723 } 5724 break; 5725 case $.ui.keyCode.ENTER: 5726 case $.ui.keyCode.SPACE: 5727 this._activate( event ); 5728 break; 5729 case $.ui.keyCode.ESCAPE: 5730 this.collapse( event ); 5731 break; 5732 default: 5733 preventDefault = false;
vendor: 6,930 bytes, lines 5734-5982
5734 prev = this.previousFilter || ""; 5735 skip = false; 5736 5737 // Support number pad values 5738 character = event.keyCode >= 96 && event.keyCode <= 105 ? 5739 ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode ); 5740 5741 clearTimeout( this.filterTimer ); 5742 5743 if ( character === prev ) { 5744 skip = true; 5745 } else { 5746 character = prev + character; 5747 } 5748 5749 match = this._filterMenuItems( character ); 5750 match = skip && match.index( this.active.next() ) !== -1 ? 5751 this.active.nextAll( ".ui-menu-item" ) : 5752 match; 5753 5754 // If no matches on the current filter, reset to the last character pressed 5755 // to move down the menu to the first item that starts with that character 5756 if ( !match.length ) { 5757 character = String.fromCharCode( event.keyCode ); 5758 match = this._filterMenuItems( character ); 5759 } 5760 5761 if ( match.length ) { 5762 this.focus( event, match ); 5763 this.previousFilter = character; 5764 this.filterTimer = this._delay( function() { 5765 delete this.previousFilter; 5766 }, 1000 ); 5767 } else { 5768 delete this.previousFilter; 5769 } 5770 } 5771 5772 if ( preventDefault ) { 5773 event.preventDefault(); 5774 } 5775 }, 5776 5777 _activate: function( event ) { 5778 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5779 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 5780 this.expand( event ); 5781 } else { 5782 this.select( event ); 5783 } 5784 } 5785 }, 5786 5787 refresh: function() { 5788 var menus, items, newSubmenus, newItems, newWrappers, 5789 that = this, 5790 icon = this.options.icons.submenu, 5791 submenus = this.element.find( this.options.menus ); 5792 5793 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 5794 5795 // Initialize nested menus 5796 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 5797 .hide() 5798 .attr( { 5799 role: this.options.role, 5800 "aria-hidden": "true", 5801 "aria-expanded": "false" 5802 } ) 5803 .each( function() { 5804 var menu = $( this ), 5805 item = menu.prev(), 5806 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 5807 5808 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 5809 item 5810 .attr( "aria-haspopup", "true" ) 5811 .prepend( submenuCaret ); 5812 menu.attr( "aria-labelledby", item.attr( "id" ) ); 5813 } ); 5814 5815 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 5816 5817 menus = submenus.add( this.element ); 5818 items = menus.find( this.options.items ); 5819 5820 // Initialize menu-items containing spaces and/or dashes only as dividers 5821 items.not( ".ui-menu-item" ).each( function() { 5822 var item = $( this ); 5823 if ( that._isDivider( item ) ) { 5824 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 5825 } 5826 } ); 5827 5828 // Don't refresh list items that are already adapted 5829 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 5830 newWrappers = newItems.children() 5831 .not( ".ui-menu" ) 5832 .uniqueId() 5833 .attr( { 5834 tabIndex: -1, 5835 role: this._itemRole() 5836 } ); 5837 this._addClass( newItems, "ui-menu-item" ) 5838 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 5839 5840 // Add aria-disabled attribute to any disabled menu item 5841 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 5842 5843 // If the active item has been removed, blur the menu 5844 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5845 this.blur(); 5846 } 5847 }, 5848 5849 _itemRole: function() { 5850 return { 5851 menu: "menuitem", 5852 listbox: "option" 5853 }[ this.options.role ]; 5854 }, 5855 5856 _setOption: function( key, value ) { 5857 if ( key === "icons" ) { 5858 var icons = this.element.find( ".ui-menu-icon" ); 5859 this._removeClass( icons, null, this.options.icons.submenu ) 5860 ._addClass( icons, null, value.submenu ); 5861 } 5862 this._super( key, value ); 5863 }, 5864 5865 _setOptionDisabled: function( value ) { 5866 this._super( value ); 5867 5868 this.element.attr( "aria-disabled", String( value ) ); 5869 this._toggleClass( null, "ui-state-disabled", !!value ); 5870 }, 5871 5872 focus: function( event, item ) { 5873 var nested, focused, activeParent; 5874 this.blur( event, event && event.type === "focus" ); 5875 5876 this._scrollIntoView( item ); 5877 5878 this.active = item.first(); 5879 5880 focused = this.active.children( ".ui-menu-item-wrapper" ); 5881 this._addClass( focused, null, "ui-state-active" ); 5882 5883 // Only update aria-activedescendant if there's a role 5884 // otherwise we assume focus is managed elsewhere 5885 if ( this.options.role ) { 5886 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 5887 } 5888 5889 // Highlight active parent menu item, if any 5890 activeParent = this.active 5891 .parent() 5892 .closest( ".ui-menu-item" ) 5893 .children( ".ui-menu-item-wrapper" ); 5894 this._addClass( activeParent, null, "ui-state-active" ); 5895 5896 if ( event && event.type === "keydown" ) { 5897 this._close(); 5898 } else { 5899 this.timer = this._delay( function() { 5900 this._close(); 5901 }, this.delay ); 5902 } 5903 5904 nested = item.children( ".ui-menu" ); 5905 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 5906 this._startOpening( nested ); 5907 } 5908 this.activeMenu = item.parent(); 5909 5910 this._trigger( "focus", event, { item: item } ); 5911 }, 5912 5913 _scrollIntoView: function( item ) { 5914 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5915 if ( this._hasScroll() ) { 5916 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 5917 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 5918 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5919 scroll = this.activeMenu.scrollTop(); 5920 elementHeight = this.activeMenu.height(); 5921 itemHeight = item.outerHeight(); 5922 5923 if ( offset < 0 ) { 5924 this.activeMenu.scrollTop( scroll + offset ); 5925 } else if ( offset + itemHeight > elementHeight ) { 5926 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 5927 } 5928 } 5929 }, 5930 5931 blur: function( event, fromFocus ) { 5932 if ( !fromFocus ) { 5933 clearTimeout( this.timer ); 5934 } 5935 5936 if ( !this.active ) { 5937 return; 5938 } 5939 5940 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 5941 null, "ui-state-active" ); 5942 5943 this._trigger( "blur", event, { item: this.active } ); 5944 this.active = null; 5945 }, 5946 5947 _startOpening: function( submenu ) { 5948 clearTimeout( this.timer ); 5949 5950 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5951 // shift in the submenu position when mousing over the caret icon 5952 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 5953 return; 5954 } 5955 5956 this.timer = this._delay( function() { 5957 this._close(); 5958 this._open( submenu ); 5959 }, this.delay ); 5960 }, 5961 5962 _open: function( submenu ) { 5963 var position = $.extend( { 5964 of: this.active 5965 }, this.options.position ); 5966 5967 clearTimeout( this.timer ); 5968 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 5969 .hide() 5970 .attr( "aria-hidden", "true" ); 5971 5972 submenu 5973 .show() 5974 .removeAttr( "aria-hidden" ) 5975 .attr( "aria-expanded", "true" ) 5976 .position( position ); 5977 }, 5978 5979 collapseAll: function( event, all ) { 5980 clearTimeout( this.timer ); 5981 this.timer = this._delay( function() { 5982
vendor: 5,398 bytes, lines 5983-6183
5983 // If we were passed an event, look for the submenu that contains the event 5984 var currentMenu = all ? this.element : 5985 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 5986 5987 // If we found no valid submenu ancestor, use the main menu to close all 5988 // sub menus anyway 5989 if ( !currentMenu.length ) { 5990 currentMenu = this.element; 5991 } 5992 5993 this._close( currentMenu ); 5994 5995 this.blur( event ); 5996 5997 // Work around active item staying active after menu is blurred 5998 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 5999 6000 this.activeMenu = currentMenu; 6001 }, all ? 0 : this.delay ); 6002 }, 6003 6004 // With no arguments, closes the currently active menu - if nothing is active 6005 // it closes all menus. If passed an argument, it will search for menus BELOW 6006 _close: function( startMenu ) { 6007 if ( !startMenu ) { 6008 startMenu = this.active ? this.active.parent() : this.element; 6009 } 6010 6011 startMenu.find( ".ui-menu" ) 6012 .hide() 6013 .attr( "aria-hidden", "true" ) 6014 .attr( "aria-expanded", "false" ); 6015 }, 6016 6017 _closeOnDocumentClick: function( event ) { 6018 return !$( event.target ).closest( ".ui-menu" ).length; 6019 }, 6020 6021 _isDivider: function( item ) { 6022 6023 // Match hyphen, em dash, en dash 6024 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 6025 }, 6026 6027 collapse: function( event ) { 6028 var newItem = this.active && 6029 this.active.parent().closest( ".ui-menu-item", this.element ); 6030 if ( newItem && newItem.length ) { 6031 this._close(); 6032 this.focus( event, newItem ); 6033 } 6034 }, 6035 6036 expand: function( event ) { 6037 var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first(); 6038 6039 if ( newItem && newItem.length ) { 6040 this._open( newItem.parent() ); 6041 6042 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 6043 this._delay( function() { 6044 this.focus( event, newItem ); 6045 } ); 6046 } 6047 }, 6048 6049 next: function( event ) { 6050 this._move( "next", "first", event ); 6051 }, 6052 6053 previous: function( event ) { 6054 this._move( "prev", "last", event ); 6055 }, 6056 6057 isFirstItem: function() { 6058 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 6059 }, 6060 6061 isLastItem: function() { 6062 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 6063 }, 6064 6065 _menuItems: function( menu ) { 6066 return ( menu || this.element ) 6067 .find( this.options.items ) 6068 .filter( ".ui-menu-item" ); 6069 }, 6070 6071 _move: function( direction, filter, event ) { 6072 var next; 6073 if ( this.active ) { 6074 if ( direction === "first" || direction === "last" ) { 6075 next = this.active 6076 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 6077 .last(); 6078 } else { 6079 next = this.active 6080 [ direction + "All" ]( ".ui-menu-item" ) 6081 .first(); 6082 } 6083 } 6084 if ( !next || !next.length || !this.active ) { 6085 next = this._menuItems( this.activeMenu )[ filter ](); 6086 } 6087 6088 this.focus( event, next ); 6089 }, 6090 6091 nextPage: function( event ) { 6092 var item, base, height; 6093 6094 if ( !this.active ) { 6095 this.next( event ); 6096 return; 6097 } 6098 if ( this.isLastItem() ) { 6099 return; 6100 } 6101 if ( this._hasScroll() ) { 6102 base = this.active.offset().top; 6103 height = this.element.innerHeight(); 6104 6105 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 6106 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 6107 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 6108 } 6109 6110 this.active.nextAll( ".ui-menu-item" ).each( function() { 6111 item = $( this ); 6112 return item.offset().top - base - height < 0; 6113 } ); 6114 6115 this.focus( event, item ); 6116 } else { 6117 this.focus( event, this._menuItems( this.activeMenu ) 6118 [ !this.active ? "first" : "last" ]() ); 6119 } 6120 }, 6121 6122 previousPage: function( event ) { 6123 var item, base, height; 6124 if ( !this.active ) { 6125 this.next( event ); 6126 return; 6127 } 6128 if ( this.isFirstItem() ) { 6129 return; 6130 } 6131 if ( this._hasScroll() ) { 6132 base = this.active.offset().top; 6133 height = this.element.innerHeight(); 6134 6135 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 6136 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 6137 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 6138 } 6139 6140 this.active.prevAll( ".ui-menu-item" ).each( function() { 6141 item = $( this ); 6142 return item.offset().top - base + height > 0; 6143 } ); 6144 6145 this.focus( event, item ); 6146 } else { 6147 this.focus( event, this._menuItems( this.activeMenu ).first() ); 6148 } 6149 }, 6150 6151 _hasScroll: function() { 6152 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 6153 }, 6154 6155 select: function( event ) { 6156 6157 // TODO: It should never be possible to not have an active item at this 6158 // point, but the tests don't trigger mouseenter before click. 6159 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 6160 var ui = { item: this.active }; 6161 if ( !this.active.has( ".ui-menu" ).length ) { 6162 this.collapseAll( event, true ); 6163 } 6164 this._trigger( "select", event, ui ); 6165 }, 6166 6167 _filterMenuItems: function( character ) { 6168 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 6169 regex = new RegExp( "^" + escapedCharacter, "i" ); 6170 6171 return this.activeMenu 6172 .find( this.options.items ) 6173 6174 // Only match on items, not dividers or other content (#10571) 6175 .filter( ".ui-menu-item" ) 6176 .filter( function() { 6177 return regex.test( 6178 String.prototype.trim.call( 6179 $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 6180 } ); 6181 } 6182} ); 6183
6184} ); 6185 6186 6187 6188 6189 6190 6191/*! 6192 * jQuery UI Autocomplete 1.14.1 6193 * https://jqueryui.com 6194 * 6195 * Copyright OpenJS Foundation and other contributors 6196 * Released under the MIT license. 6197 * https://jquery.org/license 6198 */ 6199 6200//>>label: Autocomplete 6201//>>group: Widgets 6202//>>description: Lists suggested words as the user is typing. 6203//>>docs: https://api.jqueryui.com/autocomplete/ 6204//>>demos: https://jqueryui.com/autocomplete/ 6205//>>css.structure: ../../themes/base/core.css 6206//>>css.structure: ../../themes/base/autocomplete.css 6207//>>css.theme: ../../themes/base/theme.css 6208 6209( function( factory ) { 6210 "use strict"; 6211 6212 if ( typeof define === "function" && define.amd ) { 6213 6214 // AMD. Register as an anonymous module. 6215 define( [ 6216 "jquery", 6217 "./menu", 6218 "../keycode", 6219 "../position", 6220 "../version", 6221 "../widget" 6222 ], factory ); 6223 } else { 6224 6225 // Browser globals 6226 factory( jQuery ); 6227 } 6228} )( function( $ ) { 6229"use strict"; 6230 6231$.widget( "ui.autocomplete", { 6232 version: "1.14.1
vendor: 15,219 bytes, lines 6232-6827
6232", 6233 defaultElement: "<input>", 6234 options: { 6235 appendTo: null, 6236 autoFocus: false, 6237 delay: 300, 6238 minLength: 1, 6239 position: { 6240 my: "left top", 6241 at: "left bottom", 6242 collision: "none" 6243 }, 6244 source: null, 6245 6246 // Callbacks 6247 change: null, 6248 close: null, 6249 focus: null, 6250 open: null, 6251 response: null, 6252 search: null, 6253 select: null 6254 }, 6255 6256 requestIndex: 0, 6257 pending: 0, 6258 liveRegionTimer: null, 6259 6260 _create: function() { 6261 6262 // Some browsers only repeat keydown events, not keypress events, 6263 // so we use the suppressKeyPress flag to determine if we've already 6264 // handled the keydown event. #7269 6265 // Unfortunately the code for & in keypress is the same as the up arrow, 6266 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 6267 // events when we know the keydown event was used to modify the 6268 // search term. #7799 6269 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 6270 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 6271 isTextarea = nodeName === "textarea", 6272 isInput = nodeName === "input"; 6273 6274 // Textareas are always multi-line 6275 // Inputs are always single-line, even if inside a contentEditable element 6276 // All other element types are determined by whether they're contentEditable 6277 this.isMultiLine = isTextarea || 6278 !isInput && this.element.prop( "contentEditable" ) === "true"; 6279 6280 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 6281 this.isNewMenu = true; 6282 6283 this._addClass( "ui-autocomplete-input" ); 6284 this.element.attr( "autocomplete", "off" ); 6285 6286 this._on( this.element, { 6287 keydown: function( event ) { 6288 if ( this.element.prop( "readOnly" ) ) { 6289 suppressKeyPress = true; 6290 suppressInput = true; 6291 suppressKeyPressRepeat = true; 6292 return; 6293 } 6294 6295 suppressKeyPress = false; 6296 suppressInput = false; 6297 suppressKeyPressRepeat = false; 6298 var keyCode = $.ui.keyCode; 6299 switch ( event.keyCode ) { 6300 case keyCode.PAGE_UP: 6301 suppressKeyPress = true; 6302 this._move( "previousPage", event ); 6303 break; 6304 case keyCode.PAGE_DOWN: 6305 suppressKeyPress = true; 6306 this._move( "nextPage", event ); 6307 break; 6308 case keyCode.UP: 6309 suppressKeyPress = true; 6310 this._keyEvent( "previous", event ); 6311 break; 6312 case keyCode.DOWN: 6313 suppressKeyPress = true; 6314 this._keyEvent( "next", event ); 6315 break; 6316 case keyCode.ENTER: 6317 6318 // when menu is open and has focus 6319 if ( this.menu.active ) { 6320 6321 // #6055 - Opera still allows the keypress to occur 6322 // which causes forms to submit 6323 suppressKeyPress = true; 6324 event.preventDefault(); 6325 this.menu.select( event ); 6326 } 6327 break; 6328 case keyCode.TAB: 6329 if ( this.menu.active ) { 6330 this.menu.select( event ); 6331 } 6332 break; 6333 case keyCode.ESCAPE: 6334 if ( this.menu.element.is( ":visible" ) ) { 6335 if ( !this.isMultiLine ) { 6336 this._value( this.term ); 6337 } 6338 this.close( event ); 6339 6340 // Different browsers have different default behavior for escape 6341 // Single press can mean undo or clear 6342 event.preventDefault(); 6343 } 6344 break; 6345 default: 6346 suppressKeyPressRepeat = true; 6347 6348 // search timeout should be triggered before the input value is changed 6349 this._searchTimeout( event ); 6350 break; 6351 } 6352 }, 6353 keypress: function( event ) { 6354 if ( suppressKeyPress ) { 6355 suppressKeyPress = false; 6356 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6357 event.preventDefault(); 6358 } 6359 return; 6360 } 6361 if ( suppressKeyPressRepeat ) { 6362 return; 6363 } 6364 6365 // Replicate some key handlers to allow them to repeat in Firefox and Opera 6366 var keyCode = $.ui.keyCode; 6367 switch ( event.keyCode ) { 6368 case keyCode.PAGE_UP: 6369 this._move( "previousPage", event ); 6370 break; 6371 case keyCode.PAGE_DOWN: 6372 this._move( "nextPage", event ); 6373 break; 6374 case keyCode.UP: 6375 this._keyEvent( "previous", event ); 6376 break; 6377 case keyCode.DOWN: 6378 this._keyEvent( "next", event ); 6379 break; 6380 } 6381 }, 6382 input: function( event ) { 6383 if ( suppressInput ) { 6384 suppressInput = false; 6385 event.preventDefault(); 6386 return; 6387 } 6388 this._searchTimeout( event ); 6389 }, 6390 focus: function() { 6391 this.selectedItem = null; 6392 this.previous = this._value(); 6393 }, 6394 blur: function( event ) { 6395 clearTimeout( this.searching ); 6396 this.close( event ); 6397 this._change( event ); 6398 } 6399 } ); 6400 6401 this._initSource(); 6402 this.menu = $( "<ul>" ) 6403 .appendTo( this._appendTo() ) 6404 .menu( { 6405 6406 // disable ARIA support, the live region takes care of that 6407 role: null 6408 } ) 6409 .hide() 6410 .menu( "instance" ); 6411 6412 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 6413 this._on( this.menu.element, { 6414 mousedown: function( event ) { 6415 6416 // Prevent moving focus out of the text field 6417 event.preventDefault(); 6418 }, 6419 menufocus: function( event, ui ) { 6420 var label, item; 6421 6422 // Support: Firefox 6423 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 6424 if ( this.isNewMenu ) { 6425 this.isNewMenu = false; 6426 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 6427 this.menu.blur(); 6428 6429 this.document.one( "mousemove", function() { 6430 $( event.target ).trigger( event.originalEvent ); 6431 } ); 6432 6433 return; 6434 } 6435 } 6436 6437 item = ui.item.data( "ui-autocomplete-item" ); 6438 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 6439 6440 // use value to match what will end up in the input, if it was a key event 6441 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 6442 this._value( item.value ); 6443 } 6444 } 6445 6446 // Announce the value in the liveRegion 6447 label = ui.item.attr( "aria-label" ) || item.value; 6448 if ( label && String.prototype.trim.call( label ).length ) { 6449 clearTimeout( this.liveRegionTimer ); 6450 this.liveRegionTimer = this._delay( function() { 6451 this.liveRegion.html( $( "<div>" ).text( label ) ); 6452 }, 100 ); 6453 } 6454 }, 6455 menuselect: function( event, ui ) { 6456 var item = ui.item.data( "ui-autocomplete-item" ), 6457 previous = this.previous; 6458 6459 // Only trigger when focus was lost (click on menu) 6460 if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { 6461 this.element.trigger( "focus" ); 6462 this.previous = previous; 6463 } 6464 6465 if ( false !== this._trigger( "select", event, { item: item } ) ) { 6466 this._value( item.value ); 6467 } 6468 6469 // reset the term after the select event 6470 // this allows custom select handling to work properly 6471 this.term = this._value(); 6472 6473 this.close( event ); 6474 this.selectedItem = item; 6475 } 6476 } ); 6477 6478 this.liveRegion = $( "<div>", { 6479 role: "status", 6480 "aria-live": "assertive", 6481 "aria-relevant": "additions" 6482 } ) 6483 .appendTo( this.document[ 0 ].body ); 6484 6485 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 6486 6487 // Turning off autocomplete prevents the browser from remembering the 6488 // value when navigating through history, so we re-enable autocomplete 6489 // if the page is unloaded before the widget is destroyed. #7790 6490 this._on( this.window, { 6491 beforeunload: function() { 6492 this.element.removeAttr( "autocomplete" ); 6493 } 6494 } ); 6495 }, 6496 6497 _destroy: function() { 6498 clearTimeout( this.searching ); 6499 this.element.removeAttr( "autocomplete" ); 6500 this.menu.element.remove(); 6501 this.liveRegion.remove(); 6502 }, 6503 6504 _setOption: function( key, value ) { 6505 this._super( key, value ); 6506 if ( key === "source" ) { 6507 this._initSource(); 6508 } 6509 if ( key === "appendTo" ) { 6510 this.menu.element.appendTo( this._appendTo() ); 6511 } 6512 if ( key === "disabled" && value && this.xhr ) { 6513 this.xhr.abort(); 6514 } 6515 }, 6516 6517 _isEventTargetInWidget: function( event ) { 6518 var menuElement = this.menu.element[ 0 ]; 6519 6520 return event.target === this.element[ 0 ] || 6521 event.target === menuElement || 6522 $.contains( menuElement, event.target ); 6523 }, 6524 6525 _closeOnClickOutside: function( event ) { 6526 if ( !this._isEventTargetInWidget( event ) ) { 6527 this.close(); 6528 } 6529 }, 6530 6531 _appendTo: function() { 6532 var element = this.options.appendTo; 6533 6534 if ( element ) { 6535 element = element.jquery || element.nodeType ? 6536 $( element ) : 6537 this.document.find( element ).eq( 0 ); 6538 } 6539 6540 if ( !element || !element[ 0 ] ) { 6541 element = this.element.closest( ".ui-front, dialog" ); 6542 } 6543 6544 if ( !element.length ) { 6545 element = this.document[ 0 ].body; 6546 } 6547 6548 return element; 6549 }, 6550 6551 _initSource: function() { 6552 var array, url, 6553 that = this; 6554 if ( Array.isArray( this.options.source ) ) { 6555 array = this.options.source; 6556 this.source = function( request, response ) { 6557 response( $.ui.autocomplete.filter( array, request.term ) ); 6558 }; 6559 } else if ( typeof this.options.source === "string" ) { 6560 url = this.options.source; 6561 this.source = function( request, response ) { 6562 if ( that.xhr ) { 6563 that.xhr.abort(); 6564 } 6565 that.xhr = $.ajax( { 6566 url: url, 6567 data: request, 6568 dataType: "json", 6569 success: function( data ) { 6570 response( data ); 6571 }, 6572 error: function() { 6573 response( [] ); 6574 } 6575 } ); 6576 }; 6577 } else { 6578 this.source = this.options.source; 6579 } 6580 }, 6581 6582 _searchTimeout: function( event ) { 6583 clearTimeout( this.searching ); 6584 this.searching = this._delay( function() { 6585 6586 // Search if the value has changed, or if the user retypes the same value (see #7434) 6587 var equalValues = this.term === this._value(), 6588 menuVisible = this.menu.element.is( ":visible" ), 6589 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 6590 6591 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 6592 this.selectedItem = null; 6593 this.search( null, event ); 6594 } 6595 }, this.options.delay ); 6596 }, 6597 6598 search: function( value, event ) { 6599 value = value != null ? value : this._value(); 6600 6601 // Always save the actual value, not the one passed as an argument 6602 this.term = this._value(); 6603 6604 if ( value.length < this.options.minLength ) { 6605 return this.close( event ); 6606 } 6607 6608 if ( this._trigger( "search", event ) === false ) { 6609 return; 6610 } 6611 6612 return this._search( value ); 6613 }, 6614 6615 _search: function( value ) { 6616 this.pending++; 6617 this._addClass( "ui-autocomplete-loading" ); 6618 this.cancelSearch = false; 6619 6620 this.source( { term: value }, this._response() ); 6621 }, 6622 6623 _response: function() { 6624 var index = ++this.requestIndex; 6625 6626 return function( content ) { 6627 if ( index === this.requestIndex ) { 6628 this.__response( content ); 6629 } 6630 6631 this.pending--; 6632 if ( !this.pending ) { 6633 this._removeClass( "ui-autocomplete-loading" ); 6634 } 6635 }.bind( this ); 6636 }, 6637 6638 __response: function( content ) { 6639 if ( content ) { 6640 content = this._normalize( content ); 6641 } 6642 this._trigger( "response", null, { content: content } ); 6643 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 6644 this._suggest( content ); 6645 this._trigger( "open" ); 6646 } else { 6647 6648 // use ._close() instead of .close() so we don't cancel future searches 6649 this._close(); 6650 } 6651 }, 6652 6653 close: function( event ) { 6654 this.cancelSearch = true; 6655 this._close( event ); 6656 }, 6657 6658 _close: function( event ) { 6659 6660 // Remove the handler that closes the menu on outside clicks 6661 this._off( this.document, "mousedown" ); 6662 6663 if ( this.menu.element.is( ":visible" ) ) { 6664 this.menu.element.hide(); 6665 this.menu.blur(); 6666 this.isNewMenu = true; 6667 this._trigger( "close", event ); 6668 } 6669 }, 6670 6671 _change: function( event ) { 6672 if ( this.previous !== this._value() ) { 6673 this._trigger( "change", event, { item: this.selectedItem } ); 6674 } 6675 }, 6676 6677 _normalize: function( items ) { 6678 6679 // assume all items have the right format when the first item is complete 6680 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 6681 return items; 6682 } 6683 return $.map( items, function( item ) { 6684 if ( typeof item === "string" ) { 6685 return { 6686 label: item, 6687 value: item 6688 }; 6689 } 6690 return $.extend( {}, item, { 6691 label: item.label || item.value, 6692 value: item.value || item.label 6693 } ); 6694 } ); 6695 }, 6696 6697 _suggest: function( items ) { 6698 var ul = this.menu.element.empty(); 6699 this._renderMenu( ul, items ); 6700 this.isNewMenu = true; 6701 this.menu.refresh(); 6702 6703 // Size and position menu 6704 ul.show(); 6705 this._resizeMenu(); 6706 ul.position( $.extend( { 6707 of: this.element 6708 }, this.options.position ) ); 6709 6710 if ( this.options.autoFocus ) { 6711 this.menu.next(); 6712 } 6713 6714 // Listen for interactions outside of the widget (#6642) 6715 this._on( this.document, { 6716 mousedown: "_closeOnClickOutside" 6717 } ); 6718 }, 6719 6720 _resizeMenu: function() { 6721 var ul = this.menu.element; 6722 ul.outerWidth( Math.max( 6723 6724 // Firefox wraps long text (possibly a rounding bug) 6725 // so we add 1px to avoid the wrapping (#7513) 6726 ul.width( "" ).outerWidth() + 1, 6727 this.element.outerWidth() 6728 ) ); 6729 }, 6730 6731 _renderMenu: function( ul, items ) { 6732 var that = this; 6733 $.each( items, function( index, item ) { 6734 that._renderItemData( ul, item ); 6735 } ); 6736 }, 6737 6738 _renderItemData: function( ul, item ) { 6739 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 6740 }, 6741 6742 _renderItem: function( ul, item ) { 6743 return $( "<li>" ) 6744 .append( $( "<div>" ).text( item.label ) ) 6745 .appendTo( ul ); 6746 }, 6747 6748 _move: function( direction, event ) { 6749 if ( !this.menu.element.is( ":visible" ) ) { 6750 this.search( null, event ); 6751 return; 6752 } 6753 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 6754 this.menu.isLastItem() && /^next/.test( direction ) ) { 6755 6756 if ( !this.isMultiLine ) { 6757 this._value( this.term ); 6758 } 6759 6760 this.menu.blur(); 6761 return; 6762 } 6763 this.menu[ direction ]( event ); 6764 }, 6765 6766 widget: function() { 6767 return this.menu.element; 6768 }, 6769 6770 _value: function() { 6771 return this.valueMethod.apply( this.element, arguments ); 6772 }, 6773 6774 _keyEvent: function( keyEvent, event ) { 6775 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6776 this._move( keyEvent, event ); 6777 6778 // Prevents moving cursor to beginning/end of the text field in some browsers 6779 event.preventDefault(); 6780 } 6781 } 6782} ); 6783 6784$.extend( $.ui.autocomplete, { 6785 escapeRegex: function( value ) { 6786 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 6787 }, 6788 filter: function( array, term ) { 6789 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 6790 return $.grep( array, function( value ) { 6791 return matcher.test( value.label || value.value || value ); 6792 } ); 6793 } 6794} ); 6795 6796// Live region extension, adding a `messages` option 6797// NOTE: This is an experimental API. We are still investigating 6798// a full solution for string manipulation and internationalization. 6799$.widget( "ui.autocomplete", $.ui.autocomplete, { 6800 options: { 6801 messages: { 6802 noResults: "No search results.", 6803 results: function( amount ) { 6804 return amount + ( amount > 1 ? " results are" : " result is" ) + 6805 " available, use up and down arrow keys to navigate."; 6806 } 6807 } 6808 }, 6809 6810 __response: function( content ) { 6811 var message; 6812 this._superApply( arguments ); 6813 if ( this.options.disabled || this.cancelSearch ) { 6814 return; 6815 } 6816 if ( content && content.length ) { 6817 message = this.options.messages.results( content.length ); 6818 } else { 6819 message = this.options.messages.noResults; 6820 } 6821 clearTimeout( this.liveRegionTimer ); 6822 this.liveRegionTimer = this._delay( function() { 6823 this.liveRegion.html( $( "<div>" ).text( message ) ); 6824 }, 100 ); 6825 } 6826} ); 6827
6828return $.ui.autocomplete; 6829 6830} ); 6831 6832 6833/*! 6834 * jQuery UI Controlgroup 1.14.1 6835 * https://jqueryui.com 6836 * 6837 * Copyright OpenJS Foundation and other contributors 6838 * Released under the MIT license. 6839 * https://jquery.org/license 6840 */ 6841 6842//>>label: Controlgroup 6843//>>group: Widgets 6844//>>description: Visually groups form control widgets 6845//>>docs: https://api.jqueryui.com/controlgroup/ 6846//>>demos: https://jqueryui.com/controlgroup/ 6847//>>css.structure: ../../themes/base/core.css 6848//>>css.structure: ../../themes/base/controlgroup.css 6849//>>css.theme: ../../themes/base/theme.css 6850 6851( function( factory ) { 6852 "use strict"; 6853 6854 if ( typeof define === "function" && define.amd ) { 6855 6856 // AMD. Register as an anonymous module. 6857 define( [ 6858 "jquery", 6859 "../widget" 6860 ], factory ); 6861 } else { 6862 6863 // Browser globals 6864 factory( jQuery ); 6865 } 6866} )( function( $ ) { 6867"use strict"; 6868 6869var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6870 6871return $.widget( "ui.controlgroup", { 6872 version: "1.14.1
vendor: 7,699 bytes, lines 6872-7133
6872", 6873 defaultElement: "<div>", 6874 options: { 6875 direction: "horizontal", 6876 disabled: null, 6877 onlyVisible: true, 6878 items: { 6879 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6880 "controlgroupLabel": ".ui-controlgroup-label", 6881 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6882 "selectmenu": "select", 6883 "spinner": ".ui-spinner-input" 6884 } 6885 }, 6886 6887 _create: function() { 6888 this._enhance(); 6889 }, 6890 6891 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6892 _enhance: function() { 6893 this.element.attr( "role", "toolbar" ); 6894 this.refresh(); 6895 }, 6896 6897 _destroy: function() { 6898 this._callChildMethod( "destroy" ); 6899 this.childWidgets.removeData( "ui-controlgroup-data" ); 6900 this.element.removeAttr( "role" ); 6901 if ( this.options.items.controlgroupLabel ) { 6902 this.element 6903 .find( this.options.items.controlgroupLabel ) 6904 .find( ".ui-controlgroup-label-contents" ) 6905 .contents().unwrap(); 6906 } 6907 }, 6908 6909 _initWidgets: function() { 6910 var that = this, 6911 childWidgets = []; 6912 6913 // First we iterate over each of the items options 6914 $.each( this.options.items, function( widget, selector ) { 6915 var labels; 6916 var options = {}; 6917 6918 // Make sure the widget has a selector set 6919 if ( !selector ) { 6920 return; 6921 } 6922 6923 if ( widget === "controlgroupLabel" ) { 6924 labels = that.element.find( selector ); 6925 labels.each( function() { 6926 var element = $( this ); 6927 6928 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 6929 return; 6930 } 6931 element.contents() 6932 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 6933 } ); 6934 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 6935 childWidgets = childWidgets.concat( labels.get() ); 6936 return; 6937 } 6938 6939 // Make sure the widget actually exists 6940 if ( !$.fn[ widget ] ) { 6941 return; 6942 } 6943 6944 // We assume everything is in the middle to start because we can't determine 6945 // first / last elements until all enhancments are done. 6946 if ( that[ "_" + widget + "Options" ] ) { 6947 options = that[ "_" + widget + "Options" ]( "middle" ); 6948 } else { 6949 options = { classes: {} }; 6950 } 6951 6952 // Find instances of this widget inside controlgroup and init them 6953 that.element 6954 .find( selector ) 6955 .each( function() { 6956 var element = $( this ); 6957 var instance = element[ widget ]( "instance" ); 6958 6959 // We need to clone the default options for this type of widget to avoid 6960 // polluting the variable options which has a wider scope than a single widget. 6961 var instanceOptions = $.widget.extend( {}, options ); 6962 6963 // If the button is the child of a spinner ignore it 6964 // TODO: Find a more generic solution 6965 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 6966 return; 6967 } 6968 6969 // Create the widget if it doesn't exist 6970 if ( !instance ) { 6971 instance = element[ widget ]()[ widget ]( "instance" ); 6972 } 6973 if ( instance ) { 6974 instanceOptions.classes = 6975 that._resolveClassesValues( instanceOptions.classes, instance ); 6976 } 6977 element[ widget ]( instanceOptions ); 6978 6979 // Store an instance of the controlgroup to be able to reference 6980 // from the outermost element for changing options and refresh 6981 var widgetElement = element[ widget ]( "widget" ); 6982 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 6983 instance ? instance : element[ widget ]( "instance" ) ); 6984 6985 childWidgets.push( widgetElement[ 0 ] ); 6986 } ); 6987 } ); 6988 6989 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 6990 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 6991 }, 6992 6993 _callChildMethod: function( method ) { 6994 this.childWidgets.each( function() { 6995 var element = $( this ), 6996 data = element.data( "ui-controlgroup-data" ); 6997 if ( data && data[ method ] ) { 6998 data[ method ](); 6999 } 7000 } ); 7001 }, 7002 7003 _updateCornerClass: function( element, position ) { 7004 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 7005 var add = this._buildSimpleOptions( position, "label" ).classes.label; 7006 7007 this._removeClass( element, null, remove ); 7008 this._addClass( element, null, add ); 7009 }, 7010 7011 _buildSimpleOptions: function( position, key ) { 7012 var direction = this.options.direction === "vertical"; 7013 var result = { 7014 classes: {} 7015 }; 7016 result.classes[ key ] = { 7017 "middle": "", 7018 "first": "ui-corner-" + ( direction ? "top" : "left" ), 7019 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 7020 "only": "ui-corner-all" 7021 }[ position ]; 7022 7023 return result; 7024 }, 7025 7026 _spinnerOptions: function( position ) { 7027 var options = this._buildSimpleOptions( position, "ui-spinner" ); 7028 7029 options.classes[ "ui-spinner-up" ] = ""; 7030 options.classes[ "ui-spinner-down" ] = ""; 7031 7032 return options; 7033 }, 7034 7035 _buttonOptions: function( position ) { 7036 return this._buildSimpleOptions( position, "ui-button" ); 7037 }, 7038 7039 _checkboxradioOptions: function( position ) { 7040 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 7041 }, 7042 7043 _selectmenuOptions: function( position ) { 7044 var direction = this.options.direction === "vertical"; 7045 return { 7046 width: direction ? "auto" : false, 7047 classes: { 7048 middle: { 7049 "ui-selectmenu-button-open": "", 7050 "ui-selectmenu-button-closed": "" 7051 }, 7052 first: { 7053 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 7054 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 7055 }, 7056 last: { 7057 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 7058 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 7059 }, 7060 only: { 7061 "ui-selectmenu-button-open": "ui-corner-top", 7062 "ui-selectmenu-button-closed": "ui-corner-all" 7063 } 7064 7065 }[ position ] 7066 }; 7067 }, 7068 7069 _resolveClassesValues: function( classes, instance ) { 7070 var result = {}; 7071 $.each( classes, function( key ) { 7072 var current = instance.options.classes[ key ] || ""; 7073 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 7074 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 7075 } ); 7076 return result; 7077 }, 7078 7079 _setOption: function( key, value ) { 7080 if ( key === "direction" ) { 7081 this._removeClass( "ui-controlgroup-" + this.options.direction ); 7082 } 7083 7084 this._super( key, value ); 7085 if ( key === "disabled" ) { 7086 this._callChildMethod( value ? "disable" : "enable" ); 7087 return; 7088 } 7089 7090 this.refresh(); 7091 }, 7092 7093 refresh: function() { 7094 var children, 7095 that = this; 7096 7097 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 7098 7099 if ( this.options.direction === "horizontal" ) { 7100 this._addClass( null, "ui-helper-clearfix" ); 7101 } 7102 this._initWidgets(); 7103 7104 children = this.childWidgets; 7105 7106 // We filter here because we need to track all childWidgets not just the visible ones 7107 if ( this.options.onlyVisible ) { 7108 children = children.filter( ":visible" ); 7109 } 7110 7111 if ( children.length ) { 7112 7113 // We do this last because we need to make sure all enhancment is done 7114 // before determining first and last 7115 $.each( [ "first", "last" ], function( index, value ) { 7116 var instance = children[ value ]().data( "ui-controlgroup-data" ); 7117 7118 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 7119 var options = that[ "_" + instance.widgetName + "Options" ]( 7120 children.length === 1 ? "only" : value 7121 ); 7122 options.classes = that._resolveClassesValues( options.classes, instance ); 7123 instance.element[ instance.widgetName ]( options ); 7124 } else { 7125 that._updateCornerClass( children[ value ](), value ); 7126 } 7127 } ); 7128 7129 // Finally call the refresh method on each of the child widgets. 7130 this._callChildMethod( "refresh" ); 7131 } 7132 } 7133} );
vendor: 8,561 bytes, lines 7134-7478
7134} ); 7135 7136 7137 7138 7139/*! 7140 * jQuery UI Checkboxradio 1.14.1 7141 * https://jqueryui.com 7142 * 7143 * Copyright OpenJS Foundation and other contributors 7144 * Released under the MIT license. 7145 * https://jquery.org/license 7146 */ 7147 7148//>>label: Checkboxradio 7149//>>group: Widgets 7150//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 7151//>>docs: https://api.jqueryui.com/checkboxradio/ 7152//>>demos: https://jqueryui.com/checkboxradio/ 7153//>>css.structure: ../../themes/base/core.css 7154//>>css.structure: ../../themes/base/button.css 7155//>>css.structure: ../../themes/base/checkboxradio.css 7156//>>css.theme: ../../themes/base/theme.css 7157 7158( function( factory ) { 7159 "use strict"; 7160 7161 if ( typeof define === "function" && define.amd ) { 7162 7163 // AMD. Register as an anonymous module. 7164 define( [ 7165 "jquery", 7166 "../form-reset-mixin", 7167 "../labels", 7168 "../widget" 7169 ], factory ); 7170 } else { 7171 7172 // Browser globals 7173 factory( jQuery ); 7174 } 7175} )( function( $ ) { 7176"use strict"; 7177 7178$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 7179 version: "1.14.1", 7180 options: { 7181 disabled: null, 7182 label: null, 7183 icon: true, 7184 classes: { 7185 "ui-checkboxradio-label": "ui-corner-all", 7186 "ui-checkboxradio-icon": "ui-corner-all" 7187 } 7188 }, 7189 7190 _getCreateOptions: function() { 7191 var disabled, labels, labelContents; 7192 var options = this._super() || {}; 7193 7194 // We read the type here, because it makes more sense to throw a element type error first, 7195 // rather then the error for lack of a label. Often if its the wrong type, it 7196 // won't have a label (e.g. calling on a div, btn, etc) 7197 this._readType(); 7198 7199 labels = this.element.labels(); 7200 7201 // If there are multiple labels, use the last one 7202 this.label = $( labels[ labels.length - 1 ] ); 7203 if ( !this.label.length ) { 7204 $.error( "No label found for checkboxradio widget" ); 7205 } 7206 7207 this.originalLabel = ""; 7208 7209 // We need to get the label text but this may also need to make sure it does not contain the 7210 // input itself. 7211 // The label contents could be text, html, or a mix. We wrap all elements 7212 // and read the wrapper's `innerHTML` to get a string representation of 7213 // the label, without the input as part of it. 7214 labelContents = this.label.contents().not( this.element[ 0 ] ); 7215 7216 if ( labelContents.length ) { 7217 this.originalLabel += labelContents 7218 .clone() 7219 .wrapAll( "<div></div>" ) 7220 .parent() 7221 .html(); 7222 } 7223 7224 // Set the label option if we found label text 7225 if ( this.originalLabel ) { 7226 options.label = this.originalLabel; 7227 } 7228 7229 disabled = this.element[ 0 ].disabled; 7230 if ( disabled != null ) { 7231 options.disabled = disabled; 7232 } 7233 return options; 7234 }, 7235 7236 _create: function() { 7237 var checked = this.element[ 0 ].checked; 7238 7239 this._bindFormResetHandler(); 7240 7241 if ( this.options.disabled == null ) { 7242 this.options.disabled = this.element[ 0 ].disabled; 7243 } 7244 7245 this._setOption( "disabled", this.options.disabled ); 7246 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 7247 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 7248 7249 if ( this.type === "radio" ) { 7250 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 7251 } 7252 7253 if ( this.options.label && this.options.label !== this.originalLabel ) { 7254 this._updateLabel(); 7255 } else if ( this.originalLabel ) { 7256 this.options.label = this.originalLabel; 7257 } 7258 7259 this._enhance(); 7260 7261 if ( checked ) { 7262 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 7263 } 7264 7265 this._on( { 7266 change: "_toggleClasses", 7267 focus: function() { 7268 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 7269 }, 7270 blur: function() { 7271 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 7272 } 7273 } ); 7274 }, 7275 7276 _readType: function() { 7277 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 7278 this.type = this.element[ 0 ].type; 7279 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 7280 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 7281 " and element.type=" + this.type ); 7282 } 7283 }, 7284 7285 // Support jQuery Mobile enhanced option 7286 _enhance: function() { 7287 this._updateIcon( this.element[ 0 ].checked ); 7288 }, 7289 7290 widget: function() { 7291 return this.label; 7292 }, 7293 7294 _getRadioGroup: function() { 7295 var group; 7296 var name = this.element[ 0 ].name; 7297 var nameSelector = "input[name='" + CSS.escape( name ) + "']"; 7298 7299 if ( !name ) { 7300 return $( [] ); 7301 } 7302 7303 if ( this.form.length ) { 7304 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 7305 } else { 7306 7307 // Not inside a form, check all inputs that also are not inside a form 7308 group = $( nameSelector ).filter( function() { 7309 return $( $( this ).prop( "form" ) ).length === 0; 7310 } ); 7311 } 7312 7313 return group.not( this.element ); 7314 }, 7315 7316 _toggleClasses: function() { 7317 var checked = this.element[ 0 ].checked; 7318 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 7319 7320 if ( this.options.icon && this.type === "checkbox" ) { 7321 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 7322 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 7323 } 7324 7325 if ( this.type === "radio" ) { 7326 this._getRadioGroup() 7327 .each( function() { 7328 var instance = $( this ).checkboxradio( "instance" ); 7329 7330 if ( instance ) { 7331 instance._removeClass( instance.label, 7332 "ui-checkboxradio-checked", "ui-state-active" ); 7333 } 7334 } ); 7335 } 7336 }, 7337 7338 _destroy: function() { 7339 this._unbindFormResetHandler(); 7340 7341 if ( this.icon ) { 7342 this.icon.remove(); 7343 this.iconSpace.remove(); 7344 } 7345 }, 7346 7347 _setOption: function( key, value ) { 7348 7349 // We don't allow the value to be set to nothing 7350 if ( key === "label" && !value ) { 7351 return; 7352 } 7353 7354 this._super( key, value ); 7355 7356 if ( key === "disabled" ) { 7357 this._toggleClass( this.label, null, "ui-state-disabled", value ); 7358 this.element[ 0 ].disabled = value; 7359 7360 // Don't refresh when setting disabled 7361 return; 7362 } 7363 this.refresh(); 7364 }, 7365 7366 _updateIcon: function( checked ) { 7367 var toAdd = "ui-icon ui-icon-background "; 7368 7369 if ( this.options.icon ) { 7370 if ( !this.icon ) { 7371 this.icon = $( "<span>" ); 7372 this.iconSpace = $( "<span> </span>" ); 7373 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 7374 } 7375 7376 if ( this.type === "checkbox" ) { 7377 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 7378 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 7379 } else { 7380 toAdd += "ui-icon-blank"; 7381 } 7382 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 7383 if ( !checked ) { 7384 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 7385 } 7386 this.icon.prependTo( this.label ).after( this.iconSpace ); 7387 } else if ( this.icon !== undefined ) { 7388 this.icon.remove(); 7389 this.iconSpace.remove(); 7390 delete this.icon; 7391 } 7392 }, 7393 7394 _updateLabel: function() { 7395 7396 // Remove the contents of the label ( minus the icon, icon space, and input ) 7397 var contents = this.label.contents().not( this.element[ 0 ] ); 7398 if ( this.icon ) { 7399 contents = contents.not( this.icon[ 0 ] ); 7400 } 7401 if ( this.iconSpace ) { 7402 contents = contents.not( this.iconSpace[ 0 ] ); 7403 } 7404 contents.remove(); 7405 7406 this.label.append( this.options.label ); 7407 }, 7408 7409 refresh: function() { 7410 var checked = this.element[ 0 ].checked, 7411 isDisabled = this.element[ 0 ].disabled; 7412 7413 this._updateIcon( checked ); 7414 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 7415 if ( this.options.label !== null ) { 7416 this._updateLabel(); 7417 } 7418 7419 if ( isDisabled !== this.options.disabled ) { 7420 this._setOptions( { "disabled": isDisabled } ); 7421 } 7422 } 7423 7424} ] ); 7425 7426return $.ui.checkboxradio; 7427 7428} ); 7429 7430 7431 7432 7433 7434/*! 7435 * jQuery UI Button 1.14.1 7436 * https://jqueryui.com 7437 * 7438 * Copyright OpenJS Foundation and other contributors 7439 * Released under the MIT license. 7440 * https://jquery.org/license 7441 */ 7442 7443//>>label: Button 7444//>>group: Widgets 7445//>>description: Enhances a form with themeable buttons. 7446//>>docs: https://api.jqueryui.com/button/ 7447//>>demos: https://jqueryui.com/button/ 7448//>>css.structure: ../../themes/base/core.css 7449//>>css.structure: ../../themes/base/button.css 7450//>>css.theme: ../../themes/base/theme.css 7451 7452( function( factory ) { 7453 "use strict"; 7454 7455 if ( typeof define === "function" && define.amd ) { 7456 7457 // AMD. Register as an anonymous module. 7458 define( [ 7459 "jquery", 7460 7461 // These are only for backcompat 7462 // TODO: Remove after 1.12 7463 "./controlgroup", 7464 "./checkboxradio", 7465 7466 "../keycode", 7467 "../widget" 7468 ], factory ); 7469 } else { 7470 7471 // Browser globals 7472 factory( jQuery ); 7473 } 7474} )( function( $ ) { 7475"use strict"; 7476 7477$.widget( "ui.button", { 7478 version: "1.14.1
vendor: 10,694 bytes, lines 7478-7879
7478", 7479 defaultElement: "<button>", 7480 options: { 7481 classes: { 7482 "ui-button": "ui-corner-all" 7483 }, 7484 disabled: null, 7485 icon: null, 7486 iconPosition: "beginning", 7487 label: null, 7488 showLabel: true 7489 }, 7490 7491 _getCreateOptions: function() { 7492 var disabled, 7493 7494 // This is to support cases like in jQuery Mobile where the base widget does have 7495 // an implementation of _getCreateOptions 7496 options = this._super() || {}; 7497 7498 this.isInput = this.element.is( "input" ); 7499 7500 disabled = this.element[ 0 ].disabled; 7501 if ( disabled != null ) { 7502 options.disabled = disabled; 7503 } 7504 7505 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 7506 if ( this.originalLabel ) { 7507 options.label = this.originalLabel; 7508 } 7509 7510 return options; 7511 }, 7512 7513 _create: function() { 7514 if ( !this.option.showLabel & !this.options.icon ) { 7515 this.options.showLabel = true; 7516 } 7517 7518 // We have to check the option again here even though we did in _getCreateOptions, 7519 // because null may have been passed on init which would override what was set in 7520 // _getCreateOptions 7521 if ( this.options.disabled == null ) { 7522 this.options.disabled = this.element[ 0 ].disabled || false; 7523 } 7524 7525 this.hasTitle = !!this.element.attr( "title" ); 7526 7527 // Check to see if the label needs to be set or if its already correct 7528 if ( this.options.label && this.options.label !== this.originalLabel ) { 7529 if ( this.isInput ) { 7530 this.element.val( this.options.label ); 7531 } else { 7532 this.element.html( this.options.label ); 7533 } 7534 } 7535 this._addClass( "ui-button", "ui-widget" ); 7536 this._setOption( "disabled", this.options.disabled ); 7537 this._enhance(); 7538 7539 if ( this.element.is( "a" ) ) { 7540 this._on( { 7541 "keyup": function( event ) { 7542 if ( event.keyCode === $.ui.keyCode.SPACE ) { 7543 event.preventDefault(); 7544 7545 // If a native click is available use it, so we 7546 // actually cause navigation. Otherwise, just trigger 7547 // a click event. 7548 if ( this.element[ 0 ].click ) { 7549 this.element[ 0 ].click(); 7550 } else { 7551 this.element.trigger( "click" ); 7552 } 7553 } 7554 } 7555 } ); 7556 } 7557 }, 7558 7559 _enhance: function() { 7560 if ( !this.element.is( "button" ) ) { 7561 this.element.attr( "role", "button" ); 7562 } 7563 7564 if ( this.options.icon ) { 7565 this._updateIcon( "icon", this.options.icon ); 7566 this._updateTooltip(); 7567 } 7568 }, 7569 7570 _updateTooltip: function() { 7571 this.title = this.element.attr( "title" ); 7572 7573 if ( !this.options.showLabel && !this.title ) { 7574 this.element.attr( "title", this.options.label ); 7575 } 7576 }, 7577 7578 _updateIcon: function( option, value ) { 7579 var icon = option !== "iconPosition", 7580 position = icon ? this.options.iconPosition : value, 7581 displayBlock = position === "top" || position === "bottom"; 7582 7583 // Create icon 7584 if ( !this.icon ) { 7585 this.icon = $( "<span>" ); 7586 7587 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 7588 7589 if ( !this.options.showLabel ) { 7590 this._addClass( "ui-button-icon-only" ); 7591 } 7592 } else if ( icon ) { 7593 7594 // If we are updating the icon remove the old icon class 7595 this._removeClass( this.icon, null, this.options.icon ); 7596 } 7597 7598 // If we are updating the icon add the new icon class 7599 if ( icon ) { 7600 this._addClass( this.icon, null, value ); 7601 } 7602 7603 this._attachIcon( position ); 7604 7605 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 7606 // the iconSpace if there is one. 7607 if ( displayBlock ) { 7608 this._addClass( this.icon, null, "ui-widget-icon-block" ); 7609 if ( this.iconSpace ) { 7610 this.iconSpace.remove(); 7611 } 7612 } else { 7613 7614 // Position is beginning or end so remove the ui-widget-icon-block class and add the 7615 // space if it does not exist 7616 if ( !this.iconSpace ) { 7617 this.iconSpace = $( "<span> </span>" ); 7618 this._addClass( this.iconSpace, "ui-button-icon-space" ); 7619 } 7620 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 7621 this._attachIconSpace( position ); 7622 } 7623 }, 7624 7625 _destroy: function() { 7626 this.element.removeAttr( "role" ); 7627 7628 if ( this.icon ) { 7629 this.icon.remove(); 7630 } 7631 if ( this.iconSpace ) { 7632 this.iconSpace.remove(); 7633 } 7634 if ( !this.hasTitle ) { 7635 this.element.removeAttr( "title" ); 7636 } 7637 }, 7638 7639 _attachIconSpace: function( iconPosition ) { 7640 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 7641 }, 7642 7643 _attachIcon: function( iconPosition ) { 7644 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 7645 }, 7646 7647 _setOptions: function( options ) { 7648 var newShowLabel = options.showLabel === undefined ? 7649 this.options.showLabel : 7650 options.showLabel, 7651 newIcon = options.icon === undefined ? this.options.icon : options.icon; 7652 7653 if ( !newShowLabel && !newIcon ) { 7654 options.showLabel = true; 7655 } 7656 this._super( options ); 7657 }, 7658 7659 _setOption: function( key, value ) { 7660 if ( key === "icon" ) { 7661 if ( value ) { 7662 this._updateIcon( key, value ); 7663 } else if ( this.icon ) { 7664 this.icon.remove(); 7665 if ( this.iconSpace ) { 7666 this.iconSpace.remove(); 7667 } 7668 } 7669 } 7670 7671 if ( key === "iconPosition" ) { 7672 this._updateIcon( key, value ); 7673 } 7674 7675 // Make sure we can't end up with a button that has neither text nor icon 7676 if ( key === "showLabel" ) { 7677 this._toggleClass( "ui-button-icon-only", null, !value ); 7678 this._updateTooltip(); 7679 } 7680 7681 if ( key === "label" ) { 7682 if ( this.isInput ) { 7683 this.element.val( value ); 7684 } else { 7685 7686 // If there is an icon, append it, else nothing then append the value 7687 // this avoids removal of the icon when setting label text 7688 this.element.html( value ); 7689 if ( this.icon ) { 7690 this._attachIcon( this.options.iconPosition ); 7691 this._attachIconSpace( this.options.iconPosition ); 7692 } 7693 } 7694 } 7695 7696 this._super( key, value ); 7697 7698 if ( key === "disabled" ) { 7699 this._toggleClass( null, "ui-state-disabled", value ); 7700 this.element[ 0 ].disabled = value; 7701 if ( value ) { 7702 this.element.trigger( "blur" ); 7703 } 7704 } 7705 }, 7706 7707 refresh: function() { 7708 7709 // Make sure to only check disabled if its an element that supports this otherwise 7710 // check for the disabled class to determine state 7711 var isDisabled = this.element.is( "input, button" ) ? 7712 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 7713 7714 if ( isDisabled !== this.options.disabled ) { 7715 this._setOptions( { disabled: isDisabled } ); 7716 } 7717 7718 this._updateTooltip(); 7719 } 7720} ); 7721 7722// DEPRECATED 7723if ( $.uiBackCompat === true ) { 7724 7725 // Text and Icons options 7726 $.widget( "ui.button", $.ui.button, { 7727 options: { 7728 text: true, 7729 icons: { 7730 primary: null, 7731 secondary: null 7732 } 7733 }, 7734 7735 _create: function() { 7736 if ( this.options.showLabel && !this.options.text ) { 7737 this.options.showLabel = this.options.text; 7738 } 7739 if ( !this.options.showLabel && this.options.text ) { 7740 this.options.text = this.options.showLabel; 7741 } 7742 if ( !this.options.icon && ( this.options.icons.primary || 7743 this.options.icons.secondary ) ) { 7744 if ( this.options.icons.primary ) { 7745 this.options.icon = this.options.icons.primary; 7746 } else { 7747 this.options.icon = this.options.icons.secondary; 7748 this.options.iconPosition = "end"; 7749 } 7750 } else if ( this.options.icon ) { 7751 this.options.icons.primary = this.options.icon; 7752 } 7753 this._super(); 7754 }, 7755 7756 _setOption: function( key, value ) { 7757 if ( key === "text" ) { 7758 this._super( "showLabel", value ); 7759 return; 7760 } 7761 if ( key === "showLabel" ) { 7762 this.options.text = value; 7763 } 7764 if ( key === "icon" ) { 7765 this.options.icons.primary = value; 7766 } 7767 if ( key === "icons" ) { 7768 if ( value.primary ) { 7769 this._super( "icon", value.primary ); 7770 this._super( "iconPosition", "beginning" ); 7771 } else if ( value.secondary ) { 7772 this._super( "icon", value.secondary ); 7773 this._super( "iconPosition", "end" ); 7774 } 7775 } 7776 this._superApply( arguments ); 7777 } 7778 } ); 7779 7780 $.fn.button = ( function( orig ) { 7781 return function( options ) { 7782 var isMethodCall = typeof options === "string"; 7783 var args = Array.prototype.slice.call( arguments, 1 ); 7784 var returnValue = this; 7785 7786 if ( isMethodCall ) { 7787 7788 // If this is an empty collection, we need to have the instance method 7789 // return undefined instead of the jQuery instance 7790 if ( !this.length && options === "instance" ) { 7791 returnValue = undefined; 7792 } else { 7793 this.each( function() { 7794 var methodValue; 7795 var type = $( this ).attr( "type" ); 7796 var name = type !== "checkbox" && type !== "radio" ? 7797 "button" : 7798 "checkboxradio"; 7799 var instance = $.data( this, "ui-" + name ); 7800 7801 if ( options === "instance" ) { 7802 returnValue = instance; 7803 return false; 7804 } 7805 7806 if ( !instance ) { 7807 return $.error( "cannot call methods on button" + 7808 " prior to initialization; " + 7809 "attempted to call method '" + options + "'" ); 7810 } 7811 7812 if ( typeof instance[ options ] !== "function" || 7813 options.charAt( 0 ) === "_" ) { 7814 return $.error( "no such method '" + options + "' for button" + 7815 " widget instance" ); 7816 } 7817 7818 methodValue = instance[ options ].apply( instance, args ); 7819 7820 if ( methodValue !== instance && methodValue !== undefined ) { 7821 returnValue = methodValue && methodValue.jquery ? 7822 returnValue.pushStack( methodValue.get() ) : 7823 methodValue; 7824 return false; 7825 } 7826 } ); 7827 } 7828 } else { 7829 7830 // Allow multiple hashes to be passed on init 7831 if ( args.length ) { 7832 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 7833 } 7834 7835 this.each( function() { 7836 var type = $( this ).attr( "type" ); 7837 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 7838 var instance = $.data( this, "ui-" + name ); 7839 7840 if ( instance ) { 7841 instance.option( options || {} ); 7842 if ( instance._init ) { 7843 instance._init(); 7844 } 7845 } else { 7846 if ( name === "button" ) { 7847 orig.call( $( this ), options ); 7848 return; 7849 } 7850 7851 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 7852 } 7853 } ); 7854 } 7855 7856 return returnValue; 7857 }; 7858 } )( $.fn.button ); 7859 7860 $.fn.buttonset = function() { 7861 if ( !$.ui.controlgroup ) { 7862 $.error( "Controlgroup widget missing" ); 7863 } 7864 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 7865 return this.controlgroup.apply( this, 7866 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 7867 } 7868 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 7869 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 7870 } 7871 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 7872 arguments[ 0 ].items = { 7873 button: arguments[ 0 ].items 7874 }; 7875 } 7876 return this.controlgroup.apply( this, arguments ); 7877 }; 7878} 7879
7880return $.ui.button; 7881 7882} ); 7883 7884 7885 7886/* eslint-disable max-len, camelcase */ 7887/*! 7888 * jQuery UI Datepicker 1.14.1 7889 * https://jqueryui.com 7890 * 7891 * Copyright OpenJS Foundation and other contributors 7892 * Released under the MIT license. 7893 * https://jquery.org/license 7894 */ 7895 7896//>>label: Datepicker 7897//>>group: Widgets 7898//>>description: Displays a calendar from an input or inline for selecting dates. 7899//>>docs: https://api.jqueryui.com/datepicker/ 7900//>>demos: https://jqueryui.com/datepicker/ 7901//>>css.structure: ../../themes/base/core.css 7902//>>css.structure: ../../themes/base/datepicker.css 7903//>>css.theme: ../../themes/base/theme.css 7904 7905( function( factory ) { 7906 "use strict"; 7907 7908 if ( typeof define === "function" && define.amd ) { 7909 7910 // AMD. Register as an anonymous module. 7911 define( [ 7912 "jquery", 7913 "../version", 7914 "../keycode" 7915 ], factory ); 7916 } else { 7917 7918 // Browser globals 7919 factory( jQuery ); 7920 } 7921} )( function( $ ) { 7922"use strict"; 7923 7924$.extend( $.ui, { datepicker: { version: "1.14.1
vendor: 20,464 bytes, lines 7924-8423
7924" } } ); 7925 7926var datepicker_instActive; 7927 7928function datepicker_getZindex( elem ) { 7929 var position, value; 7930 while ( elem.length && elem[ 0 ] !== document ) { 7931 7932 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7933 // This makes behavior of this function consistent across browsers 7934 // WebKit always returns auto if the element is positioned 7935 position = elem.css( "position" ); 7936 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 7937 7938 // IE returns 0 when zIndex is not specified 7939 // other browsers return a string 7940 // we ignore the case of nested elements with an explicit value of 0 7941 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7942 value = parseInt( elem.css( "zIndex" ), 10 ); 7943 if ( !isNaN( value ) && value !== 0 ) { 7944 return value; 7945 } 7946 } 7947 elem = elem.parent(); 7948 } 7949 7950 return 0; 7951} 7952 7953/* Date picker manager. 7954 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7955 Settings for (groups of) date pickers are maintained in an instance object, 7956 allowing multiple different settings on the same page. */ 7957 7958function Datepicker() { 7959 this._curInst = null; // The current instance in use 7960 this._keyEvent = false; // If the last event was a key event 7961 this._disabledInputs = []; // List of date picker inputs that have been disabled 7962 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7963 this._inDialog = false; // True if showing within a "dialog", false if not 7964 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7965 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7966 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7967 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7968 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7969 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7970 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7971 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7972 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7973 this.regional = []; // Available regional settings, indexed by language code 7974 this.regional[ "" ] = { // Default regional settings 7975 closeText: "Done", // Display text for close link 7976 prevText: "Prev", // Display text for previous month link 7977 nextText: "Next", // Display text for next month link 7978 currentText: "Today", // Display text for current month link 7979 monthNames: [ "January", "February", "March", "April", "May", "June", 7980 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 7981 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 7982 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 7983 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 7984 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 7985 weekHeader: "Wk", // Column header for week of the year 7986 dateFormat: "mm/dd/yy", // See format options on parseDate 7987 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7988 isRTL: false, // True if right-to-left language, false if left-to-right 7989 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7990 yearSuffix: "", // Additional text to append to the year in the month headers, 7991 selectMonthLabel: "Select month", // Invisible label for month selector 7992 selectYearLabel: "Select year" // Invisible label for year selector 7993 }; 7994 this._defaults = { // Global defaults for all the date picker instances 7995 showOn: "focus", // "focus" for popup on focus, 7996 // "button" for trigger button, or "both" for either 7997 showAnim: "fadeIn", // Name of jQuery animation for popup 7998 showOptions: {}, // Options for enhanced animations 7999 defaultDate: null, // Used when field is blank: actual date, 8000 // +/-number for offset from today, null for today 8001 appendText: "", // Display text following the input box, e.g. showing the format 8002 buttonText: "...", // Text for trigger button 8003 buttonImage: "", // URL for trigger button image 8004 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 8005 hideIfNoPrevNext: false, // True to hide next/previous month links 8006 // if not applicable, false to just disable them 8007 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 8008 gotoCurrent: false, // True if today link goes back to current selection instead 8009 changeMonth: false, // True if month can be selected directly, false if only prev/next 8010 changeYear: false, // True if year can be selected directly, false if only prev/next 8011 yearRange: "c-10:c+10", // Range of years to display in drop-down, 8012 // either relative to today's year (-nn:+nn), relative to currently displayed year 8013 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 8014 showOtherMonths: false, // True to show dates in other months, false to leave blank 8015 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 8016 showWeek: false, // True to show week of the year, false to not show it 8017 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 8018 // takes a Date and returns the number of the week for it 8019 shortYearCutoff: "+10", // Short year values < this are in the current century, 8020 // > this are in the previous century, 8021 // string value starting with "+" for current year + value 8022 minDate: null, // The earliest selectable date, or null for no limit 8023 maxDate: null, // The latest selectable date, or null for no limit 8024 duration: "fast", // Duration of display/closure 8025 beforeShowDay: null, // Function that takes a date and returns an array with 8026 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 8027 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 8028 beforeShow: null, // Function that takes an input field and 8029 // returns a set of custom settings for the date picker 8030 onSelect: null, // Define a callback function when a date is selected 8031 onChangeMonthYear: null, // Define a callback function when the month or year is changed 8032 onClose: null, // Define a callback function when the datepicker is closed 8033 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 8034 numberOfMonths: 1, // Number of months to show at a time 8035 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 8036 stepMonths: 1, // Number of months to step back/forward 8037 stepBigMonths: 12, // Number of months to step back/forward for the big links 8038 altField: "", // Selector for an alternate field to store selected dates into 8039 altFormat: "", // The date format to use for the alternate field 8040 constrainInput: true, // The input is constrained by the current date format 8041 showButtonPanel: false, // True to show button panel, false to not show it 8042 autoSize: false, // True to size the input for the date format, false to leave as is 8043 disabled: false // The initial disabled state 8044 }; 8045 $.extend( this._defaults, this.regional[ "" ] ); 8046 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 8047 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 8048 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 8049} 8050 8051$.extend( Datepicker.prototype, { 8052 8053 /* Class name added to elements to indicate already configured with a date picker. */ 8054 markerClassName: "hasDatepicker", 8055 8056 //Keep track of the maximum number of rows displayed (see #7043) 8057 maxRows: 4, 8058 8059 // TODO rename to "widget" when switching to widget factory 8060 _widgetDatepicker: function() { 8061 return this.dpDiv; 8062 }, 8063 8064 /* Override the default settings for all instances of the date picker. 8065 * @param settings object - the new settings to use as defaults (anonymous object) 8066 * @return the manager object 8067 */ 8068 setDefaults: function( settings ) { 8069 datepicker_extendRemove( this._defaults, settings || {} ); 8070 return this; 8071 }, 8072 8073 /* Attach the date picker to a jQuery selection. 8074 * @param target element - the target input field or division or span 8075 * @param settings object - the new settings to use for this date picker instance (anonymous) 8076 */ 8077 _attachDatepicker: function( target, settings ) { 8078 var nodeName, inline, inst; 8079 nodeName = target.nodeName.toLowerCase(); 8080 inline = ( nodeName === "div" || nodeName === "span" ); 8081 if ( !target.id ) { 8082 this.uuid += 1; 8083 target.id = "dp" + this.uuid; 8084 } 8085 inst = this._newInst( $( target ), inline ); 8086 inst.settings = $.extend( {}, settings || {} ); 8087 if ( nodeName === "input" ) { 8088 this._connectDatepicker( target, inst ); 8089 } else if ( inline ) { 8090 this._inlineDatepicker( target, inst ); 8091 } 8092 }, 8093 8094 /* Create a new instance object. */ 8095 _newInst: function( target, inline ) { 8096 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 8097 return { id: id, input: target, // associated target 8098 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 8099 drawMonth: 0, drawYear: 0, // month being drawn 8100 inline: inline, // is datepicker inline or not 8101 dpDiv: ( !inline ? this.dpDiv : // presentation div 8102 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 8103 }, 8104 8105 /* Attach the date picker to an input field. */ 8106 _connectDatepicker: function( target, inst ) { 8107 var input = $( target ); 8108 inst.append = $( [] ); 8109 inst.trigger = $( [] ); 8110 if ( input.hasClass( this.markerClassName ) ) { 8111 return; 8112 } 8113 this._attachments( input, inst ); 8114 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 8115 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 8116 this._autoSize( inst ); 8117 $.data( target, "datepicker", inst ); 8118 8119 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 8120 if ( inst.settings.disabled ) { 8121 this._disableDatepicker( target ); 8122 } 8123 }, 8124 8125 /* Make attachments based on settings. */ 8126 _attachments: function( input, inst ) { 8127 var showOn, buttonText, buttonImage, 8128 appendText = this._get( inst, "appendText" ), 8129 isRTL = this._get( inst, "isRTL" ); 8130 8131 if ( inst.append ) { 8132 inst.append.remove(); 8133 } 8134 if ( appendText ) { 8135 inst.append = $( "<span>" ) 8136 .addClass( this._appendClass ) 8137 .text( appendText ); 8138 input[ isRTL ? "before" : "after" ]( inst.append ); 8139 } 8140 8141 input.off( "focus", this._showDatepicker ); 8142 8143 if ( inst.trigger ) { 8144 inst.trigger.remove(); 8145 } 8146 8147 showOn = this._get( inst, "showOn" ); 8148 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 8149 input.on( "focus", this._showDatepicker ); 8150 } 8151 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 8152 buttonText = this._get( inst, "buttonText" ); 8153 buttonImage = this._get( inst, "buttonImage" ); 8154 8155 if ( this._get( inst, "buttonImageOnly" ) ) { 8156 inst.trigger = $( "<img>" ) 8157 .addClass( this._triggerClass ) 8158 .attr( { 8159 src: buttonImage, 8160 alt: buttonText, 8161 title: buttonText 8162 } ); 8163 } else { 8164 inst.trigger = $( "<button type='button'>" ) 8165 .addClass( this._triggerClass ); 8166 if ( buttonImage ) { 8167 inst.trigger.html( 8168 $( "<img>" ) 8169 .attr( { 8170 src: buttonImage, 8171 alt: buttonText, 8172 title: buttonText 8173 } ) 8174 ); 8175 } else { 8176 inst.trigger.text( buttonText ); 8177 } 8178 } 8179 8180 input[ isRTL ? "before" : "after" ]( inst.trigger ); 8181 inst.trigger.on( "click", function() { 8182 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 8183 $.datepicker._hideDatepicker(); 8184 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 8185 $.datepicker._hideDatepicker(); 8186 $.datepicker._showDatepicker( input[ 0 ] ); 8187 } else { 8188 $.datepicker._showDatepicker( input[ 0 ] ); 8189 } 8190 return false; 8191 } ); 8192 } 8193 }, 8194 8195 /* Apply the maximum length for the date format. */ 8196 _autoSize: function( inst ) { 8197 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 8198 var findMax, max, maxI, i, 8199 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 8200 dateFormat = this._get( inst, "dateFormat" ); 8201 8202 if ( dateFormat.match( /[DM]/ ) ) { 8203 findMax = function( names ) { 8204 max = 0; 8205 maxI = 0; 8206 for ( i = 0; i < names.length; i++ ) { 8207 if ( names[ i ].length > max ) { 8208 max = names[ i ].length; 8209 maxI = i; 8210 } 8211 } 8212 return maxI; 8213 }; 8214 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 8215 "monthNames" : "monthNamesShort" ) ) ) ); 8216 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 8217 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 8218 } 8219 inst.input.attr( "size", this._formatDate( inst, date ).length ); 8220 } 8221 }, 8222 8223 /* Attach an inline date picker to a div. */ 8224 _inlineDatepicker: function( target, inst ) { 8225 var divSpan = $( target ); 8226 if ( divSpan.hasClass( this.markerClassName ) ) { 8227 return; 8228 } 8229 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 8230 $.data( target, "datepicker", inst ); 8231 this._setDate( inst, this._getDefaultDate( inst ), true ); 8232 this._updateDatepicker( inst ); 8233 this._updateAlternate( inst ); 8234 8235 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 8236 if ( inst.settings.disabled ) { 8237 this._disableDatepicker( target ); 8238 } 8239 8240 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 8241 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 8242 inst.dpDiv.css( "display", "block" ); 8243 }, 8244 8245 /* Pop-up the date picker in a "dialog" box. 8246 * @param input element - ignored 8247 * @param date string or Date - the initial date to display 8248 * @param onSelect function - the function to call when a date is selected 8249 * @param settings object - update the dialog date picker instance's settings (anonymous object) 8250 * @param pos int[2] - coordinates for the dialog's position within the screen or 8251 * event - with x/y coordinates or 8252 * leave empty for default (screen centre) 8253 * @return the manager object 8254 */ 8255 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 8256 var id, browserWidth, browserHeight, scrollX, scrollY, 8257 inst = this._dialogInst; // internal instance 8258 8259 if ( !inst ) { 8260 this.uuid += 1; 8261 id = "dp" + this.uuid; 8262 this._dialogInput = $( "<input type='text' id='" + id + 8263 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 8264 this._dialogInput.on( "keydown", this._doKeyDown ); 8265 $( "body" ).append( this._dialogInput ); 8266 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 8267 inst.settings = {}; 8268 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 8269 } 8270 datepicker_extendRemove( inst.settings, settings || {} ); 8271 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 8272 this._dialogInput.val( date ); 8273 8274 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 8275 if ( !this._pos ) { 8276 browserWidth = document.documentElement.clientWidth; 8277 browserHeight = document.documentElement.clientHeight; 8278 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 8279 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 8280 this._pos = // should use actual width/height below 8281 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 8282 } 8283 8284 // Move input on screen for focus, but hidden behind dialog 8285 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 8286 inst.settings.onSelect = onSelect; 8287 this._inDialog = true; 8288 this.dpDiv.addClass( this._dialogClass ); 8289 this._showDatepicker( this._dialogInput[ 0 ] ); 8290 if ( $.blockUI ) { 8291 $.blockUI( this.dpDiv ); 8292 } 8293 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 8294 return this; 8295 }, 8296 8297 /* Detach a datepicker from its control. 8298 * @param target element - the target input field or division or span 8299 */ 8300 _destroyDatepicker: function( target ) { 8301 var nodeName, 8302 $target = $( target ), 8303 inst = $.data( target, "datepicker" ); 8304 8305 if ( !$target.hasClass( this.markerClassName ) ) { 8306 return; 8307 } 8308 8309 nodeName = target.nodeName.toLowerCase(); 8310 $.removeData( target, "datepicker" ); 8311 if ( nodeName === "input" ) { 8312 inst.append.remove(); 8313 inst.trigger.remove(); 8314 $target.removeClass( this.markerClassName ). 8315 off( "focus", this._showDatepicker ). 8316 off( "keydown", this._doKeyDown ). 8317 off( "keypress", this._doKeyPress ). 8318 off( "keyup", this._doKeyUp ); 8319 } else if ( nodeName === "div" || nodeName === "span" ) { 8320 $target.removeClass( this.markerClassName ).empty(); 8321 } 8322 8323 $.datepicker._hideDatepicker(); 8324 if ( datepicker_instActive === inst ) { 8325 datepicker_instActive = null; 8326 this._curInst = null; 8327 } 8328 }, 8329 8330 /* Enable the date picker to a jQuery selection. 8331 * @param target element - the target input field or division or span 8332 */ 8333 _enableDatepicker: function( target ) { 8334 var nodeName, inline, 8335 $target = $( target ), 8336 inst = $.data( target, "datepicker" ); 8337 8338 if ( !$target.hasClass( this.markerClassName ) ) { 8339 return; 8340 } 8341 8342 nodeName = target.nodeName.toLowerCase(); 8343 if ( nodeName === "input" ) { 8344 target.disabled = false; 8345 inst.trigger.filter( "button" ). 8346 each( function() { 8347 this.disabled = false; 8348 } ).end(). 8349 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 8350 } else if ( nodeName === "div" || nodeName === "span" ) { 8351 inline = $target.children( "." + this._inlineClass ); 8352 inline.children().removeClass( "ui-state-disabled" ); 8353 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 8354 prop( "disabled", false ); 8355 } 8356 this._disabledInputs = $.map( this._disabledInputs, 8357 8358 // Delete entry 8359 function( value ) { 8360 return ( value === target ? null : value ); 8361 } ); 8362 }, 8363 8364 /* Disable the date picker to a jQuery selection. 8365 * @param target element - the target input field or division or span 8366 */ 8367 _disableDatepicker: function( target ) { 8368 var nodeName, inline, 8369 $target = $( target ), 8370 inst = $.data( target, "datepicker" ); 8371 8372 if ( !$target.hasClass( this.markerClassName ) ) { 8373 return; 8374 } 8375 8376 nodeName = target.nodeName.toLowerCase(); 8377 if ( nodeName === "input" ) { 8378 target.disabled = true; 8379 inst.trigger.filter( "button" ). 8380 each( function() { 8381 this.disabled = true; 8382 } ).end(). 8383 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 8384 } else if ( nodeName === "div" || nodeName === "span" ) { 8385 inline = $target.children( "." + this._inlineClass ); 8386 inline.children().addClass( "ui-state-disabled" ); 8387 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 8388 prop( "disabled", true ); 8389 } 8390 this._disabledInputs = $.map( this._disabledInputs, 8391 8392 // Delete entry 8393 function( value ) { 8394 return ( value === target ? null : value ); 8395 } ); 8396 this._disabledInputs[ this._disabledInputs.length ] = target; 8397 }, 8398 8399 /* Is the first field in a jQuery collection disabled as a datepicker? 8400 * @param target element - the target input field or division or span 8401 * @return boolean - true if disabled, false if enabled 8402 */ 8403 _isDisabledDatepicker: function( target ) { 8404 if ( !target ) { 8405 return false; 8406 } 8407 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 8408 if ( this._disabledInputs[ i ] === target ) { 8409 return true; 8410 } 8411 } 8412 return false; 8413 }, 8414 8415 /* Retrieve the instance data for the target control. 8416 * @param target element - the target input field or division or span 8417 * @return object - the associated instance data 8418 * @throws error if a jQuery problem getting data 8419 */ 8420 _getInst: function( target ) { 8421 try { 8422 return $.data( target, "datepicker" ); 8423 } catch (
vendor: 8,426 bytes, lines 8423-8664
8423err ) { 8424 throw "Missing instance data for this datepicker"; 8425 } 8426 }, 8427 8428 /* Update or retrieve the settings for a date picker attached to an input field or division. 8429 * @param target element - the target input field or division or span 8430 * @param name object - the new settings to update or 8431 * string - the name of the setting to change or retrieve, 8432 * when retrieving also "all" for all instance settings or 8433 * "defaults" for all global defaults 8434 * @param value any - the new value for the setting 8435 * (omit if above is an object or to retrieve a value) 8436 */ 8437 _optionDatepicker: function( target, name, value ) { 8438 var settings, date, minDate, maxDate, 8439 inst = this._getInst( target ); 8440 8441 if ( arguments.length === 2 && typeof name === "string" ) { 8442 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 8443 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 8444 this._get( inst, name ) ) : null ) ); 8445 } 8446 8447 settings = name || {}; 8448 if ( typeof name === "string" ) { 8449 settings = {}; 8450 settings[ name ] = value; 8451 } 8452 8453 if ( inst ) { 8454 if ( this._curInst === inst ) { 8455 this._hideDatepicker(); 8456 } 8457 8458 date = this._getDateDatepicker( target, true ); 8459 minDate = this._getMinMaxDate( inst, "min" ); 8460 maxDate = this._getMinMaxDate( inst, "max" ); 8461 datepicker_extendRemove( inst.settings, settings ); 8462 8463 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 8464 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 8465 inst.settings.minDate = this._formatDate( inst, minDate ); 8466 } 8467 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 8468 inst.settings.maxDate = this._formatDate( inst, maxDate ); 8469 } 8470 if ( "disabled" in settings ) { 8471 if ( settings.disabled ) { 8472 this._disableDatepicker( target ); 8473 } else { 8474 this._enableDatepicker( target ); 8475 } 8476 } 8477 this._attachments( $( target ), inst ); 8478 this._autoSize( inst ); 8479 this._setDate( inst, date ); 8480 this._updateAlternate( inst ); 8481 this._updateDatepicker( inst ); 8482 } 8483 }, 8484 8485 // Change method deprecated 8486 _changeDatepicker: function( target, name, value ) { 8487 this._optionDatepicker( target, name, value ); 8488 }, 8489 8490 /* Redraw the date picker attached to an input field or division. 8491 * @param target element - the target input field or division or span 8492 */ 8493 _refreshDatepicker: function( target ) { 8494 var inst = this._getInst( target ); 8495 if ( inst ) { 8496 this._updateDatepicker( inst ); 8497 } 8498 }, 8499 8500 /* Set the dates for a jQuery selection. 8501 * @param target element - the target input field or division or span 8502 * @param date Date - the new date 8503 */ 8504 _setDateDatepicker: function( target, date ) { 8505 var inst = this._getInst( target ); 8506 if ( inst ) { 8507 this._setDate( inst, date ); 8508 this._updateDatepicker( inst ); 8509 this._updateAlternate( inst ); 8510 } 8511 }, 8512 8513 /* Get the date(s) for the first entry in a jQuery selection. 8514 * @param target element - the target input field or division or span 8515 * @param noDefault boolean - true if no default date is to be used 8516 * @return Date - the current date 8517 */ 8518 _getDateDatepicker: function( target, noDefault ) { 8519 var inst = this._getInst( target ); 8520 if ( inst && !inst.inline ) { 8521 this._setDateFromField( inst, noDefault ); 8522 } 8523 return ( inst ? this._getDate( inst ) : null ); 8524 }, 8525 8526 /* Handle keystrokes. */ 8527 _doKeyDown: function( event ) { 8528 var onSelect, dateStr, sel, 8529 inst = $.datepicker._getInst( event.target ), 8530 handled = true, 8531 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 8532 8533 inst._keyEvent = true; 8534 if ( $.datepicker._datepickerShowing ) { 8535 switch ( event.keyCode ) { 8536 case 9: $.datepicker._hideDatepicker(); 8537 handled = false; 8538 break; // hide on tab out 8539 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 8540 $.datepicker._currentClass + ")", inst.dpDiv ); 8541 if ( sel[ 0 ] ) { 8542 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 8543 } 8544 8545 onSelect = $.datepicker._get( inst, "onSelect" ); 8546 if ( onSelect ) { 8547 dateStr = $.datepicker._formatDate( inst ); 8548 8549 // Trigger custom callback 8550 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 8551 } else { 8552 $.datepicker._hideDatepicker(); 8553 } 8554 8555 return false; // don't submit the form 8556 case 27: $.datepicker._hideDatepicker(); 8557 break; // hide on escape 8558 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8559 -$.datepicker._get( inst, "stepBigMonths" ) : 8560 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8561 break; // previous month/year on page up/+ ctrl 8562 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8563 +$.datepicker._get( inst, "stepBigMonths" ) : 8564 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8565 break; // next month/year on page down/+ ctrl 8566 case 35: if ( event.ctrlKey || event.metaKey ) { 8567 $.datepicker._clearDate( event.target ); 8568 } 8569 handled = event.ctrlKey || event.metaKey; 8570 break; // clear on ctrl or command +end 8571 case 36: if ( event.ctrlKey || event.metaKey ) { 8572 $.datepicker._gotoToday( event.target ); 8573 } 8574 handled = event.ctrlKey || event.metaKey; 8575 break; // current on ctrl or command +home 8576 case 37: if ( event.ctrlKey || event.metaKey ) { 8577 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 8578 } 8579 handled = event.ctrlKey || event.metaKey; 8580 8581 // -1 day on ctrl or command +left 8582 if ( event.originalEvent.altKey ) { 8583 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8584 -$.datepicker._get( inst, "stepBigMonths" ) : 8585 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8586 } 8587 8588 // next month/year on alt +left on Mac 8589 break; 8590 case 38: if ( event.ctrlKey || event.metaKey ) { 8591 $.datepicker._adjustDate( event.target, -7, "D" ); 8592 } 8593 handled = event.ctrlKey || event.metaKey; 8594 break; // -1 week on ctrl or command +up 8595 case 39: if ( event.ctrlKey || event.metaKey ) { 8596 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 8597 } 8598 handled = event.ctrlKey || event.metaKey; 8599 8600 // +1 day on ctrl or command +right 8601 if ( event.originalEvent.altKey ) { 8602 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 8603 +$.datepicker._get( inst, "stepBigMonths" ) : 8604 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 8605 } 8606 8607 // next month/year on alt +right 8608 break; 8609 case 40: if ( event.ctrlKey || event.metaKey ) { 8610 $.datepicker._adjustDate( event.target, +7, "D" ); 8611 } 8612 handled = event.ctrlKey || event.metaKey; 8613 break; // +1 week on ctrl or command +down 8614 default: handled = false; 8615 } 8616 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 8617 $.datepicker._showDatepicker( this ); 8618 } else { 8619 handled = false; 8620 } 8621 8622 if ( handled ) { 8623 event.preventDefault(); 8624 event.stopPropagation(); 8625 } 8626 }, 8627 8628 /* Filter entered characters - based on date format. */ 8629 _doKeyPress: function( event ) { 8630 var chars, chr, 8631 inst = $.datepicker._getInst( event.target ); 8632 8633 if ( $.datepicker._get( inst, "constrainInput" ) ) { 8634 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 8635 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 8636 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 8637 } 8638 }, 8639 8640 /* Synchronise manual entry and field/alternate field. */ 8641 _doKeyUp: function( event ) { 8642 var date, 8643 inst = $.datepicker._getInst( event.target ); 8644 8645 if ( inst.input.val() !== inst.lastVal ) { 8646 try { 8647 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8648 ( inst.input ? inst.input.val() : null ), 8649 $.datepicker._getFormatConfig( inst ) ); 8650 8651 if ( date ) { // only if valid 8652 $.datepicker._setDateFromField( inst ); 8653 $.datepicker._updateAlternate( inst ); 8654 $.datepicker._updateDatepicker( inst ); 8655 } 8656 } catch ( err ) { 8657 } 8658 } 8659 return true; 8660 }, 8661 8662 /* Pop-up the date picker for a given input field. 8663 * If false returned from beforeShow event handler do not show. 8664 * @param input element - the input field attached to the date picker or
vendor: 14,198 bytes, lines 8665-9074
8665 * event - if triggered by focus 8666 */ 8667 _showDatepicker: function( input ) { 8668 input = input.target || input; 8669 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 8670 input = $( "input", input.parentNode )[ 0 ]; 8671 } 8672 8673 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 8674 return; 8675 } 8676 8677 var inst, beforeShow, beforeShowSettings, isFixed, 8678 offset, showAnim, duration; 8679 8680 inst = $.datepicker._getInst( input ); 8681 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 8682 $.datepicker._curInst.dpDiv.stop( true, true ); 8683 if ( inst && $.datepicker._datepickerShowing ) { 8684 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 8685 } 8686 } 8687 8688 beforeShow = $.datepicker._get( inst, "beforeShow" ); 8689 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 8690 if ( beforeShowSettings === false ) { 8691 return; 8692 } 8693 datepicker_extendRemove( inst.settings, beforeShowSettings ); 8694 8695 inst.lastVal = null; 8696 $.datepicker._lastInput = input; 8697 $.datepicker._setDateFromField( inst ); 8698 8699 if ( $.datepicker._inDialog ) { // hide cursor 8700 input.value = ""; 8701 } 8702 if ( !$.datepicker._pos ) { // position below input 8703 $.datepicker._pos = $.datepicker._findPos( input ); 8704 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 8705 } 8706 8707 isFixed = false; 8708 $( input ).parents().each( function() { 8709 isFixed |= $( this ).css( "position" ) === "fixed"; 8710 return !isFixed; 8711 } ); 8712 8713 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 8714 $.datepicker._pos = null; 8715 8716 //to avoid flashes on Firefox 8717 inst.dpDiv.empty(); 8718 8719 // determine sizing offscreen 8720 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 8721 $.datepicker._updateDatepicker( inst ); 8722 8723 // fix width for dynamic number of date pickers 8724 // and adjust position before showing 8725 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 8726 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 8727 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 8728 left: offset.left + "px", top: offset.top + "px" } ); 8729 8730 if ( !inst.inline ) { 8731 showAnim = $.datepicker._get( inst, "showAnim" ); 8732 duration = $.datepicker._get( inst, "duration" ); 8733 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 8734 $.datepicker._datepickerShowing = true; 8735 8736 if ( $.effects && $.effects.effect[ showAnim ] ) { 8737 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 8738 } else { 8739 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 8740 } 8741 8742 if ( $.datepicker._shouldFocusInput( inst ) ) { 8743 inst.input.trigger( "focus" ); 8744 } 8745 8746 $.datepicker._curInst = inst; 8747 } 8748 }, 8749 8750 /* Generate the date picker content. */ 8751 _updateDatepicker: function( inst ) { 8752 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 8753 datepicker_instActive = inst; // for delegate hover events 8754 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 8755 this._attachHandlers( inst ); 8756 8757 var origyearshtml, 8758 numMonths = this._getNumberOfMonths( inst ), 8759 cols = numMonths[ 1 ], 8760 width = 17, 8761 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 8762 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 8763 8764 if ( activeCell.length > 0 ) { 8765 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 8766 } 8767 8768 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 8769 if ( cols > 1 ) { 8770 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 8771 } 8772 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 8773 "Class" ]( "ui-datepicker-multi" ); 8774 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 8775 "Class" ]( "ui-datepicker-rtl" ); 8776 8777 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 8778 inst.input.trigger( "focus" ); 8779 } 8780 8781 // Deffered render of the years select (to avoid flashes on Firefox) 8782 if ( inst.yearshtml ) { 8783 origyearshtml = inst.yearshtml; 8784 setTimeout( function() { 8785 8786 //assure that inst.yearshtml didn't change. 8787 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 8788 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 8789 } 8790 origyearshtml = inst.yearshtml = null; 8791 }, 0 ); 8792 } 8793 8794 if ( onUpdateDatepicker ) { 8795 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 8796 } 8797 }, 8798 8799 _shouldFocusInput: function( inst ) { 8800 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ); 8801 }, 8802 8803 /* Check positioning to remain on screen. */ 8804 _checkOffset: function( inst, offset, isFixed ) { 8805 var dpWidth = inst.dpDiv.outerWidth(), 8806 dpHeight = inst.dpDiv.outerHeight(), 8807 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8808 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8809 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 8810 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 8811 8812 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 8813 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 8814 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 8815 8816 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8817 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 8818 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 8819 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 8820 Math.abs( dpHeight + inputHeight ) : 0 ); 8821 8822 return offset; 8823 }, 8824 8825 /* Find an object's position on the screen. */ 8826 _findPos: function( obj ) { 8827 var position, 8828 inst = this._getInst( obj ), 8829 isRTL = this._get( inst, "isRTL" ); 8830 8831 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 8832 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 8833 } 8834 8835 position = $( obj ).offset(); 8836 return [ position.left, position.top ]; 8837 }, 8838 8839 /* Hide the date picker from view. 8840 * @param input element - the input field attached to the date picker 8841 */ 8842 _hideDatepicker: function( input ) { 8843 var showAnim, duration, postProcess, onClose, 8844 inst = this._curInst; 8845 8846 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 8847 return; 8848 } 8849 8850 if ( this._datepickerShowing ) { 8851 showAnim = this._get( inst, "showAnim" ); 8852 duration = this._get( inst, "duration" ); 8853 postProcess = function() { 8854 $.datepicker._tidyDialog( inst ); 8855 }; 8856 8857 if ( $.effects && ( $.effects.effect[ showAnim ] ) ) { 8858 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 8859 } else { 8860 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 8861 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 8862 } 8863 8864 if ( !showAnim ) { 8865 postProcess(); 8866 } 8867 this._datepickerShowing = false; 8868 8869 onClose = this._get( inst, "onClose" ); 8870 if ( onClose ) { 8871 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 8872 } 8873 8874 this._lastInput = null; 8875 if ( this._inDialog ) { 8876 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 8877 if ( $.blockUI ) { 8878 $.unblockUI(); 8879 $( "body" ).append( this.dpDiv ); 8880 } 8881 } 8882 this._inDialog = false; 8883 } 8884 }, 8885 8886 /* Tidy up after a dialog display. */ 8887 _tidyDialog: function( inst ) { 8888 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 8889 }, 8890 8891 /* Close date picker if clicked elsewhere. */ 8892 _checkExternalClick: function( event ) { 8893 if ( !$.datepicker._curInst ) { 8894 return; 8895 } 8896 8897 var $target = $( event.target ), 8898 inst = $.datepicker._getInst( $target[ 0 ] ); 8899 8900 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 8901 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 8902 !$target.hasClass( $.datepicker.markerClassName ) && 8903 !$target.closest( "." + $.datepicker._triggerClass ).length && 8904 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 8905 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 8906 $.datepicker._hideDatepicker(); 8907 } 8908 }, 8909 8910 /* Adjust one of the date sub-fields. */ 8911 _adjustDate: function( id, offset, period ) { 8912 var target = $( id ), 8913 inst = this._getInst( target[ 0 ] ); 8914 8915 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 8916 return; 8917 } 8918 this._adjustInstDate( inst, offset, period ); 8919 this._updateDatepicker( inst ); 8920 }, 8921 8922 /* Action for current link. */ 8923 _gotoToday: function( id ) { 8924 var date, 8925 target = $( id ), 8926 inst = this._getInst( target[ 0 ] ); 8927 8928 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 8929 inst.selectedDay = inst.currentDay; 8930 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8931 inst.drawYear = inst.selectedYear = inst.currentYear; 8932 } else { 8933 date = new Date(); 8934 inst.selectedDay = date.getDate(); 8935 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8936 inst.drawYear = inst.selectedYear = date.getFullYear(); 8937 } 8938 this._notifyChange( inst ); 8939 this._adjustDate( target ); 8940 }, 8941 8942 /* Action for selecting a new month/year. */ 8943 _selectMonthYear: function( id, select, period ) { 8944 var target = $( id ), 8945 inst = this._getInst( target[ 0 ] ); 8946 8947 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 8948 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 8949 parseInt( select.options[ select.selectedIndex ].value, 10 ); 8950 8951 this._notifyChange( inst ); 8952 this._adjustDate( target ); 8953 }, 8954 8955 /* Action for selecting a day. */ 8956 _selectDay: function( id, month, year, td ) { 8957 var inst, 8958 target = $( id ); 8959 8960 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 8961 return; 8962 } 8963 8964 inst = this._getInst( target[ 0 ] ); 8965 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 8966 inst.selectedMonth = inst.currentMonth = month; 8967 inst.selectedYear = inst.currentYear = year; 8968 this._selectDate( id, this._formatDate( inst, 8969 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 8970 }, 8971 8972 /* Erase the input field and hide the date picker. */ 8973 _clearDate: function( id ) { 8974 var target = $( id ); 8975 this._selectDate( target, "" ); 8976 }, 8977 8978 /* Update the input field with the selected date. */ 8979 _selectDate: function( id, dateStr ) { 8980 var onSelect, 8981 target = $( id ), 8982 inst = this._getInst( target[ 0 ] ); 8983 8984 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 8985 if ( inst.input ) { 8986 inst.input.val( dateStr ); 8987 } 8988 this._updateAlternate( inst ); 8989 8990 onSelect = this._get( inst, "onSelect" ); 8991 if ( onSelect ) { 8992 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 8993 } else if ( inst.input ) { 8994 inst.input.trigger( "change" ); // fire the change event 8995 } 8996 8997 if ( inst.inline ) { 8998 this._updateDatepicker( inst ); 8999 } else { 9000 this._hideDatepicker(); 9001 this._lastInput = inst.input[ 0 ]; 9002 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 9003 inst.input.trigger( "focus" ); // restore focus 9004 } 9005 this._lastInput = null; 9006 } 9007 }, 9008 9009 /* Update any alternate field to synchronise with the main field. */ 9010 _updateAlternate: function( inst ) { 9011 var altFormat, date, dateStr, 9012 altField = this._get( inst, "altField" ); 9013 9014 if ( altField ) { // update alternate field too 9015 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 9016 date = this._getDate( inst ); 9017 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 9018 $( document ).find( altField ).val( dateStr ); 9019 } 9020 }, 9021 9022 /* Set as beforeShowDay function to prevent selection of weekends. 9023 * @param date Date - the date to customise 9024 * @return [boolean, string] - is this date selectable?, what is its CSS class? 9025 */ 9026 noWeekends: function( date ) { 9027 var day = date.getDay(); 9028 return [ ( day > 0 && day < 6 ), "" ]; 9029 }, 9030 9031 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 9032 * @param date Date - the date to get the week for 9033 * @return number - the number of the week within the year that contains this date 9034 */ 9035 iso8601Week: function( date ) { 9036 var time, 9037 checkDate = new Date( date.getTime() ); 9038 9039 // Find Thursday of this week starting on Monday 9040 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 9041 9042 time = checkDate.getTime(); 9043 checkDate.setMonth( 0 ); // Compare with Jan 1 9044 checkDate.setDate( 1 ); 9045 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 9046 }, 9047 9048 /* Parse a string value into a date object. 9049 * See formatDate below for the possible formats. 9050 * 9051 * @param format string - the expected format of the date 9052 * @param value string - the date in the above format 9053 * @param settings Object - attributes include: 9054 * shortYearCutoff number - the cutoff year for determining the century (optional) 9055 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9056 * dayNames string[7] - names of the days from Sunday (optional) 9057 * monthNamesShort string[12] - abbreviated names of the months (optional) 9058 * monthNames string[12] - names of the months (optional) 9059 * @return Date - the extracted date value or null if value is blank 9060 */ 9061 parseDate: function( format, value, settings ) { 9062 if ( format == null || value == null ) { 9063 throw "Invalid arguments"; 9064 } 9065 9066 value = ( typeof value === "object" ? value.toString() : value + "" ); 9067 if ( value === "" ) { 9068 return null; 9069 } 9070 9071 var iFormat, dim, extra, 9072 iValue = 0, 9073 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 9074 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 9074-9264
9074: 9075 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 9076 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 9077 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 9078 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 9079 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 9080 year = -1, 9081 month = -1, 9082 day = -1, 9083 doy = -1, 9084 literal = false, 9085 date, 9086 9087 // Check whether a format character is doubled 9088 lookAhead = function( match ) { 9089 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 9090 if ( matches ) { 9091 iFormat++; 9092 } 9093 return matches; 9094 }, 9095 9096 // Extract a number from the string value 9097 getNumber = function( match ) { 9098 var isDoubled = lookAhead( match ), 9099 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 9100 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 9101 minSize = ( match === "y" ? size : 1 ), 9102 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 9103 num = value.substring( iValue ).match( digits ); 9104 if ( !num ) { 9105 throw "Missing number at position " + iValue; 9106 } 9107 iValue += num[ 0 ].length; 9108 return parseInt( num[ 0 ], 10 ); 9109 }, 9110 9111 // Extract a name from the string value and convert to an index 9112 getName = function( match, shortNames, longNames ) { 9113 var index = -1, 9114 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 9115 return [ [ k, v ] ]; 9116 } ).sort( function( a, b ) { 9117 return -( a[ 1 ].length - b[ 1 ].length ); 9118 } ); 9119 9120 $.each( names, function( i, pair ) { 9121 var name = pair[ 1 ]; 9122 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 9123 index = pair[ 0 ]; 9124 iValue += name.length; 9125 return false; 9126 } 9127 } ); 9128 if ( index !== -1 ) { 9129 return index + 1; 9130 } else { 9131 throw "Unknown name at position " + iValue; 9132 } 9133 }, 9134 9135 // Confirm that a literal character matches the string value 9136 checkLiteral = function() { 9137 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 9138 throw "Unexpected literal at position " + iValue; 9139 } 9140 iValue++; 9141 }; 9142 9143 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9144 if ( literal ) { 9145 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9146 literal = false; 9147 } else { 9148 checkLiteral(); 9149 } 9150 } else { 9151 switch ( format.charAt( iFormat ) ) { 9152 case "d": 9153 day = getNumber( "d" ); 9154 break; 9155 case "D": 9156 getName( "D", dayNamesShort, dayNames ); 9157 break; 9158 case "o": 9159 doy = getNumber( "o" ); 9160 break; 9161 case "m": 9162 month = getNumber( "m" ); 9163 break; 9164 case "M": 9165 month = getName( "M", monthNamesShort, monthNames ); 9166 break; 9167 case "y": 9168 year = getNumber( "y" ); 9169 break; 9170 case "@": 9171 date = new Date( getNumber( "@" ) ); 9172 year = date.getFullYear(); 9173 month = date.getMonth() + 1; 9174 day = date.getDate(); 9175 break; 9176 case "!": 9177 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 9178 year = date.getFullYear(); 9179 month = date.getMonth() + 1; 9180 day = date.getDate(); 9181 break; 9182 case "'": 9183 if ( lookAhead( "'" ) ) { 9184 checkLiteral(); 9185 } else { 9186 literal = true; 9187 } 9188 break; 9189 default: 9190 checkLiteral(); 9191 } 9192 } 9193 } 9194 9195 if ( iValue < value.length ) { 9196 extra = value.substr( iValue ); 9197 if ( !/^\s+/.test( extra ) ) { 9198 throw "Extra/unparsed characters found in date: " + extra; 9199 } 9200 } 9201 9202 if ( year === -1 ) { 9203 year = new Date().getFullYear(); 9204 } else if ( year < 100 ) { 9205 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 9206 ( year <= shortYearCutoff ? 0 : -100 ); 9207 } 9208 9209 if ( doy > -1 ) { 9210 month = 1; 9211 day = doy; 9212 do { 9213 dim = this._getDaysInMonth( year, month - 1 ); 9214 if ( day <= dim ) { 9215 break; 9216 } 9217 month++; 9218 day -= dim; 9219 } while ( true ); 9220 } 9221 9222 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 9223 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 9224 throw "Invalid date"; // E.g. 31/02/00 9225 } 9226 return date; 9227 }, 9228 9229 /* Standard date formats. */ 9230 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 9231 COOKIE: "D, dd M yy", 9232 ISO_8601: "yy-mm-dd", 9233 RFC_822: "D, d M y", 9234 RFC_850: "DD, dd-M-y", 9235 RFC_1036: "D, d M y", 9236 RFC_1123: "D, d M yy", 9237 RFC_2822: "D, d M yy", 9238 RSS: "D, d M y", // RFC 822 9239 TICKS: "!", 9240 TIMESTAMP: "@", 9241 W3C: "yy-mm-dd", // ISO 8601 9242 9243 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 9244 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 9245 9246 /* Format a date object into a string value. 9247 * The format can be combinations of the following: 9248 * d - day of month (no leading zero) 9249 * dd - day of month (two digit) 9250 * o - day of year (no leading zeros) 9251 * oo - day of year (three digit) 9252 * D - day name short 9253 * DD - day name long 9254 * m - month of year (no leading zero) 9255 * mm - month of year (two digit) 9256 * M - month name short 9257 * MM - month name long 9258 * y - year (two digit) 9259 * yy - year (four digit) 9260 * @ - Unix timestamp (ms since 01/01/1970) 9261 * ! - Windows ticks (100ns since 01/01/0001) 9262 * "..." - literal text 9263 * '' - single quote 9264 *
vendor: 6,198 bytes, lines 9265-9464
9265 * @param format string - the desired format of the date 9266 * @param date Date - the date value to format 9267 * @param settings Object - attributes include: 9268 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9269 * dayNames string[7] - names of the days from Sunday (optional) 9270 * monthNamesShort string[12] - abbreviated names of the months (optional) 9271 * monthNames string[12] - names of the months (optional) 9272 * @return string - the date in the above format 9273 */ 9274 formatDate: function( format, date, settings ) { 9275 if ( !date ) { 9276 return ""; 9277 } 9278 9279 var iFormat, 9280 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 9281 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 9282 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 9283 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 9284 9285 // Check whether a format character is doubled 9286 lookAhead = function( match ) { 9287 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 9288 if ( matches ) { 9289 iFormat++; 9290 } 9291 return matches; 9292 }, 9293 9294 // Format a number, with leading zero if necessary 9295 formatNumber = function( match, value, len ) { 9296 var num = "" + value; 9297 if ( lookAhead( match ) ) { 9298 while ( num.length < len ) { 9299 num = "0" + num; 9300 } 9301 } 9302 return num; 9303 }, 9304 9305 // Format a name, short or long as requested 9306 formatName = function( match, value, shortNames, longNames ) { 9307 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 9308 }, 9309 output = "", 9310 literal = false; 9311 9312 if ( date ) { 9313 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9314 if ( literal ) { 9315 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9316 literal = false; 9317 } else { 9318 output += format.charAt( iFormat ); 9319 } 9320 } else { 9321 switch ( format.charAt( iFormat ) ) { 9322 case "d": 9323 output += formatNumber( "d", date.getDate(), 2 ); 9324 break; 9325 case "D": 9326 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 9327 break; 9328 case "o": 9329 output += formatNumber( "o", 9330 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 9331 break; 9332 case "m": 9333 output += formatNumber( "m", date.getMonth() + 1, 2 ); 9334 break; 9335 case "M": 9336 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 9337 break; 9338 case "y": 9339 output += ( lookAhead( "y" ) ? date.getFullYear() : 9340 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 9341 break; 9342 case "@": 9343 output += date.getTime(); 9344 break; 9345 case "!": 9346 output += date.getTime() * 10000 + this._ticksTo1970; 9347 break; 9348 case "'": 9349 if ( lookAhead( "'" ) ) { 9350 output += "'"; 9351 } else { 9352 literal = true; 9353 } 9354 break; 9355 default: 9356 output += format.charAt( iFormat ); 9357 } 9358 } 9359 } 9360 } 9361 return output; 9362 }, 9363 9364 /* Extract all possible characters from the date format. */ 9365 _possibleChars: function( format ) { 9366 var iFormat, 9367 chars = "", 9368 literal = false, 9369 9370 // Check whether a format character is doubled 9371 lookAhead = function( match ) { 9372 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 9373 if ( matches ) { 9374 iFormat++; 9375 } 9376 return matches; 9377 }; 9378 9379 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 9380 if ( literal ) { 9381 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 9382 literal = false; 9383 } else { 9384 chars += format.charAt( iFormat ); 9385 } 9386 } else { 9387 switch ( format.charAt( iFormat ) ) { 9388 case "d": case "m": case "y": case "@": 9389 chars += "0123456789"; 9390 break; 9391 case "D": case "M": 9392 return null; // Accept anything 9393 case "'": 9394 if ( lookAhead( "'" ) ) { 9395 chars += "'"; 9396 } else { 9397 literal = true; 9398 } 9399 break; 9400 default: 9401 chars += format.charAt( iFormat ); 9402 } 9403 } 9404 } 9405 return chars; 9406 }, 9407 9408 /* Get a setting value, defaulting if necessary. */ 9409 _get: function( inst, name ) { 9410 return inst.settings[ name ] !== undefined ? 9411 inst.settings[ name ] : this._defaults[ name ]; 9412 }, 9413 9414 /* Parse existing date and initialise date picker. */ 9415 _setDateFromField: function( inst, noDefault ) { 9416 if ( inst.input.val() === inst.lastVal ) { 9417 return; 9418 } 9419 9420 var dateFormat = this._get( inst, "dateFormat" ), 9421 dates = inst.lastVal = inst.input ? inst.input.val() : null, 9422 defaultDate = this._getDefaultDate( inst ), 9423 date = defaultDate, 9424 settings = this._getFormatConfig( inst ); 9425 9426 try { 9427 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 9428 } catch ( event ) { 9429 dates = ( noDefault ? "" : dates ); 9430 } 9431 inst.selectedDay = date.getDate(); 9432 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9433 inst.drawYear = inst.selectedYear = date.getFullYear(); 9434 inst.currentDay = ( dates ? date.getDate() : 0 ); 9435 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 9436 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 9437 this._adjustInstDate( inst ); 9438 }, 9439 9440 /* Retrieve the default date shown on opening. */ 9441 _getDefaultDate: function( inst ) { 9442 return this._restrictMinMax( inst, 9443 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 9444 }, 9445 9446 /* A date may be specified as an exact value or a relative one. */ 9447 _determineDate: function( inst, date, defaultDate ) { 9448 var offsetNumeric = function( offset ) { 9449 var date = new Date(); 9450 date.setDate( date.getDate() + offset ); 9451 return date; 9452 }, 9453 offsetString = function( offset ) { 9454 try { 9455 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 9456 offset, $.datepicker._getFormatConfig( inst ) ); 9457 } catch ( e ) { 9458 9459 // Ignore 9460 } 9461 9462 var date = ( offset.toLowerCase().match( /^c/ ) ? 9463 $.datepicker._getDate( inst ) : null ) || new Date(), 9464 year = date.getFullYear(),
vendor: 5,359 bytes, lines 9465-9603
9465 month = date.getMonth(), 9466 day = date.getDate(), 9467 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 9468 matches = pattern.exec( offset ); 9469 9470 while ( matches ) { 9471 switch ( matches[ 2 ] || "d" ) { 9472 case "d" : case "D" : 9473 day += parseInt( matches[ 1 ], 10 ); break; 9474 case "w" : case "W" : 9475 day += parseInt( matches[ 1 ], 10 ) * 7; break; 9476 case "m" : case "M" : 9477 month += parseInt( matches[ 1 ], 10 ); 9478 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 9479 break; 9480 case "y": case "Y" : 9481 year += parseInt( matches[ 1 ], 10 ); 9482 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 9483 break; 9484 } 9485 matches = pattern.exec( offset ); 9486 } 9487 return new Date( year, month, day ); 9488 }, 9489 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 9490 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 9491 9492 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 9493 if ( newDate ) { 9494 newDate.setHours( 0 ); 9495 newDate.setMinutes( 0 ); 9496 newDate.setSeconds( 0 ); 9497 newDate.setMilliseconds( 0 ); 9498 } 9499 return this._daylightSavingAdjust( newDate ); 9500 }, 9501 9502 /* Handle switch to/from daylight saving. 9503 * Hours may be non-zero on daylight saving cut-over: 9504 * > 12 when midnight changeover, but then cannot generate 9505 * midnight datetime, so jump to 1AM, otherwise reset. 9506 * @param date (Date) the date to check 9507 * @return (Date) the corrected date 9508 */ 9509 _daylightSavingAdjust: function( date ) { 9510 if ( !date ) { 9511 return null; 9512 } 9513 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 9514 return date; 9515 }, 9516 9517 /* Set the date(s) directly. */ 9518 _setDate: function( inst, date, noChange ) { 9519 var clear = !date, 9520 origMonth = inst.selectedMonth, 9521 origYear = inst.selectedYear, 9522 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 9523 9524 inst.selectedDay = inst.currentDay = newDate.getDate(); 9525 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 9526 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 9527 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 9528 this._notifyChange( inst ); 9529 } 9530 this._adjustInstDate( inst ); 9531 if ( inst.input ) { 9532 inst.input.val( clear ? "" : this._formatDate( inst ) ); 9533 } 9534 }, 9535 9536 /* Retrieve the date(s) directly. */ 9537 _getDate: function( inst ) { 9538 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 9539 this._daylightSavingAdjust( new Date( 9540 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 9541 return startDate; 9542 }, 9543 9544 /* Attach the onxxx handlers. These are declared statically so 9545 * they work with static code transformers like Caja. 9546 */ 9547 _attachHandlers: function( inst ) { 9548 var stepMonths = this._get( inst, "stepMonths" ), 9549 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 9550 inst.dpDiv.find( "[data-handler]" ).map( function() { 9551 var handler = { 9552 prev: function() { 9553 $.datepicker._adjustDate( id, -stepMonths, "M" ); 9554 }, 9555 next: function() { 9556 $.datepicker._adjustDate( id, +stepMonths, "M" ); 9557 }, 9558 hide: function() { 9559 $.datepicker._hideDatepicker(); 9560 }, 9561 today: function() { 9562 $.datepicker._gotoToday( id ); 9563 }, 9564 selectDay: function() { 9565 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 9566 return false; 9567 }, 9568 selectMonth: function() { 9569 $.datepicker._selectMonthYear( id, this, "M" ); 9570 return false; 9571 }, 9572 selectYear: function() { 9573 $.datepicker._selectMonthYear( id, this, "Y" ); 9574 return false; 9575 } 9576 }; 9577 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 9578 } ); 9579 }, 9580 9581 /* Generate the HTML for the current state of the date picker. */ 9582 _generateHTML: function( inst ) { 9583 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 9584 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 9585 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 9586 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 9587 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 9588 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 9589 tempDate = new Date(), 9590 today = this._daylightSavingAdjust( 9591 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 9592 isRTL = this._get( inst, "isRTL" ), 9593 showButtonPanel = this._get( inst, "showButtonPanel" ), 9594 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 9595 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 9596 numMonths = this._getNumberOfMonths( inst ), 9597 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 9598 stepMonths = this._get( inst, "stepMonths" ), 9599 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 9600 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 9601 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 9602 minDate = this._getMinMaxDate( inst, "min" ), 9603 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,259 bytes, lines 9604-10118
9604 drawMonth = inst.drawMonth - showCurrentAtPos, 9605 drawYear = inst.drawYear; 9606 9607 if ( drawMonth < 0 ) { 9608 drawMonth += 12; 9609 drawYear--; 9610 } 9611 if ( maxDate ) { 9612 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 9613 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 9614 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 9615 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 9616 drawMonth--; 9617 if ( drawMonth < 0 ) { 9618 drawMonth = 11; 9619 drawYear--; 9620 } 9621 } 9622 } 9623 inst.drawMonth = drawMonth; 9624 inst.drawYear = drawYear; 9625 9626 prevText = this._get( inst, "prevText" ); 9627 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 9628 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 9629 this._getFormatConfig( inst ) ) ); 9630 9631 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 9632 prev = $( "<a>" ) 9633 .attr( { 9634 "class": "ui-datepicker-prev ui-corner-all", 9635 "data-handler": "prev", 9636 "data-event": "click", 9637 title: prevText 9638 } ) 9639 .append( 9640 $( "<span>" ) 9641 .addClass( "ui-icon ui-icon-circle-triangle-" + 9642 ( isRTL ? "e" : "w" ) ) 9643 .text( prevText ) 9644 )[ 0 ].outerHTML; 9645 } else if ( hideIfNoPrevNext ) { 9646 prev = ""; 9647 } else { 9648 prev = $( "<a>" ) 9649 .attr( { 9650 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 9651 title: prevText 9652 } ) 9653 .append( 9654 $( "<span>" ) 9655 .addClass( "ui-icon ui-icon-circle-triangle-" + 9656 ( isRTL ? "e" : "w" ) ) 9657 .text( prevText ) 9658 )[ 0 ].outerHTML; 9659 } 9660 9661 nextText = this._get( inst, "nextText" ); 9662 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 9663 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 9664 this._getFormatConfig( inst ) ) ); 9665 9666 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 9667 next = $( "<a>" ) 9668 .attr( { 9669 "class": "ui-datepicker-next ui-corner-all", 9670 "data-handler": "next", 9671 "data-event": "click", 9672 title: nextText 9673 } ) 9674 .append( 9675 $( "<span>" ) 9676 .addClass( "ui-icon ui-icon-circle-triangle-" + 9677 ( isRTL ? "w" : "e" ) ) 9678 .text( nextText ) 9679 )[ 0 ].outerHTML; 9680 } else if ( hideIfNoPrevNext ) { 9681 next = ""; 9682 } else { 9683 next = $( "<a>" ) 9684 .attr( { 9685 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 9686 title: nextText 9687 } ) 9688 .append( 9689 $( "<span>" ) 9690 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 9691 ( isRTL ? "w" : "e" ) ) 9692 .text( nextText ) 9693 )[ 0 ].outerHTML; 9694 } 9695 9696 currentText = this._get( inst, "currentText" ); 9697 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 9698 currentText = ( !navigationAsDateFormat ? currentText : 9699 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 9700 9701 controls = ""; 9702 if ( !inst.inline ) { 9703 controls = $( "<button>" ) 9704 .attr( { 9705 type: "button", 9706 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 9707 "data-handler": "hide", 9708 "data-event": "click" 9709 } ) 9710 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 9711 } 9712 9713 buttonPanel = ""; 9714 if ( showButtonPanel ) { 9715 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 9716 .append( isRTL ? controls : "" ) 9717 .append( this._isInRange( inst, gotoDate ) ? 9718 $( "<button>" ) 9719 .attr( { 9720 type: "button", 9721 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 9722 "data-handler": "today", 9723 "data-event": "click" 9724 } ) 9725 .text( currentText ) : 9726 "" ) 9727 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 9728 } 9729 9730 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 9731 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 9732 9733 showWeek = this._get( inst, "showWeek" ); 9734 dayNames = this._get( inst, "dayNames" ); 9735 dayNamesMin = this._get( inst, "dayNamesMin" ); 9736 monthNames = this._get( inst, "monthNames" ); 9737 monthNamesShort = this._get( inst, "monthNamesShort" ); 9738 beforeShowDay = this._get( inst, "beforeShowDay" ); 9739 showOtherMonths = this._get( inst, "showOtherMonths" ); 9740 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 9741 defaultDate = this._getDefaultDate( inst ); 9742 html = ""; 9743 9744 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 9745 group = ""; 9746 this.maxRows = 4; 9747 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 9748 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 9749 cornerClass = " ui-corner-all"; 9750 calender = ""; 9751 if ( isMultiMonth ) { 9752 calender += "<div class='ui-datepicker-group"; 9753 if ( numMonths[ 1 ] > 1 ) { 9754 switch ( col ) { 9755 case 0: calender += " ui-datepicker-group-first"; 9756 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 9757 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 9758 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 9759 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 9760 } 9761 } 9762 calender += "'>"; 9763 } 9764 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 9765 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 9766 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 9767 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 9768 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 9769 "</div><table class='ui-datepicker-calendar'><thead>" + 9770 "<tr>"; 9771 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 9772 for ( dow = 0; dow < 7; dow++ ) { // days of the week 9773 day = ( dow + firstDay ) % 7; 9774 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 9775 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 9776 } 9777 calender += thead + "</tr></thead><tbody>"; 9778 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 9779 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 9780 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 9781 } 9782 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 9783 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 9784 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 9785 this.maxRows = numRows; 9786 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 9787 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 9788 calender += "<tr>"; 9789 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 9790 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 9791 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 9792 daySettings = ( beforeShowDay ? 9793 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 9794 otherMonth = ( printDate.getMonth() !== drawMonth ); 9795 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 9796 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 9797 tbody += "<td class='" + 9798 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 9799 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 9800 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 9801 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 9802 9803 // or defaultDate is current printedDate and defaultDate is selectedDate 9804 " " + this._dayOverClass : "" ) + // highlight selected day 9805 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 9806 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 9807 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 9808 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 9809 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 9810 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 9811 ( otherMonth && !showOtherMonths ? " " : // display for other months 9812 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 9813 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 9814 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 9815 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 9816 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 9817 "' data-date='" + printDate.getDate() + // store date as data 9818 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 9819 printDate.setDate( printDate.getDate() + 1 ); 9820 printDate = this._daylightSavingAdjust( printDate ); 9821 } 9822 calender += tbody + "</tr>"; 9823 } 9824 drawMonth++; 9825 if ( drawMonth > 11 ) { 9826 drawMonth = 0; 9827 drawYear++; 9828 } 9829 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 9830 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 9831 group += calender; 9832 } 9833 html += group; 9834 } 9835 html += buttonPanel; 9836 inst._keyEvent = false; 9837 return html; 9838 }, 9839 9840 /* Generate the month and year header. */ 9841 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 9842 secondary, monthNames, monthNamesShort ) { 9843 9844 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 9845 changeMonth = this._get( inst, "changeMonth" ), 9846 changeYear = this._get( inst, "changeYear" ), 9847 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 9848 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 9849 selectYearLabel = this._get( inst, "selectYearLabel" ), 9850 html = "<div class='ui-datepicker-title'>", 9851 monthHtml = ""; 9852 9853 // Month selection 9854 if ( secondary || !changeMonth ) { 9855 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 9856 } else { 9857 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 9858 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 9859 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 9860 for ( month = 0; month < 12; month++ ) { 9861 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 9862 monthHtml += "<option value='" + month + "'" + 9863 ( month === drawMonth ? " selected='selected'" : "" ) + 9864 ">" + monthNamesShort[ month ] + "</option>"; 9865 } 9866 } 9867 monthHtml += "</select>"; 9868 } 9869 9870 if ( !showMonthAfterYear ) { 9871 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 9872 } 9873 9874 // Year selection 9875 if ( !inst.yearshtml ) { 9876 inst.yearshtml = ""; 9877 if ( secondary || !changeYear ) { 9878 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 9879 } else { 9880 9881 // determine range of years to display 9882 years = this._get( inst, "yearRange" ).split( ":" ); 9883 thisYear = new Date().getFullYear(); 9884 determineYear = function( value ) { 9885 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 9886 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 9887 parseInt( value, 10 ) ) ); 9888 return ( isNaN( year ) ? thisYear : year ); 9889 }; 9890 year = determineYear( years[ 0 ] ); 9891 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 9892 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 9893 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 9894 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 9895 for ( ; year <= endYear; year++ ) { 9896 inst.yearshtml += "<option value='" + year + "'" + 9897 ( year === drawYear ? " selected='selected'" : "" ) + 9898 ">" + year + "</option>"; 9899 } 9900 inst.yearshtml += "</select>"; 9901 9902 html += inst.yearshtml; 9903 inst.yearshtml = null; 9904 } 9905 } 9906 9907 html += this._get( inst, "yearSuffix" ); 9908 if ( showMonthAfterYear ) { 9909 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 9910 } 9911 html += "</div>"; // Close datepicker_header 9912 return html; 9913 }, 9914 9915 /* Adjust one of the date sub-fields. */ 9916 _adjustInstDate: function( inst, offset, period ) { 9917 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 9918 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 9919 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 9920 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 9921 9922 inst.selectedDay = date.getDate(); 9923 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9924 inst.drawYear = inst.selectedYear = date.getFullYear(); 9925 if ( period === "M" || period === "Y" ) { 9926 this._notifyChange( inst ); 9927 } 9928 }, 9929 9930 /* Ensure a date is within any min/max bounds. */ 9931 _restrictMinMax: function( inst, date ) { 9932 var minDate = this._getMinMaxDate( inst, "min" ), 9933 maxDate = this._getMinMaxDate( inst, "max" ), 9934 newDate = ( minDate && date < minDate ? minDate : date ); 9935 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 9936 }, 9937 9938 /* Notify change of month/year. */ 9939 _notifyChange: function( inst ) { 9940 var onChange = this._get( inst, "onChangeMonthYear" ); 9941 if ( onChange ) { 9942 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 9943 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 9944 } 9945 }, 9946 9947 /* Determine the number of months to show. */ 9948 _getNumberOfMonths: function( inst ) { 9949 var numMonths = this._get( inst, "numberOfMonths" ); 9950 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 9951 }, 9952 9953 /* Determine the current maximum date - ensure no time components are set. */ 9954 _getMinMaxDate: function( inst, minMax ) { 9955 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 9956 }, 9957 9958 /* Find the number of days in a given month. */ 9959 _getDaysInMonth: function( year, month ) { 9960 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 9961 }, 9962 9963 /* Find the day of the week of the first of a month. */ 9964 _getFirstDayOfMonth: function( year, month ) { 9965 return new Date( year, month, 1 ).getDay(); 9966 }, 9967 9968 /* Determines if we should allow a "next/prev" month display change. */ 9969 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 9970 var numMonths = this._getNumberOfMonths( inst ), 9971 date = this._daylightSavingAdjust( new Date( curYear, 9972 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 9973 9974 if ( offset < 0 ) { 9975 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 9976 } 9977 return this._isInRange( inst, date ); 9978 }, 9979 9980 /* Is the given date in the accepted range? */ 9981 _isInRange: function( inst, date ) { 9982 var yearSplit, currentYear, 9983 minDate = this._getMinMaxDate( inst, "min" ), 9984 maxDate = this._getMinMaxDate( inst, "max" ), 9985 minYear = null, 9986 maxYear = null, 9987 years = this._get( inst, "yearRange" ); 9988 if ( years ) { 9989 yearSplit = years.split( ":" ); 9990 currentYear = new Date().getFullYear(); 9991 minYear = parseInt( yearSplit[ 0 ], 10 ); 9992 maxYear = parseInt( yearSplit[ 1 ], 10 ); 9993 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 9994 minYear += currentYear; 9995 } 9996 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 9997 maxYear += currentYear; 9998 } 9999 } 10000 10001 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 10002 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 10003 ( !minYear || date.getFullYear() >= minYear ) && 10004 ( !maxYear || date.getFullYear() <= maxYear ) ); 10005 }, 10006 10007 /* Provide the configuration settings for formatting/parsing. */ 10008 _getFormatConfig: function( inst ) { 10009 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 10010 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 10011 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 10012 return { shortYearCutoff: shortYearCutoff, 10013 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 10014 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 10015 }, 10016 10017 /* Format the given date for display. */ 10018 _formatDate: function( inst, day, month, year ) { 10019 if ( !day ) { 10020 inst.currentDay = inst.selectedDay; 10021 inst.currentMonth = inst.selectedMonth; 10022 inst.currentYear = inst.selectedYear; 10023 } 10024 var date = ( day ? ( typeof day === "object" ? day : 10025 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 10026 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 10027 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 10028 } 10029} ); 10030 10031/* 10032 * Bind hover events for datepicker elements. 10033 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 10034 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 10035 */ 10036function datepicker_bindHover( dpDiv ) { 10037 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 10038 return dpDiv.on( "mouseout", selector, function() { 10039 $( this ).removeClass( "ui-state-hover" ); 10040 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 10041 $( this ).removeClass( "ui-datepicker-prev-hover" ); 10042 } 10043 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 10044 $( this ).removeClass( "ui-datepicker-next-hover" ); 10045 } 10046 } ) 10047 .on( "mouseover", selector, datepicker_handleMouseover ); 10048} 10049 10050function datepicker_handleMouseover() { 10051 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 10052 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 10053 $( this ).addClass( "ui-state-hover" ); 10054 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 10055 $( this ).addClass( "ui-datepicker-prev-hover" ); 10056 } 10057 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 10058 $( this ).addClass( "ui-datepicker-next-hover" ); 10059 } 10060 } 10061} 10062 10063/* jQuery extend now ignores nulls! */ 10064function datepicker_extendRemove( target, props ) { 10065 $.extend( target, props ); 10066 for ( var name in props ) { 10067 if ( props[ name ] == null ) { 10068 target[ name ] = props[ name ]; 10069 } 10070 } 10071 return target; 10072} 10073 10074/* Invoke the datepicker functionality. 10075 @param options string - a command, optionally followed by additional parameters or 10076 Object - settings for attaching new datepicker functionality 10077 @return jQuery object */ 10078$.fn.datepicker = function( options ) { 10079 10080 /* Verify an empty collection wasn't passed - Fixes #6976 */ 10081 if ( !this.length ) { 10082 return this; 10083 } 10084 10085 /* Initialise the date picker. */ 10086 if ( !$.datepicker.initialized ) { 10087 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 10088 $.datepicker.initialized = true; 10089 } 10090 10091 /* Append datepicker main container to body if not exist. */ 10092 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 10093 $( "body" ).append( $.datepicker.dpDiv ); 10094 } 10095 10096 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 10097 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 10098 return $.datepicker[ "_" + options + "Datepicker" ]. 10099 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 10100 } 10101 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 10102 return $.datepicker[ "_" + options + "Datepicker" ]. 10103 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 10104 } 10105 return this.each( function() { 10106 if ( typeof options === "string" ) { 10107 $.datepicker[ "_" + options + "Datepicker" ] 10108 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 10109 } else { 10110 $.datepicker._attachDatepicker( this, options ); 10111 } 10112 } ); 10113}; 10114 10115$.datepicker = new Datepicker(); // singleton instance 10116$.datepicker.initialized = false; 10117$.datepicker.uuid = new Date().getTime(); 10118$.datepicker.version = "1.14.
vendor: 4,726 bytes, lines 10118-10308
101181"; 10119 10120return $.datepicker; 10121 10122} ); 10123 10124 10125 10126/*! 10127 * jQuery UI Mouse 1.14.1 10128 * https://jqueryui.com 10129 * 10130 * Copyright OpenJS Foundation and other contributors 10131 * Released under the MIT license. 10132 * https://jquery.org/license 10133 */ 10134 10135//>>label: Mouse 10136//>>group: Widgets 10137//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 10138//>>docs: https://api.jqueryui.com/mouse/ 10139 10140( function( factory ) { 10141 "use strict"; 10142 10143 if ( typeof define === "function" && define.amd ) { 10144 10145 // AMD. Register as an anonymous module. 10146 define( [ 10147 "jquery", 10148 "../version", 10149 "../widget" 10150 ], factory ); 10151 } else { 10152 10153 // Browser globals 10154 factory( jQuery ); 10155 } 10156} )( function( $ ) { 10157"use strict"; 10158 10159var mouseHandled = false; 10160$( document ).on( "mouseup", function() { 10161 mouseHandled = false; 10162} ); 10163 10164return $.widget( "ui.mouse", { 10165 version: "1.14.1", 10166 options: { 10167 cancel: "input, textarea, button, select, option", 10168 distance: 1, 10169 delay: 0 10170 }, 10171 _mouseInit: function() { 10172 var that = this; 10173 10174 this.element 10175 .on( "mousedown." + this.widgetName, function( event ) { 10176 return that._mouseDown( event ); 10177 } ) 10178 .on( "click." + this.widgetName, function( event ) { 10179 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 10180 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 10181 event.stopImmediatePropagation(); 10182 return false; 10183 } 10184 } ); 10185 10186 this.started = false; 10187 }, 10188 10189 // TODO: make sure destroying one instance of mouse doesn't mess with 10190 // other instances of mouse 10191 _mouseDestroy: function() { 10192 this.element.off( "." + this.widgetName ); 10193 if ( this._mouseMoveDelegate ) { 10194 this.document 10195 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10196 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10197 } 10198 }, 10199 10200 _mouseDown: function( event ) { 10201 10202 // don't let more than one widget handle mouseStart 10203 if ( mouseHandled ) { 10204 return; 10205 } 10206 10207 this._mouseMoved = false; 10208 10209 // We may have missed mouseup (out of window) 10210 if ( this._mouseStarted ) { 10211 this._mouseUp( event ); 10212 } 10213 10214 this._mouseDownEvent = event; 10215 10216 var that = this, 10217 btnIsLeft = event.which === 1, 10218 elIsCancel = typeof this.options.cancel === "string" ? 10219 $( event.target ).closest( this.options.cancel ).length : 10220 false; 10221 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 10222 return true; 10223 } 10224 10225 this.mouseDelayMet = !this.options.delay; 10226 if ( !this.mouseDelayMet ) { 10227 this._mouseDelayTimer = setTimeout( function() { 10228 that.mouseDelayMet = true; 10229 }, this.options.delay ); 10230 } 10231 10232 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 10233 this._mouseStarted = ( this._mouseStart( event ) !== false ); 10234 if ( !this._mouseStarted ) { 10235 event.preventDefault(); 10236 return true; 10237 } 10238 } 10239 10240 // Click event may never have fired (Gecko & Opera) 10241 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 10242 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 10243 } 10244 10245 // These delegates are required to keep context 10246 this._mouseMoveDelegate = function( event ) { 10247 return that._mouseMove( event ); 10248 }; 10249 this._mouseUpDelegate = function( event ) { 10250 return that._mouseUp( event ); 10251 }; 10252 10253 this.document 10254 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10255 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10256 10257 event.preventDefault(); 10258 10259 mouseHandled = true; 10260 return true; 10261 }, 10262 10263 _mouseMove: function( event ) { 10264 10265 // Only check for mouseups outside the document if you've moved inside the document 10266 // at least once. 10267 if ( this._mouseMoved && !event.which ) { 10268 10269 // Support: Safari <=8 - 9 10270 // Safari sets which to 0 if you press any of the following keys 10271 // during a drag (#14461) 10272 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 10273 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 10274 this.ignoreMissingWhich = true; 10275 } else if ( !this.ignoreMissingWhich ) { 10276 return this._mouseUp( event ); 10277 } 10278 } 10279 10280 if ( event.which || event.button ) { 10281 this._mouseMoved = true; 10282 } 10283 10284 if ( this._mouseStarted ) { 10285 this._mouseDrag( event ); 10286 return event.preventDefault(); 10287 } 10288 10289 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 10290 this._mouseStarted = 10291 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 10292 if ( this._mouseStarted ) { 10293 this._mouseDrag( event ); 10294 } else { 10295 this._mouseUp( event ); 10296 } 10297 } 10298 10299 return !this._mouseStarted; 10300 }, 10301 10302 _mouseUp: function( event ) { 10303 this.document 10304 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 10305 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 10306 10307 if ( this._mouseStarted ) { 10308 this._mouseStarted = false;
10309 10310 if ( event.target === this._mouseDownEvent.target ) { 10311 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 10312 } 10313 10314 this._mouseStop( event ); 10315 } 10316 10317 if ( this._mouseDelayTimer ) { 10318 clearTimeout( this._mouseDelayTimer ); 10319 delete this._mouseDelayTimer; 10320 } 10321 10322 this.ignoreMissingWhich = false; 10323 mouseHandled = false; 10324 event.preventDefault(); 10325 }, 10326 10327 _mouseDistanceMet: function( event ) { 10328 return ( Math.max( 10329 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 10330 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 10331 ) >= this.options.distance 10332 ); 10333 }, 10334 10335 _mouseDelayMet: function( /* event */ ) { 10336 return this.mouseDelayMet; 10337 }, 10338 10339 // These are placeholder methods, to be overriden by extending plugin 10340 _mouseStart: function( /* event */ ) {}, 10341 _mouseDrag: function( /* event */ ) {}, 10342 _mouseStop: function( /* event */ ) {}, 10343 _mouseCapture: function( /* event */ ) { 10344 return true; 10345 } 10346} ); 10347 10348} ); 10349 10350 10351 10352 10353 10354 10355 10356/*! 10357 * jQuery UI Draggable 1.14.1 10358 * https://jqueryui.com 10359 * 10360 * Copyright OpenJS Foundation and other contributors 10361 * Released under the MIT license. 10362 * https://jquery.org/license 10363 */ 10364 10365//>>label: Draggable 10366//>>group: Interactions 10367//>>description: Enables dragging functionality for any element. 10368//>>docs: https://api.jqueryui.com/draggable/ 10369//>>demos: https://jqueryui.com/draggable/ 10370//>>css.structure: ../../themes/base/draggable.css 10371 10372( function( factory ) { 10373 "use strict"; 10374 10375 if ( typeof define === "function" && define.amd ) { 10376 10377 // AMD. Register as an anonymous module. 10378 define( [ 10379 "jquery", 10380 "./mouse", 10381 "../data", 10382 "../plugin", 10383 "../scroll-parent", 10384 "../version", 10385 "../widget" 10386 ], factory ); 10387 } else { 10388 10389 // Browser globals 10390 factory( jQuery ); 10391 } 10392} )( function( $ ) { 10393"use strict"; 10394 10395$.widget( "ui.draggable", $.ui.mouse, { 10396 version: "1.14.1
vendor: 13,254 bytes, lines 10396-10889
10396", 10397 widgetEventPrefix: "drag", 10398 options: { 10399 addClasses: true, 10400 appendTo: "parent", 10401 axis: false, 10402 connectToSortable: false, 10403 containment: false, 10404 cursor: "auto", 10405 cursorAt: false, 10406 grid: false, 10407 handle: false, 10408 helper: "original", 10409 iframeFix: false, 10410 opacity: false, 10411 refreshPositions: false, 10412 revert: false, 10413 revertDuration: 500, 10414 scope: "default", 10415 scroll: true, 10416 scrollSensitivity: 20, 10417 scrollSpeed: 20, 10418 snap: false, 10419 snapMode: "both", 10420 snapTolerance: 20, 10421 stack: false, 10422 zIndex: false, 10423 10424 // Callbacks 10425 drag: null, 10426 start: null, 10427 stop: null 10428 }, 10429 _create: function() { 10430 10431 if ( this.options.helper === "original" ) { 10432 this._setPositionRelative(); 10433 } 10434 if ( this.options.addClasses ) { 10435 this._addClass( "ui-draggable" ); 10436 } 10437 this._setHandleClassName(); 10438 10439 this._mouseInit(); 10440 }, 10441 10442 _setOption: function( key, value ) { 10443 this._super( key, value ); 10444 if ( key === "handle" ) { 10445 this._removeHandleClassName(); 10446 this._setHandleClassName(); 10447 } 10448 }, 10449 10450 _destroy: function() { 10451 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 10452 this.destroyOnClear = true; 10453 return; 10454 } 10455 this._removeHandleClassName(); 10456 this._mouseDestroy(); 10457 }, 10458 10459 _mouseCapture: function( event ) { 10460 var o = this.options; 10461 10462 // Among others, prevent a drag on a resizable-handle 10463 if ( this.helper || o.disabled || 10464 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 10465 return false; 10466 } 10467 10468 //Quit if we're not on a valid handle 10469 this.handle = this._getHandle( event ); 10470 if ( !this.handle ) { 10471 return false; 10472 } 10473 10474 this._blurActiveElement( event ); 10475 10476 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 10477 10478 return true; 10479 10480 }, 10481 10482 _blockFrames: function( selector ) { 10483 this.iframeBlocks = this.document.find( selector ).map( function() { 10484 var iframe = $( this ); 10485 10486 return $( "<div>" ) 10487 .css( "position", "absolute" ) 10488 .appendTo( iframe.parent() ) 10489 .outerWidth( iframe.outerWidth() ) 10490 .outerHeight( iframe.outerHeight() ) 10491 .offset( iframe.offset() )[ 0 ]; 10492 } ); 10493 }, 10494 10495 _unblockFrames: function() { 10496 if ( this.iframeBlocks ) { 10497 this.iframeBlocks.remove(); 10498 delete this.iframeBlocks; 10499 } 10500 }, 10501 10502 _blurActiveElement: function( event ) { 10503 var activeElement = this.document[ 0 ].activeElement, 10504 target = $( event.target ); 10505 10506 // Don't blur if the event occurred on an element that is within 10507 // the currently focused element 10508 // See #10527, #12472 10509 if ( target.closest( activeElement ).length ) { 10510 return; 10511 } 10512 10513 // Blur any element that currently has focus, see #4261 10514 $( activeElement ).trigger( "blur" ); 10515 }, 10516 10517 _mouseStart: function( event ) { 10518 10519 var o = this.options; 10520 10521 //Create and append the visible helper 10522 this.helper = this._createHelper( event ); 10523 10524 this._addClass( this.helper, "ui-draggable-dragging" ); 10525 10526 //Cache the helper size 10527 this._cacheHelperProportions(); 10528 10529 //If ddmanager is used for droppables, set the global draggable 10530 if ( $.ui.ddmanager ) { 10531 $.ui.ddmanager.current = this; 10532 } 10533 10534 /* 10535 * - Position generation - 10536 * This block generates everything position related - it's the core of draggables. 10537 */ 10538 10539 //Cache the margins of the original element 10540 this._cacheMargins(); 10541 10542 //Store the helper's css position 10543 this.cssPosition = this.helper.css( "position" ); 10544 this.scrollParent = this.helper.scrollParent( true ); 10545 this.offsetParent = this.helper.offsetParent(); 10546 this.hasFixedAncestor = this.helper.parents().filter( function() { 10547 return $( this ).css( "position" ) === "fixed"; 10548 } ).length > 0; 10549 10550 //The element's absolute position on the page minus margins 10551 this.positionAbs = this.element.offset(); 10552 this._refreshOffsets( event ); 10553 10554 //Generate the original position 10555 this.originalPosition = this.position = this._generatePosition( event, false ); 10556 this.originalPageX = event.pageX; 10557 this.originalPageY = event.pageY; 10558 10559 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 10560 if ( o.cursorAt ) { 10561 this._adjustOffsetFromHelper( o.cursorAt ); 10562 } 10563 10564 //Set a containment if given in the options 10565 this._setContainment(); 10566 10567 //Trigger event + callbacks 10568 if ( this._trigger( "start", event ) === false ) { 10569 this._clear(); 10570 return false; 10571 } 10572 10573 //Recache the helper size 10574 this._cacheHelperProportions(); 10575 10576 //Prepare the droppable offsets 10577 if ( $.ui.ddmanager && !o.dropBehaviour ) { 10578 $.ui.ddmanager.prepareOffsets( this, event ); 10579 } 10580 10581 // Execute the drag once - this causes the helper not to be visible before getting its 10582 // correct position 10583 this._mouseDrag( event, true ); 10584 10585 // If the ddmanager is used for droppables, inform the manager that dragging has started 10586 // (see #5003) 10587 if ( $.ui.ddmanager ) { 10588 $.ui.ddmanager.dragStart( this, event ); 10589 } 10590 10591 return true; 10592 }, 10593 10594 _refreshOffsets: function( event ) { 10595 this.offset = { 10596 top: this.positionAbs.top - this.margins.top, 10597 left: this.positionAbs.left - this.margins.left, 10598 scroll: false, 10599 parent: this._getParentOffset(), 10600 relative: this._getRelativeOffset() 10601 }; 10602 10603 this.offset.click = { 10604 left: event.pageX - this.offset.left, 10605 top: event.pageY - this.offset.top 10606 }; 10607 }, 10608 10609 _mouseDrag: function( event, noPropagation ) { 10610 10611 // reset any necessary cached properties (see #5009) 10612 if ( this.hasFixedAncestor ) { 10613 this.offset.parent = this._getParentOffset(); 10614 } 10615 10616 //Compute the helpers position 10617 this.position = this._generatePosition( event, true ); 10618 this.positionAbs = this._convertPositionTo( "absolute" ); 10619 10620 //Call plugins and callbacks and use the resulting position if something is returned 10621 if ( !noPropagation ) { 10622 var ui = this._uiHash(); 10623 if ( this._trigger( "drag", event, ui ) === false ) { 10624 this._mouseUp( new $.Event( "mouseup", event ) ); 10625 return false; 10626 } 10627 this.position = ui.position; 10628 } 10629 10630 this.helper[ 0 ].style.left = this.position.left + "px"; 10631 this.helper[ 0 ].style.top = this.position.top + "px"; 10632 10633 if ( $.ui.ddmanager ) { 10634 $.ui.ddmanager.drag( this, event ); 10635 } 10636 10637 return false; 10638 }, 10639 10640 _mouseStop: function( event ) { 10641 10642 //If we are using droppables, inform the manager about the drop 10643 var that = this, 10644 dropped = false; 10645 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 10646 dropped = $.ui.ddmanager.drop( this, event ); 10647 } 10648 10649 //if a drop comes from outside (a sortable) 10650 if ( this.dropped ) { 10651 dropped = this.dropped; 10652 this.dropped = false; 10653 } 10654 10655 if ( ( this.options.revert === "invalid" && !dropped ) || 10656 ( this.options.revert === "valid" && dropped ) || 10657 this.options.revert === true || ( typeof this.options.revert === "function" && 10658 this.options.revert.call( this.element, dropped ) ) 10659 ) { 10660 $( this.helper ).animate( 10661 this.originalPosition, 10662 parseInt( this.options.revertDuration, 10 ), 10663 function() { 10664 if ( that._trigger( "stop", event ) !== false ) { 10665 that._clear(); 10666 } 10667 } 10668 ); 10669 } else { 10670 if ( this._trigger( "stop", event ) !== false ) { 10671 this._clear(); 10672 } 10673 } 10674 10675 return false; 10676 }, 10677 10678 _mouseUp: function( event ) { 10679 this._unblockFrames(); 10680 10681 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 10682 // (see #5003) 10683 if ( $.ui.ddmanager ) { 10684 $.ui.ddmanager.dragStop( this, event ); 10685 } 10686 10687 // Only need to focus if the event occurred on the draggable itself, see #10527 10688 if ( this.handleElement.is( event.target ) ) { 10689 10690 // The interaction is over; whether or not the click resulted in a drag, 10691 // focus the element 10692 this.element.trigger( "focus" ); 10693 } 10694 10695 return $.ui.mouse.prototype._mouseUp.call( this, event ); 10696 }, 10697 10698 cancel: function() { 10699 10700 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 10701 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 10702 } else { 10703 this._clear(); 10704 } 10705 10706 return this; 10707 10708 }, 10709 10710 _getHandle: function( event ) { 10711 return this.options.handle ? 10712 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 10713 true; 10714 }, 10715 10716 _setHandleClassName: function() { 10717 this.handleElement = this.options.handle ? 10718 this.element.find( this.options.handle ) : this.element; 10719 this._addClass( this.handleElement, "ui-draggable-handle" ); 10720 }, 10721 10722 _removeHandleClassName: function() { 10723 this._removeClass( this.handleElement, "ui-draggable-handle" ); 10724 }, 10725 10726 _createHelper: function( event ) { 10727 10728 var o = this.options, 10729 helperIsFunction = typeof o.helper === "function", 10730 helper = helperIsFunction ? 10731 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 10732 ( o.helper === "clone" ? 10733 this.element.clone().removeAttr( "id" ) : 10734 this.element ); 10735 10736 if ( !helper.parents( "body" ).length ) { 10737 helper.appendTo( ( o.appendTo === "parent" ? 10738 this.element[ 0 ].parentNode : 10739 o.appendTo ) ); 10740 } 10741 10742 // https://bugs.jqueryui.com/ticket/9446 10743 // a helper function can return the original element 10744 // which wouldn't have been set to relative in _create 10745 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 10746 this._setPositionRelative(); 10747 } 10748 10749 if ( helper[ 0 ] !== this.element[ 0 ] && 10750 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 10751 helper.css( "position", "absolute" ); 10752 } 10753 10754 return helper; 10755 10756 }, 10757 10758 _setPositionRelative: function() { 10759 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 10760 this.element[ 0 ].style.position = "relative"; 10761 } 10762 }, 10763 10764 _adjustOffsetFromHelper: function( obj ) { 10765 if ( typeof obj === "string" ) { 10766 obj = obj.split( " " ); 10767 } 10768 if ( Array.isArray( obj ) ) { 10769 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 10770 } 10771 if ( "left" in obj ) { 10772 this.offset.click.left = obj.left + this.margins.left; 10773 } 10774 if ( "right" in obj ) { 10775 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 10776 } 10777 if ( "top" in obj ) { 10778 this.offset.click.top = obj.top + this.margins.top; 10779 } 10780 if ( "bottom" in obj ) { 10781 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 10782 } 10783 }, 10784 10785 _isRootNode: function( element ) { 10786 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 10787 }, 10788 10789 _getParentOffset: function() { 10790 10791 //Get the offsetParent and cache its position 10792 var po = this.offsetParent.offset(), 10793 document = this.document[ 0 ]; 10794 10795 // This is a special case where we need to modify a offset calculated on start, since the 10796 // following happened: 10797 // 1. The position of the helper is absolute, so it's position is calculated based on the 10798 // next positioned parent 10799 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 10800 // the document, which means that the scroll is included in the initial calculation of the 10801 // offset of the parent, and never recalculated upon drag 10802 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 10803 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 10804 po.left += this.scrollParent.scrollLeft(); 10805 po.top += this.scrollParent.scrollTop(); 10806 } 10807 10808 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 10809 po = { top: 0, left: 0 }; 10810 } 10811 10812 return { 10813 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 10814 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 10815 }; 10816 10817 }, 10818 10819 _getRelativeOffset: function() { 10820 if ( this.cssPosition !== "relative" ) { 10821 return { top: 0, left: 0 }; 10822 } 10823 10824 var p = this.element.position(), 10825 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10826 10827 return { 10828 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 10829 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 10830 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 10831 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 10832 }; 10833 10834 }, 10835 10836 _cacheMargins: function() { 10837 this.margins = { 10838 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 10839 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 10840 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 10841 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 10842 }; 10843 }, 10844 10845 _cacheHelperProportions: function() { 10846 this.helperProportions = { 10847 width: this.helper.outerWidth(), 10848 height: this.helper.outerHeight() 10849 }; 10850 }, 10851 10852 _setContainment: function() { 10853 10854 var isUserScrollable, c, ce, 10855 o = this.options, 10856 document = this.document[ 0 ]; 10857 10858 this.relativeContainer = null; 10859 10860 if ( !o.containment ) { 10861 this.containment = null; 10862 return; 10863 } 10864 10865 if ( o.containment === "window" ) { 10866 this.containment = [ 10867 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 10868 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 10869 $( window ).scrollLeft() + $( window ).width() - 10870 this.helperProportions.width - this.margins.left, 10871 $( window ).scrollTop() + 10872 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 10873 this.helperProportions.height - this.margins.top 10874 ]; 10875 return; 10876 } 10877 10878 if ( o.containment === "document" ) { 10879 this.containment = [ 10880 0, 10881 0, 10882 $( document ).width() - this.helperProportions.width - this.margins.left, 10883 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 10884 this.helperProportions.height - this.margins.top 10885 ]; 10886 return; 10887 } 10888 10889 if ( o.containment.constructor === Array ) {
vendor: 10,369 bytes, lines 10890-11236
10890 this.containment = o.containment; 10891 return; 10892 } 10893 10894 if ( o.containment === "parent" ) { 10895 o.containment = this.helper[ 0 ].parentNode; 10896 } 10897 10898 c = $( o.containment ); 10899 ce = c[ 0 ]; 10900 10901 if ( !ce ) { 10902 return; 10903 } 10904 10905 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 10906 10907 this.containment = [ 10908 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 10909 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 10910 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 10911 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 10912 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 10913 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 10914 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 10915 this.helperProportions.width - 10916 this.margins.left - 10917 this.margins.right, 10918 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 10919 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 10920 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 10921 this.helperProportions.height - 10922 this.margins.top - 10923 this.margins.bottom 10924 ]; 10925 this.relativeContainer = c; 10926 }, 10927 10928 _convertPositionTo: function( d, pos ) { 10929 10930 if ( !pos ) { 10931 pos = this.position; 10932 } 10933 10934 var mod = d === "absolute" ? 1 : -1, 10935 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10936 10937 return { 10938 top: ( 10939 10940 // The absolute mouse position 10941 pos.top + 10942 10943 // Only for relative positioned nodes: Relative offset from element to offset parent 10944 this.offset.relative.top * mod + 10945 10946 // The offsetParent's offset without borders (offset + border) 10947 this.offset.parent.top * mod - 10948 ( ( this.cssPosition === "fixed" ? 10949 -this.offset.scroll.top : 10950 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 10951 ), 10952 left: ( 10953 10954 // The absolute mouse position 10955 pos.left + 10956 10957 // Only for relative positioned nodes: Relative offset from element to offset parent 10958 this.offset.relative.left * mod + 10959 10960 // The offsetParent's offset without borders (offset + border) 10961 this.offset.parent.left * mod - 10962 ( ( this.cssPosition === "fixed" ? 10963 -this.offset.scroll.left : 10964 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 10965 ) 10966 }; 10967 10968 }, 10969 10970 _generatePosition: function( event, constrainPosition ) { 10971 10972 var containment, co, top, left, 10973 o = this.options, 10974 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 10975 pageX = event.pageX, 10976 pageY = event.pageY; 10977 10978 // Cache the scroll 10979 if ( !scrollIsRootNode || !this.offset.scroll ) { 10980 this.offset.scroll = { 10981 top: this.scrollParent.scrollTop(), 10982 left: this.scrollParent.scrollLeft() 10983 }; 10984 } 10985 10986 /* 10987 * - Position constraining - 10988 * Constrain the position to a mix of grid, containment. 10989 */ 10990 10991 // If we are not dragging yet, we won't check for options 10992 if ( constrainPosition ) { 10993 if ( this.containment ) { 10994 if ( this.relativeContainer ) { 10995 co = this.relativeContainer.offset(); 10996 containment = [ 10997 this.containment[ 0 ] + co.left, 10998 this.containment[ 1 ] + co.top, 10999 this.containment[ 2 ] + co.left, 11000 this.containment[ 3 ] + co.top 11001 ]; 11002 } else { 11003 containment = this.containment; 11004 } 11005 11006 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 11007 pageX = containment[ 0 ] + this.offset.click.left; 11008 } 11009 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 11010 pageY = containment[ 1 ] + this.offset.click.top; 11011 } 11012 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 11013 pageX = containment[ 2 ] + this.offset.click.left; 11014 } 11015 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 11016 pageY = containment[ 3 ] + this.offset.click.top; 11017 } 11018 } 11019 11020 if ( o.grid ) { 11021 11022 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 11023 // argument errors in IE (see ticket #6950) 11024 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 11025 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 11026 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 11027 top - this.offset.click.top > containment[ 3 ] ) ? 11028 top : 11029 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 11030 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 11031 11032 left = o.grid[ 0 ] ? this.originalPageX + 11033 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 11034 this.originalPageX; 11035 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 11036 left - this.offset.click.left > containment[ 2 ] ) ? 11037 left : 11038 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 11039 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 11040 } 11041 11042 if ( o.axis === "y" ) { 11043 pageX = this.originalPageX; 11044 } 11045 11046 if ( o.axis === "x" ) { 11047 pageY = this.originalPageY; 11048 } 11049 } 11050 11051 return { 11052 top: ( 11053 11054 // The absolute mouse position 11055 pageY - 11056 11057 // Click offset (relative to the element) 11058 this.offset.click.top - 11059 11060 // Only for relative positioned nodes: Relative offset from element to offset parent 11061 this.offset.relative.top - 11062 11063 // The offsetParent's offset without borders (offset + border) 11064 this.offset.parent.top + 11065 ( this.cssPosition === "fixed" ? 11066 -this.offset.scroll.top : 11067 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 11068 ), 11069 left: ( 11070 11071 // The absolute mouse position 11072 pageX - 11073 11074 // Click offset (relative to the element) 11075 this.offset.click.left - 11076 11077 // Only for relative positioned nodes: Relative offset from element to offset parent 11078 this.offset.relative.left - 11079 11080 // The offsetParent's offset without borders (offset + border) 11081 this.offset.parent.left + 11082 ( this.cssPosition === "fixed" ? 11083 -this.offset.scroll.left : 11084 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 11085 ) 11086 }; 11087 11088 }, 11089 11090 _clear: function() { 11091 this._removeClass( this.helper, "ui-draggable-dragging" ); 11092 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 11093 this.helper.remove(); 11094 } 11095 this.helper = null; 11096 this.cancelHelperRemoval = false; 11097 if ( this.destroyOnClear ) { 11098 this.destroy(); 11099 } 11100 }, 11101 11102 // From now on bulk stuff - mainly helpers 11103 11104 _trigger: function( type, event, ui ) { 11105 ui = ui || this._uiHash(); 11106 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 11107 11108 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 11109 if ( /^(drag|start|stop)/.test( type ) ) { 11110 this.positionAbs = this._convertPositionTo( "absolute" ); 11111 ui.offset = this.positionAbs; 11112 } 11113 return $.Widget.prototype._trigger.call( this, type, event, ui ); 11114 }, 11115 11116 plugins: {}, 11117 11118 _uiHash: function() { 11119 return { 11120 helper: this.helper, 11121 position: this.position, 11122 originalPosition: this.originalPosition, 11123 offset: this.positionAbs 11124 }; 11125 } 11126 11127} ); 11128 11129$.ui.plugin.add( "draggable", "connectToSortable", { 11130 start: function( event, ui, draggable ) { 11131 var uiSortable = $.extend( {}, ui, { 11132 item: draggable.element 11133 } ); 11134 11135 draggable.sortables = []; 11136 $( draggable.options.connectToSortable ).each( function() { 11137 var sortable = $( this ).sortable( "instance" ); 11138 11139 if ( sortable && !sortable.options.disabled ) { 11140 draggable.sortables.push( sortable ); 11141 11142 // RefreshPositions is called at drag start to refresh the containerCache 11143 // which is used in drag. This ensures it's initialized and synchronized 11144 // with any changes that might have happened on the page since initialization. 11145 sortable.refreshPositions(); 11146 sortable._trigger( "activate", event, uiSortable ); 11147 } 11148 } ); 11149 }, 11150 stop: function( event, ui, draggable ) { 11151 var uiSortable = $.extend( {}, ui, { 11152 item: draggable.element 11153 } ); 11154 11155 draggable.cancelHelperRemoval = false; 11156 11157 $.each( draggable.sortables, function() { 11158 var sortable = this; 11159 11160 if ( sortable.isOver ) { 11161 sortable.isOver = 0; 11162 11163 // Allow this sortable to handle removing the helper 11164 draggable.cancelHelperRemoval = true; 11165 sortable.cancelHelperRemoval = false; 11166 11167 // Use _storedCSS To restore properties in the sortable, 11168 // as this also handles revert (#9675) since the draggable 11169 // may have modified them in unexpected ways (#8809) 11170 sortable._storedCSS = { 11171 position: sortable.placeholder.css( "position" ), 11172 top: sortable.placeholder.css( "top" ), 11173 left: sortable.placeholder.css( "left" ) 11174 }; 11175 11176 sortable._mouseStop( event ); 11177 11178 // Once drag has ended, the sortable should return to using 11179 // its original helper, not the shared helper from draggable 11180 sortable.options.helper = sortable.options._helper; 11181 } else { 11182 11183 // Prevent this Sortable from removing the helper. 11184 // However, don't set the draggable to remove the helper 11185 // either as another connected Sortable may yet handle the removal. 11186 sortable.cancelHelperRemoval = true; 11187 11188 sortable._trigger( "deactivate", event, uiSortable ); 11189 } 11190 } ); 11191 }, 11192 drag: function( event, ui, draggable ) { 11193 $.each( draggable.sortables, function() { 11194 var innermostIntersecting = false, 11195 sortable = this; 11196 11197 // Copy over variables that sortable's _intersectsWith uses 11198 sortable.positionAbs = draggable.positionAbs; 11199 sortable.helperProportions = draggable.helperProportions; 11200 sortable.offset.click = draggable.offset.click; 11201 11202 if ( sortable._intersectsWith( sortable.containerCache ) ) { 11203 innermostIntersecting = true; 11204 11205 $.each( draggable.sortables, function() { 11206 11207 // Copy over variables that sortable's _intersectsWith uses 11208 this.positionAbs = draggable.positionAbs; 11209 this.helperProportions = draggable.helperProportions; 11210 this.offset.click = draggable.offset.click; 11211 11212 if ( this !== sortable && 11213 this._intersectsWith( this.containerCache ) && 11214 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 11215 innermostIntersecting = false; 11216 } 11217 11218 return innermostIntersecting; 11219 } ); 11220 } 11221 11222 if ( innermostIntersecting ) { 11223 11224 // If it intersects, we use a little isOver variable and set it once, 11225 // so that the move-in stuff gets fired only once. 11226 if ( !sortable.isOver ) { 11227 sortable.isOver = 1; 11228 11229 // Store draggable's parent in case we need to reappend to it later. 11230 draggable._parent = ui.helper.parent(); 11231 11232 sortable.currentItem = ui.helper 11233 .appendTo( sortable.element ) 11234 .data( "ui-sortable-item", true ); 11235 11236 // Store helper option to later restore it
vendor: 10,978 bytes, lines 11237-11609
11237 sortable.options._helper = sortable.options.helper; 11238 11239 sortable.options.helper = function() { 11240 return ui.helper[ 0 ]; 11241 }; 11242 11243 // Fire the start events of the sortable with our passed browser event, 11244 // and our own helper (so it doesn't create a new one) 11245 event.target = sortable.currentItem[ 0 ]; 11246 sortable._mouseCapture( event, true ); 11247 sortable._mouseStart( event, true, true ); 11248 11249 // Because the browser event is way off the new appended portlet, 11250 // modify necessary variables to reflect the changes 11251 sortable.offset.click.top = draggable.offset.click.top; 11252 sortable.offset.click.left = draggable.offset.click.left; 11253 sortable.offset.parent.left -= draggable.offset.parent.left - 11254 sortable.offset.parent.left; 11255 sortable.offset.parent.top -= draggable.offset.parent.top - 11256 sortable.offset.parent.top; 11257 11258 draggable._trigger( "toSortable", event ); 11259 11260 // Inform draggable that the helper is in a valid drop zone, 11261 // used solely in the revert option to handle "valid/invalid". 11262 draggable.dropped = sortable.element; 11263 11264 // Need to refreshPositions of all sortables in the case that 11265 // adding to one sortable changes the location of the other sortables (#9675) 11266 $.each( draggable.sortables, function() { 11267 this.refreshPositions(); 11268 } ); 11269 11270 // Hack so receive/update callbacks work (mostly) 11271 draggable.currentItem = draggable.element; 11272 sortable.fromOutside = draggable; 11273 } 11274 11275 if ( sortable.currentItem ) { 11276 sortable._mouseDrag( event ); 11277 11278 // Copy the sortable's position because the draggable's can potentially reflect 11279 // a relative position, while sortable is always absolute, which the dragged 11280 // element has now become. (#8809) 11281 ui.position = sortable.position; 11282 } 11283 } else { 11284 11285 // If it doesn't intersect with the sortable, and it intersected before, 11286 // we fake the drag stop of the sortable, but make sure it doesn't remove 11287 // the helper by using cancelHelperRemoval. 11288 if ( sortable.isOver ) { 11289 11290 sortable.isOver = 0; 11291 sortable.cancelHelperRemoval = true; 11292 11293 // Calling sortable's mouseStop would trigger a revert, 11294 // so revert must be temporarily false until after mouseStop is called. 11295 sortable.options._revert = sortable.options.revert; 11296 sortable.options.revert = false; 11297 11298 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 11299 sortable._mouseStop( event, true ); 11300 11301 // Restore sortable behaviors that were modfied 11302 // when the draggable entered the sortable area (#9481) 11303 sortable.options.revert = sortable.options._revert; 11304 sortable.options.helper = sortable.options._helper; 11305 11306 if ( sortable.placeholder ) { 11307 sortable.placeholder.remove(); 11308 } 11309 11310 // Restore and recalculate the draggable's offset considering the sortable 11311 // may have modified them in unexpected ways. (#8809, #10669) 11312 ui.helper.appendTo( draggable._parent ); 11313 draggable._refreshOffsets( event ); 11314 ui.position = draggable._generatePosition( event, true ); 11315 11316 draggable._trigger( "fromSortable", event ); 11317 11318 // Inform draggable that the helper is no longer in a valid drop zone 11319 draggable.dropped = false; 11320 11321 // Need to refreshPositions of all sortables just in case removing 11322 // from one sortable changes the location of other sortables (#9675) 11323 $.each( draggable.sortables, function() { 11324 this.refreshPositions(); 11325 } ); 11326 } 11327 } 11328 } ); 11329 } 11330} ); 11331 11332$.ui.plugin.add( "draggable", "cursor", { 11333 start: function( event, ui, instance ) { 11334 var t = $( "body" ), 11335 o = instance.options; 11336 11337 if ( t.css( "cursor" ) ) { 11338 o._cursor = t.css( "cursor" ); 11339 } 11340 t.css( "cursor", o.cursor ); 11341 }, 11342 stop: function( event, ui, instance ) { 11343 var o = instance.options; 11344 if ( o._cursor ) { 11345 $( "body" ).css( "cursor", o._cursor ); 11346 } 11347 } 11348} ); 11349 11350$.ui.plugin.add( "draggable", "opacity", { 11351 start: function( event, ui, instance ) { 11352 var t = $( ui.helper ), 11353 o = instance.options; 11354 if ( t.css( "opacity" ) ) { 11355 o._opacity = t.css( "opacity" ); 11356 } 11357 t.css( "opacity", o.opacity ); 11358 }, 11359 stop: function( event, ui, instance ) { 11360 var o = instance.options; 11361 if ( o._opacity ) { 11362 $( ui.helper ).css( "opacity", o._opacity ); 11363 } 11364 } 11365} ); 11366 11367$.ui.plugin.add( "draggable", "scroll", { 11368 start: function( event, ui, i ) { 11369 if ( !i.scrollParentNotHidden ) { 11370 i.scrollParentNotHidden = i.helper.scrollParent( false ); 11371 } 11372 11373 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 11374 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 11375 i.overflowOffset = i.scrollParentNotHidden.offset(); 11376 } 11377 }, 11378 drag: function( event, ui, i ) { 11379 11380 var o = i.options, 11381 scrolled = false, 11382 scrollParent = i.scrollParentNotHidden[ 0 ], 11383 document = i.document[ 0 ]; 11384 11385 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 11386 if ( !o.axis || o.axis !== "x" ) { 11387 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 11388 o.scrollSensitivity ) { 11389 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 11390 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 11391 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 11392 } 11393 } 11394 11395 if ( !o.axis || o.axis !== "y" ) { 11396 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 11397 o.scrollSensitivity ) { 11398 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 11399 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 11400 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 11401 } 11402 } 11403 11404 } else { 11405 11406 if ( !o.axis || o.axis !== "x" ) { 11407 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 11408 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 11409 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 11410 o.scrollSensitivity ) { 11411 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 11412 } 11413 } 11414 11415 if ( !o.axis || o.axis !== "y" ) { 11416 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 11417 scrolled = $( document ).scrollLeft( 11418 $( document ).scrollLeft() - o.scrollSpeed 11419 ); 11420 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 11421 o.scrollSensitivity ) { 11422 scrolled = $( document ).scrollLeft( 11423 $( document ).scrollLeft() + o.scrollSpeed 11424 ); 11425 } 11426 } 11427 11428 } 11429 11430 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 11431 $.ui.ddmanager.prepareOffsets( i, event ); 11432 } 11433 11434 } 11435} ); 11436 11437$.ui.plugin.add( "draggable", "snap", { 11438 start: function( event, ui, i ) { 11439 11440 var o = i.options; 11441 11442 i.snapElements = []; 11443 11444 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 11445 .each( function() { 11446 var $t = $( this ), 11447 $o = $t.offset(); 11448 if ( this !== i.element[ 0 ] ) { 11449 i.snapElements.push( { 11450 item: this, 11451 width: $t.outerWidth(), height: $t.outerHeight(), 11452 top: $o.top, left: $o.left 11453 } ); 11454 } 11455 } ); 11456 11457 }, 11458 drag: function( event, ui, inst ) { 11459 11460 var ts, bs, ls, rs, l, r, t, b, i, first, 11461 o = inst.options, 11462 d = o.snapTolerance, 11463 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 11464 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 11465 11466 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 11467 11468 l = inst.snapElements[ i ].left - inst.margins.left; 11469 r = l + inst.snapElements[ i ].width; 11470 t = inst.snapElements[ i ].top - inst.margins.top; 11471 b = t + inst.snapElements[ i ].height; 11472 11473 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 11474 !$.contains( inst.snapElements[ i ].item.ownerDocument, 11475 inst.snapElements[ i ].item ) ) { 11476 if ( inst.snapElements[ i ].snapping ) { 11477 if ( inst.options.snap.release ) { 11478 inst.options.snap.release.call( 11479 inst.element, 11480 event, 11481 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 11482 ); 11483 } 11484 } 11485 inst.snapElements[ i ].snapping = false; 11486 continue; 11487 } 11488 11489 if ( o.snapMode !== "inner" ) { 11490 ts = Math.abs( t - y2 ) <= d; 11491 bs = Math.abs( b - y1 ) <= d; 11492 ls = Math.abs( l - x2 ) <= d; 11493 rs = Math.abs( r - x1 ) <= d; 11494 if ( ts ) { 11495 ui.position.top = inst._convertPositionTo( "relative", { 11496 top: t - inst.helperProportions.height, 11497 left: 0 11498 } ).top; 11499 } 11500 if ( bs ) { 11501 ui.position.top = inst._convertPositionTo( "relative", { 11502 top: b, 11503 left: 0 11504 } ).top; 11505 } 11506 if ( ls ) { 11507 ui.position.left = inst._convertPositionTo( "relative", { 11508 top: 0, 11509 left: l - inst.helperProportions.width 11510 } ).left; 11511 } 11512 if ( rs ) { 11513 ui.position.left = inst._convertPositionTo( "relative", { 11514 top: 0, 11515 left: r 11516 } ).left; 11517 } 11518 } 11519 11520 first = ( ts || bs || ls || rs ); 11521 11522 if ( o.snapMode !== "outer" ) { 11523 ts = Math.abs( t - y1 ) <= d; 11524 bs = Math.abs( b - y2 ) <= d; 11525 ls = Math.abs( l - x1 ) <= d; 11526 rs = Math.abs( r - x2 ) <= d; 11527 if ( ts ) { 11528 ui.position.top = inst._convertPositionTo( "relative", { 11529 top: t, 11530 left: 0 11531 } ).top; 11532 } 11533 if ( bs ) { 11534 ui.position.top = inst._convertPositionTo( "relative", { 11535 top: b - inst.helperProportions.height, 11536 left: 0 11537 } ).top; 11538 } 11539 if ( ls ) { 11540 ui.position.left = inst._convertPositionTo( "relative", { 11541 top: 0, 11542 left: l 11543 } ).left; 11544 } 11545 if ( rs ) { 11546 ui.position.left = inst._convertPositionTo( "relative", { 11547 top: 0, 11548 left: r - inst.helperProportions.width 11549 } ).left; 11550 } 11551 } 11552 11553 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 11554 if ( inst.options.snap.snap ) { 11555 inst.options.snap.snap.call( 11556 inst.element, 11557 event, 11558 $.extend( inst._uiHash(), { 11559 snapItem: inst.snapElements[ i ].item 11560 } ) ); 11561 } 11562 } 11563 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 11564 11565 } 11566 11567 } 11568} ); 11569 11570$.ui.plugin.add( "draggable", "stack", { 11571 start: function( event, ui, instance ) { 11572 var min, 11573 o = instance.options, 11574 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 11575 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 11576 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 11577 } ); 11578 11579 if ( !group.length ) { 11580 return; 11581 } 11582 11583 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 11584 $( group ).each( function( i ) { 11585 $( this ).css( "zIndex", min + i ); 11586 } ); 11587 this.css( "zIndex", ( min + group.length ) ); 11588 } 11589} ); 11590 11591$.ui.plugin.add( "draggable", "zIndex", { 11592 start: function( event, ui, instance ) { 11593 var t = $( ui.helper ), 11594 o = instance.options; 11595 11596 if ( t.css( "zIndex" ) ) { 11597 o._zIndex = t.css( "zIndex" ); 11598 } 11599 t.css( "zIndex", o.zIndex ); 11600 }, 11601 stop: function( event, ui, instance ) { 11602 var o = instance.options; 11603 11604 if ( o._zIndex ) { 11605 $( ui.helper ).css( "zIndex", o._zIndex ); 11606 } 11607 } 11608} ); 11609
11610return $.ui.draggable; 11611 11612} ); 11613 11614 11615 11616 11617 11618 11619/*! 11620 * jQuery UI Resizable 1.14.1 11621 * https://jqueryui.com 11622 * 11623 * Copyright OpenJS Foundation and other contributors 11624 * Released under the MIT license. 11625 * https://jquery.org/license 11626 */ 11627 11628//>>label: Resizable 11629//>>group: Interactions 11630//>>description: Enables resize functionality for any element. 11631//>>docs: https://api.jqueryui.com/resizable/ 11632//>>demos: https://jqueryui.com/resizable/ 11633//>>css.structure: ../../themes/base/core.css 11634//>>css.structure: ../../themes/base/resizable.css 11635//>>css.theme: ../../themes/base/theme.css 11636 11637( function( factory ) { 11638 "use strict"; 11639 11640 if ( typeof define === "function" && define.amd ) { 11641 11642 // AMD. Register as an anonymous module. 11643 define( [ 11644 "jquery", 11645 "./mouse", 11646 "../disable-selection", 11647 "../plugin", 11648 "../version", 11649 "../widget" 11650 ], factory ); 11651 } else { 11652 11653 // Browser globals 11654 factory( jQuery ); 11655 } 11656} )( function( $ ) { 11657"use strict"; 11658 11659$.widget( "ui.resizable", $.ui.mouse, { 11660 version: "1.14.1", 11661 widgetEventPrefix: "resize", 11662 options: { 11663 alsoResize: false, 11664 animate: false, 11665 animateDuration: "slow", 11666 animateEasing: "swing", 11667 aspectRatio: false, 11668 autoHide: false, 11669 classes: { 11670 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 11671 }, 11672 containment: false, 11673 ghost: false, 11674 grid: false, 11675 handles: "e,s,se", 11676 helper: false, 11677 maxHeight: null, 11678 maxWidth: null, 11679 minHeight: 10, 11680 minWidth: 10, 11681 11682 // See #7960 11683 zIndex: 90, 11684 11685 // Callbacks 11686 resize: null, 11687 start: null, 11688 stop: null 11689 }, 11690 11691 _num: function( value ) { 11692 return parseFloat( value ) || 0; 11693 }, 11694 11695 _isNumber: function( value ) { 11696 return !isNaN( parseFloat( value ) ); 11697 }, 11698 11699 _hasScroll: function( el, a ) { 11700 11701 var scroll, 11702 has = false, 11703 overflow = $( el ).css( "overflow" ); 11704 11705 if ( overflow === "hidden" ) { 11706 return false;
11707 } 11708 if ( overflow === "scroll" ) { 11709 return true; 11710 } 11711 11712 scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop"; 11713 11714 if ( el[ scroll ] > 0 ) { 11715 return true; 11716 } 11717 11718 // TODO: determine which cases actually cause this to happen 11719 // if the element doesn't have the scroll set, see if it's possible to 11720 // set the scroll 11721 try { 11722 el[ scroll ] = 1; 11723 has = ( el[ scroll ] > 0 ); 11724 el[ scroll ] = 0; 11725 } catch (
vendor: 29,862 bytes, lines 11725-12890
11725e ) { 11726 11727 // `el` might be a string, then setting `scroll` will throw 11728 // an error in strict mode; ignore it. 11729 } 11730 return has; 11731 }, 11732 11733 _create: function() { 11734 11735 var margins, 11736 o = this.options, 11737 that = this; 11738 this._addClass( "ui-resizable" ); 11739 11740 $.extend( this, { 11741 _aspectRatio: !!( o.aspectRatio ), 11742 aspectRatio: o.aspectRatio, 11743 originalElement: this.element, 11744 _proportionallyResizeElements: [], 11745 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 11746 } ); 11747 11748 // Wrap the element if it cannot hold child nodes 11749 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 11750 11751 this.element.wrap( 11752 $( "<div class='ui-wrapper'></div>" ).css( { 11753 overflow: "hidden", 11754 position: this.element.css( "position" ), 11755 width: this.element.outerWidth(), 11756 height: this.element.outerHeight(), 11757 top: this.element.css( "top" ), 11758 left: this.element.css( "left" ) 11759 } ) 11760 ); 11761 11762 this.element = this.element.parent().data( 11763 "ui-resizable", this.element.resizable( "instance" ) 11764 ); 11765 11766 this.elementIsWrapper = true; 11767 11768 margins = { 11769 marginTop: this.originalElement.css( "marginTop" ), 11770 marginRight: this.originalElement.css( "marginRight" ), 11771 marginBottom: this.originalElement.css( "marginBottom" ), 11772 marginLeft: this.originalElement.css( "marginLeft" ) 11773 }; 11774 11775 this.element.css( margins ); 11776 11777 // Support: Safari 11778 // Prevent Safari textarea resize 11779 this.originalResizeStyle = this.originalElement.css( "resize" ); 11780 this.originalElement.css( "resize", "none" ); 11781 11782 this._proportionallyResizeElements.push( this.originalElement.css( { 11783 position: "static", 11784 zoom: 1, 11785 display: "block" 11786 } ) ); 11787 11788 this._proportionallyResize(); 11789 } 11790 11791 this._setupHandles(); 11792 11793 if ( o.autoHide ) { 11794 $( this.element ) 11795 .on( "mouseenter", function() { 11796 if ( o.disabled ) { 11797 return; 11798 } 11799 that._removeClass( "ui-resizable-autohide" ); 11800 that._handles.show(); 11801 } ) 11802 .on( "mouseleave", function() { 11803 if ( o.disabled ) { 11804 return; 11805 } 11806 if ( !that.resizing ) { 11807 that._addClass( "ui-resizable-autohide" ); 11808 that._handles.hide(); 11809 } 11810 } ); 11811 } 11812 11813 this._mouseInit(); 11814 }, 11815 11816 _destroy: function() { 11817 11818 this._mouseDestroy(); 11819 this._addedHandles.remove(); 11820 11821 var wrapper, 11822 _destroy = function( exp ) { 11823 $( exp ) 11824 .removeData( "resizable" ) 11825 .removeData( "ui-resizable" ) 11826 .off( ".resizable" ); 11827 }; 11828 11829 // TODO: Unwrap at same DOM position 11830 if ( this.elementIsWrapper ) { 11831 _destroy( this.element ); 11832 wrapper = this.element; 11833 this.originalElement.css( { 11834 position: wrapper.css( "position" ), 11835 width: wrapper.outerWidth(), 11836 height: wrapper.outerHeight(), 11837 top: wrapper.css( "top" ), 11838 left: wrapper.css( "left" ) 11839 } ).insertAfter( wrapper ); 11840 wrapper.remove(); 11841 } 11842 11843 this.originalElement.css( "resize", this.originalResizeStyle ); 11844 _destroy( this.originalElement ); 11845 11846 return this; 11847 }, 11848 11849 _setOption: function( key, value ) { 11850 this._super( key, value ); 11851 11852 switch ( key ) { 11853 case "handles": 11854 this._removeHandles(); 11855 this._setupHandles(); 11856 break; 11857 case "aspectRatio": 11858 this._aspectRatio = !!value; 11859 break; 11860 default: 11861 break; 11862 } 11863 }, 11864 11865 _setupHandles: function() { 11866 var o = this.options, handle, i, n, hname, axis, that = this; 11867 this.handles = o.handles || 11868 ( !$( ".ui-resizable-handle", this.element ).length ? 11869 "e,s,se" : { 11870 n: ".ui-resizable-n", 11871 e: ".ui-resizable-e", 11872 s: ".ui-resizable-s", 11873 w: ".ui-resizable-w", 11874 se: ".ui-resizable-se", 11875 sw: ".ui-resizable-sw", 11876 ne: ".ui-resizable-ne", 11877 nw: ".ui-resizable-nw" 11878 } ); 11879 11880 this._handles = $(); 11881 this._addedHandles = $(); 11882 if ( this.handles.constructor === String ) { 11883 11884 if ( this.handles === "all" ) { 11885 this.handles = "n,e,s,w,se,sw,ne,nw"; 11886 } 11887 11888 n = this.handles.split( "," ); 11889 this.handles = {}; 11890 11891 for ( i = 0; i < n.length; i++ ) { 11892 11893 handle = String.prototype.trim.call( n[ i ] ); 11894 hname = "ui-resizable-" + handle; 11895 axis = $( "<div>" ); 11896 this._addClass( axis, "ui-resizable-handle " + hname ); 11897 11898 axis.css( { zIndex: o.zIndex } ); 11899 11900 this.handles[ handle ] = ".ui-resizable-" + handle; 11901 if ( !this.element.children( this.handles[ handle ] ).length ) { 11902 this.element.append( axis ); 11903 this._addedHandles = this._addedHandles.add( axis ); 11904 } 11905 } 11906 11907 } 11908 11909 this._renderAxis = function( target ) { 11910 11911 var i, axis, padPos, padWrapper; 11912 11913 target = target || this.element; 11914 11915 for ( i in this.handles ) { 11916 11917 if ( this.handles[ i ].constructor === String ) { 11918 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 11919 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 11920 this.handles[ i ] = $( this.handles[ i ] ); 11921 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 11922 } 11923 11924 if ( this.elementIsWrapper && 11925 this.originalElement[ 0 ] 11926 .nodeName 11927 .match( /^(textarea|input|select|button)$/i ) ) { 11928 axis = $( this.handles[ i ], this.element ); 11929 11930 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 11931 axis.outerHeight() : 11932 axis.outerWidth(); 11933 11934 padPos = [ "padding", 11935 /ne|nw|n/.test( i ) ? "Top" : 11936 /se|sw|s/.test( i ) ? "Bottom" : 11937 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 11938 11939 target.css( padPos, padWrapper ); 11940 11941 this._proportionallyResize(); 11942 } 11943 11944 this._handles = this._handles.add( this.handles[ i ] ); 11945 } 11946 }; 11947 11948 // TODO: make renderAxis a prototype function 11949 this._renderAxis( this.element ); 11950 11951 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 11952 this._handles.disableSelection(); 11953 11954 this._handles.on( "mouseover", function() { 11955 if ( !that.resizing ) { 11956 if ( this.className ) { 11957 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 11958 } 11959 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 11960 } 11961 } ); 11962 11963 if ( o.autoHide ) { 11964 this._handles.hide(); 11965 this._addClass( "ui-resizable-autohide" ); 11966 } 11967 }, 11968 11969 _removeHandles: function() { 11970 this._addedHandles.remove(); 11971 }, 11972 11973 _mouseCapture: function( event ) { 11974 var i, handle, 11975 capture = false; 11976 11977 for ( i in this.handles ) { 11978 handle = $( this.handles[ i ] )[ 0 ]; 11979 if ( handle === event.target || $.contains( handle, event.target ) ) { 11980 capture = true; 11981 } 11982 } 11983 11984 return !this.options.disabled && capture; 11985 }, 11986 11987 _mouseStart: function( event ) { 11988 11989 var curleft, curtop, cursor, calculatedSize, 11990 o = this.options, 11991 el = this.element; 11992 11993 this.resizing = true; 11994 11995 this._renderProxy(); 11996 11997 curleft = this._num( this.helper.css( "left" ) ); 11998 curtop = this._num( this.helper.css( "top" ) ); 11999 12000 if ( o.containment ) { 12001 curleft += $( o.containment ).scrollLeft() || 0; 12002 curtop += $( o.containment ).scrollTop() || 0; 12003 } 12004 12005 this.offset = this.helper.offset(); 12006 this.position = { left: curleft, top: curtop }; 12007 12008 if ( !this._helper ) { 12009 calculatedSize = this._calculateAdjustedElementDimensions( el ); 12010 } 12011 12012 this.size = this._helper ? { 12013 width: this.helper.width(), 12014 height: this.helper.height() 12015 } : { 12016 width: calculatedSize.width, 12017 height: calculatedSize.height 12018 }; 12019 12020 this.originalSize = this._helper ? { 12021 width: el.outerWidth(), 12022 height: el.outerHeight() 12023 } : { 12024 width: calculatedSize.width, 12025 height: calculatedSize.height 12026 }; 12027 12028 this.sizeDiff = { 12029 width: el.outerWidth() - el.width(), 12030 height: el.outerHeight() - el.height() 12031 }; 12032 12033 this.originalPosition = { left: curleft, top: curtop }; 12034 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 12035 12036 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 12037 o.aspectRatio : 12038 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 12039 12040 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 12041 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 12042 12043 this._addClass( "ui-resizable-resizing" ); 12044 this._propagate( "start", event ); 12045 return true; 12046 }, 12047 12048 _mouseDrag: function( event ) { 12049 12050 var data, props, 12051 smp = this.originalMousePosition, 12052 a = this.axis, 12053 dx = ( event.pageX - smp.left ) || 0, 12054 dy = ( event.pageY - smp.top ) || 0, 12055 trigger = this._change[ a ]; 12056 12057 this._updatePrevProperties(); 12058 12059 if ( !trigger ) { 12060 return false; 12061 } 12062 12063 data = trigger.apply( this, [ event, dx, dy ] ); 12064 12065 this._updateVirtualBoundaries( event.shiftKey ); 12066 if ( this._aspectRatio || event.shiftKey ) { 12067 data = this._updateRatio( data, event ); 12068 } 12069 12070 data = this._respectSize( data, event ); 12071 12072 this._updateCache( data ); 12073 12074 this._propagate( "resize", event ); 12075 12076 props = this._applyChanges(); 12077 12078 if ( !this._helper && this._proportionallyResizeElements.length ) { 12079 this._proportionallyResize(); 12080 } 12081 12082 if ( !$.isEmptyObject( props ) ) { 12083 this._updatePrevProperties(); 12084 this._trigger( "resize", event, this.ui() ); 12085 this._applyChanges(); 12086 } 12087 12088 return false; 12089 }, 12090 12091 _mouseStop: function( event ) { 12092 12093 this.resizing = false; 12094 var pr, ista, soffseth, soffsetw, s, left, top, 12095 o = this.options, that = this; 12096 12097 if ( this._helper ) { 12098 12099 pr = this._proportionallyResizeElements; 12100 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 12101 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 12102 soffsetw = ista ? 0 : that.sizeDiff.width; 12103 12104 s = { 12105 width: ( that.helper.width() - soffsetw ), 12106 height: ( that.helper.height() - soffseth ) 12107 }; 12108 left = ( parseFloat( that.element.css( "left" ) ) + 12109 ( that.position.left - that.originalPosition.left ) ) || null; 12110 top = ( parseFloat( that.element.css( "top" ) ) + 12111 ( that.position.top - that.originalPosition.top ) ) || null; 12112 12113 if ( !o.animate ) { 12114 this.element.css( $.extend( s, { top: top, left: left } ) ); 12115 } 12116 12117 that.helper.height( that.size.height ); 12118 that.helper.width( that.size.width ); 12119 12120 if ( this._helper && !o.animate ) { 12121 this._proportionallyResize(); 12122 } 12123 } 12124 12125 $( "body" ).css( "cursor", "auto" ); 12126 12127 this._removeClass( "ui-resizable-resizing" ); 12128 12129 this._propagate( "stop", event ); 12130 12131 if ( this._helper ) { 12132 this.helper.remove(); 12133 } 12134 12135 return false; 12136 12137 }, 12138 12139 _updatePrevProperties: function() { 12140 this.prevPosition = { 12141 top: this.position.top, 12142 left: this.position.left 12143 }; 12144 this.prevSize = { 12145 width: this.size.width, 12146 height: this.size.height 12147 }; 12148 }, 12149 12150 _applyChanges: function() { 12151 var props = {}; 12152 12153 if ( this.position.top !== this.prevPosition.top ) { 12154 props.top = this.position.top + "px"; 12155 } 12156 if ( this.position.left !== this.prevPosition.left ) { 12157 props.left = this.position.left + "px"; 12158 } 12159 12160 this.helper.css( props ); 12161 12162 if ( this.size.width !== this.prevSize.width ) { 12163 props.width = this.size.width + "px"; 12164 this.helper.width( props.width ); 12165 } 12166 if ( this.size.height !== this.prevSize.height ) { 12167 props.height = this.size.height + "px"; 12168 this.helper.height( props.height ); 12169 } 12170 12171 return props; 12172 }, 12173 12174 _updateVirtualBoundaries: function( forceAspectRatio ) { 12175 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 12176 o = this.options; 12177 12178 b = { 12179 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 12180 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 12181 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 12182 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 12183 }; 12184 12185 if ( this._aspectRatio || forceAspectRatio ) { 12186 pMinWidth = b.minHeight * this.aspectRatio; 12187 pMinHeight = b.minWidth / this.aspectRatio; 12188 pMaxWidth = b.maxHeight * this.aspectRatio; 12189 pMaxHeight = b.maxWidth / this.aspectRatio; 12190 12191 if ( pMinWidth > b.minWidth ) { 12192 b.minWidth = pMinWidth; 12193 } 12194 if ( pMinHeight > b.minHeight ) { 12195 b.minHeight = pMinHeight; 12196 } 12197 if ( pMaxWidth < b.maxWidth ) { 12198 b.maxWidth = pMaxWidth; 12199 } 12200 if ( pMaxHeight < b.maxHeight ) { 12201 b.maxHeight = pMaxHeight; 12202 } 12203 } 12204 this._vBoundaries = b; 12205 }, 12206 12207 _updateCache: function( data ) { 12208 this.offset = this.helper.offset(); 12209 if ( this._isNumber( data.left ) ) { 12210 this.position.left = data.left; 12211 } 12212 if ( this._isNumber( data.top ) ) { 12213 this.position.top = data.top; 12214 } 12215 if ( this._isNumber( data.height ) ) { 12216 this.size.height = data.height; 12217 } 12218 if ( this._isNumber( data.width ) ) { 12219 this.size.width = data.width; 12220 } 12221 }, 12222 12223 _updateRatio: function( data ) { 12224 12225 var cpos = this.position, 12226 csize = this.size, 12227 a = this.axis; 12228 12229 if ( this._isNumber( data.height ) ) { 12230 data.width = ( data.height * this.aspectRatio ); 12231 } else if ( this._isNumber( data.width ) ) { 12232 data.height = ( data.width / this.aspectRatio ); 12233 } 12234 12235 if ( a === "sw" ) { 12236 data.left = cpos.left + ( csize.width - data.width ); 12237 data.top = null; 12238 } 12239 if ( a === "nw" ) { 12240 data.top = cpos.top + ( csize.height - data.height ); 12241 data.left = cpos.left + ( csize.width - data.width ); 12242 } 12243 12244 return data; 12245 }, 12246 12247 _respectSize: function( data ) { 12248 12249 var o = this._vBoundaries, 12250 a = this.axis, 12251 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 12252 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 12253 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 12254 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 12255 dw = this.originalPosition.left + this.originalSize.width, 12256 dh = this.originalPosition.top + this.originalSize.height, 12257 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 12258 if ( isminw ) { 12259 data.width = o.minWidth; 12260 } 12261 if ( isminh ) { 12262 data.height = o.minHeight; 12263 } 12264 if ( ismaxw ) { 12265 data.width = o.maxWidth; 12266 } 12267 if ( ismaxh ) { 12268 data.height = o.maxHeight; 12269 } 12270 12271 if ( isminw && cw ) { 12272 data.left = dw - o.minWidth; 12273 } 12274 if ( ismaxw && cw ) { 12275 data.left = dw - o.maxWidth; 12276 } 12277 if ( isminh && ch ) { 12278 data.top = dh - o.minHeight; 12279 } 12280 if ( ismaxh && ch ) { 12281 data.top = dh - o.maxHeight; 12282 } 12283 12284 // Fixing jump error on top/left - bug #2330 12285 if ( !data.width && !data.height && !data.left && data.top ) { 12286 data.top = null; 12287 } else if ( !data.width && !data.height && !data.top && data.left ) { 12288 data.left = null; 12289 } 12290 12291 return data; 12292 }, 12293 12294 _getPaddingPlusBorderDimensions: function( element ) { 12295 var i = 0, 12296 widths = [], 12297 borders = [ 12298 element.css( "borderTopWidth" ), 12299 element.css( "borderRightWidth" ), 12300 element.css( "borderBottomWidth" ), 12301 element.css( "borderLeftWidth" ) 12302 ], 12303 paddings = [ 12304 element.css( "paddingTop" ), 12305 element.css( "paddingRight" ), 12306 element.css( "paddingBottom" ), 12307 element.css( "paddingLeft" ) 12308 ]; 12309 12310 for ( ; i < 4; i++ ) { 12311 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 12312 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 12313 } 12314 12315 return { 12316 height: widths[ 0 ] + widths[ 2 ], 12317 width: widths[ 1 ] + widths[ 3 ] 12318 }; 12319 }, 12320 12321 _calculateAdjustedElementDimensions: function( element ) { 12322 var elWidth, elHeight, paddingBorder, 12323 ce = element.get( 0 ); 12324 12325 if ( element.css( "box-sizing" ) !== "content-box" || 12326 ( !this._hasScroll( ce ) && !this._hasScroll( ce, "left" ) ) ) { 12327 return { 12328 height: parseFloat( element.css( "height" ) ), 12329 width: parseFloat( element.css( "width" ) ) 12330 }; 12331 } 12332 12333 // Check if CSS inline styles are set and use those (usually from previous resizes) 12334 elWidth = parseFloat( ce.style.width ); 12335 elHeight = parseFloat( ce.style.height ); 12336 12337 paddingBorder = this._getPaddingPlusBorderDimensions( element ); 12338 elWidth = isNaN( elWidth ) ? 12339 this._getElementTheoreticalSize( element, paddingBorder, "width" ) : 12340 elWidth; 12341 elHeight = isNaN( elHeight ) ? 12342 this._getElementTheoreticalSize( element, paddingBorder, "height" ) : 12343 elHeight; 12344 12345 return { 12346 height: elHeight, 12347 width: elWidth 12348 }; 12349 }, 12350 12351 _getElementTheoreticalSize: function( element, extraSize, dimension ) { 12352 12353 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 12354 var size = Math.max( 0, Math.ceil( 12355 element.get( 0 )[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 12356 extraSize[ dimension ] - 12357 0.5 12358 12359 // If offsetWidth/offsetHeight is unknown, then we can't determine theoretical size. 12360 // Use an explicit zero to avoid NaN. 12361 // See https://github.com/jquery/jquery/issues/3964 12362 ) ) || 0; 12363 12364 return size; 12365 }, 12366 12367 _proportionallyResize: function() { 12368 12369 if ( !this._proportionallyResizeElements.length ) { 12370 return; 12371 } 12372 12373 var prel, 12374 i = 0, 12375 element = this.helper || this.element; 12376 12377 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 12378 12379 prel = this._proportionallyResizeElements[ i ]; 12380 12381 // TODO: Seems like a bug to cache this.outerDimensions 12382 // considering that we are in a loop. 12383 if ( !this.outerDimensions ) { 12384 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 12385 } 12386 12387 prel.css( { 12388 height: ( element.height() - this.outerDimensions.height ) || 0, 12389 width: ( element.width() - this.outerDimensions.width ) || 0 12390 } ); 12391 12392 } 12393 12394 }, 12395 12396 _renderProxy: function() { 12397 12398 var el = this.element, o = this.options; 12399 this.elementOffset = el.offset(); 12400 12401 if ( this._helper ) { 12402 12403 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 12404 12405 this._addClass( this.helper, this._helper ); 12406 this.helper.css( { 12407 width: this.element.outerWidth(), 12408 height: this.element.outerHeight(), 12409 position: "absolute", 12410 left: this.elementOffset.left + "px", 12411 top: this.elementOffset.top + "px", 12412 zIndex: ++o.zIndex //TODO: Don't modify option 12413 } ); 12414 12415 this.helper 12416 .appendTo( "body" ) 12417 .disableSelection(); 12418 12419 } else { 12420 this.helper = this.element; 12421 } 12422 12423 }, 12424 12425 _change: { 12426 e: function( event, dx ) { 12427 return { width: this.originalSize.width + dx }; 12428 }, 12429 w: function( event, dx ) { 12430 var cs = this.originalSize, sp = this.originalPosition; 12431 return { left: sp.left + dx, width: cs.width - dx }; 12432 }, 12433 n: function( event, dx, dy ) { 12434 var cs = this.originalSize, sp = this.originalPosition; 12435 return { top: sp.top + dy, height: cs.height - dy }; 12436 }, 12437 s: function( event, dx, dy ) { 12438 return { height: this.originalSize.height + dy }; 12439 }, 12440 se: function( event, dx, dy ) { 12441 return $.extend( this._change.s.apply( this, arguments ), 12442 this._change.e.apply( this, [ event, dx, dy ] ) ); 12443 }, 12444 sw: function( event, dx, dy ) { 12445 return $.extend( this._change.s.apply( this, arguments ), 12446 this._change.w.apply( this, [ event, dx, dy ] ) ); 12447 }, 12448 ne: function( event, dx, dy ) { 12449 return $.extend( this._change.n.apply( this, arguments ), 12450 this._change.e.apply( this, [ event, dx, dy ] ) ); 12451 }, 12452 nw: function( event, dx, dy ) { 12453 return $.extend( this._change.n.apply( this, arguments ), 12454 this._change.w.apply( this, [ event, dx, dy ] ) ); 12455 } 12456 }, 12457 12458 _propagate: function( n, event ) { 12459 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 12460 if ( n !== "resize" ) { 12461 this._trigger( n, event, this.ui() ); 12462 } 12463 }, 12464 12465 plugins: {}, 12466 12467 ui: function() { 12468 return { 12469 originalElement: this.originalElement, 12470 element: this.element, 12471 helper: this.helper, 12472 position: this.position, 12473 size: this.size, 12474 originalSize: this.originalSize, 12475 originalPosition: this.originalPosition 12476 }; 12477 } 12478 12479} ); 12480 12481/* 12482 * Resizable Extensions 12483 */ 12484 12485$.ui.plugin.add( "resizable", "animate", { 12486 12487 stop: function( event ) { 12488 var that = $( this ).resizable( "instance" ), 12489 o = that.options, 12490 pr = that._proportionallyResizeElements, 12491 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 12492 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 12493 soffsetw = ista ? 0 : that.sizeDiff.width, 12494 style = { 12495 width: ( that.size.width - soffsetw ), 12496 height: ( that.size.height - soffseth ) 12497 }, 12498 left = ( parseFloat( that.element.css( "left" ) ) + 12499 ( that.position.left - that.originalPosition.left ) ) || null, 12500 top = ( parseFloat( that.element.css( "top" ) ) + 12501 ( that.position.top - that.originalPosition.top ) ) || null; 12502 12503 that.element.animate( 12504 $.extend( style, top && left ? { top: top, left: left } : {} ), { 12505 duration: o.animateDuration, 12506 easing: o.animateEasing, 12507 step: function() { 12508 12509 var data = { 12510 width: parseFloat( that.element.css( "width" ) ), 12511 height: parseFloat( that.element.css( "height" ) ), 12512 top: parseFloat( that.element.css( "top" ) ), 12513 left: parseFloat( that.element.css( "left" ) ) 12514 }; 12515 12516 if ( pr && pr.length ) { 12517 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 12518 } 12519 12520 // Propagating resize, and updating values for each animation step 12521 that._updateCache( data ); 12522 that._propagate( "resize", event ); 12523 12524 } 12525 } 12526 ); 12527 } 12528 12529} ); 12530 12531$.ui.plugin.add( "resizable", "containment", { 12532 12533 start: function() { 12534 var element, p, co, ch, cw, width, height, 12535 that = $( this ).resizable( "instance" ), 12536 o = that.options, 12537 el = that.element, 12538 oc = o.containment, 12539 ce = ( oc instanceof $ ) ? 12540 oc.get( 0 ) : 12541 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 12542 12543 if ( !ce ) { 12544 return; 12545 } 12546 12547 that.containerElement = $( ce ); 12548 12549 if ( /document/.test( oc ) || oc === document ) { 12550 that.containerOffset = { 12551 left: 0, 12552 top: 0 12553 }; 12554 that.containerPosition = { 12555 left: 0, 12556 top: 0 12557 }; 12558 12559 that.parentData = { 12560 element: $( document ), 12561 left: 0, 12562 top: 0, 12563 width: $( document ).width(), 12564 height: $( document ).height() || document.body.parentNode.scrollHeight 12565 }; 12566 } else { 12567 element = $( ce ); 12568 p = []; 12569 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 12570 p[ i ] = that._num( element.css( "padding" + name ) ); 12571 } ); 12572 12573 that.containerOffset = element.offset(); 12574 that.containerPosition = element.position(); 12575 that.containerSize = { 12576 height: ( element.innerHeight() - p[ 3 ] ), 12577 width: ( element.innerWidth() - p[ 1 ] ) 12578 }; 12579 12580 co = that.containerOffset; 12581 ch = that.containerSize.height; 12582 cw = that.containerSize.width; 12583 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 12584 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 12585 12586 that.parentData = { 12587 element: ce, 12588 left: co.left, 12589 top: co.top, 12590 width: width, 12591 height: height 12592 }; 12593 } 12594 }, 12595 12596 resize: function( event ) { 12597 var woset, hoset, isParent, isOffsetRelative, 12598 that = $( this ).resizable( "instance" ), 12599 o = that.options, 12600 co = that.containerOffset, 12601 cp = that.position, 12602 pRatio = that._aspectRatio || event.shiftKey, 12603 cop = { 12604 top: 0, 12605 left: 0 12606 }, 12607 ce = that.containerElement, 12608 continueResize = true; 12609 12610 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 12611 cop = co; 12612 } 12613 12614 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 12615 that.size.width = that.size.width + 12616 ( that._helper ? 12617 ( that.position.left - co.left ) : 12618 ( that.position.left - cop.left ) ); 12619 12620 if ( pRatio ) { 12621 that.size.height = that.size.width / that.aspectRatio; 12622 continueResize = false; 12623 } 12624 that.position.left = o.helper ? co.left : 0; 12625 } 12626 12627 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 12628 that.size.height = that.size.height + 12629 ( that._helper ? 12630 ( that.position.top - co.top ) : 12631 that.position.top ); 12632 12633 if ( pRatio ) { 12634 that.size.width = that.size.height * that.aspectRatio; 12635 continueResize = false; 12636 } 12637 that.position.top = that._helper ? co.top : 0; 12638 } 12639 12640 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 12641 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 12642 12643 if ( isParent && isOffsetRelative ) { 12644 that.offset.left = that.parentData.left + that.position.left; 12645 that.offset.top = that.parentData.top + that.position.top; 12646 } else { 12647 that.offset.left = that.element.offset().left; 12648 that.offset.top = that.element.offset().top; 12649 } 12650 12651 woset = Math.abs( that.sizeDiff.width + 12652 ( that._helper ? 12653 that.offset.left - cop.left : 12654 ( that.offset.left - co.left ) ) ); 12655 12656 hoset = Math.abs( that.sizeDiff.height + 12657 ( that._helper ? 12658 that.offset.top - cop.top : 12659 ( that.offset.top - co.top ) ) ); 12660 12661 if ( woset + that.size.width >= that.parentData.width ) { 12662 that.size.width = that.parentData.width - woset; 12663 if ( pRatio ) { 12664 that.size.height = that.size.width / that.aspectRatio; 12665 continueResize = false; 12666 } 12667 } 12668 12669 if ( hoset + that.size.height >= that.parentData.height ) { 12670 that.size.height = that.parentData.height - hoset; 12671 if ( pRatio ) { 12672 that.size.width = that.size.height * that.aspectRatio; 12673 continueResize = false; 12674 } 12675 } 12676 12677 if ( !continueResize ) { 12678 that.position.left = that.prevPosition.left; 12679 that.position.top = that.prevPosition.top; 12680 that.size.width = that.prevSize.width; 12681 that.size.height = that.prevSize.height; 12682 } 12683 }, 12684 12685 stop: function() { 12686 var that = $( this ).resizable( "instance" ), 12687 o = that.options, 12688 co = that.containerOffset, 12689 cop = that.containerPosition, 12690 ce = that.containerElement, 12691 helper = $( that.helper ), 12692 ho = helper.offset(), 12693 w = helper.outerWidth() - that.sizeDiff.width, 12694 h = helper.outerHeight() - that.sizeDiff.height; 12695 12696 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 12697 $( this ).css( { 12698 left: ho.left - cop.left - co.left, 12699 width: w, 12700 height: h 12701 } ); 12702 } 12703 12704 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 12705 $( this ).css( { 12706 left: ho.left - cop.left - co.left, 12707 width: w, 12708 height: h 12709 } ); 12710 } 12711 } 12712} ); 12713 12714$.ui.plugin.add( "resizable", "alsoResize", { 12715 12716 start: function() { 12717 var that = $( this ).resizable( "instance" ), 12718 o = that.options; 12719 12720 $( o.alsoResize ).each( function() { 12721 var el = $( this ), 12722 elSize = that._calculateAdjustedElementDimensions( el ); 12723 12724 el.data( "ui-resizable-alsoresize", { 12725 width: elSize.width, height: elSize.height, 12726 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 12727 } ); 12728 } ); 12729 }, 12730 12731 resize: function( event, ui ) { 12732 var that = $( this ).resizable( "instance" ), 12733 o = that.options, 12734 os = that.originalSize, 12735 op = that.originalPosition, 12736 delta = { 12737 height: ( that.size.height - os.height ) || 0, 12738 width: ( that.size.width - os.width ) || 0, 12739 top: ( that.position.top - op.top ) || 0, 12740 left: ( that.position.left - op.left ) || 0 12741 }; 12742 12743 $( o.alsoResize ).each( function() { 12744 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 12745 css = el.parents( ui.originalElement[ 0 ] ).length ? 12746 [ "width", "height" ] : 12747 [ "width", "height", "top", "left" ]; 12748 12749 $.each( css, function( i, prop ) { 12750 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 12751 if ( sum && sum >= 0 ) { 12752 style[ prop ] = sum || null; 12753 } 12754 } ); 12755 12756 el.css( style ); 12757 } ); 12758 }, 12759 12760 stop: function() { 12761 $( this ).removeData( "ui-resizable-alsoresize" ); 12762 } 12763} ); 12764 12765$.ui.plugin.add( "resizable", "ghost", { 12766 12767 start: function() { 12768 12769 var that = $( this ).resizable( "instance" ), cs = that.size; 12770 12771 that.ghost = that.originalElement.clone(); 12772 that.ghost.css( { 12773 opacity: 0.25, 12774 display: "block", 12775 position: "relative", 12776 height: cs.height, 12777 width: cs.width, 12778 margin: 0, 12779 left: 0, 12780 top: 0 12781 } ); 12782 12783 that._addClass( that.ghost, "ui-resizable-ghost" ); 12784 12785 // DEPRECATED 12786 // TODO: remove after 1.12 12787 if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) { 12788 12789 // Ghost option 12790 that.ghost.addClass( this.options.ghost ); 12791 } 12792 12793 that.ghost.appendTo( that.helper ); 12794 12795 }, 12796 12797 resize: function() { 12798 var that = $( this ).resizable( "instance" ); 12799 if ( that.ghost ) { 12800 that.ghost.css( { 12801 position: "relative", 12802 height: that.size.height, 12803 width: that.size.width 12804 } ); 12805 } 12806 }, 12807 12808 stop: function() { 12809 var that = $( this ).resizable( "instance" ); 12810 if ( that.ghost && that.helper ) { 12811 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 12812 } 12813 } 12814 12815} ); 12816 12817$.ui.plugin.add( "resizable", "grid", { 12818 12819 resize: function() { 12820 var outerDimensions, 12821 that = $( this ).resizable( "instance" ), 12822 o = that.options, 12823 cs = that.size, 12824 os = that.originalSize, 12825 op = that.originalPosition, 12826 a = that.axis, 12827 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 12828 gridX = ( grid[ 0 ] || 1 ), 12829 gridY = ( grid[ 1 ] || 1 ), 12830 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 12831 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 12832 newWidth = os.width + ox, 12833 newHeight = os.height + oy, 12834 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 12835 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 12836 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 12837 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 12838 12839 o.grid = grid; 12840 12841 if ( isMinWidth ) { 12842 newWidth += gridX; 12843 } 12844 if ( isMinHeight ) { 12845 newHeight += gridY; 12846 } 12847 if ( isMaxWidth ) { 12848 newWidth -= gridX; 12849 } 12850 if ( isMaxHeight ) { 12851 newHeight -= gridY; 12852 } 12853 12854 if ( /^(se|s|e)$/.test( a ) ) { 12855 that.size.width = newWidth; 12856 that.size.height = newHeight; 12857 } else if ( /^(ne)$/.test( a ) ) { 12858 that.size.width = newWidth; 12859 that.size.height = newHeight; 12860 that.position.top = op.top - oy; 12861 } else if ( /^(sw)$/.test( a ) ) { 12862 that.size.width = newWidth; 12863 that.size.height = newHeight; 12864 that.position.left = op.left - ox; 12865 } else { 12866 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 12867 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 12868 } 12869 12870 if ( newHeight - gridY > 0 ) { 12871 that.size.height = newHeight; 12872 that.position.top = op.top - oy; 12873 } else { 12874 newHeight = gridY - outerDimensions.height; 12875 that.size.height = newHeight; 12876 that.position.top = op.top + os.height - newHeight; 12877 } 12878 if ( newWidth - gridX > 0 ) { 12879 that.size.width = newWidth; 12880 that.position.left = op.left - ox; 12881 } else { 12882 newWidth = gridX - outerDimensions.width; 12883 that.size.width = newWidth; 12884 that.position.left = op.left + os.width - newWidth; 12885 } 12886 } 12887 } 12888 12889} ); 12890
12891return $.ui.resizable; 12892 12893} ); 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906/*! 12907 * jQuery UI Dialog 1.14.1 12908 * https://jqueryui.com 12909 * 12910 * Copyright OpenJS Foundation and other contributors 12911 * Released under the MIT license. 12912 * https://jquery.org/license 12913 */ 12914 12915//>>label: Dialog 12916//>>group: Widgets 12917//>>description: Displays customizable dialog windows. 12918//>>docs: https://api.jqueryui.com/dialog/ 12919//>>demos: https://jqueryui.com/dialog/ 12920//>>css.structure: ../../themes/base/core.css 12921//>>css.structure: ../../themes/base/dialog.css 12922//>>css.theme: ../../themes/base/theme.css 12923 12924( function( factory ) { 12925 "use strict"; 12926 12927 if ( typeof define === "function" && define.amd ) { 12928 12929 // AMD. Register as an anonymous module. 12930 define( [ 12931 "jquery", 12932 "./button", 12933 "./draggable", 12934 "./mouse", 12935 "./resizable", 12936 "../focusable", 12937 "../keycode", 12938 "../position", 12939 "../tabbable", 12940 "../unique-id", 12941 "../version", 12942 "../widget" 12943 ], factory ); 12944 } else { 12945 12946 // Browser globals 12947 factory( jQuery ); 12948 } 12949} )( function( $ ) { 12950"use strict"; 12951 12952$.widget( "ui.dialog", { 12953 version: "1.14.1
vendor: 22,317 bytes, lines 12953-13847
12953", 12954 options: { 12955 appendTo: "body", 12956 autoOpen: true, 12957 buttons: [], 12958 classes: { 12959 "ui-dialog": "ui-corner-all", 12960 "ui-dialog-titlebar": "ui-corner-all" 12961 }, 12962 closeOnEscape: true, 12963 closeText: "Close", 12964 draggable: true, 12965 hide: null, 12966 height: "auto", 12967 maxHeight: null, 12968 maxWidth: null, 12969 minHeight: 150, 12970 minWidth: 150, 12971 modal: false, 12972 position: { 12973 my: "center", 12974 at: "center", 12975 of: window, 12976 collision: "fit", 12977 12978 // Ensure the titlebar is always visible 12979 using: function( pos ) { 12980 var topOffset = $( this ).css( pos ).offset().top; 12981 if ( topOffset < 0 ) { 12982 $( this ).css( "top", pos.top - topOffset ); 12983 } 12984 } 12985 }, 12986 resizable: true, 12987 show: null, 12988 title: null, 12989 uiDialogTitleHeadingLevel: 0, 12990 width: 300, 12991 12992 // Callbacks 12993 beforeClose: null, 12994 close: null, 12995 drag: null, 12996 dragStart: null, 12997 dragStop: null, 12998 focus: null, 12999 open: null, 13000 resize: null, 13001 resizeStart: null, 13002 resizeStop: null 13003 }, 13004 13005 sizeRelatedOptions: { 13006 buttons: true, 13007 height: true, 13008 maxHeight: true, 13009 maxWidth: true, 13010 minHeight: true, 13011 minWidth: true, 13012 width: true 13013 }, 13014 13015 resizableRelatedOptions: { 13016 maxHeight: true, 13017 maxWidth: true, 13018 minHeight: true, 13019 minWidth: true 13020 }, 13021 13022 _create: function() { 13023 this.originalCss = { 13024 display: this.element[ 0 ].style.display, 13025 width: this.element[ 0 ].style.width, 13026 minHeight: this.element[ 0 ].style.minHeight, 13027 maxHeight: this.element[ 0 ].style.maxHeight, 13028 height: this.element[ 0 ].style.height 13029 }; 13030 this.originalPosition = { 13031 parent: this.element.parent(), 13032 index: this.element.parent().children().index( this.element ) 13033 }; 13034 this.originalTitle = this.element.attr( "title" ); 13035 if ( this.options.title == null && this.originalTitle != null ) { 13036 this.options.title = this.originalTitle; 13037 } 13038 13039 // Dialogs can't be disabled 13040 if ( this.options.disabled ) { 13041 this.options.disabled = false; 13042 } 13043 13044 this._createWrapper(); 13045 13046 this.element 13047 .show() 13048 .removeAttr( "title" ) 13049 .appendTo( this.uiDialog ); 13050 13051 this._addClass( "ui-dialog-content", "ui-widget-content" ); 13052 13053 this._createTitlebar(); 13054 this._createButtonPane(); 13055 13056 if ( this.options.draggable && $.fn.draggable ) { 13057 this._makeDraggable(); 13058 } 13059 if ( this.options.resizable && $.fn.resizable ) { 13060 this._makeResizable(); 13061 } 13062 13063 this._isOpen = false; 13064 13065 this._trackFocus(); 13066 }, 13067 13068 _init: function() { 13069 if ( this.options.autoOpen ) { 13070 this.open(); 13071 } 13072 }, 13073 13074 _appendTo: function() { 13075 var element = this.options.appendTo; 13076 if ( element && ( element.jquery || element.nodeType ) ) { 13077 return $( element ); 13078 } 13079 return this.document.find( element || "body" ).eq( 0 ); 13080 }, 13081 13082 _destroy: function() { 13083 var next, 13084 originalPosition = this.originalPosition; 13085 13086 this._untrackInstance(); 13087 this._destroyOverlay(); 13088 13089 this.element 13090 .removeUniqueId() 13091 .css( this.originalCss ) 13092 13093 // Without detaching first, the following becomes really slow 13094 .detach(); 13095 13096 this.uiDialog.remove(); 13097 13098 if ( this.originalTitle ) { 13099 this.element.attr( "title", this.originalTitle ); 13100 } 13101 13102 next = originalPosition.parent.children().eq( originalPosition.index ); 13103 13104 // Don't try to place the dialog next to itself (#8613) 13105 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 13106 next.before( this.element ); 13107 } else { 13108 originalPosition.parent.append( this.element ); 13109 } 13110 }, 13111 13112 widget: function() { 13113 return this.uiDialog; 13114 }, 13115 13116 disable: $.noop, 13117 enable: $.noop, 13118 13119 close: function( event ) { 13120 var that = this; 13121 13122 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 13123 return; 13124 } 13125 13126 this._isOpen = false; 13127 this._focusedElement = null; 13128 this._destroyOverlay(); 13129 this._untrackInstance(); 13130 13131 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 13132 13133 // Hiding a focused element doesn't trigger blur in WebKit 13134 // so in case we have nothing to focus on, explicitly blur the active element 13135 // https://bugs.webkit.org/show_bug.cgi?id=47182 13136 $( this.document[ 0 ].activeElement ).trigger( "blur" ); 13137 } 13138 13139 this._hide( this.uiDialog, this.options.hide, function() { 13140 that._trigger( "close", event ); 13141 } ); 13142 }, 13143 13144 isOpen: function() { 13145 return this._isOpen; 13146 }, 13147 13148 moveToTop: function() { 13149 this._moveToTop(); 13150 }, 13151 13152 _moveToTop: function( event, silent ) { 13153 var moved = false, 13154 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 13155 return +$( this ).css( "z-index" ); 13156 } ).get(), 13157 zIndexMax = Math.max.apply( null, zIndices ); 13158 13159 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 13160 this.uiDialog.css( "z-index", zIndexMax + 1 ); 13161 moved = true; 13162 } 13163 13164 if ( moved && !silent ) { 13165 this._trigger( "focus", event ); 13166 } 13167 return moved; 13168 }, 13169 13170 open: function() { 13171 var that = this; 13172 if ( this._isOpen ) { 13173 if ( this._moveToTop() ) { 13174 this._focusTabbable(); 13175 } 13176 return; 13177 } 13178 13179 this._isOpen = true; 13180 this.opener = $( this.document[ 0 ].activeElement ); 13181 13182 this._size(); 13183 this._position(); 13184 this._createOverlay(); 13185 this._moveToTop( null, true ); 13186 13187 // Ensure the overlay is moved to the top with the dialog, but only when 13188 // opening. The overlay shouldn't move after the dialog is open so that 13189 // modeless dialogs opened after the modal dialog stack properly. 13190 if ( this.overlay ) { 13191 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 13192 } 13193 13194 this._show( this.uiDialog, this.options.show, function() { 13195 that._focusTabbable(); 13196 that._trigger( "focus" ); 13197 } ); 13198 13199 // Track the dialog immediately upon opening in case a focus event 13200 // somehow occurs outside of the dialog before an element inside the 13201 // dialog is focused (#10152) 13202 this._makeFocusTarget(); 13203 13204 this._trigger( "open" ); 13205 }, 13206 13207 _focusTabbable: function() { 13208 13209 // Set focus to the first match: 13210 // 1. An element that was focused previously 13211 // 2. First element inside the dialog matching [autofocus] 13212 // 3. Tabbable element inside the content element 13213 // 4. Tabbable element inside the buttonpane 13214 // 5. The close button 13215 // 6. The dialog itself 13216 var hasFocus = this._focusedElement; 13217 if ( !hasFocus ) { 13218 hasFocus = this.element.find( "[autofocus]" ); 13219 } 13220 if ( !hasFocus.length ) { 13221 hasFocus = this.element.find( ":tabbable" ); 13222 } 13223 if ( !hasFocus.length ) { 13224 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 13225 } 13226 if ( !hasFocus.length ) { 13227 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 13228 } 13229 if ( !hasFocus.length ) { 13230 hasFocus = this.uiDialog; 13231 } 13232 hasFocus.eq( 0 ).trigger( "focus" ); 13233 }, 13234 13235 _restoreTabbableFocus: function() { 13236 var activeElement = this.document[ 0 ].activeElement, 13237 isActive = this.uiDialog[ 0 ] === activeElement || 13238 $.contains( this.uiDialog[ 0 ], activeElement ); 13239 if ( !isActive ) { 13240 this._focusTabbable(); 13241 } 13242 }, 13243 13244 _keepFocus: function( event ) { 13245 event.preventDefault(); 13246 this._restoreTabbableFocus(); 13247 }, 13248 13249 _createWrapper: function() { 13250 this.uiDialog = $( "<div>" ) 13251 .hide() 13252 .attr( { 13253 13254 // Setting tabIndex makes the div focusable 13255 tabIndex: -1, 13256 role: "dialog", 13257 "aria-modal": this.options.modal ? "true" : null 13258 } ) 13259 .appendTo( this._appendTo() ); 13260 13261 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 13262 this._on( this.uiDialog, { 13263 keydown: function( event ) { 13264 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 13265 event.keyCode === $.ui.keyCode.ESCAPE ) { 13266 event.preventDefault(); 13267 this.close( event ); 13268 return; 13269 } 13270 13271 // Prevent tabbing out of dialogs 13272 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 13273 return; 13274 } 13275 var tabbables = this.uiDialog.find( ":tabbable" ), 13276 first = tabbables.first(), 13277 last = tabbables.last(); 13278 13279 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 13280 !event.shiftKey ) { 13281 this._delay( function() { 13282 first.trigger( "focus" ); 13283 } ); 13284 event.preventDefault(); 13285 } else if ( ( event.target === first[ 0 ] || 13286 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 13287 this._delay( function() { 13288 last.trigger( "focus" ); 13289 } ); 13290 event.preventDefault(); 13291 } 13292 }, 13293 mousedown: function( event ) { 13294 if ( this._moveToTop( event ) ) { 13295 this._focusTabbable(); 13296 } 13297 } 13298 } ); 13299 13300 // We assume that any existing aria-describedby attribute means 13301 // that the dialog content is marked up properly 13302 // otherwise we brute force the content as the description 13303 if ( !this.element.find( "[aria-describedby]" ).length ) { 13304 this.uiDialog.attr( { 13305 "aria-describedby": this.element.uniqueId().attr( "id" ) 13306 } ); 13307 } 13308 }, 13309 13310 _createTitlebar: function() { 13311 var uiDialogTitle; 13312 13313 this.uiDialogTitlebar = $( "<div>" ); 13314 this._addClass( this.uiDialogTitlebar, 13315 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 13316 this._on( this.uiDialogTitlebar, { 13317 mousedown: function( event ) { 13318 13319 // Don't prevent click on close button (#8838) 13320 // Focusing a dialog that is partially scrolled out of view 13321 // causes the browser to scroll it into view, preventing the click event 13322 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 13323 13324 // Dialog isn't getting focus when dragging (#8063) 13325 this.uiDialog.trigger( "focus" ); 13326 } 13327 } 13328 } ); 13329 13330 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 13331 .button( { 13332 label: $( "<a>" ).text( this.options.closeText ).html(), 13333 icon: "ui-icon-closethick", 13334 showLabel: false 13335 } ) 13336 .appendTo( this.uiDialogTitlebar ); 13337 13338 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 13339 this._on( this.uiDialogTitlebarClose, { 13340 click: function( event ) { 13341 event.preventDefault(); 13342 this.close( event ); 13343 } 13344 } ); 13345 13346 var uiDialogHeadingLevel = Number.isInteger( this.options.uiDialogTitleHeadingLevel ) && 13347 this.options.uiDialogTitleHeadingLevel > 0 && 13348 this.options.uiDialogTitleHeadingLevel <= 6 ? 13349 "h" + this.options.uiDialogTitleHeadingLevel : "span"; 13350 13351 uiDialogTitle = $( "<" + uiDialogHeadingLevel + ">" ) 13352 .uniqueId().prependTo( this.uiDialogTitlebar ); 13353 this._addClass( uiDialogTitle, "ui-dialog-title" ); 13354 this._title( uiDialogTitle ); 13355 13356 this.uiDialogTitlebar.prependTo( this.uiDialog ); 13357 13358 this.uiDialog.attr( { 13359 "aria-labelledby": uiDialogTitle.attr( "id" ) 13360 } ); 13361 }, 13362 13363 _title: function( title ) { 13364 if ( this.options.title ) { 13365 title.text( this.options.title ); 13366 } else { 13367 title.html( " " ); 13368 } 13369 }, 13370 13371 _createButtonPane: function() { 13372 this.uiDialogButtonPane = $( "<div>" ); 13373 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 13374 "ui-widget-content ui-helper-clearfix" ); 13375 13376 this.uiButtonSet = $( "<div>" ) 13377 .appendTo( this.uiDialogButtonPane ); 13378 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 13379 13380 this._createButtons(); 13381 }, 13382 13383 _createButtons: function() { 13384 var that = this, 13385 buttons = this.options.buttons; 13386 13387 // If we already have a button pane, remove it 13388 this.uiDialogButtonPane.remove(); 13389 this.uiButtonSet.empty(); 13390 13391 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 13392 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 13393 return; 13394 } 13395 13396 $.each( buttons, function( name, props ) { 13397 var click, buttonOptions; 13398 props = typeof props === "function" ? 13399 { click: props, text: name } : 13400 props; 13401 13402 // Default to a non-submitting button 13403 props = $.extend( { type: "button" }, props ); 13404 13405 // Change the context for the click callback to be the main element 13406 click = props.click; 13407 buttonOptions = { 13408 icon: props.icon, 13409 iconPosition: props.iconPosition, 13410 showLabel: props.showLabel, 13411 13412 // Deprecated options 13413 icons: props.icons, 13414 text: props.text 13415 }; 13416 13417 delete props.click; 13418 delete props.icon; 13419 delete props.iconPosition; 13420 delete props.showLabel; 13421 13422 // Deprecated options 13423 delete props.icons; 13424 if ( typeof props.text === "boolean" ) { 13425 delete props.text; 13426 } 13427 13428 $( "<button></button>", props ) 13429 .button( buttonOptions ) 13430 .appendTo( that.uiButtonSet ) 13431 .on( "click", function() { 13432 click.apply( that.element[ 0 ], arguments ); 13433 } ); 13434 } ); 13435 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 13436 this.uiDialogButtonPane.appendTo( this.uiDialog ); 13437 }, 13438 13439 _makeDraggable: function() { 13440 var that = this, 13441 options = this.options; 13442 13443 function filteredUi( ui ) { 13444 return { 13445 position: ui.position, 13446 offset: ui.offset 13447 }; 13448 } 13449 13450 this.uiDialog.draggable( { 13451 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 13452 handle: ".ui-dialog-titlebar", 13453 containment: "document", 13454 start: function( event, ui ) { 13455 that._addClass( $( this ), "ui-dialog-dragging" ); 13456 that._blockFrames(); 13457 that._trigger( "dragStart", event, filteredUi( ui ) ); 13458 }, 13459 drag: function( event, ui ) { 13460 that._trigger( "drag", event, filteredUi( ui ) ); 13461 }, 13462 stop: function( event, ui ) { 13463 var left = ui.offset.left - that.document.scrollLeft(), 13464 top = ui.offset.top - that.document.scrollTop(); 13465 13466 options.position = { 13467 my: "left top", 13468 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 13469 "top" + ( top >= 0 ? "+" : "" ) + top, 13470 of: that.window 13471 }; 13472 that._removeClass( $( this ), "ui-dialog-dragging" ); 13473 that._unblockFrames(); 13474 that._trigger( "dragStop", event, filteredUi( ui ) ); 13475 } 13476 } ); 13477 }, 13478 13479 _makeResizable: function() { 13480 var that = this, 13481 options = this.options, 13482 handles = options.resizable, 13483 13484 // .ui-resizable has position: relative defined in the stylesheet 13485 // but dialogs have to use absolute or fixed positioning 13486 position = this.uiDialog.css( "position" ), 13487 resizeHandles = typeof handles === "string" ? 13488 handles : 13489 "n,e,s,w,se,sw,ne,nw"; 13490 13491 function filteredUi( ui ) { 13492 return { 13493 originalPosition: ui.originalPosition, 13494 originalSize: ui.originalSize, 13495 position: ui.position, 13496 size: ui.size 13497 }; 13498 } 13499 13500 this.uiDialog.resizable( { 13501 cancel: ".ui-dialog-content", 13502 containment: "document", 13503 alsoResize: this.element, 13504 maxWidth: options.maxWidth, 13505 maxHeight: options.maxHeight, 13506 minWidth: options.minWidth, 13507 minHeight: this._minHeight(), 13508 handles: resizeHandles, 13509 start: function( event, ui ) { 13510 that._addClass( $( this ), "ui-dialog-resizing" ); 13511 that._blockFrames(); 13512 that._trigger( "resizeStart", event, filteredUi( ui ) ); 13513 }, 13514 resize: function( event, ui ) { 13515 that._trigger( "resize", event, filteredUi( ui ) ); 13516 }, 13517 stop: function( event, ui ) { 13518 var offset = that.uiDialog.offset(), 13519 left = offset.left - that.document.scrollLeft(), 13520 top = offset.top - that.document.scrollTop(); 13521 13522 options.height = that.uiDialog.height(); 13523 options.width = that.uiDialog.width(); 13524 options.position = { 13525 my: "left top", 13526 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 13527 "top" + ( top >= 0 ? "+" : "" ) + top, 13528 of: that.window 13529 }; 13530 that._removeClass( $( this ), "ui-dialog-resizing" ); 13531 that._unblockFrames(); 13532 that._trigger( "resizeStop", event, filteredUi( ui ) ); 13533 } 13534 } ) 13535 .css( "position", position ); 13536 }, 13537 13538 _trackFocus: function() { 13539 this._on( this.widget(), { 13540 focusin: function( event ) { 13541 this._makeFocusTarget(); 13542 this._focusedElement = $( event.target ); 13543 } 13544 } ); 13545 }, 13546 13547 _makeFocusTarget: function() { 13548 this._untrackInstance(); 13549 this._trackingInstances().unshift( this ); 13550 }, 13551 13552 _untrackInstance: function() { 13553 var instances = this._trackingInstances(), 13554 exists = $.inArray( this, instances ); 13555 if ( exists !== -1 ) { 13556 instances.splice( exists, 1 ); 13557 } 13558 }, 13559 13560 _trackingInstances: function() { 13561 var instances = this.document.data( "ui-dialog-instances" ); 13562 if ( !instances ) { 13563 instances = []; 13564 this.document.data( "ui-dialog-instances", instances ); 13565 } 13566 return instances; 13567 }, 13568 13569 _minHeight: function() { 13570 var options = this.options; 13571 13572 return options.height === "auto" ? 13573 options.minHeight : 13574 Math.min( options.minHeight, options.height ); 13575 }, 13576 13577 _position: function() { 13578 13579 // Need to show the dialog to get the actual offset in the position plugin 13580 var isVisible = this.uiDialog.is( ":visible" ); 13581 if ( !isVisible ) { 13582 this.uiDialog.show(); 13583 } 13584 this.uiDialog.position( this.options.position ); 13585 if ( !isVisible ) { 13586 this.uiDialog.hide(); 13587 } 13588 }, 13589 13590 _setOptions: function( options ) { 13591 var that = this, 13592 resize = false, 13593 resizableOptions = {}; 13594 13595 $.each( options, function( key, value ) { 13596 that._setOption( key, value ); 13597 13598 if ( key in that.sizeRelatedOptions ) { 13599 resize = true; 13600 } 13601 if ( key in that.resizableRelatedOptions ) { 13602 resizableOptions[ key ] = value; 13603 } 13604 } ); 13605 13606 if ( resize ) { 13607 this._size(); 13608 this._position(); 13609 } 13610 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 13611 this.uiDialog.resizable( "option", resizableOptions ); 13612 } 13613 }, 13614 13615 _setOption: function( key, value ) { 13616 var isDraggable, isResizable, 13617 uiDialog = this.uiDialog; 13618 13619 if ( key === "disabled" ) { 13620 return; 13621 } 13622 13623 this._super( key, value ); 13624 13625 if ( key === "appendTo" ) { 13626 this.uiDialog.appendTo( this._appendTo() ); 13627 } 13628 13629 if ( key === "buttons" ) { 13630 this._createButtons(); 13631 } 13632 13633 if ( key === "closeText" ) { 13634 this.uiDialogTitlebarClose.button( { 13635 13636 // Ensure that we always pass a string 13637 label: $( "<a>" ).text( "" + this.options.closeText ).html() 13638 } ); 13639 } 13640 13641 if ( key === "draggable" ) { 13642 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 13643 if ( isDraggable && !value ) { 13644 uiDialog.draggable( "destroy" ); 13645 } 13646 13647 if ( !isDraggable && value ) { 13648 this._makeDraggable(); 13649 } 13650 } 13651 13652 if ( key === "position" ) { 13653 this._position(); 13654 } 13655 13656 if ( key === "resizable" ) { 13657 13658 // currently resizable, becoming non-resizable 13659 isResizable = uiDialog.is( ":data(ui-resizable)" ); 13660 if ( isResizable && !value ) { 13661 uiDialog.resizable( "destroy" ); 13662 } 13663 13664 // Currently resizable, changing handles 13665 if ( isResizable && typeof value === "string" ) { 13666 uiDialog.resizable( "option", "handles", value ); 13667 } 13668 13669 // Currently non-resizable, becoming resizable 13670 if ( !isResizable && value !== false ) { 13671 this._makeResizable(); 13672 } 13673 } 13674 13675 if ( key === "title" ) { 13676 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 13677 } 13678 13679 if ( key === "modal" ) { 13680 uiDialog.attr( "aria-modal", value ? "true" : null ); 13681 } 13682 }, 13683 13684 _size: function() { 13685 13686 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 13687 // divs will both have width and height set, so we need to reset them 13688 var nonContentHeight, minContentHeight, maxContentHeight, 13689 options = this.options; 13690 13691 // Reset content sizing 13692 this.element.show().css( { 13693 width: "auto", 13694 minHeight: 0, 13695 maxHeight: "none", 13696 height: 0 13697 } ); 13698 13699 if ( options.minWidth > options.width ) { 13700 options.width = options.minWidth; 13701 } 13702 13703 // Reset wrapper sizing 13704 // determine the height of all the non-content elements 13705 nonContentHeight = this.uiDialog.css( { 13706 height: "auto", 13707 width: options.width 13708 } ) 13709 .outerHeight(); 13710 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 13711 maxContentHeight = typeof options.maxHeight === "number" ? 13712 Math.max( 0, options.maxHeight - nonContentHeight ) : 13713 "none"; 13714 13715 if ( options.height === "auto" ) { 13716 this.element.css( { 13717 minHeight: minContentHeight, 13718 maxHeight: maxContentHeight, 13719 height: "auto" 13720 } ); 13721 } else { 13722 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 13723 } 13724 13725 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 13726 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 13727 } 13728 }, 13729 13730 _blockFrames: function() { 13731 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 13732 var iframe = $( this ); 13733 13734 return $( "<div>" ) 13735 .css( { 13736 position: "absolute", 13737 width: iframe.outerWidth(), 13738 height: iframe.outerHeight() 13739 } ) 13740 .appendTo( iframe.parent() ) 13741 .offset( iframe.offset() )[ 0 ]; 13742 } ); 13743 }, 13744 13745 _unblockFrames: function() { 13746 if ( this.iframeBlocks ) { 13747 this.iframeBlocks.remove(); 13748 delete this.iframeBlocks; 13749 } 13750 }, 13751 13752 _allowInteraction: function( event ) { 13753 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 13754 return true; 13755 } 13756 13757 // TODO: Remove hack when datepicker implements 13758 // the .ui-front logic (#8989) 13759 return !!$( event.target ).closest( ".ui-datepicker" ).length; 13760 }, 13761 13762 _createOverlay: function() { 13763 if ( !this.options.modal ) { 13764 return; 13765 } 13766 13767 // We use a delay in case the overlay is created from an 13768 // event that we're going to be cancelling (#2804) 13769 var isOpening = true; 13770 this._delay( function() { 13771 isOpening = false; 13772 } ); 13773 13774 if ( !this.document.data( "ui-dialog-overlays" ) ) { 13775 13776 // Prevent use of anchors and inputs 13777 // This doesn't use `_on()` because it is a shared event handler 13778 // across all open modal dialogs. 13779 this.document.on( "focusin.ui-dialog", function( event ) { 13780 if ( isOpening ) { 13781 return; 13782 } 13783 13784 var instance = this._trackingInstances()[ 0 ]; 13785 if ( !instance._allowInteraction( event ) ) { 13786 event.preventDefault(); 13787 instance._focusTabbable(); 13788 } 13789 }.bind( this ) ); 13790 } 13791 13792 this.overlay = $( "<div>" ) 13793 .appendTo( this._appendTo() ); 13794 13795 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 13796 this._on( this.overlay, { 13797 mousedown: "_keepFocus" 13798 } ); 13799 this.document.data( "ui-dialog-overlays", 13800 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 13801 }, 13802 13803 _destroyOverlay: function() { 13804 if ( !this.options.modal ) { 13805 return; 13806 } 13807 13808 if ( this.overlay ) { 13809 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 13810 13811 if ( !overlays ) { 13812 this.document.off( "focusin.ui-dialog" ); 13813 this.document.removeData( "ui-dialog-overlays" ); 13814 } else { 13815 this.document.data( "ui-dialog-overlays", overlays ); 13816 } 13817 13818 this.overlay.remove(); 13819 this.overlay = null; 13820 } 13821 } 13822} ); 13823 13824// DEPRECATED 13825// TODO: switch return back to widget declaration at top of file when this is removed 13826if ( $.uiBackCompat === true ) { 13827 13828 // Backcompat for dialogClass option 13829 $.widget( "ui.dialog", $.ui.dialog, { 13830 options: { 13831 dialogClass: "" 13832 }, 13833 _createWrapper: function() { 13834 this._super(); 13835 this.uiDialog.addClass( this.options.dialogClass ); 13836 }, 13837 _setOption: function( key, value ) { 13838 if ( key === "dialogClass" ) { 13839 this.uiDialog 13840 .removeClass( this.options.dialogClass ) 13841 .addClass( value ); 13842 } 13843 this._superApply( arguments ); 13844 } 13845 } ); 13846} 13847
13848return $.ui.dialog; 13849 13850} ); 13851 13852 13853 13854 13855 13856/*! 13857 * jQuery UI Droppable 1.14.1 13858 * https://jqueryui.com 13859 * 13860 * Copyright OpenJS Foundation and other contributors 13861 * Released under the MIT license. 13862 * https://jquery.org/license 13863 */ 13864 13865//>>label: Droppable 13866//>>group: Interactions 13867//>>description: Enables drop targets for draggable elements. 13868//>>docs: https://api.jqueryui.com/droppable/ 13869//>>demos: https://jqueryui.com/droppable/ 13870 13871( function( factory ) { 13872 "use strict"; 13873 13874 if ( typeof define === "function" && define.amd ) { 13875 13876 // AMD. Register as an anonymous module. 13877 define( [ 13878 "jquery", 13879 "./draggable", 13880 "./mouse", 13881 "../version", 13882 "../widget" 13883 ], factory ); 13884 } else { 13885 13886 // Browser globals 13887 factory( jQuery ); 13888 } 13889} )( function( $ ) { 13890"use strict"; 13891 13892$.widget( "ui.droppable", { 13893 version: "1.14.1
vendor: 12,108 bytes, lines 13893-14355
13893", 13894 widgetEventPrefix: "drop", 13895 options: { 13896 accept: "*", 13897 addClasses: true, 13898 greedy: false, 13899 scope: "default", 13900 tolerance: "intersect", 13901 13902 // Callbacks 13903 activate: null, 13904 deactivate: null, 13905 drop: null, 13906 out: null, 13907 over: null 13908 }, 13909 _create: function() { 13910 13911 var proportions, 13912 o = this.options, 13913 accept = o.accept; 13914 13915 this.isover = false; 13916 this.isout = true; 13917 13918 this.accept = typeof accept === "function" ? accept : function( d ) { 13919 return d.is( accept ); 13920 }; 13921 13922 this.proportions = function( /* valueToWrite */ ) { 13923 if ( arguments.length ) { 13924 13925 // Store the droppable's proportions 13926 proportions = arguments[ 0 ]; 13927 } else { 13928 13929 // Retrieve or derive the droppable's proportions 13930 return proportions ? 13931 proportions : 13932 proportions = { 13933 width: this.element[ 0 ].offsetWidth, 13934 height: this.element[ 0 ].offsetHeight 13935 }; 13936 } 13937 }; 13938 13939 this._addToManager( o.scope ); 13940 13941 if ( o.addClasses ) { 13942 this._addClass( "ui-droppable" ); 13943 } 13944 13945 }, 13946 13947 _addToManager: function( scope ) { 13948 13949 // Add the reference and positions to the manager 13950 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 13951 $.ui.ddmanager.droppables[ scope ].push( this ); 13952 }, 13953 13954 _splice: function( drop ) { 13955 var i = 0; 13956 for ( ; i < drop.length; i++ ) { 13957 if ( drop[ i ] === this ) { 13958 drop.splice( i, 1 ); 13959 } 13960 } 13961 }, 13962 13963 _destroy: function() { 13964 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13965 13966 this._splice( drop ); 13967 }, 13968 13969 _setOption: function( key, value ) { 13970 13971 if ( key === "accept" ) { 13972 this.accept = typeof value === "function" ? value : function( d ) { 13973 return d.is( value ); 13974 }; 13975 } else if ( key === "scope" ) { 13976 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13977 13978 this._splice( drop ); 13979 this._addToManager( value ); 13980 } 13981 13982 this._super( key, value ); 13983 }, 13984 13985 _activate: function( event ) { 13986 var draggable = $.ui.ddmanager.current; 13987 13988 this._addActiveClass(); 13989 if ( draggable ) { 13990 this._trigger( "activate", event, this.ui( draggable ) ); 13991 } 13992 }, 13993 13994 _deactivate: function( event ) { 13995 var draggable = $.ui.ddmanager.current; 13996 13997 this._removeActiveClass(); 13998 if ( draggable ) { 13999 this._trigger( "deactivate", event, this.ui( draggable ) ); 14000 } 14001 }, 14002 14003 _over: function( event ) { 14004 14005 var draggable = $.ui.ddmanager.current; 14006 14007 // Bail if draggable and droppable are same element 14008 if ( !draggable || ( draggable.currentItem || 14009 draggable.element )[ 0 ] === this.element[ 0 ] ) { 14010 return; 14011 } 14012 14013 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 14014 draggable.element ) ) ) { 14015 this._addHoverClass(); 14016 this._trigger( "over", event, this.ui( draggable ) ); 14017 } 14018 14019 }, 14020 14021 _out: function( event ) { 14022 14023 var draggable = $.ui.ddmanager.current; 14024 14025 // Bail if draggable and droppable are same element 14026 if ( !draggable || ( draggable.currentItem || 14027 draggable.element )[ 0 ] === this.element[ 0 ] ) { 14028 return; 14029 } 14030 14031 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 14032 draggable.element ) ) ) { 14033 this._removeHoverClass(); 14034 this._trigger( "out", event, this.ui( draggable ) ); 14035 } 14036 14037 }, 14038 14039 _drop: function( event, custom ) { 14040 14041 var draggable = custom || $.ui.ddmanager.current, 14042 childrenIntersection = false; 14043 14044 // Bail if draggable and droppable are same element 14045 if ( !draggable || ( draggable.currentItem || 14046 draggable.element )[ 0 ] === this.element[ 0 ] ) { 14047 return false; 14048 } 14049 14050 this.element 14051 .find( ":data(ui-droppable)" ) 14052 .not( ".ui-draggable-dragging" ) 14053 .each( function() { 14054 var inst = $( this ).droppable( "instance" ); 14055 if ( 14056 inst.options.greedy && 14057 !inst.options.disabled && 14058 inst.options.scope === draggable.options.scope && 14059 inst.accept.call( 14060 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 14061 ) && 14062 $.ui.intersect( 14063 draggable, 14064 $.extend( inst, { offset: inst.element.offset() } ), 14065 inst.options.tolerance, event 14066 ) 14067 ) { 14068 childrenIntersection = true; 14069 return false; 14070 } 14071 } ); 14072 if ( childrenIntersection ) { 14073 return false; 14074 } 14075 14076 if ( this.accept.call( this.element[ 0 ], 14077 ( draggable.currentItem || draggable.element ) ) ) { 14078 this._removeActiveClass(); 14079 this._removeHoverClass(); 14080 14081 this._trigger( "drop", event, this.ui( draggable ) ); 14082 return this.element; 14083 } 14084 14085 return false; 14086 14087 }, 14088 14089 ui: function( c ) { 14090 return { 14091 draggable: ( c.currentItem || c.element ), 14092 helper: c.helper, 14093 position: c.position, 14094 offset: c.positionAbs 14095 }; 14096 }, 14097 14098 // Extension points just to make backcompat sane and avoid duplicating logic 14099 // TODO: Remove in 1.14 along with call to it below 14100 _addHoverClass: function() { 14101 this._addClass( "ui-droppable-hover" ); 14102 }, 14103 14104 _removeHoverClass: function() { 14105 this._removeClass( "ui-droppable-hover" ); 14106 }, 14107 14108 _addActiveClass: function() { 14109 this._addClass( "ui-droppable-active" ); 14110 }, 14111 14112 _removeActiveClass: function() { 14113 this._removeClass( "ui-droppable-active" ); 14114 } 14115} ); 14116 14117$.ui.intersect = ( function() { 14118 function isOverAxis( x, reference, size ) { 14119 return ( x >= reference ) && ( x < ( reference + size ) ); 14120 } 14121 14122 return function( draggable, droppable, toleranceMode, event ) { 14123 14124 if ( !droppable.offset ) { 14125 return false; 14126 } 14127 14128 var x1 = ( draggable.positionAbs || 14129 draggable.position.absolute ).left + draggable.margins.left, 14130 y1 = ( draggable.positionAbs || 14131 draggable.position.absolute ).top + draggable.margins.top, 14132 x2 = x1 + draggable.helperProportions.width, 14133 y2 = y1 + draggable.helperProportions.height, 14134 l = droppable.offset.left, 14135 t = droppable.offset.top, 14136 r = l + droppable.proportions().width, 14137 b = t + droppable.proportions().height; 14138 14139 switch ( toleranceMode ) { 14140 case "fit": 14141 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 14142 case "intersect": 14143 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 14144 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 14145 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 14146 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 14147 case "pointer": 14148 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 14149 isOverAxis( event.pageX, l, droppable.proportions().width ); 14150 case "touch": 14151 return ( 14152 ( y1 >= t && y1 <= b ) || // Top edge touching 14153 ( y2 >= t && y2 <= b ) || // Bottom edge touching 14154 ( y1 < t && y2 > b ) // Surrounded vertically 14155 ) && ( 14156 ( x1 >= l && x1 <= r ) || // Left edge touching 14157 ( x2 >= l && x2 <= r ) || // Right edge touching 14158 ( x1 < l && x2 > r ) // Surrounded horizontally 14159 ); 14160 default: 14161 return false; 14162 } 14163 }; 14164} )(); 14165 14166/* 14167 This manager tracks offsets of draggables and droppables 14168*/ 14169$.ui.ddmanager = { 14170 current: null, 14171 droppables: { "default": [] }, 14172 prepareOffsets: function( t, event ) { 14173 14174 var i, j, 14175 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 14176 type = event ? event.type : null, // workaround for #2317 14177 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 14178 14179 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 14180 14181 // No disabled and non-accepted 14182 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 14183 ( t.currentItem || t.element ) ) ) ) { 14184 continue; 14185 } 14186 14187 // Filter out elements in the current dragged item 14188 for ( j = 0; j < list.length; j++ ) { 14189 if ( list[ j ] === m[ i ].element[ 0 ] ) { 14190 m[ i ].proportions().height = 0; 14191 continue droppablesLoop; 14192 } 14193 } 14194 14195 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 14196 if ( !m[ i ].visible ) { 14197 continue; 14198 } 14199 14200 // Activate the droppable if used directly from draggables 14201 if ( type === "mousedown" ) { 14202 m[ i ]._activate.call( m[ i ], event ); 14203 } 14204 14205 m[ i ].offset = m[ i ].element.offset(); 14206 m[ i ].proportions( { 14207 width: m[ i ].element[ 0 ].offsetWidth, 14208 height: m[ i ].element[ 0 ].offsetHeight 14209 } ); 14210 14211 } 14212 14213 }, 14214 drop: function( draggable, event ) { 14215 14216 var dropped = false; 14217 14218 // Create a copy of the droppables in case the list changes during the drop (#9116) 14219 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 14220 14221 if ( !this.options ) { 14222 return; 14223 } 14224 if ( !this.options.disabled && this.visible && 14225 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { 14226 dropped = this._drop.call( this, event ) || dropped; 14227 } 14228 14229 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 14230 ( draggable.currentItem || draggable.element ) ) ) { 14231 this.isout = true; 14232 this.isover = false; 14233 this._deactivate.call( this, event ); 14234 } 14235 14236 } ); 14237 return dropped; 14238 14239 }, 14240 dragStart: function( draggable, event ) { 14241 14242 // Listen for scrolling so that if the dragging causes scrolling the position of the 14243 // droppables can be recalculated (see #5003) 14244 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 14245 if ( !draggable.options.refreshPositions ) { 14246 $.ui.ddmanager.prepareOffsets( draggable, event ); 14247 } 14248 } ); 14249 }, 14250 drag: function( draggable, event ) { 14251 14252 // If you have a highly dynamic page, you might try this option. It renders positions 14253 // every time you move the mouse. 14254 if ( draggable.options.refreshPositions ) { 14255 $.ui.ddmanager.prepareOffsets( draggable, event ); 14256 } 14257 14258 // Run through all droppables and check their positions based on specific tolerance options 14259 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 14260 14261 if ( this.options.disabled || this.greedyChild || !this.visible ) { 14262 return; 14263 } 14264 14265 var parentInstance, scope, parent, 14266 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), 14267 c = !intersects && this.isover ? 14268 "isout" : 14269 ( intersects && !this.isover ? "isover" : null ); 14270 if ( !c ) { 14271 return; 14272 } 14273 14274 if ( this.options.greedy ) { 14275 14276 // find droppable parents with same scope 14277 scope = this.options.scope; 14278 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 14279 return $( this ).droppable( "instance" ).options.scope === scope; 14280 } ); 14281 14282 if ( parent.length ) { 14283 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 14284 parentInstance.greedyChild = ( c === "isover" ); 14285 } 14286 } 14287 14288 // We just moved into a greedy child 14289 if ( parentInstance && c === "isover" ) { 14290 parentInstance.isover = false; 14291 parentInstance.isout = true; 14292 parentInstance._out.call( parentInstance, event ); 14293 } 14294 14295 this[ c ] = true; 14296 this[ c === "isout" ? "isover" : "isout" ] = false; 14297 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 14298 14299 // We just moved out of a greedy child 14300 if ( parentInstance && c === "isout" ) { 14301 parentInstance.isout = false; 14302 parentInstance.isover = true; 14303 parentInstance._over.call( parentInstance, event ); 14304 } 14305 } ); 14306 14307 }, 14308 dragStop: function( draggable, event ) { 14309 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 14310 14311 // Call prepareOffsets one final time since IE does not fire return scroll events when 14312 // overflow was caused by drag (see #5003) 14313 if ( !draggable.options.refreshPositions ) { 14314 $.ui.ddmanager.prepareOffsets( draggable, event ); 14315 } 14316 } 14317}; 14318 14319// DEPRECATED 14320// TODO: switch return back to widget declaration at top of file when this is removed 14321if ( $.uiBackCompat === true ) { 14322 14323 // Backcompat for activeClass and hoverClass options 14324 $.widget( "ui.droppable", $.ui.droppable, { 14325 options: { 14326 hoverClass: false, 14327 activeClass: false 14328 }, 14329 _addActiveClass: function() { 14330 this._super(); 14331 if ( this.options.activeClass ) { 14332 this.element.addClass( this.options.activeClass ); 14333 } 14334 }, 14335 _removeActiveClass: function() { 14336 this._super(); 14337 if ( this.options.activeClass ) { 14338 this.element.removeClass( this.options.activeClass ); 14339 } 14340 }, 14341 _addHoverClass: function() { 14342 this._super(); 14343 if ( this.options.hoverClass ) { 14344 this.element.addClass( this.options.hoverClass ); 14345 } 14346 }, 14347 _removeHoverClass: function() { 14348 this._super(); 14349 if ( this.options.hoverClass ) { 14350 this.element.removeClass( this.options.hoverClass ); 14351 } 14352 } 14353 } ); 14354} 14355
14356return $.ui.droppable; 14357 14358} ); 14359 14360 14361 14362/*! 14363 * jQuery UI Progressbar 1.14.1 14364 * https://jqueryui.com 14365 * 14366 * Copyright OpenJS Foundation and other contributors 14367 * Released under the MIT license. 14368 * https://jquery.org/license 14369 */ 14370 14371//>>label: Progressbar 14372//>>group: Widgets 14373/* eslint-disable max-len */ 14374//>>
vendor: 4,812 bytes, lines 14374-14584
14374description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 14375/* eslint-enable max-len */ 14376//>>docs: https://api.jqueryui.com/progressbar/ 14377//>>demos: https://jqueryui.com/progressbar/ 14378//>>css.structure: ../../themes/base/core.css 14379//>>css.structure: ../../themes/base/progressbar.css 14380//>>css.theme: ../../themes/base/theme.css 14381 14382( function( factory ) { 14383 "use strict"; 14384 14385 if ( typeof define === "function" && define.amd ) { 14386 14387 // AMD. Register as an anonymous module. 14388 define( [ 14389 "jquery", 14390 "../version", 14391 "../widget" 14392 ], factory ); 14393 } else { 14394 14395 // Browser globals 14396 factory( jQuery ); 14397 } 14398} )( function( $ ) { 14399"use strict"; 14400 14401return $.widget( "ui.progressbar", { 14402 version: "1.14.1", 14403 options: { 14404 classes: { 14405 "ui-progressbar": "ui-corner-all", 14406 "ui-progressbar-value": "ui-corner-left", 14407 "ui-progressbar-complete": "ui-corner-right" 14408 }, 14409 max: 100, 14410 value: 0, 14411 14412 change: null, 14413 complete: null 14414 }, 14415 14416 min: 0, 14417 14418 _create: function() { 14419 14420 // Constrain initial value 14421 this.oldValue = this.options.value = this._constrainedValue(); 14422 14423 this.element.attr( { 14424 14425 // Only set static values; aria-valuenow and aria-valuemax are 14426 // set inside _refreshValue() 14427 role: "progressbar", 14428 "aria-valuemin": this.min 14429 } ); 14430 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 14431 14432 this.valueDiv = $( "<div>" ).appendTo( this.element ); 14433 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 14434 this._refreshValue(); 14435 }, 14436 14437 _destroy: function() { 14438 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 14439 14440 this.valueDiv.remove(); 14441 }, 14442 14443 value: function( newValue ) { 14444 if ( newValue === undefined ) { 14445 return this.options.value; 14446 } 14447 14448 this.options.value = this._constrainedValue( newValue ); 14449 this._refreshValue(); 14450 }, 14451 14452 _constrainedValue: function( newValue ) { 14453 if ( newValue === undefined ) { 14454 newValue = this.options.value; 14455 } 14456 14457 this.indeterminate = newValue === false; 14458 14459 // Sanitize value 14460 if ( typeof newValue !== "number" ) { 14461 newValue = 0; 14462 } 14463 14464 return this.indeterminate ? false : 14465 Math.min( this.options.max, Math.max( this.min, newValue ) ); 14466 }, 14467 14468 _setOptions: function( options ) { 14469 14470 // Ensure "value" option is set after other values (like max) 14471 var value = options.value; 14472 delete options.value; 14473 14474 this._super( options ); 14475 14476 this.options.value = this._constrainedValue( value ); 14477 this._refreshValue(); 14478 }, 14479 14480 _setOption: function( key, value ) { 14481 if ( key === "max" ) { 14482 14483 // Don't allow a max less than min 14484 value = Math.max( this.min, value ); 14485 } 14486 this._super( key, value ); 14487 }, 14488 14489 _setOptionDisabled: function( value ) { 14490 this._super( value ); 14491 14492 this.element.attr( "aria-disabled", value ); 14493 this._toggleClass( null, "ui-state-disabled", !!value ); 14494 }, 14495 14496 _percentage: function() { 14497 return this.indeterminate ? 14498 100 : 14499 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 14500 }, 14501 14502 _refreshValue: function() { 14503 var value = this.options.value, 14504 percentage = this._percentage(); 14505 14506 this.valueDiv 14507 .toggle( this.indeterminate || value > this.min ) 14508 .width( percentage.toFixed( 0 ) + "%" ); 14509 14510 this 14511 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 14512 value === this.options.max ) 14513 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 14514 14515 if ( this.indeterminate ) { 14516 this.element.removeAttr( "aria-valuenow" ); 14517 if ( !this.overlayDiv ) { 14518 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 14519 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 14520 } 14521 } else { 14522 this.element.attr( { 14523 "aria-valuemax": this.options.max, 14524 "aria-valuenow": value 14525 } ); 14526 if ( this.overlayDiv ) { 14527 this.overlayDiv.remove(); 14528 this.overlayDiv = null; 14529 } 14530 } 14531 14532 if ( this.oldValue !== value ) { 14533 this.oldValue = value; 14534 this._trigger( "change" ); 14535 } 14536 if ( value === this.options.max ) { 14537 this._trigger( "complete" ); 14538 } 14539 } 14540} ); 14541 14542} ); 14543 14544 14545 14546 14547/*! 14548 * jQuery UI Selectable 1.14.1 14549 * https://jqueryui.com 14550 * 14551 * Copyright OpenJS Foundation and other contributors 14552 * Released under the MIT license. 14553 * https://jquery.org/license 14554 */ 14555 14556//>>label: Selectable 14557//>>group: Interactions 14558//>>description: Allows groups of elements to be selected with the mouse. 14559//>>docs: https://api.jqueryui.com/selectable/ 14560//>>demos: https://jqueryui.com/selectable/ 14561//>>css.structure: ../../themes/base/selectable.css 14562 14563( function( factory ) { 14564 "use strict"; 14565 14566 if ( typeof define === "function" && define.amd ) { 14567 14568 // AMD. Register as an anonymous module. 14569 define( [ 14570 "jquery", 14571 "./mouse", 14572 "../version", 14573 "../widget" 14574 ], factory ); 14575 } else { 14576 14577 // Browser globals 14578 factory( jQuery ); 14579 } 14580} )( function( $ ) { 14581"use strict"; 14582 14583return $.widget( "ui.selectable", $.ui.mouse, { 14584 version: "1.14.1
vendor: 7,293 bytes, lines 14584-14862
14584", 14585 options: { 14586 appendTo: "body", 14587 autoRefresh: true, 14588 distance: 0, 14589 filter: "*", 14590 tolerance: "touch", 14591 14592 // Callbacks 14593 selected: null, 14594 selecting: null, 14595 start: null, 14596 stop: null, 14597 unselected: null, 14598 unselecting: null 14599 }, 14600 _create: function() { 14601 var that = this; 14602 14603 this._addClass( "ui-selectable" ); 14604 14605 this.dragged = false; 14606 14607 // Cache selectee children based on filter 14608 this.refresh = function() { 14609 that.elementPos = $( that.element[ 0 ] ).offset(); 14610 that.selectees = $( that.options.filter, that.element[ 0 ] ); 14611 that._addClass( that.selectees, "ui-selectee" ); 14612 that.selectees.each( function() { 14613 var $this = $( this ), 14614 selecteeOffset = $this.offset(), 14615 pos = { 14616 left: selecteeOffset.left - that.elementPos.left, 14617 top: selecteeOffset.top - that.elementPos.top 14618 }; 14619 $.data( this, "selectable-item", { 14620 element: this, 14621 $element: $this, 14622 left: pos.left, 14623 top: pos.top, 14624 right: pos.left + $this.outerWidth(), 14625 bottom: pos.top + $this.outerHeight(), 14626 startselected: false, 14627 selected: $this.hasClass( "ui-selected" ), 14628 selecting: $this.hasClass( "ui-selecting" ), 14629 unselecting: $this.hasClass( "ui-unselecting" ) 14630 } ); 14631 } ); 14632 }; 14633 this.refresh(); 14634 14635 this._mouseInit(); 14636 14637 this.helper = $( "<div>" ); 14638 this._addClass( this.helper, "ui-selectable-helper" ); 14639 }, 14640 14641 _destroy: function() { 14642 this.selectees.removeData( "selectable-item" ); 14643 this._mouseDestroy(); 14644 }, 14645 14646 _mouseStart: function( event ) { 14647 var that = this, 14648 options = this.options; 14649 14650 this.opos = [ event.pageX, event.pageY ]; 14651 this.elementPos = $( this.element[ 0 ] ).offset(); 14652 14653 if ( this.options.disabled ) { 14654 return; 14655 } 14656 14657 this.selectees = $( options.filter, this.element[ 0 ] ); 14658 14659 this._trigger( "start", event ); 14660 14661 $( options.appendTo ).append( this.helper ); 14662 14663 // position helper (lasso) 14664 this.helper.css( { 14665 "left": event.pageX, 14666 "top": event.pageY, 14667 "width": 0, 14668 "height": 0 14669 } ); 14670 14671 if ( options.autoRefresh ) { 14672 this.refresh(); 14673 } 14674 14675 this.selectees.filter( ".ui-selected" ).each( function() { 14676 var selectee = $.data( this, "selectable-item" ); 14677 selectee.startselected = true; 14678 if ( !event.metaKey && !event.ctrlKey ) { 14679 that._removeClass( selectee.$element, "ui-selected" ); 14680 selectee.selected = false; 14681 that._addClass( selectee.$element, "ui-unselecting" ); 14682 selectee.unselecting = true; 14683 14684 // selectable UNSELECTING callback 14685 that._trigger( "unselecting", event, { 14686 unselecting: selectee.element 14687 } ); 14688 } 14689 } ); 14690 14691 $( event.target ).parents().addBack().each( function() { 14692 var doSelect, 14693 selectee = $.data( this, "selectable-item" ); 14694 if ( selectee ) { 14695 doSelect = ( !event.metaKey && !event.ctrlKey ) || 14696 !selectee.$element.hasClass( "ui-selected" ); 14697 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 14698 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 14699 selectee.unselecting = !doSelect; 14700 selectee.selecting = doSelect; 14701 selectee.selected = doSelect; 14702 14703 // selectable (UN)SELECTING callback 14704 if ( doSelect ) { 14705 that._trigger( "selecting", event, { 14706 selecting: selectee.element 14707 } ); 14708 } else { 14709 that._trigger( "unselecting", event, { 14710 unselecting: selectee.element 14711 } ); 14712 } 14713 return false; 14714 } 14715 } ); 14716 14717 }, 14718 14719 _mouseDrag: function( event ) { 14720 14721 this.dragged = true; 14722 14723 if ( this.options.disabled ) { 14724 return; 14725 } 14726 14727 var tmp, 14728 that = this, 14729 options = this.options, 14730 x1 = this.opos[ 0 ], 14731 y1 = this.opos[ 1 ], 14732 x2 = event.pageX, 14733 y2 = event.pageY; 14734 14735 if ( x1 > x2 ) { 14736 tmp = x2; x2 = x1; x1 = tmp; 14737 } 14738 if ( y1 > y2 ) { 14739 tmp = y2; y2 = y1; y1 = tmp; 14740 } 14741 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 14742 14743 this.selectees.each( function() { 14744 var selectee = $.data( this, "selectable-item" ), 14745 hit = false, 14746 offset = {}; 14747 14748 //prevent helper from being selected if appendTo: selectable 14749 if ( !selectee || selectee.element === that.element[ 0 ] ) { 14750 return; 14751 } 14752 14753 offset.left = selectee.left + that.elementPos.left; 14754 offset.right = selectee.right + that.elementPos.left; 14755 offset.top = selectee.top + that.elementPos.top; 14756 offset.bottom = selectee.bottom + that.elementPos.top; 14757 14758 if ( options.tolerance === "touch" ) { 14759 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 14760 offset.bottom < y1 ) ); 14761 } else if ( options.tolerance === "fit" ) { 14762 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 14763 offset.bottom < y2 ); 14764 } 14765 14766 if ( hit ) { 14767 14768 // SELECT 14769 if ( selectee.selected ) { 14770 that._removeClass( selectee.$element, "ui-selected" ); 14771 selectee.selected = false; 14772 } 14773 if ( selectee.unselecting ) { 14774 that._removeClass( selectee.$element, "ui-unselecting" ); 14775 selectee.unselecting = false; 14776 } 14777 if ( !selectee.selecting ) { 14778 that._addClass( selectee.$element, "ui-selecting" ); 14779 selectee.selecting = true; 14780 14781 // selectable SELECTING callback 14782 that._trigger( "selecting", event, { 14783 selecting: selectee.element 14784 } ); 14785 } 14786 } else { 14787 14788 // UNSELECT 14789 if ( selectee.selecting ) { 14790 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 14791 that._removeClass( selectee.$element, "ui-selecting" ); 14792 selectee.selecting = false; 14793 that._addClass( selectee.$element, "ui-selected" ); 14794 selectee.selected = true; 14795 } else { 14796 that._removeClass( selectee.$element, "ui-selecting" ); 14797 selectee.selecting = false; 14798 if ( selectee.startselected ) { 14799 that._addClass( selectee.$element, "ui-unselecting" ); 14800 selectee.unselecting = true; 14801 } 14802 14803 // selectable UNSELECTING callback 14804 that._trigger( "unselecting", event, { 14805 unselecting: selectee.element 14806 } ); 14807 } 14808 } 14809 if ( selectee.selected ) { 14810 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 14811 that._removeClass( selectee.$element, "ui-selected" ); 14812 selectee.selected = false; 14813 14814 that._addClass( selectee.$element, "ui-unselecting" ); 14815 selectee.unselecting = true; 14816 14817 // selectable UNSELECTING callback 14818 that._trigger( "unselecting", event, { 14819 unselecting: selectee.element 14820 } ); 14821 } 14822 } 14823 } 14824 } ); 14825 14826 return false; 14827 }, 14828 14829 _mouseStop: function( event ) { 14830 var that = this; 14831 14832 this.dragged = false; 14833 14834 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 14835 var selectee = $.data( this, "selectable-item" ); 14836 that._removeClass( selectee.$element, "ui-unselecting" ); 14837 selectee.unselecting = false; 14838 selectee.startselected = false; 14839 that._trigger( "unselected", event, { 14840 unselected: selectee.element 14841 } ); 14842 } ); 14843 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 14844 var selectee = $.data( this, "selectable-item" ); 14845 that._removeClass( selectee.$element, "ui-selecting" ) 14846 ._addClass( selectee.$element, "ui-selected" ); 14847 selectee.selecting = false; 14848 selectee.selected = true; 14849 selectee.startselected = true; 14850 that._trigger( "selected", event, { 14851 selected: selectee.element 14852 } ); 14853 } ); 14854 this._trigger( "stop", event ); 14855 14856 this.helper.remove(); 14857 14858 return false; 14859 } 14860 14861} ); 14862
vendor: 36,148 bytes, lines 14863-16344
14863} ); 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873/*! 14874 * jQuery UI Selectmenu 1.14.1 14875 * https://jqueryui.com 14876 * 14877 * Copyright OpenJS Foundation and other contributors 14878 * Released under the MIT license. 14879 * https://jquery.org/license 14880 */ 14881 14882//>>label: Selectmenu 14883//>>group: Widgets 14884/* eslint-disable max-len */ 14885//>>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. 14886/* eslint-enable max-len */ 14887//>>docs: https://api.jqueryui.com/selectmenu/ 14888//>>demos: https://jqueryui.com/selectmenu/ 14889//>>css.structure: ../../themes/base/core.css 14890//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 14891//>>css.theme: ../../themes/base/theme.css 14892 14893( function( factory ) { 14894 "use strict"; 14895 14896 if ( typeof define === "function" && define.amd ) { 14897 14898 // AMD. Register as an anonymous module. 14899 define( [ 14900 "jquery", 14901 "./menu", 14902 "../form-reset-mixin", 14903 "../keycode", 14904 "../labels", 14905 "../position", 14906 "../unique-id", 14907 "../version", 14908 "../widget" 14909 ], factory ); 14910 } else { 14911 14912 // Browser globals 14913 factory( jQuery ); 14914 } 14915} )( function( $ ) { 14916"use strict"; 14917 14918return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 14919 version: "1.14.1", 14920 defaultElement: "<select>", 14921 options: { 14922 appendTo: null, 14923 classes: { 14924 "ui-selectmenu-button-open": "ui-corner-top", 14925 "ui-selectmenu-button-closed": "ui-corner-all" 14926 }, 14927 disabled: null, 14928 icons: { 14929 button: "ui-icon-triangle-1-s" 14930 }, 14931 position: { 14932 my: "left top", 14933 at: "left bottom", 14934 collision: "none" 14935 }, 14936 width: false, 14937 14938 // Callbacks 14939 change: null, 14940 close: null, 14941 focus: null, 14942 open: null, 14943 select: null 14944 }, 14945 14946 _create: function() { 14947 var selectmenuId = this.element.uniqueId().attr( "id" ); 14948 this.ids = { 14949 element: selectmenuId, 14950 button: selectmenuId + "-button", 14951 menu: selectmenuId + "-menu" 14952 }; 14953 14954 this._drawButton(); 14955 this._drawMenu(); 14956 this._bindFormResetHandler(); 14957 14958 this._rendered = false; 14959 this.menuItems = $(); 14960 }, 14961 14962 _drawButton: function() { 14963 var icon, 14964 that = this, 14965 item = this._parseOption( 14966 this.element.find( "option:selected" ), 14967 this.element[ 0 ].selectedIndex 14968 ); 14969 14970 // Associate existing label with the new button 14971 this.labels = this.element.labels().attr( "for", this.ids.button ); 14972 this._on( this.labels, { 14973 click: function( event ) { 14974 this.button.trigger( "focus" ); 14975 event.preventDefault(); 14976 } 14977 } ); 14978 14979 // Hide original select element 14980 this.element.hide(); 14981 14982 // Create button 14983 this.button = $( "<span>", { 14984 tabindex: this.options.disabled ? -1 : 0, 14985 id: this.ids.button, 14986 role: "combobox", 14987 "aria-expanded": "false", 14988 "aria-autocomplete": "list", 14989 "aria-owns": this.ids.menu, 14990 "aria-haspopup": "true", 14991 title: this.element.attr( "title" ) 14992 } ) 14993 .insertAfter( this.element ); 14994 14995 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 14996 "ui-button ui-widget" ); 14997 14998 icon = $( "<span>" ).appendTo( this.button ); 14999 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 15000 this.buttonItem = this._renderButtonItem( item ) 15001 .appendTo( this.button ); 15002 15003 if ( this.options.width !== false ) { 15004 this._resizeButton(); 15005 } 15006 15007 this._on( this.button, this._buttonEvents ); 15008 this.button.one( "focusin", function() { 15009 15010 // Delay rendering the menu items until the button receives focus. 15011 // The menu may have already been rendered via a programmatic open. 15012 if ( !that._rendered ) { 15013 that._refreshMenu(); 15014 } 15015 } ); 15016 }, 15017 15018 _drawMenu: function() { 15019 var that = this; 15020 15021 // Create menu 15022 this.menu = $( "<ul>", { 15023 "aria-hidden": "true", 15024 "aria-labelledby": this.ids.button, 15025 id: this.ids.menu 15026 } ); 15027 15028 // Wrap menu 15029 this.menuWrap = $( "<div>" ).append( this.menu ); 15030 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 15031 this.menuWrap.appendTo( this._appendTo() ); 15032 15033 // Initialize menu widget 15034 this.menuInstance = this.menu 15035 .menu( { 15036 classes: { 15037 "ui-menu": "ui-corner-bottom" 15038 }, 15039 role: "listbox", 15040 select: function( event, ui ) { 15041 event.preventDefault(); 15042 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 15043 }, 15044 focus: function( event, ui ) { 15045 var item = ui.item.data( "ui-selectmenu-item" ); 15046 15047 // Prevent inital focus from firing and check if its a newly focused item 15048 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 15049 that._trigger( "focus", event, { item: item } ); 15050 if ( !that.isOpen ) { 15051 that._select( item, event ); 15052 } 15053 } 15054 that.focusIndex = item.index; 15055 15056 that.button.attr( "aria-activedescendant", 15057 that.menuItems.eq( item.index ).attr( "id" ) ); 15058 } 15059 } ) 15060 .menu( "instance" ); 15061 15062 // Don't close the menu on mouseleave 15063 this.menuInstance._off( this.menu, "mouseleave" ); 15064 15065 // Cancel the menu's collapseAll on document click 15066 this.menuInstance._closeOnDocumentClick = function() { 15067 return false; 15068 }; 15069 15070 // Selects often contain empty items, but never contain dividers 15071 this.menuInstance._isDivider = function() { 15072 return false; 15073 }; 15074 }, 15075 15076 refresh: function() { 15077 this._refreshMenu(); 15078 this.buttonItem.replaceWith( 15079 this.buttonItem = this._renderButtonItem( 15080 15081 // Fall back to an empty object in case there are no options 15082 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 15083 ) 15084 ); 15085 if ( this.options.width === null ) { 15086 this._resizeButton(); 15087 } 15088 }, 15089 15090 _refreshMenu: function() { 15091 var item, 15092 options = this.element.find( "option" ); 15093 15094 this.menu.empty(); 15095 15096 this._parseOptions( options ); 15097 this._renderMenu( this.menu, this.items ); 15098 15099 this.menuInstance.refresh(); 15100 this.menuItems = this.menu.find( "li" ) 15101 .not( ".ui-selectmenu-optgroup" ) 15102 .find( ".ui-menu-item-wrapper" ); 15103 15104 this._rendered = true; 15105 15106 if ( !options.length ) { 15107 return; 15108 } 15109 15110 item = this._getSelectedItem(); 15111 15112 // Update the menu to have the correct item focused 15113 this.menuInstance.focus( null, item ); 15114 this._setAria( item.data( "ui-selectmenu-item" ) ); 15115 15116 // Set disabled state 15117 this._setOption( "disabled", this.element.prop( "disabled" ) ); 15118 }, 15119 15120 open: function( event ) { 15121 if ( this.options.disabled ) { 15122 return; 15123 } 15124 15125 // If this is the first time the menu is being opened, render the items 15126 if ( !this._rendered ) { 15127 this._refreshMenu(); 15128 } else { 15129 15130 // Menu clears focus on close, reset focus to selected item 15131 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 15132 this.menuInstance.focus( null, this._getSelectedItem() ); 15133 } 15134 15135 // If there are no options, don't open the menu 15136 if ( !this.menuItems.length ) { 15137 return; 15138 } 15139 15140 this.isOpen = true; 15141 this._toggleAttr(); 15142 this._resizeMenu(); 15143 this._position(); 15144 15145 this._on( this.document, this._documentClick ); 15146 15147 this._trigger( "open", event ); 15148 }, 15149 15150 _position: function() { 15151 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 15152 }, 15153 15154 close: function( event ) { 15155 if ( !this.isOpen ) { 15156 return; 15157 } 15158 15159 this.isOpen = false; 15160 this._toggleAttr(); 15161 15162 this.range = null; 15163 this._off( this.document ); 15164 15165 this._trigger( "close", event ); 15166 }, 15167 15168 widget: function() { 15169 return this.button; 15170 }, 15171 15172 menuWidget: function() { 15173 return this.menu; 15174 }, 15175 15176 _renderButtonItem: function( item ) { 15177 var buttonItem = $( "<span>" ); 15178 15179 this._setText( buttonItem, item.label ); 15180 this._addClass( buttonItem, "ui-selectmenu-text" ); 15181 15182 return buttonItem; 15183 }, 15184 15185 _renderMenu: function( ul, items ) { 15186 var that = this, 15187 currentOptgroup = ""; 15188 15189 $.each( items, function( index, item ) { 15190 var li; 15191 15192 if ( item.optgroup !== currentOptgroup ) { 15193 li = $( "<li>", { 15194 text: item.optgroup 15195 } ); 15196 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 15197 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 15198 " ui-state-disabled" : 15199 "" ) ); 15200 15201 li.appendTo( ul ); 15202 15203 currentOptgroup = item.optgroup; 15204 } 15205 15206 that._renderItemData( ul, item ); 15207 } ); 15208 }, 15209 15210 _renderItemData: function( ul, item ) { 15211 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 15212 }, 15213 15214 _renderItem: function( ul, item ) { 15215 var li = $( "<li>" ), 15216 wrapper = $( "<div>", { 15217 title: item.element.attr( "title" ) 15218 } ); 15219 15220 if ( item.disabled ) { 15221 this._addClass( li, null, "ui-state-disabled" ); 15222 } 15223 15224 if ( item.hidden ) { 15225 li.prop( "hidden", true ); 15226 } else { 15227 this._setText( wrapper, item.label ); 15228 } 15229 15230 return li.append( wrapper ).appendTo( ul ); 15231 }, 15232 15233 _setText: function( element, value ) { 15234 if ( value ) { 15235 element.text( value ); 15236 } else { 15237 element.html( " " ); 15238 } 15239 }, 15240 15241 _move: function( direction, event ) { 15242 var item, next, 15243 filter = ".ui-menu-item"; 15244 15245 if ( this.isOpen ) { 15246 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 15247 } else { 15248 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 15249 filter += ":not(.ui-state-disabled)"; 15250 } 15251 15252 if ( direction === "first" || direction === "last" ) { 15253 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 15254 } else { 15255 next = item[ direction + "All" ]( filter ).eq( 0 ); 15256 } 15257 15258 if ( next.length ) { 15259 this.menuInstance.focus( event, next ); 15260 } 15261 }, 15262 15263 _getSelectedItem: function() { 15264 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 15265 }, 15266 15267 _toggle: function( event ) { 15268 this[ this.isOpen ? "close" : "open" ]( event ); 15269 }, 15270 15271 _setSelection: function() { 15272 var selection; 15273 15274 if ( !this.range ) { 15275 return; 15276 } 15277 15278 selection = window.getSelection(); 15279 selection.removeAllRanges(); 15280 selection.addRange( this.range ); 15281 }, 15282 15283 _documentClick: { 15284 mousedown: function( event ) { 15285 if ( !this.isOpen ) { 15286 return; 15287 } 15288 15289 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 15290 CSS.escape( this.ids.button ) ).length ) { 15291 this.close( event ); 15292 } 15293 } 15294 }, 15295 15296 _buttonEvents: { 15297 15298 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 15299 mousedown: function() { 15300 var selection = window.getSelection(); 15301 if ( selection.rangeCount ) { 15302 this.range = selection.getRangeAt( 0 ); 15303 } 15304 }, 15305 15306 click: function( event ) { 15307 this._setSelection(); 15308 this._toggle( event ); 15309 }, 15310 15311 keydown: function( event ) { 15312 var preventDefault = true; 15313 switch ( event.keyCode ) { 15314 case $.ui.keyCode.TAB: 15315 case $.ui.keyCode.ESCAPE: 15316 this.close( event ); 15317 preventDefault = false; 15318 break; 15319 case $.ui.keyCode.ENTER: 15320 if ( this.isOpen ) { 15321 this._selectFocusedItem( event ); 15322 } 15323 break; 15324 case $.ui.keyCode.UP: 15325 if ( event.altKey ) { 15326 this._toggle( event ); 15327 } else { 15328 this._move( "prev", event ); 15329 } 15330 break; 15331 case $.ui.keyCode.DOWN: 15332 if ( event.altKey ) { 15333 this._toggle( event ); 15334 } else { 15335 this._move( "next", event ); 15336 } 15337 break; 15338 case $.ui.keyCode.SPACE: 15339 if ( this.isOpen ) { 15340 this._selectFocusedItem( event ); 15341 } else { 15342 this._toggle( event ); 15343 } 15344 break; 15345 case $.ui.keyCode.LEFT: 15346 this._move( "prev", event ); 15347 break; 15348 case $.ui.keyCode.RIGHT: 15349 this._move( "next", event ); 15350 break; 15351 case $.ui.keyCode.HOME: 15352 case $.ui.keyCode.PAGE_UP: 15353 this._move( "first", event ); 15354 break; 15355 case $.ui.keyCode.END: 15356 case $.ui.keyCode.PAGE_DOWN: 15357 this._move( "last", event ); 15358 break; 15359 default: 15360 this.menu.trigger( event ); 15361 preventDefault = false; 15362 } 15363 15364 if ( preventDefault ) { 15365 event.preventDefault(); 15366 } 15367 } 15368 }, 15369 15370 _selectFocusedItem: function( event ) { 15371 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 15372 if ( !item.hasClass( "ui-state-disabled" ) ) { 15373 this._select( item.data( "ui-selectmenu-item" ), event ); 15374 } 15375 }, 15376 15377 _select: function( item, event ) { 15378 var oldIndex = this.element[ 0 ].selectedIndex; 15379 15380 // Change native select element 15381 this.element[ 0 ].selectedIndex = item.index; 15382 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 15383 this._setAria( item ); 15384 this._trigger( "select", event, { item: item } ); 15385 15386 if ( item.index !== oldIndex ) { 15387 this._trigger( "change", event, { item: item } ); 15388 } 15389 15390 this.close( event ); 15391 }, 15392 15393 _setAria: function( item ) { 15394 var id = this.menuItems.eq( item.index ).attr( "id" ); 15395 15396 this.button.attr( { 15397 "aria-labelledby": id, 15398 "aria-activedescendant": id 15399 } ); 15400 this.menu.attr( "aria-activedescendant", id ); 15401 }, 15402 15403 _setOption: function( key, value ) { 15404 if ( key === "icons" ) { 15405 var icon = this.button.find( "span.ui-icon" ); 15406 this._removeClass( icon, null, this.options.icons.button ) 15407 ._addClass( icon, null, value.button ); 15408 } 15409 15410 this._super( key, value ); 15411 15412 if ( key === "appendTo" ) { 15413 this.menuWrap.appendTo( this._appendTo() ); 15414 } 15415 15416 if ( key === "width" ) { 15417 this._resizeButton(); 15418 } 15419 }, 15420 15421 _setOptionDisabled: function( value ) { 15422 this._super( value ); 15423 15424 this.menuInstance.option( "disabled", value ); 15425 this.button.attr( "aria-disabled", value ); 15426 this._toggleClass( this.button, null, "ui-state-disabled", value ); 15427 15428 this.element.prop( "disabled", value ); 15429 if ( value ) { 15430 this.button.attr( "tabindex", -1 ); 15431 this.close(); 15432 } else { 15433 this.button.attr( "tabindex", 0 ); 15434 } 15435 }, 15436 15437 _appendTo: function() { 15438 var element = this.options.appendTo; 15439 15440 if ( element ) { 15441 element = element.jquery || element.nodeType ? 15442 $( element ) : 15443 this.document.find( element ).eq( 0 ); 15444 } 15445 15446 if ( !element || !element[ 0 ] ) { 15447 element = this.element.closest( ".ui-front, dialog" ); 15448 } 15449 15450 if ( !element.length ) { 15451 element = this.document[ 0 ].body; 15452 } 15453 15454 return element; 15455 }, 15456 15457 _toggleAttr: function() { 15458 this.button.attr( "aria-expanded", this.isOpen ); 15459 15460 // We can't use two _toggleClass() calls here, because we need to make sure 15461 // we always remove classes first and add them second, otherwise if both classes have the 15462 // same theme class, it will be removed after we add it. 15463 this._removeClass( this.button, "ui-selectmenu-button-" + 15464 ( this.isOpen ? "closed" : "open" ) ) 15465 ._addClass( this.button, "ui-selectmenu-button-" + 15466 ( this.isOpen ? "open" : "closed" ) ) 15467 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 15468 15469 this.menu.attr( "aria-hidden", !this.isOpen ); 15470 }, 15471 15472 _resizeButton: function() { 15473 var width = this.options.width; 15474 15475 // For `width: false`, just remove inline style and stop 15476 if ( width === false ) { 15477 this.button.css( "width", "" ); 15478 return; 15479 } 15480 15481 // For `width: null`, match the width of the original element 15482 if ( width === null ) { 15483 width = this.element.show().outerWidth(); 15484 this.element.hide(); 15485 } 15486 15487 this.button.outerWidth( width ); 15488 }, 15489 15490 _resizeMenu: function() { 15491 this.menu.outerWidth( Math.max( 15492 this.button.outerWidth(), 15493 this.menu.width( "" ).outerWidth() 15494 ) ); 15495 }, 15496 15497 _getCreateOptions: function() { 15498 var options = this._super(); 15499 15500 options.disabled = this.element.prop( "disabled" ); 15501 15502 return options; 15503 }, 15504 15505 _parseOptions: function( options ) { 15506 var that = this, 15507 data = []; 15508 options.each( function( index, item ) { 15509 data.push( that._parseOption( $( item ), index ) ); 15510 } ); 15511 this.items = data; 15512 }, 15513 15514 _parseOption: function( option, index ) { 15515 var optgroup = option.parent( "optgroup" ); 15516 15517 return { 15518 element: option, 15519 index: index, 15520 value: option.val(), 15521 label: option.text(), 15522 hidden: optgroup.prop( "hidden" ) || option.prop( "hidden" ), 15523 optgroup: optgroup.attr( "label" ) || "", 15524 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 15525 }; 15526 }, 15527 15528 _destroy: function() { 15529 this._unbindFormResetHandler(); 15530 this.menuWrap.remove(); 15531 this.button.remove(); 15532 this.element.show(); 15533 this.element.removeUniqueId(); 15534 this.labels.attr( "for", this.ids.element ); 15535 } 15536} ] ); 15537 15538} ); 15539 15540 15541 15542 15543 15544/*! 15545 * jQuery UI Slider 1.14.1 15546 * https://jqueryui.com 15547 * 15548 * Copyright OpenJS Foundation and other contributors 15549 * Released under the MIT license. 15550 * https://jquery.org/license 15551 */ 15552 15553//>>label: Slider 15554//>>group: Widgets 15555//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 15556//>>docs: https://api.jqueryui.com/slider/ 15557//>>demos: https://jqueryui.com/slider/ 15558//>>css.structure: ../../themes/base/core.css 15559//>>css.structure: ../../themes/base/slider.css 15560//>>css.theme: ../../themes/base/theme.css 15561 15562( function( factory ) { 15563 "use strict"; 15564 15565 if ( typeof define === "function" && define.amd ) { 15566 15567 // AMD. Register as an anonymous module. 15568 define( [ 15569 "jquery", 15570 "./mouse", 15571 "../keycode", 15572 "../version", 15573 "../widget" 15574 ], factory ); 15575 } else { 15576 15577 // Browser globals 15578 factory( jQuery ); 15579 } 15580} )( function( $ ) { 15581"use strict"; 15582 15583return $.widget( "ui.slider", $.ui.mouse, { 15584 version: "1.14.1", 15585 widgetEventPrefix: "slide", 15586 15587 options: { 15588 animate: false, 15589 classes: { 15590 "ui-slider": "ui-corner-all", 15591 "ui-slider-handle": "ui-corner-all", 15592 15593 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 15594 // element, but worked best visually with a variety of themes 15595 "ui-slider-range": "ui-corner-all ui-widget-header" 15596 }, 15597 distance: 0, 15598 max: 100, 15599 min: 0, 15600 orientation: "horizontal", 15601 range: false, 15602 step: 1, 15603 value: 0, 15604 values: null, 15605 15606 // Callbacks 15607 change: null, 15608 slide: null, 15609 start: null, 15610 stop: null 15611 }, 15612 15613 // Number of pages in a slider 15614 // (how many times can you page up/down to go through the whole range) 15615 numPages: 5, 15616 15617 _create: function() { 15618 this._keySliding = false; 15619 this._mouseSliding = false; 15620 this._animateOff = true; 15621 this._handleIndex = null; 15622 this._detectOrientation(); 15623 this._mouseInit(); 15624 this._calculateNewMax(); 15625 15626 this._addClass( "ui-slider ui-slider-" + this.orientation, 15627 "ui-widget ui-widget-content" ); 15628 15629 this._refresh(); 15630 15631 this._animateOff = false; 15632 }, 15633 15634 _refresh: function() { 15635 this._createRange(); 15636 this._createHandles(); 15637 this._setupEvents(); 15638 this._refreshValue(); 15639 }, 15640 15641 _createHandles: function() { 15642 var i, handleCount, 15643 options = this.options, 15644 existingHandles = this.element.find( ".ui-slider-handle" ), 15645 handle = "<span tabindex='0'></span>", 15646 handles = []; 15647 15648 handleCount = ( options.values && options.values.length ) || 1; 15649 15650 if ( existingHandles.length > handleCount ) { 15651 existingHandles.slice( handleCount ).remove(); 15652 existingHandles = existingHandles.slice( 0, handleCount ); 15653 } 15654 15655 for ( i = existingHandles.length; i < handleCount; i++ ) { 15656 handles.push( handle ); 15657 } 15658 15659 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 15660 15661 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 15662 15663 this.handle = this.handles.eq( 0 ); 15664 15665 this.handles.each( function( i ) { 15666 $( this ) 15667 .data( "ui-slider-handle-index", i ) 15668 .attr( "tabIndex", 0 ); 15669 } ); 15670 }, 15671 15672 _createRange: function() { 15673 var options = this.options; 15674 15675 if ( options.range ) { 15676 if ( options.range === true ) { 15677 if ( !options.values ) { 15678 options.values = [ this._valueMin(), this._valueMin() ]; 15679 } else if ( options.values.length && options.values.length !== 2 ) { 15680 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 15681 } else if ( Array.isArray( options.values ) ) { 15682 options.values = options.values.slice( 0 ); 15683 } 15684 } 15685 15686 if ( !this.range || !this.range.length ) { 15687 this.range = $( "<div>" ) 15688 .appendTo( this.element ); 15689 15690 this._addClass( this.range, "ui-slider-range" ); 15691 } else { 15692 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 15693 15694 // Handle range switching from true to min/max 15695 this.range.css( { 15696 "left": "", 15697 "bottom": "" 15698 } ); 15699 } 15700 if ( options.range === "min" || options.range === "max" ) { 15701 this._addClass( this.range, "ui-slider-range-" + options.range ); 15702 } 15703 } else { 15704 if ( this.range ) { 15705 this.range.remove(); 15706 } 15707 this.range = null; 15708 } 15709 }, 15710 15711 _setupEvents: function() { 15712 this._off( this.handles ); 15713 this._on( this.handles, this._handleEvents ); 15714 this._hoverable( this.handles ); 15715 this._focusable( this.handles ); 15716 }, 15717 15718 _destroy: function() { 15719 this.handles.remove(); 15720 if ( this.range ) { 15721 this.range.remove(); 15722 } 15723 15724 this._mouseDestroy(); 15725 }, 15726 15727 _mouseCapture: function( event ) { 15728 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 15729 that = this, 15730 o = this.options; 15731 15732 if ( o.disabled ) { 15733 return false; 15734 } 15735 15736 this.elementSize = { 15737 width: this.element.outerWidth(), 15738 height: this.element.outerHeight() 15739 }; 15740 this.elementOffset = this.element.offset(); 15741 15742 position = { x: event.pageX, y: event.pageY }; 15743 normValue = this._normValueFromMouse( position ); 15744 distance = this._valueMax() - this._valueMin() + 1; 15745 this.handles.each( function( i ) { 15746 var thisDistance = Math.abs( normValue - that.values( i ) ); 15747 if ( ( distance > thisDistance ) || 15748 ( distance === thisDistance && 15749 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 15750 distance = thisDistance; 15751 closestHandle = $( this ); 15752 index = i; 15753 } 15754 } ); 15755 15756 allowed = this._start( event, index ); 15757 if ( allowed === false ) { 15758 return false; 15759 } 15760 this._mouseSliding = true; 15761 15762 this._handleIndex = index; 15763 15764 this._addClass( closestHandle, null, "ui-state-active" ); 15765 closestHandle.trigger( "focus" ); 15766 15767 offset = closestHandle.offset(); 15768 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 15769 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 15770 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 15771 top: event.pageY - offset.top - 15772 ( closestHandle.height() / 2 ) - 15773 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 15774 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 15775 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 15776 }; 15777 15778 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 15779 this._slide( event, index, normValue ); 15780 } 15781 this._animateOff = true; 15782 return true; 15783 }, 15784 15785 _mouseStart: function() { 15786 return true; 15787 }, 15788 15789 _mouseDrag: function( event ) { 15790 var position = { x: event.pageX, y: event.pageY }, 15791 normValue = this._normValueFromMouse( position ); 15792 15793 this._slide( event, this._handleIndex, normValue ); 15794 15795 return false; 15796 }, 15797 15798 _mouseStop: function( event ) { 15799 this._removeClass( this.handles, null, "ui-state-active" ); 15800 this._mouseSliding = false; 15801 15802 this._stop( event, this._handleIndex ); 15803 this._change( event, this._handleIndex ); 15804 15805 this._handleIndex = null; 15806 this._clickOffset = null; 15807 this._animateOff = false; 15808 15809 return false; 15810 }, 15811 15812 _detectOrientation: function() { 15813 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 15814 }, 15815 15816 _normValueFromMouse: function( position ) { 15817 var pixelTotal, 15818 pixelMouse, 15819 percentMouse, 15820 valueTotal, 15821 valueMouse; 15822 15823 if ( this.orientation === "horizontal" ) { 15824 pixelTotal = this.elementSize.width; 15825 pixelMouse = position.x - this.elementOffset.left - 15826 ( this._clickOffset ? this._clickOffset.left : 0 ); 15827 } else { 15828 pixelTotal = this.elementSize.height; 15829 pixelMouse = position.y - this.elementOffset.top - 15830 ( this._clickOffset ? this._clickOffset.top : 0 ); 15831 } 15832 15833 percentMouse = ( pixelMouse / pixelTotal ); 15834 if ( percentMouse > 1 ) { 15835 percentMouse = 1; 15836 } 15837 if ( percentMouse < 0 ) { 15838 percentMouse = 0; 15839 } 15840 if ( this.orientation === "vertical" ) { 15841 percentMouse = 1 - percentMouse; 15842 } 15843 15844 valueTotal = this._valueMax() - this._valueMin(); 15845 valueMouse = this._valueMin() + percentMouse * valueTotal; 15846 15847 return this._trimAlignValue( valueMouse ); 15848 }, 15849 15850 _uiHash: function( index, value, values ) { 15851 var uiHash = { 15852 handle: this.handles[ index ], 15853 handleIndex: index, 15854 value: value !== undefined ? value : this.value() 15855 }; 15856 15857 if ( this._hasMultipleValues() ) { 15858 uiHash.value = value !== undefined ? value : this.values( index ); 15859 uiHash.values = values || this.values(); 15860 } 15861 15862 return uiHash; 15863 }, 15864 15865 _hasMultipleValues: function() { 15866 return this.options.values && this.options.values.length; 15867 }, 15868 15869 _start: function( event, index ) { 15870 return this._trigger( "start", event, this._uiHash( index ) ); 15871 }, 15872 15873 _slide: function( event, index, newVal ) { 15874 var allowed, otherVal, 15875 currentValue = this.value(), 15876 newValues = this.values(); 15877 15878 if ( this._hasMultipleValues() ) { 15879 otherVal = this.values( index ? 0 : 1 ); 15880 currentValue = this.values( index ); 15881 15882 if ( this.options.values.length === 2 && this.options.range === true ) { 15883 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 15884 } 15885 15886 newValues[ index ] = newVal; 15887 } 15888 15889 if ( newVal === currentValue ) { 15890 return; 15891 } 15892 15893 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 15894 15895 // A slide can be canceled by returning false from the slide callback 15896 if ( allowed === false ) { 15897 return; 15898 } 15899 15900 if ( this._hasMultipleValues() ) { 15901 this.values( index, newVal ); 15902 } else { 15903 this.value( newVal ); 15904 } 15905 }, 15906 15907 _stop: function( event, index ) { 15908 this._trigger( "stop", event, this._uiHash( index ) ); 15909 }, 15910 15911 _change: function( event, index ) { 15912 if ( !this._keySliding && !this._mouseSliding ) { 15913 15914 //store the last changed value index for reference when handles overlap 15915 this._lastChangedValue = index; 15916 this._trigger( "change", event, this._uiHash( index ) ); 15917 } 15918 }, 15919 15920 value: function( newValue ) { 15921 if ( arguments.length ) { 15922 this.options.value = this._trimAlignValue( newValue ); 15923 this._refreshValue(); 15924 this._change( null, 0 ); 15925 return; 15926 } 15927 15928 return this._value(); 15929 }, 15930 15931 values: function( index, newValue ) { 15932 var vals, 15933 newValues, 15934 i; 15935 15936 if ( arguments.length > 1 ) { 15937 this.options.values[ index ] = this._trimAlignValue( newValue ); 15938 this._refreshValue(); 15939 this._change( null, index ); 15940 return; 15941 } 15942 15943 if ( arguments.length ) { 15944 if ( Array.isArray( arguments[ 0 ] ) ) { 15945 vals = this.options.values; 15946 newValues = arguments[ 0 ]; 15947 for ( i = 0; i < vals.length; i += 1 ) { 15948 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 15949 this._change( null, i ); 15950 } 15951 this._refreshValue(); 15952 } else { 15953 if ( this._hasMultipleValues() ) { 15954 return this._values( index ); 15955 } else { 15956 return this.value(); 15957 } 15958 } 15959 } else { 15960 return this._values(); 15961 } 15962 }, 15963 15964 _setOption: function( key, value ) { 15965 var i, 15966 valsLength = 0; 15967 15968 if ( key === "range" && this.options.range === true ) { 15969 if ( value === "min" ) { 15970 this.options.value = this._values( 0 ); 15971 this.options.values = null; 15972 } else if ( value === "max" ) { 15973 this.options.value = this._values( this.options.values.length - 1 ); 15974 this.options.values = null; 15975 } 15976 } 15977 15978 if ( Array.isArray( this.options.values ) ) { 15979 valsLength = this.options.values.length; 15980 } 15981 15982 this._super( key, value ); 15983 15984 switch ( key ) { 15985 case "orientation": 15986 this._detectOrientation(); 15987 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 15988 ._addClass( "ui-slider-" + this.orientation ); 15989 this._refreshValue(); 15990 if ( this.options.range ) { 15991 this._refreshRange( value ); 15992 } 15993 15994 // Reset positioning from previous orientation 15995 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 15996 break; 15997 case "value": 15998 this._animateOff = true; 15999 this._refreshValue(); 16000 this._change( null, 0 ); 16001 this._animateOff = false; 16002 break; 16003 case "values": 16004 this._animateOff = true; 16005 this._refreshValue(); 16006 16007 // Start from the last handle to prevent unreachable handles (#9046) 16008 for ( i = valsLength - 1; i >= 0; i-- ) { 16009 this._change( null, i ); 16010 } 16011 this._animateOff = false; 16012 break; 16013 case "step": 16014 case "min": 16015 case "max": 16016 this._animateOff = true; 16017 this._calculateNewMax(); 16018 this._refreshValue(); 16019 this._animateOff = false; 16020 break; 16021 case "range": 16022 this._animateOff = true; 16023 this._refresh(); 16024 this._animateOff = false; 16025 break; 16026 } 16027 }, 16028 16029 _setOptionDisabled: function( value ) { 16030 this._super( value ); 16031 16032 this._toggleClass( null, "ui-state-disabled", !!value ); 16033 }, 16034 16035 //internal value getter 16036 // _value() returns value trimmed by min and max, aligned by step 16037 _value: function() { 16038 var val = this.options.value; 16039 val = this._trimAlignValue( val ); 16040 16041 return val; 16042 }, 16043 16044 //internal values getter 16045 // _values() returns array of values trimmed by min and max, aligned by step 16046 // _values( index ) returns single value trimmed by min and max, aligned by step 16047 _values: function( index ) { 16048 var val, 16049 vals, 16050 i; 16051 16052 if ( arguments.length ) { 16053 val = this.options.values[ index ]; 16054 val = this._trimAlignValue( val ); 16055 16056 return val; 16057 } else if ( this._hasMultipleValues() ) { 16058 16059 // .slice() creates a copy of the array 16060 // this copy gets trimmed by min and max and then returned 16061 vals = this.options.values.slice(); 16062 for ( i = 0; i < vals.length; i += 1 ) { 16063 vals[ i ] = this._trimAlignValue( vals[ i ] ); 16064 } 16065 16066 return vals; 16067 } else { 16068 return []; 16069 } 16070 }, 16071 16072 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 16073 _trimAlignValue: function( val ) { 16074 if ( val <= this._valueMin() ) { 16075 return this._valueMin(); 16076 } 16077 if ( val >= this._valueMax() ) { 16078 return this._valueMax(); 16079 } 16080 var step = ( this.options.step > 0 ) ? this.options.step : 1, 16081 valModStep = ( val - this._valueMin() ) % step, 16082 alignValue = val - valModStep; 16083 16084 if ( Math.abs( valModStep ) * 2 >= step ) { 16085 alignValue += ( valModStep > 0 ) ? step : ( -step ); 16086 } 16087 16088 // Since JavaScript has problems with large floats, round 16089 // the final value to 5 digits after the decimal point (see #4124) 16090 return parseFloat( alignValue.toFixed( 5 ) ); 16091 }, 16092 16093 _calculateNewMax: function() { 16094 var max = this.options.max, 16095 min = this._valueMin(), 16096 step = this.options.step, 16097 aboveMin = Math.round( ( max - min ) / step ) * step; 16098 max = aboveMin + min; 16099 if ( max > this.options.max ) { 16100 16101 //If max is not divisible by step, rounding off may increase its value 16102 max -= step; 16103 } 16104 this.max = parseFloat( max.toFixed( this._precision() ) ); 16105 }, 16106 16107 _precision: function() { 16108 var precision = this._precisionOf( this.options.step ); 16109 if ( this.options.min !== null ) { 16110 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 16111 } 16112 return precision; 16113 }, 16114 16115 _precisionOf: function( num ) { 16116 var str = num.toString(), 16117 decimal = str.indexOf( "." ); 16118 return decimal === -1 ? 0 : str.length - decimal - 1; 16119 }, 16120 16121 _valueMin: function() { 16122 return this.options.min; 16123 }, 16124 16125 _valueMax: function() { 16126 return this.max; 16127 }, 16128 16129 _refreshRange: function( orientation ) { 16130 if ( orientation === "vertical" ) { 16131 this.range.css( { "width": "", "left": "" } ); 16132 } 16133 if ( orientation === "horizontal" ) { 16134 this.range.css( { "height": "", "bottom": "" } ); 16135 } 16136 }, 16137 16138 _refreshValue: function() { 16139 var lastValPercent, valPercent, value, valueMin, valueMax, 16140 oRange = this.options.range, 16141 o = this.options, 16142 that = this, 16143 animate = ( !this._animateOff ) ? o.animate : false, 16144 _set = {}; 16145 16146 if ( this._hasMultipleValues() ) { 16147 this.handles.each( function( i ) { 16148 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 16149 that._valueMin() ) * 100; 16150 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 16151 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 16152 if ( that.options.range === true ) { 16153 if ( that.orientation === "horizontal" ) { 16154 if ( i === 0 ) { 16155 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16156 left: valPercent + "%" 16157 }, o.animate ); 16158 } 16159 if ( i === 1 ) { 16160 that.range[ animate ? "animate" : "css" ]( { 16161 width: ( valPercent - lastValPercent ) + "%" 16162 }, { 16163 queue: false, 16164 duration: o.animate 16165 } ); 16166 } 16167 } else { 16168 if ( i === 0 ) { 16169 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16170 bottom: ( valPercent ) + "%" 16171 }, o.animate ); 16172 } 16173 if ( i === 1 ) { 16174 that.range[ animate ? "animate" : "css" ]( { 16175 height: ( valPercent - lastValPercent ) + "%" 16176 }, { 16177 queue: false, 16178 duration: o.animate 16179 } ); 16180 } 16181 } 16182 } 16183 lastValPercent = valPercent; 16184 } ); 16185 } else { 16186 value = this.value(); 16187 valueMin = this._valueMin(); 16188 valueMax = this._valueMax(); 16189 valPercent = ( valueMax !== valueMin ) ? 16190 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 16191 0; 16192 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 16193 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 16194 16195 if ( oRange === "min" && this.orientation === "horizontal" ) { 16196 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16197 width: valPercent + "%" 16198 }, o.animate ); 16199 } 16200 if ( oRange === "max" && this.orientation === "horizontal" ) { 16201 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16202 width: ( 100 - valPercent ) + "%" 16203 }, o.animate ); 16204 } 16205 if ( oRange === "min" && this.orientation === "vertical" ) { 16206 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16207 height: valPercent + "%" 16208 }, o.animate ); 16209 } 16210 if ( oRange === "max" && this.orientation === "vertical" ) { 16211 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 16212 height: ( 100 - valPercent ) + "%" 16213 }, o.animate ); 16214 } 16215 } 16216 }, 16217 16218 _handleEvents: { 16219 keydown: function( event ) { 16220 var allowed, curVal, newVal, step, 16221 index = $( event.target ).data( "ui-slider-handle-index" ); 16222 16223 switch ( event.keyCode ) { 16224 case $.ui.keyCode.HOME: 16225 case $.ui.keyCode.END: 16226 case $.ui.keyCode.PAGE_UP: 16227 case $.ui.keyCode.PAGE_DOWN: 16228 case $.ui.keyCode.UP: 16229 case $.ui.keyCode.RIGHT: 16230 case $.ui.keyCode.DOWN: 16231 case $.ui.keyCode.LEFT: 16232 event.preventDefault(); 16233 if ( !this._keySliding ) { 16234 this._keySliding = true; 16235 this._addClass( $( event.target ), null, "ui-state-active" ); 16236 allowed = this._start( event, index ); 16237 if ( allowed === false ) { 16238 return; 16239 } 16240 } 16241 break; 16242 } 16243 16244 step = this.options.step; 16245 if ( this._hasMultipleValues() ) { 16246 curVal = newVal = this.values( index ); 16247 } else { 16248 curVal = newVal = this.value(); 16249 } 16250 16251 switch ( event.keyCode ) { 16252 case $.ui.keyCode.HOME: 16253 newVal = this._valueMin(); 16254 break; 16255 case $.ui.keyCode.END: 16256 newVal = this._valueMax(); 16257 break; 16258 case $.ui.keyCode.PAGE_UP: 16259 newVal = this._trimAlignValue( 16260 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 16261 ); 16262 break; 16263 case $.ui.keyCode.PAGE_DOWN: 16264 newVal = this._trimAlignValue( 16265 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 16266 break; 16267 case $.ui.keyCode.UP: 16268 case $.ui.keyCode.RIGHT: 16269 if ( curVal === this._valueMax() ) { 16270 return; 16271 } 16272 newVal = this._trimAlignValue( curVal + step ); 16273 break; 16274 case $.ui.keyCode.DOWN: 16275 case $.ui.keyCode.LEFT: 16276 if ( curVal === this._valueMin() ) { 16277 return; 16278 } 16279 newVal = this._trimAlignValue( curVal - step ); 16280 break; 16281 } 16282 16283 this._slide( event, index, newVal ); 16284 }, 16285 keyup: function( event ) { 16286 var index = $( event.target ).data( "ui-slider-handle-index" ); 16287 16288 if ( this._keySliding ) { 16289 this._keySliding = false; 16290 this._stop( event, index ); 16291 this._change( event, index ); 16292 this._removeClass( $( event.target ), null, "ui-state-active" ); 16293 } 16294 } 16295 } 16296} ); 16297 16298} ); 16299 16300 16301 16302 16303 16304 16305/*! 16306 * jQuery UI Sortable 1.14.1 16307 * https://jqueryui.com 16308 * 16309 * Copyright OpenJS Foundation and other contributors 16310 * Released under the MIT license. 16311 * https://jquery.org/license 16312 */ 16313 16314//>>label: Sortable 16315//>>group: Interactions 16316//>>description: Enables items in a list to be sorted using the mouse. 16317//>>docs: https://api.jqueryui.com/sortable/ 16318//>>demos: https://jqueryui.com/sortable/ 16319//>>css.structure: ../../themes/base/sortable.css 16320 16321( function( factory ) { 16322 "use strict"; 16323 16324 if ( typeof define === "function" && define.amd ) { 16325 16326 // AMD. Register as an anonymous module. 16327 define( [ 16328 "jquery", 16329 "./mouse", 16330 "../data", 16331 "../scroll-parent", 16332 "../version", 16333 "../widget" 16334 ], factory ); 16335 } else { 16336 16337 // Browser globals 16338 factory( jQuery ); 16339 } 16340} )( function( $ ) { 16341"use strict"; 16342 16343return $.widget( "ui.sortable", $.ui.mouse, { 16344 version: "1.14.1
vendor: 12,316 bytes, lines 16344-16802
16344", 16345 widgetEventPrefix: "sort", 16346 ready: false, 16347 options: { 16348 appendTo: "parent", 16349 axis: false, 16350 connectWith: false, 16351 containment: false, 16352 cursor: "auto", 16353 cursorAt: false, 16354 dropOnEmpty: true, 16355 forcePlaceholderSize: false, 16356 forceHelperSize: false, 16357 grid: false, 16358 handle: false, 16359 helper: "original", 16360 items: "> *", 16361 opacity: false, 16362 placeholder: false, 16363 revert: false, 16364 scroll: true, 16365 scrollSensitivity: 20, 16366 scrollSpeed: 20, 16367 scope: "default", 16368 tolerance: "intersect", 16369 zIndex: 1000, 16370 16371 // Callbacks 16372 activate: null, 16373 beforeStop: null, 16374 change: null, 16375 deactivate: null, 16376 out: null, 16377 over: null, 16378 receive: null, 16379 remove: null, 16380 sort: null, 16381 start: null, 16382 stop: null, 16383 update: null 16384 }, 16385 16386 _isOverAxis: function( x, reference, size ) { 16387 return ( x >= reference ) && ( x < ( reference + size ) ); 16388 }, 16389 16390 _isFloating: function( item ) { 16391 return ( /left|right/ ).test( item.css( "float" ) ) || 16392 ( /inline|table-cell/ ).test( item.css( "display" ) ); 16393 }, 16394 16395 _create: function() { 16396 this.containerCache = {}; 16397 this._addClass( "ui-sortable" ); 16398 16399 //Get the items 16400 this.refresh(); 16401 16402 //Let's determine the parent's offset 16403 this.offset = this.element.offset(); 16404 16405 //Initialize mouse events for interaction 16406 this._mouseInit(); 16407 16408 this._setHandleClassName(); 16409 16410 //We're ready to go 16411 this.ready = true; 16412 16413 }, 16414 16415 _setOption: function( key, value ) { 16416 this._super( key, value ); 16417 16418 if ( key === "handle" ) { 16419 this._setHandleClassName(); 16420 } 16421 }, 16422 16423 _setHandleClassName: function() { 16424 var that = this; 16425 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 16426 $.each( this.items, function() { 16427 that._addClass( 16428 this.instance.options.handle ? 16429 this.item.find( this.instance.options.handle ) : 16430 this.item, 16431 "ui-sortable-handle" 16432 ); 16433 } ); 16434 }, 16435 16436 _destroy: function() { 16437 this._mouseDestroy(); 16438 16439 for ( var i = this.items.length - 1; i >= 0; i-- ) { 16440 this.items[ i ].item.removeData( this.widgetName + "-item" ); 16441 } 16442 16443 return this; 16444 }, 16445 16446 _mouseCapture: function( event, overrideHandle ) { 16447 var currentItem = null, 16448 validHandle = false, 16449 that = this; 16450 16451 if ( this.reverting ) { 16452 return false; 16453 } 16454 16455 if ( this.options.disabled || this.options.type === "static" ) { 16456 return false; 16457 } 16458 16459 //We have to refresh the items data once first 16460 this._refreshItems( event ); 16461 16462 //Find out if the clicked node (or one of its parents) is a actual item in this.items 16463 $( event.target ).parents().each( function() { 16464 if ( $.data( this, that.widgetName + "-item" ) === that ) { 16465 currentItem = $( this ); 16466 return false; 16467 } 16468 } ); 16469 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 16470 currentItem = $( event.target ); 16471 } 16472 16473 if ( !currentItem ) { 16474 return false; 16475 } 16476 if ( this.options.handle && !overrideHandle ) { 16477 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 16478 if ( this === event.target ) { 16479 validHandle = true; 16480 } 16481 } ); 16482 if ( !validHandle ) { 16483 return false; 16484 } 16485 } 16486 16487 this.currentItem = currentItem; 16488 this._removeCurrentsFromItems(); 16489 return true; 16490 16491 }, 16492 16493 _mouseStart: function( event, overrideHandle, noActivation ) { 16494 16495 var i, body, 16496 o = this.options; 16497 16498 this.currentContainer = this; 16499 16500 //We only need to call refreshPositions, because the refreshItems call has been moved to 16501 // mouseCapture 16502 this.refreshPositions(); 16503 16504 //Prepare the dragged items parent 16505 this.appendTo = $( o.appendTo !== "parent" ? 16506 o.appendTo : 16507 this.currentItem.parent() ); 16508 16509 //Create and append the visible helper 16510 this.helper = this._createHelper( event ); 16511 16512 //Cache the helper size 16513 this._cacheHelperProportions(); 16514 16515 /* 16516 * - Position generation - 16517 * This block generates everything position related - it's the core of draggables. 16518 */ 16519 16520 //Cache the margins of the original element 16521 this._cacheMargins(); 16522 16523 //The element's absolute position on the page minus margins 16524 this.offset = this.currentItem.offset(); 16525 this.offset = { 16526 top: this.offset.top - this.margins.top, 16527 left: this.offset.left - this.margins.left 16528 }; 16529 16530 $.extend( this.offset, { 16531 click: { //Where the click happened, relative to the element 16532 left: event.pageX - this.offset.left, 16533 top: event.pageY - this.offset.top 16534 }, 16535 16536 // This is a relative to absolute position minus the actual position calculation - 16537 // only used for relative positioned helper 16538 relative: this._getRelativeOffset() 16539 } ); 16540 16541 // After we get the helper offset, but before we get the parent offset we can 16542 // change the helper's position to absolute 16543 // TODO: Still need to figure out a way to make relative sorting possible 16544 this.helper.css( "position", "absolute" ); 16545 this.cssPosition = this.helper.css( "position" ); 16546 16547 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 16548 if ( o.cursorAt ) { 16549 this._adjustOffsetFromHelper( o.cursorAt ); 16550 } 16551 16552 //Cache the former DOM position 16553 this.domPosition = { 16554 prev: this.currentItem.prev()[ 0 ], 16555 parent: this.currentItem.parent()[ 0 ] 16556 }; 16557 16558 // If the helper is not the original, hide the original so it's not playing any role during 16559 // the drag, won't cause anything bad this way 16560 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 16561 this.currentItem.hide(); 16562 } 16563 16564 //Create the placeholder 16565 this._createPlaceholder(); 16566 16567 //Get the next scrolling parent 16568 this.scrollParent = this.placeholder.scrollParent(); 16569 16570 $.extend( this.offset, { 16571 parent: this._getParentOffset() 16572 } ); 16573 16574 //Set a containment if given in the options 16575 if ( o.containment ) { 16576 this._setContainment(); 16577 } 16578 16579 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 16580 body = this.document.find( "body" ); 16581 16582 this._storedStylesheet = 16583 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 16584 } 16585 16586 // We need to make sure to grab the zIndex before setting the 16587 // opacity, because setting the opacity to anything lower than 1 16588 // causes the zIndex to change from "auto" to 0. 16589 if ( o.zIndex ) { // zIndex option 16590 if ( this.helper.css( "zIndex" ) ) { 16591 this._storedZIndex = this.helper.css( "zIndex" ); 16592 } 16593 this.helper.css( "zIndex", o.zIndex ); 16594 } 16595 16596 if ( o.opacity ) { // opacity option 16597 if ( this.helper.css( "opacity" ) ) { 16598 this._storedOpacity = this.helper.css( "opacity" ); 16599 } 16600 this.helper.css( "opacity", o.opacity ); 16601 } 16602 16603 //Prepare scrolling 16604 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16605 this.scrollParent[ 0 ].tagName !== "HTML" ) { 16606 this.overflowOffset = this.scrollParent.offset(); 16607 } 16608 16609 //Call callbacks 16610 this._trigger( "start", event, this._uiHash() ); 16611 16612 //Recache the helper size 16613 if ( !this._preserveHelperProportions ) { 16614 this._cacheHelperProportions(); 16615 } 16616 16617 //Post "activate" events to possible containers 16618 if ( !noActivation ) { 16619 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16620 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 16621 } 16622 } 16623 16624 //Prepare possible droppables 16625 if ( $.ui.ddmanager ) { 16626 $.ui.ddmanager.current = this; 16627 } 16628 16629 if ( $.ui.ddmanager && !o.dropBehaviour ) { 16630 $.ui.ddmanager.prepareOffsets( this, event ); 16631 } 16632 16633 this.dragging = true; 16634 16635 this._addClass( this.helper, "ui-sortable-helper" ); 16636 16637 //Move the helper, if needed 16638 if ( !this.helper.parent().is( this.appendTo ) ) { 16639 this.helper.detach().appendTo( this.appendTo ); 16640 16641 //Update position 16642 this.offset.parent = this._getParentOffset(); 16643 } 16644 16645 //Generate the original position 16646 this.position = this.originalPosition = this._generatePosition( event ); 16647 this.originalPageX = event.pageX; 16648 this.originalPageY = event.pageY; 16649 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 16650 16651 this._mouseDrag( event ); 16652 16653 return true; 16654 16655 }, 16656 16657 _scroll: function( event ) { 16658 var o = this.options, 16659 scrolled = false; 16660 16661 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16662 this.scrollParent[ 0 ].tagName !== "HTML" ) { 16663 16664 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 16665 event.pageY < o.scrollSensitivity ) { 16666 this.scrollParent[ 0 ].scrollTop = 16667 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 16668 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 16669 this.scrollParent[ 0 ].scrollTop = 16670 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 16671 } 16672 16673 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 16674 event.pageX < o.scrollSensitivity ) { 16675 this.scrollParent[ 0 ].scrollLeft = scrolled = 16676 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 16677 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 16678 this.scrollParent[ 0 ].scrollLeft = scrolled = 16679 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 16680 } 16681 16682 } else { 16683 16684 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 16685 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 16686 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 16687 o.scrollSensitivity ) { 16688 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 16689 } 16690 16691 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 16692 scrolled = this.document.scrollLeft( 16693 this.document.scrollLeft() - o.scrollSpeed 16694 ); 16695 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 16696 o.scrollSensitivity ) { 16697 scrolled = this.document.scrollLeft( 16698 this.document.scrollLeft() + o.scrollSpeed 16699 ); 16700 } 16701 16702 } 16703 16704 return scrolled; 16705 }, 16706 16707 _mouseDrag: function( event ) { 16708 var i, item, itemElement, intersection, 16709 o = this.options; 16710 16711 //Compute the helpers position 16712 this.position = this._generatePosition( event ); 16713 this.positionAbs = this._convertPositionTo( "absolute" ); 16714 16715 //Set the helper position 16716 if ( !this.options.axis || this.options.axis !== "y" ) { 16717 this.helper[ 0 ].style.left = this.position.left + "px"; 16718 } 16719 if ( !this.options.axis || this.options.axis !== "x" ) { 16720 this.helper[ 0 ].style.top = this.position.top + "px"; 16721 } 16722 16723 //Do scrolling 16724 if ( o.scroll ) { 16725 if ( this._scroll( event ) !== false ) { 16726 16727 //Update item positions used in position checks 16728 this._refreshItemPositions( true ); 16729 16730 if ( $.ui.ddmanager && !o.dropBehaviour ) { 16731 $.ui.ddmanager.prepareOffsets( this, event ); 16732 } 16733 } 16734 } 16735 16736 this.dragDirection = { 16737 vertical: this._getDragVerticalDirection(), 16738 horizontal: this._getDragHorizontalDirection() 16739 }; 16740 16741 //Rearrange 16742 for ( i = this.items.length - 1; i >= 0; i-- ) { 16743 16744 //Cache variables and intersection, continue if no intersection 16745 item = this.items[ i ]; 16746 itemElement = item.item[ 0 ]; 16747 intersection = this._intersectsWithPointer( item ); 16748 if ( !intersection ) { 16749 continue; 16750 } 16751 16752 // Only put the placeholder inside the current Container, skip all 16753 // items from other containers. This works because when moving 16754 // an item from one container to another the 16755 // currentContainer is switched before the placeholder is moved. 16756 // 16757 // Without this, moving items in "sub-sortables" can cause 16758 // the placeholder to jitter between the outer and inner container. 16759 if ( item.instance !== this.currentContainer ) { 16760 continue; 16761 } 16762 16763 // Cannot intersect with itself 16764 // no useless actions that have been done before 16765 // no action if the item moved is the parent of the item checked 16766 if ( itemElement !== this.currentItem[ 0 ] && 16767 this.placeholder[ intersection === 1 ? 16768 "next" : "prev" ]()[ 0 ] !== itemElement && 16769 !$.contains( this.placeholder[ 0 ], itemElement ) && 16770 ( this.options.type === "semi-dynamic" ? 16771 !$.contains( this.element[ 0 ], itemElement ) : 16772 true 16773 ) 16774 ) { 16775 16776 this.direction = intersection === 1 ? "down" : "up"; 16777 16778 if ( this.options.tolerance === "pointer" || 16779 this._intersectsWithSides( item ) ) { 16780 this._rearrange( event, item ); 16781 } else { 16782 break; 16783 } 16784 16785 this._trigger( "change", event, this._uiHash() ); 16786 break; 16787 } 16788 } 16789 16790 //Post events to containers 16791 this._contactContainers( event ); 16792 16793 //Interconnect with droppables 16794 if ( $.ui.ddmanager ) { 16795 $.ui.ddmanager.drag( this, event ); 16796 } 16797 16798 //Call callbacks 16799 this._trigger( "sort", event, this._uiHash() ); 16800 16801 this.lastPositionAbs = this.positionAbs; 16802 return false;
vendor: 5,063 bytes, lines 16803-16992
16803 16804 }, 16805 16806 _mouseStop: function( event, noPropagation ) { 16807 16808 if ( !event ) { 16809 return; 16810 } 16811 16812 //If we are using droppables, inform the manager about the drop 16813 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 16814 $.ui.ddmanager.drop( this, event ); 16815 } 16816 16817 if ( this.options.revert ) { 16818 var that = this, 16819 cur = this.placeholder.offset(), 16820 axis = this.options.axis, 16821 animation = {}; 16822 16823 if ( !axis || axis === "x" ) { 16824 animation.left = cur.left - this.offset.parent.left - this.margins.left + 16825 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 16826 0 : 16827 this.offsetParent[ 0 ].scrollLeft 16828 ); 16829 } 16830 if ( !axis || axis === "y" ) { 16831 animation.top = cur.top - this.offset.parent.top - this.margins.top + 16832 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 16833 0 : 16834 this.offsetParent[ 0 ].scrollTop 16835 ); 16836 } 16837 this.reverting = true; 16838 $( this.helper ).animate( 16839 animation, 16840 parseInt( this.options.revert, 10 ) || 500, 16841 function() { 16842 that._clear( event ); 16843 } 16844 ); 16845 } else { 16846 this._clear( event, noPropagation ); 16847 } 16848 16849 return false; 16850 16851 }, 16852 16853 cancel: function() { 16854 16855 if ( this.dragging ) { 16856 16857 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 16858 16859 if ( this.options.helper === "original" ) { 16860 this.currentItem.css( this._storedCSS ); 16861 this._removeClass( this.currentItem, "ui-sortable-helper" ); 16862 } else { 16863 this.currentItem.show(); 16864 } 16865 16866 //Post deactivating events to containers 16867 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 16868 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 16869 if ( this.containers[ i ].containerCache.over ) { 16870 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 16871 this.containers[ i ].containerCache.over = 0; 16872 } 16873 } 16874 16875 } 16876 16877 if ( this.placeholder ) { 16878 16879 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16880 // it unbinds ALL events from the original node! 16881 if ( this.placeholder[ 0 ].parentNode ) { 16882 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 16883 } 16884 if ( this.options.helper !== "original" && this.helper && 16885 this.helper[ 0 ].parentNode ) { 16886 this.helper.remove(); 16887 } 16888 16889 $.extend( this, { 16890 helper: null, 16891 dragging: false, 16892 reverting: false, 16893 _noFinalSort: null 16894 } ); 16895 16896 if ( this.domPosition.prev ) { 16897 $( this.domPosition.prev ).after( this.currentItem ); 16898 } else { 16899 $( this.domPosition.parent ).prepend( this.currentItem ); 16900 } 16901 } 16902 16903 return this; 16904 16905 }, 16906 16907 serialize: function( o ) { 16908 16909 var items = this._getItemsAsjQuery( o && o.connected ), 16910 str = []; 16911 o = o || {}; 16912 16913 $( items ).each( function() { 16914 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 16915 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 16916 if ( res ) { 16917 str.push( 16918 ( o.key || res[ 1 ] + "[]" ) + 16919 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 16920 } 16921 } ); 16922 16923 if ( !str.length && o.key ) { 16924 str.push( o.key + "=" ); 16925 } 16926 16927 return str.join( "&" ); 16928 16929 }, 16930 16931 toArray: function( o ) { 16932 16933 var items = this._getItemsAsjQuery( o && o.connected ), 16934 ret = []; 16935 16936 o = o || {}; 16937 16938 items.each( function() { 16939 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 16940 } ); 16941 return ret; 16942 16943 }, 16944 16945 /* Be careful with the following core functions */ 16946 _intersectsWith: function( item ) { 16947 16948 var x1 = this.positionAbs.left, 16949 x2 = x1 + this.helperProportions.width, 16950 y1 = this.positionAbs.top, 16951 y2 = y1 + this.helperProportions.height, 16952 l = item.left, 16953 r = l + item.width, 16954 t = item.top, 16955 b = t + item.height, 16956 dyClick = this.offset.click.top, 16957 dxClick = this.offset.click.left, 16958 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 16959 ( y1 + dyClick ) < b ), 16960 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 16961 ( x1 + dxClick ) < r ), 16962 isOverElement = isOverElementHeight && isOverElementWidth; 16963 16964 if ( this.options.tolerance === "pointer" || 16965 this.options.forcePointerForContainers || 16966 ( this.options.tolerance !== "pointer" && 16967 this.helperProportions[ this.floating ? "width" : "height" ] > 16968 item[ this.floating ? "width" : "height" ] ) 16969 ) { 16970 return isOverElement; 16971 } else { 16972 16973 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 16974 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 16975 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 16976 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 16977 16978 } 16979 }, 16980 16981 _intersectsWithPointer: function( item ) { 16982 var verticalDirection, horizontalDirection, 16983 isOverElementHeight = ( this.options.axis === "x" ) || 16984 this._isOverAxis( 16985 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 16986 isOverElementWidth = ( this.options.axis === "y" ) || 16987 this._isOverAxis( 16988 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 16989 isOverElement = isOverElementHeight && isOverElementWidth; 16990 16991 if ( !isOverElement ) { 16992 return false;
vendor: 18,528 bytes, lines 16993-17573
16993 } 16994 16995 verticalDirection = this.dragDirection.vertical; 16996 horizontalDirection = this.dragDirection.horizontal; 16997 16998 return this.floating ? 16999 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 17000 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 17001 17002 }, 17003 17004 _intersectsWithSides: function( item ) { 17005 17006 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 17007 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 17008 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 17009 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 17010 verticalDirection = this.dragDirection.vertical, 17011 horizontalDirection = this.dragDirection.horizontal; 17012 17013 if ( this.floating && horizontalDirection ) { 17014 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 17015 ( horizontalDirection === "left" && !isOverRightHalf ) ); 17016 } else { 17017 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 17018 ( verticalDirection === "up" && !isOverBottomHalf ) ); 17019 } 17020 17021 }, 17022 17023 _getDragVerticalDirection: function() { 17024 var delta = this.positionAbs.top - this.lastPositionAbs.top; 17025 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 17026 }, 17027 17028 _getDragHorizontalDirection: function() { 17029 var delta = this.positionAbs.left - this.lastPositionAbs.left; 17030 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 17031 }, 17032 17033 refresh: function( event ) { 17034 this._refreshItems( event ); 17035 this._setHandleClassName(); 17036 this.refreshPositions(); 17037 return this; 17038 }, 17039 17040 _connectWith: function() { 17041 var options = this.options; 17042 return options.connectWith.constructor === String ? 17043 [ options.connectWith ] : 17044 options.connectWith; 17045 }, 17046 17047 _getItemsAsjQuery: function( connected ) { 17048 17049 var i, j, cur, inst, 17050 items = [], 17051 queries = [], 17052 connectWith = this._connectWith(); 17053 17054 if ( connectWith && connected ) { 17055 for ( i = connectWith.length - 1; i >= 0; i-- ) { 17056 cur = $( connectWith[ i ], this.document[ 0 ] ); 17057 for ( j = cur.length - 1; j >= 0; j-- ) { 17058 inst = $.data( cur[ j ], this.widgetFullName ); 17059 if ( inst && inst !== this && !inst.options.disabled ) { 17060 queries.push( [ typeof inst.options.items === "function" ? 17061 inst.options.items.call( inst.element ) : 17062 $( inst.options.items, inst.element ) 17063 .not( ".ui-sortable-helper" ) 17064 .not( ".ui-sortable-placeholder" ), inst ] ); 17065 } 17066 } 17067 } 17068 } 17069 17070 queries.push( [ typeof this.options.items === "function" ? 17071 this.options.items 17072 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 17073 $( this.options.items, this.element ) 17074 .not( ".ui-sortable-helper" ) 17075 .not( ".ui-sortable-placeholder" ), this ] ); 17076 17077 function addItems() { 17078 items.push( this ); 17079 } 17080 for ( i = queries.length - 1; i >= 0; i-- ) { 17081 queries[ i ][ 0 ].each( addItems ); 17082 } 17083 17084 return $( items ); 17085 17086 }, 17087 17088 _removeCurrentsFromItems: function() { 17089 17090 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 17091 17092 this.items = $.grep( this.items, function( item ) { 17093 for ( var j = 0; j < list.length; j++ ) { 17094 if ( list[ j ] === item.item[ 0 ] ) { 17095 return false; 17096 } 17097 } 17098 return true; 17099 } ); 17100 17101 }, 17102 17103 _refreshItems: function( event ) { 17104 17105 this.items = []; 17106 this.containers = [ this ]; 17107 17108 var i, j, cur, inst, targetData, _queries, item, queriesLength, 17109 items = this.items, 17110 queries = [ [ typeof this.options.items === "function" ? 17111 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 17112 $( this.options.items, this.element ), this ] ], 17113 connectWith = this._connectWith(); 17114 17115 //Shouldn't be run the first time through due to massive slow-down 17116 if ( connectWith && this.ready ) { 17117 for ( i = connectWith.length - 1; i >= 0; i-- ) { 17118 cur = $( connectWith[ i ], this.document[ 0 ] ); 17119 for ( j = cur.length - 1; j >= 0; j-- ) { 17120 inst = $.data( cur[ j ], this.widgetFullName ); 17121 if ( inst && inst !== this && !inst.options.disabled ) { 17122 queries.push( [ typeof inst.options.items === "function" ? 17123 inst.options.items 17124 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 17125 $( inst.options.items, inst.element ), inst ] ); 17126 this.containers.push( inst ); 17127 } 17128 } 17129 } 17130 } 17131 17132 for ( i = queries.length - 1; i >= 0; i-- ) { 17133 targetData = queries[ i ][ 1 ]; 17134 _queries = queries[ i ][ 0 ]; 17135 17136 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 17137 item = $( _queries[ j ] ); 17138 17139 // Data for target checking (mouse manager) 17140 item.data( this.widgetName + "-item", targetData ); 17141 17142 items.push( { 17143 item: item, 17144 instance: targetData, 17145 width: 0, height: 0, 17146 left: 0, top: 0 17147 } ); 17148 } 17149 } 17150 17151 }, 17152 17153 _refreshItemPositions: function( fast ) { 17154 var i, item, t, p; 17155 17156 for ( i = this.items.length - 1; i >= 0; i-- ) { 17157 item = this.items[ i ]; 17158 17159 //We ignore calculating positions of all connected containers when we're not over them 17160 if ( this.currentContainer && item.instance !== this.currentContainer && 17161 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 17162 continue; 17163 } 17164 17165 t = this.options.toleranceElement ? 17166 $( this.options.toleranceElement, item.item ) : 17167 item.item; 17168 17169 if ( !fast ) { 17170 item.width = t.outerWidth(); 17171 item.height = t.outerHeight(); 17172 } 17173 17174 p = t.offset(); 17175 item.left = p.left; 17176 item.top = p.top; 17177 } 17178 }, 17179 17180 refreshPositions: function( fast ) { 17181 17182 // Determine whether items are being displayed horizontally 17183 this.floating = this.items.length ? 17184 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 17185 false; 17186 17187 // This has to be redone because due to the item being moved out/into the offsetParent, 17188 // the offsetParent's position will change 17189 if ( this.offsetParent && this.helper ) { 17190 this.offset.parent = this._getParentOffset(); 17191 } 17192 17193 this._refreshItemPositions( fast ); 17194 17195 var i, p; 17196 17197 if ( this.options.custom && this.options.custom.refreshContainers ) { 17198 this.options.custom.refreshContainers.call( this ); 17199 } else { 17200 for ( i = this.containers.length - 1; i >= 0; i-- ) { 17201 p = this.containers[ i ].element.offset(); 17202 this.containers[ i ].containerCache.left = p.left; 17203 this.containers[ i ].containerCache.top = p.top; 17204 this.containers[ i ].containerCache.width = 17205 this.containers[ i ].element.outerWidth(); 17206 this.containers[ i ].containerCache.height = 17207 this.containers[ i ].element.outerHeight(); 17208 } 17209 } 17210 17211 return this; 17212 }, 17213 17214 _createPlaceholder: function( that ) { 17215 that = that || this; 17216 var className, nodeName, 17217 o = that.options; 17218 17219 if ( !o.placeholder || o.placeholder.constructor === String ) { 17220 className = o.placeholder; 17221 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 17222 o.placeholder = { 17223 element: function() { 17224 17225 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 17226 17227 that._addClass( element, "ui-sortable-placeholder", 17228 className || that.currentItem[ 0 ].className ) 17229 ._removeClass( element, "ui-sortable-helper" ); 17230 17231 if ( nodeName === "tbody" ) { 17232 that._createTrPlaceholder( 17233 that.currentItem.find( "tr" ).eq( 0 ), 17234 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 17235 ); 17236 } else if ( nodeName === "tr" ) { 17237 that._createTrPlaceholder( that.currentItem, element ); 17238 } else if ( nodeName === "img" ) { 17239 element.attr( "src", that.currentItem.attr( "src" ) ); 17240 } 17241 17242 if ( !className ) { 17243 element.css( "visibility", "hidden" ); 17244 } 17245 17246 return element; 17247 }, 17248 update: function( container, p ) { 17249 17250 // 1. If a className is set as 'placeholder option, we don't force sizes - 17251 // the class is responsible for that 17252 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 17253 // class name is specified 17254 if ( className && !o.forcePlaceholderSize ) { 17255 return; 17256 } 17257 17258 // If the element doesn't have a actual height or width by itself (without 17259 // styles coming from a stylesheet), it receives the inline height and width 17260 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 17261 // anyway since we're populating them with <td>s above, but they're unlikely to 17262 // be the correct height on their own if the row heights are dynamic, so we'll 17263 // always assign the height of the dragged item given forcePlaceholderSize 17264 // is true. 17265 if ( !p.height() || ( o.forcePlaceholderSize && 17266 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 17267 p.height( 17268 that.currentItem.innerHeight() - 17269 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 17270 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 17271 } 17272 if ( !p.width() ) { 17273 p.width( 17274 that.currentItem.innerWidth() - 17275 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 17276 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 17277 } 17278 } 17279 }; 17280 } 17281 17282 //Create the placeholder 17283 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 17284 17285 //Append it after the actual current item 17286 that.currentItem.after( that.placeholder ); 17287 17288 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 17289 o.placeholder.update( that, that.placeholder ); 17290 17291 }, 17292 17293 _createTrPlaceholder: function( sourceTr, targetTr ) { 17294 var that = this; 17295 17296 sourceTr.children().each( function() { 17297 $( "<td> </td>", that.document[ 0 ] ) 17298 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 17299 .appendTo( targetTr ); 17300 } ); 17301 }, 17302 17303 _contactContainers: function( event ) { 17304 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 17305 floating, axis, 17306 innermostContainer = null, 17307 innermostIndex = null; 17308 17309 // Get innermost container that intersects with item 17310 for ( i = this.containers.length - 1; i >= 0; i-- ) { 17311 17312 // Never consider a container that's located within the item itself 17313 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 17314 continue; 17315 } 17316 17317 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 17318 17319 // If we've already found a container and it's more "inner" than this, then continue 17320 if ( innermostContainer && 17321 $.contains( 17322 this.containers[ i ].element[ 0 ], 17323 innermostContainer.element[ 0 ] ) ) { 17324 continue; 17325 } 17326 17327 innermostContainer = this.containers[ i ]; 17328 innermostIndex = i; 17329 17330 } else { 17331 17332 // container doesn't intersect. trigger "out" event if necessary 17333 if ( this.containers[ i ].containerCache.over ) { 17334 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 17335 this.containers[ i ].containerCache.over = 0; 17336 } 17337 } 17338 17339 } 17340 17341 // If no intersecting containers found, return 17342 if ( !innermostContainer ) { 17343 return; 17344 } 17345 17346 // Move the item into the container if it's not there already 17347 if ( this.containers.length === 1 ) { 17348 if ( !this.containers[ innermostIndex ].containerCache.over ) { 17349 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 17350 this.containers[ innermostIndex ].containerCache.over = 1; 17351 } 17352 } else { 17353 17354 // When entering a new container, we will find the item with the least distance and 17355 // append our item near it 17356 dist = 10000; 17357 itemWithLeastDistance = null; 17358 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 17359 posProperty = floating ? "left" : "top"; 17360 sizeProperty = floating ? "width" : "height"; 17361 axis = floating ? "pageX" : "pageY"; 17362 17363 for ( j = this.items.length - 1; j >= 0; j-- ) { 17364 if ( !$.contains( 17365 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 17366 ) { 17367 continue; 17368 } 17369 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 17370 continue; 17371 } 17372 17373 cur = this.items[ j ].item.offset()[ posProperty ]; 17374 nearBottom = false; 17375 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 17376 nearBottom = true; 17377 } 17378 17379 if ( Math.abs( event[ axis ] - cur ) < dist ) { 17380 dist = Math.abs( event[ axis ] - cur ); 17381 itemWithLeastDistance = this.items[ j ]; 17382 this.direction = nearBottom ? "up" : "down"; 17383 } 17384 } 17385 17386 //Check if dropOnEmpty is enabled 17387 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 17388 return; 17389 } 17390 17391 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 17392 if ( !this.currentContainer.containerCache.over ) { 17393 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 17394 this.currentContainer.containerCache.over = 1; 17395 } 17396 return; 17397 } 17398 17399 if ( itemWithLeastDistance ) { 17400 this._rearrange( event, itemWithLeastDistance, null, true ); 17401 } else { 17402 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 17403 } 17404 this._trigger( "change", event, this._uiHash() ); 17405 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 17406 this.currentContainer = this.containers[ innermostIndex ]; 17407 17408 //Update the placeholder 17409 this.options.placeholder.update( this.currentContainer, this.placeholder ); 17410 17411 //Update scrollParent 17412 this.scrollParent = this.placeholder.scrollParent(); 17413 17414 //Update overflowOffset 17415 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17416 this.scrollParent[ 0 ].tagName !== "HTML" ) { 17417 this.overflowOffset = this.scrollParent.offset(); 17418 } 17419 17420 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 17421 this.containers[ innermostIndex ].containerCache.over = 1; 17422 } 17423 17424 }, 17425 17426 _createHelper: function( event ) { 17427 17428 var o = this.options, 17429 helper = typeof o.helper === "function" ? 17430 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 17431 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 17432 17433 //Add the helper to the DOM if that didn't happen already 17434 if ( !helper.parents( "body" ).length ) { 17435 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 17436 } 17437 17438 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 17439 this._storedCSS = { 17440 width: this.currentItem[ 0 ].style.width, 17441 height: this.currentItem[ 0 ].style.height, 17442 position: this.currentItem.css( "position" ), 17443 top: this.currentItem.css( "top" ), 17444 left: this.currentItem.css( "left" ) 17445 }; 17446 } 17447 17448 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 17449 helper.width( this.currentItem.width() ); 17450 } 17451 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 17452 helper.height( this.currentItem.height() ); 17453 } 17454 17455 return helper; 17456 17457 }, 17458 17459 _adjustOffsetFromHelper: function( obj ) { 17460 if ( typeof obj === "string" ) { 17461 obj = obj.split( " " ); 17462 } 17463 if ( Array.isArray( obj ) ) { 17464 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 17465 } 17466 if ( "left" in obj ) { 17467 this.offset.click.left = obj.left + this.margins.left; 17468 } 17469 if ( "right" in obj ) { 17470 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 17471 } 17472 if ( "top" in obj ) { 17473 this.offset.click.top = obj.top + this.margins.top; 17474 } 17475 if ( "bottom" in obj ) { 17476 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 17477 } 17478 }, 17479 17480 _getParentOffset: function() { 17481 17482 //Get the offsetParent and cache its position 17483 this.offsetParent = this.helper.offsetParent(); 17484 var po = this.offsetParent.offset(); 17485 17486 // This is a special case where we need to modify a offset calculated on start, since the 17487 // following happened: 17488 // 1. The position of the helper is absolute, so it's position is calculated based on the 17489 // next positioned parent 17490 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 17491 // the document, which means that the scroll is included in the initial calculation of the 17492 // offset of the parent, and never recalculated upon drag 17493 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 17494 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 17495 po.left += this.scrollParent.scrollLeft(); 17496 po.top += this.scrollParent.scrollTop(); 17497 } 17498 17499 // This needs to be actually done for all browsers, since pageX/pageY includes 17500 // this information. 17501 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ) { 17502 po = { top: 0, left: 0 }; 17503 } 17504 17505 return { 17506 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 17507 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 17508 }; 17509 17510 }, 17511 17512 _getRelativeOffset: function() { 17513 17514 if ( this.cssPosition === "relative" ) { 17515 var p = this.currentItem.position(); 17516 return { 17517 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 17518 this.scrollParent.scrollTop(), 17519 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 17520 this.scrollParent.scrollLeft() 17521 }; 17522 } else { 17523 return { top: 0, left: 0 }; 17524 } 17525 17526 }, 17527 17528 _cacheMargins: function() { 17529 this.margins = { 17530 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 17531 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 17532 }; 17533 }, 17534 17535 _cacheHelperProportions: function() { 17536 this.helperProportions = { 17537 width: this.helper.outerWidth(), 17538 height: this.helper.outerHeight() 17539 }; 17540 }, 17541 17542 _setContainment: function() { 17543 17544 var ce, co, over, 17545 o = this.options; 17546 if ( o.containment === "parent" ) { 17547 o.containment = this.helper[ 0 ].parentNode; 17548 } 17549 if ( o.containment === "document" || o.containment === "window" ) { 17550 this.containment = [ 17551 0 - this.offset.relative.left - this.offset.parent.left, 17552 0 - this.offset.relative.top - this.offset.parent.top, 17553 o.containment === "document" ? 17554 this.document.width() : 17555 this.window.width() - this.helperProportions.width - this.margins.left, 17556 ( o.containment === "document" ? 17557 ( this.document.height() || document.body.parentNode.scrollHeight ) : 17558 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 17559 ) - this.helperProportions.height - this.margins.top 17560 ]; 17561 } 17562 17563 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 17564 ce = $( o.containment )[ 0 ]; 17565 co = $( o.containment ).offset(); 17566 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 17567 17568 this.containment = [ 17569 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 17570 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 17571 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 17572 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 17573 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth )
vendor: 1,747 bytes, lines 17573-17625
17573: ce.offsetWidth ) - 17574 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 17575 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 17576 this.helperProportions.width - this.margins.left, 17577 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 17578 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 17579 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 17580 this.helperProportions.height - this.margins.top 17581 ]; 17582 } 17583 17584 }, 17585 17586 _convertPositionTo: function( d, pos ) { 17587 17588 if ( !pos ) { 17589 pos = this.position; 17590 } 17591 var mod = d === "absolute" ? 1 : -1, 17592 scroll = this.cssPosition === "absolute" && 17593 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17594 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 17595 this.offsetParent : 17596 this.scrollParent, 17597 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 17598 17599 return { 17600 top: ( 17601 17602 // The absolute mouse position 17603 pos.top + 17604 17605 // Only for relative positioned nodes: Relative offset from element to offset parent 17606 this.offset.relative.top * mod + 17607 17608 // The offsetParent's offset without borders (offset + border) 17609 this.offset.parent.top * mod - 17610 ( ( this.cssPosition === "fixed" ? 17611 -this.scrollParent.scrollTop() : 17612 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 17613 ), 17614 left: ( 17615 17616 // The absolute mouse position 17617 pos.left + 17618 17619 // Only for relative positioned nodes: Relative offset from element to offset parent 17620 this.offset.relative.left * mod + 17621 17622 // The offsetParent's offset without borders (offset + border) 17623 this.offset.parent.left * mod - 17624 ( ( this.cssPosition === "fixed" ? 17625 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 8,861 bytes, lines 17626-17912
17626 scroll.scrollLeft() ) * mod ) 17627 ) 17628 }; 17629 17630 }, 17631 17632 _generatePosition: function( event ) { 17633 17634 var top, left, 17635 o = this.options, 17636 pageX = event.pageX, 17637 pageY = event.pageY, 17638 scroll = this.cssPosition === "absolute" && 17639 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17640 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 17641 this.offsetParent : 17642 this.scrollParent, 17643 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 17644 17645 // This is another very weird special case that only happens for relative elements: 17646 // 1. If the css position is relative 17647 // 2. and the scroll parent is the document or similar to the offset parent 17648 // we have to refresh the relative offset during the scroll so there are no jumps 17649 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 17650 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 17651 this.offset.relative = this._getRelativeOffset(); 17652 } 17653 17654 /* 17655 * - Position constraining - 17656 * Constrain the position to a mix of grid, containment. 17657 */ 17658 17659 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 17660 17661 if ( this.containment ) { 17662 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 17663 pageX = this.containment[ 0 ] + this.offset.click.left; 17664 } 17665 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 17666 pageY = this.containment[ 1 ] + this.offset.click.top; 17667 } 17668 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 17669 pageX = this.containment[ 2 ] + this.offset.click.left; 17670 } 17671 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 17672 pageY = this.containment[ 3 ] + this.offset.click.top; 17673 } 17674 } 17675 17676 if ( o.grid ) { 17677 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 17678 o.grid[ 1 ] ) * o.grid[ 1 ]; 17679 pageY = this.containment ? 17680 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 17681 top - this.offset.click.top <= this.containment[ 3 ] ) ? 17682 top : 17683 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 17684 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 17685 top; 17686 17687 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 17688 o.grid[ 0 ] ) * o.grid[ 0 ]; 17689 pageX = this.containment ? 17690 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 17691 left - this.offset.click.left <= this.containment[ 2 ] ) ? 17692 left : 17693 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 17694 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 17695 left; 17696 } 17697 17698 } 17699 17700 return { 17701 top: ( 17702 17703 // The absolute mouse position 17704 pageY - 17705 17706 // Click offset (relative to the element) 17707 this.offset.click.top - 17708 17709 // Only for relative positioned nodes: Relative offset from element to offset parent 17710 this.offset.relative.top - 17711 17712 // The offsetParent's offset without borders (offset + border) 17713 this.offset.parent.top + 17714 ( ( this.cssPosition === "fixed" ? 17715 -this.scrollParent.scrollTop() : 17716 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 17717 ), 17718 left: ( 17719 17720 // The absolute mouse position 17721 pageX - 17722 17723 // Click offset (relative to the element) 17724 this.offset.click.left - 17725 17726 // Only for relative positioned nodes: Relative offset from element to offset parent 17727 this.offset.relative.left - 17728 17729 // The offsetParent's offset without borders (offset + border) 17730 this.offset.parent.left + 17731 ( ( this.cssPosition === "fixed" ? 17732 -this.scrollParent.scrollLeft() : 17733 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 17734 ) 17735 }; 17736 17737 }, 17738 17739 _rearrange: function( event, i, a, hardRefresh ) { 17740 17741 if ( a ) { 17742 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 17743 } else { 17744 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 17745 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 17746 } 17747 17748 //Various things done here to improve the performance: 17749 // 1. we create a setTimeout, that calls refreshPositions 17750 // 2. on the instance, we have a counter variable, that get's higher after every append 17751 // 3. on the local scope, we copy the counter variable, and check in the timeout, 17752 // if it's still the same 17753 // 4. this lets only the last addition to the timeout stack through 17754 this.counter = this.counter ? ++this.counter : 1; 17755 var counter = this.counter; 17756 17757 this._delay( function() { 17758 if ( counter === this.counter ) { 17759 17760 //Precompute after each DOM insertion, NOT on mousemove 17761 this.refreshPositions( !hardRefresh ); 17762 } 17763 } ); 17764 17765 }, 17766 17767 _clear: function( event, noPropagation ) { 17768 17769 this.reverting = false; 17770 17771 // We delay all events that have to be triggered to after the point where the placeholder 17772 // has been removed and everything else normalized again 17773 var i, 17774 delayedTriggers = []; 17775 17776 // We first have to update the dom position of the actual currentItem 17777 // Note: don't do it if the current item is already removed (by a user), or it gets 17778 // reappended (see #4088) 17779 if ( !this._noFinalSort && this.currentItem.parent().length ) { 17780 this.placeholder.before( this.currentItem ); 17781 } 17782 this._noFinalSort = null; 17783 17784 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 17785 for ( i in this._storedCSS ) { 17786 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 17787 this._storedCSS[ i ] = ""; 17788 } 17789 } 17790 this.currentItem.css( this._storedCSS ); 17791 this._removeClass( this.currentItem, "ui-sortable-helper" ); 17792 } else { 17793 this.currentItem.show(); 17794 } 17795 17796 if ( this.fromOutside && !noPropagation ) { 17797 delayedTriggers.push( function( event ) { 17798 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 17799 } ); 17800 } 17801 if ( ( this.fromOutside || 17802 this.domPosition.prev !== 17803 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 17804 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 17805 17806 // Trigger update callback if the DOM position has changed 17807 delayedTriggers.push( function( event ) { 17808 this._trigger( "update", event, this._uiHash() ); 17809 } ); 17810 } 17811 17812 // Check if the items Container has Changed and trigger appropriate 17813 // events. 17814 if ( this !== this.currentContainer ) { 17815 if ( !noPropagation ) { 17816 delayedTriggers.push( function( event ) { 17817 this._trigger( "remove", event, this._uiHash() ); 17818 } ); 17819 delayedTriggers.push( ( function( c ) { 17820 return function( event ) { 17821 c._trigger( "receive", event, this._uiHash( this ) ); 17822 }; 17823 } ).call( this, this.currentContainer ) ); 17824 delayedTriggers.push( ( function( c ) { 17825 return function( event ) { 17826 c._trigger( "update", event, this._uiHash( this ) ); 17827 }; 17828 } ).call( this, this.currentContainer ) ); 17829 } 17830 } 17831 17832 //Post events to containers 17833 function delayEvent( type, instance, container ) { 17834 return function( event ) { 17835 container._trigger( type, event, instance._uiHash( instance ) ); 17836 }; 17837 } 17838 for ( i = this.containers.length - 1; i >= 0; i-- ) { 17839 if ( !noPropagation ) { 17840 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 17841 } 17842 if ( this.containers[ i ].containerCache.over ) { 17843 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 17844 this.containers[ i ].containerCache.over = 0; 17845 } 17846 } 17847 17848 //Do what was originally in plugins 17849 if ( this._storedStylesheet ) { 17850 this._storedStylesheet.remove(); 17851 this._storedStylesheet = null; 17852 } 17853 if ( this._storedOpacity ) { 17854 this.helper.css( "opacity", this._storedOpacity ); 17855 } 17856 if ( this._storedZIndex ) { 17857 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 17858 } 17859 17860 this.dragging = false; 17861 17862 if ( !noPropagation ) { 17863 this._trigger( "beforeStop", event, this._uiHash() ); 17864 } 17865 17866 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 17867 // it unbinds ALL events from the original node! 17868 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 17869 17870 if ( !this.cancelHelperRemoval ) { 17871 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 17872 this.helper.remove(); 17873 } 17874 this.helper = null; 17875 } 17876 17877 if ( !noPropagation ) { 17878 for ( i = 0; i < delayedTriggers.length; i++ ) { 17879 17880 // Trigger all delayed events 17881 delayedTriggers[ i ].call( this, event ); 17882 } 17883 this._trigger( "stop", event, this._uiHash() ); 17884 } 17885 17886 this.fromOutside = false; 17887 return !this.cancelHelperRemoval; 17888 17889 }, 17890 17891 _trigger: function() { 17892 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 17893 this.cancel(); 17894 } 17895 }, 17896 17897 _uiHash: function( _inst ) { 17898 var inst = _inst || this; 17899 return { 17900 helper: inst.helper, 17901 placeholder: inst.placeholder || $( [] ), 17902 position: inst.position, 17903 originalPosition: inst.originalPosition, 17904 offset: inst.positionAbs, 17905 item: inst.currentItem, 17906 sender: _inst ? _inst.element : null 17907 }; 17908 } 17909 17910} ); 17911 17912} );
vendor: 3,669 bytes, lines 17913-18076
17913 17914 17915 17916 17917 17918/*! 17919 * jQuery UI Spinner 1.14.1 17920 * https://jqueryui.com 17921 * 17922 * Copyright OpenJS Foundation and other contributors 17923 * Released under the MIT license. 17924 * https://jquery.org/license 17925 */ 17926 17927//>>label: Spinner 17928//>>group: Widgets 17929//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 17930//>>docs: https://api.jqueryui.com/spinner/ 17931//>>demos: https://jqueryui.com/spinner/ 17932//>>css.structure: ../../themes/base/core.css 17933//>>css.structure: ../../themes/base/spinner.css 17934//>>css.theme: ../../themes/base/theme.css 17935 17936( function( factory ) { 17937 "use strict"; 17938 17939 if ( typeof define === "function" && define.amd ) { 17940 17941 // AMD. Register as an anonymous module. 17942 define( [ 17943 "jquery", 17944 "./button", 17945 "../version", 17946 "../keycode", 17947 "../widget" 17948 ], factory ); 17949 } else { 17950 17951 // Browser globals 17952 factory( jQuery ); 17953 } 17954} )( function( $ ) { 17955"use strict"; 17956 17957function spinnerModifier( fn ) { 17958 return function() { 17959 var previous = this.element.val(); 17960 fn.apply( this, arguments ); 17961 this._refresh(); 17962 if ( previous !== this.element.val() ) { 17963 this._trigger( "change" ); 17964 } 17965 }; 17966} 17967 17968$.widget( "ui.spinner", { 17969 version: "1.14.1", 17970 defaultElement: "<input>", 17971 widgetEventPrefix: "spin", 17972 options: { 17973 classes: { 17974 "ui-spinner": "ui-corner-all", 17975 "ui-spinner-down": "ui-corner-br", 17976 "ui-spinner-up": "ui-corner-tr" 17977 }, 17978 culture: null, 17979 icons: { 17980 down: "ui-icon-triangle-1-s", 17981 up: "ui-icon-triangle-1-n" 17982 }, 17983 incremental: true, 17984 max: null, 17985 min: null, 17986 numberFormat: null, 17987 page: 10, 17988 step: 1, 17989 17990 change: null, 17991 spin: null, 17992 start: null, 17993 stop: null 17994 }, 17995 17996 _create: function() { 17997 17998 // handle string values that need to be parsed 17999 this._setOption( "max", this.options.max ); 18000 this._setOption( "min", this.options.min ); 18001 this._setOption( "step", this.options.step ); 18002 18003 // Only format if there is a value, prevents the field from being marked 18004 // as invalid in Firefox, see #9573. 18005 if ( this.value() !== "" ) { 18006 18007 // Format the value, but don't constrain. 18008 this._value( this.element.val(), true ); 18009 } 18010 18011 this._draw(); 18012 this._on( this._events ); 18013 this._refresh(); 18014 18015 // Turning off autocomplete prevents the browser from remembering the 18016 // value when navigating through history, so we re-enable autocomplete 18017 // if the page is unloaded before the widget is destroyed. #7790 18018 this._on( this.window, { 18019 beforeunload: function() { 18020 this.element.removeAttr( "autocomplete" ); 18021 } 18022 } ); 18023 }, 18024 18025 _getCreateOptions: function() { 18026 var options = this._super(); 18027 var element = this.element; 18028 18029 $.each( [ "min", "max", "step" ], function( i, option ) { 18030 var value = element.attr( option ); 18031 if ( value != null && value.length ) { 18032 options[ option ] = value; 18033 } 18034 } ); 18035 18036 return options; 18037 }, 18038 18039 _events: { 18040 keydown: function( event ) { 18041 if ( this._start( event ) && this._keydown( event ) ) { 18042 event.preventDefault(); 18043 } 18044 }, 18045 keyup: "_stop", 18046 focus: function() { 18047 this.previous = this.element.val(); 18048 }, 18049 blur: function( event ) { 18050 this._stop(); 18051 this._refresh(); 18052 if ( this.previous !== this.element.val() ) { 18053 this._trigger( "change", event ); 18054 } 18055 }, 18056 mousewheel: function( event, delta ) { 18057 var activeElement = this.document[ 0 ].activeElement; 18058 var isActive = this.element[ 0 ] === activeElement; 18059 18060 if ( !isActive || !delta ) { 18061 return; 18062 } 18063 18064 if ( !this.spinning && !this._start( event ) ) { 18065 return false; 18066 } 18067 18068 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 18069 clearTimeout( this.mousewheelTimer ); 18070 this.mousewheelTimer = this._delay( function() { 18071 if ( this.spinning ) { 18072 this._stop( event ); 18073 } 18074 }, 100 ); 18075 event.preventDefault(); 18076 },
vendor: 10,035 bytes, lines 18076-18473
18076 18077 "mousedown .ui-spinner-button": function( event ) { 18078 var previous; 18079 18080 // We never want the buttons to have focus; whenever the user is 18081 // interacting with the spinner, the focus should be on the input. 18082 // If the input is focused then this.previous is properly set from 18083 // when the input first received focus. If the input is not focused 18084 // then we need to set this.previous based on the value before spinning. 18085 previous = this.element[ 0 ] === this.document[ 0 ].activeElement ? 18086 this.previous : this.element.val(); 18087 function checkFocus() { 18088 var isActive = this.element[ 0 ] === this.document[ 0 ].activeElement; 18089 if ( !isActive ) { 18090 this.element.trigger( "focus" ); 18091 this.previous = previous; 18092 } 18093 } 18094 18095 // Ensure focus is on (or stays on) the text field 18096 event.preventDefault(); 18097 checkFocus.call( this ); 18098 18099 if ( this._start( event ) === false ) { 18100 return; 18101 } 18102 18103 this._repeat( null, $( event.currentTarget ) 18104 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 18105 }, 18106 "mouseup .ui-spinner-button": "_stop", 18107 "mouseenter .ui-spinner-button": function( event ) { 18108 18109 // button will add ui-state-active if mouse was down while mouseleave and kept down 18110 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 18111 return; 18112 } 18113 18114 if ( this._start( event ) === false ) { 18115 return false; 18116 } 18117 this._repeat( null, $( event.currentTarget ) 18118 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 18119 }, 18120 18121 // TODO: do we really want to consider this a stop? 18122 // shouldn't we just stop the repeater and wait until mouseup before 18123 // we trigger the stop event? 18124 "mouseleave .ui-spinner-button": "_stop" 18125 }, 18126 18127 // Support mobile enhanced option and make backcompat more sane 18128 _enhance: function() { 18129 this.uiSpinner = this.element 18130 .attr( "autocomplete", "off" ) 18131 .wrap( "<span>" ) 18132 .parent() 18133 18134 // Add buttons 18135 .append( 18136 "<a></a><a></a>" 18137 ); 18138 }, 18139 18140 _draw: function() { 18141 this._enhance(); 18142 18143 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 18144 this._addClass( "ui-spinner-input" ); 18145 18146 this.element.attr( "role", "spinbutton" ); 18147 18148 // Button bindings 18149 this.buttons = this.uiSpinner.children( "a" ) 18150 .attr( "tabIndex", -1 ) 18151 .attr( "aria-hidden", true ) 18152 .button( { 18153 classes: { 18154 "ui-button": "" 18155 } 18156 } ); 18157 18158 // TODO: Right now button does not support classes this is already updated in button PR 18159 this._removeClass( this.buttons, "ui-corner-all" ); 18160 18161 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 18162 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 18163 this.buttons.first().button( { 18164 "icon": this.options.icons.up, 18165 "showLabel": false 18166 } ); 18167 this.buttons.last().button( { 18168 "icon": this.options.icons.down, 18169 "showLabel": false 18170 } ); 18171 18172 // IE 6 doesn't understand height: 50% for the buttons 18173 // unless the wrapper has an explicit height 18174 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 18175 this.uiSpinner.height() > 0 ) { 18176 this.uiSpinner.height( this.uiSpinner.height() ); 18177 } 18178 }, 18179 18180 _keydown: function( event ) { 18181 var options = this.options, 18182 keyCode = $.ui.keyCode; 18183 18184 switch ( event.keyCode ) { 18185 case keyCode.UP: 18186 this._repeat( null, 1, event ); 18187 return true; 18188 case keyCode.DOWN: 18189 this._repeat( null, -1, event ); 18190 return true; 18191 case keyCode.PAGE_UP: 18192 this._repeat( null, options.page, event ); 18193 return true; 18194 case keyCode.PAGE_DOWN: 18195 this._repeat( null, -options.page, event ); 18196 return true; 18197 } 18198 18199 return false; 18200 }, 18201 18202 _start: function( event ) { 18203 if ( !this.spinning && this._trigger( "start", event ) === false ) { 18204 return false; 18205 } 18206 18207 if ( !this.counter ) { 18208 this.counter = 1; 18209 } 18210 this.spinning = true; 18211 return true; 18212 }, 18213 18214 _repeat: function( i, steps, event ) { 18215 i = i || 500; 18216 18217 clearTimeout( this.timer ); 18218 this.timer = this._delay( function() { 18219 this._repeat( 40, steps, event ); 18220 }, i ); 18221 18222 this._spin( steps * this.options.step, event ); 18223 }, 18224 18225 _spin: function( step, event ) { 18226 var value = this.value() || 0; 18227 18228 if ( !this.counter ) { 18229 this.counter = 1; 18230 } 18231 18232 value = this._adjustValue( value + step * this._increment( this.counter ) ); 18233 18234 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 18235 this._value( value ); 18236 this.counter++; 18237 } 18238 }, 18239 18240 _increment: function( i ) { 18241 var incremental = this.options.incremental; 18242 18243 if ( incremental ) { 18244 return typeof incremental === "function" ? 18245 incremental( i ) : 18246 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 18247 } 18248 18249 return 1; 18250 }, 18251 18252 _precision: function() { 18253 var precision = this._precisionOf( this.options.step ); 18254 if ( this.options.min !== null ) { 18255 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 18256 } 18257 return precision; 18258 }, 18259 18260 _precisionOf: function( num ) { 18261 var str = num.toString(), 18262 decimal = str.indexOf( "." ); 18263 return decimal === -1 ? 0 : str.length - decimal - 1; 18264 }, 18265 18266 _adjustValue: function( value ) { 18267 var base, aboveMin, 18268 options = this.options; 18269 18270 // Make sure we're at a valid step 18271 // - find out where we are relative to the base (min or 0) 18272 base = options.min !== null ? options.min : 0; 18273 aboveMin = value - base; 18274 18275 // - round to the nearest step 18276 aboveMin = Math.round( aboveMin / options.step ) * options.step; 18277 18278 // - rounding is based on 0, so adjust back to our base 18279 value = base + aboveMin; 18280 18281 // Fix precision from bad JS floating point math 18282 value = parseFloat( value.toFixed( this._precision() ) ); 18283 18284 // Clamp the value 18285 if ( options.max !== null && value > options.max ) { 18286 return options.max; 18287 } 18288 if ( options.min !== null && value < options.min ) { 18289 return options.min; 18290 } 18291 18292 return value; 18293 }, 18294 18295 _stop: function( event ) { 18296 if ( !this.spinning ) { 18297 return; 18298 } 18299 18300 clearTimeout( this.timer ); 18301 clearTimeout( this.mousewheelTimer ); 18302 this.counter = 0; 18303 this.spinning = false; 18304 this._trigger( "stop", event ); 18305 }, 18306 18307 _setOption: function( key, value ) { 18308 var prevValue, first, last; 18309 18310 if ( key === "culture" || key === "numberFormat" ) { 18311 prevValue = this._parse( this.element.val() ); 18312 this.options[ key ] = value; 18313 this.element.val( this._format( prevValue ) ); 18314 return; 18315 } 18316 18317 if ( key === "max" || key === "min" || key === "step" ) { 18318 if ( typeof value === "string" ) { 18319 value = this._parse( value ); 18320 } 18321 } 18322 if ( key === "icons" ) { 18323 first = this.buttons.first().find( ".ui-icon" ); 18324 this._removeClass( first, null, this.options.icons.up ); 18325 this._addClass( first, null, value.up ); 18326 last = this.buttons.last().find( ".ui-icon" ); 18327 this._removeClass( last, null, this.options.icons.down ); 18328 this._addClass( last, null, value.down ); 18329 } 18330 18331 this._super( key, value ); 18332 }, 18333 18334 _setOptionDisabled: function( value ) { 18335 this._super( value ); 18336 18337 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 18338 this.element.prop( "disabled", !!value ); 18339 this.buttons.button( value ? "disable" : "enable" ); 18340 }, 18341 18342 _setOptions: spinnerModifier( function( options ) { 18343 this._super( options ); 18344 } ), 18345 18346 _parse: function( val ) { 18347 if ( typeof val === "string" && val !== "" ) { 18348 val = window.Globalize && this.options.numberFormat ? 18349 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 18350 } 18351 return val === "" || isNaN( val ) ? null : val; 18352 }, 18353 18354 _format: function( value ) { 18355 if ( value === "" ) { 18356 return ""; 18357 } 18358 return window.Globalize && this.options.numberFormat ? 18359 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 18360 value; 18361 }, 18362 18363 _refresh: function() { 18364 this.element.attr( { 18365 "aria-valuemin": this.options.min, 18366 "aria-valuemax": this.options.max, 18367 18368 // TODO: what should we do with values that can't be parsed? 18369 "aria-valuenow": this._parse( this.element.val() ) 18370 } ); 18371 }, 18372 18373 isValid: function() { 18374 var value = this.value(); 18375 18376 // Null is invalid 18377 if ( value === null ) { 18378 return false; 18379 } 18380 18381 // If value gets adjusted, it's invalid 18382 return value === this._adjustValue( value ); 18383 }, 18384 18385 // Update the value without triggering change 18386 _value: function( value, allowAny ) { 18387 var parsed; 18388 if ( value !== "" ) { 18389 parsed = this._parse( value ); 18390 if ( parsed !== null ) { 18391 if ( !allowAny ) { 18392 parsed = this._adjustValue( parsed ); 18393 } 18394 value = this._format( parsed ); 18395 } 18396 } 18397 this.element.val( value ); 18398 this._refresh(); 18399 }, 18400 18401 _destroy: function() { 18402 this.element 18403 .prop( "disabled", false ) 18404 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 18405 18406 this.uiSpinner.replaceWith( this.element ); 18407 }, 18408 18409 stepUp: spinnerModifier( function( steps ) { 18410 this._stepUp( steps ); 18411 } ), 18412 _stepUp: function( steps ) { 18413 if ( this._start() ) { 18414 this._spin( ( steps || 1 ) * this.options.step ); 18415 this._stop(); 18416 } 18417 }, 18418 18419 stepDown: spinnerModifier( function( steps ) { 18420 this._stepDown( steps ); 18421 } ), 18422 _stepDown: function( steps ) { 18423 if ( this._start() ) { 18424 this._spin( ( steps || 1 ) * -this.options.step ); 18425 this._stop(); 18426 } 18427 }, 18428 18429 pageUp: spinnerModifier( function( pages ) { 18430 this._stepUp( ( pages || 1 ) * this.options.page ); 18431 } ), 18432 18433 pageDown: spinnerModifier( function( pages ) { 18434 this._stepDown( ( pages || 1 ) * this.options.page ); 18435 } ), 18436 18437 value: function( newVal ) { 18438 if ( !arguments.length ) { 18439 return this._parse( this.element.val() ); 18440 } 18441 spinnerModifier( this._value ).call( this, newVal ); 18442 }, 18443 18444 widget: function() { 18445 return this.uiSpinner; 18446 } 18447} ); 18448 18449// DEPRECATED 18450// TODO: switch return back to widget declaration at top of file when this is removed 18451if ( $.uiBackCompat === true ) { 18452 18453 // Backcompat for spinner html extension points 18454 $.widget( "ui.spinner", $.ui.spinner, { 18455 _enhance: function() { 18456 this.uiSpinner = this.element 18457 .attr( "autocomplete", "off" ) 18458 .wrap( this._uiSpinnerHtml() ) 18459 .parent() 18460 18461 // Add buttons 18462 .append( this._buttonHtml() ); 18463 }, 18464 _uiSpinnerHtml: function() { 18465 return "<span>"; 18466 }, 18467 18468 _buttonHtml: function() { 18469 return "<a></a><a></a>"; 18470 } 18471 } ); 18472} 18473
vendor: 1,929 bytes, lines 18474-18570
18474return $.ui.spinner; 18475 18476} ); 18477 18478 18479 18480 18481 18482/*! 18483 * jQuery UI Tabs 1.14.1 18484 * https://jqueryui.com 18485 * 18486 * Copyright OpenJS Foundation and other contributors 18487 * Released under the MIT license. 18488 * https://jquery.org/license 18489 */ 18490 18491//>>label: Tabs 18492//>>group: Widgets 18493//>>description: Transforms a set of container elements into a tab structure. 18494//>>docs: https://api.jqueryui.com/tabs/ 18495//>>demos: https://jqueryui.com/tabs/ 18496//>>css.structure: ../../themes/base/core.css 18497//>>css.structure: ../../themes/base/tabs.css 18498//>>css.theme: ../../themes/base/theme.css 18499 18500( function( factory ) { 18501 "use strict"; 18502 18503 if ( typeof define === "function" && define.amd ) { 18504 18505 // AMD. Register as an anonymous module. 18506 define( [ 18507 "jquery", 18508 "../keycode", 18509 "../unique-id", 18510 "../version", 18511 "../widget" 18512 ], factory ); 18513 } else { 18514 18515 // Browser globals 18516 factory( jQuery ); 18517 } 18518} )( function( $ ) { 18519"use strict"; 18520 18521$.widget( "ui.tabs", { 18522 version: "1.14.1", 18523 delay: 300, 18524 options: { 18525 active: null, 18526 classes: { 18527 "ui-tabs": "ui-corner-all", 18528 "ui-tabs-nav": "ui-corner-all", 18529 "ui-tabs-panel": "ui-corner-bottom", 18530 "ui-tabs-tab": "ui-corner-top" 18531 }, 18532 collapsible: false, 18533 event: "click", 18534 heightStyle: "content", 18535 hide: null, 18536 show: null, 18537 18538 // Callbacks 18539 activate: null, 18540 beforeActivate: null, 18541 beforeLoad: null, 18542 load: null 18543 }, 18544 18545 _isLocal: ( function() { 18546 var rhash = /#.*$/; 18547 18548 return function( anchor ) { 18549 var anchorUrl, locationUrl; 18550 18551 anchorUrl = anchor.href.replace( rhash, "" ); 18552 locationUrl = location.href.replace( rhash, "" ); 18553 18554 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 18555 try { 18556 anchorUrl = decodeURIComponent( anchorUrl ); 18557 } catch ( error ) {} 18558 try { 18559 locationUrl = decodeURIComponent( locationUrl ); 18560 } catch ( error ) {} 18561 18562 return anchor.hash.length > 1 && anchorUrl === locationUrl; 18563 }; 18564 } )(), 18565 18566 _create: function() { 18567 var that = this, 18568 options = this.options; 18569 18570 this.running = false;
vendor: 10,605 bytes, lines 18571-18971
18571 18572 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 18573 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 18574 18575 this._processTabs(); 18576 options.active = this._initialActive(); 18577 18578 // Take disabling tabs via class attribute from HTML 18579 // into account and update option properly. 18580 if ( Array.isArray( options.disabled ) ) { 18581 options.disabled = $.uniqueSort( options.disabled.concat( 18582 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 18583 return that.tabs.index( li ); 18584 } ) 18585 ) ).sort(); 18586 } 18587 18588 // Check for length avoids error when initializing empty list 18589 if ( this.options.active !== false && this.anchors.length ) { 18590 this.active = this._findActive( options.active ); 18591 } else { 18592 this.active = $(); 18593 } 18594 18595 this._refresh(); 18596 18597 if ( this.active.length ) { 18598 this.load( options.active ); 18599 } 18600 }, 18601 18602 _initialActive: function() { 18603 var active = this.options.active, 18604 collapsible = this.options.collapsible, 18605 locationHashDecoded = decodeURIComponent( location.hash.substring( 1 ) ); 18606 18607 if ( active === null ) { 18608 18609 // check the fragment identifier in the URL 18610 if ( locationHashDecoded ) { 18611 this.tabs.each( function( i, tab ) { 18612 if ( $( tab ).attr( "aria-controls" ) === locationHashDecoded ) { 18613 active = i; 18614 return false; 18615 } 18616 } ); 18617 } 18618 18619 // Check for a tab marked active via a class 18620 if ( active === null ) { 18621 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 18622 } 18623 18624 // No active tab, set to false 18625 if ( active === null || active === -1 ) { 18626 active = this.tabs.length ? 0 : false; 18627 } 18628 } 18629 18630 // Handle numbers: negative, out of range 18631 if ( active !== false ) { 18632 active = this.tabs.index( this.tabs.eq( active ) ); 18633 if ( active === -1 ) { 18634 active = collapsible ? false : 0; 18635 } 18636 } 18637 18638 // Don't allow collapsible: false and active: false 18639 if ( !collapsible && active === false && this.anchors.length ) { 18640 active = 0; 18641 } 18642 18643 return active; 18644 }, 18645 18646 _getCreateEventData: function() { 18647 return { 18648 tab: this.active, 18649 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 18650 }; 18651 }, 18652 18653 _tabKeydown: function( event ) { 18654 var focusedTab = $( this.document[ 0 ].activeElement ).closest( "li" ), 18655 selectedIndex = this.tabs.index( focusedTab ), 18656 goingForward = true; 18657 18658 if ( this._handlePageNav( event ) ) { 18659 return; 18660 } 18661 18662 switch ( event.keyCode ) { 18663 case $.ui.keyCode.RIGHT: 18664 case $.ui.keyCode.DOWN: 18665 selectedIndex++; 18666 break; 18667 case $.ui.keyCode.UP: 18668 case $.ui.keyCode.LEFT: 18669 goingForward = false; 18670 selectedIndex--; 18671 break; 18672 case $.ui.keyCode.END: 18673 selectedIndex = this.anchors.length - 1; 18674 break; 18675 case $.ui.keyCode.HOME: 18676 selectedIndex = 0; 18677 break; 18678 case $.ui.keyCode.SPACE: 18679 18680 // Activate only, no collapsing 18681 event.preventDefault(); 18682 clearTimeout( this.activating ); 18683 this._activate( selectedIndex ); 18684 return; 18685 case $.ui.keyCode.ENTER: 18686 18687 // Toggle (cancel delayed activation, allow collapsing) 18688 event.preventDefault(); 18689 clearTimeout( this.activating ); 18690 18691 // Determine if we should collapse or activate 18692 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 18693 return; 18694 default: 18695 return; 18696 } 18697 18698 // Focus the appropriate tab, based on which key was pressed 18699 event.preventDefault(); 18700 clearTimeout( this.activating ); 18701 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 18702 18703 // Navigating with control/command key will prevent automatic activation 18704 if ( !event.ctrlKey && !event.metaKey ) { 18705 18706 // Update aria-selected immediately so that AT think the tab is already selected. 18707 // Otherwise AT may confuse the user by stating that they need to activate the tab, 18708 // but the tab will already be activated by the time the announcement finishes. 18709 focusedTab.attr( "aria-selected", "false" ); 18710 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 18711 18712 this.activating = this._delay( function() { 18713 this.option( "active", selectedIndex ); 18714 }, this.delay ); 18715 } 18716 }, 18717 18718 _panelKeydown: function( event ) { 18719 if ( this._handlePageNav( event ) ) { 18720 return; 18721 } 18722 18723 // Ctrl+up moves focus to the current tab 18724 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 18725 event.preventDefault(); 18726 this.active.trigger( "focus" ); 18727 } 18728 }, 18729 18730 // Alt+page up/down moves focus to the previous/next tab (and activates) 18731 _handlePageNav: function( event ) { 18732 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 18733 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 18734 return true; 18735 } 18736 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 18737 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 18738 return true; 18739 } 18740 }, 18741 18742 _findNextTab: function( index, goingForward ) { 18743 var lastTabIndex = this.tabs.length - 1; 18744 18745 function constrain() { 18746 if ( index > lastTabIndex ) { 18747 index = 0; 18748 } 18749 if ( index < 0 ) { 18750 index = lastTabIndex; 18751 } 18752 return index; 18753 } 18754 18755 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 18756 index = goingForward ? index + 1 : index - 1; 18757 } 18758 18759 return index; 18760 }, 18761 18762 _focusNextTab: function( index, goingForward ) { 18763 index = this._findNextTab( index, goingForward ); 18764 this.tabs.eq( index ).trigger( "focus" ); 18765 return index; 18766 }, 18767 18768 _setOption: function( key, value ) { 18769 if ( key === "active" ) { 18770 18771 // _activate() will handle invalid values and update this.options 18772 this._activate( value ); 18773 return; 18774 } 18775 18776 this._super( key, value ); 18777 18778 if ( key === "collapsible" ) { 18779 this._toggleClass( "ui-tabs-collapsible", null, value ); 18780 18781 // Setting collapsible: false while collapsed; open first panel 18782 if ( !value && this.options.active === false ) { 18783 this._activate( 0 ); 18784 } 18785 } 18786 18787 if ( key === "event" ) { 18788 this._setupEvents( value ); 18789 } 18790 18791 if ( key === "heightStyle" ) { 18792 this._setupHeightStyle( value ); 18793 } 18794 }, 18795 18796 refresh: function() { 18797 var options = this.options, 18798 lis = this.tablist.children( ":has(a[href])" ); 18799 18800 // Get disabled tabs from class attribute from HTML 18801 // this will get converted to a boolean if needed in _refresh() 18802 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 18803 return lis.index( tab ); 18804 } ); 18805 18806 this._processTabs(); 18807 18808 // Was collapsed or no tabs 18809 if ( options.active === false || !this.anchors.length ) { 18810 options.active = false; 18811 this.active = $(); 18812 18813 // was active, but active tab is gone 18814 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 18815 18816 // all remaining tabs are disabled 18817 if ( this.tabs.length === options.disabled.length ) { 18818 options.active = false; 18819 this.active = $(); 18820 18821 // activate previous tab 18822 } else { 18823 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 18824 } 18825 18826 // was active, active tab still exists 18827 } else { 18828 18829 // make sure active index is correct 18830 options.active = this.tabs.index( this.active ); 18831 } 18832 18833 this._refresh(); 18834 }, 18835 18836 _refresh: function() { 18837 this._setOptionDisabled( this.options.disabled ); 18838 this._setupEvents( this.options.event ); 18839 this._setupHeightStyle( this.options.heightStyle ); 18840 18841 this.tabs.not( this.active ).attr( { 18842 "aria-selected": "false", 18843 "aria-expanded": "false", 18844 tabIndex: -1 18845 } ); 18846 this.panels.not( this._getPanelForTab( this.active ) ) 18847 .hide() 18848 .attr( { 18849 "aria-hidden": "true" 18850 } ); 18851 18852 // Make sure one tab is in the tab order 18853 if ( !this.active.length ) { 18854 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 18855 } else { 18856 this.active 18857 .attr( { 18858 "aria-selected": "true", 18859 "aria-expanded": "true", 18860 tabIndex: 0 18861 } ); 18862 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 18863 this._getPanelForTab( this.active ) 18864 .show() 18865 .attr( { 18866 "aria-hidden": "false" 18867 } ); 18868 } 18869 }, 18870 18871 _processTabs: function() { 18872 var that = this, 18873 prevTabs = this.tabs, 18874 prevAnchors = this.anchors, 18875 prevPanels = this.panels; 18876 18877 this.tablist = this._getList().attr( "role", "tablist" ); 18878 this._addClass( this.tablist, "ui-tabs-nav", 18879 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 18880 18881 // Prevent users from focusing disabled tabs via click 18882 this.tablist 18883 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 18884 if ( $( this ).is( ".ui-state-disabled" ) ) { 18885 event.preventDefault(); 18886 } 18887 } ); 18888 18889 this.tabs = this.tablist.find( "> li:has(a[href])" ) 18890 .attr( { 18891 role: "tab", 18892 tabIndex: -1 18893 } ); 18894 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 18895 18896 this.anchors = this.tabs.map( function() { 18897 return $( "a", this )[ 0 ]; 18898 } ) 18899 .attr( { 18900 tabIndex: -1 18901 } ); 18902 this._addClass( this.anchors, "ui-tabs-anchor" ); 18903 18904 this.panels = $(); 18905 18906 this.anchors.each( function( i, anchor ) { 18907 var selector, panel, panelId, 18908 anchorId = $( anchor ).uniqueId().attr( "id" ), 18909 tab = $( anchor ).closest( "li" ), 18910 originalAriaControls = tab.attr( "aria-controls" ); 18911 18912 // Inline tab 18913 if ( that._isLocal( anchor ) ) { 18914 selector = decodeURIComponent( anchor.hash ); 18915 panelId = selector.substring( 1 ); 18916 panel = that.element.find( "#" + CSS.escape( panelId ) ); 18917 18918 // remote tab 18919 } else { 18920 18921 // If the tab doesn't already have aria-controls, 18922 // generate an id by using a throw-away element 18923 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 18924 selector = "#" + panelId; 18925 panel = that.element.find( selector ); 18926 if ( !panel.length ) { 18927 panel = that._createPanel( panelId ); 18928 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 18929 } 18930 panel.attr( "aria-live", "polite" ); 18931 } 18932 18933 if ( panel.length ) { 18934 that.panels = that.panels.add( panel ); 18935 } 18936 if ( originalAriaControls ) { 18937 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 18938 } 18939 tab.attr( { 18940 "aria-controls": panelId, 18941 "aria-labelledby": anchorId 18942 } ); 18943 panel.attr( "aria-labelledby", anchorId ); 18944 } ); 18945 18946 this.panels.attr( "role", "tabpanel" ); 18947 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 18948 18949 // Avoid memory leaks (#10056) 18950 if ( prevTabs ) { 18951 this._off( prevTabs.not( this.tabs ) ); 18952 this._off( prevAnchors.not( this.anchors ) ); 18953 this._off( prevPanels.not( this.panels ) ); 18954 } 18955 }, 18956 18957 // Allow overriding how to find the list for rare usage scenarios (#7715) 18958 _getList: function() { 18959 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 18960 }, 18961 18962 _createPanel: function( id ) { 18963 return $( "<div>" ) 18964 .attr( "id", id ) 18965 .data( "ui-tabs-destroy", true ); 18966 }, 18967 18968 _setOptionDisabled: function( disabled ) { 18969 var currentItem, li, i; 18970 18971 if ( Array
vendor: 6,222 bytes, lines 18971-19202
18971.isArray( disabled ) ) { 18972 if ( !disabled.length ) { 18973 disabled = false; 18974 } else if ( disabled.length === this.anchors.length ) { 18975 disabled = true; 18976 } 18977 } 18978 18979 // Disable tabs 18980 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 18981 currentItem = $( li ); 18982 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 18983 currentItem.attr( "aria-disabled", "true" ); 18984 this._addClass( currentItem, null, "ui-state-disabled" ); 18985 } else { 18986 currentItem.removeAttr( "aria-disabled" ); 18987 this._removeClass( currentItem, null, "ui-state-disabled" ); 18988 } 18989 } 18990 18991 this.options.disabled = disabled; 18992 18993 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 18994 disabled === true ); 18995 }, 18996 18997 _setupEvents: function( event ) { 18998 var events = {}; 18999 if ( event ) { 19000 $.each( event.split( " " ), function( index, eventName ) { 19001 events[ eventName ] = "_eventHandler"; 19002 } ); 19003 } 19004 19005 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 19006 19007 // Always prevent the default action, even when disabled 19008 this._on( true, this.anchors, { 19009 click: function( event ) { 19010 event.preventDefault(); 19011 } 19012 } ); 19013 this._on( this.anchors, events ); 19014 this._on( this.tabs, { keydown: "_tabKeydown" } ); 19015 this._on( this.panels, { keydown: "_panelKeydown" } ); 19016 19017 this._focusable( this.tabs ); 19018 this._hoverable( this.tabs ); 19019 }, 19020 19021 _setupHeightStyle: function( heightStyle ) { 19022 var maxHeight, 19023 parent = this.element.parent(); 19024 19025 if ( heightStyle === "fill" ) { 19026 maxHeight = parent.height(); 19027 maxHeight -= this.element.outerHeight() - this.element.height(); 19028 19029 this.element.siblings( ":visible" ).each( function() { 19030 var elem = $( this ), 19031 position = elem.css( "position" ); 19032 19033 if ( position === "absolute" || position === "fixed" ) { 19034 return; 19035 } 19036 maxHeight -= elem.outerHeight( true ); 19037 } ); 19038 19039 this.element.children().not( this.panels ).each( function() { 19040 maxHeight -= $( this ).outerHeight( true ); 19041 } ); 19042 19043 this.panels.each( function() { 19044 $( this ).height( Math.max( 0, maxHeight - 19045 $( this ).innerHeight() + $( this ).height() ) ); 19046 } ) 19047 .css( "overflow", "auto" ); 19048 } else if ( heightStyle === "auto" ) { 19049 maxHeight = 0; 19050 this.panels.each( function() { 19051 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 19052 } ).height( maxHeight ); 19053 } 19054 }, 19055 19056 _eventHandler: function( event ) { 19057 var options = this.options, 19058 active = this.active, 19059 anchor = $( event.currentTarget ), 19060 tab = anchor.closest( "li" ), 19061 clickedIsActive = tab[ 0 ] === active[ 0 ], 19062 collapsing = clickedIsActive && options.collapsible, 19063 toShow = collapsing ? $() : this._getPanelForTab( tab ), 19064 toHide = !active.length ? $() : this._getPanelForTab( active ), 19065 eventData = { 19066 oldTab: active, 19067 oldPanel: toHide, 19068 newTab: collapsing ? $() : tab, 19069 newPanel: toShow 19070 }; 19071 19072 event.preventDefault(); 19073 19074 if ( tab.hasClass( "ui-state-disabled" ) || 19075 19076 // tab is already loading 19077 tab.hasClass( "ui-tabs-loading" ) || 19078 19079 // can't switch durning an animation 19080 this.running || 19081 19082 // click on active header, but not collapsible 19083 ( clickedIsActive && !options.collapsible ) || 19084 19085 // allow canceling activation 19086 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 19087 return; 19088 } 19089 19090 options.active = collapsing ? false : this.tabs.index( tab ); 19091 19092 this.active = clickedIsActive ? $() : tab; 19093 if ( this.xhr ) { 19094 this.xhr.abort(); 19095 } 19096 19097 if ( !toHide.length && !toShow.length ) { 19098 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 19099 } 19100 19101 if ( toShow.length ) { 19102 this.load( this.tabs.index( tab ), event ); 19103 } 19104 this._toggle( event, eventData ); 19105 }, 19106 19107 // Handles show/hide for selecting tabs 19108 _toggle: function( event, eventData ) { 19109 var that = this, 19110 toShow = eventData.newPanel, 19111 toHide = eventData.oldPanel; 19112 19113 this.running = true; 19114 19115 function complete() { 19116 that.running = false; 19117 that._trigger( "activate", event, eventData ); 19118 } 19119 19120 function show() { 19121 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 19122 19123 if ( toShow.length && that.options.show ) { 19124 that._show( toShow, that.options.show, complete ); 19125 } else { 19126 toShow.show(); 19127 complete(); 19128 } 19129 } 19130 19131 // Start out by hiding, then showing, then completing 19132 if ( toHide.length && this.options.hide ) { 19133 this._hide( toHide, this.options.hide, function() { 19134 that._removeClass( eventData.oldTab.closest( "li" ), 19135 "ui-tabs-active", "ui-state-active" ); 19136 show(); 19137 } ); 19138 } else { 19139 this._removeClass( eventData.oldTab.closest( "li" ), 19140 "ui-tabs-active", "ui-state-active" ); 19141 toHide.hide(); 19142 show(); 19143 } 19144 19145 toHide.attr( "aria-hidden", "true" ); 19146 eventData.oldTab.attr( { 19147 "aria-selected": "false", 19148 "aria-expanded": "false" 19149 } ); 19150 19151 // If we're switching tabs, remove the old tab from the tab order. 19152 // If we're opening from collapsed state, remove the previous tab from the tab order. 19153 // If we're collapsing, then keep the collapsing tab in the tab order. 19154 if ( toShow.length && toHide.length ) { 19155 eventData.oldTab.attr( "tabIndex", -1 ); 19156 } else if ( toShow.length ) { 19157 this.tabs.filter( function() { 19158 return $( this ).attr( "tabIndex" ) === 0; 19159 } ) 19160 .attr( "tabIndex", -1 ); 19161 } 19162 19163 toShow.attr( "aria-hidden", "false" ); 19164 eventData.newTab.attr( { 19165 "aria-selected": "true", 19166 "aria-expanded": "true", 19167 tabIndex: 0 19168 } ); 19169 }, 19170 19171 _activate: function( index ) { 19172 var anchor, 19173 active = this._findActive( index ); 19174 19175 // Trying to activate the already active panel 19176 if ( active[ 0 ] === this.active[ 0 ] ) { 19177 return; 19178 } 19179 19180 // Trying to collapse, simulate a click on the current active header 19181 if ( !active.length ) { 19182 active = this.active; 19183 } 19184 19185 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 19186 this._eventHandler( { 19187 target: anchor, 19188 currentTarget: anchor, 19189 preventDefault: $.noop 19190 } ); 19191 }, 19192 19193 _findActive: function( index ) { 19194 return index === false ? $() : this.tabs.eq( index ); 19195 }, 19196 19197 _getIndex: function( index ) { 19198 19199 // meta-function to give users option to provide a href string instead of a numerical index. 19200 if ( typeof index === "string" ) { 19201 index = this.anchors.index( this.anchors.filter( "[href$='" + 19202
vendor: 15,832 bytes, lines 19202-19806
19202CSS.escape( index ) + "']" ) ); 19203 } 19204 19205 return index; 19206 }, 19207 19208 _destroy: function() { 19209 if ( this.xhr ) { 19210 this.xhr.abort(); 19211 } 19212 19213 this.tablist 19214 .removeAttr( "role" ) 19215 .off( this.eventNamespace ); 19216 19217 this.anchors 19218 .removeAttr( "role tabIndex" ) 19219 .removeUniqueId(); 19220 19221 this.tabs.add( this.panels ).each( function() { 19222 if ( $.data( this, "ui-tabs-destroy" ) ) { 19223 $( this ).remove(); 19224 } else { 19225 $( this ).removeAttr( "role tabIndex " + 19226 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 19227 } 19228 } ); 19229 19230 this.tabs.each( function() { 19231 var li = $( this ), 19232 prev = li.data( "ui-tabs-aria-controls" ); 19233 if ( prev ) { 19234 li 19235 .attr( "aria-controls", prev ) 19236 .removeData( "ui-tabs-aria-controls" ); 19237 } else { 19238 li.removeAttr( "aria-controls" ); 19239 } 19240 } ); 19241 19242 this.panels.show(); 19243 19244 if ( this.options.heightStyle !== "content" ) { 19245 this.panels.css( "height", "" ); 19246 } 19247 }, 19248 19249 enable: function( index ) { 19250 var disabled = this.options.disabled; 19251 if ( disabled === false ) { 19252 return; 19253 } 19254 19255 if ( index === undefined ) { 19256 disabled = false; 19257 } else { 19258 index = this._getIndex( index ); 19259 if ( Array.isArray( disabled ) ) { 19260 disabled = $.map( disabled, function( num ) { 19261 return num !== index ? num : null; 19262 } ); 19263 } else { 19264 disabled = $.map( this.tabs, function( li, num ) { 19265 return num !== index ? num : null; 19266 } ); 19267 } 19268 } 19269 this._setOptionDisabled( disabled ); 19270 }, 19271 19272 disable: function( index ) { 19273 var disabled = this.options.disabled; 19274 if ( disabled === true ) { 19275 return; 19276 } 19277 19278 if ( index === undefined ) { 19279 disabled = true; 19280 } else { 19281 index = this._getIndex( index ); 19282 if ( $.inArray( index, disabled ) !== -1 ) { 19283 return; 19284 } 19285 if ( Array.isArray( disabled ) ) { 19286 disabled = $.merge( [ index ], disabled ).sort(); 19287 } else { 19288 disabled = [ index ]; 19289 } 19290 } 19291 this._setOptionDisabled( disabled ); 19292 }, 19293 19294 load: function( index, event ) { 19295 index = this._getIndex( index ); 19296 var that = this, 19297 tab = this.tabs.eq( index ), 19298 anchor = tab.find( ".ui-tabs-anchor" ), 19299 panel = this._getPanelForTab( tab ), 19300 eventData = { 19301 tab: tab, 19302 panel: panel 19303 }, 19304 complete = function( jqXHR, status ) { 19305 if ( status === "abort" ) { 19306 that.panels.stop( false, true ); 19307 } 19308 19309 that._removeClass( tab, "ui-tabs-loading" ); 19310 panel.removeAttr( "aria-busy" ); 19311 19312 if ( jqXHR === that.xhr ) { 19313 delete that.xhr; 19314 } 19315 }; 19316 19317 // Not remote 19318 if ( this._isLocal( anchor[ 0 ] ) ) { 19319 return; 19320 } 19321 19322 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 19323 19324 if ( this.xhr.statusText !== "canceled" ) { 19325 this._addClass( tab, "ui-tabs-loading" ); 19326 panel.attr( "aria-busy", "true" ); 19327 19328 this.xhr 19329 .done( function( response, status, jqXHR ) { 19330 panel.html( response ); 19331 that._trigger( "load", event, eventData ); 19332 19333 complete( jqXHR, status ); 19334 } ) 19335 .fail( function( jqXHR, status ) { 19336 complete( jqXHR, status ); 19337 } ); 19338 } 19339 }, 19340 19341 _ajaxSettings: function( anchor, event, eventData ) { 19342 var that = this; 19343 return { 19344 url: anchor.attr( "href" ), 19345 beforeSend: function( jqXHR, settings ) { 19346 return that._trigger( "beforeLoad", event, 19347 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 19348 } 19349 }; 19350 }, 19351 19352 _getPanelForTab: function( tab ) { 19353 var id = $( tab ).attr( "aria-controls" ); 19354 return this.element.find( "#" + CSS.escape( id ) ); 19355 } 19356} ); 19357 19358// DEPRECATED 19359// TODO: Switch return back to widget declaration at top of file when this is removed 19360if ( $.uiBackCompat === true ) { 19361 19362 // Backcompat for ui-tab class (now ui-tabs-tab) 19363 $.widget( "ui.tabs", $.ui.tabs, { 19364 _processTabs: function() { 19365 this._superApply( arguments ); 19366 this._addClass( this.tabs, "ui-tab" ); 19367 } 19368 } ); 19369} 19370 19371return $.ui.tabs; 19372 19373} ); 19374 19375 19376 19377 19378 19379 19380/*! 19381 * jQuery UI Tooltip 1.14.1 19382 * https://jqueryui.com 19383 * 19384 * Copyright OpenJS Foundation and other contributors 19385 * Released under the MIT license. 19386 * https://jquery.org/license 19387 */ 19388 19389//>>label: Tooltip 19390//>>group: Widgets 19391//>>description: Shows additional information for any element on hover or focus. 19392//>>docs: https://api.jqueryui.com/tooltip/ 19393//>>demos: https://jqueryui.com/tooltip/ 19394//>>css.structure: ../../themes/base/core.css 19395//>>css.structure: ../../themes/base/tooltip.css 19396//>>css.theme: ../../themes/base/theme.css 19397 19398( function( factory ) { 19399 "use strict"; 19400 19401 if ( typeof define === "function" && define.amd ) { 19402 19403 // AMD. Register as an anonymous module. 19404 define( [ 19405 "jquery", 19406 "../keycode", 19407 "../position", 19408 "../unique-id", 19409 "../version", 19410 "../widget" 19411 ], factory ); 19412 } else { 19413 19414 // Browser globals 19415 factory( jQuery ); 19416 } 19417} )( function( $ ) { 19418"use strict"; 19419 19420$.widget( "ui.tooltip", { 19421 version: "1.14.1", 19422 options: { 19423 classes: { 19424 "ui-tooltip": "ui-corner-all ui-widget-shadow" 19425 }, 19426 content: function() { 19427 var title = $( this ).attr( "title" ); 19428 19429 // Escape title, since we're going from an attribute to raw HTML 19430 return $( "<a>" ).text( title ).html(); 19431 }, 19432 hide: true, 19433 19434 // Disabled elements have inconsistent behavior across browsers (#8661) 19435 items: "[title]:not([disabled])", 19436 position: { 19437 my: "left top+15", 19438 at: "left bottom", 19439 collision: "flipfit flip" 19440 }, 19441 show: true, 19442 track: false, 19443 19444 // Callbacks 19445 close: null, 19446 open: null 19447 }, 19448 19449 _addDescribedBy: function( elem, id ) { 19450 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 19451 describedby.push( id ); 19452 elem 19453 .data( "ui-tooltip-id", id ) 19454 .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) ); 19455 }, 19456 19457 _removeDescribedBy: function( elem ) { 19458 var id = elem.data( "ui-tooltip-id" ), 19459 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 19460 index = $.inArray( id, describedby ); 19461 19462 if ( index !== -1 ) { 19463 describedby.splice( index, 1 ); 19464 } 19465 19466 elem.removeData( "ui-tooltip-id" ); 19467 describedby = String.prototype.trim.call( describedby.join( " " ) ); 19468 if ( describedby ) { 19469 elem.attr( "aria-describedby", describedby ); 19470 } else { 19471 elem.removeAttr( "aria-describedby" ); 19472 } 19473 }, 19474 19475 _create: function() { 19476 this._on( { 19477 mouseover: "open", 19478 focusin: "open" 19479 } ); 19480 19481 // IDs of generated tooltips, needed for destroy 19482 this.tooltips = {}; 19483 19484 // IDs of parent tooltips where we removed the title attribute 19485 this.parents = {}; 19486 19487 // Append the aria-live region so tooltips announce correctly 19488 this.liveRegion = $( "<div>" ) 19489 .attr( { 19490 role: "log", 19491 "aria-live": "assertive", 19492 "aria-relevant": "additions" 19493 } ) 19494 .appendTo( this.document[ 0 ].body ); 19495 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 19496 19497 this.disabledTitles = $( [] ); 19498 }, 19499 19500 _setOption: function( key, value ) { 19501 var that = this; 19502 19503 this._super( key, value ); 19504 19505 if ( key === "content" ) { 19506 $.each( this.tooltips, function( id, tooltipData ) { 19507 that._updateContent( tooltipData.element ); 19508 } ); 19509 } 19510 }, 19511 19512 _setOptionDisabled: function( value ) { 19513 this[ value ? "_disable" : "_enable" ](); 19514 }, 19515 19516 _disable: function() { 19517 var that = this; 19518 19519 // Close open tooltips 19520 $.each( this.tooltips, function( id, tooltipData ) { 19521 var event = $.Event( "blur" ); 19522 event.target = event.currentTarget = tooltipData.element[ 0 ]; 19523 that.close( event, true ); 19524 } ); 19525 19526 // Remove title attributes to prevent native tooltips 19527 this.disabledTitles = this.disabledTitles.add( 19528 this.element.find( this.options.items ).addBack() 19529 .filter( function() { 19530 var element = $( this ); 19531 if ( element.is( "[title]" ) ) { 19532 return element 19533 .data( "ui-tooltip-title", element.attr( "title" ) ) 19534 .removeAttr( "title" ); 19535 } 19536 } ) 19537 ); 19538 }, 19539 19540 _enable: function() { 19541 19542 // restore title attributes 19543 this.disabledTitles.each( function() { 19544 var element = $( this ); 19545 if ( element.data( "ui-tooltip-title" ) ) { 19546 element.attr( "title", element.data( "ui-tooltip-title" ) ); 19547 } 19548 } ); 19549 this.disabledTitles = $( [] ); 19550 }, 19551 19552 open: function( event ) { 19553 var that = this, 19554 target = $( event ? event.target : this.element ) 19555 19556 // we need closest here due to mouseover bubbling, 19557 // but always pointing at the same event target 19558 .closest( this.options.items ); 19559 19560 // No element to show a tooltip for or the tooltip is already open 19561 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 19562 return; 19563 } 19564 19565 if ( target.attr( "title" ) ) { 19566 target.data( "ui-tooltip-title", target.attr( "title" ) ); 19567 } 19568 19569 target.data( "ui-tooltip-open", true ); 19570 19571 // Kill parent tooltips, custom or native, for hover 19572 if ( event && event.type === "mouseover" ) { 19573 target.parents().each( function() { 19574 var parent = $( this ), 19575 blurEvent; 19576 if ( parent.data( "ui-tooltip-open" ) ) { 19577 blurEvent = $.Event( "blur" ); 19578 blurEvent.target = blurEvent.currentTarget = this; 19579 that.close( blurEvent, true ); 19580 } 19581 if ( parent.attr( "title" ) ) { 19582 parent.uniqueId(); 19583 that.parents[ this.id ] = { 19584 element: this, 19585 title: parent.attr( "title" ) 19586 }; 19587 parent.attr( "title", "" ); 19588 } 19589 } ); 19590 } 19591 19592 this._registerCloseHandlers( event, target ); 19593 this._updateContent( target, event ); 19594 }, 19595 19596 _updateContent: function( target, event ) { 19597 var content, 19598 contentOption = this.options.content, 19599 that = this, 19600 eventType = event ? event.type : null; 19601 19602 if ( typeof contentOption === "string" || contentOption.nodeType || 19603 contentOption.jquery ) { 19604 return this._open( event, target, contentOption ); 19605 } 19606 19607 content = contentOption.call( target[ 0 ], function( response ) { 19608 19609 // Ignore async response if tooltip was closed already 19610 if ( !target.data( "ui-tooltip-open" ) ) { 19611 return; 19612 } 19613 19614 // JQuery creates a special event for focusin when it doesn't 19615 // exist natively. To improve performance, the native event 19616 // object is reused and the type is changed. Therefore, we can't 19617 // rely on the type being correct after the event finished 19618 // bubbling, so we set it back to the previous value. (#8740) 19619 if ( event ) { 19620 event.type = eventType; 19621 } 19622 that._open( event, target, response ); 19623 } ); 19624 if ( content ) { 19625 this._open( event, target, content ); 19626 } 19627 }, 19628 19629 _open: function( event, target, content ) { 19630 var tooltipData, tooltip, delayedShow, a11yContent, 19631 positionOption = $.extend( {}, this.options.position ); 19632 19633 if ( !content ) { 19634 return; 19635 } 19636 19637 // Content can be updated multiple times. If the tooltip already 19638 // exists, then just update the content and bail. 19639 tooltipData = this._find( target ); 19640 if ( tooltipData ) { 19641 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 19642 return; 19643 } 19644 19645 // If we have a title, clear it to prevent the native tooltip 19646 // we have to check first to avoid defining a title if none exists 19647 // (we don't want to cause an element to start matching [title]) 19648 // 19649 // We use removeAttr only for key events, to allow IE to export the correct 19650 // accessible attributes. For mouse events, set to empty string to avoid 19651 // native tooltip showing up (happens only when removing inside mouseover). 19652 if ( target.is( "[title]" ) ) { 19653 if ( event && event.type === "mouseover" ) { 19654 target.attr( "title", "" ); 19655 } else { 19656 target.removeAttr( "title" ); 19657 } 19658 } 19659 19660 tooltipData = this._tooltip( target ); 19661 tooltip = tooltipData.tooltip; 19662 this._addDescribedBy( target, tooltip.attr( "id" ) ); 19663 tooltip.find( ".ui-tooltip-content" ).html( content ); 19664 19665 // Support: Voiceover on OS X, JAWS on IE <= 9 19666 // JAWS announces deletions even when aria-relevant="additions" 19667 // Voiceover will sometimes re-read the entire log region's contents from the beginning 19668 this.liveRegion.children().hide(); 19669 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 19670 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 19671 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 19672 a11yContent.appendTo( this.liveRegion ); 19673 19674 function position( event ) { 19675 positionOption.of = event; 19676 if ( tooltip.is( ":hidden" ) ) { 19677 return; 19678 } 19679 tooltip.position( positionOption ); 19680 } 19681 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 19682 this._on( this.document, { 19683 mousemove: position 19684 } ); 19685 19686 // trigger once to override element-relative positioning 19687 position( event ); 19688 } else { 19689 tooltip.position( $.extend( { 19690 of: target 19691 }, this.options.position ) ); 19692 } 19693 19694 tooltip.hide(); 19695 19696 this._show( tooltip, this.options.show ); 19697 19698 // Handle tracking tooltips that are shown with a delay (#8644). As soon 19699 // as the tooltip is visible, position the tooltip using the most recent 19700 // event. 19701 // Adds the check to add the timers only when both delay and track options are set (#14682) 19702 if ( this.options.track && this.options.show && this.options.show.delay ) { 19703 delayedShow = this.delayedShow = setInterval( function() { 19704 if ( tooltip.is( ":visible" ) ) { 19705 position( positionOption.of ); 19706 clearInterval( delayedShow ); 19707 } 19708 }, 13 ); 19709 } 19710 19711 this._trigger( "open", event, { tooltip: tooltip } ); 19712 }, 19713 19714 _registerCloseHandlers: function( event, target ) { 19715 var events = { 19716 keyup: function( event ) { 19717 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 19718 var fakeEvent = $.Event( event ); 19719 fakeEvent.currentTarget = target[ 0 ]; 19720 this.close( fakeEvent, true ); 19721 } 19722 } 19723 }; 19724 19725 // Only bind remove handler for delegated targets. Non-delegated 19726 // tooltips will handle this in destroy. 19727 if ( target[ 0 ] !== this.element[ 0 ] ) { 19728 events.remove = function() { 19729 var targetElement = this._find( target ); 19730 if ( targetElement ) { 19731 this._removeTooltip( targetElement.tooltip ); 19732 } 19733 }; 19734 } 19735 19736 if ( !event || event.type === "mouseover" ) { 19737 events.mouseleave = "close"; 19738 } 19739 if ( !event || event.type === "focusin" ) { 19740 events.focusout = "close"; 19741 } 19742 this._on( true, target, events ); 19743 }, 19744 19745 close: function( event ) { 19746 var tooltip, 19747 that = this, 19748 target = $( event ? event.currentTarget : this.element ), 19749 tooltipData = this._find( target ); 19750 19751 // The tooltip may already be closed 19752 if ( !tooltipData ) { 19753 19754 // We set ui-tooltip-open immediately upon open (in open()), but only set the 19755 // additional data once there's actually content to show (in _open()). So even if the 19756 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 19757 // the period between open() and _open(). 19758 target.removeData( "ui-tooltip-open" ); 19759 return; 19760 } 19761 19762 tooltip = tooltipData.tooltip; 19763 19764 // Disabling closes the tooltip, so we need to track when we're closing 19765 // to avoid an infinite loop in case the tooltip becomes disabled on close 19766 if ( tooltipData.closing ) { 19767 return; 19768 } 19769 19770 // Clear the interval for delayed tracking tooltips 19771 clearInterval( this.delayedShow ); 19772 19773 // Only set title if we had one before (see comment in _open()) 19774 // If the title attribute has changed since open(), don't restore 19775 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 19776 target.attr( "title", target.data( "ui-tooltip-title" ) ); 19777 } 19778 19779 this._removeDescribedBy( target ); 19780 19781 tooltipData.hiding = true; 19782 tooltip.stop( true ); 19783 this._hide( tooltip, this.options.hide, function() { 19784 that._removeTooltip( $( this ) ); 19785 } ); 19786 19787 target.removeData( "ui-tooltip-open" ); 19788 this._off( target, "mouseleave focusout keyup" ); 19789 19790 // Remove 'remove' binding only on delegated targets 19791 if ( target[ 0 ] !== this.element[ 0 ] ) { 19792 this._off( target, "remove" ); 19793 } 19794 this._off( this.document, "mousemove" ); 19795 19796 if ( event && event.type === "mouseleave" ) { 19797 $.each( this.parents, function( id, parent ) { 19798 $( parent.element ).attr( "title", parent.title ); 19799 delete that.parents[ id ]; 19800 } ); 19801 } 19802 19803 tooltipData.closing = true; 19804 this._trigger( "close", event, { tooltip: tooltip } ); 19805 if ( !tooltipData.hiding ) { 19806 tooltipData.closing = false;
19807 } 19808 }, 19809 19810 _tooltip: function( element ) { 19811 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 19812 content = $( "<div>" ).appendTo( tooltip ), 19813 id = tooltip.uniqueId().attr( "id" ); 19814 19815 this._addClass( content, "ui-tooltip-content" ); 19816 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 19817 19818 tooltip.appendTo( this._appendTo( element ) ); 19819 19820 return this.tooltips[ id ] = { 19821 element: element, 19822 tooltip: tooltip 19823 }; 19824 }, 19825 19826 _find: function( target ) { 19827 var id = target.data( "ui-tooltip-id" ); 19828 return id ? this.tooltips[ id ] : null; 19829 }, 19830 19831 _removeTooltip: function( tooltip ) { 19832 19833 // Clear the interval for delayed tracking tooltips 19834 clearInterval( this.delayedShow ); 19835 19836 tooltip.remove(); 19837 delete this.tooltips[ tooltip.attr( "id" ) ]; 19838 }, 19839 19840 _appendTo: function( target ) { 19841 var element = target.closest( ".ui-front, dialog" ); 19842 19843 if ( !element.length ) { 19844 element = this.document[ 0 ].body; 19845 } 19846 19847 return element; 19848 }, 19849 19850 _destroy: function() { 19851 var that = this; 19852 19853 // Close open tooltips 19854 $.each( this.tooltips, function( id, tooltipData ) { 19855 19856 // Delegate to close method to handle common cleanup 19857 var event = $.Event( "blur" ), 19858 element = tooltipData.element; 19859 event.target = event.currentTarget = element[ 0 ]; 19860 that.close( event, true ); 19861 19862 // Remove immediately; destroying an open tooltip doesn't use the 19863 // hide animation 19864 $( "#" + id ).remove(); 19865 19866 // Restore the title 19867 if ( element.data( "ui-tooltip-title" ) ) { 19868 19869 // If the title attribute has changed since open(), don't restore 19870 if ( !element.attr( "title" ) ) { 19871 element.attr( "title", element.data( "ui-tooltip-title" ) ); 19872 } 19873 element.removeData( "ui-tooltip-title" ); 19874 } 19875 } ); 19876 this.liveRegion.remove(); 19877 } 19878} ); 19879 19880// DEPRECATED 19881// TODO: Switch return back to widget declaration at top of file when this is removed 19882if ( $.uiBackCompat === true ) { 19883 19884 // Backcompat for tooltipClass option 19885 $.widget( "ui.tooltip", $.ui.tooltip, { 19886 options: { 19887 tooltipClass: null 19888 }, 19889 _tooltip: function() { 19890 var tooltipData = this._superApply( arguments ); 19891 if ( this.options.tooltipClass ) { 19892 tooltipData.tooltip.addClass( this.options.tooltipClass ); 19893 } 19894 return tooltipData; 19895 } 19896 } ); 19897} 19898 19899return $.ui.tooltip; 19900 19901} ); 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954/*! 19955 * jQuery Plugin: Are-You-Sure (Dirty Form Detection) 19956 * https://github.com/codedance/jquery.AreYouSure/ 19957 * 19958 * Copyright (c) 2012-2014, Chris Dance and PaperCut Software http://www.papercut.com/ 19959 * Dual licensed under the MIT or GPL Version 2 licenses. 19960 * http://jquery.org/license 19961 * 19962 * Author: [email protected] 19963 * Version: 1.9.0 19964 * Date: 13th August 2014 19965 */ 19966(function($) { 19967 19968 $.fn.areYouSure = function(options) { 19969 19970 var settings = $.extend( 19971 { 19972 'message' : 'You have unsaved changes!', 19973 'dirtyClass' : 'dirty', 19974 'change' : null, 19975 'silent' : false, 19976 'addRemoveFieldsMarksDirty' : false, 19977 'fieldEvents' : 'change keyup propertychange input', 19978 'fieldSelector': ":input:not(input[type=submit]):not(input[type=button])" 19979 }, options); 19980 19981 var getValue = function($field) { 19982 if ($field.hasClass('ays-ignore') 19983 || $field.hasClass('aysIgnore') 19984 || $field.attr('data-ays-ignore') 19985 || $field.attr('name') === undefined) { 19986 return null; 19987 } 19988 19989 if ($field.is(':disabled')) { 19990 return 'ays-disabled'; 19991 } 19992 19993 var val; 19994 var type = $field.attr('type'); 19995 if ($field.is('select')) { 19996 type = 'select'; 19997 } 19998 19999 switch (type) { 20000 case 'checkbox': 20001 case 'radio': 20002 val = $field.is(':checked'); 20003 break; 20004 case 'select': 20005 val = ''; 20006 $field.find('option').each(function(o) { 20007 var $option = $(this); 20008 if ($option.is(':selected')) { 20009 val += $option.val(); 20010 } 20011 }); 20012 break; 20013 default: 20014 val = $field.val(); 20015 } 20016 20017 return val; 20018 }; 20019 20020 var storeOrigValue = function($field) { 20021 $field.data('ays-orig', getValue($field)); 20022 }; 20023 20024 var checkForm = function(evt) { 20025 20026 var isFieldDirty = function($field) { 20027 var origValue = $field.data('ays-orig'); 20028 if (undefined === origValue) { 20029 return false;
20030 } 20031 return (getValue($field) != origValue); 20032 }; 20033 20034 var $form = ($(this).is('form')) 20035 ? $(this) 20036 : $(this).parents('form'); 20037 20038 // Test on the target first as it's the most likely to be dirty 20039 if (isFieldDirty($(evt.target))) { 20040 setDirtyStatus($form, true); 20041 return; 20042 } 20043 20044 $fields = $form.find(settings.fieldSelector); 20045 20046 if (settings.addRemoveFieldsMarksDirty) { 20047 // Check if field count has changed 20048 var origCount = $form.data("ays-orig-field-count"); 20049 if (origCount != $fields.length) { 20050 setDirtyStatus($form, true); 20051 return; 20052 } 20053 } 20054 20055 // Brute force - check each field 20056 var isDirty = false; 20057 $fields.each(function() { 20058 $field = $(this); 20059 if (isFieldDirty($field)) { 20060 isDirty = true; 20061 return false; // break 20062 } 20063 }); 20064 20065 setDirtyStatus($form, isDirty); 20066 }; 20067 20068 var initForm = function($form) { 20069 var fields = $form.find(settings.fieldSelector); 20070 $(fields).each(function() { storeOrigValue($(this)); }); 20071 $(fields).unbind(settings.fieldEvents, checkForm); 20072 $(fields).bind(settings.fieldEvents, checkForm); 20073 $form.data("ays-orig-field-count", $(fields).length); 20074 setDirtyStatus($form, false); 20075 }; 20076 20077 var setDirtyStatus = function($form, isDirty) { 20078 var changed = isDirty != $form.hasClass(settings.dirtyClass); 20079 $form.toggleClass(settings.dirtyClass, isDirty); 20080 20081 // Fire change event if required 20082 if (changed) { 20083 if (settings.change) settings.change.call($form, $form); 20084 20085 if (isDirty) $form.trigger('dirty.areYouSure', [$form]); 20086 if (!isDirty) $form.trigger('clean.areYouSure', [$form]); 20087 $form.trigger('change.areYouSure', [$form]); 20088 } 20089 }; 20090 20091 var rescan = function() { 20092 var $form = $(this); 20093 var fields = $form.find(settings.fieldSelector); 20094 $(fields).each(function() { 20095 var $field = $(this); 20096 if (!$field.data('ays-orig')) { 20097 storeOrigValue($field); 20098 $field.bind(settings.fieldEvents, checkForm); 20099 } 20100 }); 20101 // Check for changes while we're here 20102 $form.trigger('checkform.areYouSure'); 20103 }; 20104 20105 var reinitialize = function() { 20106 initForm($(this)); 20107 } 20108 20109 if (!settings.silent && !window.aysUnloadSet) { 20110 window.aysUnloadSet = true; 20111 $(window).bind('beforeunload', function() { 20112 $dirtyForms = $("form").filter('.' + settings.dirtyClass); 20113 if ($dirtyForms.length == 0) { 20114 return; 20115 } 20116 // Prevent multiple prompts - seen on Chrome and IE 20117 if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) { 20118 if (window.aysHasPrompted) { 20119 return; 20120 } 20121 window.aysHasPrompted = true; 20122 window.setTimeout(function() {window.aysHasPrompted = false;}, 900); 20123 } 20124 return settings.message; 20125 }); 20126 } 20127 20128 return this.each(function(elem) { 20129 if (!$(this).is('form')) { 20130 return; 20131 } 20132 var $form = $(this); 20133 20134 $form.submit(function() { 20135 $form.removeClass(settings.dirtyClass); 20136 }); 20137 $form.bind('reset', function() { setDirtyStatus($form, false); }); 20138 // Add a custom events 20139 $form.bind('rescan.areYouSure', rescan); 20140 $form.bind('reinitialize.areYouSure', reinitialize); 20141 $form.bind('checkform.areYouSure', checkForm); 20142 initForm($form); 20143 }); 20144 }; 20145})(jQuery); 20146!function(t){t.fn.railsAutocomplete=function(e){var a=function(){this.railsAutoCompleter||(this.railsAutoCompleter=new t.railsAutocomplete(this))};if(void 0!==t.fn.on){if(!e)return;return t(document).on("focus",e,a)}return this.live("focus",a)},t.railsAutocomplete=function(t){var e=t;this.init(e)},t.railsAutocomplete.options={showNoMatches:!0,noMatchesLabel:"no existing match"},t.railsAutocomplete.fn=t.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},t.railsAutocomplete.fn.extend=t.railsAutocomplete.extend=t.extend,t.railsAutocomplete.fn.extend({init:function(e){function a(t){return t.split(e.delimiter)}function i(t){return a(t).pop().replace(/^\s+/,"")}e.delimiter=t(e).attr("data-delimiter")||null,e.min_length=t(e).attr("data-min-length")||t(e).attr("min-length")||2,e.append_to=t(e).attr("data-append-to")||null,e.autoFocus=t(e).attr("data-auto-focus")||!1,t(e).autocomplete({appendTo:e.append_to,autoFocus:e.autoFocus,delay:t(e).attr("delay")||0,source:function(a,r){var n=this.element[0],o={term:i(a.term)};t(e).attr("data-autocomplete-fields")&&t.each(t.parseJSON(t(e).attr("data-autocomplete-fields")),function(e,a){o[e]=t(a).val()}),t.getJSON(t(e).attr("data-autocomplete"),o,function(){var a={};t.extend(a,t.railsAutocomplete.options),t.each(a,function(i,r){if(a.hasOwnProperty(i)){var n=t(e).attr("data-"+i);a[i]=n?n:r}}),0==arguments[0].length&&t.inArray(a.showNoMatches,[!0,"true"])>=0&&(arguments[0]=[],arguments[0][0]={id:"",label:a.noMatchesLabel}),t(arguments[0]).each(function(a,i){var r={};r[i.id]=i,t(e).data(r)}),r.apply(null,arguments),t(n).trigger("railsAutocomplete.source",arguments)})},change:function(e,a){if(t(this).is("[data-id-element]")&&""!==t(t(this).attr("data-id-element")).val()&&(t(t(this).attr("data-id-element")).val(a.item?a.item.id:"").trigger("change"),t(this).attr("data-update-elements"))){var i=t.parseJSON(t(this).attr("data-update-elements")),r=a.item?t(this).data(a.item.id.toString()):{};if(i&&""===t(i.id).val())return;for(var n in i){var o=t(i[n]);
20146o.is(":checkbox")?null!=r[n]&&o.prop("checked",r[n]):o.val(a.item?r[n]:"").trigger("change")}}},search:function(){var t=i(this.value);return t.length<e.min_length?!1:void 0},focus:function(){return!1},select:function(i,r){if(r.item.value=r.item.value.toString(),-1!=r.item.value.toLowerCase().indexOf("no match")||-1!=r.item.value.toLowerCase().indexOf("too many results"))return t(this).trigger("railsAutocomplete.noMatch",r),!1;var n=a(this.value);if(n.pop(),n.push(r.item.value),null!=e.delimiter)n.push(""),this.value=n.join(e.delimiter);else if(this.value=n.join(""),t(this).attr("data-id-element")&&t(t(this).attr("data-id-element")).val(r.item.id).trigger("change"),t(this).attr("data-update-elements")){var o=r.item,l=-1!=r.item.value.indexOf("Create New")?!0:!1,u=t.parseJSON(t(this).attr("data-update-elements"));for(var s in u)"checkbox"===t(u[s]).attr("type")?o[s]===!0||1===o[s]?t(u[s]).attr("checked","checked"):t(u[s]).removeAttr("checked"):l&&o[s]&&-1==o[s].indexOf("Create New")||!l?t(u[s]).val(o[s]).trigger("change"):t(u[s]).val("").trigger("change")}var c=this.value;return t(this).bind("keyup.clearId",function(){t.trim(t(this).val())!=t.trim(c)&&(t(t(this).attr("data-id-element")).val("").trigger("change"),t(this).unbind("keyup.clearId"))}),t(e).trigger("railsAutocomplete.select",r),!1}}),t(e).trigger("railsAutocomplete.init")}}),t(document).ready(function(){t("input[data-autocomplete]").railsAutocomplete("input[data-autocomplete]")})}(jQuery); 20147 20148 20149 20150 20151 20152 20153// Apply "Are you sure you want to leave this form?" everywhere 20154$(function() { 20155 $('form').areYouSure(); 20156});
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.