vendor: 5,050 bytes, lines 1-136
1/*! jQuery UI - v1.13.3 - 2024-04-26 2 * https://jqueryui.com 3 * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 4 * Copyright OpenJS Foundation and other contributors; Licensed MIT */ 5 6(function (factory) { 7 "use strict"; 8 9 if (typeof define === "function" && define.amd) { 10 // AMD. Register as an anonymous module. 11 define(["jquery"], factory); 12 } else { 13 // Browser globals 14 factory(jQuery); 15 } 16})(function ($) { 17 "use strict"; 18 19 $.ui = $.ui || {}; 20 21 var version = ($.ui.version = "1.13.3"); 22 23 /*! 24 * jQuery UI Widget 1.13.3 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: Widget 33 //>>group: Core 34 //>>description: Provides a factory for creating stateful widgets with a common API. 35 //>>docs: https://api.jqueryui.com/jQuery.widget/ 36 //>>demos: https://jqueryui.com/widget/ 37 38 var widgetUuid = 0; 39 var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 40 var widgetSlice = Array.prototype.slice; 41 42 $.cleanData = (function (orig) { 43 return function (elems) { 44 var events, elem, i; 45 for (i = 0; (elem = elems[i]) != null; i++) { 46 // Only trigger remove when necessary to save time 47 events = $._data(elem, "events"); 48 if (events && events.remove) { 49 $(elem).triggerHandler("remove"); 50 } 51 } 52 orig(elems); 53 }; 54 })($.cleanData); 55 56 $.widget = function (name, base, prototype) { 57 var existingConstructor, constructor, basePrototype; 58 59 // ProxiedPrototype allows the provided prototype to remain unmodified 60 // so that it can be used as a mixin for multiple widgets (#8876) 61 var proxiedPrototype = {}; 62 63 var namespace = name.split(".")[0]; 64 name = name.split(".")[1]; 65 var fullName = namespace + "-" + name; 66 67 if (!prototype) { 68 prototype = base; 69 base = $.Widget; 70 } 71 72 if (Array.isArray(prototype)) { 73 prototype = $.extend.apply(null, [{}].concat(prototype)); 74 } 75 76 // Create selector for plugin 77 $.expr.pseudos[fullName.toLowerCase()] = function (elem) { 78 return !!$.data(elem, fullName); 79 }; 80 81 $[namespace] = $[namespace] || {}; 82 existingConstructor = $[namespace][name]; 83 constructor = $[namespace][name] = function (options, element) { 84 // Allow instantiation without "new" keyword 85 if (!this || !this._createWidget) { 86 return new constructor(options, element); 87 } 88 89 // Allow instantiation without initializing for simple inheritance 90 // must use "new" keyword (the code above always passes args) 91 if (arguments.length) { 92 this._createWidget(options, element); 93 } 94 }; 95 96 // Extend with the existing constructor to carry over any static properties 97 $.extend(constructor, existingConstructor, { 98 version: prototype.version, 99 100 // Copy the object used to create the prototype in case we need to 101 // redefine the widget later 102 _proto: $.extend({}, prototype), 103 104 // Track widgets that inherit from this widget in case this widget is 105 // redefined after a widget inherits from it 106 _childConstructors: [], 107 }); 108 109 basePrototype = new base(); 110 111 // We need to make the options hash a property directly on the new instance 112 // otherwise we'll modify the options hash on the prototype that we're 113 // inheriting from 114 basePrototype.options = $.widget.extend({}, basePrototype.options); 115 $.each(prototype, function (prop, value) { 116 if (typeof value !== "function") { 117 proxiedPrototype[prop] = value; 118 return; 119 } 120 proxiedPrototype[prop] = (function () { 121 function _super() { 122 return base.prototype[prop].apply(this, arguments); 123 } 124 125 function _superApply(args) { 126 return base.prototype[prop].apply(this, args); 127 } 128 129 return function () { 130 var __super = this._super; 131 var __superApply = this._superApply; 132 var returnValue; 133 134 this._super = _super; 135 this._superApply = _superApply; 136
vendor: 21,322 bytes, lines 137-881
137 returnValue = value.apply(this, arguments); 138 139 this._super = __super; 140 this._superApply = __superApply; 141 142 return returnValue; 143 }; 144 })(); 145 }); 146 constructor.prototype = $.widget.extend( 147 basePrototype, 148 { 149 // TODO: remove support for widgetEventPrefix 150 // always use the name + a colon as the prefix, e.g., draggable:start 151 // don't prefix for widgets that aren't DOM-based 152 widgetEventPrefix: existingConstructor 153 ? basePrototype.widgetEventPrefix || name 154 : name, 155 }, 156 proxiedPrototype, 157 { 158 constructor: constructor, 159 namespace: namespace, 160 widgetName: name, 161 widgetFullName: fullName, 162 } 163 ); 164 165 // If this widget is being redefined then we need to find all widgets that 166 // are inheriting from it and redefine all of them so that they inherit from 167 // the new version of this widget. We're essentially trying to replace one 168 // level in the prototype chain. 169 if (existingConstructor) { 170 $.each(existingConstructor._childConstructors, function (i, child) { 171 var childPrototype = child.prototype; 172 173 // Redefine the child widget using the same prototype that was 174 // originally used, but inherit from the new version of the base 175 $.widget( 176 childPrototype.namespace + "." + childPrototype.widgetName, 177 constructor, 178 child._proto 179 ); 180 }); 181 182 // Remove the list of existing child constructors from the old constructor 183 // so the old child constructors can be garbage collected 184 delete existingConstructor._childConstructors; 185 } else { 186 base._childConstructors.push(constructor); 187 } 188 189 $.widget.bridge(name, constructor); 190 191 return constructor; 192 }; 193 194 $.widget.extend = function (target) { 195 var input = widgetSlice.call(arguments, 1); 196 var inputIndex = 0; 197 var inputLength = input.length; 198 var key; 199 var value; 200 201 for (; inputIndex < inputLength; inputIndex++) { 202 for (key in input[inputIndex]) { 203 value = input[inputIndex][key]; 204 if ( 205 widgetHasOwnProperty.call(input[inputIndex], key) && 206 value !== undefined 207 ) { 208 // Clone objects 209 if ($.isPlainObject(value)) { 210 target[key] = $.isPlainObject(target[key]) 211 ? $.widget.extend({}, target[key], value) 212 : // Don't extend strings, arrays, etc. with objects 213 $.widget.extend({}, value); 214 215 // Copy everything else by reference 216 } else { 217 target[key] = value; 218 } 219 } 220 } 221 } 222 return target; 223 }; 224 225 $.widget.bridge = function (name, object) { 226 var fullName = object.prototype.widgetFullName || name; 227 $.fn[name] = function (options) { 228 var isMethodCall = typeof options === "string"; 229 var args = widgetSlice.call(arguments, 1); 230 var returnValue = this; 231 232 if (isMethodCall) { 233 // If this is an empty collection, we need to have the instance method 234 // return undefined instead of the jQuery instance 235 if (!this.length && options === "instance") { 236 returnValue = undefined; 237 } else { 238 this.each(function () { 239 var methodValue; 240 var instance = $.data(this, fullName); 241 242 if (options === "instance") { 243 returnValue = instance; 244 return false; 245 } 246 247 if (!instance) { 248 return $.error( 249 "cannot call methods on " + 250 name + 251 " prior to initialization; " + 252 "attempted to call method '" + 253 options + 254 "'" 255 ); 256 } 257 258 if ( 259 typeof instance[options] !== "function" || 260 options.charAt(0) === "_" 261 ) { 262 return $.error( 263 "no such method '" + 264 options + 265 "' for " + 266 name + 267 " widget instance" 268 ); 269 } 270 271 methodValue = instance[options].apply(instance, args); 272 273 if (methodValue !== instance && methodValue !== undefined) { 274 returnValue = 275 methodValue && methodValue.jquery 276 ? returnValue.pushStack(methodValue.get()) 277 : methodValue; 278 return false; 279 } 280 }); 281 } 282 } else { 283 // Allow multiple hashes to be passed on init 284 if (args.length) { 285 options = $.widget.extend.apply(null, [options].concat(args)); 286 } 287 288 this.each(function () { 289 var instance = $.data(this, fullName); 290 if (instance) { 291 instance.option(options || {}); 292 if (instance._init) { 293 instance._init(); 294 } 295 } else { 296 $.data(this, fullName, new object(options, this)); 297 } 298 }); 299 } 300 301 return returnValue; 302 }; 303 }; 304 305 $.Widget = function (/* options, element */) {}; 306 $.Widget._childConstructors = []; 307 308 $.Widget.prototype = { 309 widgetName: "widget", 310 widgetEventPrefix: "", 311 defaultElement: "<div>", 312 313 options: { 314 classes: {}, 315 disabled: false, 316 317 // Callbacks 318 create: null, 319 }, 320 321 _createWidget: function (options, element) { 322 element = $(element || this.defaultElement || this)[0]; 323 this.element = $(element); 324 this.uuid = widgetUuid++; 325 this.eventNamespace = "." + this.widgetName + this.uuid; 326 327 this.bindings = $(); 328 this.hoverable = $(); 329 this.focusable = $(); 330 this.classesElementLookup = {}; 331 332 if (element !== this) { 333 $.data(element, this.widgetFullName, this); 334 this._on(true, this.element, { 335 remove: function (event) { 336 if (event.target === element) { 337 this.destroy(); 338 } 339 }, 340 }); 341 this.document = $( 342 element.style 343 ? // Element within the document 344 element.ownerDocument 345 : // Element is window or document 346 element.document || element 347 ); 348 this.window = $( 349 this.document[0].defaultView || this.document[0].parentWindow 350 ); 351 } 352 353 this.options = $.widget.extend( 354 {}, 355 this.options, 356 this._getCreateOptions(), 357 options 358 ); 359 360 this._create(); 361 362 if (this.options.disabled) { 363 this._setOptionDisabled(this.options.disabled); 364 } 365 366 this._trigger("create", null, this._getCreateEventData()); 367 this._init(); 368 }, 369 370 _getCreateOptions: function () { 371 return {}; 372 }, 373 374 _getCreateEventData: $.noop, 375 376 _create: $.noop, 377 378 _init: $.noop, 379 380 destroy: function () { 381 var that = this; 382 383 this._destroy(); 384 $.each(this.classesElementLookup, function (key, value) { 385 that._removeClass(value, key); 386 }); 387 388 // We can probably remove the unbind calls in 2.0 389 // all event bindings should go through this._on() 390 this.element.off(this.eventNamespace).removeData(this.widgetFullName); 391 this.widget().off(this.eventNamespace).removeAttr("aria-disabled"); 392 393 // Clean up events and states 394 this.bindings.off(this.eventNamespace); 395 }, 396 397 _destroy: $.noop, 398 399 widget: function () { 400 return this.element; 401 }, 402 403 option: function (key, value) { 404 var options = key; 405 var parts; 406 var curOption; 407 var i; 408 409 if (arguments.length === 0) { 410 // Don't return a reference to the internal hash 411 return $.widget.extend({}, this.options); 412 } 413 414 if (typeof key === "string") { 415 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 416 options = {}; 417 parts = key.split("."); 418 key = parts.shift(); 419 if (parts.length) { 420 curOption = options[key] = $.widget.extend({}, this.options[key]); 421 for (i = 0; i < parts.length - 1; i++) { 422 curOption[parts[i]] = curOption[parts[i]] || {}; 423 curOption = curOption[parts[i]]; 424 } 425 key = parts.pop(); 426 if (arguments.length === 1) { 427 return curOption[key] === undefined ? null : curOption[key]; 428 } 429 curOption[key] = value; 430 } else { 431 if (arguments.length === 1) { 432 return this.options[key] === undefined ? null : this.options[key]; 433 } 434 options[key] = value; 435 } 436 } 437 438 this._setOptions(options); 439 440 return this; 441 }, 442 443 _setOptions: function (options) { 444 var key; 445 446 for (key in options) { 447 this._setOption(key, options[key]); 448 } 449 450 return this; 451 }, 452 453 _setOption: function (key, value) { 454 if (key === "classes") { 455 this._setOptionClasses(value); 456 } 457 458 this.options[key] = value; 459 460 if (key === "disabled") { 461 this._setOptionDisabled(value); 462 } 463 464 return this; 465 }, 466 467 _setOptionClasses: function (value) { 468 var classKey, elements, currentElements; 469 470 for (classKey in value) { 471 currentElements = this.classesElementLookup[classKey]; 472 if ( 473 value[classKey] === this.options.classes[classKey] || 474 !currentElements || 475 !currentElements.length 476 ) { 477 continue; 478 } 479 480 // We are doing this to create a new jQuery object because the _removeClass() call 481 // on the next line is going to destroy the reference to the current elements being 482 // tracked. We need to save a copy of this collection so that we can add the new classes 483 // below. 484 elements = $(currentElements.get()); 485 this._removeClass(currentElements, classKey); 486 487 // We don't use _addClass() here, because that uses this.options.classes 488 // for generating the string of classes. We want to use the value passed in from 489 // _setOption(), this is the new value of the classes option which was passed to 490 // _setOption(). We pass this value directly to _classes(). 491 elements.addClass( 492 this._classes({ 493 element: elements, 494 keys: classKey, 495 classes: value, 496 add: true, 497 }) 498 ); 499 } 500 }, 501 502 _setOptionDisabled: function (value) { 503 this._toggleClass( 504 this.widget(), 505 this.widgetFullName + "-disabled", 506 null, 507 !!value 508 ); 509 510 // If the widget is becoming disabled, then nothing is interactive 511 if (value) { 512 this._removeClass(this.hoverable, null, "ui-state-hover"); 513 this._removeClass(this.focusable, null, "ui-state-focus"); 514 } 515 }, 516 517 enable: function () { 518 return this._setOptions({ disabled: false }); 519 }, 520 521 disable: function () { 522 return this._setOptions({ disabled: true }); 523 }, 524 525 _classes: function (options) { 526 var full = []; 527 var that = this; 528 529 options = $.extend( 530 { 531 element: this.element, 532 classes: this.options.classes || {}, 533 }, 534 options 535 ); 536 537 function bindRemoveEvent() { 538 var nodesToBind = []; 539 540 options.element.each(function (_, element) { 541 var isTracked = $.map(that.classesElementLookup, function (elements) { 542 return elements; 543 }).some(function (elements) { 544 return elements.is(element); 545 }); 546 547 if (!isTracked) { 548 nodesToBind.push(element); 549 } 550 }); 551 552 that._on($(nodesToBind), { 553 remove: "_untrackClassesElement", 554 }); 555 } 556 557 function processClassString(classes, checkOption) { 558 var current, i; 559 for (i = 0; i < classes.length; i++) { 560 current = that.classesElementLookup[classes[i]] || $(); 561 if (options.add) { 562 bindRemoveEvent(); 563 current = $( 564 $.uniqueSort(current.get().concat(options.element.get())) 565 ); 566 } else { 567 current = $(current.not(options.element).get()); 568 } 569 that.classesElementLookup[classes[i]] = current; 570 full.push(classes[i]); 571 if (checkOption && options.classes[classes[i]]) { 572 full.push(options.classes[classes[i]]); 573 } 574 } 575 } 576 577 if (options.keys) { 578 processClassString(options.keys.match(/\S+/g) || [], true); 579 } 580 if (options.extra) { 581 processClassString(options.extra.match(/\S+/g) || []); 582 } 583 584 return full.join(" "); 585 }, 586 587 _untrackClassesElement: function (event) { 588 var that = this; 589 $.each(that.classesElementLookup, function (key, value) { 590 if ($.inArray(event.target, value) !== -1) { 591 that.classesElementLookup[key] = $(value.not(event.target).get()); 592 } 593 }); 594 595 this._off($(event.target)); 596 }, 597 598 _removeClass: function (element, keys, extra) { 599 return this._toggleClass(element, keys, extra, false); 600 }, 601 602 _addClass: function (element, keys, extra) { 603 return this._toggleClass(element, keys, extra, true); 604 }, 605 606 _toggleClass: function (element, keys, extra, add) { 607 add = typeof add === "boolean" ? add : extra; 608 var shift = typeof element === "string" || element === null, 609 options = { 610 extra: shift ? keys : extra, 611 keys: shift ? element : keys, 612 element: shift ? this.element : element, 613 add: add, 614 }; 615 options.element.toggleClass(this._classes(options), add); 616 return this; 617 }, 618 619 _on: function (suppressDisabledCheck, element, handlers) { 620 var delegateElement; 621 var instance = this; 622 623 // No suppressDisabledCheck flag, shuffle arguments 624 if (typeof suppressDisabledCheck !== "boolean") { 625 handlers = element; 626 element = suppressDisabledCheck; 627 suppressDisabledCheck = false; 628 } 629 630 // No element argument, shuffle and use this.element 631 if (!handlers) { 632 handlers = element; 633 element = this.element; 634 delegateElement = this.widget(); 635 } else { 636 element = delegateElement = $(element); 637 this.bindings = this.bindings.add(element); 638 } 639 640 $.each(handlers, function (event, handler) { 641 function handlerProxy() { 642 // Allow widgets to customize the disabled handling 643 // - disabled as an array instead of boolean 644 // - disabled class as method for disabling individual parts 645 if ( 646 !suppressDisabledCheck && 647 (instance.options.disabled === true || 648 $(this).hasClass("ui-state-disabled")) 649 ) { 650 return; 651 } 652 return ( 653 typeof handler === "string" ? instance[handler] : handler 654 ).apply(instance, arguments); 655 } 656 657 // Copy the guid so direct unbinding works 658 if (typeof handler !== "string") { 659 handlerProxy.guid = handler.guid = 660 handler.guid || handlerProxy.guid || $.guid++; 661 } 662 663 var match = event.match(/^([\w:-]*)\s*(.*)$/); 664 var eventName = match[1] + instance.eventNamespace; 665 var selector = match[2]; 666 667 if (selector) { 668 delegateElement.on(eventName, selector, handlerProxy); 669 } else { 670 element.on(eventName, handlerProxy); 671 } 672 }); 673 }, 674 675 _off: function (element, eventName) { 676 eventName = 677 (eventName || "").split(" ").join(this.eventNamespace + " ") + 678 this.eventNamespace; 679 element.off(eventName); 680 681 // Clear the stack to avoid memory leaks (#10056) 682 this.bindings = $(this.bindings.not(element).get()); 683 this.focusable = $(this.focusable.not(element).get()); 684 this.hoverable = $(this.hoverable.not(element).get()); 685 }, 686 687 _delay: function (handler, delay) { 688 function handlerProxy() { 689 return ( 690 typeof handler === "string" ? instance[handler] : handler 691 ).apply(instance, arguments); 692 } 693 var instance = this; 694 return setTimeout(handlerProxy, delay || 0); 695 }, 696 697 _hoverable: function (element) { 698 this.hoverable = this.hoverable.add(element); 699 this._on(element, { 700 mouseenter: function (event) { 701 this._addClass($(event.currentTarget), null, "ui-state-hover"); 702 }, 703 mouseleave: function (event) { 704 this._removeClass($(event.currentTarget), null, "ui-state-hover"); 705 }, 706 }); 707 }, 708 709 _focusable: function (element) { 710 this.focusable = this.focusable.add(element); 711 this._on(element, { 712 focusin: function (event) { 713 this._addClass($(event.currentTarget), null, "ui-state-focus"); 714 }, 715 focusout: function (event) { 716 this._removeClass($(event.currentTarget), null, "ui-state-focus"); 717 }, 718 }); 719 }, 720 721 _trigger: function (type, event, data) { 722 var prop, orig; 723 var callback = this.options[type]; 724 725 data = data || {}; 726 event = $.Event(event); 727 event.type = ( 728 type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type 729 ).toLowerCase(); 730 731 // The original event may come from any element 732 // so we need to reset the target on the new event 733 event.target = this.element[0]; 734 735 // Copy original event properties over to the new event 736 orig = event.originalEvent; 737 if (orig) { 738 for (prop in orig) { 739 if (!(prop in event)) { 740 event[prop] = orig[prop]; 741 } 742 } 743 } 744 745 this.element.trigger(event, data); 746 return !( 747 (typeof callback === "function" && 748 callback.apply(this.element[0], [event].concat(data)) === false) || 749 event.isDefaultPrevented() 750 ); 751 }, 752 }; 753 754 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 755 $.Widget.prototype["_" + method] = function (element, options, callback) { 756 if (typeof options === "string") { 757 options = { effect: options }; 758 } 759 760 var hasOptions; 761 var effectName = !options 762 ? method 763 : options === true || typeof options === "number" 764 ? defaultEffect 765 : options.effect || defaultEffect; 766 767 options = options || {}; 768 if (typeof options === "number") { 769 options = { duration: options }; 770 } else if (options === true) { 771 options = {}; 772 } 773 774 hasOptions = !$.isEmptyObject(options); 775 options.complete = callback; 776 777 if (options.delay) { 778 element.delay(options.delay); 779 } 780 781 if (hasOptions && $.effects && $.effects.effect[effectName]) { 782 element[method](options); 783 } else if (effectName !== method && element[effectName]) { 784 element[effectName](options.duration, options.easing, callback); 785 } else { 786 element.queue(function (next) { 787 $(this)[method](); 788 if (callback) { 789 callback.call(element[0]); 790 } 791 next(); 792 }); 793 } 794 }; 795 }); 796 797 var widget = $.widget; 798 799 /*! 800 * jQuery UI Position 1.13.3 801 * https://jqueryui.com 802 * 803 * Copyright OpenJS Foundation and other contributors 804 * Released under the MIT license. 805 * https://jquery.org/license 806 * 807 * https://api.jqueryui.com/position/ 808 */ 809 810 //>>label: Position 811 //>>group: Core 812 //>>description: Positions elements relative to other elements. 813 //>>docs: https://api.jqueryui.com/position/ 814 //>>demos: https://jqueryui.com/position/ 815 816 (function () { 817 var cachedScrollbarWidth, 818 max = Math.max, 819 abs = Math.abs, 820 rhorizontal = /left|center|right/, 821 rvertical = /top|center|bottom/, 822 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 823 rposition = /^\w+/, 824 rpercent = /%$/, 825 _position = $.fn.position; 826 827 function getOffsets(offsets, width, height) { 828 return [ 829 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 830 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1), 831 ]; 832 } 833 834 function parseCss(element, property) { 835 return parseInt($.css(element, property), 10) || 0; 836 } 837 838 function isWindow(obj) { 839 return obj != null && obj === obj.window; 840 } 841 842 function getDimensions(elem) { 843 var raw = elem[0]; 844 if (raw.nodeType === 9) { 845 return { 846 width: elem.width(), 847 height: elem.height(), 848 offset: { top: 0, left: 0 }, 849 }; 850 } 851 if (isWindow(raw)) { 852 return { 853 width: elem.width(), 854 height: elem.height(), 855 offset: { top: elem.scrollTop(), left: elem.scrollLeft() }, 856 }; 857 } 858 if (raw.preventDefault) { 859 return { 860 width: 0, 861 height: 0, 862 offset: { top: raw.pageY, left: raw.pageX }, 863 }; 864 } 865 return { 866 width: elem.outerWidth(), 867 height: elem.outerHeight(), 868 offset: elem.offset(), 869 }; 870 } 871 872 $.position = { 873 scrollbarWidth: function () { 874 if (cachedScrollbarWidth !== undefined) { 875 return cachedScrollbarWidth; 876 } 877 var w1, 878 w2, 879 div = $( 880 "<div style=" + 881 "'display:block;position:absolute;
vendor: 4,169 bytes, lines 881-1004
881width:200px;height:200px;overflow:hidden;'>" + 882 "<div style='height:300px;width:auto;'></div></div>" 883 ), 884 innerDiv = div.children()[0]; 885 886 $("body").append(div); 887 w1 = innerDiv.offsetWidth; 888 div.css("overflow", "scroll"); 889 890 w2 = innerDiv.offsetWidth; 891 892 if (w1 === w2) { 893 w2 = div[0].clientWidth; 894 } 895 896 div.remove(); 897 898 return (cachedScrollbarWidth = w1 - w2); 899 }, 900 getScrollInfo: function (within) { 901 var overflowX = 902 within.isWindow || within.isDocument 903 ? "" 904 : within.element.css("overflow-x"), 905 overflowY = 906 within.isWindow || within.isDocument 907 ? "" 908 : within.element.css("overflow-y"), 909 hasOverflowX = 910 overflowX === "scroll" || 911 (overflowX === "auto" && 912 within.width < within.element[0].scrollWidth), 913 hasOverflowY = 914 overflowY === "scroll" || 915 (overflowY === "auto" && 916 within.height < within.element[0].scrollHeight); 917 return { 918 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 919 height: hasOverflowX ? $.position.scrollbarWidth() : 0, 920 }; 921 }, 922 getWithinInfo: function (element) { 923 var withinElement = $(element || window), 924 isElemWindow = isWindow(withinElement[0]), 925 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9, 926 hasOffset = !isElemWindow && !isDocument; 927 return { 928 element: withinElement, 929 isWindow: isElemWindow, 930 isDocument: isDocument, 931 offset: hasOffset ? $(element).offset() : { left: 0, top: 0 }, 932 scrollLeft: withinElement.scrollLeft(), 933 scrollTop: withinElement.scrollTop(), 934 width: withinElement.outerWidth(), 935 height: withinElement.outerHeight(), 936 }; 937 }, 938 }; 939 940 $.fn.position = function (options) { 941 if (!options || !options.of) { 942 return _position.apply(this, arguments); 943 } 944 945 // Make a copy, we don't want to modify arguments 946 options = $.extend({}, options); 947 948 var atOffset, 949 targetWidth, 950 targetHeight, 951 targetOffset, 952 basePosition, 953 dimensions, 954 // Make sure string options are treated as CSS selectors 955 target = 956 typeof options.of === "string" 957 ? $(document).find(options.of) 958 : $(options.of), 959 within = $.position.getWithinInfo(options.within), 960 scrollInfo = $.position.getScrollInfo(within), 961 collision = (options.collision || "flip").split(" "), 962 offsets = {}; 963 964 dimensions = getDimensions(target); 965 if (target[0].preventDefault) { 966 // Force left top to allow flipping 967 options.at = "left top"; 968 } 969 targetWidth = dimensions.width; 970 targetHeight = dimensions.height; 971 targetOffset = dimensions.offset; 972 973 // Clone to reuse original targetOffset later 974 basePosition = $.extend({}, targetOffset); 975 976 // Force my and at to have valid horizontal and vertical positions 977 // if a value is missing or invalid, it will be converted to center 978 $.each(["my", "at"], function () { 979 var pos = (options[this] || "").split(" "), 980 horizontalOffset, 981 verticalOffset; 982 983 if (pos.length === 1) { 984 pos = rhorizontal.test(pos[0]) 985 ? pos.concat(["center"]) 986 : rvertical.test(pos[0]) 987 ? ["center"].concat(pos) 988 : ["center", "center"]; 989 } 990 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 991 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 992 993 // Calculate offsets 994 horizontalOffset = roffset.exec(pos[0]); 995 verticalOffset = roffset.exec(pos[1]); 996 offsets[this] = [ 997 horizontalOffset ? horizontalOffset[0] : 0, 998 verticalOffset ? verticalOffset[0] : 0, 999 ]; 1000 1001 // Reduce to just the positions without the offsets 1002 options[this] = [rposition.exec(pos[0])[0], rposition.exec(pos[1])[0]]; 1003 }); 1004
vendor: 4,922 bytes, lines 1005-1151
1005 // Normalize collision option 1006 if (collision.length === 1) { 1007 collision[1] = collision[0]; 1008 } 1009 1010 if (options.at[0] === "right") { 1011 basePosition.left += targetWidth; 1012 } else if (options.at[0] === "center") { 1013 basePosition.left += targetWidth / 2; 1014 } 1015 1016 if (options.at[1] === "bottom") { 1017 basePosition.top += targetHeight; 1018 } else if (options.at[1] === "center") { 1019 basePosition.top += targetHeight / 2; 1020 } 1021 1022 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 1023 basePosition.left += atOffset[0]; 1024 basePosition.top += atOffset[1]; 1025 1026 return this.each(function () { 1027 var collisionPosition, 1028 using, 1029 elem = $(this), 1030 elemWidth = elem.outerWidth(), 1031 elemHeight = elem.outerHeight(), 1032 marginLeft = parseCss(this, "marginLeft"), 1033 marginTop = parseCss(this, "marginTop"), 1034 collisionWidth = 1035 elemWidth + 1036 marginLeft + 1037 parseCss(this, "marginRight") + 1038 scrollInfo.width, 1039 collisionHeight = 1040 elemHeight + 1041 marginTop + 1042 parseCss(this, "marginBottom") + 1043 scrollInfo.height, 1044 position = $.extend({}, basePosition), 1045 myOffset = getOffsets( 1046 offsets.my, 1047 elem.outerWidth(), 1048 elem.outerHeight() 1049 ); 1050 1051 if (options.my[0] === "right") { 1052 position.left -= elemWidth; 1053 } else if (options.my[0] === "center") { 1054 position.left -= elemWidth / 2; 1055 } 1056 1057 if (options.my[1] === "bottom") { 1058 position.top -= elemHeight; 1059 } else if (options.my[1] === "center") { 1060 position.top -= elemHeight / 2; 1061 } 1062 1063 position.left += myOffset[0]; 1064 position.top += myOffset[1]; 1065 1066 collisionPosition = { 1067 marginLeft: marginLeft, 1068 marginTop: marginTop, 1069 }; 1070 1071 $.each(["left", "top"], function (i, dir) { 1072 if ($.ui.position[collision[i]]) { 1073 $.ui.position[collision[i]][dir](position, { 1074 targetWidth: targetWidth, 1075 targetHeight: targetHeight, 1076 elemWidth: elemWidth, 1077 elemHeight: elemHeight, 1078 collisionPosition: collisionPosition, 1079 collisionWidth: collisionWidth, 1080 collisionHeight: collisionHeight, 1081 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 1082 my: options.my, 1083 at: options.at, 1084 within: within, 1085 elem: elem, 1086 }); 1087 } 1088 }); 1089 1090 if (options.using) { 1091 // Adds feedback as second argument to using callback, if present 1092 using = function (props) { 1093 var left = targetOffset.left - position.left, 1094 right = left + targetWidth - elemWidth, 1095 top = targetOffset.top - position.top, 1096 bottom = top + targetHeight - elemHeight, 1097 feedback = { 1098 target: { 1099 element: target, 1100 left: targetOffset.left, 1101 top: targetOffset.top, 1102 width: targetWidth, 1103 height: targetHeight, 1104 }, 1105 element: { 1106 element: elem, 1107 left: position.left, 1108 top: position.top, 1109 width: elemWidth, 1110 height: elemHeight, 1111 }, 1112 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1113 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle", 1114 }; 1115 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1116 feedback.horizontal = "center"; 1117 } 1118 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1119 feedback.vertical = "middle"; 1120 } 1121 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1122 feedback.important = "horizontal"; 1123 } else { 1124 feedback.important = "vertical"; 1125 } 1126 options.using.call(this, props, feedback); 1127 }; 1128 } 1129 1130 elem.offset($.extend(position, { using: using })); 1131 }); 1132 }; 1133 1134 $.ui.position = { 1135 fit: { 1136 left: function (position, data) { 1137 var within = data.within, 1138 withinOffset = within.isWindow 1139 ? within.scrollLeft 1140 : within.offset.left, 1141 outerWidth = within.width, 1142 collisionPosLeft = 1143 position.left - data.collisionPosition.marginLeft, 1144 overLeft = withinOffset - collisionPosLeft, 1145 overRight = 1146 collisionPosLeft + 1147 data.collisionWidth - 1148 outerWidth - 1149 withinOffset, 1150 newOverRight; 1151
vendor: 10,881 bytes, lines 1152-1479
1152 // Element is wider than within 1153 if (data.collisionWidth > outerWidth) { 1154 // Element is initially over the left side of within 1155 if (overLeft > 0 && overRight <= 0) { 1156 newOverRight = 1157 position.left + 1158 overLeft + 1159 data.collisionWidth - 1160 outerWidth - 1161 withinOffset; 1162 position.left += overLeft - newOverRight; 1163 1164 // Element is initially over right side of within 1165 } else if (overRight > 0 && overLeft <= 0) { 1166 position.left = withinOffset; 1167 1168 // Element is initially over both left and right sides of within 1169 } else { 1170 if (overLeft > overRight) { 1171 position.left = withinOffset + outerWidth - data.collisionWidth; 1172 } else { 1173 position.left = withinOffset; 1174 } 1175 } 1176 1177 // Too far left -> align with left edge 1178 } else if (overLeft > 0) { 1179 position.left += overLeft; 1180 1181 // Too far right -> align with right edge 1182 } else if (overRight > 0) { 1183 position.left -= overRight; 1184 1185 // Adjust based on position and margin 1186 } else { 1187 position.left = max( 1188 position.left - collisionPosLeft, 1189 position.left 1190 ); 1191 } 1192 }, 1193 top: function (position, data) { 1194 var within = data.within, 1195 withinOffset = within.isWindow 1196 ? within.scrollTop 1197 : within.offset.top, 1198 outerHeight = data.within.height, 1199 collisionPosTop = position.top - data.collisionPosition.marginTop, 1200 overTop = withinOffset - collisionPosTop, 1201 overBottom = 1202 collisionPosTop + 1203 data.collisionHeight - 1204 outerHeight - 1205 withinOffset, 1206 newOverBottom; 1207 1208 // Element is taller than within 1209 if (data.collisionHeight > outerHeight) { 1210 // Element is initially over the top of within 1211 if (overTop > 0 && overBottom <= 0) { 1212 newOverBottom = 1213 position.top + 1214 overTop + 1215 data.collisionHeight - 1216 outerHeight - 1217 withinOffset; 1218 position.top += overTop - newOverBottom; 1219 1220 // Element is initially over bottom of within 1221 } else if (overBottom > 0 && overTop <= 0) { 1222 position.top = withinOffset; 1223 1224 // Element is initially over both top and bottom of within 1225 } else { 1226 if (overTop > overBottom) { 1227 position.top = 1228 withinOffset + outerHeight - data.collisionHeight; 1229 } else { 1230 position.top = withinOffset; 1231 } 1232 } 1233 1234 // Too far up -> align with top 1235 } else if (overTop > 0) { 1236 position.top += overTop; 1237 1238 // Too far down -> align with bottom edge 1239 } else if (overBottom > 0) { 1240 position.top -= overBottom; 1241 1242 // Adjust based on position and margin 1243 } else { 1244 position.top = max(position.top - collisionPosTop, position.top); 1245 } 1246 }, 1247 }, 1248 flip: { 1249 left: function (position, data) { 1250 var within = data.within, 1251 withinOffset = within.offset.left + within.scrollLeft, 1252 outerWidth = within.width, 1253 offsetLeft = within.isWindow 1254 ? within.scrollLeft 1255 : within.offset.left, 1256 collisionPosLeft = 1257 position.left - data.collisionPosition.marginLeft, 1258 overLeft = collisionPosLeft - offsetLeft, 1259 overRight = 1260 collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1261 myOffset = 1262 data.my[0] === "left" 1263 ? -data.elemWidth 1264 : data.my[0] === "right" 1265 ? data.elemWidth 1266 : 0, 1267 atOffset = 1268 data.at[0] === "left" 1269 ? data.targetWidth 1270 : data.at[0] === "right" 1271 ? -data.targetWidth 1272 : 0, 1273 offset = -2 * data.offset[0], 1274 newOverRight, 1275 newOverLeft; 1276 1277 if (overLeft < 0) { 1278 newOverRight = 1279 position.left + 1280 myOffset + 1281 atOffset + 1282 offset + 1283 data.collisionWidth - 1284 outerWidth - 1285 withinOffset; 1286 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1287 position.left += myOffset + atOffset + offset; 1288 } 1289 } else if (overRight > 0) { 1290 newOverLeft = 1291 position.left - 1292 data.collisionPosition.marginLeft + 1293 myOffset + 1294 atOffset + 1295 offset - 1296 offsetLeft; 1297 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1298 position.left += myOffset + atOffset + offset; 1299 } 1300 } 1301 }, 1302 top: function (position, data) { 1303 var within = data.within, 1304 withinOffset = within.offset.top + within.scrollTop, 1305 outerHeight = within.height, 1306 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1307 collisionPosTop = position.top - data.collisionPosition.marginTop, 1308 overTop = collisionPosTop - offsetTop, 1309 overBottom = 1310 collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1311 top = data.my[1] === "top", 1312 myOffset = top 1313 ? -data.elemHeight 1314 : data.my[1] === "bottom" 1315 ? data.elemHeight 1316 : 0, 1317 atOffset = 1318 data.at[1] === "top" 1319 ? data.targetHeight 1320 : data.at[1] === "bottom" 1321 ? -data.targetHeight 1322 : 0, 1323 offset = -2 * data.offset[1], 1324 newOverTop, 1325 newOverBottom; 1326 if (overTop < 0) { 1327 newOverBottom = 1328 position.top + 1329 myOffset + 1330 atOffset + 1331 offset + 1332 data.collisionHeight - 1333 outerHeight - 1334 withinOffset; 1335 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1336 position.top += myOffset + atOffset + offset; 1337 } 1338 } else if (overBottom > 0) { 1339 newOverTop = 1340 position.top - 1341 data.collisionPosition.marginTop + 1342 myOffset + 1343 atOffset + 1344 offset - 1345 offsetTop; 1346 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1347 position.top += myOffset + atOffset + offset; 1348 } 1349 } 1350 }, 1351 }, 1352 flipfit: { 1353 left: function () { 1354 $.ui.position.flip.left.apply(this, arguments); 1355 $.ui.position.fit.left.apply(this, arguments); 1356 }, 1357 top: function () { 1358 $.ui.position.flip.top.apply(this, arguments); 1359 $.ui.position.fit.top.apply(this, arguments); 1360 }, 1361 }, 1362 }; 1363 })(); 1364 1365 var position = $.ui.position; 1366 1367 /*! 1368 * jQuery UI :data 1.13.3 1369 * https://jqueryui.com 1370 * 1371 * Copyright OpenJS Foundation and other contributors 1372 * Released under the MIT license. 1373 * https://jquery.org/license 1374 */ 1375 1376 //>>label: :data Selector 1377 //>>group: Core 1378 //>>description: Selects elements which have data stored under the specified key. 1379 //>>docs: https://api.jqueryui.com/data-selector/ 1380 1381 var data = $.extend($.expr.pseudos, { 1382 data: $.expr.createPseudo 1383 ? $.expr.createPseudo(function (dataName) { 1384 return function (elem) { 1385 return !!$.data(elem, dataName); 1386 }; 1387 }) 1388 : // Support: jQuery <1.8 1389 function (elem, i, match) { 1390 return !!$.data(elem, match[3]); 1391 }, 1392 }); 1393 1394 /*! 1395 * jQuery UI Disable Selection 1.13.3 1396 * https://jqueryui.com 1397 * 1398 * Copyright OpenJS Foundation and other contributors 1399 * Released under the MIT license. 1400 * https://jquery.org/license 1401 */ 1402 1403 //>>label: disableSelection 1404 //>>group: Core 1405 //>>description: Disable selection of text content within the set of matched elements. 1406 //>>docs: https://api.jqueryui.com/disableSelection/ 1407 1408 // This file is deprecated 1409 1410 var disableSelection = $.fn.extend({ 1411 disableSelection: (function () { 1412 var eventType = 1413 "onselectstart" in document.createElement("div") 1414 ? "selectstart" 1415 : "mousedown"; 1416 1417 return function () { 1418 return this.on(eventType + ".ui-disableSelection", function (event) { 1419 event.preventDefault(); 1420 }); 1421 }; 1422 })(), 1423 1424 enableSelection: function () { 1425 return this.off(".ui-disableSelection"); 1426 }, 1427 }); 1428 1429 // Create a local jQuery because jQuery Color relies on it and the 1430 // global may not exist with AMD and a custom build (#10199). 1431 // This module is a noop if used as a regular AMD module. 1432 // eslint-disable-next-line no-unused-vars 1433 var jQuery = $; 1434 1435 /*! 1436 * jQuery Color Animations v2.2.0 1437 * https://github.com/jquery/jquery-color 1438 * 1439 * Copyright OpenJS Foundation and other contributors 1440 * Released under the MIT license. 1441 * https://jquery.org/license 1442 * 1443 * Date: Sun May 10 09:02:36 2020 +0200 1444 */ 1445 1446 var stepHooks = 1447 "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1448 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1449 class2type = {}, 1450 toString = class2type.toString, 1451 // plusequals test for += 100 -= 100 1452 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1453 // a set of RE's that can match strings and generate color tuples. 1454 stringParsers = [ 1455 { 1456 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1457 parse: function (execResult) { 1458 return [execResult[1], execResult[2], execResult[3], execResult[4]]; 1459 }, 1460 }, 1461 { 1462 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1463 parse: function (execResult) { 1464 return [ 1465 execResult[1] * 2.55, 1466 execResult[2] * 2.55, 1467 execResult[3] * 2.55, 1468 execResult[4], 1469 ]; 1470 }, 1471 }, 1472 { 1473 // this regex ignores A-F because it's compared against an already lowercased string 1474 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 1475 parse: function (execResult) { 1476 return [ 1477 parseInt(execResult[1], 16), 1478 parseInt(execResult[2], 16), 1479 parseInt(execResult[3], 16),
1480 execResult[4] ? (parseInt(execResult[4], 16) / 255).toFixed(2) : 1, 1481 ]; 1482 }, 1483 }, 1484 { 1485 // this regex ignores A-F because it's compared against an already lowercased string 1486 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 1487 parse: function (execResult) { 1488 return [ 1489 parseInt(execResult[1] + execResult[1], 16), 1490 parseInt(execResult[2] + execResult[2], 16), 1491 parseInt(execResult[3] + execResult[3], 16), 1492 execResult[4] 1493 ? (parseInt(execResult[4] + execResult[4], 16) / 255).toFixed(2) 1494 : 1, 1495 ]; 1496 }, 1497 }, 1498 { 1499 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1500 space: "hsla", 1501 parse: function (execResult) { 1502 return [ 1503 execResult[1], 1504 execResult[2] / 100, 1505 execResult[3] / 100, 1506 execResult[4], 1507 ]; 1508 }, 1509 }, 1510 ], 1511 // jQuery.Color( ) 1512 color = (jQuery.Color = function (color, green, blue, alpha) { 1513 return new jQuery.Color.fn.parse(color, green, blue, alpha); 1514 }), 1515 spaces = { 1516 rgba: { 1517 props: { 1518 red: { 1519 idx: 0, 1520 type: "byte", 1521 }, 1522 green: { 1523 idx: 1, 1524 type: "byte", 1525 }, 1526 blue: { 1527 idx: 2, 1528 type: "byte", 1529 }, 1530 }, 1531 }, 1532 1533 hsla: { 1534 props: { 1535 hue: { 1536 idx: 0, 1537 type: "degrees", 1538 }, 1539 saturation: { 1540 idx: 1, 1541 type: "percent", 1542 }, 1543 lightness: { 1544 idx: 2, 1545 type: "percent", 1546 }, 1547 }, 1548 }, 1549 }, 1550 propTypes = { 1551 byte: { 1552 floor: true, 1553 max: 255, 1554 }, 1555 percent: { 1556 max: 1, 1557 }, 1558 degrees: { 1559 mod: 360, 1560 floor: true, 1561 }, 1562 }, 1563 support = (color.support = {}), 1564 // element for support tests 1565 supportElem = jQuery("<p>")[0], 1566 // colors = jQuery.Color.names 1567 colors, 1568 // local aliases of functions called often 1569 each = jQuery.each; 1570 1571 // determine rgba support immediately 1572 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1573 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 1574 1575 // define cache name and alpha properties 1576 // for rgba and hsla spaces 1577 each(spaces, function (spaceName, space) { 1578 space.cache = "_" + spaceName; 1579 space.props.alpha = { 1580 idx: 3, 1581 type: "percent", 1582 def: 1, 1583 }; 1584 }); 1585 1586 // Populate the class2type map 1587 jQuery.each( 1588 "Boolean Number String Function Array Date RegExp Object Error Symbol".split( 1589 " " 1590 ), 1591 function (_i, name) { 1592 class2type["[object " + name + "]"] = name.toLowerCase(); 1593 } 1594 ); 1595 1596 function getType(obj) { 1597 if (obj == null) { 1598 return obj + ""; 1599 } 1600 1601 return typeof obj === "object" 1602 ? class2type[toString.call(obj)] || "object" 1603 : typeof obj; 1604 } 1605 1606 function clamp(value, prop, allowEmpty) { 1607 var type = propTypes[prop.type] || {}; 1608 1609 if (value == null) { 1610 return allowEmpty || !prop.def ? null : prop.def; 1611 } 1612 1613 // ~~ is an short way of doing floor for positive numbers 1614 value = type.floor ? ~~value : parseFloat(value); 1615 1616 // IE will pass in empty strings as value for alpha, 1617 // which will hit this case 1618 if (isNaN(value)) { 1619 return prop.def; 1620 } 1621 1622 if (type.mod) { 1623 // we add mod before modding to make sure that negatives values 1624 // get converted properly: -10 -> 350 1625 return (value + type.mod) % type.mod; 1626 } 1627 1628 // for now all property types without mod have min and max 1629 return Math.min(type.max, Math.max(0, value)); 1630 } 1631 1632 function stringParse(string) { 1633 var inst = color(), 1634 rgba = (inst._rgba = []); 1635 1636 string = string.toLowerCase(); 1637 1638 each(stringParsers, function (_i, parser) { 1639 var parsed, 1640 match = parser.re.exec(string), 1641 values = match && parser.parse(match), 1642 spaceName = parser.space || "rgba"; 1643 1644 if (values) { 1645 parsed = inst[spaceName](values); 1646 1647 // if this was an rgba parse the assignment might happen twice 1648 // oh well....
vendor: 2,252 bytes, lines 1649-1720
1649 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 1650 rgba = inst._rgba = parsed._rgba; 1651 1652 // exit each( stringParsers ) here because we matched 1653 return false; 1654 } 1655 }); 1656 1657 // Found a stringParser that handled it 1658 if (rgba.length) { 1659 // if this came from a parsed string, force "transparent" when alpha is 0 1660 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 1661 if (rgba.join() === "0,0,0,0") { 1662 jQuery.extend(rgba, colors.transparent); 1663 } 1664 return inst; 1665 } 1666 1667 // named colors 1668 return colors[string]; 1669 } 1670 1671 color.fn = jQuery.extend(color.prototype, { 1672 parse: function (red, green, blue, alpha) { 1673 if (red === undefined) { 1674 this._rgba = [null, null, null, null]; 1675 return this; 1676 } 1677 if (red.jquery || red.nodeType) { 1678 red = jQuery(red).css(green); 1679 green = undefined; 1680 } 1681 1682 var inst = this, 1683 type = getType(red), 1684 rgba = (this._rgba = []); 1685 1686 // more than 1 argument specified - assume ( red, green, blue, alpha ) 1687 if (green !== undefined) { 1688 red = [red, green, blue, alpha]; 1689 type = "array"; 1690 } 1691 1692 if (type === "string") { 1693 return this.parse(stringParse(red) || colors._default); 1694 } 1695 1696 if (type === "array") { 1697 each(spaces.rgba.props, function (_key, prop) { 1698 rgba[prop.idx] = clamp(red[prop.idx], prop); 1699 }); 1700 return this; 1701 } 1702 1703 if (type === "object") { 1704 if (red instanceof color) { 1705 each(spaces, function (_spaceName, space) { 1706 if (red[space.cache]) { 1707 inst[space.cache] = red[space.cache].slice(); 1708 } 1709 }); 1710 } else { 1711 each(spaces, function (_spaceName, space) { 1712 var cache = space.cache; 1713 each(space.props, function (key, prop) { 1714 // if the cache doesn't exist, and we know how to convert 1715 if (!inst[cache] && space.to) { 1716 // if the value was null, we don't need to copy it 1717 // if the key was alpha, we don't need to copy it either 1718 if (key === "alpha" || red[key] == null) { 1719 return; 1720 }
vendor: 23,205 bytes, lines 1721-2547
1721 inst[cache] = space.to(inst._rgba); 1722 } 1723 1724 // this is the only case where we allow nulls for ALL properties. 1725 // call clamp with alwaysAllowEmpty 1726 inst[cache][prop.idx] = clamp(red[key], prop, true); 1727 }); 1728 1729 // everything defined but alpha? 1730 if ( 1731 inst[cache] && 1732 jQuery.inArray(null, inst[cache].slice(0, 3)) < 0 1733 ) { 1734 // use the default of 1 1735 if (inst[cache][3] == null) { 1736 inst[cache][3] = 1; 1737 } 1738 1739 if (space.from) { 1740 inst._rgba = space.from(inst[cache]); 1741 } 1742 } 1743 }); 1744 } 1745 return this; 1746 } 1747 }, 1748 is: function (compare) { 1749 var is = color(compare), 1750 same = true, 1751 inst = this; 1752 1753 each(spaces, function (_, space) { 1754 var localCache, 1755 isCache = is[space.cache]; 1756 if (isCache) { 1757 localCache = 1758 inst[space.cache] || (space.to && space.to(inst._rgba)) || []; 1759 each(space.props, function (_, prop) { 1760 if (isCache[prop.idx] != null) { 1761 same = isCache[prop.idx] === localCache[prop.idx]; 1762 return same; 1763 } 1764 }); 1765 } 1766 return same; 1767 }); 1768 return same; 1769 }, 1770 _space: function () { 1771 var used = [], 1772 inst = this; 1773 each(spaces, function (spaceName, space) { 1774 if (inst[space.cache]) { 1775 used.push(spaceName); 1776 } 1777 }); 1778 return used.pop(); 1779 }, 1780 transition: function (other, distance) { 1781 var end = color(other), 1782 spaceName = end._space(), 1783 space = spaces[spaceName], 1784 startColor = this.alpha() === 0 ? color("transparent") : this, 1785 start = startColor[space.cache] || space.to(startColor._rgba), 1786 result = start.slice(); 1787 1788 end = end[space.cache]; 1789 each(space.props, function (_key, prop) { 1790 var index = prop.idx, 1791 startValue = start[index], 1792 endValue = end[index], 1793 type = propTypes[prop.type] || {}; 1794 1795 // if null, don't override start value 1796 if (endValue === null) { 1797 return; 1798 } 1799 1800 // if null - use end 1801 if (startValue === null) { 1802 result[index] = endValue; 1803 } else { 1804 if (type.mod) { 1805 if (endValue - startValue > type.mod / 2) { 1806 startValue += type.mod; 1807 } else if (startValue - endValue > type.mod / 2) { 1808 startValue -= type.mod; 1809 } 1810 } 1811 result[index] = clamp( 1812 (endValue - startValue) * distance + startValue, 1813 prop 1814 ); 1815 } 1816 }); 1817 return this[spaceName](result); 1818 }, 1819 blend: function (opaque) { 1820 // if we are already opaque - return ourself 1821 if (this._rgba[3] === 1) { 1822 return this; 1823 } 1824 1825 var rgb = this._rgba.slice(), 1826 a = rgb.pop(), 1827 blend = color(opaque)._rgba; 1828 1829 return color( 1830 jQuery.map(rgb, function (v, i) { 1831 return (1 - a) * blend[i] + a * v; 1832 }) 1833 ); 1834 }, 1835 toRgbaString: function () { 1836 var prefix = "rgba(", 1837 rgba = jQuery.map(this._rgba, function (v, i) { 1838 if (v != null) { 1839 return v; 1840 } 1841 return i > 2 ? 1 : 0; 1842 }); 1843 1844 if (rgba[3] === 1) { 1845 rgba.pop(); 1846 prefix = "rgb("; 1847 } 1848 1849 return prefix + rgba.join() + ")"; 1850 }, 1851 toHslaString: function () { 1852 var prefix = "hsla(", 1853 hsla = jQuery.map(this.hsla(), function (v, i) { 1854 if (v == null) { 1855 v = i > 2 ? 1 : 0; 1856 } 1857 1858 // catch 1 and 2 1859 if (i && i < 3) { 1860 v = Math.round(v * 100) + "%"; 1861 } 1862 return v; 1863 }); 1864 1865 if (hsla[3] === 1) { 1866 hsla.pop(); 1867 prefix = "hsl("; 1868 } 1869 return prefix + hsla.join() + ")"; 1870 }, 1871 toHexString: function (includeAlpha) { 1872 var rgba = this._rgba.slice(), 1873 alpha = rgba.pop(); 1874 1875 if (includeAlpha) { 1876 rgba.push(~~(alpha * 255)); 1877 } 1878 1879 return ( 1880 "#" + 1881 jQuery 1882 .map(rgba, function (v) { 1883 // default to 0 when nulls exist 1884 v = (v || 0).toString(16); 1885 return v.length === 1 ? "0" + v : v; 1886 }) 1887 .join("") 1888 ); 1889 }, 1890 toString: function () { 1891 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 1892 }, 1893 }); 1894 color.fn.parse.prototype = color.fn; 1895 1896 // hsla conversions adapted from: 1897 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 1898 1899 function hue2rgb(p, q, h) { 1900 h = (h + 1) % 1; 1901 if (h * 6 < 1) { 1902 return p + (q - p) * h * 6; 1903 } 1904 if (h * 2 < 1) { 1905 return q; 1906 } 1907 if (h * 3 < 2) { 1908 return p + (q - p) * (2 / 3 - h) * 6; 1909 } 1910 return p; 1911 } 1912 1913 spaces.hsla.to = function (rgba) { 1914 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 1915 return [null, null, null, rgba[3]]; 1916 } 1917 var r = rgba[0] / 255, 1918 g = rgba[1] / 255, 1919 b = rgba[2] / 255, 1920 a = rgba[3], 1921 max = Math.max(r, g, b), 1922 min = Math.min(r, g, b), 1923 diff = max - min, 1924 add = max + min, 1925 l = add * 0.5, 1926 h, 1927 s; 1928 1929 if (min === max) { 1930 h = 0; 1931 } else if (r === max) { 1932 h = (60 * (g - b)) / diff + 360; 1933 } else if (g === max) { 1934 h = (60 * (b - r)) / diff + 120; 1935 } else { 1936 h = (60 * (r - g)) / diff + 240; 1937 } 1938 1939 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 1940 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 1941 if (diff === 0) { 1942 s = 0; 1943 } else if (l <= 0.5) { 1944 s = diff / add; 1945 } else { 1946 s = diff / (2 - add); 1947 } 1948 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 1949 }; 1950 1951 spaces.hsla.from = function (hsla) { 1952 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 1953 return [null, null, null, hsla[3]]; 1954 } 1955 var h = hsla[0] / 360, 1956 s = hsla[1], 1957 l = hsla[2], 1958 a = hsla[3], 1959 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 1960 p = 2 * l - q; 1961 1962 return [ 1963 Math.round(hue2rgb(p, q, h + 1 / 3) * 255), 1964 Math.round(hue2rgb(p, q, h) * 255), 1965 Math.round(hue2rgb(p, q, h - 1 / 3) * 255), 1966 a, 1967 ]; 1968 }; 1969 1970 each(spaces, function (spaceName, space) { 1971 var props = space.props, 1972 cache = space.cache, 1973 to = space.to, 1974 from = space.from; 1975 1976 // makes rgba() and hsla() 1977 color.fn[spaceName] = function (value) { 1978 // generate a cache for this space if it doesn't exist 1979 if (to && !this[cache]) { 1980 this[cache] = to(this._rgba); 1981 } 1982 if (value === undefined) { 1983 return this[cache].slice(); 1984 } 1985 1986 var ret, 1987 type = getType(value), 1988 arr = type === "array" || type === "object" ? value : arguments, 1989 local = this[cache].slice(); 1990 1991 each(props, function (key, prop) { 1992 var val = arr[type === "object" ? key : prop.idx]; 1993 if (val == null) { 1994 val = local[prop.idx]; 1995 } 1996 local[prop.idx] = clamp(val, prop); 1997 }); 1998 1999 if (from) { 2000 ret = color(from(local)); 2001 ret[cache] = local; 2002 return ret; 2003 } else { 2004 return color(local); 2005 } 2006 }; 2007 2008 // makes red() green() blue() alpha() hue() saturation() lightness() 2009 each(props, function (key, prop) { 2010 // alpha is included in more than one space 2011 if (color.fn[key]) { 2012 return; 2013 } 2014 color.fn[key] = function (value) { 2015 var local, 2016 cur, 2017 match, 2018 fn, 2019 vtype = getType(value); 2020 2021 if (key === "alpha") { 2022 fn = this._hsla ? "hsla" : "rgba"; 2023 } else { 2024 fn = spaceName; 2025 } 2026 local = this[fn](); 2027 cur = local[prop.idx]; 2028 2029 if (vtype === "undefined") { 2030 return cur; 2031 } 2032 2033 if (vtype === "function") { 2034 value = value.call(this, cur); 2035 vtype = getType(value); 2036 } 2037 if (value == null && prop.empty) { 2038 return this; 2039 } 2040 if (vtype === "string") { 2041 match = rplusequals.exec(value); 2042 if (match) { 2043 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 2044 } 2045 } 2046 local[prop.idx] = value; 2047 return this[fn](local); 2048 }; 2049 }); 2050 }); 2051 2052 // add cssHook and .fx.step function for each named hook. 2053 // accept a space separated string of properties 2054 color.hook = function (hook) { 2055 var hooks = hook.split(" "); 2056 each(hooks, function (_i, hook) { 2057 jQuery.cssHooks[hook] = { 2058 set: function (elem, value) { 2059 var parsed, 2060 curElem, 2061 backgroundColor = ""; 2062 2063 if ( 2064 value !== "transparent" && 2065 (getType(value) !== "string" || (parsed = stringParse(value))) 2066 ) { 2067 value = color(parsed || value); 2068 if (!support.rgba && value._rgba[3] !== 1) { 2069 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 2070 while ( 2071 (backgroundColor === "" || backgroundColor === "transparent") && 2072 curElem && 2073 curElem.style 2074 ) { 2075 try { 2076 backgroundColor = jQuery.css(curElem, "backgroundColor"); 2077 curElem = curElem.parentNode; 2078 } catch (e) {} 2079 } 2080 2081 value = value.blend( 2082 backgroundColor && backgroundColor !== "transparent" 2083 ? backgroundColor 2084 : "_default" 2085 ); 2086 } 2087 2088 value = value.toRgbaString(); 2089 } 2090 try { 2091 elem.style[hook] = value; 2092 } catch (e) { 2093 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 2094 } 2095 }, 2096 }; 2097 jQuery.fx.step[hook] = function (fx) { 2098 if (!fx.colorInit) { 2099 fx.start = color(fx.elem, hook); 2100 fx.end = color(fx.end); 2101 fx.colorInit = true; 2102 } 2103 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 2104 }; 2105 }); 2106 }; 2107 2108 color.hook(stepHooks); 2109 2110 jQuery.cssHooks.borderColor = { 2111 expand: function (value) { 2112 var expanded = {}; 2113 2114 each(["Top", "Right", "Bottom", "Left"], function (_i, part) { 2115 expanded["border" + part + "Color"] = value; 2116 }); 2117 return expanded; 2118 }, 2119 }; 2120 2121 // Basic color names only. 2122 // Usage of any of the other color names requires adding yourself or including 2123 // jquery.color.svg-names.js. 2124 colors = jQuery.Color.names = { 2125 // 4.1. Basic color keywords 2126 aqua: "#00ffff", 2127 black: "#000000", 2128 blue: "#0000ff", 2129 fuchsia: "#ff00ff", 2130 gray: "#808080", 2131 green: "#008000", 2132 lime: "#00ff00", 2133 maroon: "#800000", 2134 navy: "#000080", 2135 olive: "#808000", 2136 purple: "#800080", 2137 red: "#ff0000", 2138 silver: "#c0c0c0", 2139 teal: "#008080", 2140 white: "#ffffff", 2141 yellow: "#ffff00", 2142 2143 // 4.2.3. "transparent" color keyword 2144 transparent: [null, null, null, 0], 2145 2146 _default: "#ffffff", 2147 }; 2148 2149 /*! 2150 * jQuery UI Effects 1.13.3 2151 * https://jqueryui.com 2152 * 2153 * Copyright OpenJS Foundation and other contributors 2154 * Released under the MIT license. 2155 * https://jquery.org/license 2156 */ 2157 2158 //>>label: Effects Core 2159 //>>group: Effects 2160 /* eslint-disable max-len */ 2161 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 2162 /* eslint-enable max-len */ 2163 //>>docs: https://api.jqueryui.com/category/effects-core/ 2164 //>>demos: https://jqueryui.com/effect/ 2165 2166 var dataSpace = "ui-effects-", 2167 dataSpaceStyle = "ui-effects-style", 2168 dataSpaceAnimated = "ui-effects-animated"; 2169 2170 $.effects = { 2171 effect: {}, 2172 }; 2173 2174 /******************************************************************************/ 2175 /****************************** CLASS ANIMATIONS ******************************/ 2176 /******************************************************************************/ 2177 (function () { 2178 var classAnimationActions = ["add", "remove", "toggle"], 2179 shorthandStyles = { 2180 border: 1, 2181 borderBottom: 1, 2182 borderColor: 1, 2183 borderLeft: 1, 2184 borderRight: 1, 2185 borderTop: 1, 2186 borderWidth: 1, 2187 margin: 1, 2188 padding: 1, 2189 }; 2190 2191 $.each( 2192 [ 2193 "borderLeftStyle", 2194 "borderRightStyle", 2195 "borderBottomStyle", 2196 "borderTopStyle", 2197 ], 2198 function (_, prop) { 2199 $.fx.step[prop] = function (fx) { 2200 if ( 2201 (fx.end !== "none" && !fx.setAttr) || 2202 (fx.pos === 1 && !fx.setAttr) 2203 ) { 2204 jQuery.style(fx.elem, prop, fx.end); 2205 fx.setAttr = true; 2206 } 2207 }; 2208 } 2209 ); 2210 2211 function camelCase(string) { 2212 return string.replace(/-([\da-z])/gi, function (all, letter) { 2213 return letter.toUpperCase(); 2214 }); 2215 } 2216 2217 function getElementStyles(elem) { 2218 var key, 2219 len, 2220 style = elem.ownerDocument.defaultView 2221 ? elem.ownerDocument.defaultView.getComputedStyle(elem, null) 2222 : elem.currentStyle, 2223 styles = {}; 2224 2225 if (style && style.length && style[0] && style[style[0]]) { 2226 len = style.length; 2227 while (len--) { 2228 key = style[len]; 2229 if (typeof style[key] === "string") { 2230 styles[camelCase(key)] = style[key]; 2231 } 2232 } 2233 2234 // Support: Opera, IE <9 2235 } else { 2236 for (key in style) { 2237 if (typeof style[key] === "string") { 2238 styles[key] = style[key]; 2239 } 2240 } 2241 } 2242 2243 return styles; 2244 } 2245 2246 function styleDifference(oldStyle, newStyle) { 2247 var diff = {}, 2248 name, 2249 value; 2250 2251 for (name in newStyle) { 2252 value = newStyle[name]; 2253 if (oldStyle[name] !== value) { 2254 if (!shorthandStyles[name]) { 2255 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 2256 diff[name] = value; 2257 } 2258 } 2259 } 2260 } 2261 2262 return diff; 2263 } 2264 2265 // Support: jQuery <1.8 2266 if (!$.fn.addBack) { 2267 $.fn.addBack = function (selector) { 2268 return this.add( 2269 selector == null ? this.prevObject : this.prevObject.filter(selector) 2270 ); 2271 }; 2272 } 2273 2274 $.effects.animateClass = function (value, duration, easing, callback) { 2275 var o = $.speed(duration, easing, callback); 2276 2277 return this.queue(function () { 2278 var animated = $(this), 2279 baseClass = animated.attr("class") || "", 2280 applyClassChange, 2281 allAnimations = o.children ? animated.find("*").addBack() : animated; 2282 2283 // Map the animated objects to store the original styles. 2284 allAnimations = allAnimations.map(function () { 2285 var el = $(this); 2286 return { 2287 el: el, 2288 start: getElementStyles(this), 2289 }; 2290 }); 2291 2292 // Apply class change 2293 applyClassChange = function () { 2294 $.each(classAnimationActions, function (i, action) { 2295 if (value[action]) { 2296 animated[action + "Class"](value[action]); 2297 } 2298 }); 2299 }; 2300 applyClassChange(); 2301 2302 // Map all animated objects again - calculate new styles and diff 2303 allAnimations = allAnimations.map(function () { 2304 this.end = getElementStyles(this.el[0]); 2305 this.diff = styleDifference(this.start, this.end); 2306 return this; 2307 }); 2308 2309 // Apply original class 2310 animated.attr("class", baseClass); 2311 2312 // Map all animated objects again - this time collecting a promise 2313 allAnimations = allAnimations.map(function () { 2314 var styleInfo = this, 2315 dfd = $.Deferred(), 2316 opts = $.extend({}, o, { 2317 queue: false, 2318 complete: function () { 2319 dfd.resolve(styleInfo); 2320 }, 2321 }); 2322 2323 this.el.animate(this.diff, opts); 2324 return dfd.promise(); 2325 }); 2326 2327 // Once all animations have completed: 2328 $.when.apply($, allAnimations.get()).done(function () { 2329 // Set the final class 2330 applyClassChange(); 2331 2332 // For each animated element, 2333 // clear all css properties that were animated 2334 $.each(arguments, function () { 2335 var el = this.el; 2336 $.each(this.diff, function (key) { 2337 el.css(key, ""); 2338 }); 2339 }); 2340 2341 // This is guarnteed to be there if you use jQuery.speed() 2342 // it also handles dequeuing the next anim... 2343 o.complete.call(animated[0]); 2344 }); 2345 }); 2346 }; 2347 2348 $.fn.extend({ 2349 addClass: (function (orig) { 2350 return function (classNames, speed, easing, callback) { 2351 return speed 2352 ? $.effects.animateClass.call( 2353 this, 2354 { add: classNames }, 2355 speed, 2356 easing, 2357 callback 2358 ) 2359 : orig.apply(this, arguments); 2360 }; 2361 })($.fn.addClass), 2362 2363 removeClass: (function (orig) { 2364 return function (classNames, speed, easing, callback) { 2365 return arguments.length > 1 2366 ? $.effects.animateClass.call( 2367 this, 2368 { remove: classNames }, 2369 speed, 2370 easing, 2371 callback 2372 ) 2373 : orig.apply(this, arguments); 2374 }; 2375 })($.fn.removeClass), 2376 2377 toggleClass: (function (orig) { 2378 return function (classNames, force, speed, easing, callback) { 2379 if (typeof force === "boolean" || force === undefined) { 2380 if (!speed) { 2381 // Without speed parameter 2382 return orig.apply(this, arguments); 2383 } else { 2384 return $.effects.animateClass.call( 2385 this, 2386 force ? { add: classNames } : { remove: classNames }, 2387 speed, 2388 easing, 2389 callback 2390 ); 2391 } 2392 } else { 2393 // Without force parameter 2394 return $.effects.animateClass.call( 2395 this, 2396 { toggle: classNames }, 2397 force, 2398 speed, 2399 easing 2400 ); 2401 } 2402 }; 2403 })($.fn.toggleClass), 2404 2405 switchClass: function (remove, add, speed, easing, callback) { 2406 return $.effects.animateClass.call( 2407 this, 2408 { 2409 add: add, 2410 remove: remove, 2411 }, 2412 speed, 2413 easing, 2414 callback 2415 ); 2416 }, 2417 }); 2418 })(); 2419 2420 /******************************************************************************/ 2421 /*********************************** EFFECTS **********************************/ 2422 /******************************************************************************/ 2423 2424 (function () { 2425 if ($.expr && $.expr.pseudos && $.expr.pseudos.animated) { 2426 $.expr.pseudos.animated = (function (orig) { 2427 return function (elem) { 2428 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 2429 }; 2430 })($.expr.pseudos.animated); 2431 } 2432 2433 if ($.uiBackCompat !== false) { 2434 $.extend($.effects, { 2435 // Saves a set of properties in a data storage 2436 save: function (element, set) { 2437 var i = 0, 2438 length = set.length; 2439 for (; i < length; i++) { 2440 if (set[i] !== null) { 2441 element.data(dataSpace + set[i], element[0].style[set[i]]); 2442 } 2443 } 2444 }, 2445 2446 // Restores a set of previously saved properties from a data storage 2447 restore: function (element, set) { 2448 var val, 2449 i = 0, 2450 length = set.length; 2451 for (; i < length; i++) { 2452 if (set[i] !== null) { 2453 val = element.data(dataSpace + set[i]); 2454 element.css(set[i], val); 2455 } 2456 } 2457 }, 2458 2459 setMode: function (el, mode) { 2460 if (mode === "toggle") { 2461 mode = el.is(":hidden") ? "show" : "hide"; 2462 } 2463 return mode; 2464 }, 2465 2466 // Wraps the element around a wrapper that copies position properties 2467 createWrapper: function (element) { 2468 // If the element is already wrapped, return it 2469 if (element.parent().is(".ui-effects-wrapper")) { 2470 return element.parent(); 2471 } 2472 2473 // Wrap the element 2474 var props = { 2475 width: element.outerWidth(true), 2476 height: element.outerHeight(true), 2477 float: element.css("float"), 2478 }, 2479 wrapper = $("<div></div>").addClass("ui-effects-wrapper").css({ 2480 fontSize: "100%", 2481 background: "transparent", 2482 border: "none", 2483 margin: 0, 2484 padding: 0, 2485 }), 2486 // Store the size in case width/height are defined in % - Fixes #5245 2487 size = { 2488 width: element.width(), 2489 height: element.height(), 2490 }, 2491 active = document.activeElement; 2492 2493 // Support: Firefox 2494 // Firefox incorrectly exposes anonymous content 2495 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2496 try { 2497 // eslint-disable-next-line no-unused-expressions 2498 active.id; 2499 } catch (e) { 2500 active = document.body; 2501 } 2502 2503 element.wrap(wrapper); 2504 2505 // Fixes #7595 - Elements lose focus when wrapped. 2506 if (element[0] === active || $.contains(element[0], active)) { 2507 $(active).trigger("focus"); 2508 } 2509 2510 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2511 // lose the reference to the wrapped element 2512 wrapper = element.parent(); 2513 2514 // Transfer positioning properties to the wrapper 2515 if (element.css("position") === "static") { 2516 wrapper.css({ position: "relative" }); 2517 element.css({ position: "relative" }); 2518 } else { 2519 $.extend(props, { 2520 position: element.css("position"), 2521 zIndex: element.css("z-index"), 2522 }); 2523 $.each(["top", "left", "bottom", "right"], function (i, pos) { 2524 props[pos] = element.css(pos); 2525 if (isNaN(parseInt(props[pos], 10))) { 2526 props[pos] = "auto"; 2527 } 2528 }); 2529 element.css({ 2530 position: "relative", 2531 top: 0, 2532 left: 0, 2533 right: "auto", 2534 bottom: "auto", 2535 }); 2536 } 2537 element.css(size); 2538 2539 return wrapper.css(props).show(); 2540 }, 2541 2542 removeWrapper: function (element) { 2543 var active = document.activeElement; 2544 2545 if (element.parent().is(".ui-effects-wrapper")) { 2546 element.parent().replaceWith(element); 2547
vendor: 7,949 bytes, lines 2548-2832
2548 // Fixes #7595 - Elements lose focus when wrapped. 2549 if (element[0] === active || $.contains(element[0], active)) { 2550 $(active).trigger("focus"); 2551 } 2552 } 2553 2554 return element; 2555 }, 2556 }); 2557 } 2558 2559 $.extend($.effects, { 2560 version: "1.13.3", 2561 2562 define: function (name, mode, effect) { 2563 if (!effect) { 2564 effect = mode; 2565 mode = "effect"; 2566 } 2567 2568 $.effects.effect[name] = effect; 2569 $.effects.effect[name].mode = mode; 2570 2571 return effect; 2572 }, 2573 2574 scaledDimensions: function (element, percent, direction) { 2575 if (percent === 0) { 2576 return { 2577 height: 0, 2578 width: 0, 2579 outerHeight: 0, 2580 outerWidth: 0, 2581 }; 2582 } 2583 2584 var x = direction !== "horizontal" ? (percent || 100) / 100 : 1, 2585 y = direction !== "vertical" ? (percent || 100) / 100 : 1; 2586 2587 return { 2588 height: element.height() * y, 2589 width: element.width() * x, 2590 outerHeight: element.outerHeight() * y, 2591 outerWidth: element.outerWidth() * x, 2592 }; 2593 }, 2594 2595 clipToBox: function (animation) { 2596 return { 2597 width: animation.clip.right - animation.clip.left, 2598 height: animation.clip.bottom - animation.clip.top, 2599 left: animation.clip.left, 2600 top: animation.clip.top, 2601 }; 2602 }, 2603 2604 // Injects recently queued functions to be first in line (after "inprogress") 2605 unshift: function (element, queueLength, count) { 2606 var queue = element.queue(); 2607 2608 if (queueLength > 1) { 2609 queue.splice.apply( 2610 queue, 2611 [1, 0].concat(queue.splice(queueLength, count)) 2612 ); 2613 } 2614 element.dequeue(); 2615 }, 2616 2617 saveStyle: function (element) { 2618 element.data(dataSpaceStyle, element[0].style.cssText); 2619 }, 2620 2621 restoreStyle: function (element) { 2622 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 2623 element.removeData(dataSpaceStyle); 2624 }, 2625 2626 mode: function (element, mode) { 2627 var hidden = element.is(":hidden"); 2628 2629 if (mode === "toggle") { 2630 mode = hidden ? "show" : "hide"; 2631 } 2632 if (hidden ? mode === "hide" : mode === "show") { 2633 mode = "none"; 2634 } 2635 return mode; 2636 }, 2637 2638 // Translates a [top,left] array into a baseline value 2639 getBaseline: function (origin, original) { 2640 var y, x; 2641 2642 switch (origin[0]) { 2643 case "top": 2644 y = 0; 2645 break; 2646 case "middle": 2647 y = 0.5; 2648 break; 2649 case "bottom": 2650 y = 1; 2651 break; 2652 default: 2653 y = origin[0] / original.height; 2654 } 2655 2656 switch (origin[1]) { 2657 case "left": 2658 x = 0; 2659 break; 2660 case "center": 2661 x = 0.5; 2662 break; 2663 case "right": 2664 x = 1; 2665 break; 2666 default: 2667 x = origin[1] / original.width; 2668 } 2669 2670 return { 2671 x: x, 2672 y: y, 2673 }; 2674 }, 2675 2676 // Creates a placeholder element so that the original element can be made absolute 2677 createPlaceholder: function (element) { 2678 var placeholder, 2679 cssPosition = element.css("position"), 2680 position = element.position(); 2681 2682 // Lock in margins first to account for form elements, which 2683 // will change margin if you explicitly set height 2684 // see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 2685 // Support: Safari 2686 element 2687 .css({ 2688 marginTop: element.css("marginTop"), 2689 marginBottom: element.css("marginBottom"), 2690 marginLeft: element.css("marginLeft"), 2691 marginRight: element.css("marginRight"), 2692 }) 2693 .outerWidth(element.outerWidth()) 2694 .outerHeight(element.outerHeight()); 2695 2696 if (/^(static|relative)/.test(cssPosition)) { 2697 cssPosition = "absolute"; 2698 2699 placeholder = $("<" + element[0].nodeName + ">") 2700 .insertAfter(element) 2701 .css({ 2702 // Convert inline to inline block to account for inline elements 2703 // that turn to inline block based on content (like img) 2704 display: /^(inline|ruby)/.test(element.css("display")) 2705 ? "inline-block" 2706 : "block", 2707 visibility: "hidden", 2708 2709 // Margins need to be set to account for margin collapse 2710 marginTop: element.css("marginTop"), 2711 marginBottom: element.css("marginBottom"), 2712 marginLeft: element.css("marginLeft"), 2713 marginRight: element.css("marginRight"), 2714 float: element.css("float"), 2715 }) 2716 .outerWidth(element.outerWidth()) 2717 .outerHeight(element.outerHeight()) 2718 .addClass("ui-effects-placeholder"); 2719 2720 element.data(dataSpace + "placeholder", placeholder); 2721 } 2722 2723 element.css({ 2724 position: cssPosition, 2725 left: position.left, 2726 top: position.top, 2727 }); 2728 2729 return placeholder; 2730 }, 2731 2732 removePlaceholder: function (element) { 2733 var dataKey = dataSpace + "placeholder", 2734 placeholder = element.data(dataKey); 2735 2736 if (placeholder) { 2737 placeholder.remove(); 2738 element.removeData(dataKey); 2739 } 2740 }, 2741 2742 // Removes a placeholder if it exists and restores 2743 // properties that were modified during placeholder creation 2744 cleanUp: function (element) { 2745 $.effects.restoreStyle(element); 2746 $.effects.removePlaceholder(element); 2747 }, 2748 2749 setTransition: function (element, list, factor, value) { 2750 value = value || {}; 2751 $.each(list, function (i, x) { 2752 var unit = element.cssUnit(x); 2753 if (unit[0] > 0) { 2754 value[x] = unit[0] * factor + unit[1]; 2755 } 2756 }); 2757 return value; 2758 }, 2759 }); 2760 2761 // Return an effect options object for the given parameters: 2762 function _normalizeArguments(effect, options, speed, callback) { 2763 // Allow passing all options as the first parameter 2764 if ($.isPlainObject(effect)) { 2765 options = effect; 2766 effect = effect.effect; 2767 } 2768 2769 // Convert to an object 2770 effect = { effect: effect }; 2771 2772 // Catch (effect, null, ...) 2773 if (options == null) { 2774 options = {}; 2775 } 2776 2777 // Catch (effect, callback) 2778 if (typeof options === "function") { 2779 callback = options; 2780 speed = null; 2781 options = {}; 2782 } 2783 2784 // Catch (effect, speed, ?) 2785 if (typeof options === "number" || $.fx.speeds[options]) { 2786 callback = speed; 2787 speed = options; 2788 options = {}; 2789 } 2790 2791 // Catch (effect, options, callback) 2792 if (typeof speed === "function") { 2793 callback = speed; 2794 speed = null; 2795 } 2796 2797 // Add options to effect 2798 if (options) { 2799 $.extend(effect, options); 2800 } 2801 2802 speed = speed || options.duration; 2803 effect.duration = $.fx.off 2804 ? 0 2805 : typeof speed === "number" 2806 ? speed 2807 : speed in $.fx.speeds 2808 ? $.fx.speeds[speed] 2809 : $.fx.speeds._default; 2810 2811 effect.complete = callback || options.complete; 2812 2813 return effect; 2814 } 2815 2816 function standardAnimationOption(option) { 2817 // Valid standard speeds (nothing, number, named speed) 2818 if (!option || typeof option === "number" || $.fx.speeds[option]) { 2819 return true; 2820 } 2821 2822 // Invalid strings - treat as "normal" speed 2823 if (typeof option === "string" && !$.effects.effect[option]) { 2824 return true; 2825 } 2826 2827 // Complete callback 2828 if (typeof option === "function") { 2829 return true; 2830 } 2831 2832 // Options hash (but not naming an effect)
vendor: 5,935 bytes, lines 2833-3026
2833 if (typeof option === "object" && !option.effect) { 2834 return true; 2835 } 2836 2837 // Didn't match any standard API 2838 return false; 2839 } 2840 2841 $.fn.extend({ 2842 effect: function (/* effect, options, speed, callback */) { 2843 var args = _normalizeArguments.apply(this, arguments), 2844 effectMethod = $.effects.effect[args.effect], 2845 defaultMode = effectMethod.mode, 2846 queue = args.queue, 2847 queueName = queue || "fx", 2848 complete = args.complete, 2849 mode = args.mode, 2850 modes = [], 2851 prefilter = function (next) { 2852 var el = $(this), 2853 normalizedMode = $.effects.mode(el, mode) || defaultMode; 2854 2855 // Sentinel for duck-punching the :animated pseudo-selector 2856 el.data(dataSpaceAnimated, true); 2857 2858 // Save effect mode for later use, 2859 // we can't just call $.effects.mode again later, 2860 // as the .show() below destroys the initial state 2861 modes.push(normalizedMode); 2862 2863 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 2864 if ( 2865 defaultMode && 2866 (normalizedMode === "show" || 2867 (normalizedMode === defaultMode && normalizedMode === "hide")) 2868 ) { 2869 el.show(); 2870 } 2871 2872 if (!defaultMode || normalizedMode !== "none") { 2873 $.effects.saveStyle(el); 2874 } 2875 2876 if (typeof next === "function") { 2877 next(); 2878 } 2879 }; 2880 2881 if ($.fx.off || !effectMethod) { 2882 // Delegate to the original method (e.g., .show()) if possible 2883 if (mode) { 2884 return this[mode](args.duration, complete); 2885 } else { 2886 return this.each(function () { 2887 if (complete) { 2888 complete.call(this); 2889 } 2890 }); 2891 } 2892 } 2893 2894 function run(next) { 2895 var elem = $(this); 2896 2897 function cleanup() { 2898 elem.removeData(dataSpaceAnimated); 2899 2900 $.effects.cleanUp(elem); 2901 2902 if (args.mode === "hide") { 2903 elem.hide(); 2904 } 2905 2906 done(); 2907 } 2908 2909 function done() { 2910 if (typeof complete === "function") { 2911 complete.call(elem[0]); 2912 } 2913 2914 if (typeof next === "function") { 2915 next(); 2916 } 2917 } 2918 2919 // Override mode option on a per element basis, 2920 // as toggle can be either show or hide depending on element state 2921 args.mode = modes.shift(); 2922 2923 if ($.uiBackCompat !== false && !defaultMode) { 2924 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 2925 // Call the core method to track "olddisplay" properly 2926 elem[mode](); 2927 done(); 2928 } else { 2929 effectMethod.call(elem[0], args, done); 2930 } 2931 } else { 2932 if (args.mode === "none") { 2933 // Call the core method to track "olddisplay" properly 2934 elem[mode](); 2935 done(); 2936 } else { 2937 effectMethod.call(elem[0], args, cleanup); 2938 } 2939 } 2940 } 2941 2942 // Run prefilter on all elements first to ensure that 2943 // any showing or hiding happens before placeholder creation, 2944 // which ensures that any layout changes are correctly captured. 2945 return queue === false 2946 ? this.each(prefilter).each(run) 2947 : this.queue(queueName, prefilter).queue(queueName, run); 2948 }, 2949 2950 show: (function (orig) { 2951 return function (option) { 2952 if (standardAnimationOption(option)) { 2953 return orig.apply(this, arguments); 2954 } else { 2955 var args = _normalizeArguments.apply(this, arguments); 2956 args.mode = "show"; 2957 return this.effect.call(this, args); 2958 } 2959 }; 2960 })($.fn.show), 2961 2962 hide: (function (orig) { 2963 return function (option) { 2964 if (standardAnimationOption(option)) { 2965 return orig.apply(this, arguments); 2966 } else { 2967 var args = _normalizeArguments.apply(this, arguments); 2968 args.mode = "hide"; 2969 return this.effect.call(this, args); 2970 } 2971 }; 2972 })($.fn.hide), 2973 2974 toggle: (function (orig) { 2975 return function (option) { 2976 if (standardAnimationOption(option) || typeof option === "boolean") { 2977 return orig.apply(this, arguments); 2978 } else { 2979 var args = _normalizeArguments.apply(this, arguments); 2980 args.mode = "toggle"; 2981 return this.effect.call(this, args); 2982 } 2983 }; 2984 })($.fn.toggle), 2985 2986 cssUnit: function (key) { 2987 var style = this.css(key), 2988 val = []; 2989 2990 $.each(["em", "px", "%", "pt"], function (i, unit) { 2991 if (style.indexOf(unit) > 0) { 2992 val = [parseFloat(style), unit]; 2993 } 2994 }); 2995 return val; 2996 }, 2997 2998 cssClip: function (clipObj) { 2999 if (clipObj) { 3000 return this.css( 3001 "clip", 3002 "rect(" + 3003 clipObj.top + 3004 "px " + 3005 clipObj.right + 3006 "px " + 3007 clipObj.bottom + 3008 "px " + 3009 clipObj.left + 3010 "px)" 3011 ); 3012 } 3013 return parseClip(this.css("clip"), this); 3014 }, 3015 3016 transfer: function (options, done) { 3017 var element = $(this), 3018 target = $(options.to), 3019 targetFixed = target.css("position") === "fixed", 3020 body = $("body"), 3021 fixTop = targetFixed ? body.scrollTop() : 0, 3022 fixLeft = targetFixed ? body.scrollLeft() : 0, 3023 endPosition = target.offset(), 3024 animation = { 3025 top: endPosition.top - fixTop, 3026 left: endPosition.left - fixLeft,
vendor: 18,439 bytes, lines 3027-3677
3027 height: target.innerHeight(), 3028 width: target.innerWidth(), 3029 }, 3030 startPosition = element.offset(), 3031 transfer = $("<div class='ui-effects-transfer'></div>"); 3032 3033 transfer 3034 .appendTo("body") 3035 .addClass(options.className) 3036 .css({ 3037 top: startPosition.top - fixTop, 3038 left: startPosition.left - fixLeft, 3039 height: element.innerHeight(), 3040 width: element.innerWidth(), 3041 position: targetFixed ? "fixed" : "absolute", 3042 }) 3043 .animate(animation, options.duration, options.easing, function () { 3044 transfer.remove(); 3045 if (typeof done === "function") { 3046 done(); 3047 } 3048 }); 3049 }, 3050 }); 3051 3052 function parseClip(str, element) { 3053 var outerWidth = element.outerWidth(), 3054 outerHeight = element.outerHeight(), 3055 clipRegex = 3056 /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 3057 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 3058 3059 return { 3060 top: parseFloat(values[1]) || 0, 3061 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 3062 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 3063 left: parseFloat(values[4]) || 0, 3064 }; 3065 } 3066 3067 $.fx.step.clip = function (fx) { 3068 if (!fx.clipInit) { 3069 fx.start = $(fx.elem).cssClip(); 3070 if (typeof fx.end === "string") { 3071 fx.end = parseClip(fx.end, fx.elem); 3072 } 3073 fx.clipInit = true; 3074 } 3075 3076 $(fx.elem).cssClip({ 3077 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 3078 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 3079 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 3080 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left, 3081 }); 3082 }; 3083 })(); 3084 3085 /******************************************************************************/ 3086 /*********************************** EASING ***********************************/ 3087 /******************************************************************************/ 3088 3089 (function () { 3090 // Based on easing equations from Robert Penner (http://robertpenner.com/easing) 3091 3092 var baseEasings = {}; 3093 3094 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 3095 baseEasings[name] = function (p) { 3096 return Math.pow(p, i + 2); 3097 }; 3098 }); 3099 3100 $.extend(baseEasings, { 3101 Sine: function (p) { 3102 return 1 - Math.cos((p * Math.PI) / 2); 3103 }, 3104 Circ: function (p) { 3105 return 1 - Math.sqrt(1 - p * p); 3106 }, 3107 Elastic: function (p) { 3108 return p === 0 || p === 1 3109 ? p 3110 : -Math.pow(2, 8 * (p - 1)) * 3111 Math.sin((((p - 1) * 80 - 7.5) * Math.PI) / 15); 3112 }, 3113 Back: function (p) { 3114 return p * p * (3 * p - 2); 3115 }, 3116 Bounce: function (p) { 3117 var pow2, 3118 bounce = 4; 3119 3120 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {} 3121 return ( 3122 1 / Math.pow(4, 3 - bounce) - 3123 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2) 3124 ); 3125 }, 3126 }); 3127 3128 $.each(baseEasings, function (name, easeIn) { 3129 $.easing["easeIn" + name] = easeIn; 3130 $.easing["easeOut" + name] = function (p) { 3131 return 1 - easeIn(1 - p); 3132 }; 3133 $.easing["easeInOut" + name] = function (p) { 3134 return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn(p * -2 + 2) / 2; 3135 }; 3136 }); 3137 })(); 3138 3139 var effect = $.effects; 3140 3141 /*! 3142 * jQuery UI Effects Blind 1.13.3 3143 * https://jqueryui.com 3144 * 3145 * Copyright OpenJS Foundation and other contributors 3146 * Released under the MIT license. 3147 * https://jquery.org/license 3148 */ 3149 3150 //>>label: Blind Effect 3151 //>>group: Effects 3152 //>>description: Blinds the element. 3153 //>>docs: https://api.jqueryui.com/blind-effect/ 3154 //>>demos: https://jqueryui.com/effect/ 3155 3156 var effectsEffectBlind = $.effects.define( 3157 "blind", 3158 "hide", 3159 function (options, done) { 3160 var map = { 3161 up: ["bottom", "top"], 3162 vertical: ["bottom", "top"], 3163 down: ["top", "bottom"], 3164 left: ["right", "left"], 3165 horizontal: ["right", "left"], 3166 right: ["left", "right"], 3167 }, 3168 element = $(this), 3169 direction = options.direction || "up", 3170 start = element.cssClip(), 3171 animate = { clip: $.extend({}, start) }, 3172 placeholder = $.effects.createPlaceholder(element); 3173 3174 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 3175 3176 if (options.mode === "show") { 3177 element.cssClip(animate.clip); 3178 if (placeholder) { 3179 placeholder.css($.effects.clipToBox(animate)); 3180 } 3181 3182 animate.clip = start; 3183 } 3184 3185 if (placeholder) { 3186 placeholder.animate( 3187 $.effects.clipToBox(animate), 3188 options.duration, 3189 options.easing 3190 ); 3191 } 3192 3193 element.animate(animate, { 3194 queue: false, 3195 duration: options.duration, 3196 easing: options.easing, 3197 complete: done, 3198 }); 3199 } 3200 ); 3201 3202 /*! 3203 * jQuery UI Effects Bounce 1.13.3 3204 * https://jqueryui.com 3205 * 3206 * Copyright OpenJS Foundation and other contributors 3207 * Released under the MIT license. 3208 * https://jquery.org/license 3209 */ 3210 3211 //>>label: Bounce Effect 3212 //>>group: Effects 3213 //>>description: Bounces an element horizontally or vertically n times. 3214 //>>docs: https://api.jqueryui.com/bounce-effect/ 3215 //>>demos: https://jqueryui.com/effect/ 3216 3217 var effectsEffectBounce = $.effects.define( 3218 "bounce", 3219 function (options, done) { 3220 var upAnim, 3221 downAnim, 3222 refValue, 3223 element = $(this), 3224 // Defaults: 3225 mode = options.mode, 3226 hide = mode === "hide", 3227 show = mode === "show", 3228 direction = options.direction || "up", 3229 distance = options.distance, 3230 times = options.times || 5, 3231 // Number of internal animations 3232 anims = times * 2 + (show || hide ? 1 : 0), 3233 speed = options.duration / anims, 3234 easing = options.easing, 3235 // Utility: 3236 ref = direction === "up" || direction === "down" ? "top" : "left", 3237 motion = direction === "up" || direction === "left", 3238 i = 0, 3239 queuelen = element.queue().length; 3240 3241 $.effects.createPlaceholder(element); 3242 3243 refValue = element.css(ref); 3244 3245 // Default distance for the BIGGEST bounce is the outer Distance / 3 3246 if (!distance) { 3247 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 3248 } 3249 3250 if (show) { 3251 downAnim = { opacity: 1 }; 3252 downAnim[ref] = refValue; 3253 3254 // If we are showing, force opacity 0 and set the initial position 3255 // then do the "first" animation 3256 element 3257 .css("opacity", 0) 3258 .css(ref, motion ? -distance * 2 : distance * 2) 3259 .animate(downAnim, speed, easing); 3260 } 3261 3262 // Start at the smallest distance if we are hiding 3263 if (hide) { 3264 distance = distance / Math.pow(2, times - 1); 3265 } 3266 3267 downAnim = {}; 3268 downAnim[ref] = refValue; 3269 3270 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3271 for (; i < times; i++) { 3272 upAnim = {}; 3273 upAnim[ref] = (motion ? "-=" : "+=") + distance; 3274 3275 element.animate(upAnim, speed, easing).animate(downAnim, speed, easing); 3276 3277 distance = hide ? distance * 2 : distance / 2; 3278 } 3279 3280 // Last Bounce when Hiding 3281 if (hide) { 3282 upAnim = { opacity: 0 }; 3283 upAnim[ref] = (motion ? "-=" : "+=") + distance; 3284 3285 element.animate(upAnim, speed, easing); 3286 } 3287 3288 element.queue(done); 3289 3290 $.effects.unshift(element, queuelen, anims + 1); 3291 } 3292 ); 3293 3294 /*! 3295 * jQuery UI Effects Clip 1.13.3 3296 * https://jqueryui.com 3297 * 3298 * Copyright OpenJS Foundation and other contributors 3299 * Released under the MIT license. 3300 * https://jquery.org/license 3301 */ 3302 3303 //>>label: Clip Effect 3304 //>>group: Effects 3305 //>>description: Clips the element on and off like an old TV. 3306 //>>docs: https://api.jqueryui.com/clip-effect/ 3307 //>>demos: https://jqueryui.com/effect/ 3308 3309 var effectsEffectClip = $.effects.define( 3310 "clip", 3311 "hide", 3312 function (options, done) { 3313 var start, 3314 animate = {}, 3315 element = $(this), 3316 direction = options.direction || "vertical", 3317 both = direction === "both", 3318 horizontal = both || direction === "horizontal", 3319 vertical = both || direction === "vertical"; 3320 3321 start = element.cssClip(); 3322 animate.clip = { 3323 top: vertical ? (start.bottom - start.top) / 2 : start.top, 3324 right: horizontal ? (start.right - start.left) / 2 : start.right, 3325 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 3326 left: horizontal ? (start.right - start.left) / 2 : start.left, 3327 }; 3328 3329 $.effects.createPlaceholder(element); 3330 3331 if (options.mode === "show") { 3332 element.cssClip(animate.clip); 3333 animate.clip = start; 3334 } 3335 3336 element.animate(animate, { 3337 queue: false, 3338 duration: options.duration, 3339 easing: options.easing, 3340 complete: done, 3341 }); 3342 } 3343 ); 3344 3345 /*! 3346 * jQuery UI Effects Drop 1.13.3 3347 * https://jqueryui.com 3348 * 3349 * Copyright OpenJS Foundation and other contributors 3350 * Released under the MIT license. 3351 * https://jquery.org/license 3352 */ 3353 3354 //>>label: Drop Effect 3355 //>>group: Effects 3356 //>>description: Moves an element in one direction and hides it at the same time. 3357 //>>docs: https://api.jqueryui.com/drop-effect/ 3358 //>>demos: https://jqueryui.com/effect/ 3359 3360 var effectsEffectDrop = $.effects.define( 3361 "drop", 3362 "hide", 3363 function (options, done) { 3364 var distance, 3365 element = $(this), 3366 mode = options.mode, 3367 show = mode === "show", 3368 direction = options.direction || "left", 3369 ref = direction === "up" || direction === "down" ? "top" : "left", 3370 motion = direction === "up" || direction === "left" ? "-=" : "+=", 3371 oppositeMotion = motion === "+=" ? "-=" : "+=", 3372 animation = { 3373 opacity: 0, 3374 }; 3375 3376 $.effects.createPlaceholder(element); 3377 3378 distance = 3379 options.distance || 3380 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 3381 3382 animation[ref] = motion + distance; 3383 3384 if (show) { 3385 element.css(animation); 3386 3387 animation[ref] = oppositeMotion + distance; 3388 animation.opacity = 1; 3389 } 3390 3391 // Animate 3392 element.animate(animation, { 3393 queue: false, 3394 duration: options.duration, 3395 easing: options.easing, 3396 complete: done, 3397 }); 3398 } 3399 ); 3400 3401 /*! 3402 * jQuery UI Effects Explode 1.13.3 3403 * https://jqueryui.com 3404 * 3405 * Copyright OpenJS Foundation and other contributors 3406 * Released under the MIT license. 3407 * https://jquery.org/license 3408 */ 3409 3410 //>>label: Explode Effect 3411 //>>group: Effects 3412 /* eslint-disable max-len */ 3413 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3414 /* eslint-enable max-len */ 3415 //>>docs: https://api.jqueryui.com/explode-effect/ 3416 //>>demos: https://jqueryui.com/effect/ 3417 3418 var effectsEffectExplode = $.effects.define( 3419 "explode", 3420 "hide", 3421 function (options, done) { 3422 var i, 3423 j, 3424 left, 3425 top, 3426 mx, 3427 my, 3428 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 3429 cells = rows, 3430 element = $(this), 3431 mode = options.mode, 3432 show = mode === "show", 3433 // Show and then visibility:hidden the element before calculating offset 3434 offset = element.show().css("visibility", "hidden").offset(), 3435 // Width and height of a piece 3436 width = Math.ceil(element.outerWidth() / cells), 3437 height = Math.ceil(element.outerHeight() / rows), 3438 pieces = []; 3439 3440 // Children animate complete: 3441 function childComplete() { 3442 pieces.push(this); 3443 if (pieces.length === rows * cells) { 3444 animComplete(); 3445 } 3446 } 3447 3448 // Clone the element for each row and cell. 3449 for (i = 0; i < rows; i++) { 3450 // ===> 3451 top = offset.top + i * height; 3452 my = i - (rows - 1) / 2; 3453 3454 for (j = 0; j < cells; j++) { 3455 // ||| 3456 left = offset.left + j * width; 3457 mx = j - (cells - 1) / 2; 3458 3459 // Create a clone of the now hidden main element that will be absolute positioned 3460 // within a wrapper div off the -left and -top equal to size of our pieces 3461 element 3462 .clone() 3463 .appendTo("body") 3464 .wrap("<div></div>") 3465 .css({ 3466 position: "absolute", 3467 visibility: "visible", 3468 left: -j * width, 3469 top: -i * height, 3470 }) 3471 3472 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3473 // where the original was located +left and +top equal to the size of pieces 3474 .parent() 3475 .addClass("ui-effects-explode") 3476 .css({ 3477 position: "absolute", 3478 overflow: "hidden", 3479 width: width, 3480 height: height, 3481 left: left + (show ? mx * width : 0), 3482 top: top + (show ? my * height : 0), 3483 opacity: show ? 0 : 1, 3484 }) 3485 .animate( 3486 { 3487 left: left + (show ? 0 : mx * width), 3488 top: top + (show ? 0 : my * height), 3489 opacity: show ? 1 : 0, 3490 }, 3491 options.duration || 500, 3492 options.easing, 3493 childComplete 3494 ); 3495 } 3496 } 3497 3498 function animComplete() { 3499 element.css({ 3500 visibility: "visible", 3501 }); 3502 $(pieces).remove(); 3503 done(); 3504 } 3505 } 3506 ); 3507 3508 /*! 3509 * jQuery UI Effects Fade 1.13.3 3510 * https://jqueryui.com 3511 * 3512 * Copyright OpenJS Foundation and other contributors 3513 * Released under the MIT license. 3514 * https://jquery.org/license 3515 */ 3516 3517 //>>label: Fade Effect 3518 //>>group: Effects 3519 //>>description: Fades the element. 3520 //>>docs: https://api.jqueryui.com/fade-effect/ 3521 //>>demos: https://jqueryui.com/effect/ 3522 3523 var effectsEffectFade = $.effects.define( 3524 "fade", 3525 "toggle", 3526 function (options, done) { 3527 var show = options.mode === "show"; 3528 3529 $(this) 3530 .css("opacity", show ? 0 : 1) 3531 .animate( 3532 { 3533 opacity: show ? 1 : 0, 3534 }, 3535 { 3536 queue: false, 3537 duration: options.duration, 3538 easing: options.easing, 3539 complete: done, 3540 } 3541 ); 3542 } 3543 ); 3544 3545 /*! 3546 * jQuery UI Effects Fold 1.13.3 3547 * https://jqueryui.com 3548 * 3549 * Copyright OpenJS Foundation and other contributors 3550 * Released under the MIT license. 3551 * https://jquery.org/license 3552 */ 3553 3554 //>>label: Fold Effect 3555 //>>group: Effects 3556 //>>description: Folds an element first horizontally and then vertically. 3557 //>>docs: https://api.jqueryui.com/fold-effect/ 3558 //>>demos: https://jqueryui.com/effect/ 3559 3560 var effectsEffectFold = $.effects.define( 3561 "fold", 3562 "hide", 3563 function (options, done) { 3564 // Create element 3565 var element = $(this), 3566 mode = options.mode, 3567 show = mode === "show", 3568 hide = mode === "hide", 3569 size = options.size || 15, 3570 percent = /([0-9]+)%/.exec(size), 3571 horizFirst = !!options.horizFirst, 3572 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 3573 duration = options.duration / 2, 3574 placeholder = $.effects.createPlaceholder(element), 3575 start = element.cssClip(), 3576 animation1 = { clip: $.extend({}, start) }, 3577 animation2 = { clip: $.extend({}, start) }, 3578 distance = [start[ref[0]], start[ref[1]]], 3579 queuelen = element.queue().length; 3580 3581 if (percent) { 3582 size = (parseInt(percent[1], 10) / 100) * distance[hide ? 0 : 1]; 3583 } 3584 animation1.clip[ref[0]] = size; 3585 animation2.clip[ref[0]] = size; 3586 animation2.clip[ref[1]] = 0; 3587 3588 if (show) { 3589 element.cssClip(animation2.clip); 3590 if (placeholder) { 3591 placeholder.css($.effects.clipToBox(animation2)); 3592 } 3593 3594 animation2.clip = start; 3595 } 3596 3597 // Animate 3598 element 3599 .queue(function (next) { 3600 if (placeholder) { 3601 placeholder 3602 .animate( 3603 $.effects.clipToBox(animation1), 3604 duration, 3605 options.easing 3606 ) 3607 .animate( 3608 $.effects.clipToBox(animation2), 3609 duration, 3610 options.easing 3611 ); 3612 } 3613 3614 next(); 3615 }) 3616 .animate(animation1, duration, options.easing) 3617 .animate(animation2, duration, options.easing) 3618 .queue(done); 3619 3620 $.effects.unshift(element, queuelen, 4); 3621 } 3622 ); 3623 3624 /*! 3625 * jQuery UI Effects Highlight 1.13.3 3626 * https://jqueryui.com 3627 * 3628 * Copyright OpenJS Foundation and other contributors 3629 * Released under the MIT license. 3630 * https://jquery.org/license 3631 */ 3632 3633 //>>label: Highlight Effect 3634 //>>group: Effects 3635 //>>description: Highlights the background of an element in a defined color for a custom duration. 3636 //>>docs: https://api.jqueryui.com/highlight-effect/ 3637 //>>demos: https://jqueryui.com/effect/ 3638 3639 var effectsEffectHighlight = $.effects.define( 3640 "highlight", 3641 "show", 3642 function (options, done) { 3643 var element = $(this), 3644 animation = { 3645 backgroundColor: element.css("backgroundColor"), 3646 }; 3647 3648 if (options.mode === "hide") { 3649 animation.opacity = 0; 3650 } 3651 3652 $.effects.saveStyle(element); 3653 3654 element 3655 .css({ 3656 backgroundImage: "none", 3657 backgroundColor: options.color || "#ffff99", 3658 }) 3659 .animate(animation, { 3660 queue: false, 3661 duration: options.duration, 3662 easing: options.easing, 3663 complete: done, 3664 }); 3665 } 3666 ); 3667 3668 /*! 3669 * jQuery UI Effects Size 1.13.3 3670 * https://jqueryui.com 3671 * 3672 * Copyright OpenJS Foundation and other contributors 3673 * Released under the MIT license. 3674 * https://jquery.org/license 3675 */ 3676 3677 //>>
3677label: Size Effect 3678 //>>group: Effects 3679 //>>description: Resize an element to a specified width and height. 3680 //>>docs: https://api.jqueryui.com/size-effect/ 3681 //>>demos: https://jqueryui.com/effect/ 3682 3683 var effectsEffectSize = $.effects.define("size", function (options, done) { 3684 // Create element 3685 var baseline, 3686 factor, 3687 temp, 3688 element = $(this), 3689 // Copy for children 3690 cProps = ["fontSize"], 3691 vProps = [ 3692 "borderTopWidth", 3693 "borderBottomWidth", 3694 "paddingTop", 3695 "paddingBottom", 3696 ], 3697 hProps = [ 3698 "borderLeftWidth", 3699 "borderRightWidth", 3700 "paddingLeft", 3701 "paddingRight", 3702 ], 3703 // Set options 3704 mode = options.mode, 3705 restore = mode !== "effect", 3706 scale = options.scale || "both", 3707 origin = options.origin || ["middle", "center"], 3708 position = element.css("position"), 3709 pos = element.position(), 3710 original = $.effects.scaledDimensions(element), 3711 from = options.from || original, 3712 to = options.to || $.effects.scaledDimensions(element, 0); 3713 3714 $.effects.createPlaceholder(element); 3715 3716 if (mode === "show") { 3717 temp = from; 3718 from = to; 3719 to = temp; 3720 } 3721 3722 // Set scaling factor 3723 factor = { 3724 from: { 3725 y: from.height / original.height, 3726 x: from.width / original.width, 3727 }, 3728 to: { 3729 y: to.height / original.height, 3730 x: to.width / original.width, 3731 }, 3732 }; 3733 3734 // Scale the css box 3735 if (scale === "box" || scale === "both") { 3736 // Vertical props scaling 3737 if (factor.from.y !== factor.to.y) { 3738 from = $.effects.setTransition(element, vProps, factor.from.y, from); 3739 to = $.effects.setTransition(element, vProps, factor.to.y, to); 3740 } 3741 3742 // Horizontal props scaling 3743 if (factor.from.x !== factor.to.x) { 3744 from = $.effects.setTransition(element, hProps, factor.from.x, from); 3745 to = $.effects.setTransition(element, hProps, factor.to.x, to); 3746 } 3747 } 3748 3749 // Scale the content 3750 if (scale === "content" || scale === "both") { 3751 // Vertical props scaling 3752 if (factor.from.y !== factor.to.y) { 3753 from = $.effects.setTransition(element, cProps, factor.from.y, from); 3754 to = $.effects.setTransition(element, cProps, factor.to.y, to); 3755 } 3756 } 3757 3758 // Adjust the position properties based on the provided origin points 3759 if (origin) { 3760 baseline = $.effects.getBaseline(origin, original); 3761 from.top = 3762 (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 3763 from.left = 3764 (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 3765 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 3766 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 3767 } 3768 delete from.outerHeight; 3769 delete from.outerWidth; 3770 element.css(from); 3771 3772 // Animate the children if desired 3773 if (scale === "content" || scale === "both") { 3774 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 3775 hProps = hProps.concat(["marginLeft", "marginRight"]); 3776 3777 // Only animate children with width attributes specified 3778 // TODO: is this right? should we include anything with css width specified as well 3779 element.find("*[width]").each(function () { 3780 var child = $(this), 3781 childOriginal = $.effects.scaledDimensions(child), 3782 childFrom = { 3783 height: childOriginal.height * factor.from.y, 3784 width: childOriginal.width * factor.from.x, 3785 outerHeight: childOriginal.outerHeight * factor.from.y, 3786 outerWidth: childOriginal.outerWidth * factor.from.x, 3787 }, 3788 childTo = { 3789 height: childOriginal.height * factor.to.y, 3790 width: childOriginal.width * factor.to.x, 3791 outerHeight: childOriginal.height * factor.to.y, 3792 outerWidth: childOriginal.width * factor.to.x, 3793 }; 3794 3795 // Vertical props scaling 3796 if (factor.from.y !== factor.to.y) { 3797 childFrom = $.effects.setTransition( 3798 child, 3799 vProps, 3800 factor.from.y, 3801 childFrom 3802 ); 3803 childTo = $.effects.setTransition( 3804 child, 3805 vProps, 3806 factor.to.y, 3807 childTo 3808 ); 3809 } 3810 3811 // Horizontal props scaling 3812 if (factor.from.x !== factor.to.x) { 3813 childFrom = $.effects.setTransition( 3814 child, 3815 hProps, 3816 factor.from.x, 3817 childFrom 3818 ); 3819 childTo = $.effects.setTransition( 3820 child, 3821 hProps, 3822 factor.to.x, 3823 childTo 3824 ); 3825 } 3826 3827 if (restore) { 3828 $.effects.saveStyle(child); 3829 } 3830 3831 // Animate children 3832 child.css(childFrom);
vendor: 42,327 bytes, lines 3833-5333
3833 child.animate(childTo, options.duration, options.easing, function () { 3834 // Restore children 3835 if (restore) { 3836 $.effects.restoreStyle(child); 3837 } 3838 }); 3839 }); 3840 } 3841 3842 // Animate 3843 element.animate(to, { 3844 queue: false, 3845 duration: options.duration, 3846 easing: options.easing, 3847 complete: function () { 3848 var offset = element.offset(); 3849 3850 if (to.opacity === 0) { 3851 element.css("opacity", from.opacity); 3852 } 3853 3854 if (!restore) { 3855 element 3856 .css("position", position === "static" ? "relative" : position) 3857 .offset(offset); 3858 3859 // Need to save style here so that automatic style restoration 3860 // doesn't restore to the original styles from before the animation. 3861 $.effects.saveStyle(element); 3862 } 3863 3864 done(); 3865 }, 3866 }); 3867 }); 3868 3869 /*! 3870 * jQuery UI Effects Scale 1.13.3 3871 * https://jqueryui.com 3872 * 3873 * Copyright OpenJS Foundation and other contributors 3874 * Released under the MIT license. 3875 * https://jquery.org/license 3876 */ 3877 3878 //>>label: Scale Effect 3879 //>>group: Effects 3880 //>>description: Grows or shrinks an element and its content. 3881 //>>docs: https://api.jqueryui.com/scale-effect/ 3882 //>>demos: https://jqueryui.com/effect/ 3883 3884 var effectsEffectScale = $.effects.define("scale", function (options, done) { 3885 // Create element 3886 var el = $(this), 3887 mode = options.mode, 3888 percent = 3889 parseInt(options.percent, 10) || 3890 (parseInt(options.percent, 10) === 0 ? 0 : mode !== "effect" ? 0 : 100), 3891 newOptions = $.extend( 3892 true, 3893 { 3894 from: $.effects.scaledDimensions(el), 3895 to: $.effects.scaledDimensions( 3896 el, 3897 percent, 3898 options.direction || "both" 3899 ), 3900 origin: options.origin || ["middle", "center"], 3901 }, 3902 options 3903 ); 3904 3905 // Fade option to support puff 3906 if (options.fade) { 3907 newOptions.from.opacity = 1; 3908 newOptions.to.opacity = 0; 3909 } 3910 3911 $.effects.effect.size.call(this, newOptions, done); 3912 }); 3913 3914 /*! 3915 * jQuery UI Effects Puff 1.13.3 3916 * https://jqueryui.com 3917 * 3918 * Copyright OpenJS Foundation and other contributors 3919 * Released under the MIT license. 3920 * https://jquery.org/license 3921 */ 3922 3923 //>>label: Puff Effect 3924 //>>group: Effects 3925 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 3926 //>>docs: https://api.jqueryui.com/puff-effect/ 3927 //>>demos: https://jqueryui.com/effect/ 3928 3929 var effectsEffectPuff = $.effects.define( 3930 "puff", 3931 "hide", 3932 function (options, done) { 3933 var newOptions = $.extend(true, {}, options, { 3934 fade: true, 3935 percent: parseInt(options.percent, 10) || 150, 3936 }); 3937 3938 $.effects.effect.scale.call(this, newOptions, done); 3939 } 3940 ); 3941 3942 /*! 3943 * jQuery UI Effects Pulsate 1.13.3 3944 * https://jqueryui.com 3945 * 3946 * Copyright OpenJS Foundation and other contributors 3947 * Released under the MIT license. 3948 * https://jquery.org/license 3949 */ 3950 3951 //>>label: Pulsate Effect 3952 //>>group: Effects 3953 //>>description: Pulsates an element n times by changing the opacity to zero and back. 3954 //>>docs: https://api.jqueryui.com/pulsate-effect/ 3955 //>>demos: https://jqueryui.com/effect/ 3956 3957 var effectsEffectPulsate = $.effects.define( 3958 "pulsate", 3959 "show", 3960 function (options, done) { 3961 var element = $(this), 3962 mode = options.mode, 3963 show = mode === "show", 3964 hide = mode === "hide", 3965 showhide = show || hide, 3966 // Showing or hiding leaves off the "last" animation 3967 anims = (options.times || 5) * 2 + (showhide ? 1 : 0), 3968 duration = options.duration / anims, 3969 animateTo = 0, 3970 i = 1, 3971 queuelen = element.queue().length; 3972 3973 if (show || !element.is(":visible")) { 3974 element.css("opacity", 0).show(); 3975 animateTo = 1; 3976 } 3977 3978 // Anims - 1 opacity "toggles" 3979 for (; i < anims; i++) { 3980 element.animate({ opacity: animateTo }, duration, options.easing); 3981 animateTo = 1 - animateTo; 3982 } 3983 3984 element.animate({ opacity: animateTo }, duration, options.easing); 3985 3986 element.queue(done); 3987 3988 $.effects.unshift(element, queuelen, anims + 1); 3989 } 3990 ); 3991 3992 /*! 3993 * jQuery UI Effects Shake 1.13.3 3994 * https://jqueryui.com 3995 * 3996 * Copyright OpenJS Foundation and other contributors 3997 * Released under the MIT license. 3998 * https://jquery.org/license 3999 */ 4000 4001 //>>label: Shake Effect 4002 //>>group: Effects 4003 //>>description: Shakes an element horizontally or vertically n times. 4004 //>>docs: https://api.jqueryui.com/shake-effect/ 4005 //>>demos: https://jqueryui.com/effect/ 4006 4007 var effectsEffectShake = $.effects.define("shake", function (options, done) { 4008 var i = 1, 4009 element = $(this), 4010 direction = options.direction || "left", 4011 distance = options.distance || 20, 4012 times = options.times || 3, 4013 anims = times * 2 + 1, 4014 speed = Math.round(options.duration / anims), 4015 ref = direction === "up" || direction === "down" ? "top" : "left", 4016 positiveMotion = direction === "up" || direction === "left", 4017 animation = {}, 4018 animation1 = {}, 4019 animation2 = {}, 4020 queuelen = element.queue().length; 4021 4022 $.effects.createPlaceholder(element); 4023 4024 // Animation 4025 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 4026 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 4027 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 4028 4029 // Animate 4030 element.animate(animation, speed, options.easing); 4031 4032 // Shakes 4033 for (; i < times; i++) { 4034 element 4035 .animate(animation1, speed, options.easing) 4036 .animate(animation2, speed, options.easing); 4037 } 4038 4039 element 4040 .animate(animation1, speed, options.easing) 4041 .animate(animation, speed / 2, options.easing) 4042 .queue(done); 4043 4044 $.effects.unshift(element, queuelen, anims + 1); 4045 }); 4046 4047 /*! 4048 * jQuery UI Effects Slide 1.13.3 4049 * https://jqueryui.com 4050 * 4051 * Copyright OpenJS Foundation and other contributors 4052 * Released under the MIT license. 4053 * https://jquery.org/license 4054 */ 4055 4056 //>>label: Slide Effect 4057 //>>group: Effects 4058 //>>description: Slides an element in and out of the viewport. 4059 //>>docs: https://api.jqueryui.com/slide-effect/ 4060 //>>demos: https://jqueryui.com/effect/ 4061 4062 var effectsEffectSlide = $.effects.define( 4063 "slide", 4064 "show", 4065 function (options, done) { 4066 var startClip, 4067 startRef, 4068 element = $(this), 4069 map = { 4070 up: ["bottom", "top"], 4071 down: ["top", "bottom"], 4072 left: ["right", "left"], 4073 right: ["left", "right"], 4074 }, 4075 mode = options.mode, 4076 direction = options.direction || "left", 4077 ref = direction === "up" || direction === "down" ? "top" : "left", 4078 positiveMotion = direction === "up" || direction === "left", 4079 distance = 4080 options.distance || 4081 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 4082 animation = {}; 4083 4084 $.effects.createPlaceholder(element); 4085 4086 startClip = element.cssClip(); 4087 startRef = element.position()[ref]; 4088 4089 // Define hide animation 4090 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 4091 animation.clip = element.cssClip(); 4092 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 4093 4094 // Reverse the animation if we're showing 4095 if (mode === "show") { 4096 element.cssClip(animation.clip); 4097 element.css(ref, animation[ref]); 4098 animation.clip = startClip; 4099 animation[ref] = startRef; 4100 } 4101 4102 // Actually animate 4103 element.animate(animation, { 4104 queue: false, 4105 duration: options.duration, 4106 easing: options.easing, 4107 complete: done, 4108 }); 4109 } 4110 ); 4111 4112 /*! 4113 * jQuery UI Effects Transfer 1.13.3 4114 * https://jqueryui.com 4115 * 4116 * Copyright OpenJS Foundation and other contributors 4117 * Released under the MIT license. 4118 * https://jquery.org/license 4119 */ 4120 4121 //>>label: Transfer Effect 4122 //>>group: Effects 4123 //>>description: Displays a transfer effect from one element to another. 4124 //>>docs: https://api.jqueryui.com/transfer-effect/ 4125 //>>demos: https://jqueryui.com/effect/ 4126 4127 var effect; 4128 if ($.uiBackCompat !== false) { 4129 effect = $.effects.define("transfer", function (options, done) { 4130 $(this).transfer(options, done); 4131 }); 4132 } 4133 var effectsEffectTransfer = effect; 4134 4135 /*! 4136 * jQuery UI Focusable 1.13.3 4137 * https://jqueryui.com 4138 * 4139 * Copyright OpenJS Foundation and other contributors 4140 * Released under the MIT license. 4141 * https://jquery.org/license 4142 */ 4143 4144 //>>label: :focusable Selector 4145 //>>group: Core 4146 //>>description: Selects elements which can be focused. 4147 //>>docs: https://api.jqueryui.com/focusable-selector/ 4148 4149 // Selectors 4150 $.ui.focusable = function (element, hasTabindex) { 4151 var map, 4152 mapName, 4153 img, 4154 focusableIfVisible, 4155 fieldset, 4156 nodeName = element.nodeName.toLowerCase(); 4157 4158 if ("area" === nodeName) { 4159 map = element.parentNode; 4160 mapName = map.name; 4161 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 4162 return false; 4163 } 4164 img = $("img[usemap='#" + mapName + "']"); 4165 return img.length > 0 && img.is(":visible"); 4166 } 4167 4168 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 4169 focusableIfVisible = !element.disabled; 4170 4171 if (focusableIfVisible) { 4172 // Form controls within a disabled fieldset are disabled. 4173 // However, controls within the fieldset's legend do not get disabled. 4174 // Since controls generally aren't placed inside legends, we skip 4175 // this portion of the check. 4176 fieldset = $(element).closest("fieldset")[0]; 4177 if (fieldset) { 4178 focusableIfVisible = !fieldset.disabled; 4179 } 4180 } 4181 } else if ("a" === nodeName) { 4182 focusableIfVisible = element.href || hasTabindex; 4183 } else { 4184 focusableIfVisible = hasTabindex; 4185 } 4186 4187 return ( 4188 focusableIfVisible && $(element).is(":visible") && visible($(element)) 4189 ); 4190 }; 4191 4192 // Support: IE 8 only 4193 // IE 8 doesn't resolve inherit to visible/hidden for computed values 4194 function visible(element) { 4195 var visibility = element.css("visibility"); 4196 while (visibility === "inherit") { 4197 element = element.parent(); 4198 visibility = element.css("visibility"); 4199 } 4200 return visibility === "visible"; 4201 } 4202 4203 $.extend($.expr.pseudos, { 4204 focusable: function (element) { 4205 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 4206 }, 4207 }); 4208 4209 var focusable = $.ui.focusable; 4210 4211 // Support: IE8 Only 4212 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 4213 // with a string, so we need to find the proper form. 4214 var form = ($.fn._form = function () { 4215 return typeof this[0].form === "string" 4216 ? this.closest("form") 4217 : $(this[0].form); 4218 }); 4219 4220 /*! 4221 * jQuery UI Form Reset Mixin 1.13.3 4222 * https://jqueryui.com 4223 * 4224 * Copyright OpenJS Foundation and other contributors 4225 * Released under the MIT license. 4226 * https://jquery.org/license 4227 */ 4228 4229 //>>label: Form Reset Mixin 4230 //>>group: Core 4231 //>>description: Refresh input widgets when their form is reset 4232 //>>docs: https://api.jqueryui.com/form-reset-mixin/ 4233 4234 var formResetMixin = ($.ui.formResetMixin = { 4235 _formResetHandler: function () { 4236 var form = $(this); 4237 4238 // Wait for the form reset to actually happen before refreshing 4239 setTimeout(function () { 4240 var instances = form.data("ui-form-reset-instances"); 4241 $.each(instances, function () { 4242 this.refresh(); 4243 }); 4244 }); 4245 }, 4246 4247 _bindFormResetHandler: function () { 4248 this.form = this.element._form(); 4249 if (!this.form.length) { 4250 return; 4251 } 4252 4253 var instances = this.form.data("ui-form-reset-instances") || []; 4254 if (!instances.length) { 4255 // We don't use _on() here because we use a single event handler per form 4256 this.form.on("reset.ui-form-reset", this._formResetHandler); 4257 } 4258 instances.push(this); 4259 this.form.data("ui-form-reset-instances", instances); 4260 }, 4261 4262 _unbindFormResetHandler: function () { 4263 if (!this.form.length) { 4264 return; 4265 } 4266 4267 var instances = this.form.data("ui-form-reset-instances"); 4268 instances.splice($.inArray(this, instances), 1); 4269 if (instances.length) { 4270 this.form.data("ui-form-reset-instances", instances); 4271 } else { 4272 this.form 4273 .removeData("ui-form-reset-instances") 4274 .off("reset.ui-form-reset"); 4275 } 4276 }, 4277 }); 4278 4279 /*! 4280 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 4281 * https://jqueryui.com 4282 * 4283 * Copyright OpenJS Foundation and other contributors 4284 * Released under the MIT license. 4285 * https://jquery.org/license 4286 * 4287 */ 4288 4289 //>>label: jQuery 1.8+ Support 4290 //>>group: Core 4291 //>>description: Support version 1.8.x and newer of jQuery core 4292 4293 // Support: jQuery 1.9.x or older 4294 // $.expr[ ":" ] is deprecated. 4295 if (!$.expr.pseudos) { 4296 $.expr.pseudos = $.expr[":"]; 4297 } 4298 4299 // Support: jQuery 1.11.x or older 4300 // $.unique has been renamed to $.uniqueSort 4301 if (!$.uniqueSort) { 4302 $.uniqueSort = $.unique; 4303 } 4304 4305 // Support: jQuery 2.2.x or older. 4306 // This method has been defined in jQuery 3.0.0. 4307 // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 4308 if (!$.escapeSelector) { 4309 // CSS string/identifier serialization 4310 // https://drafts.csswg.org/cssom/#common-serializing-idioms 4311 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 4312 4313 var fcssescape = function (ch, asCodePoint) { 4314 if (asCodePoint) { 4315 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 4316 if (ch === "\0") { 4317 return "\uFFFD"; 4318 } 4319 4320 // Control characters and (dependent upon position) numbers get escaped as code points 4321 return ( 4322 ch.slice(0, -1) + 4323 "\\" + 4324 ch.charCodeAt(ch.length - 1).toString(16) + 4325 " " 4326 ); 4327 } 4328 4329 // Other potentially-special ASCII characters get backslash-escaped 4330 return "\\" + ch; 4331 }; 4332 4333 $.escapeSelector = function (sel) { 4334 return (sel + "").replace(rcssescape, fcssescape); 4335 }; 4336 } 4337 4338 // Support: jQuery 3.4.x or older 4339 // These methods have been defined in jQuery 3.5.0. 4340 if (!$.fn.even || !$.fn.odd) { 4341 $.fn.extend({ 4342 even: function () { 4343 return this.filter(function (i) { 4344 return i % 2 === 0; 4345 }); 4346 }, 4347 odd: function () { 4348 return this.filter(function (i) { 4349 return i % 2 === 1; 4350 }); 4351 }, 4352 }); 4353 } 4354 4355 /*! 4356 * jQuery UI Keycode 1.13.3 4357 * https://jqueryui.com 4358 * 4359 * Copyright OpenJS Foundation and other contributors 4360 * Released under the MIT license. 4361 * https://jquery.org/license 4362 */ 4363 4364 //>>label: Keycode 4365 //>>group: Core 4366 //>>description: Provide keycodes as keynames 4367 //>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 4368 4369 var keycode = ($.ui.keyCode = { 4370 BACKSPACE: 8, 4371 COMMA: 188, 4372 DELETE: 46, 4373 DOWN: 40, 4374 END: 35, 4375 ENTER: 13, 4376 ESCAPE: 27, 4377 HOME: 36, 4378 LEFT: 37, 4379 PAGE_DOWN: 34, 4380 PAGE_UP: 33, 4381 PERIOD: 190, 4382 RIGHT: 39, 4383 SPACE: 32, 4384 TAB: 9, 4385 UP: 38, 4386 }); 4387 4388 /*! 4389 * jQuery UI Labels 1.13.3 4390 * https://jqueryui.com 4391 * 4392 * Copyright OpenJS Foundation and other contributors 4393 * Released under the MIT license. 4394 * https://jquery.org/license 4395 */ 4396 4397 //>>label: labels 4398 //>>group: Core 4399 //>>description: Find all the labels associated with a given input 4400 //>>docs: https://api.jqueryui.com/labels/ 4401 4402 var labels = ($.fn.labels = function () { 4403 var ancestor, selector, id, labels, ancestors; 4404 4405 if (!this.length) { 4406 return this.pushStack([]); 4407 } 4408 4409 // Check control.labels first 4410 if (this[0].labels && this[0].labels.length) { 4411 return this.pushStack(this[0].labels); 4412 } 4413 4414 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4415 // Above browsers do not support control.labels. Everything below is to support them 4416 // as well as document fragments. control.labels does not work on document fragments 4417 labels = this.eq(0).parents("label"); 4418 4419 // Look for the label based on the id 4420 id = this.attr("id"); 4421 if (id) { 4422 // We don't search against the document in case the element 4423 // is disconnected from the DOM 4424 ancestor = this.eq(0).parents().last(); 4425 4426 // Get a full set of top level ancestors 4427 ancestors = ancestor.add( 4428 ancestor.length ? ancestor.siblings() : this.siblings() 4429 ); 4430 4431 // Create a selector for the label based on the id 4432 selector = "label[for='" + $.escapeSelector(id) + "']"; 4433 4434 labels = labels.add(ancestors.find(selector).addBack(selector)); 4435 } 4436 4437 // Return whatever we have found for labels 4438 return this.pushStack(labels); 4439 }); 4440 4441 /*! 4442 * jQuery UI Scroll Parent 1.13.3 4443 * https://jqueryui.com 4444 * 4445 * Copyright OpenJS Foundation and other contributors 4446 * Released under the MIT license. 4447 * https://jquery.org/license 4448 */ 4449 4450 //>>label: scrollParent 4451 //>>group: Core 4452 //>>description: Get the closest ancestor element that is scrollable. 4453 //>>docs: https://api.jqueryui.com/scrollParent/ 4454 4455 var scrollParent = ($.fn.scrollParent = function (includeHidden) { 4456 var position = this.css("position"), 4457 excludeStaticParent = position === "absolute", 4458 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4459 scrollParent = this.parents() 4460 .filter(function () { 4461 var parent = $(this); 4462 if (excludeStaticParent && parent.css("position") === "static") { 4463 return false; 4464 } 4465 return overflowRegex.test( 4466 parent.css("overflow") + 4467 parent.css("overflow-y") + 4468 parent.css("overflow-x") 4469 ); 4470 }) 4471 .eq(0); 4472 4473 return position === "fixed" || !scrollParent.length 4474 ? $(this[0].ownerDocument || document) 4475 : scrollParent; 4476 }); 4477 4478 /*! 4479 * jQuery UI Tabbable 1.13.3 4480 * https://jqueryui.com 4481 * 4482 * Copyright OpenJS Foundation and other contributors 4483 * Released under the MIT license. 4484 * https://jquery.org/license 4485 */ 4486 4487 //>>label: :tabbable Selector 4488 //>>group: Core 4489 //>>description: Selects elements which can be tabbed to. 4490 //>>docs: https://api.jqueryui.com/tabbable-selector/ 4491 4492 var tabbable = $.extend($.expr.pseudos, { 4493 tabbable: function (element) { 4494 var tabIndex = $.attr(element, "tabindex"), 4495 hasTabindex = tabIndex != null; 4496 return ( 4497 (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex) 4498 ); 4499 }, 4500 }); 4501 4502 /*! 4503 * jQuery UI Unique ID 1.13.3 4504 * https://jqueryui.com 4505 * 4506 * Copyright OpenJS Foundation and other contributors 4507 * Released under the MIT license. 4508 * https://jquery.org/license 4509 */ 4510 4511 //>>label: uniqueId 4512 //>>group: Core 4513 //>>description: Functions to generate and remove uniqueId's 4514 //>>docs: https://api.jqueryui.com/uniqueId/ 4515 4516 var uniqueId = $.fn.extend({ 4517 uniqueId: (function () { 4518 var uuid = 0; 4519 4520 return function () { 4521 return this.each(function () { 4522 if (!this.id) { 4523 this.id = "ui-id-" + ++uuid; 4524 } 4525 }); 4526 }; 4527 })(), 4528 4529 removeUniqueId: function () { 4530 return this.each(function () { 4531 if (/^ui-id-\d+$/.test(this.id)) { 4532 $(this).removeAttr("id"); 4533 } 4534 }); 4535 }, 4536 }); 4537 4538 /*! 4539 * jQuery UI Accordion 1.13.3 4540 * https://jqueryui.com 4541 * 4542 * Copyright OpenJS Foundation and other contributors 4543 * Released under the MIT license. 4544 * https://jquery.org/license 4545 */ 4546 4547 //>>label: Accordion 4548 //>>group: Widgets 4549 /* eslint-disable max-len */ 4550 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4551 /* eslint-enable max-len */ 4552 //>>docs: https://api.jqueryui.com/accordion/ 4553 //>>demos: https://jqueryui.com/accordion/ 4554 //>>css.structure: ../../themes/base/core.css 4555 //>>css.structure: ../../themes/base/accordion.css 4556 //>>css.theme: ../../themes/base/theme.css 4557 4558 var widgetsAccordion = $.widget("ui.accordion", { 4559 version: "1.13.3", 4560 options: { 4561 active: 0, 4562 animate: {}, 4563 classes: { 4564 "ui-accordion-header": "ui-corner-top", 4565 "ui-accordion-header-collapsed": "ui-corner-all", 4566 "ui-accordion-content": "ui-corner-bottom", 4567 }, 4568 collapsible: false, 4569 event: "click", 4570 header: function (elem) { 4571 return elem 4572 .find("> li > :first-child") 4573 .add(elem.find("> :not(li)").even()); 4574 }, 4575 heightStyle: "auto", 4576 icons: { 4577 activeHeader: "ui-icon-triangle-1-s", 4578 header: "ui-icon-triangle-1-e", 4579 }, 4580 4581 // Callbacks 4582 activate: null, 4583 beforeActivate: null, 4584 }, 4585 4586 hideProps: { 4587 borderTopWidth: "hide", 4588 borderBottomWidth: "hide", 4589 paddingTop: "hide", 4590 paddingBottom: "hide", 4591 height: "hide", 4592 }, 4593 4594 showProps: { 4595 borderTopWidth: "show", 4596 borderBottomWidth: "show", 4597 paddingTop: "show", 4598 paddingBottom: "show", 4599 height: "show", 4600 }, 4601 4602 _create: function () { 4603 var options = this.options; 4604 4605 this.prevShow = this.prevHide = $(); 4606 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 4607 this.element.attr("role", "tablist"); 4608 4609 // Don't allow collapsible: false and active: false / null 4610 if ( 4611 !options.collapsible && 4612 (options.active === false || options.active == null) 4613 ) { 4614 options.active = 0; 4615 } 4616 4617 this._processPanels(); 4618 4619 // handle negative values 4620 if (options.active < 0) { 4621 options.active += this.headers.length; 4622 } 4623 this._refresh(); 4624 }, 4625 4626 _getCreateEventData: function () { 4627 return { 4628 header: this.active, 4629 panel: !this.active.length ? $() : this.active.next(), 4630 }; 4631 }, 4632 4633 _createIcons: function () { 4634 var icon, 4635 children, 4636 icons = this.options.icons; 4637 4638 if (icons) { 4639 icon = $("<span>"); 4640 this._addClass( 4641 icon, 4642 "ui-accordion-header-icon", 4643 "ui-icon " + icons.header 4644 ); 4645 icon.prependTo(this.headers); 4646 children = this.active.children(".ui-accordion-header-icon"); 4647 this._removeClass(children, icons.header) 4648 ._addClass(children, null, icons.activeHeader) 4649 ._addClass(this.headers, "ui-accordion-icons"); 4650 } 4651 }, 4652 4653 _destroyIcons: function () { 4654 this._removeClass(this.headers, "ui-accordion-icons"); 4655 this.headers.children(".ui-accordion-header-icon").remove(); 4656 }, 4657 4658 _destroy: function () { 4659 var contents; 4660 4661 // Clean up main element 4662 this.element.removeAttr("role"); 4663 4664 // Clean up headers 4665 this.headers 4666 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 4667 .removeUniqueId(); 4668 4669 this._destroyIcons(); 4670 4671 // Clean up content panels 4672 contents = this.headers 4673 .next() 4674 .css("display", "") 4675 .removeAttr("role aria-hidden aria-labelledby") 4676 .removeUniqueId(); 4677 4678 if (this.options.heightStyle !== "content") { 4679 contents.css("height", ""); 4680 } 4681 }, 4682 4683 _setOption: function (key, value) { 4684 if (key === "active") { 4685 // _activate() will handle invalid values and update this.options 4686 this._activate(value); 4687 return; 4688 } 4689 4690 if (key === "event") { 4691 if (this.options.event) { 4692 this._off(this.headers, this.options.event); 4693 } 4694 this._setupEvents(value); 4695 } 4696 4697 this._super(key, value); 4698 4699 // Setting collapsible: false while collapsed; open first panel 4700 if (key === "collapsible" && !value && this.options.active === false) { 4701 this._activate(0); 4702 } 4703 4704 if (key === "icons") { 4705 this._destroyIcons(); 4706 if (value) { 4707 this._createIcons(); 4708 } 4709 } 4710 }, 4711 4712 _setOptionDisabled: function (value) { 4713 this._super(value); 4714 4715 this.element.attr("aria-disabled", value); 4716 4717 // Support: IE8 Only 4718 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 4719 // so we need to add the disabled class to the headers and panels 4720 this._toggleClass(null, "ui-state-disabled", !!value); 4721 this._toggleClass( 4722 this.headers.add(this.headers.next()), 4723 null, 4724 "ui-state-disabled", 4725 !!value 4726 ); 4727 }, 4728 4729 _keydown: function (event) { 4730 if (event.altKey || event.ctrlKey) { 4731 return; 4732 } 4733 4734 var keyCode = $.ui.keyCode, 4735 length = this.headers.length, 4736 currentIndex = this.headers.index(event.target), 4737 toFocus = false; 4738 4739 switch (event.keyCode) { 4740 case keyCode.RIGHT: 4741 case keyCode.DOWN: 4742 toFocus = this.headers[(currentIndex + 1) % length]; 4743 break; 4744 case keyCode.LEFT: 4745 case keyCode.UP: 4746 toFocus = this.headers[(currentIndex - 1 + length) % length]; 4747 break; 4748 case keyCode.SPACE: 4749 case keyCode.ENTER: 4750 this._eventHandler(event); 4751 break; 4752 case keyCode.HOME: 4753 toFocus = this.headers[0]; 4754 break; 4755 case keyCode.END: 4756 toFocus = this.headers[length - 1]; 4757 break; 4758 } 4759 4760 if (toFocus) { 4761 $(event.target).attr("tabIndex", -1); 4762 $(toFocus).attr("tabIndex", 0); 4763 $(toFocus).trigger("focus"); 4764 event.preventDefault(); 4765 } 4766 }, 4767 4768 _panelKeyDown: function (event) { 4769 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 4770 $(event.currentTarget).prev().trigger("focus"); 4771 } 4772 }, 4773 4774 refresh: function () { 4775 var options = this.options; 4776 this._processPanels(); 4777 4778 // Was collapsed or no panel 4779 if ( 4780 (options.active === false && options.collapsible === true) || 4781 !this.headers.length 4782 ) { 4783 options.active = false; 4784 this.active = $(); 4785 4786 // active false only when collapsible is true 4787 } else if (options.active === false) { 4788 this._activate(0); 4789 4790 // was active, but active panel is gone 4791 } else if ( 4792 this.active.length && 4793 !$.contains(this.element[0], this.active[0]) 4794 ) { 4795 // all remaining panel are disabled 4796 if ( 4797 this.headers.length === this.headers.find(".ui-state-disabled").length 4798 ) { 4799 options.active = false; 4800 this.active = $(); 4801 4802 // activate previous panel 4803 } else { 4804 this._activate(Math.max(0, options.active - 1)); 4805 } 4806 4807 // was active, active panel still exists 4808 } else { 4809 // make sure active index is correct 4810 options.active = this.headers.index(this.active); 4811 } 4812 4813 this._destroyIcons(); 4814 4815 this._refresh(); 4816 }, 4817 4818 _processPanels: function () { 4819 var prevHeaders = this.headers, 4820 prevPanels = this.panels; 4821 4822 if (typeof this.options.header === "function") { 4823 this.headers = this.options.header(this.element); 4824 } else { 4825 this.headers = this.element.find(this.options.header); 4826 } 4827 this._addClass( 4828 this.headers, 4829 "ui-accordion-header ui-accordion-header-collapsed", 4830 "ui-state-default" 4831 ); 4832 4833 this.panels = this.headers 4834 .next() 4835 .filter(":not(.ui-accordion-content-active)") 4836 .hide(); 4837 this._addClass( 4838 this.panels, 4839 "ui-accordion-content", 4840 "ui-helper-reset ui-widget-content" 4841 ); 4842 4843 // Avoid memory leaks (#10056) 4844 if (prevPanels) { 4845 this._off(prevHeaders.not(this.headers)); 4846 this._off(prevPanels.not(this.panels)); 4847 } 4848 }, 4849 4850 _refresh: function () { 4851 var maxHeight, 4852 options = this.options, 4853 heightStyle = options.heightStyle, 4854 parent = this.element.parent(); 4855 4856 this.active = this._findActive(options.active); 4857 this._addClass( 4858 this.active, 4859 "ui-accordion-header-active", 4860 "ui-state-active" 4861 )._removeClass(this.active, "ui-accordion-header-collapsed"); 4862 this._addClass(this.active.next(), "ui-accordion-content-active"); 4863 this.active.next().show(); 4864 4865 this.headers 4866 .attr("role", "tab") 4867 .each(function () { 4868 var header = $(this), 4869 headerId = header.uniqueId().attr("id"), 4870 panel = header.next(), 4871 panelId = panel.uniqueId().attr("id"); 4872 header.attr("aria-controls", panelId); 4873 panel.attr("aria-labelledby", headerId); 4874 }) 4875 .next() 4876 .attr("role", "tabpanel"); 4877 4878 this.headers 4879 .not(this.active) 4880 .attr({ 4881 "aria-selected": "false", 4882 "aria-expanded": "false", 4883 tabIndex: -1, 4884 }) 4885 .next() 4886 .attr({ 4887 "aria-hidden": "true", 4888 }) 4889 .hide(); 4890 4891 // Make sure at least one header is in the tab order 4892 if (!this.active.length) { 4893 this.headers.eq(0).attr("tabIndex", 0); 4894 } else { 4895 this.active 4896 .attr({ 4897 "aria-selected": "true", 4898 "aria-expanded": "true", 4899 tabIndex: 0, 4900 }) 4901 .next() 4902 .attr({ 4903 "aria-hidden": "false", 4904 }); 4905 } 4906 4907 this._createIcons(); 4908 4909 this._setupEvents(options.event); 4910 4911 if (heightStyle === "fill") { 4912 maxHeight = parent.height(); 4913 this.element.siblings(":visible").each(function () { 4914 var elem = $(this), 4915 position = elem.css("position"); 4916 4917 if (position === "absolute" || position === "fixed") { 4918 return; 4919 } 4920 maxHeight -= elem.outerHeight(true); 4921 }); 4922 4923 this.headers.each(function () { 4924 maxHeight -= $(this).outerHeight(true); 4925 }); 4926 4927 this.headers 4928 .next() 4929 .each(function () { 4930 $(this).height( 4931 Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()) 4932 ); 4933 }) 4934 .css("overflow", "auto"); 4935 } else if (heightStyle === "auto") { 4936 maxHeight = 0; 4937 this.headers 4938 .next() 4939 .each(function () { 4940 var isVisible = $(this).is(":visible"); 4941 if (!isVisible) { 4942 $(this).show(); 4943 } 4944 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 4945 if (!isVisible) { 4946 $(this).hide(); 4947 } 4948 }) 4949 .height(maxHeight); 4950 } 4951 }, 4952 4953 _activate: function (index) { 4954 var active = this._findActive(index)[0]; 4955 4956 // Trying to activate the already active panel 4957 if (active === this.active[0]) { 4958 return; 4959 } 4960 4961 // Trying to collapse, simulate a click on the currently active header 4962 active = active || this.active[0]; 4963 4964 this._eventHandler({ 4965 target: active, 4966 currentTarget: active, 4967 preventDefault: $.noop, 4968 }); 4969 }, 4970 4971 _findActive: function (selector) { 4972 return typeof selector === "number" ? this.headers.eq(selector) : $(); 4973 }, 4974 4975 _setupEvents: function (event) { 4976 var events = { 4977 keydown: "_keydown", 4978 }; 4979 if (event) { 4980 $.each(event.split(" "), function (index, eventName) { 4981 events[eventName] = "_eventHandler"; 4982 }); 4983 } 4984 4985 this._off(this.headers.add(this.headers.next())); 4986 this._on(this.headers, events); 4987 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 4988 this._hoverable(this.headers); 4989 this._focusable(this.headers); 4990 }, 4991 4992 _eventHandler: function (event) { 4993 var activeChildren, 4994 clickedChildren, 4995 options = this.options, 4996 active = this.active, 4997 clicked = $(event.currentTarget), 4998 clickedIsActive = clicked[0] === active[0], 4999 collapsing = clickedIsActive && options.collapsible, 5000 toShow = collapsing ? $() : clicked.next(), 5001 toHide = active.next(), 5002 eventData = { 5003 oldHeader: active, 5004 oldPanel: toHide, 5005 newHeader: collapsing ? $() : clicked, 5006 newPanel: toShow, 5007 }; 5008 5009 event.preventDefault(); 5010 5011 if ( 5012 // click on active header, but not collapsible 5013 (clickedIsActive && !options.collapsible) || 5014 // allow canceling activation 5015 this._trigger("beforeActivate", event, eventData) === false 5016 ) { 5017 return; 5018 } 5019 5020 options.active = collapsing ? false : this.headers.index(clicked); 5021 5022 // When the call to ._toggle() comes after the class changes 5023 // it causes a very odd bug in IE 8 (see #6720) 5024 this.active = clickedIsActive ? $() : clicked; 5025 this._toggle(eventData); 5026 5027 // Switch classes 5028 // corner classes on the previously active header stay after the animation 5029 this._removeClass( 5030 active, 5031 "ui-accordion-header-active", 5032 "ui-state-active" 5033 ); 5034 if (options.icons) { 5035 activeChildren = active.children(".ui-accordion-header-icon"); 5036 this._removeClass( 5037 activeChildren, 5038 null, 5039 options.icons.activeHeader 5040 )._addClass(activeChildren, null, options.icons.header); 5041 } 5042 5043 if (!clickedIsActive) { 5044 this._removeClass(clicked, "ui-accordion-header-collapsed")._addClass( 5045 clicked, 5046 "ui-accordion-header-active", 5047 "ui-state-active" 5048 ); 5049 if (options.icons) { 5050 clickedChildren = clicked.children(".ui-accordion-header-icon"); 5051 this._removeClass( 5052 clickedChildren, 5053 null, 5054 options.icons.header 5055 )._addClass(clickedChildren, null, options.icons.activeHeader); 5056 } 5057 5058 this._addClass(clicked.next(), "ui-accordion-content-active"); 5059 } 5060 }, 5061 5062 _toggle: function (data) { 5063 var toShow = data.newPanel, 5064 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 5065 5066 // Handle activating a panel during the animation for another activation 5067 this.prevShow.add(this.prevHide).stop(true, true); 5068 this.prevShow = toShow; 5069 this.prevHide = toHide; 5070 5071 if (this.options.animate) { 5072 this._animate(toShow, toHide, data); 5073 } else { 5074 toHide.hide(); 5075 toShow.show(); 5076 this._toggleComplete(data); 5077 } 5078 5079 toHide.attr({ 5080 "aria-hidden": "true", 5081 }); 5082 toHide.prev().attr({ 5083 "aria-selected": "false", 5084 "aria-expanded": "false", 5085 }); 5086 5087 // if we're switching panels, remove the old header from the tab order 5088 // if we're opening from collapsed state, remove the previous header from the tab order 5089 // if we're collapsing, then keep the collapsing header in the tab order 5090 if (toShow.length && toHide.length) { 5091 toHide.prev().attr({ 5092 tabIndex: -1, 5093 "aria-expanded": "false", 5094 }); 5095 } else if (toShow.length) { 5096 this.headers 5097 .filter(function () { 5098 return parseInt($(this).attr("tabIndex"), 10) === 0; 5099 }) 5100 .attr("tabIndex", -1); 5101 } 5102 5103 toShow.attr("aria-hidden", "false").prev().attr({ 5104 "aria-selected": "true", 5105 "aria-expanded": "true", 5106 tabIndex: 0, 5107 }); 5108 }, 5109 5110 _animate: function (toShow, toHide, data) { 5111 var total, 5112 easing, 5113 duration, 5114 that = this, 5115 adjust = 0, 5116 boxSizing = toShow.css("box-sizing"), 5117 down = 5118 toShow.length && (!toHide.length || toShow.index() < toHide.index()), 5119 animate = this.options.animate || {}, 5120 options = (down && animate.down) || animate, 5121 complete = function () { 5122 that._toggleComplete(data); 5123 }; 5124 5125 if (typeof options === "number") { 5126 duration = options; 5127 } 5128 if (typeof options === "string") { 5129 easing = options; 5130 } 5131 5132 // fall back from options to animation in case of partial down settings 5133 easing = easing || options.easing || animate.easing; 5134 duration = duration || options.duration || animate.duration; 5135 5136 if (!toHide.length) { 5137 return toShow.animate(this.showProps, duration, easing, complete); 5138 } 5139 if (!toShow.length) { 5140 return toHide.animate(this.hideProps, duration, easing, complete); 5141 } 5142 5143 total = toShow.show().outerHeight(); 5144 toHide.animate(this.hideProps, { 5145 duration: duration, 5146 easing: easing, 5147 step: function (now, fx) { 5148 fx.now = Math.round(now); 5149 }, 5150 }); 5151 toShow.hide().animate(this.showProps, { 5152 duration: duration, 5153 easing: easing, 5154 complete: complete, 5155 step: function (now, fx) { 5156 fx.now = Math.round(now); 5157 if (fx.prop !== "height") { 5158 if (boxSizing === "content-box") { 5159 adjust += fx.now; 5160 } 5161 } else if (that.options.heightStyle !== "content") { 5162 fx.now = Math.round(total - toHide.outerHeight() - adjust); 5163 adjust = 0; 5164 } 5165 }, 5166 }); 5167 }, 5168 5169 _toggleComplete: function (data) { 5170 var toHide = data.oldPanel, 5171 prev = toHide.prev(); 5172 5173 this._removeClass(toHide, "ui-accordion-content-active"); 5174 this._removeClass(prev, "ui-accordion-header-active")._addClass( 5175 prev, 5176 "ui-accordion-header-collapsed" 5177 ); 5178 5179 // Work around for rendering bug in IE (#5421) 5180 if (toHide.length) { 5181 toHide.parent()[0].className = toHide.parent()[0].className; 5182 } 5183 this._trigger("activate", null, data); 5184 }, 5185 }); 5186 5187 var safeActiveElement = ($.ui.safeActiveElement = function (document) { 5188 var activeElement; 5189 5190 // Support: IE 9 only 5191 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 5192 try { 5193 activeElement = document.activeElement; 5194 } catch (error) { 5195 activeElement = document.body; 5196 } 5197 5198 // Support: IE 9 - 11 only 5199 // IE may return null instead of an element 5200 // Interestingly, this only seems to occur when NOT in an iframe 5201 if (!activeElement) { 5202 activeElement = document.body; 5203 } 5204 5205 // Support: IE 11 only 5206 // IE11 returns a seemingly empty object in some cases when accessing 5207 // document.activeElement from an <iframe> 5208 if (!activeElement.nodeName) { 5209 activeElement = document.body; 5210 } 5211 5212 return activeElement; 5213 }); 5214 5215 /*! 5216 * jQuery UI Menu 1.13.3 5217 * https://jqueryui.com 5218 * 5219 * Copyright OpenJS Foundation and other contributors 5220 * Released under the MIT license. 5221 * https://jquery.org/license 5222 */ 5223 5224 //>>label: Menu 5225 //>>group: Widgets 5226 //>>description: Creates nestable menus. 5227 //>>docs: https://api.jqueryui.com/menu/ 5228 //>>demos: https://jqueryui.com/menu/ 5229 //>>css.structure: ../../themes/base/core.css 5230 //>>css.structure: ../../themes/base/menu.css 5231 //>>css.theme: ../../themes/base/theme.css 5232 5233 var widgetsMenu = $.widget("ui.menu", { 5234 version: "1.13.3", 5235 defaultElement: "<ul>", 5236 delay: 300, 5237 options: { 5238 icons: { 5239 submenu: "ui-icon-caret-1-e", 5240 }, 5241 items: "> *", 5242 menus: "ul", 5243 position: { 5244 my: "left top", 5245 at: "right top", 5246 }, 5247 role: "menu", 5248 5249 // Callbacks 5250 blur: null, 5251 focus: null, 5252 select: null, 5253 }, 5254 5255 _create: function () { 5256 this.activeMenu = this.element; 5257 5258 // Flag used to prevent firing of the click handler 5259 // as the event bubbles up through nested menus 5260 this.mouseHandled = false; 5261 this.lastMousePosition = { x: null, y: null }; 5262 this.element.uniqueId().attr({ 5263 role: this.options.role, 5264 tabIndex: 0, 5265 }); 5266 5267 this._addClass("ui-menu", "ui-widget ui-widget-content"); 5268 this._on({ 5269 // Prevent focus from sticking to links inside menu after clicking 5270 // them (focus should always stay on UL during navigation). 5271 "mousedown .ui-menu-item": function (event) { 5272 event.preventDefault(); 5273 5274 this._activateItem(event); 5275 }, 5276 "click .ui-menu-item": function (event) { 5277 var target = $(event.target); 5278 var active = $($.ui.safeActiveElement(this.document[0])); 5279 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 5280 this.select(event); 5281 5282 // Only set the mouseHandled flag if the event will bubble, see #9469. 5283 if (!event.isPropagationStopped()) { 5284 this.mouseHandled = true; 5285 } 5286 5287 // Open submenu on click 5288 if (target.has(".ui-menu").length) { 5289 this.expand(event); 5290 } else if ( 5291 !this.element.is(":focus") && 5292 active.closest(".ui-menu").length 5293 ) { 5294 // Redirect focus to the menu 5295 this.element.trigger("focus", [true]); 5296 5297 // If the active item is on the top level, let it stay active. 5298 // Otherwise, blur the active item since it is no longer visible. 5299 if (this.active && this.active.parents(".ui-menu").length === 1) { 5300 clearTimeout(this.timer); 5301 } 5302 } 5303 } 5304 }, 5305 "mouseenter .ui-menu-item": "_activateItem", 5306 "mousemove .ui-menu-item": "_activateItem", 5307 mouseleave: "collapseAll", 5308 "mouseleave .ui-menu": "collapseAll", 5309 focus: function (event, keepActiveItem) { 5310 // If there's already an active item, keep it active 5311 // If not, activate the first item 5312 var item = this.active || this._menuItems().first(); 5313 5314 if (!keepActiveItem) { 5315 this.focus(event, item); 5316 } 5317 }, 5318 blur: function (event) { 5319 this._delay(function () { 5320 var notContained = !$.contains( 5321 this.element[0], 5322 $.ui.safeActiveElement(this.document[0]) 5323 ); 5324 if (notContained) { 5325 this.collapseAll(event); 5326 } 5327 }); 5328 }, 5329 keydown: "_keydown", 5330 }); 5331 5332 this.refresh(); 5333
vendor: 24,069 bytes, lines 5334-6158
5334 // Clicks outside of a menu collapse any open menus 5335 this._on(this.document, { 5336 click: function (event) { 5337 if (this._closeOnDocumentClick(event)) { 5338 this.collapseAll(event, true); 5339 } 5340 5341 // Reset the mouseHandled flag 5342 this.mouseHandled = false; 5343 }, 5344 }); 5345 }, 5346 5347 _activateItem: function (event) { 5348 // Ignore mouse events while typeahead is active, see #10458. 5349 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5350 // is over an item in the menu 5351 if (this.previousFilter) { 5352 return; 5353 } 5354 5355 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 5356 if ( 5357 event.clientX === this.lastMousePosition.x && 5358 event.clientY === this.lastMousePosition.y 5359 ) { 5360 return; 5361 } 5362 5363 this.lastMousePosition = { 5364 x: event.clientX, 5365 y: event.clientY, 5366 }; 5367 5368 var actualTarget = $(event.target).closest(".ui-menu-item"), 5369 target = $(event.currentTarget); 5370 5371 // Ignore bubbled events on parent items, see #11641 5372 if (actualTarget[0] !== target[0]) { 5373 return; 5374 } 5375 5376 // If the item is already active, there's nothing to do 5377 if (target.is(".ui-state-active")) { 5378 return; 5379 } 5380 5381 // Remove ui-state-active class from siblings of the newly focused menu item 5382 // to avoid a jump caused by adjacent elements both having a class with a border 5383 this._removeClass( 5384 target.siblings().children(".ui-state-active"), 5385 null, 5386 "ui-state-active" 5387 ); 5388 this.focus(event, target); 5389 }, 5390 5391 _destroy: function () { 5392 var items = this.element 5393 .find(".ui-menu-item") 5394 .removeAttr("role aria-disabled"), 5395 submenus = items 5396 .children(".ui-menu-item-wrapper") 5397 .removeUniqueId() 5398 .removeAttr("tabIndex role aria-haspopup"); 5399 5400 // Destroy (sub)menus 5401 this.element 5402 .removeAttr("aria-activedescendant") 5403 .find(".ui-menu") 5404 .addBack() 5405 .removeAttr( 5406 "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5407 "tabIndex" 5408 ) 5409 .removeUniqueId() 5410 .show(); 5411 5412 submenus.children().each(function () { 5413 var elem = $(this); 5414 if (elem.data("ui-menu-submenu-caret")) { 5415 elem.remove(); 5416 } 5417 }); 5418 }, 5419 5420 _keydown: function (event) { 5421 var match, 5422 prev, 5423 character, 5424 skip, 5425 preventDefault = true; 5426 5427 switch (event.keyCode) { 5428 case $.ui.keyCode.PAGE_UP: 5429 this.previousPage(event); 5430 break; 5431 case $.ui.keyCode.PAGE_DOWN: 5432 this.nextPage(event); 5433 break; 5434 case $.ui.keyCode.HOME: 5435 this._move("first", "first", event); 5436 break; 5437 case $.ui.keyCode.END: 5438 this._move("last", "last", event); 5439 break; 5440 case $.ui.keyCode.UP: 5441 this.previous(event); 5442 break; 5443 case $.ui.keyCode.DOWN: 5444 this.next(event); 5445 break; 5446 case $.ui.keyCode.LEFT: 5447 this.collapse(event); 5448 break; 5449 case $.ui.keyCode.RIGHT: 5450 if (this.active && !this.active.is(".ui-state-disabled")) { 5451 this.expand(event); 5452 } 5453 break; 5454 case $.ui.keyCode.ENTER: 5455 case $.ui.keyCode.SPACE: 5456 this._activate(event); 5457 break; 5458 case $.ui.keyCode.ESCAPE: 5459 this.collapse(event); 5460 break; 5461 default: 5462 preventDefault = false; 5463 prev = this.previousFilter || ""; 5464 skip = false; 5465 5466 // Support number pad values 5467 character = 5468 event.keyCode >= 96 && event.keyCode <= 105 5469 ? (event.keyCode - 96).toString() 5470 : String.fromCharCode(event.keyCode); 5471 5472 clearTimeout(this.filterTimer); 5473 5474 if (character === prev) { 5475 skip = true; 5476 } else { 5477 character = prev + character; 5478 } 5479 5480 match = this._filterMenuItems(character); 5481 match = 5482 skip && match.index(this.active.next()) !== -1 5483 ? this.active.nextAll(".ui-menu-item") 5484 : match; 5485 5486 // If no matches on the current filter, reset to the last character pressed 5487 // to move down the menu to the first item that starts with that character 5488 if (!match.length) { 5489 character = String.fromCharCode(event.keyCode); 5490 match = this._filterMenuItems(character); 5491 } 5492 5493 if (match.length) { 5494 this.focus(event, match); 5495 this.previousFilter = character; 5496 this.filterTimer = this._delay(function () { 5497 delete this.previousFilter; 5498 }, 1000); 5499 } else { 5500 delete this.previousFilter; 5501 } 5502 } 5503 5504 if (preventDefault) { 5505 event.preventDefault(); 5506 } 5507 }, 5508 5509 _activate: function (event) { 5510 if (this.active && !this.active.is(".ui-state-disabled")) { 5511 if (this.active.children("[aria-haspopup='true']").length) { 5512 this.expand(event); 5513 } else { 5514 this.select(event); 5515 } 5516 } 5517 }, 5518 5519 refresh: function () { 5520 var menus, 5521 items, 5522 newSubmenus, 5523 newItems, 5524 newWrappers, 5525 that = this, 5526 icon = this.options.icons.submenu, 5527 submenus = this.element.find(this.options.menus); 5528 5529 this._toggleClass( 5530 "ui-menu-icons", 5531 null, 5532 !!this.element.find(".ui-icon").length 5533 ); 5534 5535 // Initialize nested menus 5536 newSubmenus = submenus 5537 .filter(":not(.ui-menu)") 5538 .hide() 5539 .attr({ 5540 role: this.options.role, 5541 "aria-hidden": "true", 5542 "aria-expanded": "false", 5543 }) 5544 .each(function () { 5545 var menu = $(this), 5546 item = menu.prev(), 5547 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 5548 5549 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 5550 item.attr("aria-haspopup", "true").prepend(submenuCaret); 5551 menu.attr("aria-labelledby", item.attr("id")); 5552 }); 5553 5554 this._addClass( 5555 newSubmenus, 5556 "ui-menu", 5557 "ui-widget ui-widget-content ui-front" 5558 ); 5559 5560 menus = submenus.add(this.element); 5561 items = menus.find(this.options.items); 5562 5563 // Initialize menu-items containing spaces and/or dashes only as dividers 5564 items.not(".ui-menu-item").each(function () { 5565 var item = $(this); 5566 if (that._isDivider(item)) { 5567 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 5568 } 5569 }); 5570 5571 // Don't refresh list items that are already adapted 5572 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 5573 newWrappers = newItems.children().not(".ui-menu").uniqueId().attr({ 5574 tabIndex: -1, 5575 role: this._itemRole(), 5576 }); 5577 this._addClass(newItems, "ui-menu-item")._addClass( 5578 newWrappers, 5579 "ui-menu-item-wrapper" 5580 ); 5581 5582 // Add aria-disabled attribute to any disabled menu item 5583 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 5584 5585 // If the active item has been removed, blur the menu 5586 if (this.active && !$.contains(this.element[0], this.active[0])) { 5587 this.blur(); 5588 } 5589 }, 5590 5591 _itemRole: function () { 5592 return { 5593 menu: "menuitem", 5594 listbox: "option", 5595 }[this.options.role]; 5596 }, 5597 5598 _setOption: function (key, value) { 5599 if (key === "icons") { 5600 var icons = this.element.find(".ui-menu-icon"); 5601 this._removeClass(icons, null, this.options.icons.submenu)._addClass( 5602 icons, 5603 null, 5604 value.submenu 5605 ); 5606 } 5607 this._super(key, value); 5608 }, 5609 5610 _setOptionDisabled: function (value) { 5611 this._super(value); 5612 5613 this.element.attr("aria-disabled", String(value)); 5614 this._toggleClass(null, "ui-state-disabled", !!value); 5615 }, 5616 5617 focus: function (event, item) { 5618 var nested, focused, activeParent; 5619 this.blur(event, event && event.type === "focus"); 5620 5621 this._scrollIntoView(item); 5622 5623 this.active = item.first(); 5624 5625 focused = this.active.children(".ui-menu-item-wrapper"); 5626 this._addClass(focused, null, "ui-state-active"); 5627 5628 // Only update aria-activedescendant if there's a role 5629 // otherwise we assume focus is managed elsewhere 5630 if (this.options.role) { 5631 this.element.attr("aria-activedescendant", focused.attr("id")); 5632 } 5633 5634 // Highlight active parent menu item, if any 5635 activeParent = this.active 5636 .parent() 5637 .closest(".ui-menu-item") 5638 .children(".ui-menu-item-wrapper"); 5639 this._addClass(activeParent, null, "ui-state-active"); 5640 5641 if (event && event.type === "keydown") { 5642 this._close(); 5643 } else { 5644 this.timer = this._delay(function () { 5645 this._close(); 5646 }, this.delay); 5647 } 5648 5649 nested = item.children(".ui-menu"); 5650 if (nested.length && event && /^mouse/.test(event.type)) { 5651 this._startOpening(nested); 5652 } 5653 this.activeMenu = item.parent(); 5654 5655 this._trigger("focus", event, { item: item }); 5656 }, 5657 5658 _scrollIntoView: function (item) { 5659 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5660 if (this._hasScroll()) { 5661 borderTop = 5662 parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 5663 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 5664 offset = 5665 item.offset().top - 5666 this.activeMenu.offset().top - 5667 borderTop - 5668 paddingTop; 5669 scroll = this.activeMenu.scrollTop(); 5670 elementHeight = this.activeMenu.height(); 5671 itemHeight = item.outerHeight(); 5672 5673 if (offset < 0) { 5674 this.activeMenu.scrollTop(scroll + offset); 5675 } else if (offset + itemHeight > elementHeight) { 5676 this.activeMenu.scrollTop( 5677 scroll + offset - elementHeight + itemHeight 5678 ); 5679 } 5680 } 5681 }, 5682 5683 blur: function (event, fromFocus) { 5684 if (!fromFocus) { 5685 clearTimeout(this.timer); 5686 } 5687 5688 if (!this.active) { 5689 return; 5690 } 5691 5692 this._removeClass( 5693 this.active.children(".ui-menu-item-wrapper"), 5694 null, 5695 "ui-state-active" 5696 ); 5697 5698 this._trigger("blur", event, { item: this.active }); 5699 this.active = null; 5700 }, 5701 5702 _startOpening: function (submenu) { 5703 clearTimeout(this.timer); 5704 5705 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5706 // shift in the submenu position when mousing over the caret icon 5707 if (submenu.attr("aria-hidden") !== "true") { 5708 return; 5709 } 5710 5711 this.timer = this._delay(function () { 5712 this._close(); 5713 this._open(submenu); 5714 }, this.delay); 5715 }, 5716 5717 _open: function (submenu) { 5718 var position = $.extend( 5719 { 5720 of: this.active, 5721 }, 5722 this.options.position 5723 ); 5724 5725 clearTimeout(this.timer); 5726 this.element 5727 .find(".ui-menu") 5728 .not(submenu.parents(".ui-menu")) 5729 .hide() 5730 .attr("aria-hidden", "true"); 5731 5732 submenu 5733 .show() 5734 .removeAttr("aria-hidden") 5735 .attr("aria-expanded", "true") 5736 .position(position); 5737 }, 5738 5739 collapseAll: function (event, all) { 5740 clearTimeout(this.timer); 5741 this.timer = this._delay( 5742 function () { 5743 // If we were passed an event, look for the submenu that contains the event 5744 var currentMenu = all 5745 ? this.element 5746 : $(event && event.target).closest(this.element.find(".ui-menu")); 5747 5748 // If we found no valid submenu ancestor, use the main menu to close all 5749 // sub menus anyway 5750 if (!currentMenu.length) { 5751 currentMenu = this.element; 5752 } 5753 5754 this._close(currentMenu); 5755 5756 this.blur(event); 5757 5758 // Work around active item staying active after menu is blurred 5759 this._removeClass( 5760 currentMenu.find(".ui-state-active"), 5761 null, 5762 "ui-state-active" 5763 ); 5764 5765 this.activeMenu = currentMenu; 5766 }, 5767 all ? 0 : this.delay 5768 ); 5769 }, 5770 5771 // With no arguments, closes the currently active menu - if nothing is active 5772 // it closes all menus. If passed an argument, it will search for menus BELOW 5773 _close: function (startMenu) { 5774 if (!startMenu) { 5775 startMenu = this.active ? this.active.parent() : this.element; 5776 } 5777 5778 startMenu 5779 .find(".ui-menu") 5780 .hide() 5781 .attr("aria-hidden", "true") 5782 .attr("aria-expanded", "false"); 5783 }, 5784 5785 _closeOnDocumentClick: function (event) { 5786 return !$(event.target).closest(".ui-menu").length; 5787 }, 5788 5789 _isDivider: function (item) { 5790 // Match hyphen, em dash, en dash 5791 return !/[^\-\u2014\u2013\s]/.test(item.text()); 5792 }, 5793 5794 collapse: function (event) { 5795 var newItem = 5796 this.active && 5797 this.active.parent().closest(".ui-menu-item", this.element); 5798 if (newItem && newItem.length) { 5799 this._close(); 5800 this.focus(event, newItem); 5801 } 5802 }, 5803 5804 expand: function (event) { 5805 var newItem = 5806 this.active && 5807 this._menuItems(this.active.children(".ui-menu")).first(); 5808 5809 if (newItem && newItem.length) { 5810 this._open(newItem.parent()); 5811 5812 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 5813 this._delay(function () { 5814 this.focus(event, newItem); 5815 }); 5816 } 5817 }, 5818 5819 next: function (event) { 5820 this._move("next", "first", event); 5821 }, 5822 5823 previous: function (event) { 5824 this._move("prev", "last", event); 5825 }, 5826 5827 isFirstItem: function () { 5828 return this.active && !this.active.prevAll(".ui-menu-item").length; 5829 }, 5830 5831 isLastItem: function () { 5832 return this.active && !this.active.nextAll(".ui-menu-item").length; 5833 }, 5834 5835 _menuItems: function (menu) { 5836 return (menu || this.element) 5837 .find(this.options.items) 5838 .filter(".ui-menu-item"); 5839 }, 5840 5841 _move: function (direction, filter, event) { 5842 var next; 5843 if (this.active) { 5844 if (direction === "first" || direction === "last") { 5845 next = 5846 this.active[direction === "first" ? "prevAll" : "nextAll"]( 5847 ".ui-menu-item" 5848 ).last(); 5849 } else { 5850 next = this.active[direction + "All"](".ui-menu-item").first(); 5851 } 5852 } 5853 if (!next || !next.length || !this.active) { 5854 next = this._menuItems(this.activeMenu)[filter](); 5855 } 5856 5857 this.focus(event, next); 5858 }, 5859 5860 nextPage: function (event) { 5861 var item, base, height; 5862 5863 if (!this.active) { 5864 this.next(event); 5865 return; 5866 } 5867 if (this.isLastItem()) { 5868 return; 5869 } 5870 if (this._hasScroll()) { 5871 base = this.active.offset().top; 5872 height = this.element.innerHeight(); 5873 5874 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 5875 if ($.fn.jquery.indexOf("3.2.") === 0) { 5876 height += this.element[0].offsetHeight - this.element.outerHeight(); 5877 } 5878 5879 this.active.nextAll(".ui-menu-item").each(function () { 5880 item = $(this); 5881 return item.offset().top - base - height < 0; 5882 }); 5883 5884 this.focus(event, item); 5885 } else { 5886 this.focus( 5887 event, 5888 this._menuItems(this.activeMenu)[!this.active ? "first" : "last"]() 5889 ); 5890 } 5891 }, 5892 5893 previousPage: function (event) { 5894 var item, base, height; 5895 if (!this.active) { 5896 this.next(event); 5897 return; 5898 } 5899 if (this.isFirstItem()) { 5900 return; 5901 } 5902 if (this._hasScroll()) { 5903 base = this.active.offset().top; 5904 height = this.element.innerHeight(); 5905 5906 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 5907 if ($.fn.jquery.indexOf("3.2.") === 0) { 5908 height += this.element[0].offsetHeight - this.element.outerHeight(); 5909 } 5910 5911 this.active.prevAll(".ui-menu-item").each(function () { 5912 item = $(this); 5913 return item.offset().top - base + height > 0; 5914 }); 5915 5916 this.focus(event, item); 5917 } else { 5918 this.focus(event, this._menuItems(this.activeMenu).first()); 5919 } 5920 }, 5921 5922 _hasScroll: function () { 5923 return this.element.outerHeight() < this.element.prop("scrollHeight"); 5924 }, 5925 5926 select: function (event) { 5927 // TODO: It should never be possible to not have an active item at this 5928 // point, but the tests don't trigger mouseenter before click. 5929 this.active = this.active || $(event.target).closest(".ui-menu-item"); 5930 var ui = { item: this.active }; 5931 if (!this.active.has(".ui-menu").length) { 5932 this.collapseAll(event, true); 5933 } 5934 this._trigger("select", event, ui); 5935 }, 5936 5937 _filterMenuItems: function (character) { 5938 var escapedCharacter = character.replace( 5939 /[\-\[\]{}()*+?.,\\\^$|#\s]/g, 5940 "\\$&" 5941 ), 5942 regex = new RegExp("^" + escapedCharacter, "i"); 5943 5944 return ( 5945 this.activeMenu 5946 .find(this.options.items) 5947 5948 // Only match on items, not dividers or other content (#10571) 5949 .filter(".ui-menu-item") 5950 .filter(function () { 5951 return regex.test( 5952 String.prototype.trim.call( 5953 $(this).children(".ui-menu-item-wrapper").text() 5954 ) 5955 ); 5956 }) 5957 ); 5958 }, 5959 }); 5960 5961 /*! 5962 * jQuery UI Autocomplete 1.13.3 5963 * https://jqueryui.com 5964 * 5965 * Copyright OpenJS Foundation and other contributors 5966 * Released under the MIT license. 5967 * https://jquery.org/license 5968 */ 5969 5970 //>>label: Autocomplete 5971 //>>group: Widgets 5972 //>>description: Lists suggested words as the user is typing. 5973 //>>docs: https://api.jqueryui.com/autocomplete/ 5974 //>>demos: https://jqueryui.com/autocomplete/ 5975 //>>css.structure: ../../themes/base/core.css 5976 //>>css.structure: ../../themes/base/autocomplete.css 5977 //>>css.theme: ../../themes/base/theme.css 5978 5979 $.widget("ui.autocomplete", { 5980 version: "1.13.3", 5981 defaultElement: "<input>", 5982 options: { 5983 appendTo: null, 5984 autoFocus: false, 5985 delay: 300, 5986 minLength: 1, 5987 position: { 5988 my: "left top", 5989 at: "left bottom", 5990 collision: "none", 5991 }, 5992 source: null, 5993 5994 // Callbacks 5995 change: null, 5996 close: null, 5997 focus: null, 5998 open: null, 5999 response: null, 6000 search: null, 6001 select: null, 6002 }, 6003 6004 requestIndex: 0, 6005 pending: 0, 6006 liveRegionTimer: null, 6007 6008 _create: function () { 6009 // Some browsers only repeat keydown events, not keypress events, 6010 // so we use the suppressKeyPress flag to determine if we've already 6011 // handled the keydown event. #7269 6012 // Unfortunately the code for & in keypress is the same as the up arrow, 6013 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 6014 // events when we know the keydown event was used to modify the 6015 // search term. #7799 6016 var suppressKeyPress, 6017 suppressKeyPressRepeat, 6018 suppressInput, 6019 nodeName = this.element[0].nodeName.toLowerCase(), 6020 isTextarea = nodeName === "textarea", 6021 isInput = nodeName === "input"; 6022 6023 // Textareas are always multi-line 6024 // Inputs are always single-line, even if inside a contentEditable element 6025 // IE also treats inputs as contentEditable 6026 // All other element types are determined by whether or not they're contentEditable 6027 this.isMultiLine = 6028 isTextarea || (!isInput && this._isContentEditable(this.element)); 6029 6030 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 6031 this.isNewMenu = true; 6032 6033 this._addClass("ui-autocomplete-input"); 6034 this.element.attr("autocomplete", "off"); 6035 6036 this._on(this.element, { 6037 keydown: function (event) { 6038 if (this.element.prop("readOnly")) { 6039 suppressKeyPress = true; 6040 suppressInput = true; 6041 suppressKeyPressRepeat = true; 6042 return; 6043 } 6044 6045 suppressKeyPress = false; 6046 suppressInput = false; 6047 suppressKeyPressRepeat = false; 6048 var keyCode = $.ui.keyCode; 6049 switch (event.keyCode) { 6050 case keyCode.PAGE_UP: 6051 suppressKeyPress = true; 6052 this._move("previousPage", event); 6053 break; 6054 case keyCode.PAGE_DOWN: 6055 suppressKeyPress = true; 6056 this._move("nextPage", event); 6057 break; 6058 case keyCode.UP: 6059 suppressKeyPress = true; 6060 this._keyEvent("previous", event); 6061 break; 6062 case keyCode.DOWN: 6063 suppressKeyPress = true; 6064 this._keyEvent("next", event); 6065 break; 6066 case keyCode.ENTER: 6067 // when menu is open and has focus 6068 if (this.menu.active) { 6069 // #6055 - Opera still allows the keypress to occur 6070 // which causes forms to submit 6071 suppressKeyPress = true; 6072 event.preventDefault(); 6073 this.menu.select(event); 6074 } 6075 break; 6076 case keyCode.TAB: 6077 if (this.menu.active) { 6078 this.menu.select(event); 6079 } 6080 break; 6081 case keyCode.ESCAPE: 6082 if (this.menu.element.is(":visible")) { 6083 if (!this.isMultiLine) { 6084 this._value(this.term); 6085 } 6086 this.close(event); 6087 6088 // Different browsers have different default behavior for escape 6089 // Single press can mean undo or clear 6090 // Double press in IE means clear the whole form 6091 event.preventDefault(); 6092 } 6093 break; 6094 default: 6095 suppressKeyPressRepeat = true; 6096 6097 // search timeout should be triggered before the input value is changed 6098 this._searchTimeout(event); 6099 break; 6100 } 6101 }, 6102 keypress: function (event) { 6103 if (suppressKeyPress) { 6104 suppressKeyPress = false; 6105 if (!this.isMultiLine || this.menu.element.is(":visible")) { 6106 event.preventDefault(); 6107 } 6108 return; 6109 } 6110 if (suppressKeyPressRepeat) { 6111 return; 6112 } 6113 6114 // Replicate some key handlers to allow them to repeat in Firefox and Opera 6115 var keyCode = $.ui.keyCode; 6116 switch (event.keyCode) { 6117 case keyCode.PAGE_UP: 6118 this._move("previousPage", event); 6119 break; 6120 case keyCode.PAGE_DOWN: 6121 this._move("nextPage", event); 6122 break; 6123 case keyCode.UP: 6124 this._keyEvent("previous", event); 6125 break; 6126 case keyCode.DOWN: 6127 this._keyEvent("next", event); 6128 break; 6129 } 6130 }, 6131 input: function (event) { 6132 if (suppressInput) { 6133 suppressInput = false; 6134 event.preventDefault(); 6135 return; 6136 } 6137 this._searchTimeout(event); 6138 }, 6139 focus: function () { 6140 this.selectedItem = null; 6141 this.previous = this._value(); 6142 }, 6143 blur: function (event) { 6144 clearTimeout(this.searching); 6145 this.close(event); 6146 this._change(event); 6147 }, 6148 }); 6149 6150 this._initSource(); 6151 this.menu = $("<ul>") 6152 .appendTo(this._appendTo()) 6153 .menu({ 6154 // disable ARIA support, the live region takes care of that 6155 role: null, 6156 }) 6157 .hide() 6158
vendor: 6,253 bytes, lines 6159-6355
6159 // Support: IE 11 only, Edge <= 14 6160 // For other browsers, we preventDefault() on the mousedown event 6161 // to keep the dropdown from taking focus from the input. This doesn't 6162 // work for IE/Edge, causing problems with selection and scrolling (#9638) 6163 // Happily, IE and Edge support an "unselectable" attribute that 6164 // prevents an element from receiving focus, exactly what we want here. 6165 .attr({ 6166 unselectable: "on", 6167 }) 6168 .menu("instance"); 6169 6170 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 6171 this._on(this.menu.element, { 6172 mousedown: function (event) { 6173 // Prevent moving focus out of the text field 6174 event.preventDefault(); 6175 }, 6176 menufocus: function (event, ui) { 6177 var label, item; 6178 6179 // support: Firefox 6180 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 6181 if (this.isNewMenu) { 6182 this.isNewMenu = false; 6183 if ( 6184 event.originalEvent && 6185 /^mouse/.test(event.originalEvent.type) 6186 ) { 6187 this.menu.blur(); 6188 6189 this.document.one("mousemove", function () { 6190 $(event.target).trigger(event.originalEvent); 6191 }); 6192 6193 return; 6194 } 6195 } 6196 6197 item = ui.item.data("ui-autocomplete-item"); 6198 if (false !== this._trigger("focus", event, { item: item })) { 6199 // use value to match what will end up in the input, if it was a key event 6200 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 6201 this._value(item.value); 6202 } 6203 } 6204 6205 // Announce the value in the liveRegion 6206 label = ui.item.attr("aria-label") || item.value; 6207 if (label && String.prototype.trim.call(label).length) { 6208 clearTimeout(this.liveRegionTimer); 6209 this.liveRegionTimer = this._delay(function () { 6210 this.liveRegion.html($("<div>").text(label)); 6211 }, 100); 6212 } 6213 }, 6214 menuselect: function (event, ui) { 6215 var item = ui.item.data("ui-autocomplete-item"), 6216 previous = this.previous; 6217 6218 // Only trigger when focus was lost (click on menu) 6219 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 6220 this.element.trigger("focus"); 6221 this.previous = previous; 6222 6223 // #6109 - IE triggers two focus events and the second 6224 // is asynchronous, so we need to reset the previous 6225 // term synchronously and asynchronously :-( 6226 this._delay(function () { 6227 this.previous = previous; 6228 this.selectedItem = item; 6229 }); 6230 } 6231 6232 if (false !== this._trigger("select", event, { item: item })) { 6233 this._value(item.value); 6234 } 6235 6236 // reset the term after the select event 6237 // this allows custom select handling to work properly 6238 this.term = this._value(); 6239 6240 this.close(event); 6241 this.selectedItem = item; 6242 }, 6243 }); 6244 6245 this.liveRegion = $("<div>", { 6246 role: "status", 6247 "aria-live": "assertive", 6248 "aria-relevant": "additions", 6249 }).appendTo(this.document[0].body); 6250 6251 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 6252 6253 // Turning off autocomplete prevents the browser from remembering the 6254 // value when navigating through history, so we re-enable autocomplete 6255 // if the page is unloaded before the widget is destroyed. #7790 6256 this._on(this.window, { 6257 beforeunload: function () { 6258 this.element.removeAttr("autocomplete"); 6259 }, 6260 }); 6261 }, 6262 6263 _destroy: function () { 6264 clearTimeout(this.searching); 6265 this.element.removeAttr("autocomplete"); 6266 this.menu.element.remove(); 6267 this.liveRegion.remove(); 6268 }, 6269 6270 _setOption: function (key, value) { 6271 this._super(key, value); 6272 if (key === "source") { 6273 this._initSource(); 6274 } 6275 if (key === "appendTo") { 6276 this.menu.element.appendTo(this._appendTo()); 6277 } 6278 if (key === "disabled" && value && this.xhr) { 6279 this.xhr.abort(); 6280 } 6281 }, 6282 6283 _isEventTargetInWidget: function (event) { 6284 var menuElement = this.menu.element[0]; 6285 6286 return ( 6287 event.target === this.element[0] || 6288 event.target === menuElement || 6289 $.contains(menuElement, event.target) 6290 ); 6291 }, 6292 6293 _closeOnClickOutside: function (event) { 6294 if (!this._isEventTargetInWidget(event)) { 6295 this.close(); 6296 } 6297 }, 6298 6299 _appendTo: function () { 6300 var element = this.options.appendTo; 6301 6302 if (element) { 6303 element = 6304 element.jquery || element.nodeType 6305 ? $(element) 6306 : this.document.find(element).eq(0); 6307 } 6308 6309 if (!element || !element[0]) { 6310 element = this.element.closest(".ui-front, dialog"); 6311 } 6312 6313 if (!element.length) { 6314 element = this.document[0].body; 6315 } 6316 6317 return element; 6318 }, 6319 6320 _initSource: function () { 6321 var array, 6322 url, 6323 that = this; 6324 if (Array.isArray(this.options.source)) { 6325 array = this.options.source; 6326 this.source = function (request, response) { 6327 response($.ui.autocomplete.filter(array, request.term)); 6328 }; 6329 } else if (typeof this.options.source === "string") { 6330 url = this.options.source; 6331 this.source = function (request, response) { 6332 if (that.xhr) { 6333 that.xhr.abort(); 6334 } 6335 that.xhr = $.ajax({ 6336 url: url, 6337 data: request, 6338 dataType: "json", 6339 success: function (data) { 6340 response(data); 6341 }, 6342 error: function () { 6343 response([]); 6344 }, 6345 }); 6346 }; 6347 } else { 6348 this.source = this.options.source; 6349 } 6350 }, 6351 6352 _searchTimeout: function (event) { 6353 clearTimeout(this.searching); 6354 this.searching = this._delay(function () { 6355 // Search if the value has changed, or if the user retypes the same value (see #7434)
vendor: 5,255 bytes, lines 6356-6559
6356 var equalValues = this.term === this._value(), 6357 menuVisible = this.menu.element.is(":visible"), 6358 modifierKey = 6359 event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 6360 6361 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 6362 this.selectedItem = null; 6363 this.search(null, event); 6364 } 6365 }, this.options.delay); 6366 }, 6367 6368 search: function (value, event) { 6369 value = value != null ? value : this._value(); 6370 6371 // Always save the actual value, not the one passed as an argument 6372 this.term = this._value(); 6373 6374 if (value.length < this.options.minLength) { 6375 return this.close(event); 6376 } 6377 6378 if (this._trigger("search", event) === false) { 6379 return; 6380 } 6381 6382 return this._search(value); 6383 }, 6384 6385 _search: function (value) { 6386 this.pending++; 6387 this._addClass("ui-autocomplete-loading"); 6388 this.cancelSearch = false; 6389 6390 this.source({ term: value }, this._response()); 6391 }, 6392 6393 _response: function () { 6394 var index = ++this.requestIndex; 6395 6396 return function (content) { 6397 if (index === this.requestIndex) { 6398 this.__response(content); 6399 } 6400 6401 this.pending--; 6402 if (!this.pending) { 6403 this._removeClass("ui-autocomplete-loading"); 6404 } 6405 }.bind(this); 6406 }, 6407 6408 __response: function (content) { 6409 if (content) { 6410 content = this._normalize(content); 6411 } 6412 this._trigger("response", null, { content: content }); 6413 if ( 6414 !this.options.disabled && 6415 content && 6416 content.length && 6417 !this.cancelSearch 6418 ) { 6419 this._suggest(content); 6420 this._trigger("open"); 6421 } else { 6422 // use ._close() instead of .close() so we don't cancel future searches 6423 this._close(); 6424 } 6425 }, 6426 6427 close: function (event) { 6428 this.cancelSearch = true; 6429 this._close(event); 6430 }, 6431 6432 _close: function (event) { 6433 // Remove the handler that closes the menu on outside clicks 6434 this._off(this.document, "mousedown"); 6435 6436 if (this.menu.element.is(":visible")) { 6437 this.menu.element.hide(); 6438 this.menu.blur(); 6439 this.isNewMenu = true; 6440 this._trigger("close", event); 6441 } 6442 }, 6443 6444 _change: function (event) { 6445 if (this.previous !== this._value()) { 6446 this._trigger("change", event, { item: this.selectedItem }); 6447 } 6448 }, 6449 6450 _normalize: function (items) { 6451 // assume all items have the right format when the first item is complete 6452 if (items.length && items[0].label && items[0].value) { 6453 return items; 6454 } 6455 return $.map(items, function (item) { 6456 if (typeof item === "string") { 6457 return { 6458 label: item, 6459 value: item, 6460 }; 6461 } 6462 return $.extend({}, item, { 6463 label: item.label || item.value, 6464 value: item.value || item.label, 6465 }); 6466 }); 6467 }, 6468 6469 _suggest: function (items) { 6470 var ul = this.menu.element.empty(); 6471 this._renderMenu(ul, items); 6472 this.isNewMenu = true; 6473 this.menu.refresh(); 6474 6475 // Size and position menu 6476 ul.show(); 6477 this._resizeMenu(); 6478 ul.position( 6479 $.extend( 6480 { 6481 of: this.element, 6482 }, 6483 this.options.position 6484 ) 6485 ); 6486 6487 if (this.options.autoFocus) { 6488 this.menu.next(); 6489 } 6490 6491 // Listen for interactions outside of the widget (#6642) 6492 this._on(this.document, { 6493 mousedown: "_closeOnClickOutside", 6494 }); 6495 }, 6496 6497 _resizeMenu: function () { 6498 var ul = this.menu.element; 6499 ul.outerWidth( 6500 Math.max( 6501 // Firefox wraps long text (possibly a rounding bug) 6502 // so we add 1px to avoid the wrapping (#7513) 6503 ul.width("").outerWidth() + 1, 6504 this.element.outerWidth() 6505 ) 6506 ); 6507 }, 6508 6509 _renderMenu: function (ul, items) { 6510 var that = this; 6511 $.each(items, function (index, item) { 6512 that._renderItemData(ul, item); 6513 }); 6514 }, 6515 6516 _renderItemData: function (ul, item) { 6517 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 6518 }, 6519 6520 _renderItem: function (ul, item) { 6521 return $("<li>").append($("<div>").text(item.label)).appendTo(ul); 6522 }, 6523 6524 _move: function (direction, event) { 6525 if (!this.menu.element.is(":visible")) { 6526 this.search(null, event); 6527 return; 6528 } 6529 if ( 6530 (this.menu.isFirstItem() && /^previous/.test(direction)) || 6531 (this.menu.isLastItem() && /^next/.test(direction)) 6532 ) { 6533 if (!this.isMultiLine) { 6534 this._value(this.term); 6535 } 6536 6537 this.menu.blur(); 6538 return; 6539 } 6540 this.menu[direction](event); 6541 }, 6542 6543 widget: function () { 6544 return this.menu.element; 6545 }, 6546 6547 _value: function () { 6548 return this.valueMethod.apply(this.element, arguments); 6549 }, 6550 6551 _keyEvent: function (keyEvent, event) { 6552 if (!this.isMultiLine || this.menu.element.is(":visible")) { 6553 this._move(keyEvent, event); 6554 6555 // Prevents moving cursor to beginning/end of the text field in some browsers 6556 event.preventDefault(); 6557 } 6558 }, 6559
vendor: 4,962 bytes, lines 6560-6727
6560 // Support: Chrome <=50 6561 // We should be able to just use this.element.prop( "isContentEditable" ) 6562 // but hidden elements always report false in Chrome. 6563 // https://code.google.com/p/chromium/issues/detail?id=313082 6564 _isContentEditable: function (element) { 6565 if (!element.length) { 6566 return false; 6567 } 6568 6569 var editable = element.prop("contentEditable"); 6570 6571 if (editable === "inherit") { 6572 return this._isContentEditable(element.parent()); 6573 } 6574 6575 return editable === "true"; 6576 }, 6577 }); 6578 6579 $.extend($.ui.autocomplete, { 6580 escapeRegex: function (value) { 6581 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 6582 }, 6583 filter: function (array, term) { 6584 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 6585 return $.grep(array, function (value) { 6586 return matcher.test(value.label || value.value || value); 6587 }); 6588 }, 6589 }); 6590 6591 // Live region extension, adding a `messages` option 6592 // NOTE: This is an experimental API. We are still investigating 6593 // a full solution for string manipulation and internationalization. 6594 $.widget("ui.autocomplete", $.ui.autocomplete, { 6595 options: { 6596 messages: { 6597 noResults: "No search results.", 6598 results: function (amount) { 6599 return ( 6600 amount + 6601 (amount > 1 ? " results are" : " result is") + 6602 " available, use up and down arrow keys to navigate." 6603 ); 6604 }, 6605 }, 6606 }, 6607 6608 __response: function (content) { 6609 var message; 6610 this._superApply(arguments); 6611 if (this.options.disabled || this.cancelSearch) { 6612 return; 6613 } 6614 if (content && content.length) { 6615 message = this.options.messages.results(content.length); 6616 } else { 6617 message = this.options.messages.noResults; 6618 } 6619 clearTimeout(this.liveRegionTimer); 6620 this.liveRegionTimer = this._delay(function () { 6621 this.liveRegion.html($("<div>").text(message)); 6622 }, 100); 6623 }, 6624 }); 6625 6626 var widgetsAutocomplete = $.ui.autocomplete; 6627 6628 /*! 6629 * jQuery UI Controlgroup 1.13.3 6630 * https://jqueryui.com 6631 * 6632 * Copyright OpenJS Foundation and other contributors 6633 * Released under the MIT license. 6634 * https://jquery.org/license 6635 */ 6636 6637 //>>label: Controlgroup 6638 //>>group: Widgets 6639 //>>description: Visually groups form control widgets 6640 //>>docs: https://api.jqueryui.com/controlgroup/ 6641 //>>demos: https://jqueryui.com/controlgroup/ 6642 //>>css.structure: ../../themes/base/core.css 6643 //>>css.structure: ../../themes/base/controlgroup.css 6644 //>>css.theme: ../../themes/base/theme.css 6645 6646 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6647 6648 var widgetsControlgroup = $.widget("ui.controlgroup", { 6649 version: "1.13.3", 6650 defaultElement: "<div>", 6651 options: { 6652 direction: "horizontal", 6653 disabled: null, 6654 onlyVisible: true, 6655 items: { 6656 button: 6657 "input[type=button], input[type=submit], input[type=reset], button, a", 6658 controlgroupLabel: ".ui-controlgroup-label", 6659 checkboxradio: "input[type='checkbox'], input[type='radio']", 6660 selectmenu: "select", 6661 spinner: ".ui-spinner-input", 6662 }, 6663 }, 6664 6665 _create: function () { 6666 this._enhance(); 6667 }, 6668 6669 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6670 _enhance: function () { 6671 this.element.attr("role", "toolbar"); 6672 this.refresh(); 6673 }, 6674 6675 _destroy: function () { 6676 this._callChildMethod("destroy"); 6677 this.childWidgets.removeData("ui-controlgroup-data"); 6678 this.element.removeAttr("role"); 6679 if (this.options.items.controlgroupLabel) { 6680 this.element 6681 .find(this.options.items.controlgroupLabel) 6682 .find(".ui-controlgroup-label-contents") 6683 .contents() 6684 .unwrap(); 6685 } 6686 }, 6687 6688 _initWidgets: function () { 6689 var that = this, 6690 childWidgets = []; 6691 6692 // First we iterate over each of the items options 6693 $.each(this.options.items, function (widget, selector) { 6694 var labels; 6695 var options = {}; 6696 6697 // Make sure the widget has a selector set 6698 if (!selector) { 6699 return; 6700 } 6701 6702 if (widget === "controlgroupLabel") { 6703 labels = that.element.find(selector); 6704 labels.each(function () { 6705 var element = $(this); 6706 6707 if (element.children(".ui-controlgroup-label-contents").length) { 6708 return; 6709 } 6710 element 6711 .contents() 6712 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 6713 }); 6714 that._addClass( 6715 labels, 6716 null, 6717 "ui-widget ui-widget-content ui-state-default" 6718 ); 6719 childWidgets = childWidgets.concat(labels.get()); 6720 return; 6721 } 6722 6723 // Make sure the widget actually exists 6724 if (!$.fn[widget]) { 6725 return; 6726 } 6727
vendor: 9,634 bytes, lines 6728-7026
6728 // We assume everything is in the middle to start because we can't determine 6729 // first / last elements until all enhancments are done. 6730 if (that["_" + widget + "Options"]) { 6731 options = that["_" + widget + "Options"]("middle"); 6732 } else { 6733 options = { classes: {} }; 6734 } 6735 6736 // Find instances of this widget inside controlgroup and init them 6737 that.element.find(selector).each(function () { 6738 var element = $(this); 6739 var instance = element[widget]("instance"); 6740 6741 // We need to clone the default options for this type of widget to avoid 6742 // polluting the variable options which has a wider scope than a single widget. 6743 var instanceOptions = $.widget.extend({}, options); 6744 6745 // If the button is the child of a spinner ignore it 6746 // TODO: Find a more generic solution 6747 if (widget === "button" && element.parent(".ui-spinner").length) { 6748 return; 6749 } 6750 6751 // Create the widget if it doesn't exist 6752 if (!instance) { 6753 instance = element[widget]()[widget]("instance"); 6754 } 6755 if (instance) { 6756 instanceOptions.classes = that._resolveClassesValues( 6757 instanceOptions.classes, 6758 instance 6759 ); 6760 } 6761 element[widget](instanceOptions); 6762 6763 // Store an instance of the controlgroup to be able to reference 6764 // from the outermost element for changing options and refresh 6765 var widgetElement = element[widget]("widget"); 6766 $.data( 6767 widgetElement[0], 6768 "ui-controlgroup-data", 6769 instance ? instance : element[widget]("instance") 6770 ); 6771 6772 childWidgets.push(widgetElement[0]); 6773 }); 6774 }); 6775 6776 this.childWidgets = $($.uniqueSort(childWidgets)); 6777 this._addClass(this.childWidgets, "ui-controlgroup-item"); 6778 }, 6779 6780 _callChildMethod: function (method) { 6781 this.childWidgets.each(function () { 6782 var element = $(this), 6783 data = element.data("ui-controlgroup-data"); 6784 if (data && data[method]) { 6785 data[method](); 6786 } 6787 }); 6788 }, 6789 6790 _updateCornerClass: function (element, position) { 6791 var remove = 6792 "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6793 var add = this._buildSimpleOptions(position, "label").classes.label; 6794 6795 this._removeClass(element, null, remove); 6796 this._addClass(element, null, add); 6797 }, 6798 6799 _buildSimpleOptions: function (position, key) { 6800 var direction = this.options.direction === "vertical"; 6801 var result = { 6802 classes: {}, 6803 }; 6804 result.classes[key] = { 6805 middle: "", 6806 first: "ui-corner-" + (direction ? "top" : "left"), 6807 last: "ui-corner-" + (direction ? "bottom" : "right"), 6808 only: "ui-corner-all", 6809 }[position]; 6810 6811 return result; 6812 }, 6813 6814 _spinnerOptions: function (position) { 6815 var options = this._buildSimpleOptions(position, "ui-spinner"); 6816 6817 options.classes["ui-spinner-up"] = ""; 6818 options.classes["ui-spinner-down"] = ""; 6819 6820 return options; 6821 }, 6822 6823 _buttonOptions: function (position) { 6824 return this._buildSimpleOptions(position, "ui-button"); 6825 }, 6826 6827 _checkboxradioOptions: function (position) { 6828 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 6829 }, 6830 6831 _selectmenuOptions: function (position) { 6832 var direction = this.options.direction === "vertical"; 6833 return { 6834 width: direction ? "auto" : false, 6835 classes: { 6836 middle: { 6837 "ui-selectmenu-button-open": "", 6838 "ui-selectmenu-button-closed": "", 6839 }, 6840 first: { 6841 "ui-selectmenu-button-open": 6842 "ui-corner-" + (direction ? "top" : "tl"), 6843 "ui-selectmenu-button-closed": 6844 "ui-corner-" + (direction ? "top" : "left"), 6845 }, 6846 last: { 6847 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 6848 "ui-selectmenu-button-closed": 6849 "ui-corner-" + (direction ? "bottom" : "right"), 6850 }, 6851 only: { 6852 "ui-selectmenu-button-open": "ui-corner-top", 6853 "ui-selectmenu-button-closed": "ui-corner-all", 6854 }, 6855 }[position], 6856 }; 6857 }, 6858 6859 _resolveClassesValues: function (classes, instance) { 6860 var result = {}; 6861 $.each(classes, function (key) { 6862 var current = instance.options.classes[key] || ""; 6863 current = String.prototype.trim.call( 6864 current.replace(controlgroupCornerRegex, "") 6865 ); 6866 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 6867 }); 6868 return result; 6869 }, 6870 6871 _setOption: function (key, value) { 6872 if (key === "direction") { 6873 this._removeClass("ui-controlgroup-" + this.options.direction); 6874 } 6875 6876 this._super(key, value); 6877 if (key === "disabled") { 6878 this._callChildMethod(value ? "disable" : "enable"); 6879 return; 6880 } 6881 6882 this.refresh(); 6883 }, 6884 6885 refresh: function () { 6886 var children, 6887 that = this; 6888 6889 this._addClass( 6890 "ui-controlgroup ui-controlgroup-" + this.options.direction 6891 ); 6892 6893 if (this.options.direction === "horizontal") { 6894 this._addClass(null, "ui-helper-clearfix"); 6895 } 6896 this._initWidgets(); 6897 6898 children = this.childWidgets; 6899 6900 // We filter here because we need to track all childWidgets not just the visible ones 6901 if (this.options.onlyVisible) { 6902 children = children.filter(":visible"); 6903 } 6904 6905 if (children.length) { 6906 // We do this last because we need to make sure all enhancment is done 6907 // before determining first and last 6908 $.each(["first", "last"], function (index, value) { 6909 var instance = children[value]().data("ui-controlgroup-data"); 6910 6911 if (instance && that["_" + instance.widgetName + "Options"]) { 6912 var options = that["_" + instance.widgetName + "Options"]( 6913 children.length === 1 ? "only" : value 6914 ); 6915 options.classes = that._resolveClassesValues( 6916 options.classes, 6917 instance 6918 ); 6919 instance.element[instance.widgetName](options); 6920 } else { 6921 that._updateCornerClass(children[value](), value); 6922 } 6923 }); 6924 6925 // Finally call the refresh method on each of the child widgets. 6926 this._callChildMethod("refresh"); 6927 } 6928 }, 6929 }); 6930 6931 /*! 6932 * jQuery UI Checkboxradio 1.13.3 6933 * https://jqueryui.com 6934 * 6935 * Copyright OpenJS Foundation and other contributors 6936 * Released under the MIT license. 6937 * https://jquery.org/license 6938 */ 6939 6940 //>>label: Checkboxradio 6941 //>>group: Widgets 6942 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 6943 //>>docs: https://api.jqueryui.com/checkboxradio/ 6944 //>>demos: https://jqueryui.com/checkboxradio/ 6945 //>>css.structure: ../../themes/base/core.css 6946 //>>css.structure: ../../themes/base/button.css 6947 //>>css.structure: ../../themes/base/checkboxradio.css 6948 //>>css.theme: ../../themes/base/theme.css 6949 6950 $.widget("ui.checkboxradio", [ 6951 $.ui.formResetMixin, 6952 { 6953 version: "1.13.3", 6954 options: { 6955 disabled: null, 6956 label: null, 6957 icon: true, 6958 classes: { 6959 "ui-checkboxradio-label": "ui-corner-all", 6960 "ui-checkboxradio-icon": "ui-corner-all", 6961 }, 6962 }, 6963 6964 _getCreateOptions: function () { 6965 var disabled, labels, labelContents; 6966 var options = this._super() || {}; 6967 6968 // We read the type here, because it makes more sense to throw a element type error first, 6969 // rather then the error for lack of a label. Often if its the wrong type, it 6970 // won't have a label (e.g. calling on a div, btn, etc) 6971 this._readType(); 6972 6973 labels = this.element.labels(); 6974 6975 // If there are multiple labels, use the last one 6976 this.label = $(labels[labels.length - 1]); 6977 if (!this.label.length) { 6978 $.error("No label found for checkboxradio widget"); 6979 } 6980 6981 this.originalLabel = ""; 6982 6983 // We need to get the label text but this may also need to make sure it does not contain the 6984 // input itself. 6985 // The label contents could be text, html, or a mix. We wrap all elements 6986 // and read the wrapper's `innerHTML` to get a string representation of 6987 // the label, without the input as part of it. 6988 labelContents = this.label.contents().not(this.element[0]); 6989 6990 if (labelContents.length) { 6991 this.originalLabel += labelContents 6992 .clone() 6993 .wrapAll("<div></div>") 6994 .parent() 6995 .html(); 6996 } 6997 6998 // Set the label option if we found label text 6999 if (this.originalLabel) { 7000 options.label = this.originalLabel; 7001 } 7002 7003 disabled = this.element[0].disabled; 7004 if (disabled != null) { 7005 options.disabled = disabled; 7006 } 7007 return options; 7008 }, 7009 7010 _create: function () { 7011 var checked = this.element[0].checked; 7012 7013 this._bindFormResetHandler(); 7014 7015 if (this.options.disabled == null) { 7016 this.options.disabled = this.element[0].disabled; 7017 } 7018 7019 this._setOption("disabled", this.options.disabled); 7020 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 7021 this._addClass( 7022 this.label, 7023 "ui-checkboxradio-label", 7024 "ui-button ui-widget" 7025 ); 7026
vendor: 3,910 bytes, lines 7027-7171
7027 if (this.type === "radio") { 7028 this._addClass(this.label, "ui-checkboxradio-radio-label"); 7029 } 7030 7031 if (this.options.label && this.options.label !== this.originalLabel) { 7032 this._updateLabel(); 7033 } else if (this.originalLabel) { 7034 this.options.label = this.originalLabel; 7035 } 7036 7037 this._enhance(); 7038 7039 if (checked) { 7040 this._addClass( 7041 this.label, 7042 "ui-checkboxradio-checked", 7043 "ui-state-active" 7044 ); 7045 } 7046 7047 this._on({ 7048 change: "_toggleClasses", 7049 focus: function () { 7050 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 7051 }, 7052 blur: function () { 7053 this._removeClass( 7054 this.label, 7055 null, 7056 "ui-state-focus ui-visual-focus" 7057 ); 7058 }, 7059 }); 7060 }, 7061 7062 _readType: function () { 7063 var nodeName = this.element[0].nodeName.toLowerCase(); 7064 this.type = this.element[0].type; 7065 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 7066 $.error( 7067 "Can't create checkboxradio on element.nodeName=" + 7068 nodeName + 7069 " and element.type=" + 7070 this.type 7071 ); 7072 } 7073 }, 7074 7075 // Support jQuery Mobile enhanced option 7076 _enhance: function () { 7077 this._updateIcon(this.element[0].checked); 7078 }, 7079 7080 widget: function () { 7081 return this.label; 7082 }, 7083 7084 _getRadioGroup: function () { 7085 var group; 7086 var name = this.element[0].name; 7087 var nameSelector = "input[name='" + $.escapeSelector(name) + "']"; 7088 7089 if (!name) { 7090 return $([]); 7091 } 7092 7093 if (this.form.length) { 7094 group = $(this.form[0].elements).filter(nameSelector); 7095 } else { 7096 // Not inside a form, check all inputs that also are not inside a form 7097 group = $(nameSelector).filter(function () { 7098 return $(this)._form().length === 0; 7099 }); 7100 } 7101 7102 return group.not(this.element); 7103 }, 7104 7105 _toggleClasses: function () { 7106 var checked = this.element[0].checked; 7107 this._toggleClass( 7108 this.label, 7109 "ui-checkboxradio-checked", 7110 "ui-state-active", 7111 checked 7112 ); 7113 7114 if (this.options.icon && this.type === "checkbox") { 7115 this._toggleClass( 7116 this.icon, 7117 null, 7118 "ui-icon-check ui-state-checked", 7119 checked 7120 )._toggleClass(this.icon, null, "ui-icon-blank", !checked); 7121 } 7122 7123 if (this.type === "radio") { 7124 this._getRadioGroup().each(function () { 7125 var instance = $(this).checkboxradio("instance"); 7126 7127 if (instance) { 7128 instance._removeClass( 7129 instance.label, 7130 "ui-checkboxradio-checked", 7131 "ui-state-active" 7132 ); 7133 } 7134 }); 7135 } 7136 }, 7137 7138 _destroy: function () { 7139 this._unbindFormResetHandler(); 7140 7141 if (this.icon) { 7142 this.icon.remove(); 7143 this.iconSpace.remove(); 7144 } 7145 }, 7146 7147 _setOption: function (key, value) { 7148 // We don't allow the value to be set to nothing 7149 if (key === "label" && !value) { 7150 return; 7151 } 7152 7153 this._super(key, value); 7154 7155 if (key === "disabled") { 7156 this._toggleClass(this.label, null, "ui-state-disabled", value); 7157 this.element[0].disabled = value; 7158 7159 // Don't refresh when setting disabled 7160 return; 7161 } 7162 this.refresh(); 7163 }, 7164 7165 _updateIcon: function (checked) { 7166 var toAdd = "ui-icon ui-icon-background "; 7167 7168 if (this.options.icon) { 7169 if (!this.icon) { 7170 this.icon = $("<span>"); 7171 this.iconSpace = $("<span> </span>");
vendor: 6,725 bytes, lines 7172-7398
7172 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 7173 } 7174 7175 if (this.type === "checkbox") { 7176 toAdd += checked 7177 ? "ui-icon-check ui-state-checked" 7178 : "ui-icon-blank"; 7179 this._removeClass( 7180 this.icon, 7181 null, 7182 checked ? "ui-icon-blank" : "ui-icon-check" 7183 ); 7184 } else { 7185 toAdd += "ui-icon-blank"; 7186 } 7187 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 7188 if (!checked) { 7189 this._removeClass( 7190 this.icon, 7191 null, 7192 "ui-icon-check ui-state-checked" 7193 ); 7194 } 7195 this.icon.prependTo(this.label).after(this.iconSpace); 7196 } else if (this.icon !== undefined) { 7197 this.icon.remove(); 7198 this.iconSpace.remove(); 7199 delete this.icon; 7200 } 7201 }, 7202 7203 _updateLabel: function () { 7204 // Remove the contents of the label ( minus the icon, icon space, and input ) 7205 var contents = this.label.contents().not(this.element[0]); 7206 if (this.icon) { 7207 contents = contents.not(this.icon[0]); 7208 } 7209 if (this.iconSpace) { 7210 contents = contents.not(this.iconSpace[0]); 7211 } 7212 contents.remove(); 7213 7214 this.label.append(this.options.label); 7215 }, 7216 7217 refresh: function () { 7218 var checked = this.element[0].checked, 7219 isDisabled = this.element[0].disabled; 7220 7221 this._updateIcon(checked); 7222 this._toggleClass( 7223 this.label, 7224 "ui-checkboxradio-checked", 7225 "ui-state-active", 7226 checked 7227 ); 7228 if (this.options.label !== null) { 7229 this._updateLabel(); 7230 } 7231 7232 if (isDisabled !== this.options.disabled) { 7233 this._setOptions({ disabled: isDisabled }); 7234 } 7235 }, 7236 }, 7237 ]); 7238 7239 var widgetsCheckboxradio = $.ui.checkboxradio; 7240 7241 /*! 7242 * jQuery UI Button 1.13.3 7243 * https://jqueryui.com 7244 * 7245 * Copyright OpenJS Foundation and other contributors 7246 * Released under the MIT license. 7247 * https://jquery.org/license 7248 */ 7249 7250 //>>label: Button 7251 //>>group: Widgets 7252 //>>description: Enhances a form with themeable buttons. 7253 //>>docs: https://api.jqueryui.com/button/ 7254 //>>demos: https://jqueryui.com/button/ 7255 //>>css.structure: ../../themes/base/core.css 7256 //>>css.structure: ../../themes/base/button.css 7257 //>>css.theme: ../../themes/base/theme.css 7258 7259 $.widget("ui.button", { 7260 version: "1.13.3", 7261 defaultElement: "<button>", 7262 options: { 7263 classes: { 7264 "ui-button": "ui-corner-all", 7265 }, 7266 disabled: null, 7267 icon: null, 7268 iconPosition: "beginning", 7269 label: null, 7270 showLabel: true, 7271 }, 7272 7273 _getCreateOptions: function () { 7274 var disabled, 7275 // This is to support cases like in jQuery Mobile where the base widget does have 7276 // an implementation of _getCreateOptions 7277 options = this._super() || {}; 7278 7279 this.isInput = this.element.is("input"); 7280 7281 disabled = this.element[0].disabled; 7282 if (disabled != null) { 7283 options.disabled = disabled; 7284 } 7285 7286 this.originalLabel = this.isInput 7287 ? this.element.val() 7288 : this.element.html(); 7289 if (this.originalLabel) { 7290 options.label = this.originalLabel; 7291 } 7292 7293 return options; 7294 }, 7295 7296 _create: function () { 7297 if (!this.option.showLabel & !this.options.icon) { 7298 this.options.showLabel = true; 7299 } 7300 7301 // We have to check the option again here even though we did in _getCreateOptions, 7302 // because null may have been passed on init which would override what was set in 7303 // _getCreateOptions 7304 if (this.options.disabled == null) { 7305 this.options.disabled = this.element[0].disabled || false; 7306 } 7307 7308 this.hasTitle = !!this.element.attr("title"); 7309 7310 // Check to see if the label needs to be set or if its already correct 7311 if (this.options.label && this.options.label !== this.originalLabel) { 7312 if (this.isInput) { 7313 this.element.val(this.options.label); 7314 } else { 7315 this.element.html(this.options.label); 7316 } 7317 } 7318 this._addClass("ui-button", "ui-widget"); 7319 this._setOption("disabled", this.options.disabled); 7320 this._enhance(); 7321 7322 if (this.element.is("a")) { 7323 this._on({ 7324 keyup: function (event) { 7325 if (event.keyCode === $.ui.keyCode.SPACE) { 7326 event.preventDefault(); 7327 7328 // Support: PhantomJS <= 1.9, IE 8 Only 7329 // If a native click is available use it so we actually cause navigation 7330 // otherwise just trigger a click event 7331 if (this.element[0].click) { 7332 this.element[0].click(); 7333 } else { 7334 this.element.trigger("click"); 7335 } 7336 } 7337 }, 7338 }); 7339 } 7340 }, 7341 7342 _enhance: function () { 7343 if (!this.element.is("button")) { 7344 this.element.attr("role", "button"); 7345 } 7346 7347 if (this.options.icon) { 7348 this._updateIcon("icon", this.options.icon); 7349 this._updateTooltip(); 7350 } 7351 }, 7352 7353 _updateTooltip: function () { 7354 this.title = this.element.attr("title"); 7355 7356 if (!this.options.showLabel && !this.title) { 7357 this.element.attr("title", this.options.label); 7358 } 7359 }, 7360 7361 _updateIcon: function (option, value) { 7362 var icon = option !== "iconPosition", 7363 position = icon ? this.options.iconPosition : value, 7364 displayBlock = position === "top" || position === "bottom"; 7365 7366 // Create icon 7367 if (!this.icon) { 7368 this.icon = $("<span>"); 7369 7370 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 7371 7372 if (!this.options.showLabel) { 7373 this._addClass("ui-button-icon-only"); 7374 } 7375 } else if (icon) { 7376 // If we are updating the icon remove the old icon class 7377 this._removeClass(this.icon, null, this.options.icon); 7378 } 7379 7380 // If we are updating the icon add the new icon class 7381 if (icon) { 7382 this._addClass(this.icon, null, value); 7383 } 7384 7385 this._attachIcon(position); 7386 7387 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 7388 // the iconSpace if there is one. 7389 if (displayBlock) { 7390 this._addClass(this.icon, null, "ui-widget-icon-block"); 7391 if (this.iconSpace) { 7392 this.iconSpace.remove(); 7393 } 7394 } else { 7395 // Position is beginning or end so remove the ui-widget-icon-block class and add the 7396 // space if it does not exist 7397 if (!this.iconSpace) { 7398 this.iconSpace = $("<span> </span>");
vendor: 5,633 bytes, lines 7399-7589
7399 this._addClass(this.iconSpace, "ui-button-icon-space"); 7400 } 7401 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 7402 this._attachIconSpace(position); 7403 } 7404 }, 7405 7406 _destroy: function () { 7407 this.element.removeAttr("role"); 7408 7409 if (this.icon) { 7410 this.icon.remove(); 7411 } 7412 if (this.iconSpace) { 7413 this.iconSpace.remove(); 7414 } 7415 if (!this.hasTitle) { 7416 this.element.removeAttr("title"); 7417 } 7418 }, 7419 7420 _attachIconSpace: function (iconPosition) { 7421 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"]( 7422 this.iconSpace 7423 ); 7424 }, 7425 7426 _attachIcon: function (iconPosition) { 7427 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"]( 7428 this.icon 7429 ); 7430 }, 7431 7432 _setOptions: function (options) { 7433 var newShowLabel = 7434 options.showLabel === undefined 7435 ? this.options.showLabel 7436 : options.showLabel, 7437 newIcon = options.icon === undefined ? this.options.icon : options.icon; 7438 7439 if (!newShowLabel && !newIcon) { 7440 options.showLabel = true; 7441 } 7442 this._super(options); 7443 }, 7444 7445 _setOption: function (key, value) { 7446 if (key === "icon") { 7447 if (value) { 7448 this._updateIcon(key, value); 7449 } else if (this.icon) { 7450 this.icon.remove(); 7451 if (this.iconSpace) { 7452 this.iconSpace.remove(); 7453 } 7454 } 7455 } 7456 7457 if (key === "iconPosition") { 7458 this._updateIcon(key, value); 7459 } 7460 7461 // Make sure we can't end up with a button that has neither text nor icon 7462 if (key === "showLabel") { 7463 this._toggleClass("ui-button-icon-only", null, !value); 7464 this._updateTooltip(); 7465 } 7466 7467 if (key === "label") { 7468 if (this.isInput) { 7469 this.element.val(value); 7470 } else { 7471 // If there is an icon, append it, else nothing then append the value 7472 // this avoids removal of the icon when setting label text 7473 this.element.html(value); 7474 if (this.icon) { 7475 this._attachIcon(this.options.iconPosition); 7476 this._attachIconSpace(this.options.iconPosition); 7477 } 7478 } 7479 } 7480 7481 this._super(key, value); 7482 7483 if (key === "disabled") { 7484 this._toggleClass(null, "ui-state-disabled", value); 7485 this.element[0].disabled = value; 7486 if (value) { 7487 this.element.trigger("blur"); 7488 } 7489 } 7490 }, 7491 7492 refresh: function () { 7493 // Make sure to only check disabled if its an element that supports this otherwise 7494 // check for the disabled class to determine state 7495 var isDisabled = this.element.is("input, button") 7496 ? this.element[0].disabled 7497 : this.element.hasClass("ui-button-disabled"); 7498 7499 if (isDisabled !== this.options.disabled) { 7500 this._setOptions({ disabled: isDisabled }); 7501 } 7502 7503 this._updateTooltip(); 7504 }, 7505 }); 7506 7507 // DEPRECATED 7508 if ($.uiBackCompat !== false) { 7509 // Text and Icons options 7510 $.widget("ui.button", $.ui.button, { 7511 options: { 7512 text: true, 7513 icons: { 7514 primary: null, 7515 secondary: null, 7516 }, 7517 }, 7518 7519 _create: function () { 7520 if (this.options.showLabel && !this.options.text) { 7521 this.options.showLabel = this.options.text; 7522 } 7523 if (!this.options.showLabel && this.options.text) { 7524 this.options.text = this.options.showLabel; 7525 } 7526 if ( 7527 !this.options.icon && 7528 (this.options.icons.primary || this.options.icons.secondary) 7529 ) { 7530 if (this.options.icons.primary) { 7531 this.options.icon = this.options.icons.primary; 7532 } else { 7533 this.options.icon = this.options.icons.secondary; 7534 this.options.iconPosition = "end"; 7535 } 7536 } else if (this.options.icon) { 7537 this.options.icons.primary = this.options.icon; 7538 } 7539 this._super(); 7540 }, 7541 7542 _setOption: function (key, value) { 7543 if (key === "text") { 7544 this._super("showLabel", value); 7545 return; 7546 } 7547 if (key === "showLabel") { 7548 this.options.text = value; 7549 } 7550 if (key === "icon") { 7551 this.options.icons.primary = value; 7552 } 7553 if (key === "icons") { 7554 if (value.primary) { 7555 this._super("icon", value.primary); 7556 this._super("iconPosition", "beginning"); 7557 } else if (value.secondary) { 7558 this._super("icon", value.secondary); 7559 this._super("iconPosition", "end"); 7560 } 7561 } 7562 this._superApply(arguments); 7563 }, 7564 }); 7565 7566 $.fn.button = (function (orig) { 7567 return function (options) { 7568 var isMethodCall = typeof options === "string"; 7569 var args = Array.prototype.slice.call(arguments, 1); 7570 var returnValue = this; 7571 7572 if (isMethodCall) { 7573 // If this is an empty collection, we need to have the instance method 7574 // return undefined instead of the jQuery instance 7575 if (!this.length && options === "instance") { 7576 returnValue = undefined; 7577 } else { 7578 this.each(function () { 7579 var methodValue; 7580 var type = $(this).attr("type"); 7581 var name = 7582 type !== "checkbox" && type !== "radio" 7583 ? "button" 7584 : "checkboxradio"; 7585 var instance = $.data(this, "ui-" + name); 7586 7587 if (options === "instance") { 7588 returnValue = instance; 7589 return false;
vendor: 8,074 bytes, lines 7590-7816
7590 } 7591 7592 if (!instance) { 7593 return $.error( 7594 "cannot call methods on button" + 7595 " prior to initialization; " + 7596 "attempted to call method '" + 7597 options + 7598 "'" 7599 ); 7600 } 7601 7602 if ( 7603 typeof instance[options] !== "function" || 7604 options.charAt(0) === "_" 7605 ) { 7606 return $.error( 7607 "no such method '" + 7608 options + 7609 "' for button" + 7610 " widget instance" 7611 ); 7612 } 7613 7614 methodValue = instance[options].apply(instance, args); 7615 7616 if (methodValue !== instance && methodValue !== undefined) { 7617 returnValue = 7618 methodValue && methodValue.jquery 7619 ? returnValue.pushStack(methodValue.get()) 7620 : methodValue; 7621 return false; 7622 } 7623 }); 7624 } 7625 } else { 7626 // Allow multiple hashes to be passed on init 7627 if (args.length) { 7628 options = $.widget.extend.apply(null, [options].concat(args)); 7629 } 7630 7631 this.each(function () { 7632 var type = $(this).attr("type"); 7633 var name = 7634 type !== "checkbox" && type !== "radio" 7635 ? "button" 7636 : "checkboxradio"; 7637 var instance = $.data(this, "ui-" + name); 7638 7639 if (instance) { 7640 instance.option(options || {}); 7641 if (instance._init) { 7642 instance._init(); 7643 } 7644 } else { 7645 if (name === "button") { 7646 orig.call($(this), options); 7647 return; 7648 } 7649 7650 $(this).checkboxradio($.extend({ icon: false }, options)); 7651 } 7652 }); 7653 } 7654 7655 return returnValue; 7656 }; 7657 })($.fn.button); 7658 7659 $.fn.buttonset = function () { 7660 if (!$.ui.controlgroup) { 7661 $.error("Controlgroup widget missing"); 7662 } 7663 if ( 7664 arguments[0] === "option" && 7665 arguments[1] === "items" && 7666 arguments[2] 7667 ) { 7668 return this.controlgroup.apply(this, [ 7669 arguments[0], 7670 "items.button", 7671 arguments[2], 7672 ]); 7673 } 7674 if (arguments[0] === "option" && arguments[1] === "items") { 7675 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 7676 } 7677 if (typeof arguments[0] === "object" && arguments[0].items) { 7678 arguments[0].items = { 7679 button: arguments[0].items, 7680 }; 7681 } 7682 return this.controlgroup.apply(this, arguments); 7683 }; 7684 } 7685 7686 var widgetsButton = $.ui.button; 7687 7688 /* eslint-disable max-len, camelcase */ 7689 /*! 7690 * jQuery UI Datepicker 1.13.3 7691 * https://jqueryui.com 7692 * 7693 * Copyright OpenJS Foundation and other contributors 7694 * Released under the MIT license. 7695 * https://jquery.org/license 7696 */ 7697 7698 //>>label: Datepicker 7699 //>>group: Widgets 7700 //>>description: Displays a calendar from an input or inline for selecting dates. 7701 //>>docs: https://api.jqueryui.com/datepicker/ 7702 //>>demos: https://jqueryui.com/datepicker/ 7703 //>>css.structure: ../../themes/base/core.css 7704 //>>css.structure: ../../themes/base/datepicker.css 7705 //>>css.theme: ../../themes/base/theme.css 7706 7707 $.extend($.ui, { datepicker: { version: "1.13.3" } }); 7708 7709 var datepicker_instActive; 7710 7711 function datepicker_getZindex(elem) { 7712 var position, value; 7713 while (elem.length && elem[0] !== document) { 7714 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7715 // This makes behavior of this function consistent across browsers 7716 // WebKit always returns auto if the element is positioned 7717 position = elem.css("position"); 7718 if ( 7719 position === "absolute" || 7720 position === "relative" || 7721 position === "fixed" 7722 ) { 7723 // IE returns 0 when zIndex is not specified 7724 // other browsers return a string 7725 // we ignore the case of nested elements with an explicit value of 0 7726 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7727 value = parseInt(elem.css("zIndex"), 10); 7728 if (!isNaN(value) && value !== 0) { 7729 return value; 7730 } 7731 } 7732 elem = elem.parent(); 7733 } 7734 7735 return 0; 7736 } 7737 7738 /* Date picker manager. 7739 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7740 Settings for (groups of) date pickers are maintained in an instance object, 7741 allowing multiple different settings on the same page. */ 7742 7743 function Datepicker() { 7744 this._curInst = null; // The current instance in use 7745 this._keyEvent = false; // If the last event was a key event 7746 this._disabledInputs = []; // List of date picker inputs that have been disabled 7747 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7748 this._inDialog = false; // True if showing within a "dialog", false if not 7749 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7750 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7751 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7752 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7753 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7754 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7755 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7756 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7757 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7758 this.regional = []; // Available regional settings, indexed by language code 7759 this.regional[""] = { 7760 // Default regional settings 7761 closeText: "Done", // Display text for close link 7762 prevText: "Prev", // Display text for previous month link 7763 nextText: "Next", // Display text for next month link 7764 currentText: "Today", // Display text for current month link 7765 monthNames: [ 7766 "January", 7767 "February", 7768 "March", 7769 "April", 7770 "May", 7771 "June", 7772 "July", 7773 "August", 7774 "September", 7775 "October", 7776 "November", 7777 "December", 7778 ], // Names of months for drop-down and formatting 7779 monthNamesShort: [ 7780 "Jan", 7781 "Feb", 7782 "Mar", 7783 "Apr", 7784 "May", 7785 "Jun", 7786 "Jul", 7787 "Aug", 7788 "Sep", 7789 "Oct", 7790 "Nov", 7791 "Dec", 7792 ], // For formatting 7793 dayNames: [ 7794 "Sunday", 7795 "Monday", 7796 "Tuesday", 7797 "Wednesday", 7798 "Thursday", 7799 "Friday", 7800 "Saturday", 7801 ], // For formatting 7802 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 7803 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 7804 weekHeader: "Wk", // Column header for week of the year 7805 dateFormat: "mm/dd/yy", // See format options on parseDate 7806 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7807 isRTL: false, // True if right-to-left language, false if left-to-right 7808 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7809 yearSuffix: "", // Additional text to append to the year in the month headers, 7810 selectMonthLabel: "Select month", // Invisible label for month selector 7811 selectYearLabel: "Select year", // Invisible label for year selector 7812 }; 7813 this._defaults = { 7814 // Global defaults for all the date picker instances 7815 showOn: "focus", // "focus" for popup on focus, 7816 // "button" for trigger button, or "both" for either
vendor: 6,452 bytes, lines 7817-7945
7817 showAnim: "fadeIn", // Name of jQuery animation for popup 7818 showOptions: {}, // Options for enhanced animations 7819 defaultDate: null, // Used when field is blank: actual date, 7820 // +/-number for offset from today, null for today 7821 appendText: "", // Display text following the input box, e.g. showing the format 7822 buttonText: "...", // Text for trigger button 7823 buttonImage: "", // URL for trigger button image 7824 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7825 hideIfNoPrevNext: false, // True to hide next/previous month links 7826 // if not applicable, false to just disable them 7827 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7828 gotoCurrent: false, // True if today link goes back to current selection instead 7829 changeMonth: false, // True if month can be selected directly, false if only prev/next 7830 changeYear: false, // True if year can be selected directly, false if only prev/next 7831 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7832 // either relative to today's year (-nn:+nn), relative to currently displayed year 7833 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7834 showOtherMonths: false, // True to show dates in other months, false to leave blank 7835 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7836 showWeek: false, // True to show week of the year, false to not show it 7837 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7838 // takes a Date and returns the number of the week for it 7839 shortYearCutoff: "+10", // Short year values < this are in the current century, 7840 // > this are in the previous century, 7841 // string value starting with "+" for current year + value 7842 minDate: null, // The earliest selectable date, or null for no limit 7843 maxDate: null, // The latest selectable date, or null for no limit 7844 duration: "fast", // Duration of display/closure 7845 beforeShowDay: null, // Function that takes a date and returns an array with 7846 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7847 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7848 beforeShow: null, // Function that takes an input field and 7849 // returns a set of custom settings for the date picker 7850 onSelect: null, // Define a callback function when a date is selected 7851 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7852 onClose: null, // Define a callback function when the datepicker is closed 7853 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 7854 numberOfMonths: 1, // Number of months to show at a time 7855 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7856 stepMonths: 1, // Number of months to step back/forward 7857 stepBigMonths: 12, // Number of months to step back/forward for the big links 7858 altField: "", // Selector for an alternate field to store selected dates into 7859 altFormat: "", // The date format to use for the alternate field 7860 constrainInput: true, // The input is constrained by the current date format 7861 showButtonPanel: false, // True to show button panel, false to not show it 7862 autoSize: false, // True to size the input for the date format, false to leave as is 7863 disabled: false, // The initial disabled state 7864 }; 7865 $.extend(this._defaults, this.regional[""]); 7866 this.regional.en = $.extend(true, {}, this.regional[""]); 7867 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 7868 this.dpDiv = datepicker_bindHover( 7869 $( 7870 "<div id='" + 7871 this._mainDivId + 7872 "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" 7873 ) 7874 ); 7875 } 7876 7877 $.extend(Datepicker.prototype, { 7878 /* Class name added to elements to indicate already configured with a date picker. */ 7879 markerClassName: "hasDatepicker", 7880 7881 //Keep track of the maximum number of rows displayed (see #7043) 7882 maxRows: 4, 7883 7884 // TODO rename to "widget" when switching to widget factory 7885 _widgetDatepicker: function () { 7886 return this.dpDiv; 7887 }, 7888 7889 /* Override the default settings for all instances of the date picker. 7890 * @param settings object - the new settings to use as defaults (anonymous object) 7891 * @return the manager object 7892 */ 7893 setDefaults: function (settings) { 7894 datepicker_extendRemove(this._defaults, settings || {}); 7895 return this; 7896 }, 7897 7898 /* Attach the date picker to a jQuery selection. 7899 * @param target element - the target input field or division or span 7900 * @param settings object - the new settings to use for this date picker instance (anonymous) 7901 */ 7902 _attachDatepicker: function (target, settings) { 7903 var nodeName, inline, inst; 7904 nodeName = target.nodeName.toLowerCase(); 7905 inline = nodeName === "div" || nodeName === "span"; 7906 if (!target.id) { 7907 this.uuid += 1; 7908 target.id = "dp" + this.uuid; 7909 } 7910 inst = this._newInst($(target), inline); 7911 inst.settings = $.extend({}, settings || {}); 7912 if (nodeName === "input") { 7913 this._connectDatepicker(target, inst); 7914 } else if (inline) { 7915 this._inlineDatepicker(target, inst); 7916 } 7917 }, 7918 7919 /* Create a new instance object. */ 7920 _newInst: function (target, inline) { 7921 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 7922 return { 7923 id: id, 7924 input: target, // associated target 7925 selectedDay: 0, 7926 selectedMonth: 0, 7927 selectedYear: 0, // current selection 7928 drawMonth: 0, 7929 drawYear: 0, // month being drawn 7930 inline: inline, // is datepicker inline or not 7931 dpDiv: !inline 7932 ? this.dpDiv // presentation div 7933 : datepicker_bindHover( 7934 $( 7935 "<div class='" + 7936 this._inlineClass + 7937 " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" 7938 ) 7939 ), 7940 }; 7941 }, 7942 7943 /* Attach the date picker to an input field. */ 7944 _connectDatepicker: function (target, inst) { 7945 var input = $(target);
vendor: 4,857 bytes, lines 7946-8104
7946 inst.append = $([]); 7947 inst.trigger = $([]); 7948 if (input.hasClass(this.markerClassName)) { 7949 return; 7950 } 7951 this._attachments(input, inst); 7952 input 7953 .addClass(this.markerClassName) 7954 .on("keydown", this._doKeyDown) 7955 .on("keypress", this._doKeyPress) 7956 .on("keyup", this._doKeyUp); 7957 this._autoSize(inst); 7958 $.data(target, "datepicker", inst); 7959 7960 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 7961 if (inst.settings.disabled) { 7962 this._disableDatepicker(target); 7963 } 7964 }, 7965 7966 /* Make attachments based on settings. */ 7967 _attachments: function (input, inst) { 7968 var showOn, 7969 buttonText, 7970 buttonImage, 7971 appendText = this._get(inst, "appendText"), 7972 isRTL = this._get(inst, "isRTL"); 7973 7974 if (inst.append) { 7975 inst.append.remove(); 7976 } 7977 if (appendText) { 7978 inst.append = $("<span>").addClass(this._appendClass).text(appendText); 7979 input[isRTL ? "before" : "after"](inst.append); 7980 } 7981 7982 input.off("focus", this._showDatepicker); 7983 7984 if (inst.trigger) { 7985 inst.trigger.remove(); 7986 } 7987 7988 showOn = this._get(inst, "showOn"); 7989 if (showOn === "focus" || showOn === "both") { 7990 // pop-up date picker when in the marked field 7991 input.on("focus", this._showDatepicker); 7992 } 7993 if (showOn === "button" || showOn === "both") { 7994 // pop-up date picker when button clicked 7995 buttonText = this._get(inst, "buttonText"); 7996 buttonImage = this._get(inst, "buttonImage"); 7997 7998 if (this._get(inst, "buttonImageOnly")) { 7999 inst.trigger = $("<img>").addClass(this._triggerClass).attr({ 8000 src: buttonImage, 8001 alt: buttonText, 8002 title: buttonText, 8003 }); 8004 } else { 8005 inst.trigger = $("<button type='button'>").addClass( 8006 this._triggerClass 8007 ); 8008 if (buttonImage) { 8009 inst.trigger.html( 8010 $("<img>").attr({ 8011 src: buttonImage, 8012 alt: buttonText, 8013 title: buttonText, 8014 }) 8015 ); 8016 } else { 8017 inst.trigger.text(buttonText); 8018 } 8019 } 8020 8021 input[isRTL ? "before" : "after"](inst.trigger); 8022 inst.trigger.on("click", function () { 8023 if ( 8024 $.datepicker._datepickerShowing && 8025 $.datepicker._lastInput === input[0] 8026 ) { 8027 $.datepicker._hideDatepicker(); 8028 } else if ( 8029 $.datepicker._datepickerShowing && 8030 $.datepicker._lastInput !== input[0] 8031 ) { 8032 $.datepicker._hideDatepicker(); 8033 $.datepicker._showDatepicker(input[0]); 8034 } else { 8035 $.datepicker._showDatepicker(input[0]); 8036 } 8037 return false; 8038 }); 8039 } 8040 }, 8041 8042 /* Apply the maximum length for the date format. */ 8043 _autoSize: function (inst) { 8044 if (this._get(inst, "autoSize") && !inst.inline) { 8045 var findMax, 8046 max, 8047 maxI, 8048 i, 8049 date = new Date(2009, 12 - 1, 20), // Ensure double digits 8050 dateFormat = this._get(inst, "dateFormat"); 8051 8052 if (dateFormat.match(/[DM]/)) { 8053 findMax = function (names) { 8054 max = 0; 8055 maxI = 0; 8056 for (i = 0; i < names.length; i++) { 8057 if (names[i].length > max) { 8058 max = names[i].length; 8059 maxI = i; 8060 } 8061 } 8062 return maxI; 8063 }; 8064 date.setMonth( 8065 findMax( 8066 this._get( 8067 inst, 8068 dateFormat.match(/MM/) ? "monthNames" : "monthNamesShort" 8069 ) 8070 ) 8071 ); 8072 date.setDate( 8073 findMax( 8074 this._get( 8075 inst, 8076 dateFormat.match(/DD/) ? "dayNames" : "dayNamesShort" 8077 ) 8078 ) + 8079 20 - 8080 date.getDay() 8081 ); 8082 } 8083 inst.input.attr("size", this._formatDate(inst, date).length); 8084 } 8085 }, 8086 8087 /* Attach an inline date picker to a div. */ 8088 _inlineDatepicker: function (target, inst) { 8089 var divSpan = $(target); 8090 if (divSpan.hasClass(this.markerClassName)) { 8091 return; 8092 } 8093 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 8094 $.data(target, "datepicker", inst); 8095 this._setDate(inst, this._getDefaultDate(inst), true); 8096 this._updateDatepicker(inst); 8097 this._updateAlternate(inst); 8098 8099 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 8100 if (inst.settings.disabled) { 8101 this._disableDatepicker(target); 8102 } 8103 8104 // Set display:block in place of inst.dpDiv.show() which w
vendor: 51,929 bytes, lines 8104-9737
8104on't work on disconnected elements 8105 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 8106 inst.dpDiv.css("display", "block"); 8107 }, 8108 8109 /* Pop-up the date picker in a "dialog" box. 8110 * @param input element - ignored 8111 * @param date string or Date - the initial date to display 8112 * @param onSelect function - the function to call when a date is selected 8113 * @param settings object - update the dialog date picker instance's settings (anonymous object) 8114 * @param pos int[2] - coordinates for the dialog's position within the screen or 8115 * event - with x/y coordinates or 8116 * leave empty for default (screen centre) 8117 * @return the manager object 8118 */ 8119 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 8120 var id, 8121 browserWidth, 8122 browserHeight, 8123 scrollX, 8124 scrollY, 8125 inst = this._dialogInst; // internal instance 8126 8127 if (!inst) { 8128 this.uuid += 1; 8129 id = "dp" + this.uuid; 8130 this._dialogInput = $( 8131 "<input type='text' id='" + 8132 id + 8133 "' style='position: absolute; top: -100px; width: 0px;'/>" 8134 ); 8135 this._dialogInput.on("keydown", this._doKeyDown); 8136 $("body").append(this._dialogInput); 8137 inst = this._dialogInst = this._newInst(this._dialogInput, false); 8138 inst.settings = {}; 8139 $.data(this._dialogInput[0], "datepicker", inst); 8140 } 8141 datepicker_extendRemove(inst.settings, settings || {}); 8142 date = 8143 date && date.constructor === Date ? this._formatDate(inst, date) : date; 8144 this._dialogInput.val(date); 8145 8146 this._pos = pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null; 8147 if (!this._pos) { 8148 browserWidth = document.documentElement.clientWidth; 8149 browserHeight = document.documentElement.clientHeight; 8150 scrollX = 8151 document.documentElement.scrollLeft || document.body.scrollLeft; 8152 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 8153 this._pos = 8154 // should use actual width/height below 8155 [browserWidth / 2 - 100 + scrollX, browserHeight / 2 - 150 + scrollY]; 8156 } 8157 8158 // Move input on screen for focus, but hidden behind dialog 8159 this._dialogInput 8160 .css("left", this._pos[0] + 20 + "px") 8161 .css("top", this._pos[1] + "px"); 8162 inst.settings.onSelect = onSelect; 8163 this._inDialog = true; 8164 this.dpDiv.addClass(this._dialogClass); 8165 this._showDatepicker(this._dialogInput[0]); 8166 if ($.blockUI) { 8167 $.blockUI(this.dpDiv); 8168 } 8169 $.data(this._dialogInput[0], "datepicker", inst); 8170 return this; 8171 }, 8172 8173 /* Detach a datepicker from its control. 8174 * @param target element - the target input field or division or span 8175 */ 8176 _destroyDatepicker: function (target) { 8177 var nodeName, 8178 $target = $(target), 8179 inst = $.data(target, "datepicker"); 8180 8181 if (!$target.hasClass(this.markerClassName)) { 8182 return; 8183 } 8184 8185 nodeName = target.nodeName.toLowerCase(); 8186 $.removeData(target, "datepicker"); 8187 if (nodeName === "input") { 8188 inst.append.remove(); 8189 inst.trigger.remove(); 8190 $target 8191 .removeClass(this.markerClassName) 8192 .off("focus", this._showDatepicker) 8193 .off("keydown", this._doKeyDown) 8194 .off("keypress", this._doKeyPress) 8195 .off("keyup", this._doKeyUp); 8196 } else if (nodeName === "div" || nodeName === "span") { 8197 $target.removeClass(this.markerClassName).empty(); 8198 } 8199 8200 if (datepicker_instActive === inst) { 8201 datepicker_instActive = null; 8202 this._curInst = null; 8203 } 8204 }, 8205 8206 /* Enable the date picker to a jQuery selection. 8207 * @param target element - the target input field or division or span 8208 */ 8209 _enableDatepicker: function (target) { 8210 var nodeName, 8211 inline, 8212 $target = $(target), 8213 inst = $.data(target, "datepicker"); 8214 8215 if (!$target.hasClass(this.markerClassName)) { 8216 return; 8217 } 8218 8219 nodeName = target.nodeName.toLowerCase(); 8220 if (nodeName === "input") { 8221 target.disabled = false; 8222 inst.trigger 8223 .filter("button") 8224 .each(function () { 8225 this.disabled = false; 8226 }) 8227 .end() 8228 .filter("img") 8229 .css({ opacity: "1.0", cursor: "" }); 8230 } else if (nodeName === "div" || nodeName === "span") { 8231 inline = $target.children("." + this._inlineClass); 8232 inline.children().removeClass("ui-state-disabled"); 8233 inline 8234 .find("select.ui-datepicker-month, select.ui-datepicker-year") 8235 .prop("disabled", false); 8236 } 8237 this._disabledInputs = $.map( 8238 this._disabledInputs, 8239 8240 // Delete entry 8241 function (value) { 8242 return value === target ? null : value; 8243 } 8244 ); 8245 }, 8246 8247 /* Disable the date picker to a jQuery selection. 8248 * @param target element - the target input field or division or span 8249 */ 8250 _disableDatepicker: function (target) { 8251 var nodeName, 8252 inline, 8253 $target = $(target), 8254 inst = $.data(target, "datepicker"); 8255 8256 if (!$target.hasClass(this.markerClassName)) { 8257 return; 8258 } 8259 8260 nodeName = target.nodeName.toLowerCase(); 8261 if (nodeName === "input") { 8262 target.disabled = true; 8263 inst.trigger 8264 .filter("button") 8265 .each(function () { 8266 this.disabled = true; 8267 }) 8268 .end() 8269 .filter("img") 8270 .css({ opacity: "0.5", cursor: "default" }); 8271 } else if (nodeName === "div" || nodeName === "span") { 8272 inline = $target.children("." + this._inlineClass); 8273 inline.children().addClass("ui-state-disabled"); 8274 inline 8275 .find("select.ui-datepicker-month, select.ui-datepicker-year") 8276 .prop("disabled", true); 8277 } 8278 this._disabledInputs = $.map( 8279 this._disabledInputs, 8280 8281 // Delete entry 8282 function (value) { 8283 return value === target ? null : value; 8284 } 8285 ); 8286 this._disabledInputs[this._disabledInputs.length] = target; 8287 }, 8288 8289 /* Is the first field in a jQuery collection disabled as a datepicker? 8290 * @param target element - the target input field or division or span 8291 * @return boolean - true if disabled, false if enabled 8292 */ 8293 _isDisabledDatepicker: function (target) { 8294 if (!target) { 8295 return false; 8296 } 8297 for (var i = 0; i < this._disabledInputs.length; i++) { 8298 if (this._disabledInputs[i] === target) { 8299 return true; 8300 } 8301 } 8302 return false; 8303 }, 8304 8305 /* Retrieve the instance data for the target control. 8306 * @param target element - the target input field or division or span 8307 * @return object - the associated instance data 8308 * @throws error if a jQuery problem getting data 8309 */ 8310 _getInst: function (target) { 8311 try { 8312 return $.data(target, "datepicker"); 8313 } catch (err) { 8314 throw "Missing instance data for this datepicker"; 8315 } 8316 }, 8317 8318 /* Update or retrieve the settings for a date picker attached to an input field or division. 8319 * @param target element - the target input field or division or span 8320 * @param name object - the new settings to update or 8321 * string - the name of the setting to change or retrieve, 8322 * when retrieving also "all" for all instance settings or 8323 * "defaults" for all global defaults 8324 * @param value any - the new value for the setting 8325 * (omit if above is an object or to retrieve a value) 8326 */ 8327 _optionDatepicker: function (target, name, value) { 8328 var settings, 8329 date, 8330 minDate, 8331 maxDate, 8332 inst = this._getInst(target); 8333 8334 if (arguments.length === 2 && typeof name === "string") { 8335 return name === "defaults" 8336 ? $.extend({}, $.datepicker._defaults) 8337 : inst 8338 ? name === "all" 8339 ? $.extend({}, inst.settings) 8340 : this._get(inst, name) 8341 : null; 8342 } 8343 8344 settings = name || {}; 8345 if (typeof name === "string") { 8346 settings = {}; 8347 settings[name] = value; 8348 } 8349 8350 if (inst) { 8351 if (this._curInst === inst) { 8352 this._hideDatepicker(); 8353 } 8354 8355 date = this._getDateDatepicker(target, true); 8356 minDate = this._getMinMaxDate(inst, "min"); 8357 maxDate = this._getMinMaxDate(inst, "max"); 8358 datepicker_extendRemove(inst.settings, settings); 8359 8360 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 8361 if ( 8362 minDate !== null && 8363 settings.dateFormat !== undefined && 8364 settings.minDate === undefined 8365 ) { 8366 inst.settings.minDate = this._formatDate(inst, minDate); 8367 } 8368 if ( 8369 maxDate !== null && 8370 settings.dateFormat !== undefined && 8371 settings.maxDate === undefined 8372 ) { 8373 inst.settings.maxDate = this._formatDate(inst, maxDate); 8374 } 8375 if ("disabled" in settings) { 8376 if (settings.disabled) { 8377 this._disableDatepicker(target); 8378 } else { 8379 this._enableDatepicker(target); 8380 } 8381 } 8382 this._attachments($(target), inst); 8383 this._autoSize(inst); 8384 this._setDate(inst, date); 8385 this._updateAlternate(inst); 8386 this._updateDatepicker(inst); 8387 } 8388 }, 8389 8390 // Change method deprecated 8391 _changeDatepicker: function (target, name, value) { 8392 this._optionDatepicker(target, name, value); 8393 }, 8394 8395 /* Redraw the date picker attached to an input field or division. 8396 * @param target element - the target input field or division or span 8397 */ 8398 _refreshDatepicker: function (target) { 8399 var inst = this._getInst(target); 8400 if (inst) { 8401 this._updateDatepicker(inst); 8402 } 8403 }, 8404 8405 /* Set the dates for a jQuery selection. 8406 * @param target element - the target input field or division or span 8407 * @param date Date - the new date 8408 */ 8409 _setDateDatepicker: function (target, date) { 8410 var inst = this._getInst(target); 8411 if (inst) { 8412 this._setDate(inst, date); 8413 this._updateDatepicker(inst); 8414 this._updateAlternate(inst); 8415 } 8416 }, 8417 8418 /* Get the date(s) for the first entry in a jQuery selection. 8419 * @param target element - the target input field or division or span 8420 * @param noDefault boolean - true if no default date is to be used 8421 * @return Date - the current date 8422 */ 8423 _getDateDatepicker: function (target, noDefault) { 8424 var inst = this._getInst(target); 8425 if (inst && !inst.inline) { 8426 this._setDateFromField(inst, noDefault); 8427 } 8428 return inst ? this._getDate(inst) : null; 8429 }, 8430 8431 /* Handle keystrokes. */ 8432 _doKeyDown: function (event) { 8433 var onSelect, 8434 dateStr, 8435 sel, 8436 inst = $.datepicker._getInst(event.target), 8437 handled = true, 8438 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 8439 8440 inst._keyEvent = true; 8441 if ($.datepicker._datepickerShowing) { 8442 switch (event.keyCode) { 8443 case 9: 8444 $.datepicker._hideDatepicker(); 8445 handled = false; 8446 break; // hide on tab out 8447 case 13: 8448 sel = $( 8449 "td." + 8450 $.datepicker._dayOverClass + 8451 ":not(." + 8452 $.datepicker._currentClass + 8453 ")", 8454 inst.dpDiv 8455 ); 8456 if (sel[0]) { 8457 $.datepicker._selectDay( 8458 event.target, 8459 inst.selectedMonth, 8460 inst.selectedYear, 8461 sel[0] 8462 ); 8463 } 8464 8465 onSelect = $.datepicker._get(inst, "onSelect"); 8466 if (onSelect) { 8467 dateStr = $.datepicker._formatDate(inst); 8468 8469 // Trigger custom callback 8470 onSelect.apply(inst.input ? inst.input[0] : null, [ 8471 dateStr, 8472 inst, 8473 ]); 8474 } else { 8475 $.datepicker._hideDatepicker(); 8476 } 8477 8478 return false; // don't submit the form 8479 case 27: 8480 $.datepicker._hideDatepicker(); 8481 break; // hide on escape 8482 case 33: 8483 $.datepicker._adjustDate( 8484 event.target, 8485 event.ctrlKey 8486 ? -$.datepicker._get(inst, "stepBigMonths") 8487 : -$.datepicker._get(inst, "stepMonths"), 8488 "M" 8489 ); 8490 break; // previous month/year on page up/+ ctrl 8491 case 34: 8492 $.datepicker._adjustDate( 8493 event.target, 8494 event.ctrlKey 8495 ? +$.datepicker._get(inst, "stepBigMonths") 8496 : +$.datepicker._get(inst, "stepMonths"), 8497 "M" 8498 ); 8499 break; // next month/year on page down/+ ctrl 8500 case 35: 8501 if (event.ctrlKey || event.metaKey) { 8502 $.datepicker._clearDate(event.target); 8503 } 8504 handled = event.ctrlKey || event.metaKey; 8505 break; // clear on ctrl or command +end 8506 case 36: 8507 if (event.ctrlKey || event.metaKey) { 8508 $.datepicker._gotoToday(event.target); 8509 } 8510 handled = event.ctrlKey || event.metaKey; 8511 break; // current on ctrl or command +home 8512 case 37: 8513 if (event.ctrlKey || event.metaKey) { 8514 $.datepicker._adjustDate(event.target, isRTL ? +1 : -1, "D"); 8515 } 8516 handled = event.ctrlKey || event.metaKey; 8517 8518 // -1 day on ctrl or command +left 8519 if (event.originalEvent.altKey) { 8520 $.datepicker._adjustDate( 8521 event.target, 8522 event.ctrlKey 8523 ? -$.datepicker._get(inst, "stepBigMonths") 8524 : -$.datepicker._get(inst, "stepMonths"), 8525 "M" 8526 ); 8527 } 8528 8529 // next month/year on alt +left on Mac 8530 break; 8531 case 38: 8532 if (event.ctrlKey || event.metaKey) { 8533 $.datepicker._adjustDate(event.target, -7, "D"); 8534 } 8535 handled = event.ctrlKey || event.metaKey; 8536 break; // -1 week on ctrl or command +up 8537 case 39: 8538 if (event.ctrlKey || event.metaKey) { 8539 $.datepicker._adjustDate(event.target, isRTL ? -1 : +1, "D"); 8540 } 8541 handled = event.ctrlKey || event.metaKey; 8542 8543 // +1 day on ctrl or command +right 8544 if (event.originalEvent.altKey) { 8545 $.datepicker._adjustDate( 8546 event.target, 8547 event.ctrlKey 8548 ? +$.datepicker._get(inst, "stepBigMonths") 8549 : +$.datepicker._get(inst, "stepMonths"), 8550 "M" 8551 ); 8552 } 8553 8554 // next month/year on alt +right 8555 break; 8556 case 40: 8557 if (event.ctrlKey || event.metaKey) { 8558 $.datepicker._adjustDate(event.target, +7, "D"); 8559 } 8560 handled = event.ctrlKey || event.metaKey; 8561 break; // +1 week on ctrl or command +down 8562 default: 8563 handled = false; 8564 } 8565 } else if (event.keyCode === 36 && event.ctrlKey) { 8566 // display the date picker on ctrl+home 8567 $.datepicker._showDatepicker(this); 8568 } else { 8569 handled = false; 8570 } 8571 8572 if (handled) { 8573 event.preventDefault(); 8574 event.stopPropagation(); 8575 } 8576 }, 8577 8578 /* Filter entered characters - based on date format. */ 8579 _doKeyPress: function (event) { 8580 var chars, 8581 chr, 8582 inst = $.datepicker._getInst(event.target); 8583 8584 if ($.datepicker._get(inst, "constrainInput")) { 8585 chars = $.datepicker._possibleChars( 8586 $.datepicker._get(inst, "dateFormat") 8587 ); 8588 chr = String.fromCharCode( 8589 event.charCode == null ? event.keyCode : event.charCode 8590 ); 8591 return ( 8592 event.ctrlKey || 8593 event.metaKey || 8594 chr < " " || 8595 !chars || 8596 chars.indexOf(chr) > -1 8597 ); 8598 } 8599 }, 8600 8601 /* Synchronise manual entry and field/alternate field. */ 8602 _doKeyUp: function (event) { 8603 var date, 8604 inst = $.datepicker._getInst(event.target); 8605 8606 if (inst.input.val() !== inst.lastVal) { 8607 try { 8608 date = $.datepicker.parseDate( 8609 $.datepicker._get(inst, "dateFormat"), 8610 inst.input ? inst.input.val() : null, 8611 $.datepicker._getFormatConfig(inst) 8612 ); 8613 8614 if (date) { 8615 // only if valid 8616 $.datepicker._setDateFromField(inst); 8617 $.datepicker._updateAlternate(inst); 8618 $.datepicker._updateDatepicker(inst); 8619 } 8620 } catch (err) {} 8621 } 8622 return true; 8623 }, 8624 8625 /* Pop-up the date picker for a given input field. 8626 * If false returned from beforeShow event handler do not show. 8627 * @param input element - the input field attached to the date picker or 8628 * event - if triggered by focus 8629 */ 8630 _showDatepicker: function (input) { 8631 input = input.target || input; 8632 if (input.nodeName.toLowerCase() !== "input") { 8633 // find from button/image trigger 8634 input = $("input", input.parentNode)[0]; 8635 } 8636 8637 if ( 8638 $.datepicker._isDisabledDatepicker(input) || 8639 $.datepicker._lastInput === input 8640 ) { 8641 // already here 8642 return; 8643 } 8644 8645 var inst, 8646 beforeShow, 8647 beforeShowSettings, 8648 isFixed, 8649 offset, 8650 showAnim, 8651 duration; 8652 8653 inst = $.datepicker._getInst(input); 8654 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 8655 $.datepicker._curInst.dpDiv.stop(true, true); 8656 if (inst && $.datepicker._datepickerShowing) { 8657 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 8658 } 8659 } 8660 8661 beforeShow = $.datepicker._get(inst, "beforeShow"); 8662 beforeShowSettings = beforeShow 8663 ? beforeShow.apply(input, [input, inst]) 8664 : {}; 8665 if (beforeShowSettings === false) { 8666 return; 8667 } 8668 datepicker_extendRemove(inst.settings, beforeShowSettings); 8669 8670 inst.lastVal = null; 8671 $.datepicker._lastInput = input; 8672 $.datepicker._setDateFromField(inst); 8673 8674 if ($.datepicker._inDialog) { 8675 // hide cursor 8676 input.value = ""; 8677 } 8678 if (!$.datepicker._pos) { 8679 // position below input 8680 $.datepicker._pos = $.datepicker._findPos(input); 8681 $.datepicker._pos[1] += input.offsetHeight; // add the height 8682 } 8683 8684 isFixed = false; 8685 $(input) 8686 .parents() 8687 .each(function () { 8688 isFixed |= $(this).css("position") === "fixed"; 8689 return !isFixed; 8690 }); 8691 8692 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 8693 $.datepicker._pos = null; 8694 8695 //to avoid flashes on Firefox 8696 inst.dpDiv.empty(); 8697 8698 // determine sizing offscreen 8699 inst.dpDiv.css({ 8700 position: "absolute", 8701 display: "block", 8702 top: "-1000px", 8703 }); 8704 $.datepicker._updateDatepicker(inst); 8705 8706 // fix width for dynamic number of date pickers 8707 // and adjust position before showing 8708 offset = $.datepicker._checkOffset(inst, offset, isFixed); 8709 inst.dpDiv.css({ 8710 position: 8711 $.datepicker._inDialog && $.blockUI 8712 ? "static" 8713 : isFixed 8714 ? "fixed" 8715 : "absolute", 8716 display: "none", 8717 left: offset.left + "px", 8718 top: offset.top + "px", 8719 }); 8720 8721 if (!inst.inline) { 8722 showAnim = $.datepicker._get(inst, "showAnim"); 8723 duration = $.datepicker._get(inst, "duration"); 8724 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 8725 $.datepicker._datepickerShowing = true; 8726 8727 if ($.effects && $.effects.effect[showAnim]) { 8728 inst.dpDiv.show( 8729 showAnim, 8730 $.datepicker._get(inst, "showOptions"), 8731 duration 8732 ); 8733 } else { 8734 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 8735 } 8736 8737 if ($.datepicker._shouldFocusInput(inst)) { 8738 inst.input.trigger("focus"); 8739 } 8740 8741 $.datepicker._curInst = inst; 8742 } 8743 }, 8744 8745 /* Generate the date picker content. */ 8746 _updateDatepicker: function (inst) { 8747 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 8748 datepicker_instActive = inst; // for delegate hover events 8749 inst.dpDiv.empty().append(this._generateHTML(inst)); 8750 this._attachHandlers(inst); 8751 8752 var origyearshtml, 8753 numMonths = this._getNumberOfMonths(inst), 8754 cols = numMonths[1], 8755 width = 17, 8756 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"), 8757 onUpdateDatepicker = $.datepicker._get(inst, "onUpdateDatepicker"); 8758 8759 if (activeCell.length > 0) { 8760 datepicker_handleMouseover.apply(activeCell.get(0)); 8761 } 8762 8763 inst.dpDiv 8764 .removeClass( 8765 "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" 8766 ) 8767 .width(""); 8768 if (cols > 1) { 8769 inst.dpDiv 8770 .addClass("ui-datepicker-multi-" + cols) 8771 .css("width", width * cols + "em"); 8772 } 8773 inst.dpDiv[ 8774 (numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + "Class" 8775 ]("ui-datepicker-multi"); 8776 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]( 8777 "ui-datepicker-rtl" 8778 ); 8779 8780 if ( 8781 inst === $.datepicker._curInst && 8782 $.datepicker._datepickerShowing && 8783 $.datepicker._shouldFocusInput(inst) 8784 ) { 8785 inst.input.trigger("focus"); 8786 } 8787 8788 // Deffered render of the years select (to avoid flashes on Firefox) 8789 if (inst.yearshtml) { 8790 origyearshtml = inst.yearshtml; 8791 setTimeout(function () { 8792 //assure that inst.yearshtml didn't change. 8793 if (origyearshtml === inst.yearshtml && inst.yearshtml) { 8794 inst.dpDiv 8795 .find("select.ui-datepicker-year") 8796 .first() 8797 .replaceWith(inst.yearshtml); 8798 } 8799 origyearshtml = inst.yearshtml = null; 8800 }, 0); 8801 } 8802 8803 if (onUpdateDatepicker) { 8804 onUpdateDatepicker.apply(inst.input ? inst.input[0] : null, [inst]); 8805 } 8806 }, 8807 8808 // #6694 - don't focus the input if it's already focused 8809 // this breaks the change event in IE 8810 // Support: IE and jQuery <1.9 8811 _shouldFocusInput: function (inst) { 8812 return ( 8813 inst.input && 8814 inst.input.is(":visible") && 8815 !inst.input.is(":disabled") && 8816 !inst.input.is(":focus") 8817 ); 8818 }, 8819 8820 /* Check positioning to remain on screen. */ 8821 _checkOffset: function (inst, offset, isFixed) { 8822 var dpWidth = inst.dpDiv.outerWidth(), 8823 dpHeight = inst.dpDiv.outerHeight(), 8824 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8825 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8826 viewWidth = 8827 document.documentElement.clientWidth + 8828 (isFixed ? 0 : $(document).scrollLeft()), 8829 viewHeight = 8830 document.documentElement.clientHeight + 8831 (isFixed ? 0 : $(document).scrollTop()); 8832 8833 offset.left -= this._get(inst, "isRTL") ? dpWidth - inputWidth : 0; 8834 offset.left -= 8835 isFixed && offset.left === inst.input.offset().left 8836 ? $(document).scrollLeft() 8837 : 0; 8838 offset.top -= 8839 isFixed && offset.top === inst.input.offset().top + inputHeight 8840 ? $(document).scrollTop() 8841 : 0; 8842 8843 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8844 offset.left -= Math.min( 8845 offset.left, 8846 offset.left + dpWidth > viewWidth && viewWidth > dpWidth 8847 ? Math.abs(offset.left + dpWidth - viewWidth) 8848 : 0 8849 ); 8850 offset.top -= Math.min( 8851 offset.top, 8852 offset.top + dpHeight > viewHeight && viewHeight > dpHeight 8853 ? Math.abs(dpHeight + inputHeight) 8854 : 0 8855 ); 8856 8857 return offset; 8858 }, 8859 8860 /* Find an object's position on the screen. */ 8861 _findPos: function (obj) { 8862 var position, 8863 inst = this._getInst(obj), 8864 isRTL = this._get(inst, "isRTL"); 8865 8866 while ( 8867 obj && 8868 (obj.type === "hidden" || 8869 obj.nodeType !== 1 || 8870 $.expr.pseudos.hidden(obj)) 8871 ) { 8872 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 8873 } 8874 8875 position = $(obj).offset(); 8876 return [position.left, position.top]; 8877 }, 8878 8879 /* Hide the date picker from view. 8880 * @param input element - the input field attached to the date picker 8881 */ 8882 _hideDatepicker: function (input) { 8883 var showAnim, 8884 duration, 8885 postProcess, 8886 onClose, 8887 inst = this._curInst; 8888 8889 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 8890 return; 8891 } 8892 8893 if (this._datepickerShowing) { 8894 showAnim = this._get(inst, "showAnim"); 8895 duration = this._get(inst, "duration"); 8896 postProcess = function () { 8897 $.datepicker._tidyDialog(inst); 8898 }; 8899 8900 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 8901 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 8902 inst.dpDiv.hide( 8903 showAnim, 8904 $.datepicker._get(inst, "showOptions"), 8905 duration, 8906 postProcess 8907 ); 8908 } else { 8909 inst.dpDiv[ 8910 showAnim === "slideDown" 8911 ? "slideUp" 8912 : showAnim === "fadeIn" 8913 ? "fadeOut" 8914 : "hide" 8915 ](showAnim ? duration : null, postProcess); 8916 } 8917 8918 if (!showAnim) { 8919 postProcess(); 8920 } 8921 this._datepickerShowing = false; 8922 8923 onClose = this._get(inst, "onClose"); 8924 if (onClose) { 8925 onClose.apply(inst.input ? inst.input[0] : null, [ 8926 inst.input ? inst.input.val() : "", 8927 inst, 8928 ]); 8929 } 8930 8931 this._lastInput = null; 8932 if (this._inDialog) { 8933 this._dialogInput.css({ 8934 position: "absolute", 8935 left: "0", 8936 top: "-100px", 8937 }); 8938 if ($.blockUI) { 8939 $.unblockUI(); 8940 $("body").append(this.dpDiv); 8941 } 8942 } 8943 this._inDialog = false; 8944 } 8945 }, 8946 8947 /* Tidy up after a dialog display. */ 8948 _tidyDialog: function (inst) { 8949 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 8950 }, 8951 8952 /* Close date picker if clicked elsewhere. */ 8953 _checkExternalClick: function (event) { 8954 if (!$.datepicker._curInst) { 8955 return; 8956 } 8957 8958 var $target = $(event.target), 8959 inst = $.datepicker._getInst($target[0]); 8960 8961 if ( 8962 ($target[0].id !== $.datepicker._mainDivId && 8963 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 8964 !$target.hasClass($.datepicker.markerClassName) && 8965 !$target.closest("." + $.datepicker._triggerClass).length && 8966 $.datepicker._datepickerShowing && 8967 !($.datepicker._inDialog && $.blockUI)) || 8968 ($target.hasClass($.datepicker.markerClassName) && 8969 $.datepicker._curInst !== inst) 8970 ) { 8971 $.datepicker._hideDatepicker(); 8972 } 8973 }, 8974 8975 /* Adjust one of the date sub-fields. */ 8976 _adjustDate: function (id, offset, period) { 8977 var target = $(id), 8978 inst = this._getInst(target[0]); 8979 8980 if (this._isDisabledDatepicker(target[0])) { 8981 return; 8982 } 8983 this._adjustInstDate(inst, offset, period); 8984 this._updateDatepicker(inst); 8985 }, 8986 8987 /* Action for current link. */ 8988 _gotoToday: function (id) { 8989 var date, 8990 target = $(id), 8991 inst = this._getInst(target[0]); 8992 8993 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 8994 inst.selectedDay = inst.currentDay; 8995 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8996 inst.drawYear = inst.selectedYear = inst.currentYear; 8997 } else { 8998 date = new Date(); 8999 inst.selectedDay = date.getDate(); 9000 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9001 inst.drawYear = inst.selectedYear = date.getFullYear(); 9002 } 9003 this._notifyChange(inst); 9004 this._adjustDate(target); 9005 }, 9006 9007 /* Action for selecting a new month/year. */ 9008 _selectMonthYear: function (id, select, period) { 9009 var target = $(id), 9010 inst = this._getInst(target[0]); 9011 9012 inst["selected" + (period === "M" ? "Month" : "Year")] = inst[ 9013 "draw" + (period === "M" ? "Month" : "Year") 9014 ] = parseInt(select.options[select.selectedIndex].value, 10); 9015 9016 this._notifyChange(inst); 9017 this._adjustDate(target); 9018 }, 9019 9020 /* Action for selecting a day. */ 9021 _selectDay: function (id, month, year, td) { 9022 var inst, 9023 target = $(id); 9024 9025 if ( 9026 $(td).hasClass(this._unselectableClass) || 9027 this._isDisabledDatepicker(target[0]) 9028 ) { 9029 return; 9030 } 9031 9032 inst = this._getInst(target[0]); 9033 inst.selectedDay = inst.currentDay = parseInt( 9034 $("a", td).attr("data-date") 9035 ); 9036 inst.selectedMonth = inst.currentMonth = month; 9037 inst.selectedYear = inst.currentYear = year; 9038 this._selectDate( 9039 id, 9040 this._formatDate( 9041 inst, 9042 inst.currentDay, 9043 inst.currentMonth, 9044 inst.currentYear 9045 ) 9046 ); 9047 }, 9048 9049 /* Erase the input field and hide the date picker. */ 9050 _clearDate: function (id) { 9051 var target = $(id); 9052 this._selectDate(target, ""); 9053 }, 9054 9055 /* Update the input field with the selected date. */ 9056 _selectDate: function (id, dateStr) { 9057 var onSelect, 9058 target = $(id), 9059 inst = this._getInst(target[0]); 9060 9061 dateStr = dateStr != null ? dateStr : this._formatDate(inst); 9062 if (inst.input) { 9063 inst.input.val(dateStr); 9064 } 9065 this._updateAlternate(inst); 9066 9067 onSelect = this._get(inst, "onSelect"); 9068 if (onSelect) { 9069 onSelect.apply(inst.input ? inst.input[0] : null, [dateStr, inst]); // trigger custom callback 9070 } else if (inst.input) { 9071 inst.input.trigger("change"); // fire the change event 9072 } 9073 9074 if (inst.inline) { 9075 this._updateDatepicker(inst); 9076 } else { 9077 this._hideDatepicker(); 9078 this._lastInput = inst.input[0]; 9079 if (typeof inst.input[0] !== "object") { 9080 inst.input.trigger("focus"); // restore focus 9081 } 9082 this._lastInput = null; 9083 } 9084 }, 9085 9086 /* Update any alternate field to synchronise with the main field. */ 9087 _updateAlternate: function (inst) { 9088 var altFormat, 9089 date, 9090 dateStr, 9091 altField = this._get(inst, "altField"); 9092 9093 if (altField) { 9094 // update alternate field too 9095 altFormat = 9096 this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 9097 date = this._getDate(inst); 9098 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 9099 $(document).find(altField).val(dateStr); 9100 } 9101 }, 9102 9103 /* Set as beforeShowDay function to prevent selection of weekends. 9104 * @param date Date - the date to customise 9105 * @return [boolean, string] - is this date selectable?, what is its CSS class? 9106 */ 9107 noWeekends: function (date) { 9108 var day = date.getDay(); 9109 return [day > 0 && day < 6, ""]; 9110 }, 9111 9112 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 9113 * @param date Date - the date to get the week for 9114 * @return number - the number of the week within the year that contains this date 9115 */ 9116 iso8601Week: function (date) { 9117 var time, 9118 checkDate = new Date(date.getTime()); 9119 9120 // Find Thursday of this week starting on Monday 9121 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 9122 9123 time = checkDate.getTime(); 9124 checkDate.setMonth(0); // Compare with Jan 1 9125 checkDate.setDate(1); 9126 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 9127 }, 9128 9129 /* Parse a string value into a date object. 9130 * See formatDate below for the possible formats. 9131 * 9132 * @param format string - the expected format of the date 9133 * @param value string - the date in the above format 9134 * @param settings Object - attributes include: 9135 * shortYearCutoff number - the cutoff year for determining the century (optional) 9136 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9137 * dayNames string[7] - names of the days from Sunday (optional) 9138 * monthNamesShort string[12] - abbreviated names of the months (optional) 9139 * monthNames string[12] - names of the months (optional) 9140 * @return Date - the extracted date value or null if value is blank 9141 */ 9142 parseDate: function (format, value, settings) { 9143 if (format == null || value == null) { 9144 throw "Invalid arguments"; 9145 } 9146 9147 value = typeof value === "object" ? value.toString() : value + ""; 9148 if (value === "") { 9149 return null; 9150 } 9151 9152 var iFormat, 9153 dim, 9154 extra, 9155 iValue = 0, 9156 shortYearCutoffTemp = 9157 (settings ? settings.shortYearCutoff : null) || 9158 this._defaults.shortYearCutoff, 9159 shortYearCutoff = 9160 typeof shortYearCutoffTemp !== "string" 9161 ? shortYearCutoffTemp 9162 : (new Date().getFullYear() % 100) + 9163 parseInt(shortYearCutoffTemp, 10), 9164 dayNamesShort = 9165 (settings ? settings.dayNamesShort : null) || 9166 this._defaults.dayNamesShort, 9167 dayNames = 9168 (settings ? settings.dayNames : null) || this._defaults.dayNames, 9169 monthNamesShort = 9170 (settings ? settings.monthNamesShort : null) || 9171 this._defaults.monthNamesShort, 9172 monthNames = 9173 (settings ? settings.monthNames : null) || this._defaults.monthNames, 9174 year = -1, 9175 month = -1, 9176 day = -1, 9177 doy = -1, 9178 literal = false, 9179 date, 9180 // Check whether a format character is doubled 9181 lookAhead = function (match) { 9182 var matches = 9183 iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; 9184 if (matches) { 9185 iFormat++; 9186 } 9187 return matches; 9188 }, 9189 // Extract a number from the string value 9190 getNumber = function (match) { 9191 var isDoubled = lookAhead(match), 9192 size = 9193 match === "@" 9194 ? 14 9195 : match === "!" 9196 ? 20 9197 : match === "y" && isDoubled 9198 ? 4 9199 : match === "o" 9200 ? 3 9201 : 2, 9202 minSize = match === "y" ? size : 1, 9203 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 9204 num = value.substring(iValue).match(digits); 9205 if (!num) { 9206 throw "Missing number at position " + iValue; 9207 } 9208 iValue += num[0].length; 9209 return parseInt(num[0], 10); 9210 }, 9211 // Extract a name from the string value and convert to an index 9212 getName = function (match, shortNames, longNames) { 9213 var index = -1, 9214 names = $.map( 9215 lookAhead(match) ? longNames : shortNames, 9216 function (v, k) { 9217 return [[k, v]]; 9218 } 9219 ).sort(function (a, b) { 9220 return -(a[1].length - b[1].length); 9221 }); 9222 9223 $.each(names, function (i, pair) { 9224 var name = pair[1]; 9225 if ( 9226 value.substr(iValue, name.length).toLowerCase() === 9227 name.toLowerCase() 9228 ) { 9229 index = pair[0]; 9230 iValue += name.length; 9231 return false; 9232 } 9233 }); 9234 if (index !== -1) { 9235 return index + 1; 9236 } else { 9237 throw "Unknown name at position " + iValue; 9238 } 9239 }, 9240 // Confirm that a literal character matches the string value 9241 checkLiteral = function () { 9242 if (value.charAt(iValue) !== format.charAt(iFormat)) { 9243 throw "Unexpected literal at position " + iValue; 9244 } 9245 iValue++; 9246 }; 9247 9248 for (iFormat = 0; iFormat < format.length; iFormat++) { 9249 if (literal) { 9250 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 9251 literal = false; 9252 } else { 9253 checkLiteral(); 9254 } 9255 } else { 9256 switch (format.charAt(iFormat)) { 9257 case "d": 9258 day = getNumber("d"); 9259 break; 9260 case "D": 9261 getName("D", dayNamesShort, dayNames); 9262 break; 9263 case "o": 9264 doy = getNumber("o"); 9265 break; 9266 case "m": 9267 month = getNumber("m"); 9268 break; 9269 case "M": 9270 month = getName("M", monthNamesShort, monthNames); 9271 break; 9272 case "y": 9273 year = getNumber("y"); 9274 break; 9275 case "@": 9276 date = new Date(getNumber("@")); 9277 year = date.getFullYear(); 9278 month = date.getMonth() + 1; 9279 day = date.getDate(); 9280 break; 9281 case "!": 9282 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 9283 year = date.getFullYear(); 9284 month = date.getMonth() + 1; 9285 day = date.getDate(); 9286 break; 9287 case "'": 9288 if (lookAhead("'")) { 9289 checkLiteral(); 9290 } else { 9291 literal = true; 9292 } 9293 break; 9294 default: 9295 checkLiteral(); 9296 } 9297 } 9298 } 9299 9300 if (iValue < value.length) { 9301 extra = value.substr(iValue); 9302 if (!/^\s+/.test(extra)) { 9303 throw "Extra/unparsed characters found in date: " + extra; 9304 } 9305 } 9306 9307 if (year === -1) { 9308 year = new Date().getFullYear(); 9309 } else if (year < 100) { 9310 year += 9311 new Date().getFullYear() - 9312 (new Date().getFullYear() % 100) + 9313 (year <= shortYearCutoff ? 0 : -100); 9314 } 9315 9316 if (doy > -1) { 9317 month = 1; 9318 day = doy; 9319 do { 9320 dim = this._getDaysInMonth(year, month - 1); 9321 if (day <= dim) { 9322 break; 9323 } 9324 month++; 9325 day -= dim; 9326 } while (true); 9327 } 9328 9329 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 9330 if ( 9331 date.getFullYear() !== year || 9332 date.getMonth() + 1 !== month || 9333 date.getDate() !== day 9334 ) { 9335 throw "Invalid date"; // E.g. 31/02/00 9336 } 9337 return date; 9338 }, 9339 9340 /* Standard date formats. */ 9341 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 9342 COOKIE: "D, dd M yy", 9343 ISO_8601: "yy-mm-dd", 9344 RFC_822: "D, d M y", 9345 RFC_850: "DD, dd-M-y", 9346 RFC_1036: "D, d M y", 9347 RFC_1123: "D, d M yy", 9348 RFC_2822: "D, d M yy", 9349 RSS: "D, d M y", // RFC 822 9350 TICKS: "!", 9351 TIMESTAMP: "@", 9352 W3C: "yy-mm-dd", // ISO 8601 9353 9354 _ticksTo1970: 9355 ((1970 - 1) * 365 + 9356 Math.floor(1970 / 4) - 9357 Math.floor(1970 / 100) + 9358 Math.floor(1970 / 400)) * 9359 24 * 9360 60 * 9361 60 * 9362 10000000, 9363 9364 /* Format a date object into a string value. 9365 * The format can be combinations of the following: 9366 * d - day of month (no leading zero) 9367 * dd - day of month (two digit) 9368 * o - day of year (no leading zeros) 9369 * oo - day of year (three digit) 9370 * D - day name short 9371 * DD - day name long 9372 * m - month of year (no leading zero) 9373 * mm - month of year (two digit) 9374 * M - month name short 9375 * MM - month name long 9376 * y - year (two digit) 9377 * yy - year (four digit) 9378 * @ - Unix timestamp (ms since 01/01/1970) 9379 * ! - Windows ticks (100ns since 01/01/0001) 9380 * "..." - literal text 9381 * '' - single quote 9382 * 9383 * @param format string - the desired format of the date 9384 * @param date Date - the date value to format 9385 * @param settings Object - attributes include: 9386 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 9387 * dayNames string[7] - names of the days from Sunday (optional) 9388 * monthNamesShort string[12] - abbreviated names of the months (optional) 9389 * monthNames string[12] - names of the months (optional) 9390 * @return string - the date in the above format 9391 */ 9392 formatDate: function (format, date, settings) { 9393 if (!date) { 9394 return ""; 9395 } 9396 9397 var iFormat, 9398 dayNamesShort = 9399 (settings ? settings.dayNamesShort : null) || 9400 this._defaults.dayNamesShort, 9401 dayNames = 9402 (settings ? settings.dayNames : null) || this._defaults.dayNames, 9403 monthNamesShort = 9404 (settings ? settings.monthNamesShort : null) || 9405 this._defaults.monthNamesShort, 9406 monthNames = 9407 (settings ? settings.monthNames : null) || this._defaults.monthNames, 9408 // Check whether a format character is doubled 9409 lookAhead = function (match) { 9410 var matches = 9411 iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; 9412 if (matches) { 9413 iFormat++; 9414 } 9415 return matches; 9416 }, 9417 // Format a number, with leading zero if necessary 9418 formatNumber = function (match, value, len) { 9419 var num = "" + value; 9420 if (lookAhead(match)) { 9421 while (num.length < len) { 9422 num = "0" + num; 9423 } 9424 } 9425 return num; 9426 }, 9427 // Format a name, short or long as requested 9428 formatName = function (match, value, shortNames, longNames) { 9429 return lookAhead(match) ? longNames[value] : shortNames[value]; 9430 }, 9431 output = "", 9432 literal = false; 9433 9434 if (date) { 9435 for (iFormat = 0; iFormat < format.length; iFormat++) { 9436 if (literal) { 9437 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 9438 literal = false; 9439 } else { 9440 output += format.charAt(iFormat); 9441 } 9442 } else { 9443 switch (format.charAt(iFormat)) { 9444 case "d": 9445 output += formatNumber("d", date.getDate(), 2); 9446 break; 9447 case "D": 9448 output += formatName( 9449 "D", 9450 date.getDay(), 9451 dayNamesShort, 9452 dayNames 9453 ); 9454 break; 9455 case "o": 9456 output += formatNumber( 9457 "o", 9458 Math.round( 9459 (new Date( 9460 date.getFullYear(), 9461 date.getMonth(), 9462 date.getDate() 9463 ).getTime() - 9464 new Date(date.getFullYear(), 0, 0).getTime()) / 9465 86400000 9466 ), 9467 3 9468 ); 9469 break; 9470 case "m": 9471 output += formatNumber("m", date.getMonth() + 1, 2); 9472 break; 9473 case "M": 9474 output += formatName( 9475 "M", 9476 date.getMonth(), 9477 monthNamesShort, 9478 monthNames 9479 ); 9480 break; 9481 case "y": 9482 output += lookAhead("y") 9483 ? date.getFullYear() 9484 : (date.getFullYear() % 100 < 10 ? "0" : "") + 9485 (date.getFullYear() % 100); 9486 break; 9487 case "@": 9488 output += date.getTime(); 9489 break; 9490 case "!": 9491 output += date.getTime() * 10000 + this._ticksTo1970; 9492 break; 9493 case "'": 9494 if (lookAhead("'")) { 9495 output += "'"; 9496 } else { 9497 literal = true; 9498 } 9499 break; 9500 default: 9501 output += format.charAt(iFormat); 9502 } 9503 } 9504 } 9505 } 9506 return output; 9507 }, 9508 9509 /* Extract all possible characters from the date format. */ 9510 _possibleChars: function (format) { 9511 var iFormat, 9512 chars = "", 9513 literal = false, 9514 // Check whether a format character is doubled 9515 lookAhead = function (match) { 9516 var matches = 9517 iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; 9518 if (matches) { 9519 iFormat++; 9520 } 9521 return matches; 9522 }; 9523 9524 for (iFormat = 0; iFormat < format.length; iFormat++) { 9525 if (literal) { 9526 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 9527 literal = false; 9528 } else { 9529 chars += format.charAt(iFormat); 9530 } 9531 } else { 9532 switch (format.charAt(iFormat)) { 9533 case "d": 9534 case "m": 9535 case "y": 9536 case "@": 9537 chars += "0123456789"; 9538 break; 9539 case "D": 9540 case "M": 9541 return null; // Accept anything 9542 case "'": 9543 if (lookAhead("'")) { 9544 chars += "'"; 9545 } else { 9546 literal = true; 9547 } 9548 break; 9549 default: 9550 chars += format.charAt(iFormat); 9551 } 9552 } 9553 } 9554 return chars; 9555 }, 9556 9557 /* Get a setting value, defaulting if necessary. */ 9558 _get: function (inst, name) { 9559 return inst.settings[name] !== undefined 9560 ? inst.settings[name] 9561 : this._defaults[name]; 9562 }, 9563 9564 /* Parse existing date and initialise date picker. */ 9565 _setDateFromField: function (inst, noDefault) { 9566 if (inst.input.val() === inst.lastVal) { 9567 return; 9568 } 9569 9570 var dateFormat = this._get(inst, "dateFormat"), 9571 dates = (inst.lastVal = inst.input ? inst.input.val() : null), 9572 defaultDate = this._getDefaultDate(inst), 9573 date = defaultDate, 9574 settings = this._getFormatConfig(inst); 9575 9576 try { 9577 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 9578 } catch (event) { 9579 dates = noDefault ? "" : dates; 9580 } 9581 inst.selectedDay = date.getDate(); 9582 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9583 inst.drawYear = inst.selectedYear = date.getFullYear(); 9584 inst.currentDay = dates ? date.getDate() : 0; 9585 inst.currentMonth = dates ? date.getMonth() : 0; 9586 inst.currentYear = dates ? date.getFullYear() : 0; 9587 this._adjustInstDate(inst); 9588 }, 9589 9590 /* Retrieve the default date shown on opening. */ 9591 _getDefaultDate: function (inst) { 9592 return this._restrictMinMax( 9593 inst, 9594 this._determineDate(inst, this._get(inst, "defaultDate"), new Date()) 9595 ); 9596 }, 9597 9598 /* A date may be specified as an exact value or a relative one. */ 9599 _determineDate: function (inst, date, defaultDate) { 9600 var offsetNumeric = function (offset) { 9601 var date = new Date(); 9602 date.setDate(date.getDate() + offset); 9603 return date; 9604 }, 9605 offsetString = function (offset) { 9606 try { 9607 return $.datepicker.parseDate( 9608 $.datepicker._get(inst, "dateFormat"), 9609 offset, 9610 $.datepicker._getFormatConfig(inst) 9611 ); 9612 } catch (e) { 9613 // Ignore 9614 } 9615 9616 var date = 9617 (offset.toLowerCase().match(/^c/) 9618 ? $.datepicker._getDate(inst) 9619 : null) || new Date(), 9620 year = date.getFullYear(), 9621 month = date.getMonth(), 9622 day = date.getDate(), 9623 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 9624 matches = pattern.exec(offset); 9625 9626 while (matches) { 9627 switch (matches[2] || "d") { 9628 case "d": 9629 case "D": 9630 day += parseInt(matches[1], 10); 9631 break; 9632 case "w": 9633 case "W": 9634 day += parseInt(matches[1], 10) * 7; 9635 break; 9636 case "m": 9637 case "M": 9638 month += parseInt(matches[1], 10); 9639 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 9640 break; 9641 case "y": 9642 case "Y": 9643 year += parseInt(matches[1], 10); 9644 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 9645 break; 9646 } 9647 matches = pattern.exec(offset); 9648 } 9649 return new Date(year, month, day); 9650 }, 9651 newDate = 9652 date == null || date === "" 9653 ? defaultDate 9654 : typeof date === "string" 9655 ? offsetString(date) 9656 : typeof date === "number" 9657 ? isNaN(date) 9658 ? defaultDate 9659 : offsetNumeric(date) 9660 : new Date(date.getTime()); 9661 9662 newDate = 9663 newDate && newDate.toString() === "Invalid Date" 9664 ? defaultDate 9665 : newDate; 9666 if (newDate) { 9667 newDate.setHours(0); 9668 newDate.setMinutes(0); 9669 newDate.setSeconds(0); 9670 newDate.setMilliseconds(0); 9671 } 9672 return this._daylightSavingAdjust(newDate); 9673 }, 9674 9675 /* Handle switch to/from daylight saving. 9676 * Hours may be non-zero on daylight saving cut-over: 9677 * > 12 when midnight changeover, but then cannot generate 9678 * midnight datetime, so jump to 1AM, otherwise reset. 9679 * @param date (Date) the date to check 9680 * @return (Date) the corrected date 9681 */ 9682 _daylightSavingAdjust: function (date) { 9683 if (!date) { 9684 return null; 9685 } 9686 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 9687 return date; 9688 }, 9689 9690 /* Set the date(s) directly. */ 9691 _setDate: function (inst, date, noChange) { 9692 var clear = !date, 9693 origMonth = inst.selectedMonth, 9694 origYear = inst.selectedYear, 9695 newDate = this._restrictMinMax( 9696 inst, 9697 this._determineDate(inst, date, new Date()) 9698 ); 9699 9700 inst.selectedDay = inst.currentDay = newDate.getDate(); 9701 inst.drawMonth = 9702 inst.selectedMonth = 9703 inst.currentMonth = 9704 newDate.getMonth(); 9705 inst.drawYear = 9706 inst.selectedYear = 9707 inst.currentYear = 9708 newDate.getFullYear(); 9709 if ( 9710 (origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && 9711 !noChange 9712 ) { 9713 this._notifyChange(inst); 9714 } 9715 this._adjustInstDate(inst); 9716 if (inst.input) { 9717 inst.input.val(clear ? "" : this._formatDate(inst)); 9718 } 9719 }, 9720 9721 /* Retrieve the date(s) directly. */ 9722 _getDate: function (inst) { 9723 var startDate = 9724 !inst.currentYear || (inst.input && inst.input.val() === "") 9725 ? null 9726 : this._daylightSavingAdjust( 9727 new Date(inst.currentYear, inst.currentMonth, inst.currentDay) 9728 ); 9729 return startDate; 9730 }, 9731 9732 /* Attach the onxxx handlers. These are declared statically so 9733 * they work with static code transformers like Caja. 9734 */ 9735 _attachHandlers: function (inst) { 9736 var stepMonths = this._get(inst, "stepMonths"), 9737 id = "#" + inst.id.replace(/\\\\/g, "\\");
vendor: 8,904 bytes, lines 9738-10027
9738 inst.dpDiv.find("[data-handler]").map(function () { 9739 var handler = { 9740 prev: function () { 9741 $.datepicker._adjustDate(id, -stepMonths, "M"); 9742 }, 9743 next: function () { 9744 $.datepicker._adjustDate(id, +stepMonths, "M"); 9745 }, 9746 hide: function () { 9747 $.datepicker._hideDatepicker(); 9748 }, 9749 today: function () { 9750 $.datepicker._gotoToday(id); 9751 }, 9752 selectDay: function () { 9753 $.datepicker._selectDay( 9754 id, 9755 +this.getAttribute("data-month"), 9756 +this.getAttribute("data-year"), 9757 this 9758 ); 9759 return false; 9760 }, 9761 selectMonth: function () { 9762 $.datepicker._selectMonthYear(id, this, "M"); 9763 return false; 9764 }, 9765 selectYear: function () { 9766 $.datepicker._selectMonthYear(id, this, "Y"); 9767 return false; 9768 }, 9769 }; 9770 $(this).on( 9771 this.getAttribute("data-event"), 9772 handler[this.getAttribute("data-handler")] 9773 ); 9774 }); 9775 }, 9776 9777 /* Generate the HTML for the current state of the date picker. */ 9778 _generateHTML: function (inst) { 9779 var maxDraw, 9780 prevText, 9781 prev, 9782 nextText, 9783 next, 9784 currentText, 9785 gotoDate, 9786 controls, 9787 buttonPanel, 9788 firstDay, 9789 showWeek, 9790 dayNames, 9791 dayNamesMin, 9792 monthNames, 9793 monthNamesShort, 9794 beforeShowDay, 9795 showOtherMonths, 9796 selectOtherMonths, 9797 defaultDate, 9798 html, 9799 dow, 9800 row, 9801 group, 9802 col, 9803 selectedDate, 9804 cornerClass, 9805 calender, 9806 thead, 9807 day, 9808 daysInMonth, 9809 leadDays, 9810 curRows, 9811 numRows, 9812 printDate, 9813 dRow, 9814 tbody, 9815 daySettings, 9816 otherMonth, 9817 unselectable, 9818 tempDate = new Date(), 9819 today = this._daylightSavingAdjust( 9820 new Date( 9821 tempDate.getFullYear(), 9822 tempDate.getMonth(), 9823 tempDate.getDate() 9824 ) 9825 ), // clear time 9826 isRTL = this._get(inst, "isRTL"), 9827 showButtonPanel = this._get(inst, "showButtonPanel"), 9828 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 9829 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 9830 numMonths = this._getNumberOfMonths(inst), 9831 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 9832 stepMonths = this._get(inst, "stepMonths"), 9833 isMultiMonth = numMonths[0] !== 1 || numMonths[1] !== 1, 9834 currentDate = this._daylightSavingAdjust( 9835 !inst.currentDay 9836 ? new Date(9999, 9, 9) 9837 : new Date(inst.currentYear, inst.currentMonth, inst.currentDay) 9838 ), 9839 minDate = this._getMinMaxDate(inst, "min"), 9840 maxDate = this._getMinMaxDate(inst, "max"), 9841 drawMonth = inst.drawMonth - showCurrentAtPos, 9842 drawYear = inst.drawYear; 9843 9844 if (drawMonth < 0) { 9845 drawMonth += 12; 9846 drawYear--; 9847 } 9848 if (maxDate) { 9849 maxDraw = this._daylightSavingAdjust( 9850 new Date( 9851 maxDate.getFullYear(), 9852 maxDate.getMonth() - numMonths[0] * numMonths[1] + 1, 9853 maxDate.getDate() 9854 ) 9855 ); 9856 maxDraw = minDate && maxDraw < minDate ? minDate : maxDraw; 9857 while ( 9858 this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw 9859 ) { 9860 drawMonth--; 9861 if (drawMonth < 0) { 9862 drawMonth = 11; 9863 drawYear--; 9864 } 9865 } 9866 } 9867 inst.drawMonth = drawMonth; 9868 inst.drawYear = drawYear; 9869 9870 prevText = this._get(inst, "prevText"); 9871 prevText = !navigationAsDateFormat 9872 ? prevText 9873 : this.formatDate( 9874 prevText, 9875 this._daylightSavingAdjust( 9876 new Date(drawYear, drawMonth - stepMonths, 1) 9877 ), 9878 this._getFormatConfig(inst) 9879 ); 9880 9881 if (this._canAdjustMonth(inst, -1, drawYear, drawMonth)) { 9882 prev = $("<a>") 9883 .attr({ 9884 class: "ui-datepicker-prev ui-corner-all", 9885 "data-handler": "prev", 9886 "data-event": "click", 9887 title: prevText, 9888 }) 9889 .append( 9890 $("<span>") 9891 .addClass( 9892 "ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") 9893 ) 9894 .text(prevText) 9895 )[0].outerHTML; 9896 } else if (hideIfNoPrevNext) { 9897 prev = ""; 9898 } else { 9899 prev = $("<a>") 9900 .attr({ 9901 class: "ui-datepicker-prev ui-corner-all ui-state-disabled", 9902 title: prevText, 9903 }) 9904 .append( 9905 $("<span>") 9906 .addClass( 9907 "ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") 9908 ) 9909 .text(prevText) 9910 )[0].outerHTML; 9911 } 9912 9913 nextText = this._get(inst, "nextText"); 9914 nextText = !navigationAsDateFormat 9915 ? nextText 9916 : this.formatDate( 9917 nextText, 9918 this._daylightSavingAdjust( 9919 new Date(drawYear, drawMonth + stepMonths, 1) 9920 ), 9921 this._getFormatConfig(inst) 9922 ); 9923 9924 if (this._canAdjustMonth(inst, +1, drawYear, drawMonth)) { 9925 next = $("<a>") 9926 .attr({ 9927 class: "ui-datepicker-next ui-corner-all", 9928 "data-handler": "next", 9929 "data-event": "click", 9930 title: nextText, 9931 }) 9932 .append( 9933 $("<span>") 9934 .addClass( 9935 "ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") 9936 ) 9937 .text(nextText) 9938 )[0].outerHTML; 9939 } else if (hideIfNoPrevNext) { 9940 next = ""; 9941 } else { 9942 next = $("<a>") 9943 .attr({ 9944 class: "ui-datepicker-next ui-corner-all ui-state-disabled", 9945 title: nextText, 9946 }) 9947 .append( 9948 $("<span>") 9949 .attr( 9950 "class", 9951 "ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") 9952 ) 9953 .text(nextText) 9954 )[0].outerHTML; 9955 } 9956 9957 currentText = this._get(inst, "currentText"); 9958 gotoDate = 9959 this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today; 9960 currentText = !navigationAsDateFormat 9961 ? currentText 9962 : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)); 9963 9964 controls = ""; 9965 if (!inst.inline) { 9966 controls = $("<button>") 9967 .attr({ 9968 type: "button", 9969 class: 9970 "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 9971 "data-handler": "hide", 9972 "data-event": "click", 9973 }) 9974 .text(this._get(inst, "closeText"))[0].outerHTML; 9975 } 9976 9977 buttonPanel = ""; 9978 if (showButtonPanel) { 9979 buttonPanel = $( 9980 "<div class='ui-datepicker-buttonpane ui-widget-content'>" 9981 ) 9982 .append(isRTL ? controls : "") 9983 .append( 9984 this._isInRange(inst, gotoDate) 9985 ? $("<button>") 9986 .attr({ 9987 type: "button", 9988 class: 9989 "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 9990 "data-handler": "today", 9991 "data-event": "click", 9992 }) 9993 .text(currentText) 9994 : "" 9995 ) 9996 .append(isRTL ? "" : controls)[0].outerHTML; 9997 } 9998 9999 firstDay = parseInt(this._get(inst, "firstDay"), 10); 10000 firstDay = isNaN(firstDay) ? 0 : firstDay; 10001 10002 showWeek = this._get(inst, "showWeek"); 10003 dayNames = this._get(inst, "dayNames"); 10004 dayNamesMin = this._get(inst, "dayNamesMin"); 10005 monthNames = this._get(inst, "monthNames"); 10006 monthNamesShort = this._get(inst, "monthNamesShort"); 10007 beforeShowDay = this._get(inst, "beforeShowDay"); 10008 showOtherMonths = this._get(inst, "showOtherMonths"); 10009 selectOtherMonths = this._get(inst, "selectOtherMonths"); 10010 defaultDate = this._getDefaultDate(inst); 10011 html = ""; 10012 10013 for (row = 0; row < numMonths[0]; row++) { 10014 group = ""; 10015 this.maxRows = 4; 10016 for (col = 0; col < numMonths[1]; col++) { 10017 selectedDate = this._daylightSavingAdjust( 10018 new Date(drawYear, drawMonth, inst.selectedDay) 10019 ); 10020 cornerClass = " ui-corner-all"; 10021 calender = ""; 10022 if (isMultiMonth) { 10023 calender += "<div class='ui-datepicker-group"; 10024 if (numMonths[1] > 1) { 10025 switch (col) { 10026 case 0: 10027 calender += " ui-datepicker-group-first";
vendor: 20,167 bytes, lines 10028-10599
10028 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); 10029 break; 10030 case numMonths[1] - 1: 10031 calender += " ui-datepicker-group-last"; 10032 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); 10033 break; 10034 default: 10035 calender += " ui-datepicker-group-middle"; 10036 cornerClass = ""; 10037 break; 10038 } 10039 } 10040 calender += "'>"; 10041 } 10042 calender += 10043 "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + 10044 cornerClass + 10045 "'>" + 10046 (/all|left/.test(cornerClass) && row === 0 10047 ? isRTL 10048 ? next 10049 : prev 10050 : "") + 10051 (/all|right/.test(cornerClass) && row === 0 10052 ? isRTL 10053 ? prev 10054 : next 10055 : "") + 10056 this._generateMonthYearHeader( 10057 inst, 10058 drawMonth, 10059 drawYear, 10060 minDate, 10061 maxDate, 10062 row > 0 || col > 0, 10063 monthNames, 10064 monthNamesShort 10065 ) + // draw month headers 10066 "</div><table class='ui-datepicker-calendar'><thead>" + 10067 "<tr>"; 10068 thead = showWeek 10069 ? "<th class='ui-datepicker-week-col'>" + 10070 this._get(inst, "weekHeader") + 10071 "</th>" 10072 : ""; 10073 for (dow = 0; dow < 7; dow++) { 10074 // days of the week 10075 day = (dow + firstDay) % 7; 10076 thead += 10077 "<th scope='col'" + 10078 ((dow + firstDay + 6) % 7 >= 5 10079 ? " class='ui-datepicker-week-end'" 10080 : "") + 10081 ">" + 10082 "<span title='" + 10083 dayNames[day] + 10084 "'>" + 10085 dayNamesMin[day] + 10086 "</span></th>"; 10087 } 10088 calender += thead + "</tr></thead><tbody>"; 10089 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 10090 if ( 10091 drawYear === inst.selectedYear && 10092 drawMonth === inst.selectedMonth 10093 ) { 10094 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 10095 } 10096 leadDays = 10097 (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 10098 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 10099 numRows = isMultiMonth 10100 ? this.maxRows > curRows 10101 ? this.maxRows 10102 : curRows 10103 : curRows; //If multiple months, use the higher number of rows (see #7043) 10104 this.maxRows = numRows; 10105 printDate = this._daylightSavingAdjust( 10106 new Date(drawYear, drawMonth, 1 - leadDays) 10107 ); 10108 for (dRow = 0; dRow < numRows; dRow++) { 10109 // create date picker rows 10110 calender += "<tr>"; 10111 tbody = !showWeek 10112 ? "" 10113 : "<td class='ui-datepicker-week-col'>" + 10114 this._get(inst, "calculateWeek")(printDate) + 10115 "</td>"; 10116 for (dow = 0; dow < 7; dow++) { 10117 // create date picker days 10118 daySettings = beforeShowDay 10119 ? beforeShowDay.apply(inst.input ? inst.input[0] : null, [ 10120 printDate, 10121 ]) 10122 : [true, ""]; 10123 otherMonth = printDate.getMonth() !== drawMonth; 10124 unselectable = 10125 (otherMonth && !selectOtherMonths) || 10126 !daySettings[0] || 10127 (minDate && printDate < minDate) || 10128 (maxDate && printDate > maxDate); 10129 tbody += 10130 "<td class='" + 10131 ((dow + firstDay + 6) % 7 >= 5 10132 ? " ui-datepicker-week-end" 10133 : "") + // highlight weekends 10134 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 10135 ((printDate.getTime() === selectedDate.getTime() && 10136 drawMonth === inst.selectedMonth && 10137 inst._keyEvent) || // user pressed key 10138 (defaultDate.getTime() === printDate.getTime() && 10139 defaultDate.getTime() === selectedDate.getTime()) 10140 ? // or defaultDate is current printedDate and defaultDate is selectedDate 10141 " " + this._dayOverClass 10142 : "") + // highlight selected day 10143 (unselectable 10144 ? " " + this._unselectableClass + " ui-state-disabled" 10145 : "") + // highlight unselectable days 10146 (otherMonth && !showOtherMonths 10147 ? "" 10148 : " " + 10149 daySettings[1] + // highlight custom dates 10150 (printDate.getTime() === currentDate.getTime() 10151 ? " " + this._currentClass 10152 : "") + // highlight selected day 10153 (printDate.getTime() === today.getTime() 10154 ? " ui-datepicker-today" 10155 : "")) + 10156 "'" + // highlight today (if different) 10157 ((!otherMonth || showOtherMonths) && daySettings[2] 10158 ? " title='" + daySettings[2].replace(/'/g, "'") + "'" 10159 : "") + // cell title 10160 (unselectable 10161 ? "" 10162 : " data-handler='selectDay' data-event='click' data-month='" + 10163 printDate.getMonth() + 10164 "' data-year='" + 10165 printDate.getFullYear() + 10166 "'") + 10167 ">" + // actions 10168 (otherMonth && !showOtherMonths 10169 ? " " // display for other months 10170 : unselectable 10171 ? "<span class='ui-state-default'>" + 10172 printDate.getDate() + 10173 "</span>" 10174 : "<a class='ui-state-default" + 10175 (printDate.getTime() === today.getTime() 10176 ? " ui-state-highlight" 10177 : "") + 10178 (printDate.getTime() === currentDate.getTime() 10179 ? " ui-state-active" 10180 : "") + // highlight selected day 10181 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 10182 "' href='#' aria-current='" + 10183 (printDate.getTime() === currentDate.getTime() 10184 ? "true" 10185 : "false") + // mark date as selected for screen reader 10186 "' data-date='" + 10187 printDate.getDate() + // store date as data 10188 "'>" + 10189 printDate.getDate() + 10190 "</a>") + 10191 "</td>"; // display selectable date 10192 printDate.setDate(printDate.getDate() + 1); 10193 printDate = this._daylightSavingAdjust(printDate); 10194 } 10195 calender += tbody + "</tr>"; 10196 } 10197 drawMonth++; 10198 if (drawMonth > 11) { 10199 drawMonth = 0; 10200 drawYear++; 10201 } 10202 calender += 10203 "</tbody></table>" + 10204 (isMultiMonth 10205 ? "</div>" + 10206 (numMonths[0] > 0 && col === numMonths[1] - 1 10207 ? "<div class='ui-datepicker-row-break'></div>" 10208 : "") 10209 : ""); 10210 group += calender; 10211 } 10212 html += group; 10213 } 10214 html += buttonPanel; 10215 inst._keyEvent = false; 10216 return html; 10217 }, 10218 10219 /* Generate the month and year header. */ 10220 _generateMonthYearHeader: function ( 10221 inst, 10222 drawMonth, 10223 drawYear, 10224 minDate, 10225 maxDate, 10226 secondary, 10227 monthNames, 10228 monthNamesShort 10229 ) { 10230 var inMinYear, 10231 inMaxYear, 10232 month, 10233 years, 10234 thisYear, 10235 determineYear, 10236 year, 10237 endYear, 10238 changeMonth = this._get(inst, "changeMonth"), 10239 changeYear = this._get(inst, "changeYear"), 10240 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 10241 selectMonthLabel = this._get(inst, "selectMonthLabel"), 10242 selectYearLabel = this._get(inst, "selectYearLabel"), 10243 html = "<div class='ui-datepicker-title'>", 10244 monthHtml = ""; 10245 10246 // Month selection 10247 if (secondary || !changeMonth) { 10248 monthHtml += 10249 "<span class='ui-datepicker-month'>" + 10250 monthNames[drawMonth] + 10251 "</span>"; 10252 } else { 10253 inMinYear = minDate && minDate.getFullYear() === drawYear; 10254 inMaxYear = maxDate && maxDate.getFullYear() === drawYear; 10255 monthHtml += 10256 "<select class='ui-datepicker-month' aria-label='" + 10257 selectMonthLabel + 10258 "' data-handler='selectMonth' data-event='change'>"; 10259 for (month = 0; month < 12; month++) { 10260 if ( 10261 (!inMinYear || month >= minDate.getMonth()) && 10262 (!inMaxYear || month <= maxDate.getMonth()) 10263 ) { 10264 monthHtml += 10265 "<option value='" + 10266 month + 10267 "'" + 10268 (month === drawMonth ? " selected='selected'" : "") + 10269 ">" + 10270 monthNamesShort[month] + 10271 "</option>"; 10272 } 10273 } 10274 monthHtml += "</select>"; 10275 } 10276 10277 if (!showMonthAfterYear) { 10278 html += 10279 monthHtml + 10280 (secondary || !(changeMonth && changeYear) ? " " : ""); 10281 } 10282 10283 // Year selection 10284 if (!inst.yearshtml) { 10285 inst.yearshtml = ""; 10286 if (secondary || !changeYear) { 10287 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 10288 } else { 10289 // determine range of years to display 10290 years = this._get(inst, "yearRange").split(":"); 10291 thisYear = new Date().getFullYear(); 10292 determineYear = function (value) { 10293 var year = value.match(/c[+\-].*/) 10294 ? drawYear + parseInt(value.substring(1), 10) 10295 : value.match(/[+\-].*/) 10296 ? thisYear + parseInt(value, 10) 10297 : parseInt(value, 10); 10298 return isNaN(year) ? thisYear : year; 10299 }; 10300 year = determineYear(years[0]); 10301 endYear = Math.max(year, determineYear(years[1] || "")); 10302 year = minDate ? Math.max(year, minDate.getFullYear()) : year; 10303 endYear = maxDate 10304 ? Math.min(endYear, maxDate.getFullYear()) 10305 : endYear; 10306 inst.yearshtml += 10307 "<select class='ui-datepicker-year' aria-label='" + 10308 selectYearLabel + 10309 "' data-handler='selectYear' data-event='change'>"; 10310 for (; year <= endYear; year++) { 10311 inst.yearshtml += 10312 "<option value='" + 10313 year + 10314 "'" + 10315 (year === drawYear ? " selected='selected'" : "") + 10316 ">" + 10317 year + 10318 "</option>"; 10319 } 10320 inst.yearshtml += "</select>"; 10321 10322 html += inst.yearshtml; 10323 inst.yearshtml = null; 10324 } 10325 } 10326 10327 html += this._get(inst, "yearSuffix"); 10328 if (showMonthAfterYear) { 10329 html += 10330 (secondary || !(changeMonth && changeYear) ? " " : "") + 10331 monthHtml; 10332 } 10333 html += "</div>"; // Close datepicker_header 10334 return html; 10335 }, 10336 10337 /* Adjust one of the date sub-fields. */ 10338 _adjustInstDate: function (inst, offset, period) { 10339 var year = inst.selectedYear + (period === "Y" ? offset : 0), 10340 month = inst.selectedMonth + (period === "M" ? offset : 0), 10341 day = 10342 Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + 10343 (period === "D" ? offset : 0), 10344 date = this._restrictMinMax( 10345 inst, 10346 this._daylightSavingAdjust(new Date(year, month, day)) 10347 ); 10348 10349 inst.selectedDay = date.getDate(); 10350 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10351 inst.drawYear = inst.selectedYear = date.getFullYear(); 10352 if (period === "M" || period === "Y") { 10353 this._notifyChange(inst); 10354 } 10355 }, 10356 10357 /* Ensure a date is within any min/max bounds. */ 10358 _restrictMinMax: function (inst, date) { 10359 var minDate = this._getMinMaxDate(inst, "min"), 10360 maxDate = this._getMinMaxDate(inst, "max"), 10361 newDate = minDate && date < minDate ? minDate : date; 10362 return maxDate && newDate > maxDate ? maxDate : newDate; 10363 }, 10364 10365 /* Notify change of month/year. */ 10366 _notifyChange: function (inst) { 10367 var onChange = this._get(inst, "onChangeMonthYear"); 10368 if (onChange) { 10369 onChange.apply(inst.input ? inst.input[0] : null, [ 10370 inst.selectedYear, 10371 inst.selectedMonth + 1, 10372 inst, 10373 ]); 10374 } 10375 }, 10376 10377 /* Determine the number of months to show. */ 10378 _getNumberOfMonths: function (inst) { 10379 var numMonths = this._get(inst, "numberOfMonths"); 10380 return numMonths == null 10381 ? [1, 1] 10382 : typeof numMonths === "number" 10383 ? [1, numMonths] 10384 : numMonths; 10385 }, 10386 10387 /* Determine the current maximum date - ensure no time components are set. */ 10388 _getMinMaxDate: function (inst, minMax) { 10389 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 10390 }, 10391 10392 /* Find the number of days in a given month. */ 10393 _getDaysInMonth: function (year, month) { 10394 return ( 10395 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate() 10396 ); 10397 }, 10398 10399 /* Find the day of the week of the first of a month. */ 10400 _getFirstDayOfMonth: function (year, month) { 10401 return new Date(year, month, 1).getDay(); 10402 }, 10403 10404 /* Determines if we should allow a "next/prev" month display change. */ 10405 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 10406 var numMonths = this._getNumberOfMonths(inst), 10407 date = this._daylightSavingAdjust( 10408 new Date( 10409 curYear, 10410 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 10411 1 10412 ) 10413 ); 10414 10415 if (offset < 0) { 10416 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 10417 } 10418 return this._isInRange(inst, date); 10419 }, 10420 10421 /* Is the given date in the accepted range? */ 10422 _isInRange: function (inst, date) { 10423 var yearSplit, 10424 currentYear, 10425 minDate = this._getMinMaxDate(inst, "min"), 10426 maxDate = this._getMinMaxDate(inst, "max"), 10427 minYear = null, 10428 maxYear = null, 10429 years = this._get(inst, "yearRange"); 10430 if (years) { 10431 yearSplit = years.split(":"); 10432 currentYear = new Date().getFullYear(); 10433 minYear = parseInt(yearSplit[0], 10); 10434 maxYear = parseInt(yearSplit[1], 10); 10435 if (yearSplit[0].match(/[+\-].*/)) { 10436 minYear += currentYear; 10437 } 10438 if (yearSplit[1].match(/[+\-].*/)) { 10439 maxYear += currentYear; 10440 } 10441 } 10442 10443 return ( 10444 (!minDate || date.getTime() >= minDate.getTime()) && 10445 (!maxDate || date.getTime() <= maxDate.getTime()) && 10446 (!minYear || date.getFullYear() >= minYear) && 10447 (!maxYear || date.getFullYear() <= maxYear) 10448 ); 10449 }, 10450 10451 /* Provide the configuration settings for formatting/parsing. */ 10452 _getFormatConfig: function (inst) { 10453 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 10454 shortYearCutoff = 10455 typeof shortYearCutoff !== "string" 10456 ? shortYearCutoff 10457 : (new Date().getFullYear() % 100) + parseInt(shortYearCutoff, 10); 10458 return { 10459 shortYearCutoff: shortYearCutoff, 10460 dayNamesShort: this._get(inst, "dayNamesShort"), 10461 dayNames: this._get(inst, "dayNames"), 10462 monthNamesShort: this._get(inst, "monthNamesShort"), 10463 monthNames: this._get(inst, "monthNames"), 10464 }; 10465 }, 10466 10467 /* Format the given date for display. */ 10468 _formatDate: function (inst, day, month, year) { 10469 if (!day) { 10470 inst.currentDay = inst.selectedDay; 10471 inst.currentMonth = inst.selectedMonth; 10472 inst.currentYear = inst.selectedYear; 10473 } 10474 var date = day 10475 ? typeof day === "object" 10476 ? day 10477 : this._daylightSavingAdjust(new Date(year, month, day)) 10478 : this._daylightSavingAdjust( 10479 new Date(inst.currentYear, inst.currentMonth, inst.currentDay) 10480 ); 10481 return this.formatDate( 10482 this._get(inst, "dateFormat"), 10483 date, 10484 this._getFormatConfig(inst) 10485 ); 10486 }, 10487 }); 10488 10489 /* 10490 * Bind hover events for datepicker elements. 10491 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 10492 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 10493 */ 10494 function datepicker_bindHover(dpDiv) { 10495 var selector = 10496 "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 10497 return dpDiv 10498 .on("mouseout", selector, function () { 10499 $(this).removeClass("ui-state-hover"); 10500 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 10501 $(this).removeClass("ui-datepicker-prev-hover"); 10502 } 10503 if (this.className.indexOf("ui-datepicker-next") !== -1) { 10504 $(this).removeClass("ui-datepicker-next-hover"); 10505 } 10506 }) 10507 .on("mouseover", selector, datepicker_handleMouseover); 10508 } 10509 10510 function datepicker_handleMouseover() { 10511 if ( 10512 !$.datepicker._isDisabledDatepicker( 10513 datepicker_instActive.inline 10514 ? datepicker_instActive.dpDiv.parent()[0] 10515 : datepicker_instActive.input[0] 10516 ) 10517 ) { 10518 $(this) 10519 .parents(".ui-datepicker-calendar") 10520 .find("a") 10521 .removeClass("ui-state-hover"); 10522 $(this).addClass("ui-state-hover"); 10523 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 10524 $(this).addClass("ui-datepicker-prev-hover"); 10525 } 10526 if (this.className.indexOf("ui-datepicker-next") !== -1) { 10527 $(this).addClass("ui-datepicker-next-hover"); 10528 } 10529 } 10530 } 10531 10532 /* jQuery extend now ignores nulls! */ 10533 function datepicker_extendRemove(target, props) { 10534 $.extend(target, props); 10535 for (var name in props) { 10536 if (props[name] == null) { 10537 target[name] = props[name]; 10538 } 10539 } 10540 return target; 10541 } 10542 10543 /* Invoke the datepicker functionality. 10544 @param options string - a command, optionally followed by additional parameters or 10545 Object - settings for attaching new datepicker functionality 10546 @return jQuery object */ 10547 $.fn.datepicker = function (options) { 10548 /* Verify an empty collection wasn't passed - Fixes #6976 */ 10549 if (!this.length) { 10550 return this; 10551 } 10552 10553 /* Initialise the date picker. */ 10554 if (!$.datepicker.initialized) { 10555 $(document).on("mousedown", $.datepicker._checkExternalClick); 10556 $.datepicker.initialized = true; 10557 } 10558 10559 /* Append datepicker main container to body if not exist. */ 10560 if ($("#" + $.datepicker._mainDivId).length === 0) { 10561 $("body").append($.datepicker.dpDiv); 10562 } 10563 10564 var otherArgs = Array.prototype.slice.call(arguments, 1); 10565 if ( 10566 typeof options === "string" && 10567 (options === "isDisabled" || 10568 options === "getDate" || 10569 options === "widget") 10570 ) { 10571 return $.datepicker["_" + options + "Datepicker"].apply( 10572 $.datepicker, 10573 [this[0]].concat(otherArgs) 10574 ); 10575 } 10576 if ( 10577 options === "option" && 10578 arguments.length === 2 && 10579 typeof arguments[1] === "string" 10580 ) { 10581 return $.datepicker["_" + options + "Datepicker"].apply( 10582 $.datepicker, 10583 [this[0]].concat(otherArgs) 10584 ); 10585 } 10586 return this.each(function () { 10587 if (typeof options === "string") { 10588 $.datepicker["_" + options + "Datepicker"].apply( 10589 $.datepicker, 10590 [this].concat(otherArgs) 10591 ); 10592 } else { 10593 $.datepicker._attachDatepicker(this, options); 10594 } 10595 }); 10596 }; 10597 10598 $.datepicker = new Datepicker(); // singleton instance 10599 $.datepicker.initialized = false;
vendor: 13,293 bytes, lines 10600-11071
10600 $.datepicker.uuid = new Date().getTime(); 10601 $.datepicker.version = "1.13.3"; 10602 10603 var widgetsDatepicker = $.datepicker; 10604 10605 // This file is deprecated 10606 var ie = ($.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase())); 10607 10608 /*! 10609 * jQuery UI Mouse 1.13.3 10610 * https://jqueryui.com 10611 * 10612 * Copyright OpenJS Foundation and other contributors 10613 * Released under the MIT license. 10614 * https://jquery.org/license 10615 */ 10616 10617 //>>label: Mouse 10618 //>>group: Widgets 10619 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 10620 //>>docs: https://api.jqueryui.com/mouse/ 10621 10622 var mouseHandled = false; 10623 $(document).on("mouseup", function () { 10624 mouseHandled = false; 10625 }); 10626 10627 var widgetsMouse = $.widget("ui.mouse", { 10628 version: "1.13.3", 10629 options: { 10630 cancel: "input, textarea, button, select, option", 10631 distance: 1, 10632 delay: 0, 10633 }, 10634 _mouseInit: function () { 10635 var that = this; 10636 10637 this.element 10638 .on("mousedown." + this.widgetName, function (event) { 10639 return that._mouseDown(event); 10640 }) 10641 .on("click." + this.widgetName, function (event) { 10642 if ( 10643 true === 10644 $.data(event.target, that.widgetName + ".preventClickEvent") 10645 ) { 10646 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 10647 event.stopImmediatePropagation(); 10648 return false; 10649 } 10650 }); 10651 10652 this.started = false; 10653 }, 10654 10655 // TODO: make sure destroying one instance of mouse doesn't mess with 10656 // other instances of mouse 10657 _mouseDestroy: function () { 10658 this.element.off("." + this.widgetName); 10659 if (this._mouseMoveDelegate) { 10660 this.document 10661 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 10662 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 10663 } 10664 }, 10665 10666 _mouseDown: function (event) { 10667 // don't let more than one widget handle mouseStart 10668 if (mouseHandled) { 10669 return; 10670 } 10671 10672 this._mouseMoved = false; 10673 10674 // We may have missed mouseup (out of window) 10675 if (this._mouseStarted) { 10676 this._mouseUp(event); 10677 } 10678 10679 this._mouseDownEvent = event; 10680 10681 var that = this, 10682 btnIsLeft = event.which === 1, 10683 // event.target.nodeName works around a bug in IE 8 with 10684 // disabled inputs (#7620) 10685 elIsCancel = 10686 typeof this.options.cancel === "string" && event.target.nodeName 10687 ? $(event.target).closest(this.options.cancel).length 10688 : false; 10689 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 10690 return true; 10691 } 10692 10693 this.mouseDelayMet = !this.options.delay; 10694 if (!this.mouseDelayMet) { 10695 this._mouseDelayTimer = setTimeout(function () { 10696 that.mouseDelayMet = true; 10697 }, this.options.delay); 10698 } 10699 10700 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 10701 this._mouseStarted = this._mouseStart(event) !== false; 10702 if (!this._mouseStarted) { 10703 event.preventDefault(); 10704 return true; 10705 } 10706 } 10707 10708 // Click event may never have fired (Gecko & Opera) 10709 if ( 10710 true === $.data(event.target, this.widgetName + ".preventClickEvent") 10711 ) { 10712 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 10713 } 10714 10715 // These delegates are required to keep context 10716 this._mouseMoveDelegate = function (event) { 10717 return that._mouseMove(event); 10718 }; 10719 this._mouseUpDelegate = function (event) { 10720 return that._mouseUp(event); 10721 }; 10722 10723 this.document 10724 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 10725 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 10726 10727 event.preventDefault(); 10728 10729 mouseHandled = true; 10730 return true; 10731 }, 10732 10733 _mouseMove: function (event) { 10734 // Only check for mouseups outside the document if you've moved inside the document 10735 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 10736 // fire a mousemove event if content is placed under the cursor. See #7778 10737 // Support: IE <9 10738 if (this._mouseMoved) { 10739 // IE mouseup check - mouseup happened when mouse was out of window 10740 if ( 10741 $.ui.ie && 10742 (!document.documentMode || document.documentMode < 9) && 10743 !event.button 10744 ) { 10745 return this._mouseUp(event); 10746 10747 // Iframe mouseup check - mouseup occurred in another document 10748 } else if (!event.which) { 10749 // Support: Safari <=8 - 9 10750 // Safari sets which to 0 if you press any of the following keys 10751 // during a drag (#14461) 10752 if ( 10753 event.originalEvent.altKey || 10754 event.originalEvent.ctrlKey || 10755 event.originalEvent.metaKey || 10756 event.originalEvent.shiftKey 10757 ) { 10758 this.ignoreMissingWhich = true; 10759 } else if (!this.ignoreMissingWhich) { 10760 return this._mouseUp(event); 10761 } 10762 } 10763 } 10764 10765 if (event.which || event.button) { 10766 this._mouseMoved = true; 10767 } 10768 10769 if (this._mouseStarted) { 10770 this._mouseDrag(event); 10771 return event.preventDefault(); 10772 } 10773 10774 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 10775 this._mouseStarted = 10776 this._mouseStart(this._mouseDownEvent, event) !== false; 10777 if (this._mouseStarted) { 10778 this._mouseDrag(event); 10779 } else { 10780 this._mouseUp(event); 10781 } 10782 } 10783 10784 return !this._mouseStarted; 10785 }, 10786 10787 _mouseUp: function (event) { 10788 this.document 10789 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 10790 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 10791 10792 if (this._mouseStarted) { 10793 this._mouseStarted = false; 10794 10795 if (event.target === this._mouseDownEvent.target) { 10796 $.data(event.target, this.widgetName + ".preventClickEvent", true); 10797 } 10798 10799 this._mouseStop(event); 10800 } 10801 10802 if (this._mouseDelayTimer) { 10803 clearTimeout(this._mouseDelayTimer); 10804 delete this._mouseDelayTimer; 10805 } 10806 10807 this.ignoreMissingWhich = false; 10808 mouseHandled = false; 10809 event.preventDefault(); 10810 }, 10811 10812 _mouseDistanceMet: function (event) { 10813 return ( 10814 Math.max( 10815 Math.abs(this._mouseDownEvent.pageX - event.pageX), 10816 Math.abs(this._mouseDownEvent.pageY - event.pageY) 10817 ) >= this.options.distance 10818 ); 10819 }, 10820 10821 _mouseDelayMet: function (/* event */) { 10822 return this.mouseDelayMet; 10823 }, 10824 10825 // These are placeholder methods, to be overriden by extending plugin 10826 _mouseStart: function (/* event */) {}, 10827 _mouseDrag: function (/* event */) {}, 10828 _mouseStop: function (/* event */) {}, 10829 _mouseCapture: function (/* event */) { 10830 return true; 10831 }, 10832 }); 10833 10834 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 10835 var plugin = ($.ui.plugin = { 10836 add: function (module, option, set) { 10837 var i, 10838 proto = $.ui[module].prototype; 10839 for (i in set) { 10840 proto.plugins[i] = proto.plugins[i] || []; 10841 proto.plugins[i].push([option, set[i]]); 10842 } 10843 }, 10844 call: function (instance, name, args, allowDisconnected) { 10845 var i, 10846 set = instance.plugins[name]; 10847 10848 if (!set) { 10849 return; 10850 } 10851 10852 if ( 10853 !allowDisconnected && 10854 (!instance.element[0].parentNode || 10855 instance.element[0].parentNode.nodeType === 11) 10856 ) { 10857 return; 10858 } 10859 10860 for (i = 0; i < set.length; i++) { 10861 if (instance.options[set[i][0]]) { 10862 set[i][1].apply(instance.element, args); 10863 } 10864 } 10865 }, 10866 }); 10867 10868 var safeBlur = ($.ui.safeBlur = function (element) { 10869 // Support: IE9 - 10 only 10870 // If the <body> is blurred, IE will switch windows, see #9420 10871 if (element && element.nodeName.toLowerCase() !== "body") { 10872 $(element).trigger("blur"); 10873 } 10874 }); 10875 10876 /*! 10877 * jQuery UI Draggable 1.13.3 10878 * https://jqueryui.com 10879 * 10880 * Copyright OpenJS Foundation and other contributors 10881 * Released under the MIT license. 10882 * https://jquery.org/license 10883 */ 10884 10885 //>>label: Draggable 10886 //>>group: Interactions 10887 //>>description: Enables dragging functionality for any element. 10888 //>>docs: https://api.jqueryui.com/draggable/ 10889 //>>demos: https://jqueryui.com/draggable/ 10890 //>>css.structure: ../../themes/base/draggable.css 10891 10892 $.widget("ui.draggable", $.ui.mouse, { 10893 version: "1.13.3", 10894 widgetEventPrefix: "drag", 10895 options: { 10896 addClasses: true, 10897 appendTo: "parent", 10898 axis: false, 10899 connectToSortable: false, 10900 containment: false, 10901 cursor: "auto", 10902 cursorAt: false, 10903 grid: false, 10904 handle: false, 10905 helper: "original", 10906 iframeFix: false, 10907 opacity: false, 10908 refreshPositions: false, 10909 revert: false, 10910 revertDuration: 500, 10911 scope: "default", 10912 scroll: true, 10913 scrollSensitivity: 20, 10914 scrollSpeed: 20, 10915 snap: false, 10916 snapMode: "both", 10917 snapTolerance: 20, 10918 stack: false, 10919 zIndex: false, 10920 10921 // Callbacks 10922 drag: null, 10923 start: null, 10924 stop: null, 10925 }, 10926 _create: function () { 10927 if (this.options.helper === "original") { 10928 this._setPositionRelative(); 10929 } 10930 if (this.options.addClasses) { 10931 this._addClass("ui-draggable"); 10932 } 10933 this._setHandleClassName(); 10934 10935 this._mouseInit(); 10936 }, 10937 10938 _setOption: function (key, value) { 10939 this._super(key, value); 10940 if (key === "handle") { 10941 this._removeHandleClassName(); 10942 this._setHandleClassName(); 10943 } 10944 }, 10945 10946 _destroy: function () { 10947 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 10948 this.destroyOnClear = true; 10949 return; 10950 } 10951 this._removeHandleClassName(); 10952 this._mouseDestroy(); 10953 }, 10954 10955 _mouseCapture: function (event) { 10956 var o = this.options; 10957 10958 // Among others, prevent a drag on a resizable-handle 10959 if ( 10960 this.helper || 10961 o.disabled || 10962 $(event.target).closest(".ui-resizable-handle").length > 0 10963 ) { 10964 return false; 10965 } 10966 10967 //Quit if we're not on a valid handle 10968 this.handle = this._getHandle(event); 10969 if (!this.handle) { 10970 return false; 10971 } 10972 10973 this._blurActiveElement(event); 10974 10975 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 10976 10977 return true; 10978 }, 10979 10980 _blockFrames: function (selector) { 10981 this.iframeBlocks = this.document.find(selector).map(function () { 10982 var iframe = $(this); 10983 10984 return $("<div>") 10985 .css("position", "absolute") 10986 .appendTo(iframe.parent()) 10987 .outerWidth(iframe.outerWidth()) 10988 .outerHeight(iframe.outerHeight()) 10989 .offset(iframe.offset())[0]; 10990 }); 10991 }, 10992 10993 _unblockFrames: function () { 10994 if (this.iframeBlocks) { 10995 this.iframeBlocks.remove(); 10996 delete this.iframeBlocks; 10997 } 10998 }, 10999 11000 _blurActiveElement: function (event) { 11001 var activeElement = $.ui.safeActiveElement(this.document[0]), 11002 target = $(event.target); 11003 11004 // Don't blur if the event occurred on an element that is within 11005 // the currently focused element 11006 // See #10527, #12472 11007 if (target.closest(activeElement).length) { 11008 return; 11009 } 11010 11011 // Blur any element that currently has focus, see #4261 11012 $.ui.safeBlur(activeElement); 11013 }, 11014 11015 _mouseStart: function (event) { 11016 var o = this.options; 11017 11018 //Create and append the visible helper 11019 this.helper = this._createHelper(event); 11020 11021 this._addClass(this.helper, "ui-draggable-dragging"); 11022 11023 //Cache the helper size 11024 this._cacheHelperProportions(); 11025 11026 //If ddmanager is used for droppables, set the global draggable 11027 if ($.ui.ddmanager) { 11028 $.ui.ddmanager.current = this; 11029 } 11030 11031 /* 11032 * - Position generation - 11033 * This block generates everything position related - it's the core of draggables. 11034 */ 11035 11036 //Cache the margins of the original element 11037 this._cacheMargins(); 11038 11039 //Store the helper's css position 11040 this.cssPosition = this.helper.css("position"); 11041 this.scrollParent = this.helper.scrollParent(true); 11042 this.offsetParent = this.helper.offsetParent(); 11043 this.hasFixedAncestor = 11044 this.helper.parents().filter(function () { 11045 return $(this).css("position") === "fixed"; 11046 }).length > 0; 11047 11048 //The element's absolute position on the page minus margins 11049 this.positionAbs = this.element.offset(); 11050 this._refreshOffsets(event); 11051 11052 //Generate the original position 11053 this.originalPosition = this.position = this._generatePosition( 11054 event, 11055 false 11056 ); 11057 this.originalPageX = event.pageX; 11058 this.originalPageY = event.pageY; 11059 11060 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 11061 if (o.cursorAt) { 11062 this._adjustOffsetFromHelper(o.cursorAt); 11063 } 11064 11065 //Set a containment if given in the options 11066 this._setContainment(); 11067 11068 //Trigger event + callbacks 11069 if (this._trigger("start", event) === false) { 11070 this._clear(); 11071 return false;
vendor: 31,599 bytes, lines 11072-12043
11072 } 11073 11074 //Recache the helper size 11075 this._cacheHelperProportions(); 11076 11077 //Prepare the droppable offsets 11078 if ($.ui.ddmanager && !o.dropBehaviour) { 11079 $.ui.ddmanager.prepareOffsets(this, event); 11080 } 11081 11082 // Execute the drag once - this causes the helper not to be visible before getting its 11083 // correct position 11084 this._mouseDrag(event, true); 11085 11086 // If the ddmanager is used for droppables, inform the manager that dragging has started 11087 // (see #5003) 11088 if ($.ui.ddmanager) { 11089 $.ui.ddmanager.dragStart(this, event); 11090 } 11091 11092 return true; 11093 }, 11094 11095 _refreshOffsets: function (event) { 11096 this.offset = { 11097 top: this.positionAbs.top - this.margins.top, 11098 left: this.positionAbs.left - this.margins.left, 11099 scroll: false, 11100 parent: this._getParentOffset(), 11101 relative: this._getRelativeOffset(), 11102 }; 11103 11104 this.offset.click = { 11105 left: event.pageX - this.offset.left, 11106 top: event.pageY - this.offset.top, 11107 }; 11108 }, 11109 11110 _mouseDrag: function (event, noPropagation) { 11111 // reset any necessary cached properties (see #5009) 11112 if (this.hasFixedAncestor) { 11113 this.offset.parent = this._getParentOffset(); 11114 } 11115 11116 //Compute the helpers position 11117 this.position = this._generatePosition(event, true); 11118 this.positionAbs = this._convertPositionTo("absolute"); 11119 11120 //Call plugins and callbacks and use the resulting position if something is returned 11121 if (!noPropagation) { 11122 var ui = this._uiHash(); 11123 if (this._trigger("drag", event, ui) === false) { 11124 this._mouseUp(new $.Event("mouseup", event)); 11125 return false; 11126 } 11127 this.position = ui.position; 11128 } 11129 11130 this.helper[0].style.left = this.position.left + "px"; 11131 this.helper[0].style.top = this.position.top + "px"; 11132 11133 if ($.ui.ddmanager) { 11134 $.ui.ddmanager.drag(this, event); 11135 } 11136 11137 return false; 11138 }, 11139 11140 _mouseStop: function (event) { 11141 //If we are using droppables, inform the manager about the drop 11142 var that = this, 11143 dropped = false; 11144 if ($.ui.ddmanager && !this.options.dropBehaviour) { 11145 dropped = $.ui.ddmanager.drop(this, event); 11146 } 11147 11148 //if a drop comes from outside (a sortable) 11149 if (this.dropped) { 11150 dropped = this.dropped; 11151 this.dropped = false; 11152 } 11153 11154 if ( 11155 (this.options.revert === "invalid" && !dropped) || 11156 (this.options.revert === "valid" && dropped) || 11157 this.options.revert === true || 11158 (typeof this.options.revert === "function" && 11159 this.options.revert.call(this.element, dropped)) 11160 ) { 11161 $(this.helper).animate( 11162 this.originalPosition, 11163 parseInt(this.options.revertDuration, 10), 11164 function () { 11165 if (that._trigger("stop", event) !== false) { 11166 that._clear(); 11167 } 11168 } 11169 ); 11170 } else { 11171 if (this._trigger("stop", event) !== false) { 11172 this._clear(); 11173 } 11174 } 11175 11176 return false; 11177 }, 11178 11179 _mouseUp: function (event) { 11180 this._unblockFrames(); 11181 11182 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 11183 // (see #5003) 11184 if ($.ui.ddmanager) { 11185 $.ui.ddmanager.dragStop(this, event); 11186 } 11187 11188 // Only need to focus if the event occurred on the draggable itself, see #10527 11189 if (this.handleElement.is(event.target)) { 11190 // The interaction is over; whether or not the click resulted in a drag, 11191 // focus the element 11192 this.element.trigger("focus"); 11193 } 11194 11195 return $.ui.mouse.prototype._mouseUp.call(this, event); 11196 }, 11197 11198 cancel: function () { 11199 if (this.helper.is(".ui-draggable-dragging")) { 11200 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 11201 } else { 11202 this._clear(); 11203 } 11204 11205 return this; 11206 }, 11207 11208 _getHandle: function (event) { 11209 return this.options.handle 11210 ? !!$(event.target).closest(this.element.find(this.options.handle)) 11211 .length 11212 : true; 11213 }, 11214 11215 _setHandleClassName: function () { 11216 this.handleElement = this.options.handle 11217 ? this.element.find(this.options.handle) 11218 : this.element; 11219 this._addClass(this.handleElement, "ui-draggable-handle"); 11220 }, 11221 11222 _removeHandleClassName: function () { 11223 this._removeClass(this.handleElement, "ui-draggable-handle"); 11224 }, 11225 11226 _createHelper: function (event) { 11227 var o = this.options, 11228 helperIsFunction = typeof o.helper === "function", 11229 helper = helperIsFunction 11230 ? $(o.helper.apply(this.element[0], [event])) 11231 : o.helper === "clone" 11232 ? this.element.clone().removeAttr("id") 11233 : this.element; 11234 11235 if (!helper.parents("body").length) { 11236 helper.appendTo( 11237 o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo 11238 ); 11239 } 11240 11241 // https://bugs.jqueryui.com/ticket/9446 11242 // a helper function can return the original element 11243 // which wouldn't have been set to relative in _create 11244 if (helperIsFunction && helper[0] === this.element[0]) { 11245 this._setPositionRelative(); 11246 } 11247 11248 if ( 11249 helper[0] !== this.element[0] && 11250 !/(fixed|absolute)/.test(helper.css("position")) 11251 ) { 11252 helper.css("position", "absolute"); 11253 } 11254 11255 return helper; 11256 }, 11257 11258 _setPositionRelative: function () { 11259 if (!/^(?:r|a|f)/.test(this.element.css("position"))) { 11260 this.element[0].style.position = "relative"; 11261 } 11262 }, 11263 11264 _adjustOffsetFromHelper: function (obj) { 11265 if (typeof obj === "string") { 11266 obj = obj.split(" "); 11267 } 11268 if (Array.isArray(obj)) { 11269 obj = { left: +obj[0], top: +obj[1] || 0 }; 11270 } 11271 if ("left" in obj) { 11272 this.offset.click.left = obj.left + this.margins.left; 11273 } 11274 if ("right" in obj) { 11275 this.offset.click.left = 11276 this.helperProportions.width - obj.right + this.margins.left; 11277 } 11278 if ("top" in obj) { 11279 this.offset.click.top = obj.top + this.margins.top; 11280 } 11281 if ("bottom" in obj) { 11282 this.offset.click.top = 11283 this.helperProportions.height - obj.bottom + this.margins.top; 11284 } 11285 }, 11286 11287 _isRootNode: function (element) { 11288 return ( 11289 /(html|body)/i.test(element.tagName) || element === this.document[0] 11290 ); 11291 }, 11292 11293 _getParentOffset: function () { 11294 //Get the offsetParent and cache its position 11295 var po = this.offsetParent.offset(), 11296 document = this.document[0]; 11297 11298 // This is a special case where we need to modify a offset calculated on start, since the 11299 // following happened: 11300 // 1. The position of the helper is absolute, so it's position is calculated based on the 11301 // next positioned parent 11302 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 11303 // the document, which means that the scroll is included in the initial calculation of the 11304 // offset of the parent, and never recalculated upon drag 11305 if ( 11306 this.cssPosition === "absolute" && 11307 this.scrollParent[0] !== document && 11308 $.contains(this.scrollParent[0], this.offsetParent[0]) 11309 ) { 11310 po.left += this.scrollParent.scrollLeft(); 11311 po.top += this.scrollParent.scrollTop(); 11312 } 11313 11314 if (this._isRootNode(this.offsetParent[0])) { 11315 po = { top: 0, left: 0 }; 11316 } 11317 11318 return { 11319 top: 11320 po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 11321 left: 11322 po.left + 11323 (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0), 11324 }; 11325 }, 11326 11327 _getRelativeOffset: function () { 11328 if (this.cssPosition !== "relative") { 11329 return { top: 0, left: 0 }; 11330 } 11331 11332 var p = this.element.position(), 11333 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 11334 11335 return { 11336 top: 11337 p.top - 11338 (parseInt(this.helper.css("top"), 10) || 0) + 11339 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 11340 left: 11341 p.left - 11342 (parseInt(this.helper.css("left"), 10) || 0) + 11343 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0), 11344 }; 11345 }, 11346 11347 _cacheMargins: function () { 11348 this.margins = { 11349 left: parseInt(this.element.css("marginLeft"), 10) || 0, 11350 top: parseInt(this.element.css("marginTop"), 10) || 0, 11351 right: parseInt(this.element.css("marginRight"), 10) || 0, 11352 bottom: parseInt(this.element.css("marginBottom"), 10) || 0, 11353 }; 11354 }, 11355 11356 _cacheHelperProportions: function () { 11357 this.helperProportions = { 11358 width: this.helper.outerWidth(), 11359 height: this.helper.outerHeight(), 11360 }; 11361 }, 11362 11363 _setContainment: function () { 11364 var isUserScrollable, 11365 c, 11366 ce, 11367 o = this.options, 11368 document = this.document[0]; 11369 11370 this.relativeContainer = null; 11371 11372 if (!o.containment) { 11373 this.containment = null; 11374 return; 11375 } 11376 11377 if (o.containment === "window") { 11378 this.containment = [ 11379 $(window).scrollLeft() - 11380 this.offset.relative.left - 11381 this.offset.parent.left, 11382 $(window).scrollTop() - 11383 this.offset.relative.top - 11384 this.offset.parent.top, 11385 $(window).scrollLeft() + 11386 $(window).width() - 11387 this.helperProportions.width - 11388 this.margins.left, 11389 $(window).scrollTop() + 11390 ($(window).height() || document.body.parentNode.scrollHeight) - 11391 this.helperProportions.height - 11392 this.margins.top, 11393 ]; 11394 return; 11395 } 11396 11397 if (o.containment === "document") { 11398 this.containment = [ 11399 0, 11400 0, 11401 $(document).width() - 11402 this.helperProportions.width - 11403 this.margins.left, 11404 ($(document).height() || document.body.parentNode.scrollHeight) - 11405 this.helperProportions.height - 11406 this.margins.top, 11407 ]; 11408 return; 11409 } 11410 11411 if (o.containment.constructor === Array) { 11412 this.containment = o.containment; 11413 return; 11414 } 11415 11416 if (o.containment === "parent") { 11417 o.containment = this.helper[0].parentNode; 11418 } 11419 11420 c = $(o.containment); 11421 ce = c[0]; 11422 11423 if (!ce) { 11424 return; 11425 } 11426 11427 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 11428 11429 this.containment = [ 11430 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 11431 (parseInt(c.css("paddingLeft"), 10) || 0), 11432 (parseInt(c.css("borderTopWidth"), 10) || 0) + 11433 (parseInt(c.css("paddingTop"), 10) || 0), 11434 (isUserScrollable 11435 ? Math.max(ce.scrollWidth, ce.offsetWidth) 11436 : ce.offsetWidth) - 11437 (parseInt(c.css("borderRightWidth"), 10) || 0) - 11438 (parseInt(c.css("paddingRight"), 10) || 0) - 11439 this.helperProportions.width - 11440 this.margins.left - 11441 this.margins.right, 11442 (isUserScrollable 11443 ? Math.max(ce.scrollHeight, ce.offsetHeight) 11444 : ce.offsetHeight) - 11445 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 11446 (parseInt(c.css("paddingBottom"), 10) || 0) - 11447 this.helperProportions.height - 11448 this.margins.top - 11449 this.margins.bottom, 11450 ]; 11451 this.relativeContainer = c; 11452 }, 11453 11454 _convertPositionTo: function (d, pos) { 11455 if (!pos) { 11456 pos = this.position; 11457 } 11458 11459 var mod = d === "absolute" ? 1 : -1, 11460 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 11461 11462 return { 11463 top: 11464 // The absolute mouse position 11465 pos.top + 11466 // Only for relative positioned nodes: Relative offset from element to offset parent 11467 this.offset.relative.top * mod + 11468 // The offsetParent's offset without borders (offset + border) 11469 this.offset.parent.top * mod - 11470 (this.cssPosition === "fixed" 11471 ? -this.offset.scroll.top 11472 : scrollIsRootNode 11473 ? 0 11474 : this.offset.scroll.top) * 11475 mod, 11476 left: 11477 // The absolute mouse position 11478 pos.left + 11479 // Only for relative positioned nodes: Relative offset from element to offset parent 11480 this.offset.relative.left * mod + 11481 // The offsetParent's offset without borders (offset + border) 11482 this.offset.parent.left * mod - 11483 (this.cssPosition === "fixed" 11484 ? -this.offset.scroll.left 11485 : scrollIsRootNode 11486 ? 0 11487 : this.offset.scroll.left) * 11488 mod, 11489 }; 11490 }, 11491 11492 _generatePosition: function (event, constrainPosition) { 11493 var containment, 11494 co, 11495 top, 11496 left, 11497 o = this.options, 11498 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 11499 pageX = event.pageX, 11500 pageY = event.pageY; 11501 11502 // Cache the scroll 11503 if (!scrollIsRootNode || !this.offset.scroll) { 11504 this.offset.scroll = { 11505 top: this.scrollParent.scrollTop(), 11506 left: this.scrollParent.scrollLeft(), 11507 }; 11508 } 11509 11510 /* 11511 * - Position constraining - 11512 * Constrain the position to a mix of grid, containment. 11513 */ 11514 11515 // If we are not dragging yet, we won't check for options 11516 if (constrainPosition) { 11517 if (this.containment) { 11518 if (this.relativeContainer) { 11519 co = this.relativeContainer.offset(); 11520 containment = [ 11521 this.containment[0] + co.left, 11522 this.containment[1] + co.top, 11523 this.containment[2] + co.left, 11524 this.containment[3] + co.top, 11525 ]; 11526 } else { 11527 containment = this.containment; 11528 } 11529 11530 if (event.pageX - this.offset.click.left < containment[0]) { 11531 pageX = containment[0] + this.offset.click.left; 11532 } 11533 if (event.pageY - this.offset.click.top < containment[1]) { 11534 pageY = containment[1] + this.offset.click.top; 11535 } 11536 if (event.pageX - this.offset.click.left > containment[2]) { 11537 pageX = containment[2] + this.offset.click.left; 11538 } 11539 if (event.pageY - this.offset.click.top > containment[3]) { 11540 pageY = containment[3] + this.offset.click.top; 11541 } 11542 } 11543 11544 if (o.grid) { 11545 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 11546 // argument errors in IE (see ticket #6950) 11547 top = o.grid[1] 11548 ? this.originalPageY + 11549 Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] 11550 : this.originalPageY; 11551 pageY = containment 11552 ? top - this.offset.click.top >= containment[1] || 11553 top - this.offset.click.top > containment[3] 11554 ? top 11555 : top - this.offset.click.top >= containment[1] 11556 ? top - o.grid[1] 11557 : top + o.grid[1] 11558 : top; 11559 11560 left = o.grid[0] 11561 ? this.originalPageX + 11562 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] 11563 : this.originalPageX; 11564 pageX = containment 11565 ? left - this.offset.click.left >= containment[0] || 11566 left - this.offset.click.left > containment[2] 11567 ? left 11568 : left - this.offset.click.left >= containment[0] 11569 ? left - o.grid[0] 11570 : left + o.grid[0] 11571 : left; 11572 } 11573 11574 if (o.axis === "y") { 11575 pageX = this.originalPageX; 11576 } 11577 11578 if (o.axis === "x") { 11579 pageY = this.originalPageY; 11580 } 11581 } 11582 11583 return { 11584 top: 11585 // The absolute mouse position 11586 pageY - 11587 // Click offset (relative to the element) 11588 this.offset.click.top - 11589 // Only for relative positioned nodes: Relative offset from element to offset parent 11590 this.offset.relative.top - 11591 // The offsetParent's offset without borders (offset + border) 11592 this.offset.parent.top + 11593 (this.cssPosition === "fixed" 11594 ? -this.offset.scroll.top 11595 : scrollIsRootNode 11596 ? 0 11597 : this.offset.scroll.top), 11598 left: 11599 // The absolute mouse position 11600 pageX - 11601 // Click offset (relative to the element) 11602 this.offset.click.left - 11603 // Only for relative positioned nodes: Relative offset from element to offset parent 11604 this.offset.relative.left - 11605 // The offsetParent's offset without borders (offset + border) 11606 this.offset.parent.left + 11607 (this.cssPosition === "fixed" 11608 ? -this.offset.scroll.left 11609 : scrollIsRootNode 11610 ? 0 11611 : this.offset.scroll.left), 11612 }; 11613 }, 11614 11615 _clear: function () { 11616 this._removeClass(this.helper, "ui-draggable-dragging"); 11617 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 11618 this.helper.remove(); 11619 } 11620 this.helper = null; 11621 this.cancelHelperRemoval = false; 11622 if (this.destroyOnClear) { 11623 this.destroy(); 11624 } 11625 }, 11626 11627 // From now on bulk stuff - mainly helpers 11628 11629 _trigger: function (type, event, ui) { 11630 ui = ui || this._uiHash(); 11631 $.ui.plugin.call(this, type, [event, ui, this], true); 11632 11633 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 11634 if (/^(drag|start|stop)/.test(type)) { 11635 this.positionAbs = this._convertPositionTo("absolute"); 11636 ui.offset = this.positionAbs; 11637 } 11638 return $.Widget.prototype._trigger.call(this, type, event, ui); 11639 }, 11640 11641 plugins: {}, 11642 11643 _uiHash: function () { 11644 return { 11645 helper: this.helper, 11646 position: this.position, 11647 originalPosition: this.originalPosition, 11648 offset: this.positionAbs, 11649 }; 11650 }, 11651 }); 11652 11653 $.ui.plugin.add("draggable", "connectToSortable", { 11654 start: function (event, ui, draggable) { 11655 var uiSortable = $.extend({}, ui, { 11656 item: draggable.element, 11657 }); 11658 11659 draggable.sortables = []; 11660 $(draggable.options.connectToSortable).each(function () { 11661 var sortable = $(this).sortable("instance"); 11662 11663 if (sortable && !sortable.options.disabled) { 11664 draggable.sortables.push(sortable); 11665 11666 // RefreshPositions is called at drag start to refresh the containerCache 11667 // which is used in drag. This ensures it's initialized and synchronized 11668 // with any changes that might have happened on the page since initialization. 11669 sortable.refreshPositions(); 11670 sortable._trigger("activate", event, uiSortable); 11671 } 11672 }); 11673 }, 11674 stop: function (event, ui, draggable) { 11675 var uiSortable = $.extend({}, ui, { 11676 item: draggable.element, 11677 }); 11678 11679 draggable.cancelHelperRemoval = false; 11680 11681 $.each(draggable.sortables, function () { 11682 var sortable = this; 11683 11684 if (sortable.isOver) { 11685 sortable.isOver = 0; 11686 11687 // Allow this sortable to handle removing the helper 11688 draggable.cancelHelperRemoval = true; 11689 sortable.cancelHelperRemoval = false; 11690 11691 // Use _storedCSS To restore properties in the sortable, 11692 // as this also handles revert (#9675) since the draggable 11693 // may have modified them in unexpected ways (#8809) 11694 sortable._storedCSS = { 11695 position: sortable.placeholder.css("position"), 11696 top: sortable.placeholder.css("top"), 11697 left: sortable.placeholder.css("left"), 11698 }; 11699 11700 sortable._mouseStop(event); 11701 11702 // Once drag has ended, the sortable should return to using 11703 // its original helper, not the shared helper from draggable 11704 sortable.options.helper = sortable.options._helper; 11705 } else { 11706 // Prevent this Sortable from removing the helper. 11707 // However, don't set the draggable to remove the helper 11708 // either as another connected Sortable may yet handle the removal. 11709 sortable.cancelHelperRemoval = true; 11710 11711 sortable._trigger("deactivate", event, uiSortable); 11712 } 11713 }); 11714 }, 11715 drag: function (event, ui, draggable) { 11716 $.each(draggable.sortables, function () { 11717 var innermostIntersecting = false, 11718 sortable = this; 11719 11720 // Copy over variables that sortable's _intersectsWith uses 11721 sortable.positionAbs = draggable.positionAbs; 11722 sortable.helperProportions = draggable.helperProportions; 11723 sortable.offset.click = draggable.offset.click; 11724 11725 if (sortable._intersectsWith(sortable.containerCache)) { 11726 innermostIntersecting = true; 11727 11728 $.each(draggable.sortables, function () { 11729 // Copy over variables that sortable's _intersectsWith uses 11730 this.positionAbs = draggable.positionAbs; 11731 this.helperProportions = draggable.helperProportions; 11732 this.offset.click = draggable.offset.click; 11733 11734 if ( 11735 this !== sortable && 11736 this._intersectsWith(this.containerCache) && 11737 $.contains(sortable.element[0], this.element[0]) 11738 ) { 11739 innermostIntersecting = false; 11740 } 11741 11742 return innermostIntersecting; 11743 }); 11744 } 11745 11746 if (innermostIntersecting) { 11747 // If it intersects, we use a little isOver variable and set it once, 11748 // so that the move-in stuff gets fired only once. 11749 if (!sortable.isOver) { 11750 sortable.isOver = 1; 11751 11752 // Store draggable's parent in case we need to reappend to it later. 11753 draggable._parent = ui.helper.parent(); 11754 11755 sortable.currentItem = ui.helper 11756 .appendTo(sortable.element) 11757 .data("ui-sortable-item", true); 11758 11759 // Store helper option to later restore it 11760 sortable.options._helper = sortable.options.helper; 11761 11762 sortable.options.helper = function () { 11763 return ui.helper[0]; 11764 }; 11765 11766 // Fire the start events of the sortable with our passed browser event, 11767 // and our own helper (so it doesn't create a new one) 11768 event.target = sortable.currentItem[0]; 11769 sortable._mouseCapture(event, true); 11770 sortable._mouseStart(event, true, true); 11771 11772 // Because the browser event is way off the new appended portlet, 11773 // modify necessary variables to reflect the changes 11774 sortable.offset.click.top = draggable.offset.click.top; 11775 sortable.offset.click.left = draggable.offset.click.left; 11776 sortable.offset.parent.left -= 11777 draggable.offset.parent.left - sortable.offset.parent.left; 11778 sortable.offset.parent.top -= 11779 draggable.offset.parent.top - sortable.offset.parent.top; 11780 11781 draggable._trigger("toSortable", event); 11782 11783 // Inform draggable that the helper is in a valid drop zone, 11784 // used solely in the revert option to handle "valid/invalid". 11785 draggable.dropped = sortable.element; 11786 11787 // Need to refreshPositions of all sortables in the case that 11788 // adding to one sortable changes the location of the other sortables (#9675) 11789 $.each(draggable.sortables, function () { 11790 this.refreshPositions(); 11791 }); 11792 11793 // Hack so receive/update callbacks work (mostly) 11794 draggable.currentItem = draggable.element; 11795 sortable.fromOutside = draggable; 11796 } 11797 11798 if (sortable.currentItem) { 11799 sortable._mouseDrag(event); 11800 11801 // Copy the sortable's position because the draggable's can potentially reflect 11802 // a relative position, while sortable is always absolute, which the dragged 11803 // element has now become. (#8809) 11804 ui.position = sortable.position; 11805 } 11806 } else { 11807 // If it doesn't intersect with the sortable, and it intersected before, 11808 // we fake the drag stop of the sortable, but make sure it doesn't remove 11809 // the helper by using cancelHelperRemoval. 11810 if (sortable.isOver) { 11811 sortable.isOver = 0; 11812 sortable.cancelHelperRemoval = true; 11813 11814 // Calling sortable's mouseStop would trigger a revert, 11815 // so revert must be temporarily false until after mouseStop is called. 11816 sortable.options._revert = sortable.options.revert; 11817 sortable.options.revert = false; 11818 11819 sortable._trigger("out", event, sortable._uiHash(sortable)); 11820 sortable._mouseStop(event, true); 11821 11822 // Restore sortable behaviors that were modfied 11823 // when the draggable entered the sortable area (#9481) 11824 sortable.options.revert = sortable.options._revert; 11825 sortable.options.helper = sortable.options._helper; 11826 11827 if (sortable.placeholder) { 11828 sortable.placeholder.remove(); 11829 } 11830 11831 // Restore and recalculate the draggable's offset considering the sortable 11832 // may have modified them in unexpected ways. (#8809, #10669) 11833 ui.helper.appendTo(draggable._parent); 11834 draggable._refreshOffsets(event); 11835 ui.position = draggable._generatePosition(event, true); 11836 11837 draggable._trigger("fromSortable", event); 11838 11839 // Inform draggable that the helper is no longer in a valid drop zone 11840 draggable.dropped = false; 11841 11842 // Need to refreshPositions of all sortables just in case removing 11843 // from one sortable changes the location of other sortables (#9675) 11844 $.each(draggable.sortables, function () { 11845 this.refreshPositions(); 11846 }); 11847 } 11848 } 11849 }); 11850 }, 11851 }); 11852 11853 $.ui.plugin.add("draggable", "cursor", { 11854 start: function (event, ui, instance) { 11855 var t = $("body"), 11856 o = instance.options; 11857 11858 if (t.css("cursor")) { 11859 o._cursor = t.css("cursor"); 11860 } 11861 t.css("cursor", o.cursor); 11862 }, 11863 stop: function (event, ui, instance) { 11864 var o = instance.options; 11865 if (o._cursor) { 11866 $("body").css("cursor", o._cursor); 11867 } 11868 }, 11869 }); 11870 11871 $.ui.plugin.add("draggable", "opacity", { 11872 start: function (event, ui, instance) { 11873 var t = $(ui.helper), 11874 o = instance.options; 11875 if (t.css("opacity")) { 11876 o._opacity = t.css("opacity"); 11877 } 11878 t.css("opacity", o.opacity); 11879 }, 11880 stop: function (event, ui, instance) { 11881 var o = instance.options; 11882 if (o._opacity) { 11883 $(ui.helper).css("opacity", o._opacity); 11884 } 11885 }, 11886 }); 11887 11888 $.ui.plugin.add("draggable", "scroll", { 11889 start: function (event, ui, i) { 11890 if (!i.scrollParentNotHidden) { 11891 i.scrollParentNotHidden = i.helper.scrollParent(false); 11892 } 11893 11894 if ( 11895 i.scrollParentNotHidden[0] !== i.document[0] && 11896 i.scrollParentNotHidden[0].tagName !== "HTML" 11897 ) { 11898 i.overflowOffset = i.scrollParentNotHidden.offset(); 11899 } 11900 }, 11901 drag: function (event, ui, i) { 11902 var o = i.options, 11903 scrolled = false, 11904 scrollParent = i.scrollParentNotHidden[0], 11905 document = i.document[0]; 11906 11907 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 11908 if (!o.axis || o.axis !== "x") { 11909 if ( 11910 i.overflowOffset.top + scrollParent.offsetHeight - event.pageY < 11911 o.scrollSensitivity 11912 ) { 11913 scrollParent.scrollTop = scrolled = 11914 scrollParent.scrollTop + o.scrollSpeed; 11915 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 11916 scrollParent.scrollTop = scrolled = 11917 scrollParent.scrollTop - o.scrollSpeed; 11918 } 11919 } 11920 11921 if (!o.axis || o.axis !== "y") { 11922 if ( 11923 i.overflowOffset.left + scrollParent.offsetWidth - event.pageX < 11924 o.scrollSensitivity 11925 ) { 11926 scrollParent.scrollLeft = scrolled = 11927 scrollParent.scrollLeft + o.scrollSpeed; 11928 } else if ( 11929 event.pageX - i.overflowOffset.left < 11930 o.scrollSensitivity 11931 ) { 11932 scrollParent.scrollLeft = scrolled = 11933 scrollParent.scrollLeft - o.scrollSpeed; 11934 } 11935 } 11936 } else { 11937 if (!o.axis || o.axis !== "x") { 11938 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 11939 scrolled = $(document).scrollTop( 11940 $(document).scrollTop() - o.scrollSpeed 11941 ); 11942 } else if ( 11943 $(window).height() - (event.pageY - $(document).scrollTop()) < 11944 o.scrollSensitivity 11945 ) { 11946 scrolled = $(document).scrollTop( 11947 $(document).scrollTop() + o.scrollSpeed 11948 ); 11949 } 11950 } 11951 11952 if (!o.axis || o.axis !== "y") { 11953 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 11954 scrolled = $(document).scrollLeft( 11955 $(document).scrollLeft() - o.scrollSpeed 11956 ); 11957 } else if ( 11958 $(window).width() - (event.pageX - $(document).scrollLeft()) < 11959 o.scrollSensitivity 11960 ) { 11961 scrolled = $(document).scrollLeft( 11962 $(document).scrollLeft() + o.scrollSpeed 11963 ); 11964 } 11965 } 11966 } 11967 11968 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 11969 $.ui.ddmanager.prepareOffsets(i, event); 11970 } 11971 }, 11972 }); 11973 11974 $.ui.plugin.add("draggable", "snap", { 11975 start: function (event, ui, i) { 11976 var o = i.options; 11977 11978 i.snapElements = []; 11979 11980 $( 11981 o.snap.constructor !== String 11982 ? o.snap.items || ":data(ui-draggable)" 11983 : o.snap 11984 ).each(function () { 11985 var $t = $(this), 11986 $o = $t.offset(); 11987 if (this !== i.element[0]) { 11988 i.snapElements.push({ 11989 item: this, 11990 width: $t.outerWidth(), 11991 height: $t.outerHeight(), 11992 top: $o.top, 11993 left: $o.left, 11994 }); 11995 } 11996 }); 11997 }, 11998 drag: function (event, ui, inst) { 11999 var ts, 12000 bs, 12001 ls, 12002 rs, 12003 l, 12004 r, 12005 t, 12006 b, 12007 i, 12008 first, 12009 o = inst.options, 12010 d = o.snapTolerance, 12011 x1 = ui.offset.left, 12012 x2 = x1 + inst.helperProportions.width, 12013 y1 = ui.offset.top, 12014 y2 = y1 + inst.helperProportions.height; 12015 12016 for (i = inst.snapElements.length - 1; i >= 0; i--) { 12017 l = inst.snapElements[i].left - inst.margins.left; 12018 r = l + inst.snapElements[i].width; 12019 t = inst.snapElements[i].top - inst.margins.top; 12020 b = t + inst.snapElements[i].height; 12021 12022 if ( 12023 x2 < l - d || 12024 x1 > r + d || 12025 y2 < t - d || 12026 y1 > b + d || 12027 !$.contains( 12028 inst.snapElements[i].item.ownerDocument, 12029 inst.snapElements[i].item 12030 ) 12031 ) { 12032 if (inst.snapElements[i].snapping) { 12033 if (inst.options.snap.release) { 12034 inst.options.snap.release.call( 12035 inst.element, 12036 event, 12037 $.extend(inst._uiHash(), { 12038 snapItem: inst.snapElements[i].item, 12039 }) 12040 ); 12041 } 12042 } 12043 inst.snapElements[i].snapping = false;
12044 continue; 12045 } 12046 12047 if (o.snapMode !== "inner") { 12048 ts = Math.abs(t - y2) <= d; 12049 bs = Math.abs(b - y1) <= d; 12050 ls = Math.abs(l - x2) <= d; 12051 rs = Math.abs(r - x1) <= d; 12052 if (ts) { 12053 ui.position.top = inst._convertPositionTo("relative", { 12054 top: t - inst.helperProportions.height, 12055 left: 0, 12056 }).top; 12057 } 12058 if (bs) { 12059 ui.position.top = inst._convertPositionTo("relative", { 12060 top: b, 12061 left: 0, 12062 }).top; 12063 } 12064 if (ls) { 12065 ui.position.left = inst._convertPositionTo("relative", { 12066 top: 0, 12067 left: l - inst.helperProportions.width, 12068 }).left; 12069 } 12070 if (rs) { 12071 ui.position.left = inst._convertPositionTo("relative", { 12072 top: 0, 12073 left: r, 12074 }).left; 12075 } 12076 } 12077 12078 first = ts || bs || ls || rs; 12079 12080 if (o.snapMode !== "outer") { 12081 ts = Math.abs(t - y1) <= d; 12082 bs = Math.abs(b - y2) <= d; 12083 ls = Math.abs(l - x1) <= d; 12084 rs = Math.abs(r - x2) <= d; 12085 if (ts) { 12086 ui.position.top = inst._convertPositionTo("relative", { 12087 top: t, 12088 left: 0, 12089 }).top; 12090 } 12091 if (bs) { 12092 ui.position.top = inst._convertPositionTo("relative", { 12093 top: b - inst.helperProportions.height, 12094 left: 0, 12095 }).top; 12096 } 12097 if (ls) { 12098 ui.position.left = inst._convertPositionTo("relative", { 12099 top: 0, 12100 left: l, 12101 }).left; 12102 } 12103 if (rs) { 12104 ui.position.left = inst._convertPositionTo("relative", { 12105 top: 0, 12106 left: r - inst.helperProportions.width, 12107 }).left; 12108 } 12109 } 12110 12111 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 12112 if (inst.options.snap.snap) { 12113 inst.options.snap.snap.call( 12114 inst.element, 12115 event, 12116 $.extend(inst._uiHash(), { 12117 snapItem: inst.snapElements[i].item, 12118 }) 12119 ); 12120 } 12121 } 12122 inst.snapElements[i].snapping = ts || bs || ls || rs || first; 12123 } 12124 }, 12125 }); 12126 12127 $.ui.plugin.add("draggable", "stack", { 12128 start: function (event, ui, instance) { 12129 var min, 12130 o = instance.options, 12131 group = $.makeArray($(o.stack)).sort(function (a, b) { 12132 return ( 12133 (parseInt($(a).css("zIndex"), 10) || 0) - 12134 (parseInt($(b).css("zIndex"), 10) || 0) 12135 ); 12136 }); 12137 12138 if (!group.length) { 12139 return; 12140 } 12141 12142 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 12143 $(group).each(function (i) { 12144 $(this).css("zIndex", min + i); 12145 }); 12146 this.css("zIndex", min + group.length); 12147 }, 12148 }); 12149 12150 $.ui.plugin.add("draggable", "zIndex", { 12151 start: function (event, ui, instance) { 12152 var t = $(ui.helper), 12153 o = instance.options; 12154 12155 if (t.css("zIndex")) { 12156 o._zIndex = t.css("zIndex"); 12157 } 12158 t.css("zIndex", o.zIndex); 12159 }, 12160 stop: function (event, ui, instance) { 12161 var o = instance.options; 12162 12163 if (o._zIndex) { 12164 $(ui.helper).css("zIndex", o._zIndex); 12165 } 12166 }, 12167 }); 12168 12169 var widgetsDraggable = $.ui.draggable; 12170 12171 /*! 12172 * jQuery UI Resizable 1.13.3 12173 * https://jqueryui.com 12174 * 12175 * Copyright OpenJS Foundation and other contributors 12176 * Released under the MIT license. 12177 * https://jquery.org/license 12178 */ 12179 12180 //>>label: Resizable 12181 //>>group: Interactions 12182 //>>description: Enables resize functionality for any element. 12183 //>>docs: https://api.jqueryui.com/resizable/ 12184 //>>demos: https://jqueryui.com/resizable/ 12185 //>>css.structure: ../../themes/base/core.css 12186 //>>css.structure: ../../themes/base/resizable.css 12187 //>>css.theme: ../../themes/base/theme.css 12188 12189 $.widget("ui.resizable", $.ui.mouse, { 12190 version: "1.13.3", 12191 widgetEventPrefix: "resize", 12192 options: { 12193 alsoResize: false, 12194 animate: false, 12195 animateDuration: "slow", 12196 animateEasing: "swing", 12197 aspectRatio: false, 12198 autoHide: false, 12199 classes: { 12200 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se", 12201 }, 12202 containment: false, 12203 ghost: false, 12204 grid: false, 12205 handles: "e,s,se", 12206 helper: false, 12207 maxHeight: null, 12208 maxWidth: null, 12209 minHeight: 10, 12210 minWidth: 10, 12211 12212 // See #7960 12213 zIndex: 90, 12214 12215 // Callbacks 12216 resize: null, 12217 start: null, 12218 stop: null, 12219 }, 12220 12221 _num: function (value) { 12222 return parseFloat(value) || 0; 12223 }, 12224 12225 _isNumber: function (value) { 12226 return !isNaN(parseFloat(value)); 12227 }, 12228 12229 _hasScroll: function (el, a) { 12230 if ($(el).css("overflow") === "hidden") { 12231 return false;
vendor: 6,853 bytes, lines 12232-12478
12232 } 12233 12234 var scroll = a && a === "left" ? "scrollLeft" : "scrollTop", 12235 has = false; 12236 12237 if (el[scroll] > 0) { 12238 return true; 12239 } 12240 12241 // TODO: determine which cases actually cause this to happen 12242 // if the element doesn't have the scroll set, see if it's possible to 12243 // set the scroll 12244 try { 12245 el[scroll] = 1; 12246 has = el[scroll] > 0; 12247 el[scroll] = 0; 12248 } catch (e) { 12249 // `el` might be a string, then setting `scroll` will throw 12250 // an error in strict mode; ignore it. 12251 } 12252 return has; 12253 }, 12254 12255 _create: function () { 12256 var margins, 12257 o = this.options, 12258 that = this; 12259 this._addClass("ui-resizable"); 12260 12261 $.extend(this, { 12262 _aspectRatio: !!o.aspectRatio, 12263 aspectRatio: o.aspectRatio, 12264 originalElement: this.element, 12265 _proportionallyResizeElements: [], 12266 _helper: 12267 o.helper || o.ghost || o.animate 12268 ? o.helper || "ui-resizable-helper" 12269 : null, 12270 }); 12271 12272 // Wrap the element if it cannot hold child nodes 12273 if ( 12274 this.element[0].nodeName.match( 12275 /^(canvas|textarea|input|select|button|img)$/i 12276 ) 12277 ) { 12278 this.element.wrap( 12279 $("<div class='ui-wrapper'></div>").css({ 12280 overflow: "hidden", 12281 position: this.element.css("position"), 12282 width: this.element.outerWidth(), 12283 height: this.element.outerHeight(), 12284 top: this.element.css("top"), 12285 left: this.element.css("left"), 12286 }) 12287 ); 12288 12289 this.element = this.element 12290 .parent() 12291 .data("ui-resizable", this.element.resizable("instance")); 12292 12293 this.elementIsWrapper = true; 12294 12295 margins = { 12296 marginTop: this.originalElement.css("marginTop"), 12297 marginRight: this.originalElement.css("marginRight"), 12298 marginBottom: this.originalElement.css("marginBottom"), 12299 marginLeft: this.originalElement.css("marginLeft"), 12300 }; 12301 12302 this.element.css(margins); 12303 this.originalElement.css("margin", 0); 12304 12305 // support: Safari 12306 // Prevent Safari textarea resize 12307 this.originalResizeStyle = this.originalElement.css("resize"); 12308 this.originalElement.css("resize", "none"); 12309 12310 this._proportionallyResizeElements.push( 12311 this.originalElement.css({ 12312 position: "static", 12313 zoom: 1, 12314 display: "block", 12315 }) 12316 ); 12317 12318 // Support: IE9 12319 // avoid IE jump (hard set the margin) 12320 this.originalElement.css(margins); 12321 12322 this._proportionallyResize(); 12323 } 12324 12325 this._setupHandles(); 12326 12327 if (o.autoHide) { 12328 $(this.element) 12329 .on("mouseenter", function () { 12330 if (o.disabled) { 12331 return; 12332 } 12333 that._removeClass("ui-resizable-autohide"); 12334 that._handles.show(); 12335 }) 12336 .on("mouseleave", function () { 12337 if (o.disabled) { 12338 return; 12339 } 12340 if (!that.resizing) { 12341 that._addClass("ui-resizable-autohide"); 12342 that._handles.hide(); 12343 } 12344 }); 12345 } 12346 12347 this._mouseInit(); 12348 }, 12349 12350 _destroy: function () { 12351 this._mouseDestroy(); 12352 this._addedHandles.remove(); 12353 12354 var wrapper, 12355 _destroy = function (exp) { 12356 $(exp) 12357 .removeData("resizable") 12358 .removeData("ui-resizable") 12359 .off(".resizable"); 12360 }; 12361 12362 // TODO: Unwrap at same DOM position 12363 if (this.elementIsWrapper) { 12364 _destroy(this.element); 12365 wrapper = this.element; 12366 this.originalElement 12367 .css({ 12368 position: wrapper.css("position"), 12369 width: wrapper.outerWidth(), 12370 height: wrapper.outerHeight(), 12371 top: wrapper.css("top"), 12372 left: wrapper.css("left"), 12373 }) 12374 .insertAfter(wrapper); 12375 wrapper.remove(); 12376 } 12377 12378 this.originalElement.css("resize", this.originalResizeStyle); 12379 _destroy(this.originalElement); 12380 12381 return this; 12382 }, 12383 12384 _setOption: function (key, value) { 12385 this._super(key, value); 12386 12387 switch (key) { 12388 case "handles": 12389 this._removeHandles(); 12390 this._setupHandles(); 12391 break; 12392 case "aspectRatio": 12393 this._aspectRatio = !!value; 12394 break; 12395 default: 12396 break; 12397 } 12398 }, 12399 12400 _setupHandles: function () { 12401 var o = this.options, 12402 handle, 12403 i, 12404 n, 12405 hname, 12406 axis, 12407 that = this; 12408 this.handles = 12409 o.handles || 12410 (!$(".ui-resizable-handle", this.element).length 12411 ? "e,s,se" 12412 : { 12413 n: ".ui-resizable-n", 12414 e: ".ui-resizable-e", 12415 s: ".ui-resizable-s", 12416 w: ".ui-resizable-w", 12417 se: ".ui-resizable-se", 12418 sw: ".ui-resizable-sw", 12419 ne: ".ui-resizable-ne", 12420 nw: ".ui-resizable-nw", 12421 }); 12422 12423 this._handles = $(); 12424 this._addedHandles = $(); 12425 if (this.handles.constructor === String) { 12426 if (this.handles === "all") { 12427 this.handles = "n,e,s,w,se,sw,ne,nw"; 12428 } 12429 12430 n = this.handles.split(","); 12431 this.handles = {}; 12432 12433 for (i = 0; i < n.length; i++) { 12434 handle = String.prototype.trim.call(n[i]); 12435 hname = "ui-resizable-" + handle; 12436 axis = $("<div>"); 12437 this._addClass(axis, "ui-resizable-handle " + hname); 12438 12439 axis.css({ zIndex: o.zIndex }); 12440 12441 this.handles[handle] = ".ui-resizable-" + handle; 12442 if (!this.element.children(this.handles[handle]).length) { 12443 this.element.append(axis); 12444 this._addedHandles = this._addedHandles.add(axis); 12445 } 12446 } 12447 } 12448 12449 this._renderAxis = function (target) { 12450 var i, axis, padPos, padWrapper; 12451 12452 target = target || this.element; 12453 12454 for (i in this.handles) { 12455 if (this.handles[i].constructor === String) { 12456 this.handles[i] = this.element 12457 .children(this.handles[i]) 12458 .first() 12459 .show(); 12460 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 12461 this.handles[i] = $(this.handles[i]); 12462 this._on(this.handles[i], { mousedown: that._mouseDown }); 12463 } 12464 12465 if ( 12466 this.elementIsWrapper && 12467 this.originalElement[0].nodeName.match( 12468 /^(textarea|input|select|button)$/i 12469 ) 12470 ) { 12471 axis = $(this.handles[i], this.element); 12472 12473 padWrapper = /sw|ne|nw|se|n|s/.test(i) 12474 ? axis.outerHeight() 12475 : axis.outerWidth(); 12476 12477 padPos = [ 12478 "padding",
vendor: 14,690 bytes, lines 12479-13024
12479 /ne|nw|n/.test(i) 12480 ? "Top" 12481 : /se|sw|s/.test(i) 12482 ? "Bottom" 12483 : /^e$/.test(i) 12484 ? "Right" 12485 : "Left", 12486 ].join(""); 12487 12488 target.css(padPos, padWrapper); 12489 12490 this._proportionallyResize(); 12491 } 12492 12493 this._handles = this._handles.add(this.handles[i]); 12494 } 12495 }; 12496 12497 // TODO: make renderAxis a prototype function 12498 this._renderAxis(this.element); 12499 12500 this._handles = this._handles.add( 12501 this.element.find(".ui-resizable-handle") 12502 ); 12503 this._handles.disableSelection(); 12504 12505 this._handles.on("mouseover", function () { 12506 if (!that.resizing) { 12507 if (this.className) { 12508 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 12509 } 12510 that.axis = axis && axis[1] ? axis[1] : "se"; 12511 } 12512 }); 12513 12514 if (o.autoHide) { 12515 this._handles.hide(); 12516 this._addClass("ui-resizable-autohide"); 12517 } 12518 }, 12519 12520 _removeHandles: function () { 12521 this._addedHandles.remove(); 12522 }, 12523 12524 _mouseCapture: function (event) { 12525 var i, 12526 handle, 12527 capture = false; 12528 12529 for (i in this.handles) { 12530 handle = $(this.handles[i])[0]; 12531 if (handle === event.target || $.contains(handle, event.target)) { 12532 capture = true; 12533 } 12534 } 12535 12536 return !this.options.disabled && capture; 12537 }, 12538 12539 _mouseStart: function (event) { 12540 var curleft, 12541 curtop, 12542 cursor, 12543 o = this.options, 12544 el = this.element; 12545 12546 this.resizing = true; 12547 12548 this._renderProxy(); 12549 12550 curleft = this._num(this.helper.css("left")); 12551 curtop = this._num(this.helper.css("top")); 12552 12553 if (o.containment) { 12554 curleft += $(o.containment).scrollLeft() || 0; 12555 curtop += $(o.containment).scrollTop() || 0; 12556 } 12557 12558 this.offset = this.helper.offset(); 12559 this.position = { left: curleft, top: curtop }; 12560 12561 this.size = this._helper 12562 ? { 12563 width: this.helper.width(), 12564 height: this.helper.height(), 12565 } 12566 : { 12567 width: el.width(), 12568 height: el.height(), 12569 }; 12570 12571 this.originalSize = this._helper 12572 ? { 12573 width: el.outerWidth(), 12574 height: el.outerHeight(), 12575 } 12576 : { 12577 width: el.width(), 12578 height: el.height(), 12579 }; 12580 12581 this.sizeDiff = { 12582 width: el.outerWidth() - el.width(), 12583 height: el.outerHeight() - el.height(), 12584 }; 12585 12586 this.originalPosition = { left: curleft, top: curtop }; 12587 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 12588 12589 this.aspectRatio = 12590 typeof o.aspectRatio === "number" 12591 ? o.aspectRatio 12592 : this.originalSize.width / this.originalSize.height || 1; 12593 12594 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 12595 $("body").css( 12596 "cursor", 12597 cursor === "auto" ? this.axis + "-resize" : cursor 12598 ); 12599 12600 this._addClass("ui-resizable-resizing"); 12601 this._propagate("start", event); 12602 return true; 12603 }, 12604 12605 _mouseDrag: function (event) { 12606 var data, 12607 props, 12608 smp = this.originalMousePosition, 12609 a = this.axis, 12610 dx = event.pageX - smp.left || 0, 12611 dy = event.pageY - smp.top || 0, 12612 trigger = this._change[a]; 12613 12614 this._updatePrevProperties(); 12615 12616 if (!trigger) { 12617 return false; 12618 } 12619 12620 data = trigger.apply(this, [event, dx, dy]); 12621 12622 this._updateVirtualBoundaries(event.shiftKey); 12623 if (this._aspectRatio || event.shiftKey) { 12624 data = this._updateRatio(data, event); 12625 } 12626 12627 data = this._respectSize(data, event); 12628 12629 this._updateCache(data); 12630 12631 this._propagate("resize", event); 12632 12633 props = this._applyChanges(); 12634 12635 if (!this._helper && this._proportionallyResizeElements.length) { 12636 this._proportionallyResize(); 12637 } 12638 12639 if (!$.isEmptyObject(props)) { 12640 this._updatePrevProperties(); 12641 this._trigger("resize", event, this.ui()); 12642 this._applyChanges(); 12643 } 12644 12645 return false; 12646 }, 12647 12648 _mouseStop: function (event) { 12649 this.resizing = false; 12650 var pr, 12651 ista, 12652 soffseth, 12653 soffsetw, 12654 s, 12655 left, 12656 top, 12657 o = this.options, 12658 that = this; 12659 12660 if (this._helper) { 12661 pr = this._proportionallyResizeElements; 12662 ista = pr.length && /textarea/i.test(pr[0].nodeName); 12663 soffseth = 12664 ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 12665 soffsetw = ista ? 0 : that.sizeDiff.width; 12666 12667 s = { 12668 width: that.helper.width() - soffsetw, 12669 height: that.helper.height() - soffseth, 12670 }; 12671 left = 12672 parseFloat(that.element.css("left")) + 12673 (that.position.left - that.originalPosition.left) || null; 12674 top = 12675 parseFloat(that.element.css("top")) + 12676 (that.position.top - that.originalPosition.top) || null; 12677 12678 if (!o.animate) { 12679 this.element.css($.extend(s, { top: top, left: left })); 12680 } 12681 12682 that.helper.height(that.size.height); 12683 that.helper.width(that.size.width); 12684 12685 if (this._helper && !o.animate) { 12686 this._proportionallyResize(); 12687 } 12688 } 12689 12690 $("body").css("cursor", "auto"); 12691 12692 this._removeClass("ui-resizable-resizing"); 12693 12694 this._propagate("stop", event); 12695 12696 if (this._helper) { 12697 this.helper.remove(); 12698 } 12699 12700 return false; 12701 }, 12702 12703 _updatePrevProperties: function () { 12704 this.prevPosition = { 12705 top: this.position.top, 12706 left: this.position.left, 12707 }; 12708 this.prevSize = { 12709 width: this.size.width, 12710 height: this.size.height, 12711 }; 12712 }, 12713 12714 _applyChanges: function () { 12715 var props = {}; 12716 12717 if (this.position.top !== this.prevPosition.top) { 12718 props.top = this.position.top + "px"; 12719 } 12720 if (this.position.left !== this.prevPosition.left) { 12721 props.left = this.position.left + "px"; 12722 } 12723 12724 this.helper.css(props); 12725 12726 if (this.size.width !== this.prevSize.width) { 12727 props.width = this.size.width + "px"; 12728 this.helper.width(props.width); 12729 } 12730 if (this.size.height !== this.prevSize.height) { 12731 props.height = this.size.height + "px"; 12732 this.helper.height(props.height); 12733 } 12734 12735 return props; 12736 }, 12737 12738 _updateVirtualBoundaries: function (forceAspectRatio) { 12739 var pMinWidth, 12740 pMaxWidth, 12741 pMinHeight, 12742 pMaxHeight, 12743 b, 12744 o = this.options; 12745 12746 b = { 12747 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 12748 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 12749 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 12750 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity, 12751 }; 12752 12753 if (this._aspectRatio || forceAspectRatio) { 12754 pMinWidth = b.minHeight * this.aspectRatio; 12755 pMinHeight = b.minWidth / this.aspectRatio; 12756 pMaxWidth = b.maxHeight * this.aspectRatio; 12757 pMaxHeight = b.maxWidth / this.aspectRatio; 12758 12759 if (pMinWidth > b.minWidth) { 12760 b.minWidth = pMinWidth; 12761 } 12762 if (pMinHeight > b.minHeight) { 12763 b.minHeight = pMinHeight; 12764 } 12765 if (pMaxWidth < b.maxWidth) { 12766 b.maxWidth = pMaxWidth; 12767 } 12768 if (pMaxHeight < b.maxHeight) { 12769 b.maxHeight = pMaxHeight; 12770 } 12771 } 12772 this._vBoundaries = b; 12773 }, 12774 12775 _updateCache: function (data) { 12776 this.offset = this.helper.offset(); 12777 if (this._isNumber(data.left)) { 12778 this.position.left = data.left; 12779 } 12780 if (this._isNumber(data.top)) { 12781 this.position.top = data.top; 12782 } 12783 if (this._isNumber(data.height)) { 12784 this.size.height = data.height; 12785 } 12786 if (this._isNumber(data.width)) { 12787 this.size.width = data.width; 12788 } 12789 }, 12790 12791 _updateRatio: function (data) { 12792 var cpos = this.position, 12793 csize = this.size, 12794 a = this.axis; 12795 12796 if (this._isNumber(data.height)) { 12797 data.width = data.height * this.aspectRatio; 12798 } else if (this._isNumber(data.width)) { 12799 data.height = data.width / this.aspectRatio; 12800 } 12801 12802 if (a === "sw") { 12803 data.left = cpos.left + (csize.width - data.width); 12804 data.top = null; 12805 } 12806 if (a === "nw") { 12807 data.top = cpos.top + (csize.height - data.height); 12808 data.left = cpos.left + (csize.width - data.width); 12809 } 12810 12811 return data; 12812 }, 12813 12814 _respectSize: function (data) { 12815 var o = this._vBoundaries, 12816 a = this.axis, 12817 ismaxw = 12818 this._isNumber(data.width) && o.maxWidth && o.maxWidth < data.width, 12819 ismaxh = 12820 this._isNumber(data.height) && 12821 o.maxHeight && 12822 o.maxHeight < data.height, 12823 isminw = 12824 this._isNumber(data.width) && o.minWidth && o.minWidth > data.width, 12825 isminh = 12826 this._isNumber(data.height) && 12827 o.minHeight && 12828 o.minHeight > data.height, 12829 dw = this.originalPosition.left + this.originalSize.width, 12830 dh = this.originalPosition.top + this.originalSize.height, 12831 cw = /sw|nw|w/.test(a), 12832 ch = /nw|ne|n/.test(a); 12833 if (isminw) { 12834 data.width = o.minWidth; 12835 } 12836 if (isminh) { 12837 data.height = o.minHeight; 12838 } 12839 if (ismaxw) { 12840 data.width = o.maxWidth; 12841 } 12842 if (ismaxh) { 12843 data.height = o.maxHeight; 12844 } 12845 12846 if (isminw && cw) { 12847 data.left = dw - o.minWidth; 12848 } 12849 if (ismaxw && cw) { 12850 data.left = dw - o.maxWidth; 12851 } 12852 if (isminh && ch) { 12853 data.top = dh - o.minHeight; 12854 } 12855 if (ismaxh && ch) { 12856 data.top = dh - o.maxHeight; 12857 } 12858 12859 // Fixing jump error on top/left - bug #2330 12860 if (!data.width && !data.height && !data.left && data.top) { 12861 data.top = null; 12862 } else if (!data.width && !data.height && !data.top && data.left) { 12863 data.left = null; 12864 } 12865 12866 return data; 12867 }, 12868 12869 _getPaddingPlusBorderDimensions: function (element) { 12870 var i = 0, 12871 widths = [], 12872 borders = [ 12873 element.css("borderTopWidth"), 12874 element.css("borderRightWidth"), 12875 element.css("borderBottomWidth"), 12876 element.css("borderLeftWidth"), 12877 ], 12878 paddings = [ 12879 element.css("paddingTop"), 12880 element.css("paddingRight"), 12881 element.css("paddingBottom"), 12882 element.css("paddingLeft"), 12883 ]; 12884 12885 for (; i < 4; i++) { 12886 widths[i] = parseFloat(borders[i]) || 0; 12887 widths[i] += parseFloat(paddings[i]) || 0; 12888 } 12889 12890 return { 12891 height: widths[0] + widths[2], 12892 width: widths[1] + widths[3], 12893 }; 12894 }, 12895 12896 _proportionallyResize: function () { 12897 if (!this._proportionallyResizeElements.length) { 12898 return; 12899 } 12900 12901 var prel, 12902 i = 0, 12903 element = this.helper || this.element; 12904 12905 for (; i < this._proportionallyResizeElements.length; i++) { 12906 prel = this._proportionallyResizeElements[i]; 12907 12908 // TODO: Seems like a bug to cache this.outerDimensions 12909 // considering that we are in a loop. 12910 if (!this.outerDimensions) { 12911 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 12912 } 12913 12914 prel.css({ 12915 height: element.height() - this.outerDimensions.height || 0, 12916 width: element.width() - this.outerDimensions.width || 0, 12917 }); 12918 } 12919 }, 12920 12921 _renderProxy: function () { 12922 var el = this.element, 12923 o = this.options; 12924 this.elementOffset = el.offset(); 12925 12926 if (this._helper) { 12927 this.helper = 12928 this.helper || $("<div></div>").css({ overflow: "hidden" }); 12929 12930 this._addClass(this.helper, this._helper); 12931 this.helper.css({ 12932 width: this.element.outerWidth(), 12933 height: this.element.outerHeight(), 12934 position: "absolute", 12935 left: this.elementOffset.left + "px", 12936 top: this.elementOffset.top + "px", 12937 zIndex: ++o.zIndex, //TODO: Don't modify option 12938 }); 12939 12940 this.helper.appendTo("body").disableSelection(); 12941 } else { 12942 this.helper = this.element; 12943 } 12944 }, 12945 12946 _change: { 12947 e: function (event, dx) { 12948 return { width: this.originalSize.width + dx }; 12949 }, 12950 w: function (event, dx) { 12951 var cs = this.originalSize, 12952 sp = this.originalPosition; 12953 return { left: sp.left + dx, width: cs.width - dx }; 12954 }, 12955 n: function (event, dx, dy) { 12956 var cs = this.originalSize, 12957 sp = this.originalPosition; 12958 return { top: sp.top + dy, height: cs.height - dy }; 12959 }, 12960 s: function (event, dx, dy) { 12961 return { height: this.originalSize.height + dy }; 12962 }, 12963 se: function (event, dx, dy) { 12964 return $.extend( 12965 this._change.s.apply(this, arguments), 12966 this._change.e.apply(this, [event, dx, dy]) 12967 ); 12968 }, 12969 sw: function (event, dx, dy) { 12970 return $.extend( 12971 this._change.s.apply(this, arguments), 12972 this._change.w.apply(this, [event, dx, dy]) 12973 ); 12974 }, 12975 ne: function (event, dx, dy) { 12976 return $.extend( 12977 this._change.n.apply(this, arguments), 12978 this._change.e.apply(this, [event, dx, dy]) 12979 ); 12980 }, 12981 nw: function (event, dx, dy) { 12982 return $.extend( 12983 this._change.n.apply(this, arguments), 12984 this._change.w.apply(this, [event, dx, dy]) 12985 ); 12986 }, 12987 }, 12988 12989 _propagate: function (n, event) { 12990 $.ui.plugin.call(this, n, [event, this.ui()]); 12991 if (n !== "resize") { 12992 this._trigger(n, event, this.ui()); 12993 } 12994 }, 12995 12996 plugins: {}, 12997 12998 ui: function () { 12999 return { 13000 originalElement: this.originalElement, 13001 element: this.element, 13002 helper: this.helper, 13003 position: this.position, 13004 size: this.size, 13005 originalSize: this.originalSize, 13006 originalPosition: this.originalPosition, 13007 }; 13008 }, 13009 }); 13010 13011 /* 13012 * Resizable Extensions 13013 */ 13014 13015 $.ui.plugin.add("resizable", "animate", { 13016 stop: function (event) { 13017 var that = $(this).resizable("instance"), 13018 o = that.options, 13019 pr = that._proportionallyResizeElements, 13020 ista = pr.length && /textarea/i.test(pr[0].nodeName), 13021 soffseth = 13022 ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 13023 soffsetw = ista ? 0 : that.sizeDiff.width, 13024 style = {
13025 width: that.size.width - soffsetw, 13026 height: that.size.height - soffseth, 13027 }, 13028 left = 13029 parseFloat(that.element.css("left")) + 13030 (that.position.left - that.originalPosition.left) || null, 13031 top = 13032 parseFloat(that.element.css("top")) + 13033 (that.position.top - that.originalPosition.top) || null; 13034 13035 that.element.animate( 13036 $.extend(style, top && left ? { top: top, left: left } : {}), 13037 { 13038 duration: o.animateDuration, 13039 easing: o.animateEasing, 13040 step: function () { 13041 var data = { 13042 width: parseFloat(that.element.css("width")), 13043 height: parseFloat(that.element.css("height")), 13044 top: parseFloat(that.element.css("top")), 13045 left: parseFloat(that.element.css("left")), 13046 }; 13047 13048 if (pr && pr.length) { 13049 $(pr[0]).css({ width: data.width, height: data.height }); 13050 } 13051 13052 // Propagating resize, and updating values for each animation step 13053 that._updateCache(data); 13054 that._propagate("resize", event); 13055 }, 13056 } 13057 ); 13058 }, 13059 }); 13060 13061 $.ui.plugin.add("resizable", "containment", { 13062 start: function () { 13063 var element, 13064 p, 13065 co, 13066 ch, 13067 cw, 13068 width, 13069 height, 13070 that = $(this).resizable("instance"), 13071 o = that.options, 13072 el = that.element, 13073 oc = o.containment, 13074 ce = 13075 oc instanceof $ 13076 ? oc.get(0) 13077 : /parent/.test(oc) 13078 ? el.parent().get(0) 13079 : oc; 13080 13081 if (!ce) { 13082 return; 13083 } 13084 13085 that.containerElement = $(ce); 13086 13087 if (/document/.test(oc) || oc === document) { 13088 that.containerOffset = { 13089 left: 0, 13090 top: 0, 13091 }; 13092 that.containerPosition = { 13093 left: 0, 13094 top: 0, 13095 }; 13096 13097 that.parentData = { 13098 element: $(document), 13099 left: 0, 13100 top: 0, 13101 width: $(document).width(), 13102 height: $(document).height() || document.body.parentNode.scrollHeight, 13103 }; 13104 } else { 13105 element = $(ce); 13106 p = []; 13107 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 13108 p[i] = that._num(element.css("padding" + name)); 13109 }); 13110 13111 that.containerOffset = element.offset(); 13112 that.containerPosition = element.position(); 13113 that.containerSize = { 13114 height: element.innerHeight() - p[3], 13115 width: element.innerWidth() - p[1], 13116 }; 13117 13118 co = that.containerOffset; 13119 ch = that.containerSize.height; 13120 cw = that.containerSize.width; 13121 width = that._hasScroll(ce, "left") ? ce.scrollWidth : cw; 13122 height = that._hasScroll(ce) ? ce.scrollHeight : ch; 13123 13124 that.parentData = { 13125 element: ce, 13126 left: co.left, 13127 top: co.top, 13128 width: width, 13129 height: height, 13130 }; 13131 } 13132 }, 13133 13134 resize: function (event) { 13135 var woset, 13136 hoset, 13137 isParent, 13138 isOffsetRelative, 13139 that = $(this).resizable("instance"), 13140 o = that.options, 13141 co = that.containerOffset, 13142 cp = that.position, 13143 pRatio = that._aspectRatio || event.shiftKey, 13144 cop = { 13145 top: 0, 13146 left: 0, 13147 }, 13148 ce = that.containerElement, 13149 continueResize = true; 13150 13151 if (ce[0] !== document && /static/.test(ce.css("position"))) { 13152 cop = co; 13153 } 13154 13155 if (cp.left < (that._helper ? co.left : 0)) { 13156 that.size.width = 13157 that.size.width + 13158 (that._helper 13159 ? that.position.left - co.left 13160 : that.position.left - cop.left); 13161 13162 if (pRatio) { 13163 that.size.height = that.size.width / that.aspectRatio; 13164 continueResize = false; 13165 } 13166 that.position.left = o.helper ? co.left : 0; 13167 } 13168 13169 if (cp.top < (that._helper ? co.top : 0)) { 13170 that.size.height = 13171 that.size.height + 13172 (that._helper ? that.position.top - co.top : that.position.top); 13173 13174 if (pRatio) { 13175 that.size.width = that.size.height * that.aspectRatio; 13176 continueResize = false;
vendor: 4,884 bytes, lines 13177-13345
13177 } 13178 that.position.top = that._helper ? co.top : 0; 13179 } 13180 13181 isParent = that.containerElement.get(0) === that.element.parent().get(0); 13182 isOffsetRelative = /relative|absolute/.test( 13183 that.containerElement.css("position") 13184 ); 13185 13186 if (isParent && isOffsetRelative) { 13187 that.offset.left = that.parentData.left + that.position.left; 13188 that.offset.top = that.parentData.top + that.position.top; 13189 } else { 13190 that.offset.left = that.element.offset().left; 13191 that.offset.top = that.element.offset().top; 13192 } 13193 13194 woset = Math.abs( 13195 that.sizeDiff.width + 13196 (that._helper 13197 ? that.offset.left - cop.left 13198 : that.offset.left - co.left) 13199 ); 13200 13201 hoset = Math.abs( 13202 that.sizeDiff.height + 13203 (that._helper ? that.offset.top - cop.top : that.offset.top - co.top) 13204 ); 13205 13206 if (woset + that.size.width >= that.parentData.width) { 13207 that.size.width = that.parentData.width - woset; 13208 if (pRatio) { 13209 that.size.height = that.size.width / that.aspectRatio; 13210 continueResize = false; 13211 } 13212 } 13213 13214 if (hoset + that.size.height >= that.parentData.height) { 13215 that.size.height = that.parentData.height - hoset; 13216 if (pRatio) { 13217 that.size.width = that.size.height * that.aspectRatio; 13218 continueResize = false; 13219 } 13220 } 13221 13222 if (!continueResize) { 13223 that.position.left = that.prevPosition.left; 13224 that.position.top = that.prevPosition.top; 13225 that.size.width = that.prevSize.width; 13226 that.size.height = that.prevSize.height; 13227 } 13228 }, 13229 13230 stop: function () { 13231 var that = $(this).resizable("instance"), 13232 o = that.options, 13233 co = that.containerOffset, 13234 cop = that.containerPosition, 13235 ce = that.containerElement, 13236 helper = $(that.helper), 13237 ho = helper.offset(), 13238 w = helper.outerWidth() - that.sizeDiff.width, 13239 h = helper.outerHeight() - that.sizeDiff.height; 13240 13241 if (that._helper && !o.animate && /relative/.test(ce.css("position"))) { 13242 $(this).css({ 13243 left: ho.left - cop.left - co.left, 13244 width: w, 13245 height: h, 13246 }); 13247 } 13248 13249 if (that._helper && !o.animate && /static/.test(ce.css("position"))) { 13250 $(this).css({ 13251 left: ho.left - cop.left - co.left, 13252 width: w, 13253 height: h, 13254 }); 13255 } 13256 }, 13257 }); 13258 13259 $.ui.plugin.add("resizable", "alsoResize", { 13260 start: function () { 13261 var that = $(this).resizable("instance"), 13262 o = that.options; 13263 13264 $(o.alsoResize).each(function () { 13265 var el = $(this); 13266 el.data("ui-resizable-alsoresize", { 13267 width: parseFloat(el.css("width")), 13268 height: parseFloat(el.css("height")), 13269 left: parseFloat(el.css("left")), 13270 top: parseFloat(el.css("top")), 13271 }); 13272 }); 13273 }, 13274 13275 resize: function (event, ui) { 13276 var that = $(this).resizable("instance"), 13277 o = that.options, 13278 os = that.originalSize, 13279 op = that.originalPosition, 13280 delta = { 13281 height: that.size.height - os.height || 0, 13282 width: that.size.width - os.width || 0, 13283 top: that.position.top - op.top || 0, 13284 left: that.position.left - op.left || 0, 13285 }; 13286 13287 $(o.alsoResize).each(function () { 13288 var el = $(this), 13289 start = $(this).data("ui-resizable-alsoresize"), 13290 style = {}, 13291 css = el.parents(ui.originalElement[0]).length 13292 ? ["width", "height"] 13293 : ["width", "height", "top", "left"]; 13294 13295 $.each(css, function (i, prop) { 13296 var sum = (start[prop] || 0) + (delta[prop] || 0); 13297 if (sum && sum >= 0) { 13298 style[prop] = sum || null; 13299 } 13300 }); 13301 13302 el.css(style); 13303 }); 13304 }, 13305 13306 stop: function () { 13307 $(this).removeData("ui-resizable-alsoresize"); 13308 }, 13309 }); 13310 13311 $.ui.plugin.add("resizable", "ghost", { 13312 start: function () { 13313 var that = $(this).resizable("instance"), 13314 cs = that.size; 13315 13316 that.ghost = that.originalElement.clone(); 13317 that.ghost.css({ 13318 opacity: 0.25, 13319 display: "block", 13320 position: "relative", 13321 height: cs.height, 13322 width: cs.width, 13323 margin: 0, 13324 left: 0, 13325 top: 0, 13326 }); 13327 13328 that._addClass(that.ghost, "ui-resizable-ghost"); 13329 13330 // DEPRECATED 13331 // TODO: remove after 1.12 13332 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 13333 // Ghost option 13334 that.ghost.addClass(this.options.ghost); 13335 } 13336 13337 that.ghost.appendTo(that.helper); 13338 }, 13339 13340 resize: function () { 13341 var that = $(this).resizable("instance"); 13342 if (that.ghost) { 13343 that.ghost.css({ 13344 position: "relative", 13345 height: that.size.height,
vendor: 5,342 bytes, lines 13346-13539
13346 width: that.size.width, 13347 }); 13348 } 13349 }, 13350 13351 stop: function () { 13352 var that = $(this).resizable("instance"); 13353 if (that.ghost && that.helper) { 13354 that.helper.get(0).removeChild(that.ghost.get(0)); 13355 } 13356 }, 13357 }); 13358 13359 $.ui.plugin.add("resizable", "grid", { 13360 resize: function () { 13361 var outerDimensions, 13362 that = $(this).resizable("instance"), 13363 o = that.options, 13364 cs = that.size, 13365 os = that.originalSize, 13366 op = that.originalPosition, 13367 a = that.axis, 13368 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 13369 gridX = grid[0] || 1, 13370 gridY = grid[1] || 1, 13371 ox = Math.round((cs.width - os.width) / gridX) * gridX, 13372 oy = Math.round((cs.height - os.height) / gridY) * gridY, 13373 newWidth = os.width + ox, 13374 newHeight = os.height + oy, 13375 isMaxWidth = o.maxWidth && o.maxWidth < newWidth, 13376 isMaxHeight = o.maxHeight && o.maxHeight < newHeight, 13377 isMinWidth = o.minWidth && o.minWidth > newWidth, 13378 isMinHeight = o.minHeight && o.minHeight > newHeight; 13379 13380 o.grid = grid; 13381 13382 if (isMinWidth) { 13383 newWidth += gridX; 13384 } 13385 if (isMinHeight) { 13386 newHeight += gridY; 13387 } 13388 if (isMaxWidth) { 13389 newWidth -= gridX; 13390 } 13391 if (isMaxHeight) { 13392 newHeight -= gridY; 13393 } 13394 13395 if (/^(se|s|e)$/.test(a)) { 13396 that.size.width = newWidth; 13397 that.size.height = newHeight; 13398 } else if (/^(ne)$/.test(a)) { 13399 that.size.width = newWidth; 13400 that.size.height = newHeight; 13401 that.position.top = op.top - oy; 13402 } else if (/^(sw)$/.test(a)) { 13403 that.size.width = newWidth; 13404 that.size.height = newHeight; 13405 that.position.left = op.left - ox; 13406 } else { 13407 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 13408 outerDimensions = that._getPaddingPlusBorderDimensions(this); 13409 } 13410 13411 if (newHeight - gridY > 0) { 13412 that.size.height = newHeight; 13413 that.position.top = op.top - oy; 13414 } else { 13415 newHeight = gridY - outerDimensions.height; 13416 that.size.height = newHeight; 13417 that.position.top = op.top + os.height - newHeight; 13418 } 13419 if (newWidth - gridX > 0) { 13420 that.size.width = newWidth; 13421 that.position.left = op.left - ox; 13422 } else { 13423 newWidth = gridX - outerDimensions.width; 13424 that.size.width = newWidth; 13425 that.position.left = op.left + os.width - newWidth; 13426 } 13427 } 13428 }, 13429 }); 13430 13431 var widgetsResizable = $.ui.resizable; 13432 13433 /*! 13434 * jQuery UI Dialog 1.13.3 13435 * https://jqueryui.com 13436 * 13437 * Copyright OpenJS Foundation and other contributors 13438 * Released under the MIT license. 13439 * https://jquery.org/license 13440 */ 13441 13442 //>>label: Dialog 13443 //>>group: Widgets 13444 //>>description: Displays customizable dialog windows. 13445 //>>docs: https://api.jqueryui.com/dialog/ 13446 //>>demos: https://jqueryui.com/dialog/ 13447 //>>css.structure: ../../themes/base/core.css 13448 //>>css.structure: ../../themes/base/dialog.css 13449 //>>css.theme: ../../themes/base/theme.css 13450 13451 $.widget("ui.dialog", { 13452 version: "1.13.3", 13453 options: { 13454 appendTo: "body", 13455 autoOpen: true, 13456 buttons: [], 13457 classes: { 13458 "ui-dialog": "ui-corner-all", 13459 "ui-dialog-titlebar": "ui-corner-all", 13460 }, 13461 closeOnEscape: true, 13462 closeText: "Close", 13463 draggable: true, 13464 hide: null, 13465 height: "auto", 13466 maxHeight: null, 13467 maxWidth: null, 13468 minHeight: 150, 13469 minWidth: 150, 13470 modal: false, 13471 position: { 13472 my: "center", 13473 at: "center", 13474 of: window, 13475 collision: "fit", 13476 13477 // Ensure the titlebar is always visible 13478 using: function (pos) { 13479 var topOffset = $(this).css(pos).offset().top; 13480 if (topOffset < 0) { 13481 $(this).css("top", pos.top - topOffset); 13482 } 13483 }, 13484 }, 13485 resizable: true, 13486 show: null, 13487 title: null, 13488 width: 300, 13489 13490 // Callbacks 13491 beforeClose: null, 13492 close: null, 13493 drag: null, 13494 dragStart: null, 13495 dragStop: null, 13496 focus: null, 13497 open: null, 13498 resize: null, 13499 resizeStart: null, 13500 resizeStop: null, 13501 }, 13502 13503 sizeRelatedOptions: { 13504 buttons: true, 13505 height: true, 13506 maxHeight: true, 13507 maxWidth: true, 13508 minHeight: true, 13509 minWidth: true, 13510 width: true, 13511 }, 13512 13513 resizableRelatedOptions: { 13514 maxHeight: true, 13515 maxWidth: true, 13516 minHeight: true, 13517 minWidth: true, 13518 }, 13519 13520 _create: function () { 13521 this.originalCss = { 13522 display: this.element[0].style.display, 13523 width: this.element[0].style.width, 13524 minHeight: this.element[0].style.minHeight, 13525 maxHeight: this.element[0].style.maxHeight, 13526 height: this.element[0].style.height, 13527 }; 13528 this.originalPosition = { 13529 parent: this.element.parent(), 13530 index: this.element.parent().children().index(this.element), 13531 }; 13532 this.originalTitle = this.element.attr("title"); 13533 if (this.options.title == null && this.originalTitle != null) { 13534 this.options.title = this.originalTitle; 13535 } 13536 13537 // Dialogs can't be disabled 13538 if (this.options.disabled) { 13539 this.options.disabled = false;
vendor: 38,353 bytes, lines 13540-14881
13540 } 13541 13542 this._createWrapper(); 13543 13544 this.element.show().removeAttr("title").appendTo(this.uiDialog); 13545 13546 this._addClass("ui-dialog-content", "ui-widget-content"); 13547 13548 this._createTitlebar(); 13549 this._createButtonPane(); 13550 13551 if (this.options.draggable && $.fn.draggable) { 13552 this._makeDraggable(); 13553 } 13554 if (this.options.resizable && $.fn.resizable) { 13555 this._makeResizable(); 13556 } 13557 13558 this._isOpen = false; 13559 13560 this._trackFocus(); 13561 }, 13562 13563 _init: function () { 13564 if (this.options.autoOpen) { 13565 this.open(); 13566 } 13567 }, 13568 13569 _appendTo: function () { 13570 var element = this.options.appendTo; 13571 if (element && (element.jquery || element.nodeType)) { 13572 return $(element); 13573 } 13574 return this.document.find(element || "body").eq(0); 13575 }, 13576 13577 _destroy: function () { 13578 var next, 13579 originalPosition = this.originalPosition; 13580 13581 this._untrackInstance(); 13582 this._destroyOverlay(); 13583 13584 this.element 13585 .removeUniqueId() 13586 .css(this.originalCss) 13587 13588 // Without detaching first, the following becomes really slow 13589 .detach(); 13590 13591 this.uiDialog.remove(); 13592 13593 if (this.originalTitle) { 13594 this.element.attr("title", this.originalTitle); 13595 } 13596 13597 next = originalPosition.parent.children().eq(originalPosition.index); 13598 13599 // Don't try to place the dialog next to itself (#8613) 13600 if (next.length && next[0] !== this.element[0]) { 13601 next.before(this.element); 13602 } else { 13603 originalPosition.parent.append(this.element); 13604 } 13605 }, 13606 13607 widget: function () { 13608 return this.uiDialog; 13609 }, 13610 13611 disable: $.noop, 13612 enable: $.noop, 13613 13614 close: function (event) { 13615 var that = this; 13616 13617 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 13618 return; 13619 } 13620 13621 this._isOpen = false; 13622 this._focusedElement = null; 13623 this._destroyOverlay(); 13624 this._untrackInstance(); 13625 13626 if (!this.opener.filter(":focusable").trigger("focus").length) { 13627 // Hiding a focused element doesn't trigger blur in WebKit 13628 // so in case we have nothing to focus on, explicitly blur the active element 13629 // https://bugs.webkit.org/show_bug.cgi?id=47182 13630 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 13631 } 13632 13633 this._hide(this.uiDialog, this.options.hide, function () { 13634 that._trigger("close", event); 13635 }); 13636 }, 13637 13638 isOpen: function () { 13639 return this._isOpen; 13640 }, 13641 13642 moveToTop: function () { 13643 this._moveToTop(); 13644 }, 13645 13646 _moveToTop: function (event, silent) { 13647 var moved = false, 13648 zIndices = this.uiDialog 13649 .siblings(".ui-front:visible") 13650 .map(function () { 13651 return +$(this).css("z-index"); 13652 }) 13653 .get(), 13654 zIndexMax = Math.max.apply(null, zIndices); 13655 13656 if (zIndexMax >= +this.uiDialog.css("z-index")) { 13657 this.uiDialog.css("z-index", zIndexMax + 1); 13658 moved = true; 13659 } 13660 13661 if (moved && !silent) { 13662 this._trigger("focus", event); 13663 } 13664 return moved; 13665 }, 13666 13667 open: function () { 13668 var that = this; 13669 if (this._isOpen) { 13670 if (this._moveToTop()) { 13671 this._focusTabbable(); 13672 } 13673 return; 13674 } 13675 13676 this._isOpen = true; 13677 this.opener = $($.ui.safeActiveElement(this.document[0])); 13678 13679 this._size(); 13680 this._position(); 13681 this._createOverlay(); 13682 this._moveToTop(null, true); 13683 13684 // Ensure the overlay is moved to the top with the dialog, but only when 13685 // opening. The overlay shouldn't move after the dialog is open so that 13686 // modeless dialogs opened after the modal dialog stack properly. 13687 if (this.overlay) { 13688 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 13689 } 13690 13691 this._show(this.uiDialog, this.options.show, function () { 13692 that._focusTabbable(); 13693 that._trigger("focus"); 13694 }); 13695 13696 // Track the dialog immediately upon opening in case a focus event 13697 // somehow occurs outside of the dialog before an element inside the 13698 // dialog is focused (#10152) 13699 this._makeFocusTarget(); 13700 13701 this._trigger("open"); 13702 }, 13703 13704 _focusTabbable: function () { 13705 // Set focus to the first match: 13706 // 1. An element that was focused previously 13707 // 2. First element inside the dialog matching [autofocus] 13708 // 3. Tabbable element inside the content element 13709 // 4. Tabbable element inside the buttonpane 13710 // 5. The close button 13711 // 6. The dialog itself 13712 var hasFocus = this._focusedElement; 13713 if (!hasFocus) { 13714 hasFocus = this.element.find("[autofocus]"); 13715 } 13716 if (!hasFocus.length) { 13717 hasFocus = this.element.find(":tabbable"); 13718 } 13719 if (!hasFocus.length) { 13720 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 13721 } 13722 if (!hasFocus.length) { 13723 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 13724 } 13725 if (!hasFocus.length) { 13726 hasFocus = this.uiDialog; 13727 } 13728 hasFocus.eq(0).trigger("focus"); 13729 }, 13730 13731 _restoreTabbableFocus: function () { 13732 var activeElement = $.ui.safeActiveElement(this.document[0]), 13733 isActive = 13734 this.uiDialog[0] === activeElement || 13735 $.contains(this.uiDialog[0], activeElement); 13736 if (!isActive) { 13737 this._focusTabbable(); 13738 } 13739 }, 13740 13741 _keepFocus: function (event) { 13742 event.preventDefault(); 13743 this._restoreTabbableFocus(); 13744 13745 // support: IE 13746 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 13747 // so we check again later 13748 this._delay(this._restoreTabbableFocus); 13749 }, 13750 13751 _createWrapper: function () { 13752 this.uiDialog = $("<div>") 13753 .hide() 13754 .attr({ 13755 // Setting tabIndex makes the div focusable 13756 tabIndex: -1, 13757 role: "dialog", 13758 }) 13759 .appendTo(this._appendTo()); 13760 13761 this._addClass( 13762 this.uiDialog, 13763 "ui-dialog", 13764 "ui-widget ui-widget-content ui-front" 13765 ); 13766 this._on(this.uiDialog, { 13767 keydown: function (event) { 13768 if ( 13769 this.options.closeOnEscape && 13770 !event.isDefaultPrevented() && 13771 event.keyCode && 13772 event.keyCode === $.ui.keyCode.ESCAPE 13773 ) { 13774 event.preventDefault(); 13775 this.close(event); 13776 return; 13777 } 13778 13779 // Prevent tabbing out of dialogs 13780 if ( 13781 event.keyCode !== $.ui.keyCode.TAB || 13782 event.isDefaultPrevented() 13783 ) { 13784 return; 13785 } 13786 var tabbables = this.uiDialog.find(":tabbable"), 13787 first = tabbables.first(), 13788 last = tabbables.last(); 13789 13790 if ( 13791 (event.target === last[0] || event.target === this.uiDialog[0]) && 13792 !event.shiftKey 13793 ) { 13794 this._delay(function () { 13795 first.trigger("focus"); 13796 }); 13797 event.preventDefault(); 13798 } else if ( 13799 (event.target === first[0] || event.target === this.uiDialog[0]) && 13800 event.shiftKey 13801 ) { 13802 this._delay(function () { 13803 last.trigger("focus"); 13804 }); 13805 event.preventDefault(); 13806 } 13807 }, 13808 mousedown: function (event) { 13809 if (this._moveToTop(event)) { 13810 this._focusTabbable(); 13811 } 13812 }, 13813 }); 13814 13815 // We assume that any existing aria-describedby attribute means 13816 // that the dialog content is marked up properly 13817 // otherwise we brute force the content as the description 13818 if (!this.element.find("[aria-describedby]").length) { 13819 this.uiDialog.attr({ 13820 "aria-describedby": this.element.uniqueId().attr("id"), 13821 }); 13822 } 13823 }, 13824 13825 _createTitlebar: function () { 13826 var uiDialogTitle; 13827 13828 this.uiDialogTitlebar = $("<div>"); 13829 this._addClass( 13830 this.uiDialogTitlebar, 13831 "ui-dialog-titlebar", 13832 "ui-widget-header ui-helper-clearfix" 13833 ); 13834 this._on(this.uiDialogTitlebar, { 13835 mousedown: function (event) { 13836 // Don't prevent click on close button (#8838) 13837 // Focusing a dialog that is partially scrolled out of view 13838 // causes the browser to scroll it into view, preventing the click event 13839 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 13840 // Dialog isn't getting focus when dragging (#8063) 13841 this.uiDialog.trigger("focus"); 13842 } 13843 }, 13844 }); 13845 13846 // Support: IE 13847 // Use type="button" to prevent enter keypresses in textboxes from closing the 13848 // dialog in IE (#9312) 13849 this.uiDialogTitlebarClose = $("<button type='button'></button>") 13850 .button({ 13851 label: $("<a>").text(this.options.closeText).html(), 13852 icon: "ui-icon-closethick", 13853 showLabel: false, 13854 }) 13855 .appendTo(this.uiDialogTitlebar); 13856 13857 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 13858 this._on(this.uiDialogTitlebarClose, { 13859 click: function (event) { 13860 event.preventDefault(); 13861 this.close(event); 13862 }, 13863 }); 13864 13865 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 13866 this._addClass(uiDialogTitle, "ui-dialog-title"); 13867 this._title(uiDialogTitle); 13868 13869 this.uiDialogTitlebar.prependTo(this.uiDialog); 13870 13871 this.uiDialog.attr({ 13872 "aria-labelledby": uiDialogTitle.attr("id"), 13873 }); 13874 }, 13875 13876 _title: function (title) { 13877 if (this.options.title) { 13878 title.text(this.options.title); 13879 } else { 13880 title.html(" "); 13881 } 13882 }, 13883 13884 _createButtonPane: function () { 13885 this.uiDialogButtonPane = $("<div>"); 13886 this._addClass( 13887 this.uiDialogButtonPane, 13888 "ui-dialog-buttonpane", 13889 "ui-widget-content ui-helper-clearfix" 13890 ); 13891 13892 this.uiButtonSet = $("<div>").appendTo(this.uiDialogButtonPane); 13893 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 13894 13895 this._createButtons(); 13896 }, 13897 13898 _createButtons: function () { 13899 var that = this, 13900 buttons = this.options.buttons; 13901 13902 // If we already have a button pane, remove it 13903 this.uiDialogButtonPane.remove(); 13904 this.uiButtonSet.empty(); 13905 13906 if ( 13907 $.isEmptyObject(buttons) || 13908 (Array.isArray(buttons) && !buttons.length) 13909 ) { 13910 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 13911 return; 13912 } 13913 13914 $.each(buttons, function (name, props) { 13915 var click, buttonOptions; 13916 props = 13917 typeof props === "function" ? { click: props, text: name } : props; 13918 13919 // Default to a non-submitting button 13920 props = $.extend({ type: "button" }, props); 13921 13922 // Change the context for the click callback to be the main element 13923 click = props.click; 13924 buttonOptions = { 13925 icon: props.icon, 13926 iconPosition: props.iconPosition, 13927 showLabel: props.showLabel, 13928 13929 // Deprecated options 13930 icons: props.icons, 13931 text: props.text, 13932 }; 13933 13934 delete props.click; 13935 delete props.icon; 13936 delete props.iconPosition; 13937 delete props.showLabel; 13938 13939 // Deprecated options 13940 delete props.icons; 13941 if (typeof props.text === "boolean") { 13942 delete props.text; 13943 } 13944 13945 $("<button></button>", props) 13946 .button(buttonOptions) 13947 .appendTo(that.uiButtonSet) 13948 .on("click", function () { 13949 click.apply(that.element[0], arguments); 13950 }); 13951 }); 13952 this._addClass(this.uiDialog, "ui-dialog-buttons"); 13953 this.uiDialogButtonPane.appendTo(this.uiDialog); 13954 }, 13955 13956 _makeDraggable: function () { 13957 var that = this, 13958 options = this.options; 13959 13960 function filteredUi(ui) { 13961 return { 13962 position: ui.position, 13963 offset: ui.offset, 13964 }; 13965 } 13966 13967 this.uiDialog.draggable({ 13968 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 13969 handle: ".ui-dialog-titlebar", 13970 containment: "document", 13971 start: function (event, ui) { 13972 that._addClass($(this), "ui-dialog-dragging"); 13973 that._blockFrames(); 13974 that._trigger("dragStart", event, filteredUi(ui)); 13975 }, 13976 drag: function (event, ui) { 13977 that._trigger("drag", event, filteredUi(ui)); 13978 }, 13979 stop: function (event, ui) { 13980 var left = ui.offset.left - that.document.scrollLeft(), 13981 top = ui.offset.top - that.document.scrollTop(); 13982 13983 options.position = { 13984 my: "left top", 13985 at: 13986 "left" + 13987 (left >= 0 ? "+" : "") + 13988 left + 13989 " " + 13990 "top" + 13991 (top >= 0 ? "+" : "") + 13992 top, 13993 of: that.window, 13994 }; 13995 that._removeClass($(this), "ui-dialog-dragging"); 13996 that._unblockFrames(); 13997 that._trigger("dragStop", event, filteredUi(ui)); 13998 }, 13999 }); 14000 }, 14001 14002 _makeResizable: function () { 14003 var that = this, 14004 options = this.options, 14005 handles = options.resizable, 14006 // .ui-resizable has position: relative defined in the stylesheet 14007 // but dialogs have to use absolute or fixed positioning 14008 position = this.uiDialog.css("position"), 14009 resizeHandles = 14010 typeof handles === "string" ? handles : "n,e,s,w,se,sw,ne,nw"; 14011 14012 function filteredUi(ui) { 14013 return { 14014 originalPosition: ui.originalPosition, 14015 originalSize: ui.originalSize, 14016 position: ui.position, 14017 size: ui.size, 14018 }; 14019 } 14020 14021 this.uiDialog 14022 .resizable({ 14023 cancel: ".ui-dialog-content", 14024 containment: "document", 14025 alsoResize: this.element, 14026 maxWidth: options.maxWidth, 14027 maxHeight: options.maxHeight, 14028 minWidth: options.minWidth, 14029 minHeight: this._minHeight(), 14030 handles: resizeHandles, 14031 start: function (event, ui) { 14032 that._addClass($(this), "ui-dialog-resizing"); 14033 that._blockFrames(); 14034 that._trigger("resizeStart", event, filteredUi(ui)); 14035 }, 14036 resize: function (event, ui) { 14037 that._trigger("resize", event, filteredUi(ui)); 14038 }, 14039 stop: function (event, ui) { 14040 var offset = that.uiDialog.offset(), 14041 left = offset.left - that.document.scrollLeft(), 14042 top = offset.top - that.document.scrollTop(); 14043 14044 options.height = that.uiDialog.height(); 14045 options.width = that.uiDialog.width(); 14046 options.position = { 14047 my: "left top", 14048 at: 14049 "left" + 14050 (left >= 0 ? "+" : "") + 14051 left + 14052 " " + 14053 "top" + 14054 (top >= 0 ? "+" : "") + 14055 top, 14056 of: that.window, 14057 }; 14058 that._removeClass($(this), "ui-dialog-resizing"); 14059 that._unblockFrames(); 14060 that._trigger("resizeStop", event, filteredUi(ui)); 14061 }, 14062 }) 14063 .css("position", position); 14064 }, 14065 14066 _trackFocus: function () { 14067 this._on(this.widget(), { 14068 focusin: function (event) { 14069 this._makeFocusTarget(); 14070 this._focusedElement = $(event.target); 14071 }, 14072 }); 14073 }, 14074 14075 _makeFocusTarget: function () { 14076 this._untrackInstance(); 14077 this._trackingInstances().unshift(this); 14078 }, 14079 14080 _untrackInstance: function () { 14081 var instances = this._trackingInstances(), 14082 exists = $.inArray(this, instances); 14083 if (exists !== -1) { 14084 instances.splice(exists, 1); 14085 } 14086 }, 14087 14088 _trackingInstances: function () { 14089 var instances = this.document.data("ui-dialog-instances"); 14090 if (!instances) { 14091 instances = []; 14092 this.document.data("ui-dialog-instances", instances); 14093 } 14094 return instances; 14095 }, 14096 14097 _minHeight: function () { 14098 var options = this.options; 14099 14100 return options.height === "auto" 14101 ? options.minHeight 14102 : Math.min(options.minHeight, options.height); 14103 }, 14104 14105 _position: function () { 14106 // Need to show the dialog to get the actual offset in the position plugin 14107 var isVisible = this.uiDialog.is(":visible"); 14108 if (!isVisible) { 14109 this.uiDialog.show(); 14110 } 14111 this.uiDialog.position(this.options.position); 14112 if (!isVisible) { 14113 this.uiDialog.hide(); 14114 } 14115 }, 14116 14117 _setOptions: function (options) { 14118 var that = this, 14119 resize = false, 14120 resizableOptions = {}; 14121 14122 $.each(options, function (key, value) { 14123 that._setOption(key, value); 14124 14125 if (key in that.sizeRelatedOptions) { 14126 resize = true; 14127 } 14128 if (key in that.resizableRelatedOptions) { 14129 resizableOptions[key] = value; 14130 } 14131 }); 14132 14133 if (resize) { 14134 this._size(); 14135 this._position(); 14136 } 14137 if (this.uiDialog.is(":data(ui-resizable)")) { 14138 this.uiDialog.resizable("option", resizableOptions); 14139 } 14140 }, 14141 14142 _setOption: function (key, value) { 14143 var isDraggable, 14144 isResizable, 14145 uiDialog = this.uiDialog; 14146 14147 if (key === "disabled") { 14148 return; 14149 } 14150 14151 this._super(key, value); 14152 14153 if (key === "appendTo") { 14154 this.uiDialog.appendTo(this._appendTo()); 14155 } 14156 14157 if (key === "buttons") { 14158 this._createButtons(); 14159 } 14160 14161 if (key === "closeText") { 14162 this.uiDialogTitlebarClose.button({ 14163 // Ensure that we always pass a string 14164 label: $("<a>") 14165 .text("" + this.options.closeText) 14166 .html(), 14167 }); 14168 } 14169 14170 if (key === "draggable") { 14171 isDraggable = uiDialog.is(":data(ui-draggable)"); 14172 if (isDraggable && !value) { 14173 uiDialog.draggable("destroy"); 14174 } 14175 14176 if (!isDraggable && value) { 14177 this._makeDraggable(); 14178 } 14179 } 14180 14181 if (key === "position") { 14182 this._position(); 14183 } 14184 14185 if (key === "resizable") { 14186 // currently resizable, becoming non-resizable 14187 isResizable = uiDialog.is(":data(ui-resizable)"); 14188 if (isResizable && !value) { 14189 uiDialog.resizable("destroy"); 14190 } 14191 14192 // Currently resizable, changing handles 14193 if (isResizable && typeof value === "string") { 14194 uiDialog.resizable("option", "handles", value); 14195 } 14196 14197 // Currently non-resizable, becoming resizable 14198 if (!isResizable && value !== false) { 14199 this._makeResizable(); 14200 } 14201 } 14202 14203 if (key === "title") { 14204 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 14205 } 14206 }, 14207 14208 _size: function () { 14209 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 14210 // divs will both have width and height set, so we need to reset them 14211 var nonContentHeight, 14212 minContentHeight, 14213 maxContentHeight, 14214 options = this.options; 14215 14216 // Reset content sizing 14217 this.element.show().css({ 14218 width: "auto", 14219 minHeight: 0, 14220 maxHeight: "none", 14221 height: 0, 14222 }); 14223 14224 if (options.minWidth > options.width) { 14225 options.width = options.minWidth; 14226 } 14227 14228 // Reset wrapper sizing 14229 // determine the height of all the non-content elements 14230 nonContentHeight = this.uiDialog 14231 .css({ 14232 height: "auto", 14233 width: options.width, 14234 }) 14235 .outerHeight(); 14236 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 14237 maxContentHeight = 14238 typeof options.maxHeight === "number" 14239 ? Math.max(0, options.maxHeight - nonContentHeight) 14240 : "none"; 14241 14242 if (options.height === "auto") { 14243 this.element.css({ 14244 minHeight: minContentHeight, 14245 maxHeight: maxContentHeight, 14246 height: "auto", 14247 }); 14248 } else { 14249 this.element.height(Math.max(0, options.height - nonContentHeight)); 14250 } 14251 14252 if (this.uiDialog.is(":data(ui-resizable)")) { 14253 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 14254 } 14255 }, 14256 14257 _blockFrames: function () { 14258 this.iframeBlocks = this.document.find("iframe").map(function () { 14259 var iframe = $(this); 14260 14261 return $("<div>") 14262 .css({ 14263 position: "absolute", 14264 width: iframe.outerWidth(), 14265 height: iframe.outerHeight(), 14266 }) 14267 .appendTo(iframe.parent()) 14268 .offset(iframe.offset())[0]; 14269 }); 14270 }, 14271 14272 _unblockFrames: function () { 14273 if (this.iframeBlocks) { 14274 this.iframeBlocks.remove(); 14275 delete this.iframeBlocks; 14276 } 14277 }, 14278 14279 _allowInteraction: function (event) { 14280 if ($(event.target).closest(".ui-dialog").length) { 14281 return true; 14282 } 14283 14284 // TODO: Remove hack when datepicker implements 14285 // the .ui-front logic (#8989) 14286 return !!$(event.target).closest(".ui-datepicker").length; 14287 }, 14288 14289 _createOverlay: function () { 14290 if (!this.options.modal) { 14291 return; 14292 } 14293 14294 var jqMinor = $.fn.jquery.substring(0, 4); 14295 14296 // We use a delay in case the overlay is created from an 14297 // event that we're going to be cancelling (#2804) 14298 var isOpening = true; 14299 this._delay(function () { 14300 isOpening = false; 14301 }); 14302 14303 if (!this.document.data("ui-dialog-overlays")) { 14304 // Prevent use of anchors and inputs 14305 // This doesn't use `_on()` because it is a shared event handler 14306 // across all open modal dialogs. 14307 this.document.on( 14308 "focusin.ui-dialog", 14309 function (event) { 14310 if (isOpening) { 14311 return; 14312 } 14313 14314 var instance = this._trackingInstances()[0]; 14315 if (!instance._allowInteraction(event)) { 14316 event.preventDefault(); 14317 instance._focusTabbable(); 14318 14319 // Support: jQuery >=3.4 <3.7 only 14320 // In jQuery 3.4-3.6, there are multiple issues with focus/blur 14321 // trigger chains or when triggering is done on a hidden element 14322 // at least once. 14323 // Trigger focus in a delay in addition if needed to avoid the issues. 14324 // See https://github.com/jquery/jquery/issues/4382 14325 // See https://github.com/jquery/jquery/issues/4856 14326 // See https://github.com/jquery/jquery/issues/4950 14327 if ( 14328 jqMinor === "3.4." || 14329 jqMinor === "3.5." || 14330 jqMinor === "3.6." 14331 ) { 14332 instance._delay(instance._restoreTabbableFocus); 14333 } 14334 } 14335 }.bind(this) 14336 ); 14337 } 14338 14339 this.overlay = $("<div>").appendTo(this._appendTo()); 14340 14341 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 14342 this._on(this.overlay, { 14343 mousedown: "_keepFocus", 14344 }); 14345 this.document.data( 14346 "ui-dialog-overlays", 14347 (this.document.data("ui-dialog-overlays") || 0) + 1 14348 ); 14349 }, 14350 14351 _destroyOverlay: function () { 14352 if (!this.options.modal) { 14353 return; 14354 } 14355 14356 if (this.overlay) { 14357 var overlays = this.document.data("ui-dialog-overlays") - 1; 14358 14359 if (!overlays) { 14360 this.document.off("focusin.ui-dialog"); 14361 this.document.removeData("ui-dialog-overlays"); 14362 } else { 14363 this.document.data("ui-dialog-overlays", overlays); 14364 } 14365 14366 this.overlay.remove(); 14367 this.overlay = null; 14368 } 14369 }, 14370 }); 14371 14372 // DEPRECATED 14373 // TODO: switch return back to widget declaration at top of file when this is removed 14374 if ($.uiBackCompat !== false) { 14375 // Backcompat for dialogClass option 14376 $.widget("ui.dialog", $.ui.dialog, { 14377 options: { 14378 dialogClass: "", 14379 }, 14380 _createWrapper: function () { 14381 this._super(); 14382 this.uiDialog.addClass(this.options.dialogClass); 14383 }, 14384 _setOption: function (key, value) { 14385 if (key === "dialogClass") { 14386 this.uiDialog.removeClass(this.options.dialogClass).addClass(value); 14387 } 14388 this._superApply(arguments); 14389 }, 14390 }); 14391 } 14392 14393 var widgetsDialog = $.ui.dialog; 14394 14395 /*! 14396 * jQuery UI Droppable 1.13.3 14397 * https://jqueryui.com 14398 * 14399 * Copyright OpenJS Foundation and other contributors 14400 * Released under the MIT license. 14401 * https://jquery.org/license 14402 */ 14403 14404 //>>label: Droppable 14405 //>>group: Interactions 14406 //>>description: Enables drop targets for draggable elements. 14407 //>>docs: https://api.jqueryui.com/droppable/ 14408 //>>demos: https://jqueryui.com/droppable/ 14409 14410 $.widget("ui.droppable", { 14411 version: "1.13.3", 14412 widgetEventPrefix: "drop", 14413 options: { 14414 accept: "*", 14415 addClasses: true, 14416 greedy: false, 14417 scope: "default", 14418 tolerance: "intersect", 14419 14420 // Callbacks 14421 activate: null, 14422 deactivate: null, 14423 drop: null, 14424 out: null, 14425 over: null, 14426 }, 14427 _create: function () { 14428 var proportions, 14429 o = this.options, 14430 accept = o.accept; 14431 14432 this.isover = false; 14433 this.isout = true; 14434 14435 this.accept = 14436 typeof accept === "function" 14437 ? accept 14438 : function (d) { 14439 return d.is(accept); 14440 }; 14441 14442 this.proportions = function (/* valueToWrite */) { 14443 if (arguments.length) { 14444 // Store the droppable's proportions 14445 proportions = arguments[0]; 14446 } else { 14447 // Retrieve or derive the droppable's proportions 14448 return proportions 14449 ? proportions 14450 : (proportions = { 14451 width: this.element[0].offsetWidth, 14452 height: this.element[0].offsetHeight, 14453 }); 14454 } 14455 }; 14456 14457 this._addToManager(o.scope); 14458 14459 if (o.addClasses) { 14460 this._addClass("ui-droppable"); 14461 } 14462 }, 14463 14464 _addToManager: function (scope) { 14465 // Add the reference and positions to the manager 14466 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 14467 $.ui.ddmanager.droppables[scope].push(this); 14468 }, 14469 14470 _splice: function (drop) { 14471 var i = 0; 14472 for (; i < drop.length; i++) { 14473 if (drop[i] === this) { 14474 drop.splice(i, 1); 14475 } 14476 } 14477 }, 14478 14479 _destroy: function () { 14480 var drop = $.ui.ddmanager.droppables[this.options.scope]; 14481 14482 this._splice(drop); 14483 }, 14484 14485 _setOption: function (key, value) { 14486 if (key === "accept") { 14487 this.accept = 14488 typeof value === "function" 14489 ? value 14490 : function (d) { 14491 return d.is(value); 14492 }; 14493 } else if (key === "scope") { 14494 var drop = $.ui.ddmanager.droppables[this.options.scope]; 14495 14496 this._splice(drop); 14497 this._addToManager(value); 14498 } 14499 14500 this._super(key, value); 14501 }, 14502 14503 _activate: function (event) { 14504 var draggable = $.ui.ddmanager.current; 14505 14506 this._addActiveClass(); 14507 if (draggable) { 14508 this._trigger("activate", event, this.ui(draggable)); 14509 } 14510 }, 14511 14512 _deactivate: function (event) { 14513 var draggable = $.ui.ddmanager.current; 14514 14515 this._removeActiveClass(); 14516 if (draggable) { 14517 this._trigger("deactivate", event, this.ui(draggable)); 14518 } 14519 }, 14520 14521 _over: function (event) { 14522 var draggable = $.ui.ddmanager.current; 14523 14524 // Bail if draggable and droppable are same element 14525 if ( 14526 !draggable || 14527 (draggable.currentItem || draggable.element)[0] === this.element[0] 14528 ) { 14529 return; 14530 } 14531 14532 if ( 14533 this.accept.call( 14534 this.element[0], 14535 draggable.currentItem || draggable.element 14536 ) 14537 ) { 14538 this._addHoverClass(); 14539 this._trigger("over", event, this.ui(draggable)); 14540 } 14541 }, 14542 14543 _out: function (event) { 14544 var draggable = $.ui.ddmanager.current; 14545 14546 // Bail if draggable and droppable are same element 14547 if ( 14548 !draggable || 14549 (draggable.currentItem || draggable.element)[0] === this.element[0] 14550 ) { 14551 return; 14552 } 14553 14554 if ( 14555 this.accept.call( 14556 this.element[0], 14557 draggable.currentItem || draggable.element 14558 ) 14559 ) { 14560 this._removeHoverClass(); 14561 this._trigger("out", event, this.ui(draggable)); 14562 } 14563 }, 14564 14565 _drop: function (event, custom) { 14566 var draggable = custom || $.ui.ddmanager.current, 14567 childrenIntersection = false; 14568 14569 // Bail if draggable and droppable are same element 14570 if ( 14571 !draggable || 14572 (draggable.currentItem || draggable.element)[0] === this.element[0] 14573 ) { 14574 return false; 14575 } 14576 14577 this.element 14578 .find(":data(ui-droppable)") 14579 .not(".ui-draggable-dragging") 14580 .each(function () { 14581 var inst = $(this).droppable("instance"); 14582 if ( 14583 inst.options.greedy && 14584 !inst.options.disabled && 14585 inst.options.scope === draggable.options.scope && 14586 inst.accept.call( 14587 inst.element[0], 14588 draggable.currentItem || draggable.element 14589 ) && 14590 $.ui.intersect( 14591 draggable, 14592 $.extend(inst, { offset: inst.element.offset() }), 14593 inst.options.tolerance, 14594 event 14595 ) 14596 ) { 14597 childrenIntersection = true; 14598 return false; 14599 } 14600 }); 14601 if (childrenIntersection) { 14602 return false; 14603 } 14604 14605 if ( 14606 this.accept.call( 14607 this.element[0], 14608 draggable.currentItem || draggable.element 14609 ) 14610 ) { 14611 this._removeActiveClass(); 14612 this._removeHoverClass(); 14613 14614 this._trigger("drop", event, this.ui(draggable)); 14615 return this.element; 14616 } 14617 14618 return false; 14619 }, 14620 14621 ui: function (c) { 14622 return { 14623 draggable: c.currentItem || c.element, 14624 helper: c.helper, 14625 position: c.position, 14626 offset: c.positionAbs, 14627 }; 14628 }, 14629 14630 // Extension points just to make backcompat sane and avoid duplicating logic 14631 // TODO: Remove in 1.14 along with call to it below 14632 _addHoverClass: function () { 14633 this._addClass("ui-droppable-hover"); 14634 }, 14635 14636 _removeHoverClass: function () { 14637 this._removeClass("ui-droppable-hover"); 14638 }, 14639 14640 _addActiveClass: function () { 14641 this._addClass("ui-droppable-active"); 14642 }, 14643 14644 _removeActiveClass: function () { 14645 this._removeClass("ui-droppable-active"); 14646 }, 14647 }); 14648 14649 $.ui.intersect = (function () { 14650 function isOverAxis(x, reference, size) { 14651 return x >= reference && x < reference + size; 14652 } 14653 14654 return function (draggable, droppable, toleranceMode, event) { 14655 if (!droppable.offset) { 14656 return false; 14657 } 14658 14659 var x1 = 14660 (draggable.positionAbs || draggable.position.absolute).left + 14661 draggable.margins.left, 14662 y1 = 14663 (draggable.positionAbs || draggable.position.absolute).top + 14664 draggable.margins.top, 14665 x2 = x1 + draggable.helperProportions.width, 14666 y2 = y1 + draggable.helperProportions.height, 14667 l = droppable.offset.left, 14668 t = droppable.offset.top, 14669 r = l + droppable.proportions().width, 14670 b = t + droppable.proportions().height; 14671 14672 switch (toleranceMode) { 14673 case "fit": 14674 return l <= x1 && x2 <= r && t <= y1 && y2 <= b; 14675 case "intersect": 14676 return ( 14677 l < x1 + draggable.helperProportions.width / 2 && // Right Half 14678 x2 - draggable.helperProportions.width / 2 < r && // Left Half 14679 t < y1 + draggable.helperProportions.height / 2 && // Bottom Half 14680 y2 - draggable.helperProportions.height / 2 < b 14681 ); // Top Half 14682 case "pointer": 14683 return ( 14684 isOverAxis(event.pageY, t, droppable.proportions().height) && 14685 isOverAxis(event.pageX, l, droppable.proportions().width) 14686 ); 14687 case "touch": 14688 return ( 14689 ((y1 >= t && y1 <= b) || // Top edge touching 14690 (y2 >= t && y2 <= b) || // Bottom edge touching 14691 (y1 < t && y2 > b)) && // Surrounded vertically 14692 ((x1 >= l && x1 <= r) || // Left edge touching 14693 (x2 >= l && x2 <= r) || // Right edge touching 14694 (x1 < l && x2 > r)) // Surrounded horizontally 14695 ); 14696 default: 14697 return false; 14698 } 14699 }; 14700 })(); 14701 14702 /* 14703 This manager tracks offsets of draggables and droppables 14704*/ 14705 $.ui.ddmanager = { 14706 current: null, 14707 droppables: { default: [] }, 14708 prepareOffsets: function (t, event) { 14709 var i, 14710 j, 14711 m = $.ui.ddmanager.droppables[t.options.scope] || [], 14712 type = event ? event.type : null, // workaround for #2317 14713 list = (t.currentItem || t.element) 14714 .find(":data(ui-droppable)") 14715 .addBack(); 14716 14717 droppablesLoop: for (i = 0; i < m.length; i++) { 14718 // No disabled and non-accepted 14719 if ( 14720 m[i].options.disabled || 14721 (t && !m[i].accept.call(m[i].element[0], t.currentItem || t.element)) 14722 ) { 14723 continue; 14724 } 14725 14726 // Filter out elements in the current dragged item 14727 for (j = 0; j < list.length; j++) { 14728 if (list[j] === m[i].element[0]) { 14729 m[i].proportions().height = 0; 14730 continue droppablesLoop; 14731 } 14732 } 14733 14734 m[i].visible = m[i].element.css("display") !== "none"; 14735 if (!m[i].visible) { 14736 continue; 14737 } 14738 14739 // Activate the droppable if used directly from draggables 14740 if (type === "mousedown") { 14741 m[i]._activate.call(m[i], event); 14742 } 14743 14744 m[i].offset = m[i].element.offset(); 14745 m[i].proportions({ 14746 width: m[i].element[0].offsetWidth, 14747 height: m[i].element[0].offsetHeight, 14748 }); 14749 } 14750 }, 14751 drop: function (draggable, event) { 14752 var dropped = false; 14753 14754 // Create a copy of the droppables in case the list changes during the drop (#9116) 14755 $.each( 14756 ($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), 14757 function () { 14758 if (!this.options) { 14759 return; 14760 } 14761 if ( 14762 !this.options.disabled && 14763 this.visible && 14764 $.ui.intersect(draggable, this, this.options.tolerance, event) 14765 ) { 14766 dropped = this._drop.call(this, event) || dropped; 14767 } 14768 14769 if ( 14770 !this.options.disabled && 14771 this.visible && 14772 this.accept.call( 14773 this.element[0], 14774 draggable.currentItem || draggable.element 14775 ) 14776 ) { 14777 this.isout = true; 14778 this.isover = false; 14779 this._deactivate.call(this, event); 14780 } 14781 } 14782 ); 14783 return dropped; 14784 }, 14785 dragStart: function (draggable, event) { 14786 // Listen for scrolling so that if the dragging causes scrolling the position of the 14787 // droppables can be recalculated (see #5003) 14788 draggable.element 14789 .parentsUntil("body") 14790 .on("scroll.droppable", function () { 14791 if (!draggable.options.refreshPositions) { 14792 $.ui.ddmanager.prepareOffsets(draggable, event); 14793 } 14794 }); 14795 }, 14796 drag: function (draggable, event) { 14797 // If you have a highly dynamic page, you might try this option. It renders positions 14798 // every time you move the mouse. 14799 if (draggable.options.refreshPositions) { 14800 $.ui.ddmanager.prepareOffsets(draggable, event); 14801 } 14802 14803 // Run through all droppables and check their positions based on specific tolerance options 14804 $.each( 14805 $.ui.ddmanager.droppables[draggable.options.scope] || [], 14806 function () { 14807 if (this.options.disabled || this.greedyChild || !this.visible) { 14808 return; 14809 } 14810 14811 var parentInstance, 14812 scope, 14813 parent, 14814 intersects = $.ui.intersect( 14815 draggable, 14816 this, 14817 this.options.tolerance, 14818 event 14819 ), 14820 c = 14821 !intersects && this.isover 14822 ? "isout" 14823 : intersects && !this.isover 14824 ? "isover" 14825 : null; 14826 if (!c) { 14827 return; 14828 } 14829 14830 if (this.options.greedy) { 14831 // find droppable parents with same scope 14832 scope = this.options.scope; 14833 parent = this.element 14834 .parents(":data(ui-droppable)") 14835 .filter(function () { 14836 return $(this).droppable("instance").options.scope === scope; 14837 }); 14838 14839 if (parent.length) { 14840 parentInstance = $(parent[0]).droppable("instance"); 14841 parentInstance.greedyChild = c === "isover"; 14842 } 14843 } 14844 14845 // We just moved into a greedy child 14846 if (parentInstance && c === "isover") { 14847 parentInstance.isover = false; 14848 parentInstance.isout = true; 14849 parentInstance._out.call(parentInstance, event); 14850 } 14851 14852 this[c] = true; 14853 this[c === "isout" ? "isover" : "isout"] = false; 14854 this[c === "isover" ? "_over" : "_out"].call(this, event); 14855 14856 // We just moved out of a greedy child 14857 if (parentInstance && c === "isout") { 14858 parentInstance.isout = false; 14859 parentInstance.isover = true; 14860 parentInstance._over.call(parentInstance, event); 14861 } 14862 } 14863 ); 14864 }, 14865 dragStop: function (draggable, event) { 14866 draggable.element.parentsUntil("body").off("scroll.droppable"); 14867 14868 // Call prepareOffsets one final time since IE does not fire return scroll events when 14869 // overflow was caused by drag (see #5003) 14870 if (!draggable.options.refreshPositions) { 14871 $.ui.ddmanager.prepareOffsets(draggable, event); 14872 } 14873 }, 14874 }; 14875 14876 // DEPRECATED 14877 // TODO: switch return back to widget declaration at top of file when this is removed 14878 if ($.uiBackCompat !== false) { 14879 // Backcompat for activeClass and hoverClass options 14880 $.widget("ui.droppable", $.ui.droppable, { 14881 options: {
vendor: 16,313 bytes, lines 14882-15451
14882 hoverClass: false, 14883 activeClass: false, 14884 }, 14885 _addActiveClass: function () { 14886 this._super(); 14887 if (this.options.activeClass) { 14888 this.element.addClass(this.options.activeClass); 14889 } 14890 }, 14891 _removeActiveClass: function () { 14892 this._super(); 14893 if (this.options.activeClass) { 14894 this.element.removeClass(this.options.activeClass); 14895 } 14896 }, 14897 _addHoverClass: function () { 14898 this._super(); 14899 if (this.options.hoverClass) { 14900 this.element.addClass(this.options.hoverClass); 14901 } 14902 }, 14903 _removeHoverClass: function () { 14904 this._super(); 14905 if (this.options.hoverClass) { 14906 this.element.removeClass(this.options.hoverClass); 14907 } 14908 }, 14909 }); 14910 } 14911 14912 var widgetsDroppable = $.ui.droppable; 14913 14914 /*! 14915 * jQuery UI Progressbar 1.13.3 14916 * https://jqueryui.com 14917 * 14918 * Copyright OpenJS Foundation and other contributors 14919 * Released under the MIT license. 14920 * https://jquery.org/license 14921 */ 14922 14923 //>>label: Progressbar 14924 //>>group: Widgets 14925 /* eslint-disable max-len */ 14926 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 14927 /* eslint-enable max-len */ 14928 //>>docs: https://api.jqueryui.com/progressbar/ 14929 //>>demos: https://jqueryui.com/progressbar/ 14930 //>>css.structure: ../../themes/base/core.css 14931 //>>css.structure: ../../themes/base/progressbar.css 14932 //>>css.theme: ../../themes/base/theme.css 14933 14934 var widgetsProgressbar = $.widget("ui.progressbar", { 14935 version: "1.13.3", 14936 options: { 14937 classes: { 14938 "ui-progressbar": "ui-corner-all", 14939 "ui-progressbar-value": "ui-corner-left", 14940 "ui-progressbar-complete": "ui-corner-right", 14941 }, 14942 max: 100, 14943 value: 0, 14944 14945 change: null, 14946 complete: null, 14947 }, 14948 14949 min: 0, 14950 14951 _create: function () { 14952 // Constrain initial value 14953 this.oldValue = this.options.value = this._constrainedValue(); 14954 14955 this.element.attr({ 14956 // Only set static values; aria-valuenow and aria-valuemax are 14957 // set inside _refreshValue() 14958 role: "progressbar", 14959 "aria-valuemin": this.min, 14960 }); 14961 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 14962 14963 this.valueDiv = $("<div>").appendTo(this.element); 14964 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 14965 this._refreshValue(); 14966 }, 14967 14968 _destroy: function () { 14969 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 14970 14971 this.valueDiv.remove(); 14972 }, 14973 14974 value: function (newValue) { 14975 if (newValue === undefined) { 14976 return this.options.value; 14977 } 14978 14979 this.options.value = this._constrainedValue(newValue); 14980 this._refreshValue(); 14981 }, 14982 14983 _constrainedValue: function (newValue) { 14984 if (newValue === undefined) { 14985 newValue = this.options.value; 14986 } 14987 14988 this.indeterminate = newValue === false; 14989 14990 // Sanitize value 14991 if (typeof newValue !== "number") { 14992 newValue = 0; 14993 } 14994 14995 return this.indeterminate 14996 ? false 14997 : Math.min(this.options.max, Math.max(this.min, newValue)); 14998 }, 14999 15000 _setOptions: function (options) { 15001 // Ensure "value" option is set after other values (like max) 15002 var value = options.value; 15003 delete options.value; 15004 15005 this._super(options); 15006 15007 this.options.value = this._constrainedValue(value); 15008 this._refreshValue(); 15009 }, 15010 15011 _setOption: function (key, value) { 15012 if (key === "max") { 15013 // Don't allow a max less than min 15014 value = Math.max(this.min, value); 15015 } 15016 this._super(key, value); 15017 }, 15018 15019 _setOptionDisabled: function (value) { 15020 this._super(value); 15021 15022 this.element.attr("aria-disabled", value); 15023 this._toggleClass(null, "ui-state-disabled", !!value); 15024 }, 15025 15026 _percentage: function () { 15027 return this.indeterminate 15028 ? 100 15029 : (100 * (this.options.value - this.min)) / 15030 (this.options.max - this.min); 15031 }, 15032 15033 _refreshValue: function () { 15034 var value = this.options.value, 15035 percentage = this._percentage(); 15036 15037 this.valueDiv 15038 .toggle(this.indeterminate || value > this.min) 15039 .width(percentage.toFixed(0) + "%"); 15040 15041 this._toggleClass( 15042 this.valueDiv, 15043 "ui-progressbar-complete", 15044 null, 15045 value === this.options.max 15046 )._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 15047 15048 if (this.indeterminate) { 15049 this.element.removeAttr("aria-valuenow"); 15050 if (!this.overlayDiv) { 15051 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 15052 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 15053 } 15054 } else { 15055 this.element.attr({ 15056 "aria-valuemax": this.options.max, 15057 "aria-valuenow": value, 15058 }); 15059 if (this.overlayDiv) { 15060 this.overlayDiv.remove(); 15061 this.overlayDiv = null; 15062 } 15063 } 15064 15065 if (this.oldValue !== value) { 15066 this.oldValue = value; 15067 this._trigger("change"); 15068 } 15069 if (value === this.options.max) { 15070 this._trigger("complete"); 15071 } 15072 }, 15073 }); 15074 15075 /*! 15076 * jQuery UI Selectable 1.13.3 15077 * https://jqueryui.com 15078 * 15079 * Copyright OpenJS Foundation and other contributors 15080 * Released under the MIT license. 15081 * https://jquery.org/license 15082 */ 15083 15084 //>>label: Selectable 15085 //>>group: Interactions 15086 //>>description: Allows groups of elements to be selected with the mouse. 15087 //>>docs: https://api.jqueryui.com/selectable/ 15088 //>>demos: https://jqueryui.com/selectable/ 15089 //>>css.structure: ../../themes/base/selectable.css 15090 15091 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 15092 version: "1.13.3", 15093 options: { 15094 appendTo: "body", 15095 autoRefresh: true, 15096 distance: 0, 15097 filter: "*", 15098 tolerance: "touch", 15099 15100 // Callbacks 15101 selected: null, 15102 selecting: null, 15103 start: null, 15104 stop: null, 15105 unselected: null, 15106 unselecting: null, 15107 }, 15108 _create: function () { 15109 var that = this; 15110 15111 this._addClass("ui-selectable"); 15112 15113 this.dragged = false; 15114 15115 // Cache selectee children based on filter 15116 this.refresh = function () { 15117 that.elementPos = $(that.element[0]).offset(); 15118 that.selectees = $(that.options.filter, that.element[0]); 15119 that._addClass(that.selectees, "ui-selectee"); 15120 that.selectees.each(function () { 15121 var $this = $(this), 15122 selecteeOffset = $this.offset(), 15123 pos = { 15124 left: selecteeOffset.left - that.elementPos.left, 15125 top: selecteeOffset.top - that.elementPos.top, 15126 }; 15127 $.data(this, "selectable-item", { 15128 element: this, 15129 $element: $this, 15130 left: pos.left, 15131 top: pos.top, 15132 right: pos.left + $this.outerWidth(), 15133 bottom: pos.top + $this.outerHeight(), 15134 startselected: false, 15135 selected: $this.hasClass("ui-selected"), 15136 selecting: $this.hasClass("ui-selecting"), 15137 unselecting: $this.hasClass("ui-unselecting"), 15138 }); 15139 }); 15140 }; 15141 this.refresh(); 15142 15143 this._mouseInit(); 15144 15145 this.helper = $("<div>"); 15146 this._addClass(this.helper, "ui-selectable-helper"); 15147 }, 15148 15149 _destroy: function () { 15150 this.selectees.removeData("selectable-item"); 15151 this._mouseDestroy(); 15152 }, 15153 15154 _mouseStart: function (event) { 15155 var that = this, 15156 options = this.options; 15157 15158 this.opos = [event.pageX, event.pageY]; 15159 this.elementPos = $(this.element[0]).offset(); 15160 15161 if (this.options.disabled) { 15162 return; 15163 } 15164 15165 this.selectees = $(options.filter, this.element[0]); 15166 15167 this._trigger("start", event); 15168 15169 $(options.appendTo).append(this.helper); 15170 15171 // position helper (lasso) 15172 this.helper.css({ 15173 left: event.pageX, 15174 top: event.pageY, 15175 width: 0, 15176 height: 0, 15177 }); 15178 15179 if (options.autoRefresh) { 15180 this.refresh(); 15181 } 15182 15183 this.selectees.filter(".ui-selected").each(function () { 15184 var selectee = $.data(this, "selectable-item"); 15185 selectee.startselected = true; 15186 if (!event.metaKey && !event.ctrlKey) { 15187 that._removeClass(selectee.$element, "ui-selected"); 15188 selectee.selected = false; 15189 that._addClass(selectee.$element, "ui-unselecting"); 15190 selectee.unselecting = true; 15191 15192 // selectable UNSELECTING callback 15193 that._trigger("unselecting", event, { 15194 unselecting: selectee.element, 15195 }); 15196 } 15197 }); 15198 15199 $(event.target) 15200 .parents() 15201 .addBack() 15202 .each(function () { 15203 var doSelect, 15204 selectee = $.data(this, "selectable-item"); 15205 if (selectee) { 15206 doSelect = 15207 (!event.metaKey && !event.ctrlKey) || 15208 !selectee.$element.hasClass("ui-selected"); 15209 that 15210 ._removeClass( 15211 selectee.$element, 15212 doSelect ? "ui-unselecting" : "ui-selected" 15213 ) 15214 ._addClass( 15215 selectee.$element, 15216 doSelect ? "ui-selecting" : "ui-unselecting" 15217 ); 15218 selectee.unselecting = !doSelect; 15219 selectee.selecting = doSelect; 15220 selectee.selected = doSelect; 15221 15222 // selectable (UN)SELECTING callback 15223 if (doSelect) { 15224 that._trigger("selecting", event, { 15225 selecting: selectee.element, 15226 }); 15227 } else { 15228 that._trigger("unselecting", event, { 15229 unselecting: selectee.element, 15230 }); 15231 } 15232 return false; 15233 } 15234 }); 15235 }, 15236 15237 _mouseDrag: function (event) { 15238 this.dragged = true; 15239 15240 if (this.options.disabled) { 15241 return; 15242 } 15243 15244 var tmp, 15245 that = this, 15246 options = this.options, 15247 x1 = this.opos[0], 15248 y1 = this.opos[1], 15249 x2 = event.pageX, 15250 y2 = event.pageY; 15251 15252 if (x1 > x2) { 15253 tmp = x2; 15254 x2 = x1; 15255 x1 = tmp; 15256 } 15257 if (y1 > y2) { 15258 tmp = y2; 15259 y2 = y1; 15260 y1 = tmp; 15261 } 15262 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 15263 15264 this.selectees.each(function () { 15265 var selectee = $.data(this, "selectable-item"), 15266 hit = false, 15267 offset = {}; 15268 15269 //prevent helper from being selected if appendTo: selectable 15270 if (!selectee || selectee.element === that.element[0]) { 15271 return; 15272 } 15273 15274 offset.left = selectee.left + that.elementPos.left; 15275 offset.right = selectee.right + that.elementPos.left; 15276 offset.top = selectee.top + that.elementPos.top; 15277 offset.bottom = selectee.bottom + that.elementPos.top; 15278 15279 if (options.tolerance === "touch") { 15280 hit = !( 15281 offset.left > x2 || 15282 offset.right < x1 || 15283 offset.top > y2 || 15284 offset.bottom < y1 15285 ); 15286 } else if (options.tolerance === "fit") { 15287 hit = 15288 offset.left > x1 && 15289 offset.right < x2 && 15290 offset.top > y1 && 15291 offset.bottom < y2; 15292 } 15293 15294 if (hit) { 15295 // SELECT 15296 if (selectee.selected) { 15297 that._removeClass(selectee.$element, "ui-selected"); 15298 selectee.selected = false; 15299 } 15300 if (selectee.unselecting) { 15301 that._removeClass(selectee.$element, "ui-unselecting"); 15302 selectee.unselecting = false; 15303 } 15304 if (!selectee.selecting) { 15305 that._addClass(selectee.$element, "ui-selecting"); 15306 selectee.selecting = true; 15307 15308 // selectable SELECTING callback 15309 that._trigger("selecting", event, { 15310 selecting: selectee.element, 15311 }); 15312 } 15313 } else { 15314 // UNSELECT 15315 if (selectee.selecting) { 15316 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 15317 that._removeClass(selectee.$element, "ui-selecting"); 15318 selectee.selecting = false; 15319 that._addClass(selectee.$element, "ui-selected"); 15320 selectee.selected = true; 15321 } else { 15322 that._removeClass(selectee.$element, "ui-selecting"); 15323 selectee.selecting = false; 15324 if (selectee.startselected) { 15325 that._addClass(selectee.$element, "ui-unselecting"); 15326 selectee.unselecting = true; 15327 } 15328 15329 // selectable UNSELECTING callback 15330 that._trigger("unselecting", event, { 15331 unselecting: selectee.element, 15332 }); 15333 } 15334 } 15335 if (selectee.selected) { 15336 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 15337 that._removeClass(selectee.$element, "ui-selected"); 15338 selectee.selected = false; 15339 15340 that._addClass(selectee.$element, "ui-unselecting"); 15341 selectee.unselecting = true; 15342 15343 // selectable UNSELECTING callback 15344 that._trigger("unselecting", event, { 15345 unselecting: selectee.element, 15346 }); 15347 } 15348 } 15349 } 15350 }); 15351 15352 return false; 15353 }, 15354 15355 _mouseStop: function (event) { 15356 var that = this; 15357 15358 this.dragged = false; 15359 15360 $(".ui-unselecting", this.element[0]).each(function () { 15361 var selectee = $.data(this, "selectable-item"); 15362 that._removeClass(selectee.$element, "ui-unselecting"); 15363 selectee.unselecting = false; 15364 selectee.startselected = false; 15365 that._trigger("unselected", event, { 15366 unselected: selectee.element, 15367 }); 15368 }); 15369 $(".ui-selecting", this.element[0]).each(function () { 15370 var selectee = $.data(this, "selectable-item"); 15371 that 15372 ._removeClass(selectee.$element, "ui-selecting") 15373 ._addClass(selectee.$element, "ui-selected"); 15374 selectee.selecting = false; 15375 selectee.selected = true; 15376 selectee.startselected = true; 15377 that._trigger("selected", event, { 15378 selected: selectee.element, 15379 }); 15380 }); 15381 this._trigger("stop", event); 15382 15383 this.helper.remove(); 15384 15385 return false; 15386 }, 15387 }); 15388 15389 /*! 15390 * jQuery UI Selectmenu 1.13.3 15391 * https://jqueryui.com 15392 * 15393 * Copyright OpenJS Foundation and other contributors 15394 * Released under the MIT license. 15395 * https://jquery.org/license 15396 */ 15397 15398 //>>label: Selectmenu 15399 //>>group: Widgets 15400 /* eslint-disable max-len */ 15401 //>>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. 15402 /* eslint-enable max-len */ 15403 //>>docs: https://api.jqueryui.com/selectmenu/ 15404 //>>demos: https://jqueryui.com/selectmenu/ 15405 //>>css.structure: ../../themes/base/core.css 15406 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 15407 //>>css.theme: ../../themes/base/theme.css 15408 15409 var widgetsSelectmenu = $.widget("ui.selectmenu", [ 15410 $.ui.formResetMixin, 15411 { 15412 version: "1.13.3", 15413 defaultElement: "<select>", 15414 options: { 15415 appendTo: null, 15416 classes: { 15417 "ui-selectmenu-button-open": "ui-corner-top", 15418 "ui-selectmenu-button-closed": "ui-corner-all", 15419 }, 15420 disabled: null, 15421 icons: { 15422 button: "ui-icon-triangle-1-s", 15423 }, 15424 position: { 15425 my: "left top", 15426 at: "left bottom", 15427 collision: "none", 15428 }, 15429 width: false, 15430 15431 // Callbacks 15432 change: null, 15433 close: null, 15434 focus: null, 15435 open: null, 15436 select: null, 15437 }, 15438 15439 _create: function () { 15440 var selectmenuId = this.element.uniqueId().attr("id"); 15441 this.ids = { 15442 element: selectmenuId, 15443 button: selectmenuId + "-button", 15444 menu: selectmenuId + "-menu", 15445 }; 15446 15447 this._drawButton(); 15448 this._drawMenu(); 15449 this._bindFormResetHandler(); 15450 15451 this._rendered = false;
vendor: 10,533 bytes, lines 15452-15836
15452 this.menuItems = $(); 15453 }, 15454 15455 _drawButton: function () { 15456 var icon, 15457 that = this, 15458 item = this._parseOption( 15459 this.element.find("option:selected"), 15460 this.element[0].selectedIndex 15461 ); 15462 15463 // Associate existing label with the new button 15464 this.labels = this.element.labels().attr("for", this.ids.button); 15465 this._on(this.labels, { 15466 click: function (event) { 15467 this.button.trigger("focus"); 15468 event.preventDefault(); 15469 }, 15470 }); 15471 15472 // Hide original select element 15473 this.element.hide(); 15474 15475 // Create button 15476 this.button = $("<span>", { 15477 tabindex: this.options.disabled ? -1 : 0, 15478 id: this.ids.button, 15479 role: "combobox", 15480 "aria-expanded": "false", 15481 "aria-autocomplete": "list", 15482 "aria-owns": this.ids.menu, 15483 "aria-haspopup": "true", 15484 title: this.element.attr("title"), 15485 }).insertAfter(this.element); 15486 15487 this._addClass( 15488 this.button, 15489 "ui-selectmenu-button ui-selectmenu-button-closed", 15490 "ui-button ui-widget" 15491 ); 15492 15493 icon = $("<span>").appendTo(this.button); 15494 this._addClass( 15495 icon, 15496 "ui-selectmenu-icon", 15497 "ui-icon " + this.options.icons.button 15498 ); 15499 this.buttonItem = this._renderButtonItem(item).appendTo(this.button); 15500 15501 if (this.options.width !== false) { 15502 this._resizeButton(); 15503 } 15504 15505 this._on(this.button, this._buttonEvents); 15506 this.button.one("focusin", function () { 15507 // Delay rendering the menu items until the button receives focus. 15508 // The menu may have already been rendered via a programmatic open. 15509 if (!that._rendered) { 15510 that._refreshMenu(); 15511 } 15512 }); 15513 }, 15514 15515 _drawMenu: function () { 15516 var that = this; 15517 15518 // Create menu 15519 this.menu = $("<ul>", { 15520 "aria-hidden": "true", 15521 "aria-labelledby": this.ids.button, 15522 id: this.ids.menu, 15523 }); 15524 15525 // Wrap menu 15526 this.menuWrap = $("<div>").append(this.menu); 15527 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 15528 this.menuWrap.appendTo(this._appendTo()); 15529 15530 // Initialize menu widget 15531 this.menuInstance = this.menu 15532 .menu({ 15533 classes: { 15534 "ui-menu": "ui-corner-bottom", 15535 }, 15536 role: "listbox", 15537 select: function (event, ui) { 15538 event.preventDefault(); 15539 15540 // Support: IE8 15541 // If the item was selected via a click, the text selection 15542 // will be destroyed in IE 15543 that._setSelection(); 15544 15545 that._select(ui.item.data("ui-selectmenu-item"), event); 15546 }, 15547 focus: function (event, ui) { 15548 var item = ui.item.data("ui-selectmenu-item"); 15549 15550 // Prevent inital focus from firing and check if its a newly focused item 15551 if (that.focusIndex != null && item.index !== that.focusIndex) { 15552 that._trigger("focus", event, { item: item }); 15553 if (!that.isOpen) { 15554 that._select(item, event); 15555 } 15556 } 15557 that.focusIndex = item.index; 15558 15559 that.button.attr( 15560 "aria-activedescendant", 15561 that.menuItems.eq(item.index).attr("id") 15562 ); 15563 }, 15564 }) 15565 .menu("instance"); 15566 15567 // Don't close the menu on mouseleave 15568 this.menuInstance._off(this.menu, "mouseleave"); 15569 15570 // Cancel the menu's collapseAll on document click 15571 this.menuInstance._closeOnDocumentClick = function () { 15572 return false; 15573 }; 15574 15575 // Selects often contain empty items, but never contain dividers 15576 this.menuInstance._isDivider = function () { 15577 return false; 15578 }; 15579 }, 15580 15581 refresh: function () { 15582 this._refreshMenu(); 15583 this.buttonItem.replaceWith( 15584 (this.buttonItem = this._renderButtonItem( 15585 // Fall back to an empty object in case there are no options 15586 this._getSelectedItem().data("ui-selectmenu-item") || {} 15587 )) 15588 ); 15589 if (this.options.width === null) { 15590 this._resizeButton(); 15591 } 15592 }, 15593 15594 _refreshMenu: function () { 15595 var item, 15596 options = this.element.find("option"); 15597 15598 this.menu.empty(); 15599 15600 this._parseOptions(options); 15601 this._renderMenu(this.menu, this.items); 15602 15603 this.menuInstance.refresh(); 15604 this.menuItems = this.menu 15605 .find("li") 15606 .not(".ui-selectmenu-optgroup") 15607 .find(".ui-menu-item-wrapper"); 15608 15609 this._rendered = true; 15610 15611 if (!options.length) { 15612 return; 15613 } 15614 15615 item = this._getSelectedItem(); 15616 15617 // Update the menu to have the correct item focused 15618 this.menuInstance.focus(null, item); 15619 this._setAria(item.data("ui-selectmenu-item")); 15620 15621 // Set disabled state 15622 this._setOption("disabled", this.element.prop("disabled")); 15623 }, 15624 15625 open: function (event) { 15626 if (this.options.disabled) { 15627 return; 15628 } 15629 15630 // If this is the first time the menu is being opened, render the items 15631 if (!this._rendered) { 15632 this._refreshMenu(); 15633 } else { 15634 // Menu clears focus on close, reset focus to selected item 15635 this._removeClass( 15636 this.menu.find(".ui-state-active"), 15637 null, 15638 "ui-state-active" 15639 ); 15640 this.menuInstance.focus(null, this._getSelectedItem()); 15641 } 15642 15643 // If there are no options, don't open the menu 15644 if (!this.menuItems.length) { 15645 return; 15646 } 15647 15648 this.isOpen = true; 15649 this._toggleAttr(); 15650 this._resizeMenu(); 15651 this._position(); 15652 15653 this._on(this.document, this._documentClick); 15654 15655 this._trigger("open", event); 15656 }, 15657 15658 _position: function () { 15659 this.menuWrap.position( 15660 $.extend({ of: this.button }, this.options.position) 15661 ); 15662 }, 15663 15664 close: function (event) { 15665 if (!this.isOpen) { 15666 return; 15667 } 15668 15669 this.isOpen = false; 15670 this._toggleAttr(); 15671 15672 this.range = null; 15673 this._off(this.document); 15674 15675 this._trigger("close", event); 15676 }, 15677 15678 widget: function () { 15679 return this.button; 15680 }, 15681 15682 menuWidget: function () { 15683 return this.menu; 15684 }, 15685 15686 _renderButtonItem: function (item) { 15687 var buttonItem = $("<span>"); 15688 15689 this._setText(buttonItem, item.label); 15690 this._addClass(buttonItem, "ui-selectmenu-text"); 15691 15692 return buttonItem; 15693 }, 15694 15695 _renderMenu: function (ul, items) { 15696 var that = this, 15697 currentOptgroup = ""; 15698 15699 $.each(items, function (index, item) { 15700 var li; 15701 15702 if (item.optgroup !== currentOptgroup) { 15703 li = $("<li>", { 15704 text: item.optgroup, 15705 }); 15706 that._addClass( 15707 li, 15708 "ui-selectmenu-optgroup", 15709 "ui-menu-divider" + 15710 (item.element.parent("optgroup").prop("disabled") 15711 ? " ui-state-disabled" 15712 : "") 15713 ); 15714 15715 li.appendTo(ul); 15716 15717 currentOptgroup = item.optgroup; 15718 } 15719 15720 that._renderItemData(ul, item); 15721 }); 15722 }, 15723 15724 _renderItemData: function (ul, item) { 15725 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 15726 }, 15727 15728 _renderItem: function (ul, item) { 15729 var li = $("<li>"), 15730 wrapper = $("<div>", { 15731 title: item.element.attr("title"), 15732 }); 15733 15734 if (item.disabled) { 15735 this._addClass(li, null, "ui-state-disabled"); 15736 } 15737 15738 if (item.hidden) { 15739 li.prop("hidden", true); 15740 } else { 15741 this._setText(wrapper, item.label); 15742 } 15743 15744 return li.append(wrapper).appendTo(ul); 15745 }, 15746 15747 _setText: function (element, value) { 15748 if (value) { 15749 element.text(value); 15750 } else { 15751 element.html(" "); 15752 } 15753 }, 15754 15755 _move: function (direction, event) { 15756 var item, 15757 next, 15758 filter = ".ui-menu-item"; 15759 15760 if (this.isOpen) { 15761 item = this.menuItems.eq(this.focusIndex).parent("li"); 15762 } else { 15763 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 15764 filter += ":not(.ui-state-disabled)"; 15765 } 15766 15767 if (direction === "first" || direction === "last") { 15768 next = 15769 item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 15770 } else { 15771 next = item[direction + "All"](filter).eq(0); 15772 } 15773 15774 if (next.length) { 15775 this.menuInstance.focus(event, next); 15776 } 15777 }, 15778 15779 _getSelectedItem: function () { 15780 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 15781 }, 15782 15783 _toggle: function (event) { 15784 this[this.isOpen ? "close" : "open"](event); 15785 }, 15786 15787 _setSelection: function () { 15788 var selection; 15789 15790 if (!this.range) { 15791 return; 15792 } 15793 15794 if (window.getSelection) { 15795 selection = window.getSelection(); 15796 selection.removeAllRanges(); 15797 selection.addRange(this.range); 15798 15799 // Support: IE8 15800 } else { 15801 this.range.select(); 15802 } 15803 15804 // Support: IE 15805 // Setting the text selection kills the button focus in IE, but 15806 // restoring the focus doesn't kill the selection. 15807 this.button.trigger("focus"); 15808 }, 15809 15810 _documentClick: { 15811 mousedown: function (event) { 15812 if (!this.isOpen) { 15813 return; 15814 } 15815 15816 if ( 15817 !$(event.target).closest( 15818 ".ui-selectmenu-menu, #" + $.escapeSelector(this.ids.button) 15819 ).length 15820 ) { 15821 this.close(event); 15822 } 15823 }, 15824 }, 15825 15826 _buttonEvents: { 15827 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 15828 mousedown: function () { 15829 var selection; 15830 15831 if (window.getSelection) { 15832 selection = window.getSelection(); 15833 if (selection.rangeCount) { 15834 this.range = selection.getRangeAt(0); 15835 } 15836
vendor: 1,872 bytes, lines 15837-15898
15837 // Support: IE8 15838 } else { 15839 this.range = document.selection.createRange(); 15840 } 15841 }, 15842 15843 click: function (event) { 15844 this._setSelection(); 15845 this._toggle(event); 15846 }, 15847 15848 keydown: function (event) { 15849 var preventDefault = true; 15850 switch (event.keyCode) { 15851 case $.ui.keyCode.TAB: 15852 case $.ui.keyCode.ESCAPE: 15853 this.close(event); 15854 preventDefault = false; 15855 break; 15856 case $.ui.keyCode.ENTER: 15857 if (this.isOpen) { 15858 this._selectFocusedItem(event); 15859 } 15860 break; 15861 case $.ui.keyCode.UP: 15862 if (event.altKey) { 15863 this._toggle(event); 15864 } else { 15865 this._move("prev", event); 15866 } 15867 break; 15868 case $.ui.keyCode.DOWN: 15869 if (event.altKey) { 15870 this._toggle(event); 15871 } else { 15872 this._move("next", event); 15873 } 15874 break; 15875 case $.ui.keyCode.SPACE: 15876 if (this.isOpen) { 15877 this._selectFocusedItem(event); 15878 } else { 15879 this._toggle(event); 15880 } 15881 break; 15882 case $.ui.keyCode.LEFT: 15883 this._move("prev", event); 15884 break; 15885 case $.ui.keyCode.RIGHT: 15886 this._move("next", event); 15887 break; 15888 case $.ui.keyCode.HOME: 15889 case $.ui.keyCode.PAGE_UP: 15890 this._move("first", event); 15891 break; 15892 case $.ui.keyCode.END: 15893 case $.ui.keyCode.PAGE_DOWN: 15894 this._move("last", event); 15895 break; 15896 default: 15897 this.menu.trigger(event); 15898 preventDefault = false;
vendor: 6,802 bytes, lines 15899-16145
15899 } 15900 15901 if (preventDefault) { 15902 event.preventDefault(); 15903 } 15904 }, 15905 }, 15906 15907 _selectFocusedItem: function (event) { 15908 var item = this.menuItems.eq(this.focusIndex).parent("li"); 15909 if (!item.hasClass("ui-state-disabled")) { 15910 this._select(item.data("ui-selectmenu-item"), event); 15911 } 15912 }, 15913 15914 _select: function (item, event) { 15915 var oldIndex = this.element[0].selectedIndex; 15916 15917 // Change native select element 15918 this.element[0].selectedIndex = item.index; 15919 this.buttonItem.replaceWith( 15920 (this.buttonItem = this._renderButtonItem(item)) 15921 ); 15922 this._setAria(item); 15923 this._trigger("select", event, { item: item }); 15924 15925 if (item.index !== oldIndex) { 15926 this._trigger("change", event, { item: item }); 15927 } 15928 15929 this.close(event); 15930 }, 15931 15932 _setAria: function (item) { 15933 var id = this.menuItems.eq(item.index).attr("id"); 15934 15935 this.button.attr({ 15936 "aria-labelledby": id, 15937 "aria-activedescendant": id, 15938 }); 15939 this.menu.attr("aria-activedescendant", id); 15940 }, 15941 15942 _setOption: function (key, value) { 15943 if (key === "icons") { 15944 var icon = this.button.find("span.ui-icon"); 15945 this._removeClass(icon, null, this.options.icons.button)._addClass( 15946 icon, 15947 null, 15948 value.button 15949 ); 15950 } 15951 15952 this._super(key, value); 15953 15954 if (key === "appendTo") { 15955 this.menuWrap.appendTo(this._appendTo()); 15956 } 15957 15958 if (key === "width") { 15959 this._resizeButton(); 15960 } 15961 }, 15962 15963 _setOptionDisabled: function (value) { 15964 this._super(value); 15965 15966 this.menuInstance.option("disabled", value); 15967 this.button.attr("aria-disabled", value); 15968 this._toggleClass(this.button, null, "ui-state-disabled", value); 15969 15970 this.element.prop("disabled", value); 15971 if (value) { 15972 this.button.attr("tabindex", -1); 15973 this.close(); 15974 } else { 15975 this.button.attr("tabindex", 0); 15976 } 15977 }, 15978 15979 _appendTo: function () { 15980 var element = this.options.appendTo; 15981 15982 if (element) { 15983 element = 15984 element.jquery || element.nodeType 15985 ? $(element) 15986 : this.document.find(element).eq(0); 15987 } 15988 15989 if (!element || !element[0]) { 15990 element = this.element.closest(".ui-front, dialog"); 15991 } 15992 15993 if (!element.length) { 15994 element = this.document[0].body; 15995 } 15996 15997 return element; 15998 }, 15999 16000 _toggleAttr: function () { 16001 this.button.attr("aria-expanded", this.isOpen); 16002 16003 // We can't use two _toggleClass() calls here, because we need to make sure 16004 // we always remove classes first and add them second, otherwise if both classes have the 16005 // same theme class, it will be removed after we add it. 16006 this._removeClass( 16007 this.button, 16008 "ui-selectmenu-button-" + (this.isOpen ? "closed" : "open") 16009 ) 16010 ._addClass( 16011 this.button, 16012 "ui-selectmenu-button-" + (this.isOpen ? "open" : "closed") 16013 ) 16014 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 16015 16016 this.menu.attr("aria-hidden", !this.isOpen); 16017 }, 16018 16019 _resizeButton: function () { 16020 var width = this.options.width; 16021 16022 // For `width: false`, just remove inline style and stop 16023 if (width === false) { 16024 this.button.css("width", ""); 16025 return; 16026 } 16027 16028 // For `width: null`, match the width of the original element 16029 if (width === null) { 16030 width = this.element.show().outerWidth(); 16031 this.element.hide(); 16032 } 16033 16034 this.button.outerWidth(width); 16035 }, 16036 16037 _resizeMenu: function () { 16038 this.menu.outerWidth( 16039 Math.max( 16040 this.button.outerWidth(), 16041 16042 // Support: IE10 16043 // IE10 wraps long text (possibly a rounding bug) 16044 // so we add 1px to avoid the wrapping 16045 this.menu.width("").outerWidth() + 1 16046 ) 16047 ); 16048 }, 16049 16050 _getCreateOptions: function () { 16051 var options = this._super(); 16052 16053 options.disabled = this.element.prop("disabled"); 16054 16055 return options; 16056 }, 16057 16058 _parseOptions: function (options) { 16059 var that = this, 16060 data = []; 16061 options.each(function (index, item) { 16062 data.push(that._parseOption($(item), index)); 16063 }); 16064 this.items = data; 16065 }, 16066 16067 _parseOption: function (option, index) { 16068 var optgroup = option.parent("optgroup"); 16069 16070 return { 16071 element: option, 16072 index: index, 16073 value: option.val(), 16074 label: option.text(), 16075 hidden: optgroup.prop("hidden") || option.prop("hidden"), 16076 optgroup: optgroup.attr("label") || "", 16077 disabled: optgroup.prop("disabled") || option.prop("disabled"), 16078 }; 16079 }, 16080 16081 _destroy: function () { 16082 this._unbindFormResetHandler(); 16083 this.menuWrap.remove(); 16084 this.button.remove(); 16085 this.element.show(); 16086 this.element.removeUniqueId(); 16087 this.labels.attr("for", this.ids.element); 16088 }, 16089 }, 16090 ]); 16091 16092 /*! 16093 * jQuery UI Slider 1.13.3 16094 * https://jqueryui.com 16095 * 16096 * Copyright OpenJS Foundation and other contributors 16097 * Released under the MIT license. 16098 * https://jquery.org/license 16099 */ 16100 16101 //>>label: Slider 16102 //>>group: Widgets 16103 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 16104 //>>docs: https://api.jqueryui.com/slider/ 16105 //>>demos: https://jqueryui.com/slider/ 16106 //>>css.structure: ../../themes/base/core.css 16107 //>>css.structure: ../../themes/base/slider.css 16108 //>>css.theme: ../../themes/base/theme.css 16109 16110 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 16111 version: "1.13.3", 16112 widgetEventPrefix: "slide", 16113 16114 options: { 16115 animate: false, 16116 classes: { 16117 "ui-slider": "ui-corner-all", 16118 "ui-slider-handle": "ui-corner-all", 16119 16120 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 16121 // element, but worked best visually with a variety of themes 16122 "ui-slider-range": "ui-corner-all ui-widget-header", 16123 }, 16124 distance: 0, 16125 max: 100, 16126 min: 0, 16127 orientation: "horizontal", 16128 range: false, 16129 step: 1, 16130 value: 0, 16131 values: null, 16132 16133 // Callbacks 16134 change: null, 16135 slide: null, 16136 start: null, 16137 stop: null, 16138 }, 16139 16140 // Number of pages in a slider 16141 // (how many times can you page up/down to go through the whole range) 16142 numPages: 5, 16143 16144 _create: function () { 16145 this._keySliding = false;
vendor: 20,924 bytes, lines 16146-16877
16146 this._mouseSliding = false; 16147 this._animateOff = true; 16148 this._handleIndex = null; 16149 this._detectOrientation(); 16150 this._mouseInit(); 16151 this._calculateNewMax(); 16152 16153 this._addClass( 16154 "ui-slider ui-slider-" + this.orientation, 16155 "ui-widget ui-widget-content" 16156 ); 16157 16158 this._refresh(); 16159 16160 this._animateOff = false; 16161 }, 16162 16163 _refresh: function () { 16164 this._createRange(); 16165 this._createHandles(); 16166 this._setupEvents(); 16167 this._refreshValue(); 16168 }, 16169 16170 _createHandles: function () { 16171 var i, 16172 handleCount, 16173 options = this.options, 16174 existingHandles = this.element.find(".ui-slider-handle"), 16175 handle = "<span tabindex='0'></span>", 16176 handles = []; 16177 16178 handleCount = (options.values && options.values.length) || 1; 16179 16180 if (existingHandles.length > handleCount) { 16181 existingHandles.slice(handleCount).remove(); 16182 existingHandles = existingHandles.slice(0, handleCount); 16183 } 16184 16185 for (i = existingHandles.length; i < handleCount; i++) { 16186 handles.push(handle); 16187 } 16188 16189 this.handles = existingHandles.add( 16190 $(handles.join("")).appendTo(this.element) 16191 ); 16192 16193 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 16194 16195 this.handle = this.handles.eq(0); 16196 16197 this.handles.each(function (i) { 16198 $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0); 16199 }); 16200 }, 16201 16202 _createRange: function () { 16203 var options = this.options; 16204 16205 if (options.range) { 16206 if (options.range === true) { 16207 if (!options.values) { 16208 options.values = [this._valueMin(), this._valueMin()]; 16209 } else if (options.values.length && options.values.length !== 2) { 16210 options.values = [options.values[0], options.values[0]]; 16211 } else if (Array.isArray(options.values)) { 16212 options.values = options.values.slice(0); 16213 } 16214 } 16215 16216 if (!this.range || !this.range.length) { 16217 this.range = $("<div>").appendTo(this.element); 16218 16219 this._addClass(this.range, "ui-slider-range"); 16220 } else { 16221 this._removeClass( 16222 this.range, 16223 "ui-slider-range-min ui-slider-range-max" 16224 ); 16225 16226 // Handle range switching from true to min/max 16227 this.range.css({ 16228 left: "", 16229 bottom: "", 16230 }); 16231 } 16232 if (options.range === "min" || options.range === "max") { 16233 this._addClass(this.range, "ui-slider-range-" + options.range); 16234 } 16235 } else { 16236 if (this.range) { 16237 this.range.remove(); 16238 } 16239 this.range = null; 16240 } 16241 }, 16242 16243 _setupEvents: function () { 16244 this._off(this.handles); 16245 this._on(this.handles, this._handleEvents); 16246 this._hoverable(this.handles); 16247 this._focusable(this.handles); 16248 }, 16249 16250 _destroy: function () { 16251 this.handles.remove(); 16252 if (this.range) { 16253 this.range.remove(); 16254 } 16255 16256 this._mouseDestroy(); 16257 }, 16258 16259 _mouseCapture: function (event) { 16260 var position, 16261 normValue, 16262 distance, 16263 closestHandle, 16264 index, 16265 allowed, 16266 offset, 16267 mouseOverHandle, 16268 that = this, 16269 o = this.options; 16270 16271 if (o.disabled) { 16272 return false; 16273 } 16274 16275 this.elementSize = { 16276 width: this.element.outerWidth(), 16277 height: this.element.outerHeight(), 16278 }; 16279 this.elementOffset = this.element.offset(); 16280 16281 position = { x: event.pageX, y: event.pageY }; 16282 normValue = this._normValueFromMouse(position); 16283 distance = this._valueMax() - this._valueMin() + 1; 16284 this.handles.each(function (i) { 16285 var thisDistance = Math.abs(normValue - that.values(i)); 16286 if ( 16287 distance > thisDistance || 16288 (distance === thisDistance && 16289 (i === that._lastChangedValue || that.values(i) === o.min)) 16290 ) { 16291 distance = thisDistance; 16292 closestHandle = $(this); 16293 index = i; 16294 } 16295 }); 16296 16297 allowed = this._start(event, index); 16298 if (allowed === false) { 16299 return false; 16300 } 16301 this._mouseSliding = true; 16302 16303 this._handleIndex = index; 16304 16305 this._addClass(closestHandle, null, "ui-state-active"); 16306 closestHandle.trigger("focus"); 16307 16308 offset = closestHandle.offset(); 16309 mouseOverHandle = !$(event.target) 16310 .parents() 16311 .addBack() 16312 .is(".ui-slider-handle"); 16313 this._clickOffset = mouseOverHandle 16314 ? { left: 0, top: 0 } 16315 : { 16316 left: event.pageX - offset.left - closestHandle.width() / 2, 16317 top: 16318 event.pageY - 16319 offset.top - 16320 closestHandle.height() / 2 - 16321 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 16322 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 16323 (parseInt(closestHandle.css("marginTop"), 10) || 0), 16324 }; 16325 16326 if (!this.handles.hasClass("ui-state-hover")) { 16327 this._slide(event, index, normValue); 16328 } 16329 this._animateOff = true; 16330 return true; 16331 }, 16332 16333 _mouseStart: function () { 16334 return true; 16335 }, 16336 16337 _mouseDrag: function (event) { 16338 var position = { x: event.pageX, y: event.pageY }, 16339 normValue = this._normValueFromMouse(position); 16340 16341 this._slide(event, this._handleIndex, normValue); 16342 16343 return false; 16344 }, 16345 16346 _mouseStop: function (event) { 16347 this._removeClass(this.handles, null, "ui-state-active"); 16348 this._mouseSliding = false; 16349 16350 this._stop(event, this._handleIndex); 16351 this._change(event, this._handleIndex); 16352 16353 this._handleIndex = null; 16354 this._clickOffset = null; 16355 this._animateOff = false; 16356 16357 return false; 16358 }, 16359 16360 _detectOrientation: function () { 16361 this.orientation = 16362 this.options.orientation === "vertical" ? "vertical" : "horizontal"; 16363 }, 16364 16365 _normValueFromMouse: function (position) { 16366 var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse; 16367 16368 if (this.orientation === "horizontal") { 16369 pixelTotal = this.elementSize.width; 16370 pixelMouse = 16371 position.x - 16372 this.elementOffset.left - 16373 (this._clickOffset ? this._clickOffset.left : 0); 16374 } else { 16375 pixelTotal = this.elementSize.height; 16376 pixelMouse = 16377 position.y - 16378 this.elementOffset.top - 16379 (this._clickOffset ? this._clickOffset.top : 0); 16380 } 16381 16382 percentMouse = pixelMouse / pixelTotal; 16383 if (percentMouse > 1) { 16384 percentMouse = 1; 16385 } 16386 if (percentMouse < 0) { 16387 percentMouse = 0; 16388 } 16389 if (this.orientation === "vertical") { 16390 percentMouse = 1 - percentMouse; 16391 } 16392 16393 valueTotal = this._valueMax() - this._valueMin(); 16394 valueMouse = this._valueMin() + percentMouse * valueTotal; 16395 16396 return this._trimAlignValue(valueMouse); 16397 }, 16398 16399 _uiHash: function (index, value, values) { 16400 var uiHash = { 16401 handle: this.handles[index], 16402 handleIndex: index, 16403 value: value !== undefined ? value : this.value(), 16404 }; 16405 16406 if (this._hasMultipleValues()) { 16407 uiHash.value = value !== undefined ? value : this.values(index); 16408 uiHash.values = values || this.values(); 16409 } 16410 16411 return uiHash; 16412 }, 16413 16414 _hasMultipleValues: function () { 16415 return this.options.values && this.options.values.length; 16416 }, 16417 16418 _start: function (event, index) { 16419 return this._trigger("start", event, this._uiHash(index)); 16420 }, 16421 16422 _slide: function (event, index, newVal) { 16423 var allowed, 16424 otherVal, 16425 currentValue = this.value(), 16426 newValues = this.values(); 16427 16428 if (this._hasMultipleValues()) { 16429 otherVal = this.values(index ? 0 : 1); 16430 currentValue = this.values(index); 16431 16432 if (this.options.values.length === 2 && this.options.range === true) { 16433 newVal = 16434 index === 0 16435 ? Math.min(otherVal, newVal) 16436 : Math.max(otherVal, newVal); 16437 } 16438 16439 newValues[index] = newVal; 16440 } 16441 16442 if (newVal === currentValue) { 16443 return; 16444 } 16445 16446 allowed = this._trigger( 16447 "slide", 16448 event, 16449 this._uiHash(index, newVal, newValues) 16450 ); 16451 16452 // A slide can be canceled by returning false from the slide callback 16453 if (allowed === false) { 16454 return; 16455 } 16456 16457 if (this._hasMultipleValues()) { 16458 this.values(index, newVal); 16459 } else { 16460 this.value(newVal); 16461 } 16462 }, 16463 16464 _stop: function (event, index) { 16465 this._trigger("stop", event, this._uiHash(index)); 16466 }, 16467 16468 _change: function (event, index) { 16469 if (!this._keySliding && !this._mouseSliding) { 16470 //store the last changed value index for reference when handles overlap 16471 this._lastChangedValue = index; 16472 this._trigger("change", event, this._uiHash(index)); 16473 } 16474 }, 16475 16476 value: function (newValue) { 16477 if (arguments.length) { 16478 this.options.value = this._trimAlignValue(newValue); 16479 this._refreshValue(); 16480 this._change(null, 0); 16481 return; 16482 } 16483 16484 return this._value(); 16485 }, 16486 16487 values: function (index, newValue) { 16488 var vals, newValues, i; 16489 16490 if (arguments.length > 1) { 16491 this.options.values[index] = this._trimAlignValue(newValue); 16492 this._refreshValue(); 16493 this._change(null, index); 16494 return; 16495 } 16496 16497 if (arguments.length) { 16498 if (Array.isArray(arguments[0])) { 16499 vals = this.options.values; 16500 newValues = arguments[0]; 16501 for (i = 0; i < vals.length; i += 1) { 16502 vals[i] = this._trimAlignValue(newValues[i]); 16503 this._change(null, i); 16504 } 16505 this._refreshValue(); 16506 } else { 16507 if (this._hasMultipleValues()) { 16508 return this._values(index); 16509 } else { 16510 return this.value(); 16511 } 16512 } 16513 } else { 16514 return this._values(); 16515 } 16516 }, 16517 16518 _setOption: function (key, value) { 16519 var i, 16520 valsLength = 0; 16521 16522 if (key === "range" && this.options.range === true) { 16523 if (value === "min") { 16524 this.options.value = this._values(0); 16525 this.options.values = null; 16526 } else if (value === "max") { 16527 this.options.value = this._values(this.options.values.length - 1); 16528 this.options.values = null; 16529 } 16530 } 16531 16532 if (Array.isArray(this.options.values)) { 16533 valsLength = this.options.values.length; 16534 } 16535 16536 this._super(key, value); 16537 16538 switch (key) { 16539 case "orientation": 16540 this._detectOrientation(); 16541 this._removeClass( 16542 "ui-slider-horizontal ui-slider-vertical" 16543 )._addClass("ui-slider-" + this.orientation); 16544 this._refreshValue(); 16545 if (this.options.range) { 16546 this._refreshRange(value); 16547 } 16548 16549 // Reset positioning from previous orientation 16550 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 16551 break; 16552 case "value": 16553 this._animateOff = true; 16554 this._refreshValue(); 16555 this._change(null, 0); 16556 this._animateOff = false; 16557 break; 16558 case "values": 16559 this._animateOff = true; 16560 this._refreshValue(); 16561 16562 // Start from the last handle to prevent unreachable handles (#9046) 16563 for (i = valsLength - 1; i >= 0; i--) { 16564 this._change(null, i); 16565 } 16566 this._animateOff = false; 16567 break; 16568 case "step": 16569 case "min": 16570 case "max": 16571 this._animateOff = true; 16572 this._calculateNewMax(); 16573 this._refreshValue(); 16574 this._animateOff = false; 16575 break; 16576 case "range": 16577 this._animateOff = true; 16578 this._refresh(); 16579 this._animateOff = false; 16580 break; 16581 } 16582 }, 16583 16584 _setOptionDisabled: function (value) { 16585 this._super(value); 16586 16587 this._toggleClass(null, "ui-state-disabled", !!value); 16588 }, 16589 16590 //internal value getter 16591 // _value() returns value trimmed by min and max, aligned by step 16592 _value: function () { 16593 var val = this.options.value; 16594 val = this._trimAlignValue(val); 16595 16596 return val; 16597 }, 16598 16599 //internal values getter 16600 // _values() returns array of values trimmed by min and max, aligned by step 16601 // _values( index ) returns single value trimmed by min and max, aligned by step 16602 _values: function (index) { 16603 var val, vals, i; 16604 16605 if (arguments.length) { 16606 val = this.options.values[index]; 16607 val = this._trimAlignValue(val); 16608 16609 return val; 16610 } else if (this._hasMultipleValues()) { 16611 // .slice() creates a copy of the array 16612 // this copy gets trimmed by min and max and then returned 16613 vals = this.options.values.slice(); 16614 for (i = 0; i < vals.length; i += 1) { 16615 vals[i] = this._trimAlignValue(vals[i]); 16616 } 16617 16618 return vals; 16619 } else { 16620 return []; 16621 } 16622 }, 16623 16624 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 16625 _trimAlignValue: function (val) { 16626 if (val <= this._valueMin()) { 16627 return this._valueMin(); 16628 } 16629 if (val >= this._valueMax()) { 16630 return this._valueMax(); 16631 } 16632 var step = this.options.step > 0 ? this.options.step : 1, 16633 valModStep = (val - this._valueMin()) % step, 16634 alignValue = val - valModStep; 16635 16636 if (Math.abs(valModStep) * 2 >= step) { 16637 alignValue += valModStep > 0 ? step : -step; 16638 } 16639 16640 // Since JavaScript has problems with large floats, round 16641 // the final value to 5 digits after the decimal point (see #4124) 16642 return parseFloat(alignValue.toFixed(5)); 16643 }, 16644 16645 _calculateNewMax: function () { 16646 var max = this.options.max, 16647 min = this._valueMin(), 16648 step = this.options.step, 16649 aboveMin = Math.round((max - min) / step) * step; 16650 max = aboveMin + min; 16651 if (max > this.options.max) { 16652 //If max is not divisible by step, rounding off may increase its value 16653 max -= step; 16654 } 16655 this.max = parseFloat(max.toFixed(this._precision())); 16656 }, 16657 16658 _precision: function () { 16659 var precision = this._precisionOf(this.options.step); 16660 if (this.options.min !== null) { 16661 precision = Math.max(precision, this._precisionOf(this.options.min)); 16662 } 16663 return precision; 16664 }, 16665 16666 _precisionOf: function (num) { 16667 var str = num.toString(), 16668 decimal = str.indexOf("."); 16669 return decimal === -1 ? 0 : str.length - decimal - 1; 16670 }, 16671 16672 _valueMin: function () { 16673 return this.options.min; 16674 }, 16675 16676 _valueMax: function () { 16677 return this.max; 16678 }, 16679 16680 _refreshRange: function (orientation) { 16681 if (orientation === "vertical") { 16682 this.range.css({ width: "", left: "" }); 16683 } 16684 if (orientation === "horizontal") { 16685 this.range.css({ height: "", bottom: "" }); 16686 } 16687 }, 16688 16689 _refreshValue: function () { 16690 var lastValPercent, 16691 valPercent, 16692 value, 16693 valueMin, 16694 valueMax, 16695 oRange = this.options.range, 16696 o = this.options, 16697 that = this, 16698 animate = !this._animateOff ? o.animate : false, 16699 _set = {}; 16700 16701 if (this._hasMultipleValues()) { 16702 this.handles.each(function (i) { 16703 valPercent = 16704 ((that.values(i) - that._valueMin()) / 16705 (that._valueMax() - that._valueMin())) * 16706 100; 16707 _set[that.orientation === "horizontal" ? "left" : "bottom"] = 16708 valPercent + "%"; 16709 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 16710 if (that.options.range === true) { 16711 if (that.orientation === "horizontal") { 16712 if (i === 0) { 16713 that.range.stop(1, 1)[animate ? "animate" : "css"]( 16714 { 16715 left: valPercent + "%", 16716 }, 16717 o.animate 16718 ); 16719 } 16720 if (i === 1) { 16721 that.range[animate ? "animate" : "css"]( 16722 { 16723 width: valPercent - lastValPercent + "%", 16724 }, 16725 { 16726 queue: false, 16727 duration: o.animate, 16728 } 16729 ); 16730 } 16731 } else { 16732 if (i === 0) { 16733 that.range.stop(1, 1)[animate ? "animate" : "css"]( 16734 { 16735 bottom: valPercent + "%", 16736 }, 16737 o.animate 16738 ); 16739 } 16740 if (i === 1) { 16741 that.range[animate ? "animate" : "css"]( 16742 { 16743 height: valPercent - lastValPercent + "%", 16744 }, 16745 { 16746 queue: false, 16747 duration: o.animate, 16748 } 16749 ); 16750 } 16751 } 16752 } 16753 lastValPercent = valPercent; 16754 }); 16755 } else { 16756 value = this.value(); 16757 valueMin = this._valueMin(); 16758 valueMax = this._valueMax(); 16759 valPercent = 16760 valueMax !== valueMin 16761 ? ((value - valueMin) / (valueMax - valueMin)) * 100 16762 : 0; 16763 _set[this.orientation === "horizontal" ? "left" : "bottom"] = 16764 valPercent + "%"; 16765 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 16766 16767 if (oRange === "min" && this.orientation === "horizontal") { 16768 this.range.stop(1, 1)[animate ? "animate" : "css"]( 16769 { 16770 width: valPercent + "%", 16771 }, 16772 o.animate 16773 ); 16774 } 16775 if (oRange === "max" && this.orientation === "horizontal") { 16776 this.range.stop(1, 1)[animate ? "animate" : "css"]( 16777 { 16778 width: 100 - valPercent + "%", 16779 }, 16780 o.animate 16781 ); 16782 } 16783 if (oRange === "min" && this.orientation === "vertical") { 16784 this.range.stop(1, 1)[animate ? "animate" : "css"]( 16785 { 16786 height: valPercent + "%", 16787 }, 16788 o.animate 16789 ); 16790 } 16791 if (oRange === "max" && this.orientation === "vertical") { 16792 this.range.stop(1, 1)[animate ? "animate" : "css"]( 16793 { 16794 height: 100 - valPercent + "%", 16795 }, 16796 o.animate 16797 ); 16798 } 16799 } 16800 }, 16801 16802 _handleEvents: { 16803 keydown: function (event) { 16804 var allowed, 16805 curVal, 16806 newVal, 16807 step, 16808 index = $(event.target).data("ui-slider-handle-index"); 16809 16810 switch (event.keyCode) { 16811 case $.ui.keyCode.HOME: 16812 case $.ui.keyCode.END: 16813 case $.ui.keyCode.PAGE_UP: 16814 case $.ui.keyCode.PAGE_DOWN: 16815 case $.ui.keyCode.UP: 16816 case $.ui.keyCode.RIGHT: 16817 case $.ui.keyCode.DOWN: 16818 case $.ui.keyCode.LEFT: 16819 event.preventDefault(); 16820 if (!this._keySliding) { 16821 this._keySliding = true; 16822 this._addClass($(event.target), null, "ui-state-active"); 16823 allowed = this._start(event, index); 16824 if (allowed === false) { 16825 return; 16826 } 16827 } 16828 break; 16829 } 16830 16831 step = this.options.step; 16832 if (this._hasMultipleValues()) { 16833 curVal = newVal = this.values(index); 16834 } else { 16835 curVal = newVal = this.value(); 16836 } 16837 16838 switch (event.keyCode) { 16839 case $.ui.keyCode.HOME: 16840 newVal = this._valueMin(); 16841 break; 16842 case $.ui.keyCode.END: 16843 newVal = this._valueMax(); 16844 break; 16845 case $.ui.keyCode.PAGE_UP: 16846 newVal = this._trimAlignValue( 16847 curVal + (this._valueMax() - this._valueMin()) / this.numPages 16848 ); 16849 break; 16850 case $.ui.keyCode.PAGE_DOWN: 16851 newVal = this._trimAlignValue( 16852 curVal - (this._valueMax() - this._valueMin()) / this.numPages 16853 ); 16854 break; 16855 case $.ui.keyCode.UP: 16856 case $.ui.keyCode.RIGHT: 16857 if (curVal === this._valueMax()) { 16858 return; 16859 } 16860 newVal = this._trimAlignValue(curVal + step); 16861 break; 16862 case $.ui.keyCode.DOWN: 16863 case $.ui.keyCode.LEFT: 16864 if (curVal === this._valueMin()) { 16865 return; 16866 } 16867 newVal = this._trimAlignValue(curVal - step); 16868 break; 16869 } 16870 16871 this._slide(event, index, newVal); 16872 }, 16873 keyup: function (event) { 16874 var index = $(event.target).data("ui-slider-handle-index"); 16875 16876 if (this._keySliding) { 16877 this._keySliding = false;
vendor: 4,252 bytes, lines 16878-17051
16878 this._stop(event, index); 16879 this._change(event, index); 16880 this._removeClass($(event.target), null, "ui-state-active"); 16881 } 16882 }, 16883 }, 16884 }); 16885 16886 /*! 16887 * jQuery UI Sortable 1.13.3 16888 * https://jqueryui.com 16889 * 16890 * Copyright OpenJS Foundation and other contributors 16891 * Released under the MIT license. 16892 * https://jquery.org/license 16893 */ 16894 16895 //>>label: Sortable 16896 //>>group: Interactions 16897 //>>description: Enables items in a list to be sorted using the mouse. 16898 //>>docs: https://api.jqueryui.com/sortable/ 16899 //>>demos: https://jqueryui.com/sortable/ 16900 //>>css.structure: ../../themes/base/sortable.css 16901 16902 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 16903 version: "1.13.3", 16904 widgetEventPrefix: "sort", 16905 ready: false, 16906 options: { 16907 appendTo: "parent", 16908 axis: false, 16909 connectWith: false, 16910 containment: false, 16911 cursor: "auto", 16912 cursorAt: false, 16913 dropOnEmpty: true, 16914 forcePlaceholderSize: false, 16915 forceHelperSize: false, 16916 grid: false, 16917 handle: false, 16918 helper: "original", 16919 items: "> *", 16920 opacity: false, 16921 placeholder: false, 16922 revert: false, 16923 scroll: true, 16924 scrollSensitivity: 20, 16925 scrollSpeed: 20, 16926 scope: "default", 16927 tolerance: "intersect", 16928 zIndex: 1000, 16929 16930 // Callbacks 16931 activate: null, 16932 beforeStop: null, 16933 change: null, 16934 deactivate: null, 16935 out: null, 16936 over: null, 16937 receive: null, 16938 remove: null, 16939 sort: null, 16940 start: null, 16941 stop: null, 16942 update: null, 16943 }, 16944 16945 _isOverAxis: function (x, reference, size) { 16946 return x >= reference && x < reference + size; 16947 }, 16948 16949 _isFloating: function (item) { 16950 return ( 16951 /left|right/.test(item.css("float")) || 16952 /inline|table-cell/.test(item.css("display")) 16953 ); 16954 }, 16955 16956 _create: function () { 16957 this.containerCache = {}; 16958 this._addClass("ui-sortable"); 16959 16960 //Get the items 16961 this.refresh(); 16962 16963 //Let's determine the parent's offset 16964 this.offset = this.element.offset(); 16965 16966 //Initialize mouse events for interaction 16967 this._mouseInit(); 16968 16969 this._setHandleClassName(); 16970 16971 //We're ready to go 16972 this.ready = true; 16973 }, 16974 16975 _setOption: function (key, value) { 16976 this._super(key, value); 16977 16978 if (key === "handle") { 16979 this._setHandleClassName(); 16980 } 16981 }, 16982 16983 _setHandleClassName: function () { 16984 var that = this; 16985 this._removeClass( 16986 this.element.find(".ui-sortable-handle"), 16987 "ui-sortable-handle" 16988 ); 16989 $.each(this.items, function () { 16990 that._addClass( 16991 this.instance.options.handle 16992 ? this.item.find(this.instance.options.handle) 16993 : this.item, 16994 "ui-sortable-handle" 16995 ); 16996 }); 16997 }, 16998 16999 _destroy: function () { 17000 this._mouseDestroy(); 17001 17002 for (var i = this.items.length - 1; i >= 0; i--) { 17003 this.items[i].item.removeData(this.widgetName + "-item"); 17004 } 17005 17006 return this; 17007 }, 17008 17009 _mouseCapture: function (event, overrideHandle) { 17010 var currentItem = null, 17011 validHandle = false, 17012 that = this; 17013 17014 if (this.reverting) { 17015 return false; 17016 } 17017 17018 if (this.options.disabled || this.options.type === "static") { 17019 return false; 17020 } 17021 17022 //We have to refresh the items data once first 17023 this._refreshItems(event); 17024 17025 //Find out if the clicked node (or one of its parents) is a actual item in this.items 17026 $(event.target) 17027 .parents() 17028 .each(function () { 17029 if ($.data(this, that.widgetName + "-item") === that) { 17030 currentItem = $(this); 17031 return false; 17032 } 17033 }); 17034 if ($.data(event.target, that.widgetName + "-item") === that) { 17035 currentItem = $(event.target); 17036 } 17037 17038 if (!currentItem) { 17039 return false; 17040 } 17041 if (this.options.handle && !overrideHandle) { 17042 $(this.options.handle, currentItem) 17043 .find("*") 17044 .addBack() 17045 .each(function () { 17046 if (this === event.target) { 17047 validHandle = true; 17048 } 17049 }); 17050 if (!validHandle) { 17051 return false;
vendor: 5,487 bytes, lines 17052-17237
17052 } 17053 } 17054 17055 this.currentItem = currentItem; 17056 this._removeCurrentsFromItems(); 17057 return true; 17058 }, 17059 17060 _mouseStart: function (event, overrideHandle, noActivation) { 17061 var i, 17062 body, 17063 o = this.options; 17064 17065 this.currentContainer = this; 17066 17067 //We only need to call refreshPositions, because the refreshItems call has been moved to 17068 // mouseCapture 17069 this.refreshPositions(); 17070 17071 //Prepare the dragged items parent 17072 this.appendTo = $( 17073 o.appendTo !== "parent" ? o.appendTo : this.currentItem.parent() 17074 ); 17075 17076 //Create and append the visible helper 17077 this.helper = this._createHelper(event); 17078 17079 //Cache the helper size 17080 this._cacheHelperProportions(); 17081 17082 /* 17083 * - Position generation - 17084 * This block generates everything position related - it's the core of draggables. 17085 */ 17086 17087 //Cache the margins of the original element 17088 this._cacheMargins(); 17089 17090 //The element's absolute position on the page minus margins 17091 this.offset = this.currentItem.offset(); 17092 this.offset = { 17093 top: this.offset.top - this.margins.top, 17094 left: this.offset.left - this.margins.left, 17095 }; 17096 17097 $.extend(this.offset, { 17098 click: { 17099 //Where the click happened, relative to the element 17100 left: event.pageX - this.offset.left, 17101 top: event.pageY - this.offset.top, 17102 }, 17103 17104 // This is a relative to absolute position minus the actual position calculation - 17105 // only used for relative positioned helper 17106 relative: this._getRelativeOffset(), 17107 }); 17108 17109 // After we get the helper offset, but before we get the parent offset we can 17110 // change the helper's position to absolute 17111 // TODO: Still need to figure out a way to make relative sorting possible 17112 this.helper.css("position", "absolute"); 17113 this.cssPosition = this.helper.css("position"); 17114 17115 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 17116 if (o.cursorAt) { 17117 this._adjustOffsetFromHelper(o.cursorAt); 17118 } 17119 17120 //Cache the former DOM position 17121 this.domPosition = { 17122 prev: this.currentItem.prev()[0], 17123 parent: this.currentItem.parent()[0], 17124 }; 17125 17126 // If the helper is not the original, hide the original so it's not playing any role during 17127 // the drag, won't cause anything bad this way 17128 if (this.helper[0] !== this.currentItem[0]) { 17129 this.currentItem.hide(); 17130 } 17131 17132 //Create the placeholder 17133 this._createPlaceholder(); 17134 17135 //Get the next scrolling parent 17136 this.scrollParent = this.placeholder.scrollParent(); 17137 17138 $.extend(this.offset, { 17139 parent: this._getParentOffset(), 17140 }); 17141 17142 //Set a containment if given in the options 17143 if (o.containment) { 17144 this._setContainment(); 17145 } 17146 17147 if (o.cursor && o.cursor !== "auto") { 17148 // cursor option 17149 body = this.document.find("body"); 17150 17151 // Support: IE 17152 this.storedCursor = body.css("cursor"); 17153 body.css("cursor", o.cursor); 17154 17155 this.storedStylesheet = $( 17156 "<style>*{ cursor: " + o.cursor + " !important; }</style>" 17157 ).appendTo(body); 17158 } 17159 17160 // We need to make sure to grab the zIndex before setting the 17161 // opacity, because setting the opacity to anything lower than 1 17162 // causes the zIndex to change from "auto" to 0. 17163 if (o.zIndex) { 17164 // zIndex option 17165 if (this.helper.css("zIndex")) { 17166 this._storedZIndex = this.helper.css("zIndex"); 17167 } 17168 this.helper.css("zIndex", o.zIndex); 17169 } 17170 17171 if (o.opacity) { 17172 // opacity option 17173 if (this.helper.css("opacity")) { 17174 this._storedOpacity = this.helper.css("opacity"); 17175 } 17176 this.helper.css("opacity", o.opacity); 17177 } 17178 17179 //Prepare scrolling 17180 if ( 17181 this.scrollParent[0] !== this.document[0] && 17182 this.scrollParent[0].tagName !== "HTML" 17183 ) { 17184 this.overflowOffset = this.scrollParent.offset(); 17185 } 17186 17187 //Call callbacks 17188 this._trigger("start", event, this._uiHash()); 17189 17190 //Recache the helper size 17191 if (!this._preserveHelperProportions) { 17192 this._cacheHelperProportions(); 17193 } 17194 17195 //Post "activate" events to possible containers 17196 if (!noActivation) { 17197 for (i = this.containers.length - 1; i >= 0; i--) { 17198 this.containers[i]._trigger("activate", event, this._uiHash(this)); 17199 } 17200 } 17201 17202 //Prepare possible droppables 17203 if ($.ui.ddmanager) { 17204 $.ui.ddmanager.current = this; 17205 } 17206 17207 if ($.ui.ddmanager && !o.dropBehaviour) { 17208 $.ui.ddmanager.prepareOffsets(this, event); 17209 } 17210 17211 this.dragging = true; 17212 17213 this._addClass(this.helper, "ui-sortable-helper"); 17214 17215 //Move the helper, if needed 17216 if (!this.helper.parent().is(this.appendTo)) { 17217 this.helper.detach().appendTo(this.appendTo); 17218 17219 //Update position 17220 this.offset.parent = this._getParentOffset(); 17221 } 17222 17223 //Generate the original position 17224 this.position = this.originalPosition = this._generatePosition(event); 17225 this.originalPageX = event.pageX; 17226 this.originalPageY = event.pageY; 17227 this.lastPositionAbs = this.positionAbs = 17228 this._convertPositionTo("absolute"); 17229 17230 this._mouseDrag(event); 17231 17232 return true; 17233 }, 17234 17235 _scroll: function (event) { 17236 var o = this.options, 17237 scrolled = false;
vendor: 21,229 bytes, lines 17238-17917
17238 17239 if ( 17240 this.scrollParent[0] !== this.document[0] && 17241 this.scrollParent[0].tagName !== "HTML" 17242 ) { 17243 if ( 17244 this.overflowOffset.top + 17245 this.scrollParent[0].offsetHeight - 17246 event.pageY < 17247 o.scrollSensitivity 17248 ) { 17249 this.scrollParent[0].scrollTop = scrolled = 17250 this.scrollParent[0].scrollTop + o.scrollSpeed; 17251 } else if ( 17252 event.pageY - this.overflowOffset.top < 17253 o.scrollSensitivity 17254 ) { 17255 this.scrollParent[0].scrollTop = scrolled = 17256 this.scrollParent[0].scrollTop - o.scrollSpeed; 17257 } 17258 17259 if ( 17260 this.overflowOffset.left + 17261 this.scrollParent[0].offsetWidth - 17262 event.pageX < 17263 o.scrollSensitivity 17264 ) { 17265 this.scrollParent[0].scrollLeft = scrolled = 17266 this.scrollParent[0].scrollLeft + o.scrollSpeed; 17267 } else if ( 17268 event.pageX - this.overflowOffset.left < 17269 o.scrollSensitivity 17270 ) { 17271 this.scrollParent[0].scrollLeft = scrolled = 17272 this.scrollParent[0].scrollLeft - o.scrollSpeed; 17273 } 17274 } else { 17275 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 17276 scrolled = this.document.scrollTop( 17277 this.document.scrollTop() - o.scrollSpeed 17278 ); 17279 } else if ( 17280 this.window.height() - (event.pageY - this.document.scrollTop()) < 17281 o.scrollSensitivity 17282 ) { 17283 scrolled = this.document.scrollTop( 17284 this.document.scrollTop() + o.scrollSpeed 17285 ); 17286 } 17287 17288 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 17289 scrolled = this.document.scrollLeft( 17290 this.document.scrollLeft() - o.scrollSpeed 17291 ); 17292 } else if ( 17293 this.window.width() - (event.pageX - this.document.scrollLeft()) < 17294 o.scrollSensitivity 17295 ) { 17296 scrolled = this.document.scrollLeft( 17297 this.document.scrollLeft() + o.scrollSpeed 17298 ); 17299 } 17300 } 17301 17302 return scrolled; 17303 }, 17304 17305 _mouseDrag: function (event) { 17306 var i, 17307 item, 17308 itemElement, 17309 intersection, 17310 o = this.options; 17311 17312 //Compute the helpers position 17313 this.position = this._generatePosition(event); 17314 this.positionAbs = this._convertPositionTo("absolute"); 17315 17316 //Set the helper position 17317 if (!this.options.axis || this.options.axis !== "y") { 17318 this.helper[0].style.left = this.position.left + "px"; 17319 } 17320 if (!this.options.axis || this.options.axis !== "x") { 17321 this.helper[0].style.top = this.position.top + "px"; 17322 } 17323 17324 //Do scrolling 17325 if (o.scroll) { 17326 if (this._scroll(event) !== false) { 17327 //Update item positions used in position checks 17328 this._refreshItemPositions(true); 17329 17330 if ($.ui.ddmanager && !o.dropBehaviour) { 17331 $.ui.ddmanager.prepareOffsets(this, event); 17332 } 17333 } 17334 } 17335 17336 this.dragDirection = { 17337 vertical: this._getDragVerticalDirection(), 17338 horizontal: this._getDragHorizontalDirection(), 17339 }; 17340 17341 //Rearrange 17342 for (i = this.items.length - 1; i >= 0; i--) { 17343 //Cache variables and intersection, continue if no intersection 17344 item = this.items[i]; 17345 itemElement = item.item[0]; 17346 intersection = this._intersectsWithPointer(item); 17347 if (!intersection) { 17348 continue; 17349 } 17350 17351 // Only put the placeholder inside the current Container, skip all 17352 // items from other containers. This works because when moving 17353 // an item from one container to another the 17354 // currentContainer is switched before the placeholder is moved. 17355 // 17356 // Without this, moving items in "sub-sortables" can cause 17357 // the placeholder to jitter between the outer and inner container. 17358 if (item.instance !== this.currentContainer) { 17359 continue; 17360 } 17361 17362 // Cannot intersect with itself 17363 // no useless actions that have been done before 17364 // no action if the item moved is the parent of the item checked 17365 if ( 17366 itemElement !== this.currentItem[0] && 17367 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== 17368 itemElement && 17369 !$.contains(this.placeholder[0], itemElement) && 17370 (this.options.type === "semi-dynamic" 17371 ? !$.contains(this.element[0], itemElement) 17372 : true) 17373 ) { 17374 this.direction = intersection === 1 ? "down" : "up"; 17375 17376 if ( 17377 this.options.tolerance === "pointer" || 17378 this._intersectsWithSides(item) 17379 ) { 17380 this._rearrange(event, item); 17381 } else { 17382 break; 17383 } 17384 17385 this._trigger("change", event, this._uiHash()); 17386 break; 17387 } 17388 } 17389 17390 //Post events to containers 17391 this._contactContainers(event); 17392 17393 //Interconnect with droppables 17394 if ($.ui.ddmanager) { 17395 $.ui.ddmanager.drag(this, event); 17396 } 17397 17398 //Call callbacks 17399 this._trigger("sort", event, this._uiHash()); 17400 17401 this.lastPositionAbs = this.positionAbs; 17402 return false; 17403 }, 17404 17405 _mouseStop: function (event, noPropagation) { 17406 if (!event) { 17407 return; 17408 } 17409 17410 //If we are using droppables, inform the manager about the drop 17411 if ($.ui.ddmanager && !this.options.dropBehaviour) { 17412 $.ui.ddmanager.drop(this, event); 17413 } 17414 17415 if (this.options.revert) { 17416 var that = this, 17417 cur = this.placeholder.offset(), 17418 axis = this.options.axis, 17419 animation = {}; 17420 17421 if (!axis || axis === "x") { 17422 animation.left = 17423 cur.left - 17424 this.offset.parent.left - 17425 this.margins.left + 17426 (this.offsetParent[0] === this.document[0].body 17427 ? 0 17428 : this.offsetParent[0].scrollLeft); 17429 } 17430 if (!axis || axis === "y") { 17431 animation.top = 17432 cur.top - 17433 this.offset.parent.top - 17434 this.margins.top + 17435 (this.offsetParent[0] === this.document[0].body 17436 ? 0 17437 : this.offsetParent[0].scrollTop); 17438 } 17439 this.reverting = true; 17440 $(this.helper).animate( 17441 animation, 17442 parseInt(this.options.revert, 10) || 500, 17443 function () { 17444 that._clear(event); 17445 } 17446 ); 17447 } else { 17448 this._clear(event, noPropagation); 17449 } 17450 17451 return false; 17452 }, 17453 17454 cancel: function () { 17455 if (this.dragging) { 17456 this._mouseUp(new $.Event("mouseup", { target: null })); 17457 17458 if (this.options.helper === "original") { 17459 this.currentItem.css(this._storedCSS); 17460 this._removeClass(this.currentItem, "ui-sortable-helper"); 17461 } else { 17462 this.currentItem.show(); 17463 } 17464 17465 //Post deactivating events to containers 17466 for (var i = this.containers.length - 1; i >= 0; i--) { 17467 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 17468 if (this.containers[i].containerCache.over) { 17469 this.containers[i]._trigger("out", null, this._uiHash(this)); 17470 this.containers[i].containerCache.over = 0; 17471 } 17472 } 17473 } 17474 17475 if (this.placeholder) { 17476 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 17477 // it unbinds ALL events from the original node! 17478 if (this.placeholder[0].parentNode) { 17479 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 17480 } 17481 if ( 17482 this.options.helper !== "original" && 17483 this.helper && 17484 this.helper[0].parentNode 17485 ) { 17486 this.helper.remove(); 17487 } 17488 17489 $.extend(this, { 17490 helper: null, 17491 dragging: false, 17492 reverting: false, 17493 _noFinalSort: null, 17494 }); 17495 17496 if (this.domPosition.prev) { 17497 $(this.domPosition.prev).after(this.currentItem); 17498 } else { 17499 $(this.domPosition.parent).prepend(this.currentItem); 17500 } 17501 } 17502 17503 return this; 17504 }, 17505 17506 serialize: function (o) { 17507 var items = this._getItemsAsjQuery(o && o.connected), 17508 str = []; 17509 o = o || {}; 17510 17511 $(items).each(function () { 17512 var res = ($(o.item || this).attr(o.attribute || "id") || "").match( 17513 o.expression || /(.+)[\-=_](.+)/ 17514 ); 17515 if (res) { 17516 str.push( 17517 (o.key || res[1] + "[]") + 17518 "=" + 17519 (o.key && o.expression ? res[1] : res[2]) 17520 ); 17521 } 17522 }); 17523 17524 if (!str.length && o.key) { 17525 str.push(o.key + "="); 17526 } 17527 17528 return str.join("&"); 17529 }, 17530 17531 toArray: function (o) { 17532 var items = this._getItemsAsjQuery(o && o.connected), 17533 ret = []; 17534 17535 o = o || {}; 17536 17537 items.each(function () { 17538 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 17539 }); 17540 return ret; 17541 }, 17542 17543 /* Be careful with the following core functions */ 17544 _intersectsWith: function (item) { 17545 var x1 = this.positionAbs.left, 17546 x2 = x1 + this.helperProportions.width, 17547 y1 = this.positionAbs.top, 17548 y2 = y1 + this.helperProportions.height, 17549 l = item.left, 17550 r = l + item.width, 17551 t = item.top, 17552 b = t + item.height, 17553 dyClick = this.offset.click.top, 17554 dxClick = this.offset.click.left, 17555 isOverElementHeight = 17556 this.options.axis === "x" || (y1 + dyClick > t && y1 + dyClick < b), 17557 isOverElementWidth = 17558 this.options.axis === "y" || (x1 + dxClick > l && x1 + dxClick < r), 17559 isOverElement = isOverElementHeight && isOverElementWidth; 17560 17561 if ( 17562 this.options.tolerance === "pointer" || 17563 this.options.forcePointerForContainers || 17564 (this.options.tolerance !== "pointer" && 17565 this.helperProportions[this.floating ? "width" : "height"] > 17566 item[this.floating ? "width" : "height"]) 17567 ) { 17568 return isOverElement; 17569 } else { 17570 return ( 17571 l < x1 + this.helperProportions.width / 2 && // Right Half 17572 x2 - this.helperProportions.width / 2 < r && // Left Half 17573 t < y1 + this.helperProportions.height / 2 && // Bottom Half 17574 y2 - this.helperProportions.height / 2 < b 17575 ); // Top Half 17576 } 17577 }, 17578 17579 _intersectsWithPointer: function (item) { 17580 var verticalDirection, 17581 horizontalDirection, 17582 isOverElementHeight = 17583 this.options.axis === "x" || 17584 this._isOverAxis( 17585 this.positionAbs.top + this.offset.click.top, 17586 item.top, 17587 item.height 17588 ), 17589 isOverElementWidth = 17590 this.options.axis === "y" || 17591 this._isOverAxis( 17592 this.positionAbs.left + this.offset.click.left, 17593 item.left, 17594 item.width 17595 ), 17596 isOverElement = isOverElementHeight && isOverElementWidth; 17597 17598 if (!isOverElement) { 17599 return false; 17600 } 17601 17602 verticalDirection = this.dragDirection.vertical; 17603 horizontalDirection = this.dragDirection.horizontal; 17604 17605 return this.floating 17606 ? horizontalDirection === "right" || verticalDirection === "down" 17607 ? 2 17608 : 1 17609 : verticalDirection && (verticalDirection === "down" ? 2 : 1); 17610 }, 17611 17612 _intersectsWithSides: function (item) { 17613 var isOverBottomHalf = this._isOverAxis( 17614 this.positionAbs.top + this.offset.click.top, 17615 item.top + item.height / 2, 17616 item.height 17617 ), 17618 isOverRightHalf = this._isOverAxis( 17619 this.positionAbs.left + this.offset.click.left, 17620 item.left + item.width / 2, 17621 item.width 17622 ), 17623 verticalDirection = this.dragDirection.vertical, 17624 horizontalDirection = this.dragDirection.horizontal; 17625 17626 if (this.floating && horizontalDirection) { 17627 return ( 17628 (horizontalDirection === "right" && isOverRightHalf) || 17629 (horizontalDirection === "left" && !isOverRightHalf) 17630 ); 17631 } else { 17632 return ( 17633 verticalDirection && 17634 ((verticalDirection === "down" && isOverBottomHalf) || 17635 (verticalDirection === "up" && !isOverBottomHalf)) 17636 ); 17637 } 17638 }, 17639 17640 _getDragVerticalDirection: function () { 17641 var delta = this.positionAbs.top - this.lastPositionAbs.top; 17642 return delta !== 0 && (delta > 0 ? "down" : "up"); 17643 }, 17644 17645 _getDragHorizontalDirection: function () { 17646 var delta = this.positionAbs.left - this.lastPositionAbs.left; 17647 return delta !== 0 && (delta > 0 ? "right" : "left"); 17648 }, 17649 17650 refresh: function (event) { 17651 this._refreshItems(event); 17652 this._setHandleClassName(); 17653 this.refreshPositions(); 17654 return this; 17655 }, 17656 17657 _connectWith: function () { 17658 var options = this.options; 17659 return options.connectWith.constructor === String 17660 ? [options.connectWith] 17661 : options.connectWith; 17662 }, 17663 17664 _getItemsAsjQuery: function (connected) { 17665 var i, 17666 j, 17667 cur, 17668 inst, 17669 items = [], 17670 queries = [], 17671 connectWith = this._connectWith(); 17672 17673 if (connectWith && connected) { 17674 for (i = connectWith.length - 1; i >= 0; i--) { 17675 cur = $(connectWith[i], this.document[0]); 17676 for (j = cur.length - 1; j >= 0; j--) { 17677 inst = $.data(cur[j], this.widgetFullName); 17678 if (inst && inst !== this && !inst.options.disabled) { 17679 queries.push([ 17680 typeof inst.options.items === "function" 17681 ? inst.options.items.call(inst.element) 17682 : $(inst.options.items, inst.element) 17683 .not(".ui-sortable-helper") 17684 .not(".ui-sortable-placeholder"), 17685 inst, 17686 ]); 17687 } 17688 } 17689 } 17690 } 17691 17692 queries.push([ 17693 typeof this.options.items === "function" 17694 ? this.options.items.call(this.element, null, { 17695 options: this.options, 17696 item: this.currentItem, 17697 }) 17698 : $(this.options.items, this.element) 17699 .not(".ui-sortable-helper") 17700 .not(".ui-sortable-placeholder"), 17701 this, 17702 ]); 17703 17704 function addItems() { 17705 items.push(this); 17706 } 17707 for (i = queries.length - 1; i >= 0; i--) { 17708 queries[i][0].each(addItems); 17709 } 17710 17711 return $(items); 17712 }, 17713 17714 _removeCurrentsFromItems: function () { 17715 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 17716 17717 this.items = $.grep(this.items, function (item) { 17718 for (var j = 0; j < list.length; j++) { 17719 if (list[j] === item.item[0]) { 17720 return false; 17721 } 17722 } 17723 return true; 17724 }); 17725 }, 17726 17727 _refreshItems: function (event) { 17728 this.items = []; 17729 this.containers = [this]; 17730 17731 var i, 17732 j, 17733 cur, 17734 inst, 17735 targetData, 17736 _queries, 17737 item, 17738 queriesLength, 17739 items = this.items, 17740 queries = [ 17741 [ 17742 typeof this.options.items === "function" 17743 ? this.options.items.call(this.element[0], event, { 17744 item: this.currentItem, 17745 }) 17746 : $(this.options.items, this.element), 17747 this, 17748 ], 17749 ], 17750 connectWith = this._connectWith(); 17751 17752 //Shouldn't be run the first time through due to massive slow-down 17753 if (connectWith && this.ready) { 17754 for (i = connectWith.length - 1; i >= 0; i--) { 17755 cur = $(connectWith[i], this.document[0]); 17756 for (j = cur.length - 1; j >= 0; j--) { 17757 inst = $.data(cur[j], this.widgetFullName); 17758 if (inst && inst !== this && !inst.options.disabled) { 17759 queries.push([ 17760 typeof inst.options.items === "function" 17761 ? inst.options.items.call(inst.element[0], event, { 17762 item: this.currentItem, 17763 }) 17764 : $(inst.options.items, inst.element), 17765 inst, 17766 ]); 17767 this.containers.push(inst); 17768 } 17769 } 17770 } 17771 } 17772 17773 for (i = queries.length - 1; i >= 0; i--) { 17774 targetData = queries[i][1]; 17775 _queries = queries[i][0]; 17776 17777 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 17778 item = $(_queries[j]); 17779 17780 // Data for target checking (mouse manager) 17781 item.data(this.widgetName + "-item", targetData); 17782 17783 items.push({ 17784 item: item, 17785 instance: targetData, 17786 width: 0, 17787 height: 0, 17788 left: 0, 17789 top: 0, 17790 }); 17791 } 17792 } 17793 }, 17794 17795 _refreshItemPositions: function (fast) { 17796 var i, item, t, p; 17797 17798 for (i = this.items.length - 1; i >= 0; i--) { 17799 item = this.items[i]; 17800 17801 //We ignore calculating positions of all connected containers when we're not over them 17802 if ( 17803 this.currentContainer && 17804 item.instance !== this.currentContainer && 17805 item.item[0] !== this.currentItem[0] 17806 ) { 17807 continue; 17808 } 17809 17810 t = this.options.toleranceElement 17811 ? $(this.options.toleranceElement, item.item) 17812 : item.item; 17813 17814 if (!fast) { 17815 item.width = t.outerWidth(); 17816 item.height = t.outerHeight(); 17817 } 17818 17819 p = t.offset(); 17820 item.left = p.left; 17821 item.top = p.top; 17822 } 17823 }, 17824 17825 refreshPositions: function (fast) { 17826 // Determine whether items are being displayed horizontally 17827 this.floating = this.items.length 17828 ? this.options.axis === "x" || this._isFloating(this.items[0].item) 17829 : false; 17830 17831 // This has to be redone because due to the item being moved out/into the offsetParent, 17832 // the offsetParent's position will change 17833 if (this.offsetParent && this.helper) { 17834 this.offset.parent = this._getParentOffset(); 17835 } 17836 17837 this._refreshItemPositions(fast); 17838 17839 var i, p; 17840 17841 if (this.options.custom && this.options.custom.refreshContainers) { 17842 this.options.custom.refreshContainers.call(this); 17843 } else { 17844 for (i = this.containers.length - 1; i >= 0; i--) { 17845 p = this.containers[i].element.offset(); 17846 this.containers[i].containerCache.left = p.left; 17847 this.containers[i].containerCache.top = p.top; 17848 this.containers[i].containerCache.width = 17849 this.containers[i].element.outerWidth(); 17850 this.containers[i].containerCache.height = 17851 this.containers[i].element.outerHeight(); 17852 } 17853 } 17854 17855 return this; 17856 }, 17857 17858 _createPlaceholder: function (that) { 17859 that = that || this; 17860 var className, 17861 nodeName, 17862 o = that.options; 17863 17864 if (!o.placeholder || o.placeholder.constructor === String) { 17865 className = o.placeholder; 17866 nodeName = that.currentItem[0].nodeName.toLowerCase(); 17867 o.placeholder = { 17868 element: function () { 17869 var element = $("<" + nodeName + ">", that.document[0]); 17870 17871 that 17872 ._addClass( 17873 element, 17874 "ui-sortable-placeholder", 17875 className || that.currentItem[0].className 17876 ) 17877 ._removeClass(element, "ui-sortable-helper"); 17878 17879 if (nodeName === "tbody") { 17880 that._createTrPlaceholder( 17881 that.currentItem.find("tr").eq(0), 17882 $("<tr>", that.document[0]).appendTo(element) 17883 ); 17884 } else if (nodeName === "tr") { 17885 that._createTrPlaceholder(that.currentItem, element); 17886 } else if (nodeName === "img") { 17887 element.attr("src", that.currentItem.attr("src")); 17888 } 17889 17890 if (!className) { 17891 element.css("visibility", "hidden"); 17892 } 17893 17894 return element; 17895 }, 17896 update: function (container, p) { 17897 // 1. If a className is set as 'placeholder option, we don't force sizes - 17898 // the class is responsible for that 17899 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 17900 // class name is specified 17901 if (className && !o.forcePlaceholderSize) { 17902 return; 17903 } 17904 17905 // If the element doesn't have a actual height or width by itself (without 17906 // styles coming from a stylesheet), it receives the inline height and width 17907 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 17908 // anyway since we're populating them with <td>s above, but they're unlikely to 17909 // be the correct height on their own if the row heights are dynamic, so we'll 17910 // always assign the height of the dragged item given forcePlaceholderSize 17911 // is true. 17912 if ( 17913 !p.height() || 17914 (o.forcePlaceholderSize && 17915 (nodeName === "tbody" || nodeName === "tr")) 17916 ) { 17917 p.height(
vendor: 16,384 bytes, lines 17918-18410
17918 that.currentItem.innerHeight() - 17919 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 17920 parseInt(that.currentItem.css("paddingBottom") || 0, 10) 17921 ); 17922 } 17923 if (!p.width()) { 17924 p.width( 17925 that.currentItem.innerWidth() - 17926 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 17927 parseInt(that.currentItem.css("paddingRight") || 0, 10) 17928 ); 17929 } 17930 }, 17931 }; 17932 } 17933 17934 //Create the placeholder 17935 that.placeholder = $( 17936 o.placeholder.element.call(that.element, that.currentItem) 17937 ); 17938 17939 //Append it after the actual current item 17940 that.currentItem.after(that.placeholder); 17941 17942 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 17943 o.placeholder.update(that, that.placeholder); 17944 }, 17945 17946 _createTrPlaceholder: function (sourceTr, targetTr) { 17947 var that = this; 17948 17949 sourceTr.children().each(function () { 17950 $("<td> </td>", that.document[0]) 17951 .attr("colspan", $(this).attr("colspan") || 1) 17952 .appendTo(targetTr); 17953 }); 17954 }, 17955 17956 _contactContainers: function (event) { 17957 var i, 17958 j, 17959 dist, 17960 itemWithLeastDistance, 17961 posProperty, 17962 sizeProperty, 17963 cur, 17964 nearBottom, 17965 floating, 17966 axis, 17967 innermostContainer = null, 17968 innermostIndex = null; 17969 17970 // Get innermost container that intersects with item 17971 for (i = this.containers.length - 1; i >= 0; i--) { 17972 // Never consider a container that's located within the item itself 17973 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 17974 continue; 17975 } 17976 17977 if (this._intersectsWith(this.containers[i].containerCache)) { 17978 // If we've already found a container and it's more "inner" than this, then continue 17979 if ( 17980 innermostContainer && 17981 $.contains( 17982 this.containers[i].element[0], 17983 innermostContainer.element[0] 17984 ) 17985 ) { 17986 continue; 17987 } 17988 17989 innermostContainer = this.containers[i]; 17990 innermostIndex = i; 17991 } else { 17992 // container doesn't intersect. trigger "out" event if necessary 17993 if (this.containers[i].containerCache.over) { 17994 this.containers[i]._trigger("out", event, this._uiHash(this)); 17995 this.containers[i].containerCache.over = 0; 17996 } 17997 } 17998 } 17999 18000 // If no intersecting containers found, return 18001 if (!innermostContainer) { 18002 return; 18003 } 18004 18005 // Move the item into the container if it's not there already 18006 if (this.containers.length === 1) { 18007 if (!this.containers[innermostIndex].containerCache.over) { 18008 this.containers[innermostIndex]._trigger( 18009 "over", 18010 event, 18011 this._uiHash(this) 18012 ); 18013 this.containers[innermostIndex].containerCache.over = 1; 18014 } 18015 } else { 18016 // When entering a new container, we will find the item with the least distance and 18017 // append our item near it 18018 dist = 10000; 18019 itemWithLeastDistance = null; 18020 floating = 18021 innermostContainer.floating || this._isFloating(this.currentItem); 18022 posProperty = floating ? "left" : "top"; 18023 sizeProperty = floating ? "width" : "height"; 18024 axis = floating ? "pageX" : "pageY"; 18025 18026 for (j = this.items.length - 1; j >= 0; j--) { 18027 if ( 18028 !$.contains( 18029 this.containers[innermostIndex].element[0], 18030 this.items[j].item[0] 18031 ) 18032 ) { 18033 continue; 18034 } 18035 if (this.items[j].item[0] === this.currentItem[0]) { 18036 continue; 18037 } 18038 18039 cur = this.items[j].item.offset()[posProperty]; 18040 nearBottom = false; 18041 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 18042 nearBottom = true; 18043 } 18044 18045 if (Math.abs(event[axis] - cur) < dist) { 18046 dist = Math.abs(event[axis] - cur); 18047 itemWithLeastDistance = this.items[j]; 18048 this.direction = nearBottom ? "up" : "down"; 18049 } 18050 } 18051 18052 //Check if dropOnEmpty is enabled 18053 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 18054 return; 18055 } 18056 18057 if (this.currentContainer === this.containers[innermostIndex]) { 18058 if (!this.currentContainer.containerCache.over) { 18059 this.containers[innermostIndex]._trigger( 18060 "over", 18061 event, 18062 this._uiHash() 18063 ); 18064 this.currentContainer.containerCache.over = 1; 18065 } 18066 return; 18067 } 18068 18069 if (itemWithLeastDistance) { 18070 this._rearrange(event, itemWithLeastDistance, null, true); 18071 } else { 18072 this._rearrange( 18073 event, 18074 null, 18075 this.containers[innermostIndex].element, 18076 true 18077 ); 18078 } 18079 this._trigger("change", event, this._uiHash()); 18080 this.containers[innermostIndex]._trigger( 18081 "change", 18082 event, 18083 this._uiHash(this) 18084 ); 18085 this.currentContainer = this.containers[innermostIndex]; 18086 18087 //Update the placeholder 18088 this.options.placeholder.update( 18089 this.currentContainer, 18090 this.placeholder 18091 ); 18092 18093 //Update scrollParent 18094 this.scrollParent = this.placeholder.scrollParent(); 18095 18096 //Update overflowOffset 18097 if ( 18098 this.scrollParent[0] !== this.document[0] && 18099 this.scrollParent[0].tagName !== "HTML" 18100 ) { 18101 this.overflowOffset = this.scrollParent.offset(); 18102 } 18103 18104 this.containers[innermostIndex]._trigger( 18105 "over", 18106 event, 18107 this._uiHash(this) 18108 ); 18109 this.containers[innermostIndex].containerCache.over = 1; 18110 } 18111 }, 18112 18113 _createHelper: function (event) { 18114 var o = this.options, 18115 helper = 18116 typeof o.helper === "function" 18117 ? $(o.helper.apply(this.element[0], [event, this.currentItem])) 18118 : o.helper === "clone" 18119 ? this.currentItem.clone() 18120 : this.currentItem; 18121 18122 //Add the helper to the DOM if that didn't happen already 18123 if (!helper.parents("body").length) { 18124 this.appendTo[0].appendChild(helper[0]); 18125 } 18126 18127 if (helper[0] === this.currentItem[0]) { 18128 this._storedCSS = { 18129 width: this.currentItem[0].style.width, 18130 height: this.currentItem[0].style.height, 18131 position: this.currentItem.css("position"), 18132 top: this.currentItem.css("top"), 18133 left: this.currentItem.css("left"), 18134 }; 18135 } 18136 18137 if (!helper[0].style.width || o.forceHelperSize) { 18138 helper.width(this.currentItem.width()); 18139 } 18140 if (!helper[0].style.height || o.forceHelperSize) { 18141 helper.height(this.currentItem.height()); 18142 } 18143 18144 return helper; 18145 }, 18146 18147 _adjustOffsetFromHelper: function (obj) { 18148 if (typeof obj === "string") { 18149 obj = obj.split(" "); 18150 } 18151 if (Array.isArray(obj)) { 18152 obj = { left: +obj[0], top: +obj[1] || 0 }; 18153 } 18154 if ("left" in obj) { 18155 this.offset.click.left = obj.left + this.margins.left; 18156 } 18157 if ("right" in obj) { 18158 this.offset.click.left = 18159 this.helperProportions.width - obj.right + this.margins.left; 18160 } 18161 if ("top" in obj) { 18162 this.offset.click.top = obj.top + this.margins.top; 18163 } 18164 if ("bottom" in obj) { 18165 this.offset.click.top = 18166 this.helperProportions.height - obj.bottom + this.margins.top; 18167 } 18168 }, 18169 18170 _getParentOffset: function () { 18171 //Get the offsetParent and cache its position 18172 this.offsetParent = this.helper.offsetParent(); 18173 var po = this.offsetParent.offset(); 18174 18175 // This is a special case where we need to modify a offset calculated on start, since the 18176 // following happened: 18177 // 1. The position of the helper is absolute, so it's position is calculated based on the 18178 // next positioned parent 18179 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 18180 // the document, which means that the scroll is included in the initial calculation of the 18181 // offset of the parent, and never recalculated upon drag 18182 if ( 18183 this.cssPosition === "absolute" && 18184 this.scrollParent[0] !== this.document[0] && 18185 $.contains(this.scrollParent[0], this.offsetParent[0]) 18186 ) { 18187 po.left += this.scrollParent.scrollLeft(); 18188 po.top += this.scrollParent.scrollTop(); 18189 } 18190 18191 // This needs to be actually done for all browsers, since pageX/pageY includes this 18192 // information with an ugly IE fix 18193 if ( 18194 this.offsetParent[0] === this.document[0].body || 18195 (this.offsetParent[0].tagName && 18196 this.offsetParent[0].tagName.toLowerCase() === "html" && 18197 $.ui.ie) 18198 ) { 18199 po = { top: 0, left: 0 }; 18200 } 18201 18202 return { 18203 top: 18204 po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 18205 left: 18206 po.left + 18207 (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0), 18208 }; 18209 }, 18210 18211 _getRelativeOffset: function () { 18212 if (this.cssPosition === "relative") { 18213 var p = this.currentItem.position(); 18214 return { 18215 top: 18216 p.top - 18217 (parseInt(this.helper.css("top"), 10) || 0) + 18218 this.scrollParent.scrollTop(), 18219 left: 18220 p.left - 18221 (parseInt(this.helper.css("left"), 10) || 0) + 18222 this.scrollParent.scrollLeft(), 18223 }; 18224 } else { 18225 return { top: 0, left: 0 }; 18226 } 18227 }, 18228 18229 _cacheMargins: function () { 18230 this.margins = { 18231 left: parseInt(this.currentItem.css("marginLeft"), 10) || 0, 18232 top: parseInt(this.currentItem.css("marginTop"), 10) || 0, 18233 }; 18234 }, 18235 18236 _cacheHelperProportions: function () { 18237 this.helperProportions = { 18238 width: this.helper.outerWidth(), 18239 height: this.helper.outerHeight(), 18240 }; 18241 }, 18242 18243 _setContainment: function () { 18244 var ce, 18245 co, 18246 over, 18247 o = this.options; 18248 if (o.containment === "parent") { 18249 o.containment = this.helper[0].parentNode; 18250 } 18251 if (o.containment === "document" || o.containment === "window") { 18252 this.containment = [ 18253 0 - this.offset.relative.left - this.offset.parent.left, 18254 0 - this.offset.relative.top - this.offset.parent.top, 18255 o.containment === "document" 18256 ? this.document.width() 18257 : this.window.width() - 18258 this.helperProportions.width - 18259 this.margins.left, 18260 (o.containment === "document" 18261 ? this.document.height() || document.body.parentNode.scrollHeight 18262 : this.window.height() || 18263 this.document[0].body.parentNode.scrollHeight) - 18264 this.helperProportions.height - 18265 this.margins.top, 18266 ]; 18267 } 18268 18269 if (!/^(document|window|parent)$/.test(o.containment)) { 18270 ce = $(o.containment)[0]; 18271 co = $(o.containment).offset(); 18272 over = $(ce).css("overflow") !== "hidden"; 18273 18274 this.containment = [ 18275 co.left + 18276 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 18277 (parseInt($(ce).css("paddingLeft"), 10) || 0) - 18278 this.margins.left, 18279 co.top + 18280 (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 18281 (parseInt($(ce).css("paddingTop"), 10) || 0) - 18282 this.margins.top, 18283 co.left + 18284 (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 18285 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 18286 (parseInt($(ce).css("paddingRight"), 10) || 0) - 18287 this.helperProportions.width - 18288 this.margins.left, 18289 co.top + 18290 (over 18291 ? Math.max(ce.scrollHeight, ce.offsetHeight) 18292 : ce.offsetHeight) - 18293 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 18294 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 18295 this.helperProportions.height - 18296 this.margins.top, 18297 ]; 18298 } 18299 }, 18300 18301 _convertPositionTo: function (d, pos) { 18302 if (!pos) { 18303 pos = this.position; 18304 } 18305 var mod = d === "absolute" ? 1 : -1, 18306 scroll = 18307 this.cssPosition === "absolute" && 18308 !( 18309 this.scrollParent[0] !== this.document[0] && 18310 $.contains(this.scrollParent[0], this.offsetParent[0]) 18311 ) 18312 ? this.offsetParent 18313 : this.scrollParent, 18314 scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName); 18315 18316 return { 18317 top: 18318 // The absolute mouse position 18319 pos.top + 18320 // Only for relative positioned nodes: Relative offset from element to offset parent 18321 this.offset.relative.top * mod + 18322 // The offsetParent's offset without borders (offset + border) 18323 this.offset.parent.top * mod - 18324 (this.cssPosition === "fixed" 18325 ? -this.scrollParent.scrollTop() 18326 : scrollIsRootNode 18327 ? 0 18328 : scroll.scrollTop()) * 18329 mod, 18330 left: 18331 // The absolute mouse position 18332 pos.left + 18333 // Only for relative positioned nodes: Relative offset from element to offset parent 18334 this.offset.relative.left * mod + 18335 // The offsetParent's offset without borders (offset + border) 18336 this.offset.parent.left * mod - 18337 (this.cssPosition === "fixed" 18338 ? -this.scrollParent.scrollLeft() 18339 : scrollIsRootNode 18340 ? 0 18341 : scroll.scrollLeft()) * 18342 mod, 18343 }; 18344 }, 18345 18346 _generatePosition: function (event) { 18347 var top, 18348 left, 18349 o = this.options, 18350 pageX = event.pageX, 18351 pageY = event.pageY, 18352 scroll = 18353 this.cssPosition === "absolute" && 18354 !( 18355 this.scrollParent[0] !== this.document[0] && 18356 $.contains(this.scrollParent[0], this.offsetParent[0]) 18357 ) 18358 ? this.offsetParent 18359 : this.scrollParent, 18360 scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName); 18361 18362 // This is another very weird special case that only happens for relative elements: 18363 // 1. If the css position is relative 18364 // 2. and the scroll parent is the document or similar to the offset parent 18365 // we have to refresh the relative offset during the scroll so there are no jumps 18366 if ( 18367 this.cssPosition === "relative" && 18368 !( 18369 this.scrollParent[0] !== this.document[0] && 18370 this.scrollParent[0] !== this.offsetParent[0] 18371 ) 18372 ) { 18373 this.offset.relative = this._getRelativeOffset(); 18374 } 18375 18376 /* 18377 * - Position constraining - 18378 * Constrain the position to a mix of grid, containment. 18379 */ 18380 18381 if (this.originalPosition) { 18382 //If we are not dragging yet, we won't check for options 18383 18384 if (this.containment) { 18385 if (event.pageX - this.offset.click.left < this.containment[0]) { 18386 pageX = this.containment[0] + this.offset.click.left; 18387 } 18388 if (event.pageY - this.offset.click.top < this.containment[1]) { 18389 pageY = this.containment[1] + this.offset.click.top; 18390 } 18391 if (event.pageX - this.offset.click.left > this.containment[2]) { 18392 pageX = this.containment[2] + this.offset.click.left; 18393 } 18394 if (event.pageY - this.offset.click.top > this.containment[3]) { 18395 pageY = this.containment[3] + this.offset.click.top; 18396 } 18397 } 18398 18399 if (o.grid) { 18400 top = 18401 this.originalPageY + 18402 Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; 18403 pageY = this.containment 18404 ? top - this.offset.click.top >= this.containment[1] && 18405 top - this.offset.click.top <= this.containment[3] 18406 ? top 18407 : top - this.offset.click.top >= this.containment[1] 18408 ? top - o.grid[1] 18409 : top + o.grid[1] 18410
vendor: 5,744 bytes, lines 18410-18571
18410 : top; 18411 18412 left = 18413 this.originalPageX + 18414 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; 18415 pageX = this.containment 18416 ? left - this.offset.click.left >= this.containment[0] && 18417 left - this.offset.click.left <= this.containment[2] 18418 ? left 18419 : left - this.offset.click.left >= this.containment[0] 18420 ? left - o.grid[0] 18421 : left + o.grid[0] 18422 : left; 18423 } 18424 } 18425 18426 return { 18427 top: 18428 // The absolute mouse position 18429 pageY - 18430 // Click offset (relative to the element) 18431 this.offset.click.top - 18432 // Only for relative positioned nodes: Relative offset from element to offset parent 18433 this.offset.relative.top - 18434 // The offsetParent's offset without borders (offset + border) 18435 this.offset.parent.top + 18436 (this.cssPosition === "fixed" 18437 ? -this.scrollParent.scrollTop() 18438 : scrollIsRootNode 18439 ? 0 18440 : scroll.scrollTop()), 18441 left: 18442 // The absolute mouse position 18443 pageX - 18444 // Click offset (relative to the element) 18445 this.offset.click.left - 18446 // Only for relative positioned nodes: Relative offset from element to offset parent 18447 this.offset.relative.left - 18448 // The offsetParent's offset without borders (offset + border) 18449 this.offset.parent.left + 18450 (this.cssPosition === "fixed" 18451 ? -this.scrollParent.scrollLeft() 18452 : scrollIsRootNode 18453 ? 0 18454 : scroll.scrollLeft()), 18455 }; 18456 }, 18457 18458 _rearrange: function (event, i, a, hardRefresh) { 18459 if (a) { 18460 a[0].appendChild(this.placeholder[0]); 18461 } else { 18462 i.item[0].parentNode.insertBefore( 18463 this.placeholder[0], 18464 this.direction === "down" ? i.item[0] : i.item[0].nextSibling 18465 ); 18466 } 18467 18468 //Various things done here to improve the performance: 18469 // 1. we create a setTimeout, that calls refreshPositions 18470 // 2. on the instance, we have a counter variable, that get's higher after every append 18471 // 3. on the local scope, we copy the counter variable, and check in the timeout, 18472 // if it's still the same 18473 // 4. this lets only the last addition to the timeout stack through 18474 this.counter = this.counter ? ++this.counter : 1; 18475 var counter = this.counter; 18476 18477 this._delay(function () { 18478 if (counter === this.counter) { 18479 //Precompute after each DOM insertion, NOT on mousemove 18480 this.refreshPositions(!hardRefresh); 18481 } 18482 }); 18483 }, 18484 18485 _clear: function (event, noPropagation) { 18486 this.reverting = false; 18487 18488 // We delay all events that have to be triggered to after the point where the placeholder 18489 // has been removed and everything else normalized again 18490 var i, 18491 delayedTriggers = []; 18492 18493 // We first have to update the dom position of the actual currentItem 18494 // Note: don't do it if the current item is already removed (by a user), or it gets 18495 // reappended (see #4088) 18496 if (!this._noFinalSort && this.currentItem.parent().length) { 18497 this.placeholder.before(this.currentItem); 18498 } 18499 this._noFinalSort = null; 18500 18501 if (this.helper[0] === this.currentItem[0]) { 18502 for (i in this._storedCSS) { 18503 if ( 18504 this._storedCSS[i] === "auto" || 18505 this._storedCSS[i] === "static" 18506 ) { 18507 this._storedCSS[i] = ""; 18508 } 18509 } 18510 this.currentItem.css(this._storedCSS); 18511 this._removeClass(this.currentItem, "ui-sortable-helper"); 18512 } else { 18513 this.currentItem.show(); 18514 } 18515 18516 if (this.fromOutside && !noPropagation) { 18517 delayedTriggers.push(function (event) { 18518 this._trigger("receive", event, this._uiHash(this.fromOutside)); 18519 }); 18520 } 18521 if ( 18522 (this.fromOutside || 18523 this.domPosition.prev !== 18524 this.currentItem.prev().not(".ui-sortable-helper")[0] || 18525 this.domPosition.parent !== this.currentItem.parent()[0]) && 18526 !noPropagation 18527 ) { 18528 // Trigger update callback if the DOM position has changed 18529 delayedTriggers.push(function (event) { 18530 this._trigger("update", event, this._uiHash()); 18531 }); 18532 } 18533 18534 // Check if the items Container has Changed and trigger appropriate 18535 // events. 18536 if (this !== this.currentContainer) { 18537 if (!noPropagation) { 18538 delayedTriggers.push(function (event) { 18539 this._trigger("remove", event, this._uiHash()); 18540 }); 18541 delayedTriggers.push( 18542 function (c) { 18543 return function (event) { 18544 c._trigger("receive", event, this._uiHash(this)); 18545 }; 18546 }.call(this, this.currentContainer) 18547 ); 18548 delayedTriggers.push( 18549 function (c) { 18550 return function (event) { 18551 c._trigger("update", event, this._uiHash(this)); 18552 }; 18553 }.call(this, this.currentContainer) 18554 ); 18555 } 18556 } 18557 18558 //Post events to containers 18559 function delayEvent(type, instance, container) { 18560 return function (event) { 18561 container._trigger(type, event, instance._uiHash(instance)); 18562 }; 18563 } 18564 for (i = this.containers.length - 1; i >= 0; i--) { 18565 if (!noPropagation) { 18566 delayedTriggers.push( 18567 delayEvent("deactivate", this, this.containers[i]) 18568 ); 18569 } 18570 if (this.containers[i].containerCache.over) { 18571 delayedTriggers.push(delayEvent("out", this, this.containers[i])
vendor: 10,514 bytes, lines 18571-18933
18571); 18572 this.containers[i].containerCache.over = 0; 18573 } 18574 } 18575 18576 //Do what was originally in plugins 18577 if (this.storedCursor) { 18578 this.document.find("body").css("cursor", this.storedCursor); 18579 this.storedStylesheet.remove(); 18580 } 18581 if (this._storedOpacity) { 18582 this.helper.css("opacity", this._storedOpacity); 18583 } 18584 if (this._storedZIndex) { 18585 this.helper.css( 18586 "zIndex", 18587 this._storedZIndex === "auto" ? "" : this._storedZIndex 18588 ); 18589 } 18590 18591 this.dragging = false; 18592 18593 if (!noPropagation) { 18594 this._trigger("beforeStop", event, this._uiHash()); 18595 } 18596 18597 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 18598 // it unbinds ALL events from the original node! 18599 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 18600 18601 if (!this.cancelHelperRemoval) { 18602 if (this.helper[0] !== this.currentItem[0]) { 18603 this.helper.remove(); 18604 } 18605 this.helper = null; 18606 } 18607 18608 if (!noPropagation) { 18609 for (i = 0; i < delayedTriggers.length; i++) { 18610 // Trigger all delayed events 18611 delayedTriggers[i].call(this, event); 18612 } 18613 this._trigger("stop", event, this._uiHash()); 18614 } 18615 18616 this.fromOutside = false; 18617 return !this.cancelHelperRemoval; 18618 }, 18619 18620 _trigger: function () { 18621 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 18622 this.cancel(); 18623 } 18624 }, 18625 18626 _uiHash: function (_inst) { 18627 var inst = _inst || this; 18628 return { 18629 helper: inst.helper, 18630 placeholder: inst.placeholder || $([]), 18631 position: inst.position, 18632 originalPosition: inst.originalPosition, 18633 offset: inst.positionAbs, 18634 item: inst.currentItem, 18635 sender: _inst ? _inst.element : null, 18636 }; 18637 }, 18638 }); 18639 18640 /*! 18641 * jQuery UI Spinner 1.13.3 18642 * https://jqueryui.com 18643 * 18644 * Copyright OpenJS Foundation and other contributors 18645 * Released under the MIT license. 18646 * https://jquery.org/license 18647 */ 18648 18649 //>>label: Spinner 18650 //>>group: Widgets 18651 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 18652 //>>docs: https://api.jqueryui.com/spinner/ 18653 //>>demos: https://jqueryui.com/spinner/ 18654 //>>css.structure: ../../themes/base/core.css 18655 //>>css.structure: ../../themes/base/spinner.css 18656 //>>css.theme: ../../themes/base/theme.css 18657 18658 function spinnerModifier(fn) { 18659 return function () { 18660 var previous = this.element.val(); 18661 fn.apply(this, arguments); 18662 this._refresh(); 18663 if (previous !== this.element.val()) { 18664 this._trigger("change"); 18665 } 18666 }; 18667 } 18668 18669 $.widget("ui.spinner", { 18670 version: "1.13.3", 18671 defaultElement: "<input>", 18672 widgetEventPrefix: "spin", 18673 options: { 18674 classes: { 18675 "ui-spinner": "ui-corner-all", 18676 "ui-spinner-down": "ui-corner-br", 18677 "ui-spinner-up": "ui-corner-tr", 18678 }, 18679 culture: null, 18680 icons: { 18681 down: "ui-icon-triangle-1-s", 18682 up: "ui-icon-triangle-1-n", 18683 }, 18684 incremental: true, 18685 max: null, 18686 min: null, 18687 numberFormat: null, 18688 page: 10, 18689 step: 1, 18690 18691 change: null, 18692 spin: null, 18693 start: null, 18694 stop: null, 18695 }, 18696 18697 _create: function () { 18698 // handle string values that need to be parsed 18699 this._setOption("max", this.options.max); 18700 this._setOption("min", this.options.min); 18701 this._setOption("step", this.options.step); 18702 18703 // Only format if there is a value, prevents the field from being marked 18704 // as invalid in Firefox, see #9573. 18705 if (this.value() !== "") { 18706 // Format the value, but don't constrain. 18707 this._value(this.element.val(), true); 18708 } 18709 18710 this._draw(); 18711 this._on(this._events); 18712 this._refresh(); 18713 18714 // Turning off autocomplete prevents the browser from remembering the 18715 // value when navigating through history, so we re-enable autocomplete 18716 // if the page is unloaded before the widget is destroyed. #7790 18717 this._on(this.window, { 18718 beforeunload: function () { 18719 this.element.removeAttr("autocomplete"); 18720 }, 18721 }); 18722 }, 18723 18724 _getCreateOptions: function () { 18725 var options = this._super(); 18726 var element = this.element; 18727 18728 $.each(["min", "max", "step"], function (i, option) { 18729 var value = element.attr(option); 18730 if (value != null && value.length) { 18731 options[option] = value; 18732 } 18733 }); 18734 18735 return options; 18736 }, 18737 18738 _events: { 18739 keydown: function (event) { 18740 if (this._start(event) && this._keydown(event)) { 18741 event.preventDefault(); 18742 } 18743 }, 18744 keyup: "_stop", 18745 focus: function () { 18746 this.previous = this.element.val(); 18747 }, 18748 blur: function (event) { 18749 if (this.cancelBlur) { 18750 delete this.cancelBlur; 18751 return; 18752 } 18753 18754 this._stop(); 18755 this._refresh(); 18756 if (this.previous !== this.element.val()) { 18757 this._trigger("change", event); 18758 } 18759 }, 18760 mousewheel: function (event, delta) { 18761 var activeElement = $.ui.safeActiveElement(this.document[0]); 18762 var isActive = this.element[0] === activeElement; 18763 18764 if (!isActive || !delta) { 18765 return; 18766 } 18767 18768 if (!this.spinning && !this._start(event)) { 18769 return false; 18770 } 18771 18772 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 18773 clearTimeout(this.mousewheelTimer); 18774 this.mousewheelTimer = this._delay(function () { 18775 if (this.spinning) { 18776 this._stop(event); 18777 } 18778 }, 100); 18779 event.preventDefault(); 18780 }, 18781 "mousedown .ui-spinner-button": function (event) { 18782 var previous; 18783 18784 // We never want the buttons to have focus; whenever the user is 18785 // interacting with the spinner, the focus should be on the input. 18786 // If the input is focused then this.previous is properly set from 18787 // when the input first received focus. If the input is not focused 18788 // then we need to set this.previous based on the value before spinning. 18789 previous = 18790 this.element[0] === $.ui.safeActiveElement(this.document[0]) 18791 ? this.previous 18792 : this.element.val(); 18793 function checkFocus() { 18794 var isActive = 18795 this.element[0] === $.ui.safeActiveElement(this.document[0]); 18796 if (!isActive) { 18797 this.element.trigger("focus"); 18798 this.previous = previous; 18799 18800 // support: IE 18801 // IE sets focus asynchronously, so we need to check if focus 18802 // moved off of the input because the user clicked on the button. 18803 this._delay(function () { 18804 this.previous = previous; 18805 }); 18806 } 18807 } 18808 18809 // Ensure focus is on (or stays on) the text field 18810 event.preventDefault(); 18811 checkFocus.call(this); 18812 18813 // Support: IE 18814 // IE doesn't prevent moving focus even with event.preventDefault() 18815 // so we set a flag to know when we should ignore the blur event 18816 // and check (again) if focus moved off of the input. 18817 this.cancelBlur = true; 18818 this._delay(function () { 18819 delete this.cancelBlur; 18820 checkFocus.call(this); 18821 }); 18822 18823 if (this._start(event) === false) { 18824 return; 18825 } 18826 18827 this._repeat( 18828 null, 18829 $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, 18830 event 18831 ); 18832 }, 18833 "mouseup .ui-spinner-button": "_stop", 18834 "mouseenter .ui-spinner-button": function (event) { 18835 // button will add ui-state-active if mouse was down while mouseleave and kept down 18836 if (!$(event.currentTarget).hasClass("ui-state-active")) { 18837 return; 18838 } 18839 18840 if (this._start(event) === false) { 18841 return false; 18842 } 18843 this._repeat( 18844 null, 18845 $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, 18846 event 18847 ); 18848 }, 18849 18850 // TODO: do we really want to consider this a stop? 18851 // shouldn't we just stop the repeater and wait until mouseup before 18852 // we trigger the stop event? 18853 "mouseleave .ui-spinner-button": "_stop", 18854 }, 18855 18856 // Support mobile enhanced option and make backcompat more sane 18857 _enhance: function () { 18858 this.uiSpinner = this.element 18859 .attr("autocomplete", "off") 18860 .wrap("<span>") 18861 .parent() 18862 18863 // Add buttons 18864 .append("<a></a><a></a>"); 18865 }, 18866 18867 _draw: function () { 18868 this._enhance(); 18869 18870 this._addClass( 18871 this.uiSpinner, 18872 "ui-spinner", 18873 "ui-widget ui-widget-content" 18874 ); 18875 this._addClass("ui-spinner-input"); 18876 18877 this.element.attr("role", "spinbutton"); 18878 18879 // Button bindings 18880 this.buttons = this.uiSpinner 18881 .children("a") 18882 .attr("tabIndex", -1) 18883 .attr("aria-hidden", true) 18884 .button({ 18885 classes: { 18886 "ui-button": "", 18887 }, 18888 }); 18889 18890 // TODO: Right now button does not support classes this is already updated in button PR 18891 this._removeClass(this.buttons, "ui-corner-all"); 18892 18893 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 18894 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 18895 this.buttons.first().button({ 18896 icon: this.options.icons.up, 18897 showLabel: false, 18898 }); 18899 this.buttons.last().button({ 18900 icon: this.options.icons.down, 18901 showLabel: false, 18902 }); 18903 18904 // IE 6 doesn't understand height: 50% for the buttons 18905 // unless the wrapper has an explicit height 18906 if ( 18907 this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 18908 this.uiSpinner.height() > 0 18909 ) { 18910 this.uiSpinner.height(this.uiSpinner.height()); 18911 } 18912 }, 18913 18914 _keydown: function (event) { 18915 var options = this.options, 18916 keyCode = $.ui.keyCode; 18917 18918 switch (event.keyCode) { 18919 case keyCode.UP: 18920 this._repeat(null, 1, event); 18921 return true; 18922 case keyCode.DOWN: 18923 this._repeat(null, -1, event); 18924 return true; 18925 case keyCode.PAGE_UP: 18926 this._repeat(null, options.page, event); 18927 return true; 18928 case keyCode.PAGE_DOWN: 18929 this._repeat(null, -options.page, event); 18930 return true; 18931 } 18932 18933 return false;
vendor: 4,918 bytes, lines 18934-19121
18934 }, 18935 18936 _start: function (event) { 18937 if (!this.spinning && this._trigger("start", event) === false) { 18938 return false; 18939 } 18940 18941 if (!this.counter) { 18942 this.counter = 1; 18943 } 18944 this.spinning = true; 18945 return true; 18946 }, 18947 18948 _repeat: function (i, steps, event) { 18949 i = i || 500; 18950 18951 clearTimeout(this.timer); 18952 this.timer = this._delay(function () { 18953 this._repeat(40, steps, event); 18954 }, i); 18955 18956 this._spin(steps * this.options.step, event); 18957 }, 18958 18959 _spin: function (step, event) { 18960 var value = this.value() || 0; 18961 18962 if (!this.counter) { 18963 this.counter = 1; 18964 } 18965 18966 value = this._adjustValue(value + step * this._increment(this.counter)); 18967 18968 if ( 18969 !this.spinning || 18970 this._trigger("spin", event, { value: value }) !== false 18971 ) { 18972 this._value(value); 18973 this.counter++; 18974 } 18975 }, 18976 18977 _increment: function (i) { 18978 var incremental = this.options.incremental; 18979 18980 if (incremental) { 18981 return typeof incremental === "function" 18982 ? incremental(i) 18983 : Math.floor( 18984 (i * i * i) / 50000 - (i * i) / 500 + (17 * i) / 200 + 1 18985 ); 18986 } 18987 18988 return 1; 18989 }, 18990 18991 _precision: function () { 18992 var precision = this._precisionOf(this.options.step); 18993 if (this.options.min !== null) { 18994 precision = Math.max(precision, this._precisionOf(this.options.min)); 18995 } 18996 return precision; 18997 }, 18998 18999 _precisionOf: function (num) { 19000 var str = num.toString(), 19001 decimal = str.indexOf("."); 19002 return decimal === -1 ? 0 : str.length - decimal - 1; 19003 }, 19004 19005 _adjustValue: function (value) { 19006 var base, 19007 aboveMin, 19008 options = this.options; 19009 19010 // Make sure we're at a valid step 19011 // - find out where we are relative to the base (min or 0) 19012 base = options.min !== null ? options.min : 0; 19013 aboveMin = value - base; 19014 19015 // - round to the nearest step 19016 aboveMin = Math.round(aboveMin / options.step) * options.step; 19017 19018 // - rounding is based on 0, so adjust back to our base 19019 value = base + aboveMin; 19020 19021 // Fix precision from bad JS floating point math 19022 value = parseFloat(value.toFixed(this._precision())); 19023 19024 // Clamp the value 19025 if (options.max !== null && value > options.max) { 19026 return options.max; 19027 } 19028 if (options.min !== null && value < options.min) { 19029 return options.min; 19030 } 19031 19032 return value; 19033 }, 19034 19035 _stop: function (event) { 19036 if (!this.spinning) { 19037 return; 19038 } 19039 19040 clearTimeout(this.timer); 19041 clearTimeout(this.mousewheelTimer); 19042 this.counter = 0; 19043 this.spinning = false; 19044 this._trigger("stop", event); 19045 }, 19046 19047 _setOption: function (key, value) { 19048 var prevValue, first, last; 19049 19050 if (key === "culture" || key === "numberFormat") { 19051 prevValue = this._parse(this.element.val()); 19052 this.options[key] = value; 19053 this.element.val(this._format(prevValue)); 19054 return; 19055 } 19056 19057 if (key === "max" || key === "min" || key === "step") { 19058 if (typeof value === "string") { 19059 value = this._parse(value); 19060 } 19061 } 19062 if (key === "icons") { 19063 first = this.buttons.first().find(".ui-icon"); 19064 this._removeClass(first, null, this.options.icons.up); 19065 this._addClass(first, null, value.up); 19066 last = this.buttons.last().find(".ui-icon"); 19067 this._removeClass(last, null, this.options.icons.down); 19068 this._addClass(last, null, value.down); 19069 } 19070 19071 this._super(key, value); 19072 }, 19073 19074 _setOptionDisabled: function (value) { 19075 this._super(value); 19076 19077 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 19078 this.element.prop("disabled", !!value); 19079 this.buttons.button(value ? "disable" : "enable"); 19080 }, 19081 19082 _setOptions: spinnerModifier(function (options) { 19083 this._super(options); 19084 }), 19085 19086 _parse: function (val) { 19087 if (typeof val === "string" && val !== "") { 19088 val = 19089 window.Globalize && this.options.numberFormat 19090 ? Globalize.parseFloat(val, 10, this.options.culture) 19091 : +val; 19092 } 19093 return val === "" || isNaN(val) ? null : val; 19094 }, 19095 19096 _format: function (value) { 19097 if (value === "") { 19098 return ""; 19099 } 19100 return window.Globalize && this.options.numberFormat 19101 ? Globalize.format( 19102 value, 19103 this.options.numberFormat, 19104 this.options.culture 19105 ) 19106 : value; 19107 }, 19108 19109 _refresh: function () { 19110 this.element.attr({ 19111 "aria-valuemin": this.options.min, 19112 "aria-valuemax": this.options.max, 19113 19114 // TODO: what should we do with values that can't be parsed? 19115 "aria-valuenow": this._parse(this.element.val()), 19116 }); 19117 }, 19118 19119 isValid: function () { 19120 var value = this.value(); 19121
vendor: 21,305 bytes, lines 19122-19867
19122 // Null is invalid 19123 if (value === null) { 19124 return false; 19125 } 19126 19127 // If value gets adjusted, it's invalid 19128 return value === this._adjustValue(value); 19129 }, 19130 19131 // Update the value without triggering change 19132 _value: function (value, allowAny) { 19133 var parsed; 19134 if (value !== "") { 19135 parsed = this._parse(value); 19136 if (parsed !== null) { 19137 if (!allowAny) { 19138 parsed = this._adjustValue(parsed); 19139 } 19140 value = this._format(parsed); 19141 } 19142 } 19143 this.element.val(value); 19144 this._refresh(); 19145 }, 19146 19147 _destroy: function () { 19148 this.element 19149 .prop("disabled", false) 19150 .removeAttr( 19151 "autocomplete role aria-valuemin aria-valuemax aria-valuenow" 19152 ); 19153 19154 this.uiSpinner.replaceWith(this.element); 19155 }, 19156 19157 stepUp: spinnerModifier(function (steps) { 19158 this._stepUp(steps); 19159 }), 19160 _stepUp: function (steps) { 19161 if (this._start()) { 19162 this._spin((steps || 1) * this.options.step); 19163 this._stop(); 19164 } 19165 }, 19166 19167 stepDown: spinnerModifier(function (steps) { 19168 this._stepDown(steps); 19169 }), 19170 _stepDown: function (steps) { 19171 if (this._start()) { 19172 this._spin((steps || 1) * -this.options.step); 19173 this._stop(); 19174 } 19175 }, 19176 19177 pageUp: spinnerModifier(function (pages) { 19178 this._stepUp((pages || 1) * this.options.page); 19179 }), 19180 19181 pageDown: spinnerModifier(function (pages) { 19182 this._stepDown((pages || 1) * this.options.page); 19183 }), 19184 19185 value: function (newVal) { 19186 if (!arguments.length) { 19187 return this._parse(this.element.val()); 19188 } 19189 spinnerModifier(this._value).call(this, newVal); 19190 }, 19191 19192 widget: function () { 19193 return this.uiSpinner; 19194 }, 19195 }); 19196 19197 // DEPRECATED 19198 // TODO: switch return back to widget declaration at top of file when this is removed 19199 if ($.uiBackCompat !== false) { 19200 // Backcompat for spinner html extension points 19201 $.widget("ui.spinner", $.ui.spinner, { 19202 _enhance: function () { 19203 this.uiSpinner = this.element 19204 .attr("autocomplete", "off") 19205 .wrap(this._uiSpinnerHtml()) 19206 .parent() 19207 19208 // Add buttons 19209 .append(this._buttonHtml()); 19210 }, 19211 _uiSpinnerHtml: function () { 19212 return "<span>"; 19213 }, 19214 19215 _buttonHtml: function () { 19216 return "<a></a><a></a>"; 19217 }, 19218 }); 19219 } 19220 19221 var widgetsSpinner = $.ui.spinner; 19222 19223 /*! 19224 * jQuery UI Tabs 1.13.3 19225 * https://jqueryui.com 19226 * 19227 * Copyright OpenJS Foundation and other contributors 19228 * Released under the MIT license. 19229 * https://jquery.org/license 19230 */ 19231 19232 //>>label: Tabs 19233 //>>group: Widgets 19234 //>>description: Transforms a set of container elements into a tab structure. 19235 //>>docs: https://api.jqueryui.com/tabs/ 19236 //>>demos: https://jqueryui.com/tabs/ 19237 //>>css.structure: ../../themes/base/core.css 19238 //>>css.structure: ../../themes/base/tabs.css 19239 //>>css.theme: ../../themes/base/theme.css 19240 19241 $.widget("ui.tabs", { 19242 version: "1.13.3", 19243 delay: 300, 19244 options: { 19245 active: null, 19246 classes: { 19247 "ui-tabs": "ui-corner-all", 19248 "ui-tabs-nav": "ui-corner-all", 19249 "ui-tabs-panel": "ui-corner-bottom", 19250 "ui-tabs-tab": "ui-corner-top", 19251 }, 19252 collapsible: false, 19253 event: "click", 19254 heightStyle: "content", 19255 hide: null, 19256 show: null, 19257 19258 // Callbacks 19259 activate: null, 19260 beforeActivate: null, 19261 beforeLoad: null, 19262 load: null, 19263 }, 19264 19265 _isLocal: (function () { 19266 var rhash = /#.*$/; 19267 19268 return function (anchor) { 19269 var anchorUrl, locationUrl; 19270 19271 anchorUrl = anchor.href.replace(rhash, ""); 19272 locationUrl = location.href.replace(rhash, ""); 19273 19274 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 19275 try { 19276 anchorUrl = decodeURIComponent(anchorUrl); 19277 } catch (error) {} 19278 try { 19279 locationUrl = decodeURIComponent(locationUrl); 19280 } catch (error) {} 19281 19282 return anchor.hash.length > 1 && anchorUrl === locationUrl; 19283 }; 19284 })(), 19285 19286 _create: function () { 19287 var that = this, 19288 options = this.options; 19289 19290 this.running = false; 19291 19292 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 19293 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 19294 19295 this._processTabs(); 19296 options.active = this._initialActive(); 19297 19298 // Take disabling tabs via class attribute from HTML 19299 // into account and update option properly. 19300 if (Array.isArray(options.disabled)) { 19301 options.disabled = $.uniqueSort( 19302 options.disabled.concat( 19303 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 19304 return that.tabs.index(li); 19305 }) 19306 ) 19307 ).sort(); 19308 } 19309 19310 // Check for length avoids error when initializing empty list 19311 if (this.options.active !== false && this.anchors.length) { 19312 this.active = this._findActive(options.active); 19313 } else { 19314 this.active = $(); 19315 } 19316 19317 this._refresh(); 19318 19319 if (this.active.length) { 19320 this.load(options.active); 19321 } 19322 }, 19323 19324 _initialActive: function () { 19325 var active = this.options.active, 19326 collapsible = this.options.collapsible, 19327 locationHash = location.hash.substring(1); 19328 19329 if (active === null) { 19330 // check the fragment identifier in the URL 19331 if (locationHash) { 19332 this.tabs.each(function (i, tab) { 19333 if ($(tab).attr("aria-controls") === locationHash) { 19334 active = i; 19335 return false; 19336 } 19337 }); 19338 } 19339 19340 // Check for a tab marked active via a class 19341 if (active === null) { 19342 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 19343 } 19344 19345 // No active tab, set to false 19346 if (active === null || active === -1) { 19347 active = this.tabs.length ? 0 : false; 19348 } 19349 } 19350 19351 // Handle numbers: negative, out of range 19352 if (active !== false) { 19353 active = this.tabs.index(this.tabs.eq(active)); 19354 if (active === -1) { 19355 active = collapsible ? false : 0; 19356 } 19357 } 19358 19359 // Don't allow collapsible: false and active: false 19360 if (!collapsible && active === false && this.anchors.length) { 19361 active = 0; 19362 } 19363 19364 return active; 19365 }, 19366 19367 _getCreateEventData: function () { 19368 return { 19369 tab: this.active, 19370 panel: !this.active.length ? $() : this._getPanelForTab(this.active), 19371 }; 19372 }, 19373 19374 _tabKeydown: function (event) { 19375 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest( 19376 "li" 19377 ), 19378 selectedIndex = this.tabs.index(focusedTab), 19379 goingForward = true; 19380 19381 if (this._handlePageNav(event)) { 19382 return; 19383 } 19384 19385 switch (event.keyCode) { 19386 case $.ui.keyCode.RIGHT: 19387 case $.ui.keyCode.DOWN: 19388 selectedIndex++; 19389 break; 19390 case $.ui.keyCode.UP: 19391 case $.ui.keyCode.LEFT: 19392 goingForward = false; 19393 selectedIndex--; 19394 break; 19395 case $.ui.keyCode.END: 19396 selectedIndex = this.anchors.length - 1; 19397 break; 19398 case $.ui.keyCode.HOME: 19399 selectedIndex = 0; 19400 break; 19401 case $.ui.keyCode.SPACE: 19402 // Activate only, no collapsing 19403 event.preventDefault(); 19404 clearTimeout(this.activating); 19405 this._activate(selectedIndex); 19406 return; 19407 case $.ui.keyCode.ENTER: 19408 // Toggle (cancel delayed activation, allow collapsing) 19409 event.preventDefault(); 19410 clearTimeout(this.activating); 19411 19412 // Determine if we should collapse or activate 19413 this._activate( 19414 selectedIndex === this.options.active ? false : selectedIndex 19415 ); 19416 return; 19417 default: 19418 return; 19419 } 19420 19421 // Focus the appropriate tab, based on which key was pressed 19422 event.preventDefault(); 19423 clearTimeout(this.activating); 19424 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 19425 19426 // Navigating with control/command key will prevent automatic activation 19427 if (!event.ctrlKey && !event.metaKey) { 19428 // Update aria-selected immediately so that AT think the tab is already selected. 19429 // Otherwise AT may confuse the user by stating that they need to activate the tab, 19430 // but the tab will already be activated by the time the announcement finishes. 19431 focusedTab.attr("aria-selected", "false"); 19432 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 19433 19434 this.activating = this._delay(function () { 19435 this.option("active", selectedIndex); 19436 }, this.delay); 19437 } 19438 }, 19439 19440 _panelKeydown: function (event) { 19441 if (this._handlePageNav(event)) { 19442 return; 19443 } 19444 19445 // Ctrl+up moves focus to the current tab 19446 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 19447 event.preventDefault(); 19448 this.active.trigger("focus"); 19449 } 19450 }, 19451 19452 // Alt+page up/down moves focus to the previous/next tab (and activates) 19453 _handlePageNav: function (event) { 19454 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 19455 this._activate(this._focusNextTab(this.options.active - 1, false)); 19456 return true; 19457 } 19458 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 19459 this._activate(this._focusNextTab(this.options.active + 1, true)); 19460 return true; 19461 } 19462 }, 19463 19464 _findNextTab: function (index, goingForward) { 19465 var lastTabIndex = this.tabs.length - 1; 19466 19467 function constrain() { 19468 if (index > lastTabIndex) { 19469 index = 0; 19470 } 19471 if (index < 0) { 19472 index = lastTabIndex; 19473 } 19474 return index; 19475 } 19476 19477 while ($.inArray(constrain(), this.options.disabled) !== -1) { 19478 index = goingForward ? index + 1 : index - 1; 19479 } 19480 19481 return index; 19482 }, 19483 19484 _focusNextTab: function (index, goingForward) { 19485 index = this._findNextTab(index, goingForward); 19486 this.tabs.eq(index).trigger("focus"); 19487 return index; 19488 }, 19489 19490 _setOption: function (key, value) { 19491 if (key === "active") { 19492 // _activate() will handle invalid values and update this.options 19493 this._activate(value); 19494 return; 19495 } 19496 19497 this._super(key, value); 19498 19499 if (key === "collapsible") { 19500 this._toggleClass("ui-tabs-collapsible", null, value); 19501 19502 // Setting collapsible: false while collapsed; open first panel 19503 if (!value && this.options.active === false) { 19504 this._activate(0); 19505 } 19506 } 19507 19508 if (key === "event") { 19509 this._setupEvents(value); 19510 } 19511 19512 if (key === "heightStyle") { 19513 this._setupHeightStyle(value); 19514 } 19515 }, 19516 19517 _sanitizeSelector: function (hash) { 19518 return hash 19519 ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") 19520 : ""; 19521 }, 19522 19523 refresh: function () { 19524 var options = this.options, 19525 lis = this.tablist.children(":has(a[href])"); 19526 19527 // Get disabled tabs from class attribute from HTML 19528 // this will get converted to a boolean if needed in _refresh() 19529 options.disabled = $.map( 19530 lis.filter(".ui-state-disabled"), 19531 function (tab) { 19532 return lis.index(tab); 19533 } 19534 ); 19535 19536 this._processTabs(); 19537 19538 // Was collapsed or no tabs 19539 if (options.active === false || !this.anchors.length) { 19540 options.active = false; 19541 this.active = $(); 19542 19543 // was active, but active tab is gone 19544 } else if ( 19545 this.active.length && 19546 !$.contains(this.tablist[0], this.active[0]) 19547 ) { 19548 // all remaining tabs are disabled 19549 if (this.tabs.length === options.disabled.length) { 19550 options.active = false; 19551 this.active = $(); 19552 19553 // activate previous tab 19554 } else { 19555 this._activate( 19556 this._findNextTab(Math.max(0, options.active - 1), false) 19557 ); 19558 } 19559 19560 // was active, active tab still exists 19561 } else { 19562 // make sure active index is correct 19563 options.active = this.tabs.index(this.active); 19564 } 19565 19566 this._refresh(); 19567 }, 19568 19569 _refresh: function () { 19570 this._setOptionDisabled(this.options.disabled); 19571 this._setupEvents(this.options.event); 19572 this._setupHeightStyle(this.options.heightStyle); 19573 19574 this.tabs.not(this.active).attr({ 19575 "aria-selected": "false", 19576 "aria-expanded": "false", 19577 tabIndex: -1, 19578 }); 19579 this.panels.not(this._getPanelForTab(this.active)).hide().attr({ 19580 "aria-hidden": "true", 19581 }); 19582 19583 // Make sure one tab is in the tab order 19584 if (!this.active.length) { 19585 this.tabs.eq(0).attr("tabIndex", 0); 19586 } else { 19587 this.active.attr({ 19588 "aria-selected": "true", 19589 "aria-expanded": "true", 19590 tabIndex: 0, 19591 }); 19592 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 19593 this._getPanelForTab(this.active).show().attr({ 19594 "aria-hidden": "false", 19595 }); 19596 } 19597 }, 19598 19599 _processTabs: function () { 19600 var that = this, 19601 prevTabs = this.tabs, 19602 prevAnchors = this.anchors, 19603 prevPanels = this.panels; 19604 19605 this.tablist = this._getList().attr("role", "tablist"); 19606 this._addClass( 19607 this.tablist, 19608 "ui-tabs-nav", 19609 "ui-helper-reset ui-helper-clearfix ui-widget-header" 19610 ); 19611 19612 // Prevent users from focusing disabled tabs via click 19613 this.tablist 19614 .on("mousedown" + this.eventNamespace, "> li", function (event) { 19615 if ($(this).is(".ui-state-disabled")) { 19616 event.preventDefault(); 19617 } 19618 }) 19619 19620 // Support: IE <9 19621 // Preventing the default action in mousedown doesn't prevent IE 19622 // from focusing the element, so if the anchor gets focused, blur. 19623 // We don't have to worry about focusing the previously focused 19624 // element since clicking on a non-focusable element should focus 19625 // the body anyway. 19626 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 19627 if ($(this).closest("li").is(".ui-state-disabled")) { 19628 this.blur(); 19629 } 19630 }); 19631 19632 this.tabs = this.tablist.find("> li:has(a[href])").attr({ 19633 role: "tab", 19634 tabIndex: -1, 19635 }); 19636 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 19637 19638 this.anchors = this.tabs 19639 .map(function () { 19640 return $("a", this)[0]; 19641 }) 19642 .attr({ 19643 tabIndex: -1, 19644 }); 19645 this._addClass(this.anchors, "ui-tabs-anchor"); 19646 19647 this.panels = $(); 19648 19649 this.anchors.each(function (i, anchor) { 19650 var selector, 19651 panel, 19652 panelId, 19653 anchorId = $(anchor).uniqueId().attr("id"), 19654 tab = $(anchor).closest("li"), 19655 originalAriaControls = tab.attr("aria-controls"); 19656 19657 // Inline tab 19658 if (that._isLocal(anchor)) { 19659 selector = anchor.hash; 19660 panelId = selector.substring(1); 19661 panel = that.element.find(that._sanitizeSelector(selector)); 19662 19663 // remote tab 19664 } else { 19665 // If the tab doesn't already have aria-controls, 19666 // generate an id by using a throw-away element 19667 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 19668 selector = "#" + panelId; 19669 panel = that.element.find(selector); 19670 if (!panel.length) { 19671 panel = that._createPanel(panelId); 19672 panel.insertAfter(that.panels[i - 1] || that.tablist); 19673 } 19674 panel.attr("aria-live", "polite"); 19675 } 19676 19677 if (panel.length) { 19678 that.panels = that.panels.add(panel); 19679 } 19680 if (originalAriaControls) { 19681 tab.data("ui-tabs-aria-controls", originalAriaControls); 19682 } 19683 tab.attr({ 19684 "aria-controls": panelId, 19685 "aria-labelledby": anchorId, 19686 }); 19687 panel.attr("aria-labelledby", anchorId); 19688 }); 19689 19690 this.panels.attr("role", "tabpanel"); 19691 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 19692 19693 // Avoid memory leaks (#10056) 19694 if (prevTabs) { 19695 this._off(prevTabs.not(this.tabs)); 19696 this._off(prevAnchors.not(this.anchors)); 19697 this._off(prevPanels.not(this.panels)); 19698 } 19699 }, 19700 19701 // Allow overriding how to find the list for rare usage scenarios (#7715) 19702 _getList: function () { 19703 return this.tablist || this.element.find("ol, ul").eq(0); 19704 }, 19705 19706 _createPanel: function (id) { 19707 return $("<div>").attr("id", id).data("ui-tabs-destroy", true); 19708 }, 19709 19710 _setOptionDisabled: function (disabled) { 19711 var currentItem, li, i; 19712 19713 if (Array.isArray(disabled)) { 19714 if (!disabled.length) { 19715 disabled = false; 19716 } else if (disabled.length === this.anchors.length) { 19717 disabled = true; 19718 } 19719 } 19720 19721 // Disable tabs 19722 for (i = 0; (li = this.tabs[i]); i++) { 19723 currentItem = $(li); 19724 if (disabled === true || $.inArray(i, disabled) !== -1) { 19725 currentItem.attr("aria-disabled", "true"); 19726 this._addClass(currentItem, null, "ui-state-disabled"); 19727 } else { 19728 currentItem.removeAttr("aria-disabled"); 19729 this._removeClass(currentItem, null, "ui-state-disabled"); 19730 } 19731 } 19732 19733 this.options.disabled = disabled; 19734 19735 this._toggleClass( 19736 this.widget(), 19737 this.widgetFullName + "-disabled", 19738 null, 19739 disabled === true 19740 ); 19741 }, 19742 19743 _setupEvents: function (event) { 19744 var events = {}; 19745 if (event) { 19746 $.each(event.split(" "), function (index, eventName) { 19747 events[eventName] = "_eventHandler"; 19748 }); 19749 } 19750 19751 this._off(this.anchors.add(this.tabs).add(this.panels)); 19752 19753 // Always prevent the default action, even when disabled 19754 this._on(true, this.anchors, { 19755 click: function (event) { 19756 event.preventDefault(); 19757 }, 19758 }); 19759 this._on(this.anchors, events); 19760 this._on(this.tabs, { keydown: "_tabKeydown" }); 19761 this._on(this.panels, { keydown: "_panelKeydown" }); 19762 19763 this._focusable(this.tabs); 19764 this._hoverable(this.tabs); 19765 }, 19766 19767 _setupHeightStyle: function (heightStyle) { 19768 var maxHeight, 19769 parent = this.element.parent(); 19770 19771 if (heightStyle === "fill") { 19772 maxHeight = parent.height(); 19773 maxHeight -= this.element.outerHeight() - this.element.height(); 19774 19775 this.element.siblings(":visible").each(function () { 19776 var elem = $(this), 19777 position = elem.css("position"); 19778 19779 if (position === "absolute" || position === "fixed") { 19780 return; 19781 } 19782 maxHeight -= elem.outerHeight(true); 19783 }); 19784 19785 this.element 19786 .children() 19787 .not(this.panels) 19788 .each(function () { 19789 maxHeight -= $(this).outerHeight(true); 19790 }); 19791 19792 this.panels 19793 .each(function () { 19794 $(this).height( 19795 Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()) 19796 ); 19797 }) 19798 .css("overflow", "auto"); 19799 } else if (heightStyle === "auto") { 19800 maxHeight = 0; 19801 this.panels 19802 .each(function () { 19803 maxHeight = Math.max(maxHeight, $(this).height("").height()); 19804 }) 19805 .height(maxHeight); 19806 } 19807 }, 19808 19809 _eventHandler: function (event) { 19810 var options = this.options, 19811 active = this.active, 19812 anchor = $(event.currentTarget), 19813 tab = anchor.closest("li"), 19814 clickedIsActive = tab[0] === active[0], 19815 collapsing = clickedIsActive && options.collapsible, 19816 toShow = collapsing ? $() : this._getPanelForTab(tab), 19817 toHide = !active.length ? $() : this._getPanelForTab(active), 19818 eventData = { 19819 oldTab: active, 19820 oldPanel: toHide, 19821 newTab: collapsing ? $() : tab, 19822 newPanel: toShow, 19823 }; 19824 19825 event.preventDefault(); 19826 19827 if ( 19828 tab.hasClass("ui-state-disabled") || 19829 // tab is already loading 19830 tab.hasClass("ui-tabs-loading") || 19831 // can't switch durning an animation 19832 this.running || 19833 // click on active header, but not collapsible 19834 (clickedIsActive && !options.collapsible) || 19835 // allow canceling activation 19836 this._trigger("beforeActivate", event, eventData) === false 19837 ) { 19838 return; 19839 } 19840 19841 options.active = collapsing ? false : this.tabs.index(tab); 19842 19843 this.active = clickedIsActive ? $() : tab; 19844 if (this.xhr) { 19845 this.xhr.abort(); 19846 } 19847 19848 if (!toHide.length && !toShow.length) { 19849 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 19850 } 19851 19852 if (toShow.length) { 19853 this.load(this.tabs.index(tab), event); 19854 } 19855 this._toggle(event, eventData); 19856 }, 19857 19858 // Handles show/hide for selecting tabs 19859 _toggle: function (event, eventData) { 19860 var that = this, 19861 toShow = eventData.newPanel, 19862 toHide = eventData.oldPanel; 19863 19864 this.running = true; 19865 19866 function complete() { 19867 that.running = false;
vendor: 5,657 bytes, lines 19868-20081
19868 that._trigger("activate", event, eventData); 19869 } 19870 19871 function show() { 19872 that._addClass( 19873 eventData.newTab.closest("li"), 19874 "ui-tabs-active", 19875 "ui-state-active" 19876 ); 19877 19878 if (toShow.length && that.options.show) { 19879 that._show(toShow, that.options.show, complete); 19880 } else { 19881 toShow.show(); 19882 complete(); 19883 } 19884 } 19885 19886 // Start out by hiding, then showing, then completing 19887 if (toHide.length && this.options.hide) { 19888 this._hide(toHide, this.options.hide, function () { 19889 that._removeClass( 19890 eventData.oldTab.closest("li"), 19891 "ui-tabs-active", 19892 "ui-state-active" 19893 ); 19894 show(); 19895 }); 19896 } else { 19897 this._removeClass( 19898 eventData.oldTab.closest("li"), 19899 "ui-tabs-active", 19900 "ui-state-active" 19901 ); 19902 toHide.hide(); 19903 show(); 19904 } 19905 19906 toHide.attr("aria-hidden", "true"); 19907 eventData.oldTab.attr({ 19908 "aria-selected": "false", 19909 "aria-expanded": "false", 19910 }); 19911 19912 // If we're switching tabs, remove the old tab from the tab order. 19913 // If we're opening from collapsed state, remove the previous tab from the tab order. 19914 // If we're collapsing, then keep the collapsing tab in the tab order. 19915 if (toShow.length && toHide.length) { 19916 eventData.oldTab.attr("tabIndex", -1); 19917 } else if (toShow.length) { 19918 this.tabs 19919 .filter(function () { 19920 return $(this).attr("tabIndex") === 0; 19921 }) 19922 .attr("tabIndex", -1); 19923 } 19924 19925 toShow.attr("aria-hidden", "false"); 19926 eventData.newTab.attr({ 19927 "aria-selected": "true", 19928 "aria-expanded": "true", 19929 tabIndex: 0, 19930 }); 19931 }, 19932 19933 _activate: function (index) { 19934 var anchor, 19935 active = this._findActive(index); 19936 19937 // Trying to activate the already active panel 19938 if (active[0] === this.active[0]) { 19939 return; 19940 } 19941 19942 // Trying to collapse, simulate a click on the current active header 19943 if (!active.length) { 19944 active = this.active; 19945 } 19946 19947 anchor = active.find(".ui-tabs-anchor")[0]; 19948 this._eventHandler({ 19949 target: anchor, 19950 currentTarget: anchor, 19951 preventDefault: $.noop, 19952 }); 19953 }, 19954 19955 _findActive: function (index) { 19956 return index === false ? $() : this.tabs.eq(index); 19957 }, 19958 19959 _getIndex: function (index) { 19960 // meta-function to give users option to provide a href string instead of a numerical index. 19961 if (typeof index === "string") { 19962 index = this.anchors.index( 19963 this.anchors.filter("[href$='" + $.escapeSelector(index) + "']") 19964 ); 19965 } 19966 19967 return index; 19968 }, 19969 19970 _destroy: function () { 19971 if (this.xhr) { 19972 this.xhr.abort(); 19973 } 19974 19975 this.tablist.removeAttr("role").off(this.eventNamespace); 19976 19977 this.anchors.removeAttr("role tabIndex").removeUniqueId(); 19978 19979 this.tabs.add(this.panels).each(function () { 19980 if ($.data(this, "ui-tabs-destroy")) { 19981 $(this).remove(); 19982 } else { 19983 $(this).removeAttr( 19984 "role tabIndex " + 19985 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" 19986 ); 19987 } 19988 }); 19989 19990 this.tabs.each(function () { 19991 var li = $(this), 19992 prev = li.data("ui-tabs-aria-controls"); 19993 if (prev) { 19994 li.attr("aria-controls", prev).removeData("ui-tabs-aria-controls"); 19995 } else { 19996 li.removeAttr("aria-controls"); 19997 } 19998 }); 19999 20000 this.panels.show(); 20001 20002 if (this.options.heightStyle !== "content") { 20003 this.panels.css("height", ""); 20004 } 20005 }, 20006 20007 enable: function (index) { 20008 var disabled = this.options.disabled; 20009 if (disabled === false) { 20010 return; 20011 } 20012 20013 if (index === undefined) { 20014 disabled = false; 20015 } else { 20016 index = this._getIndex(index); 20017 if (Array.isArray(disabled)) { 20018 disabled = $.map(disabled, function (num) { 20019 return num !== index ? num : null; 20020 }); 20021 } else { 20022 disabled = $.map(this.tabs, function (li, num) { 20023 return num !== index ? num : null; 20024 }); 20025 } 20026 } 20027 this._setOptionDisabled(disabled); 20028 }, 20029 20030 disable: function (index) { 20031 var disabled = this.options.disabled; 20032 if (disabled === true) { 20033 return; 20034 } 20035 20036 if (index === undefined) { 20037 disabled = true; 20038 } else { 20039 index = this._getIndex(index); 20040 if ($.inArray(index, disabled) !== -1) { 20041 return; 20042 } 20043 if (Array.isArray(disabled)) { 20044 disabled = $.merge([index], disabled).sort(); 20045 } else { 20046 disabled = [index]; 20047 } 20048 } 20049 this._setOptionDisabled(disabled); 20050 }, 20051 20052 load: function (index, event) { 20053 index = this._getIndex(index); 20054 var that = this, 20055 tab = this.tabs.eq(index), 20056 anchor = tab.find(".ui-tabs-anchor"), 20057 panel = this._getPanelForTab(tab), 20058 eventData = { 20059 tab: tab, 20060 panel: panel, 20061 }, 20062 complete = function (jqXHR, status) { 20063 if (status === "abort") { 20064 that.panels.stop(false, true); 20065 } 20066 20067 that._removeClass(tab, "ui-tabs-loading"); 20068 panel.removeAttr("aria-busy"); 20069 20070 if (jqXHR === that.xhr) { 20071 delete that.xhr; 20072 } 20073 }; 20074 20075 // Not remote 20076 if (this._isLocal(anchor[0])) { 20077 return; 20078 } 20079 20080 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 20081
vendor: 10,312 bytes, lines 20082-20420
20082 // Support: jQuery <1.8 20083 // jQuery <1.8 returns false if the request is canceled in beforeSend, 20084 // but as of 1.8, $.ajax() always returns a jqXHR object. 20085 if (this.xhr && this.xhr.statusText !== "canceled") { 20086 this._addClass(tab, "ui-tabs-loading"); 20087 panel.attr("aria-busy", "true"); 20088 20089 this.xhr 20090 .done(function (response, status, jqXHR) { 20091 // support: jQuery <1.8 20092 // https://bugs.jquery.com/ticket/11778 20093 setTimeout(function () { 20094 panel.html(response); 20095 that._trigger("load", event, eventData); 20096 20097 complete(jqXHR, status); 20098 }, 1); 20099 }) 20100 .fail(function (jqXHR, status) { 20101 // support: jQuery <1.8 20102 // https://bugs.jquery.com/ticket/11778 20103 setTimeout(function () { 20104 complete(jqXHR, status); 20105 }, 1); 20106 }); 20107 } 20108 }, 20109 20110 _ajaxSettings: function (anchor, event, eventData) { 20111 var that = this; 20112 return { 20113 // Support: IE <11 only 20114 // Strip any hash that exists to prevent errors with the Ajax request 20115 url: anchor.attr("href").replace(/#.*$/, ""), 20116 beforeSend: function (jqXHR, settings) { 20117 return that._trigger( 20118 "beforeLoad", 20119 event, 20120 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData) 20121 ); 20122 }, 20123 }; 20124 }, 20125 20126 _getPanelForTab: function (tab) { 20127 var id = $(tab).attr("aria-controls"); 20128 return this.element.find(this._sanitizeSelector("#" + id)); 20129 }, 20130 }); 20131 20132 // DEPRECATED 20133 // TODO: Switch return back to widget declaration at top of file when this is removed 20134 if ($.uiBackCompat !== false) { 20135 // Backcompat for ui-tab class (now ui-tabs-tab) 20136 $.widget("ui.tabs", $.ui.tabs, { 20137 _processTabs: function () { 20138 this._superApply(arguments); 20139 this._addClass(this.tabs, "ui-tab"); 20140 }, 20141 }); 20142 } 20143 20144 var widgetsTabs = $.ui.tabs; 20145 20146 /*! 20147 * jQuery UI Tooltip 1.13.3 20148 * https://jqueryui.com 20149 * 20150 * Copyright OpenJS Foundation and other contributors 20151 * Released under the MIT license. 20152 * https://jquery.org/license 20153 */ 20154 20155 //>>label: Tooltip 20156 //>>group: Widgets 20157 //>>description: Shows additional information for any element on hover or focus. 20158 //>>docs: https://api.jqueryui.com/tooltip/ 20159 //>>demos: https://jqueryui.com/tooltip/ 20160 //>>css.structure: ../../themes/base/core.css 20161 //>>css.structure: ../../themes/base/tooltip.css 20162 //>>css.theme: ../../themes/base/theme.css 20163 20164 $.widget("ui.tooltip", { 20165 version: "1.13.3", 20166 options: { 20167 classes: { 20168 "ui-tooltip": "ui-corner-all ui-widget-shadow", 20169 }, 20170 content: function () { 20171 var title = $(this).attr("title"); 20172 20173 // Escape title, since we're going from an attribute to raw HTML 20174 return $("<a>").text(title).html(); 20175 }, 20176 hide: true, 20177 20178 // Disabled elements have inconsistent behavior across browsers (#8661) 20179 items: "[title]:not([disabled])", 20180 position: { 20181 my: "left top+15", 20182 at: "left bottom", 20183 collision: "flipfit flip", 20184 }, 20185 show: true, 20186 track: false, 20187 20188 // Callbacks 20189 close: null, 20190 open: null, 20191 }, 20192 20193 _addDescribedBy: function (elem, id) { 20194 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 20195 describedby.push(id); 20196 elem 20197 .data("ui-tooltip-id", id) 20198 .attr( 20199 "aria-describedby", 20200 String.prototype.trim.call(describedby.join(" ")) 20201 ); 20202 }, 20203 20204 _removeDescribedBy: function (elem) { 20205 var id = elem.data("ui-tooltip-id"), 20206 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 20207 index = $.inArray(id, describedby); 20208 20209 if (index !== -1) { 20210 describedby.splice(index, 1); 20211 } 20212 20213 elem.removeData("ui-tooltip-id"); 20214 describedby = String.prototype.trim.call(describedby.join(" ")); 20215 if (describedby) { 20216 elem.attr("aria-describedby", describedby); 20217 } else { 20218 elem.removeAttr("aria-describedby"); 20219 } 20220 }, 20221 20222 _create: function () { 20223 this._on({ 20224 mouseover: "open", 20225 focusin: "open", 20226 }); 20227 20228 // IDs of generated tooltips, needed for destroy 20229 this.tooltips = {}; 20230 20231 // IDs of parent tooltips where we removed the title attribute 20232 this.parents = {}; 20233 20234 // Append the aria-live region so tooltips announce correctly 20235 this.liveRegion = $("<div>") 20236 .attr({ 20237 role: "log", 20238 "aria-live": "assertive", 20239 "aria-relevant": "additions", 20240 }) 20241 .appendTo(this.document[0].body); 20242 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 20243 20244 this.disabledTitles = $([]); 20245 }, 20246 20247 _setOption: function (key, value) { 20248 var that = this; 20249 20250 this._super(key, value); 20251 20252 if (key === "content") { 20253 $.each(this.tooltips, function (id, tooltipData) { 20254 that._updateContent(tooltipData.element); 20255 }); 20256 } 20257 }, 20258 20259 _setOptionDisabled: function (value) { 20260 this[value ? "_disable" : "_enable"](); 20261 }, 20262 20263 _disable: function () { 20264 var that = this; 20265 20266 // Close open tooltips 20267 $.each(this.tooltips, function (id, tooltipData) { 20268 var event = $.Event("blur"); 20269 event.target = event.currentTarget = tooltipData.element[0]; 20270 that.close(event, true); 20271 }); 20272 20273 // Remove title attributes to prevent native tooltips 20274 this.disabledTitles = this.disabledTitles.add( 20275 this.element 20276 .find(this.options.items) 20277 .addBack() 20278 .filter(function () { 20279 var element = $(this); 20280 if (element.is("[title]")) { 20281 return element 20282 .data("ui-tooltip-title", element.attr("title")) 20283 .removeAttr("title"); 20284 } 20285 }) 20286 ); 20287 }, 20288 20289 _enable: function () { 20290 // restore title attributes 20291 this.disabledTitles.each(function () { 20292 var element = $(this); 20293 if (element.data("ui-tooltip-title")) { 20294 element.attr("title", element.data("ui-tooltip-title")); 20295 } 20296 }); 20297 this.disabledTitles = $([]); 20298 }, 20299 20300 open: function (event) { 20301 var that = this, 20302 target = $(event ? event.target : this.element) 20303 // we need closest here due to mouseover bubbling, 20304 // but always pointing at the same event target 20305 .closest(this.options.items); 20306 20307 // No element to show a tooltip for or the tooltip is already open 20308 if (!target.length || target.data("ui-tooltip-id")) { 20309 return; 20310 } 20311 20312 if (target.attr("title")) { 20313 target.data("ui-tooltip-title", target.attr("title")); 20314 } 20315 20316 target.data("ui-tooltip-open", true); 20317 20318 // Kill parent tooltips, custom or native, for hover 20319 if (event && event.type === "mouseover") { 20320 target.parents().each(function () { 20321 var parent = $(this), 20322 blurEvent; 20323 if (parent.data("ui-tooltip-open")) { 20324 blurEvent = $.Event("blur"); 20325 blurEvent.target = blurEvent.currentTarget = this; 20326 that.close(blurEvent, true); 20327 } 20328 if (parent.attr("title")) { 20329 parent.uniqueId(); 20330 that.parents[this.id] = { 20331 element: this, 20332 title: parent.attr("title"), 20333 }; 20334 parent.attr("title", ""); 20335 } 20336 }); 20337 } 20338 20339 this._registerCloseHandlers(event, target); 20340 this._updateContent(target, event); 20341 }, 20342 20343 _updateContent: function (target, event) { 20344 var content, 20345 contentOption = this.options.content, 20346 that = this, 20347 eventType = event ? event.type : null; 20348 20349 if ( 20350 typeof contentOption === "string" || 20351 contentOption.nodeType || 20352 contentOption.jquery 20353 ) { 20354 return this._open(event, target, contentOption); 20355 } 20356 20357 content = contentOption.call(target[0], function (response) { 20358 // IE may instantly serve a cached response for ajax requests 20359 // delay this call to _open so the other call to _open runs first 20360 that._delay(function () { 20361 // Ignore async response if tooltip was closed already 20362 if (!target.data("ui-tooltip-open")) { 20363 return; 20364 } 20365 20366 // JQuery creates a special event for focusin when it doesn't 20367 // exist natively. To improve performance, the native event 20368 // object is reused and the type is changed. Therefore, we can't 20369 // rely on the type being correct after the event finished 20370 // bubbling, so we set it back to the previous value. (#8740) 20371 if (event) { 20372 event.type = eventType; 20373 } 20374 this._open(event, target, response); 20375 }); 20376 }); 20377 if (content) { 20378 this._open(event, target, content); 20379 } 20380 }, 20381 20382 _open: function (event, target, content) { 20383 var tooltipData, 20384 tooltip, 20385 delayedShow, 20386 a11yContent, 20387 positionOption = $.extend({}, this.options.position); 20388 20389 if (!content) { 20390 return; 20391 } 20392 20393 // Content can be updated multiple times. If the tooltip already 20394 // exists, then just update the content and bail. 20395 tooltipData = this._find(target); 20396 if (tooltipData) { 20397 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 20398 return; 20399 } 20400 20401 // If we have a title, clear it to prevent the native tooltip 20402 // we have to check first to avoid defining a title if none exists 20403 // (we don't want to cause an element to start matching [title]) 20404 // 20405 // We use removeAttr only for key events, to allow IE to export the correct 20406 // accessible attributes. For mouse events, set to empty string to avoid 20407 // native tooltip showing up (happens only when removing inside mouseover). 20408 if (target.is("[title]")) { 20409 if (event && event.type === "mouseover") { 20410 target.attr("title", ""); 20411 } else { 20412 target.removeAttr("title"); 20413 } 20414 } 20415 20416 tooltipData = this._tooltip(target); 20417 tooltip = tooltipData.tooltip; 20418 this._addDescribedBy(target, tooltip.attr("id")); 20419 tooltip.find(".ui-tooltip-content").html(content); 20420
vendor: 4,926 bytes, lines 20421-20566
20421 // Support: Voiceover on OS X, JAWS on IE <= 9 20422 // JAWS announces deletions even when aria-relevant="additions" 20423 // Voiceover will sometimes re-read the entire log region's contents from the beginning 20424 this.liveRegion.children().hide(); 20425 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 20426 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 20427 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 20428 a11yContent.appendTo(this.liveRegion); 20429 20430 function position(event) { 20431 positionOption.of = event; 20432 if (tooltip.is(":hidden")) { 20433 return; 20434 } 20435 tooltip.position(positionOption); 20436 } 20437 if (this.options.track && event && /^mouse/.test(event.type)) { 20438 this._on(this.document, { 20439 mousemove: position, 20440 }); 20441 20442 // trigger once to override element-relative positioning 20443 position(event); 20444 } else { 20445 tooltip.position( 20446 $.extend( 20447 { 20448 of: target, 20449 }, 20450 this.options.position 20451 ) 20452 ); 20453 } 20454 20455 tooltip.hide(); 20456 20457 this._show(tooltip, this.options.show); 20458 20459 // Handle tracking tooltips that are shown with a delay (#8644). As soon 20460 // as the tooltip is visible, position the tooltip using the most recent 20461 // event. 20462 // Adds the check to add the timers only when both delay and track options are set (#14682) 20463 if (this.options.track && this.options.show && this.options.show.delay) { 20464 delayedShow = this.delayedShow = setInterval(function () { 20465 if (tooltip.is(":visible")) { 20466 position(positionOption.of); 20467 clearInterval(delayedShow); 20468 } 20469 }, 13); 20470 } 20471 20472 this._trigger("open", event, { tooltip: tooltip }); 20473 }, 20474 20475 _registerCloseHandlers: function (event, target) { 20476 var events = { 20477 keyup: function (event) { 20478 if (event.keyCode === $.ui.keyCode.ESCAPE) { 20479 var fakeEvent = $.Event(event); 20480 fakeEvent.currentTarget = target[0]; 20481 this.close(fakeEvent, true); 20482 } 20483 }, 20484 }; 20485 20486 // Only bind remove handler for delegated targets. Non-delegated 20487 // tooltips will handle this in destroy. 20488 if (target[0] !== this.element[0]) { 20489 events.remove = function () { 20490 var targetElement = this._find(target); 20491 if (targetElement) { 20492 this._removeTooltip(targetElement.tooltip); 20493 } 20494 }; 20495 } 20496 20497 if (!event || event.type === "mouseover") { 20498 events.mouseleave = "close"; 20499 } 20500 if (!event || event.type === "focusin") { 20501 events.focusout = "close"; 20502 } 20503 this._on(true, target, events); 20504 }, 20505 20506 close: function (event) { 20507 var tooltip, 20508 that = this, 20509 target = $(event ? event.currentTarget : this.element), 20510 tooltipData = this._find(target); 20511 20512 // The tooltip may already be closed 20513 if (!tooltipData) { 20514 // We set ui-tooltip-open immediately upon open (in open()), but only set the 20515 // additional data once there's actually content to show (in _open()). So even if the 20516 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 20517 // the period between open() and _open(). 20518 target.removeData("ui-tooltip-open"); 20519 return; 20520 } 20521 20522 tooltip = tooltipData.tooltip; 20523 20524 // Disabling closes the tooltip, so we need to track when we're closing 20525 // to avoid an infinite loop in case the tooltip becomes disabled on close 20526 if (tooltipData.closing) { 20527 return; 20528 } 20529 20530 // Clear the interval for delayed tracking tooltips 20531 clearInterval(this.delayedShow); 20532 20533 // Only set title if we had one before (see comment in _open()) 20534 // If the title attribute has changed since open(), don't restore 20535 if (target.data("ui-tooltip-title") && !target.attr("title")) { 20536 target.attr("title", target.data("ui-tooltip-title")); 20537 } 20538 20539 this._removeDescribedBy(target); 20540 20541 tooltipData.hiding = true; 20542 tooltip.stop(true); 20543 this._hide(tooltip, this.options.hide, function () { 20544 that._removeTooltip($(this)); 20545 }); 20546 20547 target.removeData("ui-tooltip-open"); 20548 this._off(target, "mouseleave focusout keyup"); 20549 20550 // Remove 'remove' binding only on delegated targets 20551 if (target[0] !== this.element[0]) { 20552 this._off(target, "remove"); 20553 } 20554 this._off(this.document, "mousemove"); 20555 20556 if (event && event.type === "mouseleave") { 20557 $.each(this.parents, function (id, parent) { 20558 $(parent.element).attr("title", parent.title); 20559 delete that.parents[id]; 20560 }); 20561 } 20562 20563 tooltipData.closing = true; 20564 this._trigger("close", event, { tooltip: tooltip }); 20565 if (!tooltipData.hiding) { 20566 tooltipData.closing = false;
vendor: 2,495 bytes, lines 20567-20656
20567 } 20568 }, 20569 20570 _tooltip: function (element) { 20571 var tooltip = $("<div>").attr("role", "tooltip"), 20572 content = $("<div>").appendTo(tooltip), 20573 id = tooltip.uniqueId().attr("id"); 20574 20575 this._addClass(content, "ui-tooltip-content"); 20576 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 20577 20578 tooltip.appendTo(this._appendTo(element)); 20579 20580 return (this.tooltips[id] = { 20581 element: element, 20582 tooltip: tooltip, 20583 }); 20584 }, 20585 20586 _find: function (target) { 20587 var id = target.data("ui-tooltip-id"); 20588 return id ? this.tooltips[id] : null; 20589 }, 20590 20591 _removeTooltip: function (tooltip) { 20592 // Clear the interval for delayed tracking tooltips 20593 clearInterval(this.delayedShow); 20594 20595 tooltip.remove(); 20596 delete this.tooltips[tooltip.attr("id")]; 20597 }, 20598 20599 _appendTo: function (target) { 20600 var element = target.closest(".ui-front, dialog"); 20601 20602 if (!element.length) { 20603 element = this.document[0].body; 20604 } 20605 20606 return element; 20607 }, 20608 20609 _destroy: function () { 20610 var that = this; 20611 20612 // Close open tooltips 20613 $.each(this.tooltips, function (id, tooltipData) { 20614 // Delegate to close method to handle common cleanup 20615 var event = $.Event("blur"), 20616 element = tooltipData.element; 20617 event.target = event.currentTarget = element[0]; 20618 that.close(event, true); 20619 20620 // Remove immediately; destroying an open tooltip doesn't use the 20621 // hide animation 20622 $("#" + id).remove(); 20623 20624 // Restore the title 20625 if (element.data("ui-tooltip-title")) { 20626 // If the title attribute has changed since open(), don't restore 20627 if (!element.attr("title")) { 20628 element.attr("title", element.data("ui-tooltip-title")); 20629 } 20630 element.removeData("ui-tooltip-title"); 20631 } 20632 }); 20633 this.liveRegion.remove(); 20634 }, 20635 }); 20636 20637 // DEPRECATED 20638 // TODO: Switch return back to widget declaration at top of file when this is removed 20639 if ($.uiBackCompat !== false) { 20640 // Backcompat for tooltipClass option 20641 $.widget("ui.tooltip", $.ui.tooltip, { 20642 options: { 20643 tooltipClass: null, 20644 }, 20645 _tooltip: function () { 20646 var tooltipData = this._superApply(arguments); 20647 if (this.options.tooltipClass) { 20648 tooltipData.tooltip.addClass(this.options.tooltipClass); 20649 } 20650 return tooltipData; 20651 }, 20652 }); 20653 } 20654 20655 var widgetsTooltip = $.ui.tooltip; 20656});
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.