vendor: 4,928 bytes, lines 1-142
1/*! jQuery UI - v1.13.2 - 2023-11-19 2* http://jqueryui.com 3* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.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 4* Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 6(function (factory) { 7 "use strict"; 8 9 if (typeof define === "function" && define.amd) { 10 11 // AMD. Register as an anonymous module. 12 define(["jquery"], factory); 13 } else { 14 15 // Browser globals 16 factory(jQuery); 17 } 18})(function ($) { 19 "use strict"; 20 21 $.ui = $.ui || {}; 22 23 var version = $.ui.version = "1.13.2"; 24 25 26 /*! 27 * jQuery UI Widget 1.13.2 28 * http://jqueryui.com 29 * 30 * Copyright jQuery Foundation and other contributors 31 * Released under the MIT license. 32 * http://jquery.org/license 33 */ 34 35 //>>label: Widget 36 //>>group: Core 37 //>>description: Provides a factory for creating stateful widgets with a common API. 38 //>>docs: http://api.jqueryui.com/jQuery.widget/ 39 //>>demos: http://jqueryui.com/widget/ 40 41 42 var widgetUuid = 0; 43 var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 44 var widgetSlice = Array.prototype.slice; 45 46 $.cleanData = (function (orig) { 47 return function (elems) { 48 var events, elem, i; 49 for (i = 0; (elem = elems[i]) != null; i++) { 50 51 // Only trigger remove when necessary to save time 52 events = $._data(elem, "events"); 53 if (events && events.remove) { 54 $(elem).triggerHandler("remove"); 55 } 56 } 57 orig(elems); 58 }; 59 })($.cleanData); 60 61 $.widget = function (name, base, prototype) { 62 var existingConstructor, constructor, basePrototype; 63 64 // ProxiedPrototype allows the provided prototype to remain unmodified 65 // so that it can be used as a mixin for multiple widgets (#8876) 66 var proxiedPrototype = {}; 67 68 var namespace = name.split(".")[0]; 69 name = name.split(".")[1]; 70 var fullName = namespace + "-" + name; 71 72 if (!prototype) { 73 prototype = base; 74 base = $.Widget; 75 } 76 77 if (Array.isArray(prototype)) { 78 prototype = $.extend.apply(null, [{}].concat(prototype)); 79 } 80 81 // Create selector for plugin 82 $.expr.pseudos[fullName.toLowerCase()] = function (elem) { 83 return !!$.data(elem, fullName); 84 }; 85 86 $[namespace] = $[namespace] || {}; 87 existingConstructor = $[namespace][name]; 88 constructor = $[namespace][name] = function (options, element) { 89 90 // Allow instantiation without "new" keyword 91 if (!this || !this._createWidget) { 92 return new constructor(options, element); 93 } 94 95 // Allow instantiation without initializing for simple inheritance 96 // must use "new" keyword (the code above always passes args) 97 if (arguments.length) { 98 this._createWidget(options, element); 99 } 100 }; 101 102 // Extend with the existing constructor to carry over any static properties 103 $.extend(constructor, existingConstructor, { 104 version: prototype.version, 105 106 // Copy the object used to create the prototype in case we need to 107 // redefine the widget later 108 _proto: $.extend({}, prototype), 109 110 // Track widgets that inherit from this widget in case this widget is 111 // redefined after a widget inherits from it 112 _childConstructors: [] 113 }); 114 115 basePrototype = new base(); 116 117 // We need to make the options hash a property directly on the new instance 118 // otherwise we'll modify the options hash on the prototype that we're 119 // inheriting from 120 basePrototype.options = $.widget.extend({}, basePrototype.options); 121 $.each(prototype, function (prop, value) { 122 if (typeof value !== "function") { 123 proxiedPrototype[prop] = value; 124 return; 125 } 126 proxiedPrototype[prop] = (function () { 127 function _super() { 128 return base.prototype[prop].apply(this, arguments); 129 } 130 131 function _superApply(args) { 132 return base.prototype[prop].apply(this, args); 133 } 134 135 return function () { 136 var __super = this._super; 137 var __superApply = this._superApply; 138 var returnValue; 139 140 this._super = _super; 141 this._superApply = _superApply; 142
vendor: 33,156 bytes, lines 143-1267
143 returnValue = value.apply(this, arguments); 144 145 this._super = __super; 146 this._superApply = __superApply; 147 148 return returnValue; 149 }; 150 })(); 151 }); 152 constructor.prototype = $.widget.extend(basePrototype, { 153 154 // TODO: remove support for widgetEventPrefix 155 // always use the name + a colon as the prefix, e.g., draggable:start 156 // don't prefix for widgets that aren't DOM-based 157 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 158 }, proxiedPrototype, { 159 constructor: constructor, 160 namespace: namespace, 161 widgetName: name, 162 widgetFullName: fullName 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(childPrototype.namespace + "." + childPrototype.widgetName, constructor, 176 child._proto); 177 }); 178 179 // Remove the list of existing child constructors from the old constructor 180 // so the old child constructors can be garbage collected 181 delete existingConstructor._childConstructors; 182 } else { 183 base._childConstructors.push(constructor); 184 } 185 186 $.widget.bridge(name, constructor); 187 188 return constructor; 189 }; 190 191 $.widget.extend = function (target) { 192 var input = widgetSlice.call(arguments, 1); 193 var inputIndex = 0; 194 var inputLength = input.length; 195 var key; 196 var value; 197 198 for (; inputIndex < inputLength; inputIndex++) { 199 for (key in input[inputIndex]) { 200 value = input[inputIndex][key]; 201 if (widgetHasOwnProperty.call(input[inputIndex], key) && value !== undefined) { 202 203 // Clone objects 204 if ($.isPlainObject(value)) { 205 target[key] = $.isPlainObject(target[key]) ? 206 $.widget.extend({}, target[key], value) : 207 208 // Don't extend strings, arrays, etc. with objects 209 $.widget.extend({}, value); 210 211 // Copy everything else by reference 212 } else { 213 target[key] = value; 214 } 215 } 216 } 217 } 218 return target; 219 }; 220 221 $.widget.bridge = function (name, object) { 222 var fullName = object.prototype.widgetFullName || name; 223 $.fn[name] = function (options) { 224 var isMethodCall = typeof options === "string"; 225 var args = widgetSlice.call(arguments, 1); 226 var returnValue = this; 227 228 if (isMethodCall) { 229 230 // If this is an empty collection, we need to have the instance method 231 // return undefined instead of the jQuery instance 232 if (!this.length && options === "instance") { 233 returnValue = undefined; 234 } else { 235 this.each(function () { 236 var methodValue; 237 var instance = $.data(this, fullName); 238 239 if (options === "instance") { 240 returnValue = instance; 241 return false; 242 } 243 244 if (!instance) { 245 return $.error("cannot call methods on " + name + 246 " prior to initialization; " + 247 "attempted to call method '" + options + "'"); 248 } 249 250 if (typeof instance[options] !== "function" || 251 options.charAt(0) === "_") { 252 return $.error("no such method '" + options + "' for " + name + 253 " widget instance"); 254 } 255 256 methodValue = instance[options].apply(instance, args); 257 258 if (methodValue !== instance && methodValue !== undefined) { 259 returnValue = methodValue && methodValue.jquery ? 260 returnValue.pushStack(methodValue.get()) : 261 methodValue; 262 return false; 263 } 264 }); 265 } 266 } else { 267 268 // Allow multiple hashes to be passed on init 269 if (args.length) { 270 options = $.widget.extend.apply(null, [options].concat(args)); 271 } 272 273 this.each(function () { 274 var instance = $.data(this, fullName); 275 if (instance) { 276 instance.option(options || {}); 277 if (instance._init) { 278 instance._init(); 279 } 280 } else { 281 $.data(this, fullName, new object(options, this)); 282 } 283 }); 284 } 285 286 return returnValue; 287 }; 288 }; 289 290 $.Widget = function ( /* options, element */) { }; 291 $.Widget._childConstructors = []; 292 293 $.Widget.prototype = { 294 widgetName: "widget", 295 widgetEventPrefix: "", 296 defaultElement: "<div>", 297 298 options: { 299 classes: {}, 300 disabled: false, 301 302 // Callbacks 303 create: null 304 }, 305 306 _createWidget: function (options, element) { 307 element = $(element || this.defaultElement || this)[0]; 308 this.element = $(element); 309 this.uuid = widgetUuid++; 310 this.eventNamespace = "." + this.widgetName + this.uuid; 311 312 this.bindings = $(); 313 this.hoverable = $(); 314 this.focusable = $(); 315 this.classesElementLookup = {}; 316 317 if (element !== this) { 318 $.data(element, this.widgetFullName, this); 319 this._on(true, this.element, { 320 remove: function (event) { 321 if (event.target === element) { 322 this.destroy(); 323 } 324 } 325 }); 326 this.document = $(element.style ? 327 328 // Element within the document 329 element.ownerDocument : 330 331 // Element is window or document 332 element.document || element); 333 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 334 } 335 336 this.options = $.widget.extend({}, 337 this.options, 338 this._getCreateOptions(), 339 options); 340 341 this._create(); 342 343 if (this.options.disabled) { 344 this._setOptionDisabled(this.options.disabled); 345 } 346 347 this._trigger("create", null, this._getCreateEventData()); 348 this._init(); 349 }, 350 351 _getCreateOptions: function () { 352 return {}; 353 }, 354 355 _getCreateEventData: $.noop, 356 357 _create: $.noop, 358 359 _init: $.noop, 360 361 destroy: function () { 362 var that = this; 363 364 this._destroy(); 365 $.each(this.classesElementLookup, function (key, value) { 366 that._removeClass(value, key); 367 }); 368 369 // We can probably remove the unbind calls in 2.0 370 // all event bindings should go through this._on() 371 this.element 372 .off(this.eventNamespace) 373 .removeData(this.widgetFullName); 374 this.widget() 375 .off(this.eventNamespace) 376 .removeAttr("aria-disabled"); 377 378 // Clean up events and states 379 this.bindings.off(this.eventNamespace); 380 }, 381 382 _destroy: $.noop, 383 384 widget: function () { 385 return this.element; 386 }, 387 388 option: function (key, value) { 389 var options = key; 390 var parts; 391 var curOption; 392 var i; 393 394 if (arguments.length === 0) { 395 396 // Don't return a reference to the internal hash 397 return $.widget.extend({}, this.options); 398 } 399 400 if (typeof key === "string") { 401 402 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 403 options = {}; 404 parts = key.split("."); 405 key = parts.shift(); 406 if (parts.length) { 407 curOption = options[key] = $.widget.extend({}, this.options[key]); 408 for (i = 0; i < parts.length - 1; i++) { 409 curOption[parts[i]] = curOption[parts[i]] || {}; 410 curOption = curOption[parts[i]]; 411 } 412 key = parts.pop(); 413 if (arguments.length === 1) { 414 return curOption[key] === undefined ? null : curOption[key]; 415 } 416 curOption[key] = value; 417 } else { 418 if (arguments.length === 1) { 419 return this.options[key] === undefined ? null : this.options[key]; 420 } 421 options[key] = value; 422 } 423 } 424 425 this._setOptions(options); 426 427 return this; 428 }, 429 430 _setOptions: function (options) { 431 var key; 432 433 for (key in options) { 434 this._setOption(key, options[key]); 435 } 436 437 return this; 438 }, 439 440 _setOption: function (key, value) { 441 if (key === "classes") { 442 this._setOptionClasses(value); 443 } 444 445 this.options[key] = value; 446 447 if (key === "disabled") { 448 this._setOptionDisabled(value); 449 } 450 451 return this; 452 }, 453 454 _setOptionClasses: function (value) { 455 var classKey, elements, currentElements; 456 457 for (classKey in value) { 458 currentElements = this.classesElementLookup[classKey]; 459 if (value[classKey] === this.options.classes[classKey] || 460 !currentElements || 461 !currentElements.length) { 462 continue; 463 } 464 465 // We are doing this to create a new jQuery object because the _removeClass() call 466 // on the next line is going to destroy the reference to the current elements being 467 // tracked. We need to save a copy of this collection so that we can add the new classes 468 // below. 469 elements = $(currentElements.get()); 470 this._removeClass(currentElements, classKey); 471 472 // We don't use _addClass() here, because that uses this.options.classes 473 // for generating the string of classes. We want to use the value passed in from 474 // _setOption(), this is the new value of the classes option which was passed to 475 // _setOption(). We pass this value directly to _classes(). 476 elements.addClass(this._classes({ 477 element: elements, 478 keys: classKey, 479 classes: value, 480 add: true 481 })); 482 } 483 }, 484 485 _setOptionDisabled: function (value) { 486 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value); 487 488 // If the widget is becoming disabled, then nothing is interactive 489 if (value) { 490 this._removeClass(this.hoverable, null, "ui-state-hover"); 491 this._removeClass(this.focusable, null, "ui-state-focus"); 492 } 493 }, 494 495 enable: function () { 496 return this._setOptions({ disabled: false }); 497 }, 498 499 disable: function () { 500 return this._setOptions({ disabled: true }); 501 }, 502 503 _classes: function (options) { 504 var full = []; 505 var that = this; 506 507 options = $.extend({ 508 element: this.element, 509 classes: this.options.classes || {} 510 }, options); 511 512 function bindRemoveEvent() { 513 var nodesToBind = []; 514 515 options.element.each(function (_, element) { 516 var isTracked = $.map(that.classesElementLookup, function (elements) { 517 return elements; 518 }) 519 .some(function (elements) { 520 return elements.is(element); 521 }); 522 523 if (!isTracked) { 524 nodesToBind.push(element); 525 } 526 }); 527 528 that._on($(nodesToBind), { 529 remove: "_untrackClassesElement" 530 }); 531 } 532 533 function processClassString(classes, checkOption) { 534 var current, i; 535 for (i = 0; i < classes.length; i++) { 536 current = that.classesElementLookup[classes[i]] || $(); 537 if (options.add) { 538 bindRemoveEvent(); 539 current = $($.uniqueSort(current.get().concat(options.element.get()))); 540 } else { 541 current = $(current.not(options.element).get()); 542 } 543 that.classesElementLookup[classes[i]] = current; 544 full.push(classes[i]); 545 if (checkOption && options.classes[classes[i]]) { 546 full.push(options.classes[classes[i]]); 547 } 548 } 549 } 550 551 if (options.keys) { 552 processClassString(options.keys.match(/\S+/g) || [], true); 553 } 554 if (options.extra) { 555 processClassString(options.extra.match(/\S+/g) || []); 556 } 557 558 return full.join(" "); 559 }, 560 561 _untrackClassesElement: function (event) { 562 var that = this; 563 $.each(that.classesElementLookup, function (key, value) { 564 if ($.inArray(event.target, value) !== -1) { 565 that.classesElementLookup[key] = $(value.not(event.target).get()); 566 } 567 }); 568 569 this._off($(event.target)); 570 }, 571 572 _removeClass: function (element, keys, extra) { 573 return this._toggleClass(element, keys, extra, false); 574 }, 575 576 _addClass: function (element, keys, extra) { 577 return this._toggleClass(element, keys, extra, true); 578 }, 579 580 _toggleClass: function (element, keys, extra, add) { 581 add = (typeof add === "boolean") ? add : extra; 582 var shift = (typeof element === "string" || element === null), 583 options = { 584 extra: shift ? keys : extra, 585 keys: shift ? element : keys, 586 element: shift ? this.element : element, 587 add: add 588 }; 589 options.element.toggleClass(this._classes(options), add); 590 return this; 591 }, 592 593 _on: function (suppressDisabledCheck, element, handlers) { 594 var delegateElement; 595 var instance = this; 596 597 // No suppressDisabledCheck flag, shuffle arguments 598 if (typeof suppressDisabledCheck !== "boolean") { 599 handlers = element; 600 element = suppressDisabledCheck; 601 suppressDisabledCheck = false; 602 } 603 604 // No element argument, shuffle and use this.element 605 if (!handlers) { 606 handlers = element; 607 element = this.element; 608 delegateElement = this.widget(); 609 } else { 610 element = delegateElement = $(element); 611 this.bindings = this.bindings.add(element); 612 } 613 614 $.each(handlers, function (event, handler) { 615 function handlerProxy() { 616 617 // Allow widgets to customize the disabled handling 618 // - disabled as an array instead of boolean 619 // - disabled class as method for disabling individual parts 620 if (!suppressDisabledCheck && 621 (instance.options.disabled === true || 622 $(this).hasClass("ui-state-disabled"))) { 623 return; 624 } 625 return (typeof handler === "string" ? instance[handler] : handler) 626 .apply(instance, arguments); 627 } 628 629 // Copy the guid so direct unbinding works 630 if (typeof handler !== "string") { 631 handlerProxy.guid = handler.guid = 632 handler.guid || handlerProxy.guid || $.guid++; 633 } 634 635 var match = event.match(/^([\w:-]*)\s*(.*)$/); 636 var eventName = match[1] + instance.eventNamespace; 637 var selector = match[2]; 638 639 if (selector) { 640 delegateElement.on(eventName, selector, handlerProxy); 641 } else { 642 element.on(eventName, handlerProxy); 643 } 644 }); 645 }, 646 647 _off: function (element, eventName) { 648 eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + 649 this.eventNamespace; 650 element.off(eventName); 651 652 // Clear the stack to avoid memory leaks (#10056) 653 this.bindings = $(this.bindings.not(element).get()); 654 this.focusable = $(this.focusable.not(element).get()); 655 this.hoverable = $(this.hoverable.not(element).get()); 656 }, 657 658 _delay: function (handler, delay) { 659 function handlerProxy() { 660 return (typeof handler === "string" ? instance[handler] : handler) 661 .apply(instance, arguments); 662 } 663 var instance = this; 664 return setTimeout(handlerProxy, delay || 0); 665 }, 666 667 _hoverable: function (element) { 668 this.hoverable = this.hoverable.add(element); 669 this._on(element, { 670 mouseenter: function (event) { 671 this._addClass($(event.currentTarget), null, "ui-state-hover"); 672 }, 673 mouseleave: function (event) { 674 this._removeClass($(event.currentTarget), null, "ui-state-hover"); 675 } 676 }); 677 }, 678 679 _focusable: function (element) { 680 this.focusable = this.focusable.add(element); 681 this._on(element, { 682 focusin: function (event) { 683 this._addClass($(event.currentTarget), null, "ui-state-focus"); 684 }, 685 focusout: function (event) { 686 this._removeClass($(event.currentTarget), null, "ui-state-focus"); 687 } 688 }); 689 }, 690 691 _trigger: function (type, event, data) { 692 var prop, orig; 693 var callback = this.options[type]; 694 695 data = data || {}; 696 event = $.Event(event); 697 event.type = (type === this.widgetEventPrefix ? 698 type : 699 this.widgetEventPrefix + type).toLowerCase(); 700 701 // The original event may come from any element 702 // so we need to reset the target on the new event 703 event.target = this.element[0]; 704 705 // Copy original event properties over to the new event 706 orig = event.originalEvent; 707 if (orig) { 708 for (prop in orig) { 709 if (!(prop in event)) { 710 event[prop] = orig[prop]; 711 } 712 } 713 } 714 715 this.element.trigger(event, data); 716 return !(typeof callback === "function" && 717 callback.apply(this.element[0], [event].concat(data)) === false || 718 event.isDefaultPrevented()); 719 } 720 }; 721 722 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 723 $.Widget.prototype["_" + method] = function (element, options, callback) { 724 if (typeof options === "string") { 725 options = { effect: options }; 726 } 727 728 var hasOptions; 729 var effectName = !options ? 730 method : 731 options === true || typeof options === "number" ? 732 defaultEffect : 733 options.effect || defaultEffect; 734 735 options = options || {}; 736 if (typeof options === "number") { 737 options = { duration: options }; 738 } else if (options === true) { 739 options = {}; 740 } 741 742 hasOptions = !$.isEmptyObject(options); 743 options.complete = callback; 744 745 if (options.delay) { 746 element.delay(options.delay); 747 } 748 749 if (hasOptions && $.effects && $.effects.effect[effectName]) { 750 element[method](options); 751 } else if (effectName !== method && element[effectName]) { 752 element[effectName](options.duration, options.easing, callback); 753 } else { 754 element.queue(function (next) { 755 $(this)[method](); 756 if (callback) { 757 callback.call(element[0]); 758 } 759 next(); 760 }); 761 } 762 }; 763 }); 764 765 var widget = $.widget; 766 767 768 /*! 769 * jQuery UI Position 1.13.2 770 * http://jqueryui.com 771 * 772 * Copyright jQuery Foundation and other contributors 773 * Released under the MIT license. 774 * http://jquery.org/license 775 * 776 * http://api.jqueryui.com/position/ 777 */ 778 779 //>>label: Position 780 //>>group: Core 781 //>>description: Positions elements relative to other elements. 782 //>>docs: http://api.jqueryui.com/position/ 783 //>>demos: http://jqueryui.com/position/ 784 785 786 (function () { 787 var cachedScrollbarWidth, 788 max = Math.max, 789 abs = Math.abs, 790 rhorizontal = /left|center|right/, 791 rvertical = /top|center|bottom/, 792 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 793 rposition = /^\w+/, 794 rpercent = /%$/, 795 _position = $.fn.position; 796 797 function getOffsets(offsets, width, height) { 798 return [ 799 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 800 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1) 801 ]; 802 } 803 804 function parseCss(element, property) { 805 return parseInt($.css(element, property), 10) || 0; 806 } 807 808 function isWindow(obj) { 809 return obj != null && obj === obj.window; 810 } 811 812 function getDimensions(elem) { 813 var raw = elem[0]; 814 if (raw.nodeType === 9) { 815 return { 816 width: elem.width(), 817 height: elem.height(), 818 offset: { top: 0, left: 0 } 819 }; 820 } 821 if (isWindow(raw)) { 822 return { 823 width: elem.width(), 824 height: elem.height(), 825 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 826 }; 827 } 828 if (raw.preventDefault) { 829 return { 830 width: 0, 831 height: 0, 832 offset: { top: raw.pageY, left: raw.pageX } 833 }; 834 } 835 return { 836 width: elem.outerWidth(), 837 height: elem.outerHeight(), 838 offset: elem.offset() 839 }; 840 } 841 842 $.position = { 843 scrollbarWidth: function () { 844 if (cachedScrollbarWidth !== undefined) { 845 return cachedScrollbarWidth; 846 } 847 var w1, w2, 848 div = $("<div style=" + 849 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 850 "<div style='height:300px;width:auto;'></div></div>"), 851 innerDiv = div.children()[0]; 852 853 $("body").append(div); 854 w1 = innerDiv.offsetWidth; 855 div.css("overflow", "scroll"); 856 857 w2 = innerDiv.offsetWidth; 858 859 if (w1 === w2) { 860 w2 = div[0].clientWidth; 861 } 862 863 div.remove(); 864 865 return (cachedScrollbarWidth = w1 - w2); 866 }, 867 getScrollInfo: function (within) { 868 var overflowX = within.isWindow || within.isDocument ? "" : 869 within.element.css("overflow-x"), 870 overflowY = within.isWindow || within.isDocument ? "" : 871 within.element.css("overflow-y"), 872 hasOverflowX = overflowX === "scroll" || 873 (overflowX === "auto" && within.width < within.element[0].scrollWidth), 874 hasOverflowY = overflowY === "scroll" || 875 (overflowY === "auto" && within.height < within.element[0].scrollHeight); 876 return { 877 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 878 height: hasOverflowX ? $.position.scrollbarWidth() : 0 879 }; 880 }, 881 getWithinInfo: function (element) { 882 var withinElement = $(element || window), 883 isElemWindow = isWindow(withinElement[0]), 884 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9, 885 hasOffset = !isElemWindow && !isDocument; 886 return { 887 element: withinElement, 888 isWindow: isElemWindow, 889 isDocument: isDocument, 890 offset: hasOffset ? $(element).offset() : { left: 0, top: 0 }, 891 scrollLeft: withinElement.scrollLeft(), 892 scrollTop: withinElement.scrollTop(), 893 width: withinElement.outerWidth(), 894 height: withinElement.outerHeight() 895 }; 896 } 897 }; 898 899 $.fn.position = function (options) { 900 if (!options || !options.of) { 901 return _position.apply(this, arguments); 902 } 903 904 // Make a copy, we don't want to modify arguments 905 options = $.extend({}, options); 906 907 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 908 909 // Make sure string options are treated as CSS selectors 910 target = typeof options.of === "string" ? 911 $(document).find(options.of) : 912 $(options.of), 913 914 within = $.position.getWithinInfo(options.within), 915 scrollInfo = $.position.getScrollInfo(within), 916 collision = (options.collision || "flip").split(" "), 917 offsets = {}; 918 919 dimensions = getDimensions(target); 920 if (target[0].preventDefault) { 921 922 // Force left top to allow flipping 923 options.at = "left top"; 924 } 925 targetWidth = dimensions.width; 926 targetHeight = dimensions.height; 927 targetOffset = dimensions.offset; 928 929 // Clone to reuse original targetOffset later 930 basePosition = $.extend({}, targetOffset); 931 932 // Force my and at to have valid horizontal and vertical positions 933 // if a value is missing or invalid, it will be converted to center 934 $.each(["my", "at"], function () { 935 var pos = (options[this] || "").split(" "), 936 horizontalOffset, 937 verticalOffset; 938 939 if (pos.length === 1) { 940 pos = rhorizontal.test(pos[0]) ? 941 pos.concat(["center"]) : 942 rvertical.test(pos[0]) ? 943 ["center"].concat(pos) : 944 ["center", "center"]; 945 } 946 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 947 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 948 949 // Calculate offsets 950 horizontalOffset = roffset.exec(pos[0]); 951 verticalOffset = roffset.exec(pos[1]); 952 offsets[this] = [ 953 horizontalOffset ? horizontalOffset[0] : 0, 954 verticalOffset ? verticalOffset[0] : 0 955 ]; 956 957 // Reduce to just the positions without the offsets 958 options[this] = [ 959 rposition.exec(pos[0])[0], 960 rposition.exec(pos[1])[0] 961 ]; 962 }); 963 964 // Normalize collision option 965 if (collision.length === 1) { 966 collision[1] = collision[0]; 967 } 968 969 if (options.at[0] === "right") { 970 basePosition.left += targetWidth; 971 } else if (options.at[0] === "center") { 972 basePosition.left += targetWidth / 2; 973 } 974 975 if (options.at[1] === "bottom") { 976 basePosition.top += targetHeight; 977 } else if (options.at[1] === "center") { 978 basePosition.top += targetHeight / 2; 979 } 980 981 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 982 basePosition.left += atOffset[0]; 983 basePosition.top += atOffset[1]; 984 985 return this.each(function () { 986 var collisionPosition, using, 987 elem = $(this), 988 elemWidth = elem.outerWidth(), 989 elemHeight = elem.outerHeight(), 990 marginLeft = parseCss(this, "marginLeft"), 991 marginTop = parseCss(this, "marginTop"), 992 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + 993 scrollInfo.width, 994 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + 995 scrollInfo.height, 996 position = $.extend({}, basePosition), 997 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 998 999 if (options.my[0] === "right") { 1000 position.left -= elemWidth; 1001 } else if (options.my[0] === "center") { 1002 position.left -= elemWidth / 2; 1003 } 1004 1005 if (options.my[1] === "bottom") { 1006 position.top -= elemHeight; 1007 } else if (options.my[1] === "center") { 1008 position.top -= elemHeight / 2; 1009 } 1010 1011 position.left += myOffset[0]; 1012 position.top += myOffset[1]; 1013 1014 collisionPosition = { 1015 marginLeft: marginLeft, 1016 marginTop: marginTop 1017 }; 1018 1019 $.each(["left", "top"], function (i, dir) { 1020 if ($.ui.position[collision[i]]) { 1021 $.ui.position[collision[i]][dir](position, { 1022 targetWidth: targetWidth, 1023 targetHeight: targetHeight, 1024 elemWidth: elemWidth, 1025 elemHeight: elemHeight, 1026 collisionPosition: collisionPosition, 1027 collisionWidth: collisionWidth, 1028 collisionHeight: collisionHeight, 1029 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 1030 my: options.my, 1031 at: options.at, 1032 within: within, 1033 elem: elem 1034 }); 1035 } 1036 }); 1037 1038 if (options.using) { 1039 1040 // Adds feedback as second argument to using callback, if present 1041 using = function (props) { 1042 var left = targetOffset.left - position.left, 1043 right = left + targetWidth - elemWidth, 1044 top = targetOffset.top - position.top, 1045 bottom = top + targetHeight - elemHeight, 1046 feedback = { 1047 target: { 1048 element: target, 1049 left: targetOffset.left, 1050 top: targetOffset.top, 1051 width: targetWidth, 1052 height: targetHeight 1053 }, 1054 element: { 1055 element: elem, 1056 left: position.left, 1057 top: position.top, 1058 width: elemWidth, 1059 height: elemHeight 1060 }, 1061 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1062 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1063 }; 1064 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1065 feedback.horizontal = "center"; 1066 } 1067 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1068 feedback.vertical = "middle"; 1069 } 1070 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1071 feedback.important = "horizontal"; 1072 } else { 1073 feedback.important = "vertical"; 1074 } 1075 options.using.call(this, props, feedback); 1076 }; 1077 } 1078 1079 elem.offset($.extend(position, { using: using })); 1080 }); 1081 }; 1082 1083 $.ui.position = { 1084 fit: { 1085 left: function (position, data) { 1086 var within = data.within, 1087 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1088 outerWidth = within.width, 1089 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1090 overLeft = withinOffset - collisionPosLeft, 1091 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1092 newOverRight; 1093 1094 // Element is wider than within 1095 if (data.collisionWidth > outerWidth) { 1096 1097 // Element is initially over the left side of within 1098 if (overLeft > 0 && overRight <= 0) { 1099 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1100 withinOffset; 1101 position.left += overLeft - newOverRight; 1102 1103 // Element is initially over right side of within 1104 } else if (overRight > 0 && overLeft <= 0) { 1105 position.left = withinOffset; 1106 1107 // Element is initially over both left and right sides of within 1108 } else { 1109 if (overLeft > overRight) { 1110 position.left = withinOffset + outerWidth - data.collisionWidth; 1111 } else { 1112 position.left = withinOffset; 1113 } 1114 } 1115 1116 // Too far left -> align with left edge 1117 } else if (overLeft > 0) { 1118 position.left += overLeft; 1119 1120 // Too far right -> align with right edge 1121 } else if (overRight > 0) { 1122 position.left -= overRight; 1123 1124 // Adjust based on position and margin 1125 } else { 1126 position.left = max(position.left - collisionPosLeft, position.left); 1127 } 1128 }, 1129 top: function (position, data) { 1130 var within = data.within, 1131 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1132 outerHeight = data.within.height, 1133 collisionPosTop = position.top - data.collisionPosition.marginTop, 1134 overTop = withinOffset - collisionPosTop, 1135 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1136 newOverBottom; 1137 1138 // Element is taller than within 1139 if (data.collisionHeight > outerHeight) { 1140 1141 // Element is initially over the top of within 1142 if (overTop > 0 && overBottom <= 0) { 1143 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1144 withinOffset; 1145 position.top += overTop - newOverBottom; 1146 1147 // Element is initially over bottom of within 1148 } else if (overBottom > 0 && overTop <= 0) { 1149 position.top = withinOffset; 1150 1151 // Element is initially over both top and bottom of within 1152 } else { 1153 if (overTop > overBottom) { 1154 position.top = withinOffset + outerHeight - data.collisionHeight; 1155 } else { 1156 position.top = withinOffset; 1157 } 1158 } 1159 1160 // Too far up -> align with top 1161 } else if (overTop > 0) { 1162 position.top += overTop; 1163 1164 // Too far down -> align with bottom edge 1165 } else if (overBottom > 0) { 1166 position.top -= overBottom; 1167 1168 // Adjust based on position and margin 1169 } else { 1170 position.top = max(position.top - collisionPosTop, position.top); 1171 } 1172 } 1173 }, 1174 flip: { 1175 left: function (position, data) { 1176 var within = data.within, 1177 withinOffset = within.offset.left + within.scrollLeft, 1178 outerWidth = within.width, 1179 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1180 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1181 overLeft = collisionPosLeft - offsetLeft, 1182 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1183 myOffset = data.my[0] === "left" ? 1184 -data.elemWidth : 1185 data.my[0] === "right" ? 1186 data.elemWidth : 1187 0, 1188 atOffset = data.at[0] === "left" ? 1189 data.targetWidth : 1190 data.at[0] === "right" ? 1191 -data.targetWidth : 1192 0, 1193 offset = -2 * data.offset[0], 1194 newOverRight, 1195 newOverLeft; 1196 1197 if (overLeft < 0) { 1198 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1199 outerWidth - withinOffset; 1200 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1201 position.left += myOffset + atOffset + offset; 1202 } 1203 } else if (overRight > 0) { 1204 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1205 atOffset + offset - offsetLeft; 1206 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1207 position.left += myOffset + atOffset + offset; 1208 } 1209 } 1210 }, 1211 top: function (position, data) { 1212 var within = data.within, 1213 withinOffset = within.offset.top + within.scrollTop, 1214 outerHeight = within.height, 1215 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1216 collisionPosTop = position.top - data.collisionPosition.marginTop, 1217 overTop = collisionPosTop - offsetTop, 1218 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1219 top = data.my[1] === "top", 1220 myOffset = top ? 1221 -data.elemHeight : 1222 data.my[1] === "bottom" ? 1223 data.elemHeight : 1224 0, 1225 atOffset = data.at[1] === "top" ? 1226 data.targetHeight : 1227 data.at[1] === "bottom" ? 1228 -data.targetHeight : 1229 0, 1230 offset = -2 * data.offset[1], 1231 newOverTop, 1232 newOverBottom; 1233 if (overTop < 0) { 1234 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1235 outerHeight - withinOffset; 1236 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1237 position.top += myOffset + atOffset + offset; 1238 } 1239 } else if (overBottom > 0) { 1240 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1241 offset - offsetTop; 1242 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1243 position.top += myOffset + atOffset + offset; 1244 } 1245 } 1246 } 1247 }, 1248 flipfit: { 1249 left: function () { 1250 $.ui.position.flip.left.apply(this, arguments); 1251 $.ui.position.fit.left.apply(this, arguments); 1252 }, 1253 top: function () { 1254 $.ui.position.flip.top.apply(this, arguments); 1255 $.ui.position.fit.top.apply(this, arguments); 1256 } 1257 } 1258 }; 1259 1260 })(); 1261 1262 var position = $.ui.position; 1263 1264 1265 /*! 1266 * jQuery UI :data 1.13.2 1267 * http://jqueryui.com
vendor: 24,520 bytes, lines 1268-2200
1268 * 1269 * Copyright jQuery Foundation and other contributors 1270 * Released under the MIT license. 1271 * http://jquery.org/license 1272 */ 1273 1274 //>>label: :data Selector 1275 //>>group: Core 1276 //>>description: Selects elements which have data stored under the specified key. 1277 //>>docs: http://api.jqueryui.com/data-selector/ 1278 1279 1280 var data = $.extend($.expr.pseudos, { 1281 data: $.expr.createPseudo ? 1282 $.expr.createPseudo(function (dataName) { 1283 return function (elem) { 1284 return !!$.data(elem, dataName); 1285 }; 1286 }) : 1287 1288 // Support: jQuery <1.8 1289 function (elem, i, match) { 1290 return !!$.data(elem, match[3]); 1291 } 1292 }); 1293 1294 /*! 1295 * jQuery UI Disable Selection 1.13.2 1296 * http://jqueryui.com 1297 * 1298 * Copyright jQuery Foundation and other contributors 1299 * Released under the MIT license. 1300 * http://jquery.org/license 1301 */ 1302 1303 //>>label: disableSelection 1304 //>>group: Core 1305 //>>description: Disable selection of text content within the set of matched elements. 1306 //>>docs: http://api.jqueryui.com/disableSelection/ 1307 1308 // This file is deprecated 1309 1310 var disableSelection = $.fn.extend({ 1311 disableSelection: (function () { 1312 var eventType = "onselectstart" in document.createElement("div") ? 1313 "selectstart" : 1314 "mousedown"; 1315 1316 return function () { 1317 return this.on(eventType + ".ui-disableSelection", function (event) { 1318 event.preventDefault(); 1319 }); 1320 }; 1321 })(), 1322 1323 enableSelection: function () { 1324 return this.off(".ui-disableSelection"); 1325 } 1326 }); 1327 1328 1329 /*! 1330 * jQuery UI Focusable 1.13.2 1331 * http://jqueryui.com 1332 * 1333 * Copyright jQuery Foundation and other contributors 1334 * Released under the MIT license. 1335 * http://jquery.org/license 1336 */ 1337 1338 //>>label: :focusable Selector 1339 //>>group: Core 1340 //>>description: Selects elements which can be focused. 1341 //>>docs: http://api.jqueryui.com/focusable-selector/ 1342 1343 1344 // Selectors 1345 $.ui.focusable = function (element, hasTabindex) { 1346 var map, mapName, img, focusableIfVisible, fieldset, 1347 nodeName = element.nodeName.toLowerCase(); 1348 1349 if ("area" === nodeName) { 1350 map = element.parentNode; 1351 mapName = map.name; 1352 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 1353 return false; 1354 } 1355 img = $("img[usemap='#" + mapName + "']"); 1356 return img.length > 0 && img.is(":visible"); 1357 } 1358 1359 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 1360 focusableIfVisible = !element.disabled; 1361 1362 if (focusableIfVisible) { 1363 1364 // Form controls within a disabled fieldset are disabled. 1365 // However, controls within the fieldset's legend do not get disabled. 1366 // Since controls generally aren't placed inside legends, we skip 1367 // this portion of the check. 1368 fieldset = $(element).closest("fieldset")[0]; 1369 if (fieldset) { 1370 focusableIfVisible = !fieldset.disabled; 1371 } 1372 } 1373 } else if ("a" === nodeName) { 1374 focusableIfVisible = element.href || hasTabindex; 1375 } else { 1376 focusableIfVisible = hasTabindex; 1377 } 1378 1379 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 1380 }; 1381 1382 // Support: IE 8 only 1383 // IE 8 doesn't resolve inherit to visible/hidden for computed values 1384 function visible(element) { 1385 var visibility = element.css("visibility"); 1386 while (visibility === "inherit") { 1387 element = element.parent(); 1388 visibility = element.css("visibility"); 1389 } 1390 return visibility === "visible"; 1391 } 1392 1393 $.extend($.expr.pseudos, { 1394 focusable: function (element) { 1395 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 1396 } 1397 }); 1398 1399 var focusable = $.ui.focusable; 1400 1401 1402 1403 // Support: IE8 Only 1404 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 1405 // with a string, so we need to find the proper form. 1406 var form = $.fn._form = function () { 1407 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 1408 }; 1409 1410 1411 /*! 1412 * jQuery UI Form Reset Mixin 1.13.2 1413 * http://jqueryui.com 1414 * 1415 * Copyright jQuery Foundation and other contributors 1416 * Released under the MIT license. 1417 * http://jquery.org/license 1418 */ 1419 1420 //>>label: Form Reset Mixin 1421 //>>group: Core 1422 //>>description: Refresh input widgets when their form is reset 1423 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 1424 1425 1426 var formResetMixin = $.ui.formResetMixin = { 1427 _formResetHandler: function () { 1428 var form = $(this); 1429 1430 // Wait for the form reset to actually happen before refreshing 1431 setTimeout(function () { 1432 var instances = form.data("ui-form-reset-instances"); 1433 $.each(instances, function () { 1434 this.refresh(); 1435 }); 1436 }); 1437 }, 1438 1439 _bindFormResetHandler: function () { 1440 this.form = this.element._form(); 1441 if (!this.form.length) { 1442 return; 1443 } 1444 1445 var instances = this.form.data("ui-form-reset-instances") || []; 1446 if (!instances.length) { 1447 1448 // We don't use _on() here because we use a single event handler per form 1449 this.form.on("reset.ui-form-reset", this._formResetHandler); 1450 } 1451 instances.push(this); 1452 this.form.data("ui-form-reset-instances", instances); 1453 }, 1454 1455 _unbindFormResetHandler: function () { 1456 if (!this.form.length) { 1457 return; 1458 } 1459 1460 var instances = this.form.data("ui-form-reset-instances"); 1461 instances.splice($.inArray(this, instances), 1); 1462 if (instances.length) { 1463 this.form.data("ui-form-reset-instances", instances); 1464 } else { 1465 this.form 1466 .removeData("ui-form-reset-instances") 1467 .off("reset.ui-form-reset"); 1468 } 1469 } 1470 }; 1471 1472 1473 /*! 1474 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2 1475 * http://jqueryui.com 1476 * 1477 * Copyright jQuery Foundation and other contributors 1478 * Released under the MIT license. 1479 * http://jquery.org/license 1480 * 1481 */ 1482 1483 //>>label: jQuery 1.8+ Support 1484 //>>group: Core 1485 //>>description: Support version 1.8.x and newer of jQuery core 1486 1487 1488 // Support: jQuery 1.9.x or older 1489 // $.expr[ ":" ] is deprecated. 1490 if (!$.expr.pseudos) { 1491 $.expr.pseudos = $.expr[":"]; 1492 } 1493 1494 // Support: jQuery 1.11.x or older 1495 // $.unique has been renamed to $.uniqueSort 1496 if (!$.uniqueSort) { 1497 $.uniqueSort = $.unique; 1498 } 1499 1500 // Support: jQuery 2.2.x or older. 1501 // This method has been defined in jQuery 3.0.0. 1502 // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 1503 if (!$.escapeSelector) { 1504 1505 // CSS string/identifier serialization 1506 // https://drafts.csswg.org/cssom/#common-serializing-idioms 1507 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 1508 1509 var fcssescape = function (ch, asCodePoint) { 1510 if (asCodePoint) { 1511 1512 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 1513 if (ch === "\0") { 1514 return "\uFFFD"; 1515 } 1516 1517 // Control characters and (dependent upon position) numbers get escaped as code points 1518 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 1519 } 1520 1521 // Other potentially-special ASCII characters get backslash-escaped 1522 return "\\" + ch; 1523 }; 1524 1525 $.escapeSelector = function (sel) { 1526 return (sel + "").replace(rcssescape, fcssescape); 1527 }; 1528 } 1529 1530 // Support: jQuery 3.4.x or older 1531 // These methods have been defined in jQuery 3.5.0. 1532 if (!$.fn.even || !$.fn.odd) { 1533 $.fn.extend({ 1534 even: function () { 1535 return this.filter(function (i) { 1536 return i % 2 === 0; 1537 }); 1538 }, 1539 odd: function () { 1540 return this.filter(function (i) { 1541 return i % 2 === 1; 1542 }); 1543 } 1544 }); 1545 } 1546 1547 ; 1548 /*! 1549 * jQuery UI Keycode 1.13.2 1550 * http://jqueryui.com 1551 * 1552 * Copyright jQuery Foundation and other contributors 1553 * Released under the MIT license. 1554 * http://jquery.org/license 1555 */ 1556 1557 //>>label: Keycode 1558 //>>group: Core 1559 //>>description: Provide keycodes as keynames 1560 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 1561 1562 1563 var keycode = $.ui.keyCode = { 1564 BACKSPACE: 8, 1565 COMMA: 188, 1566 DELETE: 46, 1567 DOWN: 40, 1568 END: 35, 1569 ENTER: 13, 1570 ESCAPE: 27, 1571 HOME: 36, 1572 LEFT: 37, 1573 PAGE_DOWN: 34, 1574 PAGE_UP: 33, 1575 PERIOD: 190, 1576 RIGHT: 39, 1577 SPACE: 32, 1578 TAB: 9, 1579 UP: 38 1580 }; 1581 1582 1583 /*! 1584 * jQuery UI Labels 1.13.2 1585 * http://jqueryui.com 1586 * 1587 * Copyright jQuery Foundation and other contributors 1588 * Released under the MIT license. 1589 * http://jquery.org/license 1590 */ 1591 1592 //>>label: labels 1593 //>>group: Core 1594 //>>description: Find all the labels associated with a given input 1595 //>>docs: http://api.jqueryui.com/labels/ 1596 1597 1598 var labels = $.fn.labels = function () { 1599 var ancestor, selector, id, labels, ancestors; 1600 1601 if (!this.length) { 1602 return this.pushStack([]); 1603 } 1604 1605 // Check control.labels first 1606 if (this[0].labels && this[0].labels.length) { 1607 return this.pushStack(this[0].labels); 1608 } 1609 1610 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 1611 // Above browsers do not support control.labels. Everything below is to support them 1612 // as well as document fragments. control.labels does not work on document fragments 1613 labels = this.eq(0).parents("label"); 1614 1615 // Look for the label based on the id 1616 id = this.attr("id"); 1617 if (id) { 1618 1619 // We don't search against the document in case the element 1620 // is disconnected from the DOM 1621 ancestor = this.eq(0).parents().last(); 1622 1623 // Get a full set of top level ancestors 1624 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 1625 1626 // Create a selector for the label based on the id 1627 selector = "label[for='" + $.escapeSelector(id) + "']"; 1628 1629 labels = labels.add(ancestors.find(selector).addBack(selector)); 1630 1631 } 1632 1633 // Return whatever we have found for labels 1634 return this.pushStack(labels); 1635 }; 1636 1637 1638 /*! 1639 * jQuery UI Scroll Parent 1.13.2 1640 * http://jqueryui.com 1641 * 1642 * Copyright jQuery Foundation and other contributors 1643 * Released under the MIT license. 1644 * http://jquery.org/license 1645 */ 1646 1647 //>>label: scrollParent 1648 //>>group: Core 1649 //>>description: Get the closest ancestor element that is scrollable. 1650 //>>docs: http://api.jqueryui.com/scrollParent/ 1651 1652 1653 var scrollParent = $.fn.scrollParent = function (includeHidden) { 1654 var position = this.css("position"), 1655 excludeStaticParent = position === "absolute", 1656 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1657 scrollParent = this.parents().filter(function () { 1658 var parent = $(this); 1659 if (excludeStaticParent && parent.css("position") === "static") { 1660 return false; 1661 } 1662 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 1663 parent.css("overflow-x")); 1664 }).eq(0); 1665 1666 return position === "fixed" || !scrollParent.length ? 1667 $(this[0].ownerDocument || document) : 1668 scrollParent; 1669 }; 1670 1671 1672 /*! 1673 * jQuery UI Tabbable 1.13.2 1674 * http://jqueryui.com 1675 * 1676 * Copyright jQuery Foundation and other contributors 1677 * Released under the MIT license. 1678 * http://jquery.org/license 1679 */ 1680 1681 //>>label: :tabbable Selector 1682 //>>group: Core 1683 //>>description: Selects elements which can be tabbed to. 1684 //>>docs: http://api.jqueryui.com/tabbable-selector/ 1685 1686 1687 var tabbable = $.extend($.expr.pseudos, { 1688 tabbable: function (element) { 1689 var tabIndex = $.attr(element, "tabindex"), 1690 hasTabindex = tabIndex != null; 1691 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 1692 } 1693 }); 1694 1695 1696 /*! 1697 * jQuery UI Unique ID 1.13.2 1698 * http://jqueryui.com 1699 * 1700 * Copyright jQuery Foundation and other contributors 1701 * Released under the MIT license. 1702 * http://jquery.org/license 1703 */ 1704 1705 //>>label: uniqueId 1706 //>>group: Core 1707 //>>description: Functions to generate and remove uniqueId's 1708 //>>docs: http://api.jqueryui.com/uniqueId/ 1709 1710 1711 var uniqueId = $.fn.extend({ 1712 uniqueId: (function () { 1713 var uuid = 0; 1714 1715 return function () { 1716 return this.each(function () { 1717 if (!this.id) { 1718 this.id = "ui-id-" + (++uuid); 1719 } 1720 }); 1721 }; 1722 })(), 1723 1724 removeUniqueId: function () { 1725 return this.each(function () { 1726 if (/^ui-id-\d+$/.test(this.id)) { 1727 $(this).removeAttr("id"); 1728 } 1729 }); 1730 } 1731 }); 1732 1733 1734 1735 // This file is deprecated 1736 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 1737 1738 /*! 1739 * jQuery UI Mouse 1.13.2 1740 * http://jqueryui.com 1741 * 1742 * Copyright jQuery Foundation and other contributors 1743 * Released under the MIT license. 1744 * http://jquery.org/license 1745 */ 1746 1747 //>>label: Mouse 1748 //>>group: Widgets 1749 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1750 //>>docs: http://api.jqueryui.com/mouse/ 1751 1752 1753 var mouseHandled = false; 1754 $(document).on("mouseup", function () { 1755 mouseHandled = false; 1756 }); 1757 1758 var widgetsMouse = $.widget("ui.mouse", { 1759 version: "1.13.2", 1760 options: { 1761 cancel: "input, textarea, button, select, option", 1762 distance: 1, 1763 delay: 0 1764 }, 1765 _mouseInit: function () { 1766 var that = this; 1767 1768 this.element 1769 .on("mousedown." + this.widgetName, function (event) { 1770 return that._mouseDown(event); 1771 }) 1772 .on("click." + this.widgetName, function (event) { 1773 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 1774 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 1775 event.stopImmediatePropagation(); 1776 return false; 1777 } 1778 }); 1779 1780 this.started = false; 1781 }, 1782 1783 // TODO: make sure destroying one instance of mouse doesn't mess with 1784 // other instances of mouse 1785 _mouseDestroy: function () { 1786 this.element.off("." + this.widgetName); 1787 if (this._mouseMoveDelegate) { 1788 this.document 1789 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1790 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1791 } 1792 }, 1793 1794 _mouseDown: function (event) { 1795 1796 // don't let more than one widget handle mouseStart 1797 if (mouseHandled) { 1798 return; 1799 } 1800 1801 this._mouseMoved = false; 1802 1803 // We may have missed mouseup (out of window) 1804 if (this._mouseStarted) { 1805 this._mouseUp(event); 1806 } 1807 1808 this._mouseDownEvent = event; 1809 1810 var that = this, 1811 btnIsLeft = (event.which === 1), 1812 1813 // event.target.nodeName works around a bug in IE 8 with 1814 // disabled inputs (#7620) 1815 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 1816 $(event.target).closest(this.options.cancel).length : false); 1817 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 1818 return true; 1819 } 1820 1821 this.mouseDelayMet = !this.options.delay; 1822 if (!this.mouseDelayMet) { 1823 this._mouseDelayTimer = setTimeout(function () { 1824 that.mouseDelayMet = true; 1825 }, this.options.delay); 1826 } 1827 1828 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1829 this._mouseStarted = (this._mouseStart(event) !== false); 1830 if (!this._mouseStarted) { 1831 event.preventDefault(); 1832 return true; 1833 } 1834 } 1835 1836 // Click event may never have fired (Gecko & Opera) 1837 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 1838 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 1839 } 1840 1841 // These delegates are required to keep context 1842 this._mouseMoveDelegate = function (event) { 1843 return that._mouseMove(event); 1844 }; 1845 this._mouseUpDelegate = function (event) { 1846 return that._mouseUp(event); 1847 }; 1848 1849 this.document 1850 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 1851 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 1852 1853 event.preventDefault(); 1854 1855 mouseHandled = true; 1856 return true; 1857 }, 1858 1859 _mouseMove: function (event) { 1860 1861 // Only check for mouseups outside the document if you've moved inside the document 1862 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 1863 // fire a mousemove event if content is placed under the cursor. See #7778 1864 // Support: IE <9 1865 if (this._mouseMoved) { 1866 1867 // IE mouseup check - mouseup happened when mouse was out of window 1868 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 1869 !event.button) { 1870 return this._mouseUp(event); 1871 1872 // Iframe mouseup check - mouseup occurred in another document 1873 } else if (!event.which) { 1874 1875 // Support: Safari <=8 - 9 1876 // Safari sets which to 0 if you press any of the following keys 1877 // during a drag (#14461) 1878 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 1879 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 1880 this.ignoreMissingWhich = true; 1881 } else if (!this.ignoreMissingWhich) { 1882 return this._mouseUp(event); 1883 } 1884 } 1885 } 1886 1887 if (event.which || event.button) { 1888 this._mouseMoved = true; 1889 } 1890 1891 if (this._mouseStarted) { 1892 this._mouseDrag(event); 1893 return event.preventDefault(); 1894 } 1895 1896 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 1897 this._mouseStarted = 1898 (this._mouseStart(this._mouseDownEvent, event) !== false); 1899 if (this._mouseStarted) { 1900 this._mouseDrag(event); 1901 } else { 1902 this._mouseUp(event); 1903 } 1904 } 1905 1906 return !this._mouseStarted; 1907 }, 1908 1909 _mouseUp: function (event) { 1910 this.document 1911 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 1912 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 1913 1914 if (this._mouseStarted) { 1915 this._mouseStarted = false; 1916 1917 if (event.target === this._mouseDownEvent.target) { 1918 $.data(event.target, this.widgetName + ".preventClickEvent", true); 1919 } 1920 1921 this._mouseStop(event); 1922 } 1923 1924 if (this._mouseDelayTimer) { 1925 clearTimeout(this._mouseDelayTimer); 1926 delete this._mouseDelayTimer; 1927 } 1928 1929 this.ignoreMissingWhich = false; 1930 mouseHandled = false; 1931 event.preventDefault(); 1932 }, 1933 1934 _mouseDistanceMet: function (event) { 1935 return (Math.max( 1936 Math.abs(this._mouseDownEvent.pageX - event.pageX), 1937 Math.abs(this._mouseDownEvent.pageY - event.pageY) 1938 ) >= this.options.distance 1939 ); 1940 }, 1941 1942 _mouseDelayMet: function ( /* event */) { 1943 return this.mouseDelayMet; 1944 }, 1945 1946 // These are placeholder methods, to be overriden by extending plugin 1947 _mouseStart: function ( /* event */) { }, 1948 _mouseDrag: function ( /* event */) { }, 1949 _mouseStop: function ( /* event */) { }, 1950 _mouseCapture: function ( /* event */) { 1951 return true; 1952 } 1953 }); 1954 1955 1956 1957 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 1958 var plugin = $.ui.plugin = { 1959 add: function (module, option, set) { 1960 var i, 1961 proto = $.ui[module].prototype; 1962 for (i in set) { 1963 proto.plugins[i] = proto.plugins[i] || []; 1964 proto.plugins[i].push([option, set[i]]); 1965 } 1966 }, 1967 call: function (instance, name, args, allowDisconnected) { 1968 var i, 1969 set = instance.plugins[name]; 1970 1971 if (!set) { 1972 return; 1973 } 1974 1975 if (!allowDisconnected && (!instance.element[0].parentNode || 1976 instance.element[0].parentNode.nodeType === 11)) { 1977 return; 1978 } 1979 1980 for (i = 0; i < set.length; i++) { 1981 if (instance.options[set[i][0]]) { 1982 set[i][1].apply(instance.element, args); 1983 } 1984 } 1985 } 1986 }; 1987 1988 1989 1990 var safeActiveElement = $.ui.safeActiveElement = function (document) { 1991 var activeElement; 1992 1993 // Support: IE 9 only 1994 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 1995 try { 1996 activeElement = document.activeElement; 1997 } catch (error) { 1998 activeElement = document.body; 1999 } 2000 2001 // Support: IE 9 - 11 only 2002 // IE may return null instead of an element 2003 // Interestingly, this only seems to occur when NOT in an iframe 2004 if (!activeElement) { 2005 activeElement = document.body; 2006 } 2007 2008 // Support: IE 11 only 2009 // IE11 returns a seemingly empty object in some cases when accessing 2010 // document.activeElement from an <iframe> 2011 if (!activeElement.nodeName) { 2012 activeElement = document.body; 2013 } 2014 2015 return activeElement; 2016 }; 2017 2018 2019 2020 var safeBlur = $.ui.safeBlur = function (element) { 2021 2022 // Support: IE9 - 10 only 2023 // If the <body> is blurred, IE will switch windows, see #9420 2024 if (element && element.nodeName.toLowerCase() !== "body") { 2025 $(element).trigger("blur"); 2026 } 2027 }; 2028 2029 2030 /*! 2031 * jQuery UI Draggable 1.13.2 2032 * http://jqueryui.com 2033 * 2034 * Copyright jQuery Foundation and other contributors 2035 * Released under the MIT license. 2036 * http://jquery.org/license 2037 */ 2038 2039 //>>label: Draggable 2040 //>>group: Interactions 2041 //>>description: Enables dragging functionality for any element. 2042 //>>docs: http://api.jqueryui.com/draggable/ 2043 //>>demos: http://jqueryui.com/draggable/ 2044 //>>css.structure: ../../themes/base/draggable.css 2045 2046 2047 $.widget("ui.draggable", $.ui.mouse, { 2048 version: "1.13.2", 2049 widgetEventPrefix: "drag", 2050 options: { 2051 addClasses: true, 2052 appendTo: "parent", 2053 axis: false, 2054 connectToSortable: false, 2055 containment: false, 2056 cursor: "auto", 2057 cursorAt: false, 2058 grid: false, 2059 handle: false, 2060 helper: "original", 2061 iframeFix: false, 2062 opacity: false, 2063 refreshPositions: false, 2064 revert: false, 2065 revertDuration: 500, 2066 scope: "default", 2067 scroll: true, 2068 scrollSensitivity: 20, 2069 scrollSpeed: 20, 2070 snap: false, 2071 snapMode: "both", 2072 snapTolerance: 20, 2073 stack: false, 2074 zIndex: false, 2075 2076 // Callbacks 2077 drag: null, 2078 start: null, 2079 stop: null 2080 }, 2081 _create: function () { 2082 2083 if (this.options.helper === "original") { 2084 this._setPositionRelative(); 2085 } 2086 if (this.options.addClasses) { 2087 this._addClass("ui-draggable"); 2088 } 2089 this._setHandleClassName(); 2090 2091 this._mouseInit(); 2092 }, 2093 2094 _setOption: function (key, value) { 2095 this._super(key, value); 2096 if (key === "handle") { 2097 this._removeHandleClassName(); 2098 this._setHandleClassName(); 2099 } 2100 }, 2101 2102 _destroy: function () { 2103 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 2104 this.destroyOnClear = true; 2105 return; 2106 } 2107 this._removeHandleClassName(); 2108 this._mouseDestroy(); 2109 }, 2110 2111 _mouseCapture: function (event) { 2112 var o = this.options; 2113 2114 // Among others, prevent a drag on a resizable-handle 2115 if (this.helper || o.disabled || 2116 $(event.target).closest(".ui-resizable-handle").length > 0) { 2117 return false; 2118 } 2119 2120 //Quit if we're not on a valid handle 2121 this.handle = this._getHandle(event); 2122 if (!this.handle) { 2123 return false; 2124 } 2125 2126 this._blurActiveElement(event); 2127 2128 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 2129 2130 return true; 2131 2132 }, 2133 2134 _blockFrames: function (selector) { 2135 this.iframeBlocks = this.document.find(selector).map(function () { 2136 var iframe = $(this); 2137 2138 return $("<div>") 2139 .css("position", "absolute") 2140 .appendTo(iframe.parent()) 2141 .outerWidth(iframe.outerWidth()) 2142 .outerHeight(iframe.outerHeight()) 2143 .offset(iframe.offset())[0]; 2144 }); 2145 }, 2146 2147 _unblockFrames: function () { 2148 if (this.iframeBlocks) { 2149 this.iframeBlocks.remove(); 2150 delete this.iframeBlocks; 2151 } 2152 }, 2153 2154 _blurActiveElement: function (event) { 2155 var activeElement = $.ui.safeActiveElement(this.document[0]), 2156 target = $(event.target); 2157 2158 // Don't blur if the event occurred on an element that is within 2159 // the currently focused element 2160 // See #10527, #12472 2161 if (target.closest(activeElement).length) { 2162 return; 2163 } 2164 2165 // Blur any element that currently has focus, see #4261 2166 $.ui.safeBlur(activeElement); 2167 }, 2168 2169 _mouseStart: function (event) { 2170 2171 var o = this.options; 2172 2173 //Create and append the visible helper 2174 this.helper = this._createHelper(event); 2175 2176 this._addClass(this.helper, "ui-draggable-dragging"); 2177 2178 //Cache the helper size 2179 this._cacheHelperProportions(); 2180 2181 //If ddmanager is used for droppables, set the global draggable 2182 if ($.ui.ddmanager) { 2183 $.ui.ddmanager.current = this; 2184 } 2185 2186 /* 2187 * - Position generation - 2188 * This block generates everything position related - it's the core of draggables. 2189 */ 2190 2191 //Cache the margins of the original element 2192 this._cacheMargins(); 2193 2194 //Store the helper's css position 2195 this.cssPosition = this.helper.css("position"); 2196 this.scrollParent = this.helper.scrollParent(true); 2197 this.offsetParent = this.helper.offsetParent(); 2198 this.hasFixedAncestor = this.helper.parents().filter(function () { 2199 return $(this).css("position") === "fixed"; 2200 }).length > 0;
vendor: 40,924 bytes, lines 2201-3607
2201 2202 //The element's absolute position on the page minus margins 2203 this.positionAbs = this.element.offset(); 2204 this._refreshOffsets(event); 2205 2206 //Generate the original position 2207 this.originalPosition = this.position = this._generatePosition(event, false); 2208 this.originalPageX = event.pageX; 2209 this.originalPageY = event.pageY; 2210 2211 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2212 if (o.cursorAt) { 2213 this._adjustOffsetFromHelper(o.cursorAt); 2214 } 2215 2216 //Set a containment if given in the options 2217 this._setContainment(); 2218 2219 //Trigger event + callbacks 2220 if (this._trigger("start", event) === false) { 2221 this._clear(); 2222 return false; 2223 } 2224 2225 //Recache the helper size 2226 this._cacheHelperProportions(); 2227 2228 //Prepare the droppable offsets 2229 if ($.ui.ddmanager && !o.dropBehaviour) { 2230 $.ui.ddmanager.prepareOffsets(this, event); 2231 } 2232 2233 // Execute the drag once - this causes the helper not to be visible before getting its 2234 // correct position 2235 this._mouseDrag(event, true); 2236 2237 // If the ddmanager is used for droppables, inform the manager that dragging has started 2238 // (see #5003) 2239 if ($.ui.ddmanager) { 2240 $.ui.ddmanager.dragStart(this, event); 2241 } 2242 2243 return true; 2244 }, 2245 2246 _refreshOffsets: function (event) { 2247 this.offset = { 2248 top: this.positionAbs.top - this.margins.top, 2249 left: this.positionAbs.left - this.margins.left, 2250 scroll: false, 2251 parent: this._getParentOffset(), 2252 relative: this._getRelativeOffset() 2253 }; 2254 2255 this.offset.click = { 2256 left: event.pageX - this.offset.left, 2257 top: event.pageY - this.offset.top 2258 }; 2259 }, 2260 2261 _mouseDrag: function (event, noPropagation) { 2262 2263 // reset any necessary cached properties (see #5009) 2264 if (this.hasFixedAncestor) { 2265 this.offset.parent = this._getParentOffset(); 2266 } 2267 2268 //Compute the helpers position 2269 this.position = this._generatePosition(event, true); 2270 this.positionAbs = this._convertPositionTo("absolute"); 2271 2272 //Call plugins and callbacks and use the resulting position if something is returned 2273 if (!noPropagation) { 2274 var ui = this._uiHash(); 2275 if (this._trigger("drag", event, ui) === false) { 2276 this._mouseUp(new $.Event("mouseup", event)); 2277 return false; 2278 } 2279 this.position = ui.position; 2280 } 2281 2282 this.helper[0].style.left = this.position.left + "px"; 2283 this.helper[0].style.top = this.position.top + "px"; 2284 2285 if ($.ui.ddmanager) { 2286 $.ui.ddmanager.drag(this, event); 2287 } 2288 2289 return false; 2290 }, 2291 2292 _mouseStop: function (event) { 2293 2294 //If we are using droppables, inform the manager about the drop 2295 var that = this, 2296 dropped = false; 2297 if ($.ui.ddmanager && !this.options.dropBehaviour) { 2298 dropped = $.ui.ddmanager.drop(this, event); 2299 } 2300 2301 //if a drop comes from outside (a sortable) 2302 if (this.dropped) { 2303 dropped = this.dropped; 2304 this.dropped = false; 2305 } 2306 2307 if ((this.options.revert === "invalid" && !dropped) || 2308 (this.options.revert === "valid" && dropped) || 2309 this.options.revert === true || (typeof this.options.revert === "function" && 2310 this.options.revert.call(this.element, dropped)) 2311 ) { 2312 $(this.helper).animate( 2313 this.originalPosition, 2314 parseInt(this.options.revertDuration, 10), 2315 function () { 2316 if (that._trigger("stop", event) !== false) { 2317 that._clear(); 2318 } 2319 } 2320 ); 2321 } else { 2322 if (this._trigger("stop", event) !== false) { 2323 this._clear(); 2324 } 2325 } 2326 2327 return false; 2328 }, 2329 2330 _mouseUp: function (event) { 2331 this._unblockFrames(); 2332 2333 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2334 // (see #5003) 2335 if ($.ui.ddmanager) { 2336 $.ui.ddmanager.dragStop(this, event); 2337 } 2338 2339 // Only need to focus if the event occurred on the draggable itself, see #10527 2340 if (this.handleElement.is(event.target)) { 2341 2342 // The interaction is over; whether or not the click resulted in a drag, 2343 // focus the element 2344 this.element.trigger("focus"); 2345 } 2346 2347 return $.ui.mouse.prototype._mouseUp.call(this, event); 2348 }, 2349 2350 cancel: function () { 2351 2352 if (this.helper.is(".ui-draggable-dragging")) { 2353 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 2354 } else { 2355 this._clear(); 2356 } 2357 2358 return this; 2359 2360 }, 2361 2362 _getHandle: function (event) { 2363 return this.options.handle ? 2364 !!$(event.target).closest(this.element.find(this.options.handle)).length : 2365 true; 2366 }, 2367 2368 _setHandleClassName: function () { 2369 this.handleElement = this.options.handle ? 2370 this.element.find(this.options.handle) : this.element; 2371 this._addClass(this.handleElement, "ui-draggable-handle"); 2372 }, 2373 2374 _removeHandleClassName: function () { 2375 this._removeClass(this.handleElement, "ui-draggable-handle"); 2376 }, 2377 2378 _createHelper: function (event) { 2379 2380 var o = this.options, 2381 helperIsFunction = typeof o.helper === "function", 2382 helper = helperIsFunction ? 2383 $(o.helper.apply(this.element[0], [event])) : 2384 (o.helper === "clone" ? 2385 this.element.clone().removeAttr("id") : 2386 this.element); 2387 2388 if (!helper.parents("body").length) { 2389 helper.appendTo((o.appendTo === "parent" ? 2390 this.element[0].parentNode : 2391 o.appendTo)); 2392 } 2393 2394 // Http://bugs.jqueryui.com/ticket/9446 2395 // a helper function can return the original element 2396 // which wouldn't have been set to relative in _create 2397 if (helperIsFunction && helper[0] === this.element[0]) { 2398 this._setPositionRelative(); 2399 } 2400 2401 if (helper[0] !== this.element[0] && 2402 !(/(fixed|absolute)/).test(helper.css("position"))) { 2403 helper.css("position", "absolute"); 2404 } 2405 2406 return helper; 2407 2408 }, 2409 2410 _setPositionRelative: function () { 2411 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 2412 this.element[0].style.position = "relative"; 2413 } 2414 }, 2415 2416 _adjustOffsetFromHelper: function (obj) { 2417 if (typeof obj === "string") { 2418 obj = obj.split(" "); 2419 } 2420 if (Array.isArray(obj)) { 2421 obj = { left: +obj[0], top: +obj[1] || 0 }; 2422 } 2423 if ("left" in obj) { 2424 this.offset.click.left = obj.left + this.margins.left; 2425 } 2426 if ("right" in obj) { 2427 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2428 } 2429 if ("top" in obj) { 2430 this.offset.click.top = obj.top + this.margins.top; 2431 } 2432 if ("bottom" in obj) { 2433 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2434 } 2435 }, 2436 2437 _isRootNode: function (element) { 2438 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 2439 }, 2440 2441 _getParentOffset: function () { 2442 2443 //Get the offsetParent and cache its position 2444 var po = this.offsetParent.offset(), 2445 document = this.document[0]; 2446 2447 // This is a special case where we need to modify a offset calculated on start, since the 2448 // following happened: 2449 // 1. The position of the helper is absolute, so it's position is calculated based on the 2450 // next positioned parent 2451 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2452 // the document, which means that the scroll is included in the initial calculation of the 2453 // offset of the parent, and never recalculated upon drag 2454 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 2455 $.contains(this.scrollParent[0], this.offsetParent[0])) { 2456 po.left += this.scrollParent.scrollLeft(); 2457 po.top += this.scrollParent.scrollTop(); 2458 } 2459 2460 if (this._isRootNode(this.offsetParent[0])) { 2461 po = { top: 0, left: 0 }; 2462 } 2463 2464 return { 2465 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 2466 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 2467 }; 2468 2469 }, 2470 2471 _getRelativeOffset: function () { 2472 if (this.cssPosition !== "relative") { 2473 return { top: 0, left: 0 }; 2474 } 2475 2476 var p = this.element.position(), 2477 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2478 2479 return { 2480 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 2481 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 2482 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 2483 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 2484 }; 2485 2486 }, 2487 2488 _cacheMargins: function () { 2489 this.margins = { 2490 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 2491 top: (parseInt(this.element.css("marginTop"), 10) || 0), 2492 right: (parseInt(this.element.css("marginRight"), 10) || 0), 2493 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 2494 }; 2495 }, 2496 2497 _cacheHelperProportions: function () { 2498 this.helperProportions = { 2499 width: this.helper.outerWidth(), 2500 height: this.helper.outerHeight() 2501 }; 2502 }, 2503 2504 _setContainment: function () { 2505 2506 var isUserScrollable, c, ce, 2507 o = this.options, 2508 document = this.document[0]; 2509 2510 this.relativeContainer = null; 2511 2512 if (!o.containment) { 2513 this.containment = null; 2514 return; 2515 } 2516 2517 if (o.containment === "window") { 2518 this.containment = [ 2519 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2520 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2521 $(window).scrollLeft() + $(window).width() - 2522 this.helperProportions.width - this.margins.left, 2523 $(window).scrollTop() + 2524 ($(window).height() || document.body.parentNode.scrollHeight) - 2525 this.helperProportions.height - this.margins.top 2526 ]; 2527 return; 2528 } 2529 2530 if (o.containment === "document") { 2531 this.containment = [ 2532 0, 2533 0, 2534 $(document).width() - this.helperProportions.width - this.margins.left, 2535 ($(document).height() || document.body.parentNode.scrollHeight) - 2536 this.helperProportions.height - this.margins.top 2537 ]; 2538 return; 2539 } 2540 2541 if (o.containment.constructor === Array) { 2542 this.containment = o.containment; 2543 return; 2544 } 2545 2546 if (o.containment === "parent") { 2547 o.containment = this.helper[0].parentNode; 2548 } 2549 2550 c = $(o.containment); 2551 ce = c[0]; 2552 2553 if (!ce) { 2554 return; 2555 } 2556 2557 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 2558 2559 this.containment = [ 2560 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 2561 (parseInt(c.css("paddingLeft"), 10) || 0), 2562 (parseInt(c.css("borderTopWidth"), 10) || 0) + 2563 (parseInt(c.css("paddingTop"), 10) || 0), 2564 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 2565 (parseInt(c.css("borderRightWidth"), 10) || 0) - 2566 (parseInt(c.css("paddingRight"), 10) || 0) - 2567 this.helperProportions.width - 2568 this.margins.left - 2569 this.margins.right, 2570 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 2571 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 2572 (parseInt(c.css("paddingBottom"), 10) || 0) - 2573 this.helperProportions.height - 2574 this.margins.top - 2575 this.margins.bottom 2576 ]; 2577 this.relativeContainer = c; 2578 }, 2579 2580 _convertPositionTo: function (d, pos) { 2581 2582 if (!pos) { 2583 pos = this.position; 2584 } 2585 2586 var mod = d === "absolute" ? 1 : -1, 2587 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 2588 2589 return { 2590 top: ( 2591 2592 // The absolute mouse position 2593 pos.top + 2594 2595 // Only for relative positioned nodes: Relative offset from element to offset parent 2596 this.offset.relative.top * mod + 2597 2598 // The offsetParent's offset without borders (offset + border) 2599 this.offset.parent.top * mod - 2600 ((this.cssPosition === "fixed" ? 2601 -this.offset.scroll.top : 2602 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 2603 ), 2604 left: ( 2605 2606 // The absolute mouse position 2607 pos.left + 2608 2609 // Only for relative positioned nodes: Relative offset from element to offset parent 2610 this.offset.relative.left * mod + 2611 2612 // The offsetParent's offset without borders (offset + border) 2613 this.offset.parent.left * mod - 2614 ((this.cssPosition === "fixed" ? 2615 -this.offset.scroll.left : 2616 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 2617 ) 2618 }; 2619 2620 }, 2621 2622 _generatePosition: function (event, constrainPosition) { 2623 2624 var containment, co, top, left, 2625 o = this.options, 2626 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 2627 pageX = event.pageX, 2628 pageY = event.pageY; 2629 2630 // Cache the scroll 2631 if (!scrollIsRootNode || !this.offset.scroll) { 2632 this.offset.scroll = { 2633 top: this.scrollParent.scrollTop(), 2634 left: this.scrollParent.scrollLeft() 2635 }; 2636 } 2637 2638 /* 2639 * - Position constraining - 2640 * Constrain the position to a mix of grid, containment. 2641 */ 2642 2643 // If we are not dragging yet, we won't check for options 2644 if (constrainPosition) { 2645 if (this.containment) { 2646 if (this.relativeContainer) { 2647 co = this.relativeContainer.offset(); 2648 containment = [ 2649 this.containment[0] + co.left, 2650 this.containment[1] + co.top, 2651 this.containment[2] + co.left, 2652 this.containment[3] + co.top 2653 ]; 2654 } else { 2655 containment = this.containment; 2656 } 2657 2658 if (event.pageX - this.offset.click.left < containment[0]) { 2659 pageX = containment[0] + this.offset.click.left; 2660 } 2661 if (event.pageY - this.offset.click.top < containment[1]) { 2662 pageY = containment[1] + this.offset.click.top; 2663 } 2664 if (event.pageX - this.offset.click.left > containment[2]) { 2665 pageX = containment[2] + this.offset.click.left; 2666 } 2667 if (event.pageY - this.offset.click.top > containment[3]) { 2668 pageY = containment[3] + this.offset.click.top; 2669 } 2670 } 2671 2672 if (o.grid) { 2673 2674 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2675 // argument errors in IE (see ticket #6950) 2676 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 2677 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 2678 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 2679 top - this.offset.click.top > containment[3]) ? 2680 top : 2681 ((top - this.offset.click.top >= containment[1]) ? 2682 top - o.grid[1] : top + o.grid[1])) : top; 2683 2684 left = o.grid[0] ? this.originalPageX + 2685 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 2686 this.originalPageX; 2687 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 2688 left - this.offset.click.left > containment[2]) ? 2689 left : 2690 ((left - this.offset.click.left >= containment[0]) ? 2691 left - o.grid[0] : left + o.grid[0])) : left; 2692 } 2693 2694 if (o.axis === "y") { 2695 pageX = this.originalPageX; 2696 } 2697 2698 if (o.axis === "x") { 2699 pageY = this.originalPageY; 2700 } 2701 } 2702 2703 return { 2704 top: ( 2705 2706 // The absolute mouse position 2707 pageY - 2708 2709 // Click offset (relative to the element) 2710 this.offset.click.top - 2711 2712 // Only for relative positioned nodes: Relative offset from element to offset parent 2713 this.offset.relative.top - 2714 2715 // The offsetParent's offset without borders (offset + border) 2716 this.offset.parent.top + 2717 (this.cssPosition === "fixed" ? 2718 -this.offset.scroll.top : 2719 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 2720 ), 2721 left: ( 2722 2723 // The absolute mouse position 2724 pageX - 2725 2726 // Click offset (relative to the element) 2727 this.offset.click.left - 2728 2729 // Only for relative positioned nodes: Relative offset from element to offset parent 2730 this.offset.relative.left - 2731 2732 // The offsetParent's offset without borders (offset + border) 2733 this.offset.parent.left + 2734 (this.cssPosition === "fixed" ? 2735 -this.offset.scroll.left : 2736 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 2737 ) 2738 }; 2739 2740 }, 2741 2742 _clear: function () { 2743 this._removeClass(this.helper, "ui-draggable-dragging"); 2744 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 2745 this.helper.remove(); 2746 } 2747 this.helper = null; 2748 this.cancelHelperRemoval = false; 2749 if (this.destroyOnClear) { 2750 this.destroy(); 2751 } 2752 }, 2753 2754 // From now on bulk stuff - mainly helpers 2755 2756 _trigger: function (type, event, ui) { 2757 ui = ui || this._uiHash(); 2758 $.ui.plugin.call(this, type, [event, ui, this], true); 2759 2760 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2761 if (/^(drag|start|stop)/.test(type)) { 2762 this.positionAbs = this._convertPositionTo("absolute"); 2763 ui.offset = this.positionAbs; 2764 } 2765 return $.Widget.prototype._trigger.call(this, type, event, ui); 2766 }, 2767 2768 plugins: {}, 2769 2770 _uiHash: function () { 2771 return { 2772 helper: this.helper, 2773 position: this.position, 2774 originalPosition: this.originalPosition, 2775 offset: this.positionAbs 2776 }; 2777 } 2778 2779 }); 2780 2781 $.ui.plugin.add("draggable", "connectToSortable", { 2782 start: function (event, ui, draggable) { 2783 var uiSortable = $.extend({}, ui, { 2784 item: draggable.element 2785 }); 2786 2787 draggable.sortables = []; 2788 $(draggable.options.connectToSortable).each(function () { 2789 var sortable = $(this).sortable("instance"); 2790 2791 if (sortable && !sortable.options.disabled) { 2792 draggable.sortables.push(sortable); 2793 2794 // RefreshPositions is called at drag start to refresh the containerCache 2795 // which is used in drag. This ensures it's initialized and synchronized 2796 // with any changes that might have happened on the page since initialization. 2797 sortable.refreshPositions(); 2798 sortable._trigger("activate", event, uiSortable); 2799 } 2800 }); 2801 }, 2802 stop: function (event, ui, draggable) { 2803 var uiSortable = $.extend({}, ui, { 2804 item: draggable.element 2805 }); 2806 2807 draggable.cancelHelperRemoval = false; 2808 2809 $.each(draggable.sortables, function () { 2810 var sortable = this; 2811 2812 if (sortable.isOver) { 2813 sortable.isOver = 0; 2814 2815 // Allow this sortable to handle removing the helper 2816 draggable.cancelHelperRemoval = true; 2817 sortable.cancelHelperRemoval = false; 2818 2819 // Use _storedCSS To restore properties in the sortable, 2820 // as this also handles revert (#9675) since the draggable 2821 // may have modified them in unexpected ways (#8809) 2822 sortable._storedCSS = { 2823 position: sortable.placeholder.css("position"), 2824 top: sortable.placeholder.css("top"), 2825 left: sortable.placeholder.css("left") 2826 }; 2827 2828 sortable._mouseStop(event); 2829 2830 // Once drag has ended, the sortable should return to using 2831 // its original helper, not the shared helper from draggable 2832 sortable.options.helper = sortable.options._helper; 2833 } else { 2834 2835 // Prevent this Sortable from removing the helper. 2836 // However, don't set the draggable to remove the helper 2837 // either as another connected Sortable may yet handle the removal. 2838 sortable.cancelHelperRemoval = true; 2839 2840 sortable._trigger("deactivate", event, uiSortable); 2841 } 2842 }); 2843 }, 2844 drag: function (event, ui, draggable) { 2845 $.each(draggable.sortables, function () { 2846 var innermostIntersecting = false, 2847 sortable = this; 2848 2849 // Copy over variables that sortable's _intersectsWith uses 2850 sortable.positionAbs = draggable.positionAbs; 2851 sortable.helperProportions = draggable.helperProportions; 2852 sortable.offset.click = draggable.offset.click; 2853 2854 if (sortable._intersectsWith(sortable.containerCache)) { 2855 innermostIntersecting = true; 2856 2857 $.each(draggable.sortables, function () { 2858 2859 // Copy over variables that sortable's _intersectsWith uses 2860 this.positionAbs = draggable.positionAbs; 2861 this.helperProportions = draggable.helperProportions; 2862 this.offset.click = draggable.offset.click; 2863 2864 if (this !== sortable && 2865 this._intersectsWith(this.containerCache) && 2866 $.contains(sortable.element[0], this.element[0])) { 2867 innermostIntersecting = false; 2868 } 2869 2870 return innermostIntersecting; 2871 }); 2872 } 2873 2874 if (innermostIntersecting) { 2875 2876 // If it intersects, we use a little isOver variable and set it once, 2877 // so that the move-in stuff gets fired only once. 2878 if (!sortable.isOver) { 2879 sortable.isOver = 1; 2880 2881 // Store draggable's parent in case we need to reappend to it later. 2882 draggable._parent = ui.helper.parent(); 2883 2884 sortable.currentItem = ui.helper 2885 .appendTo(sortable.element) 2886 .data("ui-sortable-item", true); 2887 2888 // Store helper option to later restore it 2889 sortable.options._helper = sortable.options.helper; 2890 2891 sortable.options.helper = function () { 2892 return ui.helper[0]; 2893 }; 2894 2895 // Fire the start events of the sortable with our passed browser event, 2896 // and our own helper (so it doesn't create a new one) 2897 event.target = sortable.currentItem[0]; 2898 sortable._mouseCapture(event, true); 2899 sortable._mouseStart(event, true, true); 2900 2901 // Because the browser event is way off the new appended portlet, 2902 // modify necessary variables to reflect the changes 2903 sortable.offset.click.top = draggable.offset.click.top; 2904 sortable.offset.click.left = draggable.offset.click.left; 2905 sortable.offset.parent.left -= draggable.offset.parent.left - 2906 sortable.offset.parent.left; 2907 sortable.offset.parent.top -= draggable.offset.parent.top - 2908 sortable.offset.parent.top; 2909 2910 draggable._trigger("toSortable", event); 2911 2912 // Inform draggable that the helper is in a valid drop zone, 2913 // used solely in the revert option to handle "valid/invalid". 2914 draggable.dropped = sortable.element; 2915 2916 // Need to refreshPositions of all sortables in the case that 2917 // adding to one sortable changes the location of the other sortables (#9675) 2918 $.each(draggable.sortables, function () { 2919 this.refreshPositions(); 2920 }); 2921 2922 // Hack so receive/update callbacks work (mostly) 2923 draggable.currentItem = draggable.element; 2924 sortable.fromOutside = draggable; 2925 } 2926 2927 if (sortable.currentItem) { 2928 sortable._mouseDrag(event); 2929 2930 // Copy the sortable's position because the draggable's can potentially reflect 2931 // a relative position, while sortable is always absolute, which the dragged 2932 // element has now become. (#8809) 2933 ui.position = sortable.position; 2934 } 2935 } else { 2936 2937 // If it doesn't intersect with the sortable, and it intersected before, 2938 // we fake the drag stop of the sortable, but make sure it doesn't remove 2939 // the helper by using cancelHelperRemoval. 2940 if (sortable.isOver) { 2941 2942 sortable.isOver = 0; 2943 sortable.cancelHelperRemoval = true; 2944 2945 // Calling sortable's mouseStop would trigger a revert, 2946 // so revert must be temporarily false until after mouseStop is called. 2947 sortable.options._revert = sortable.options.revert; 2948 sortable.options.revert = false; 2949 2950 sortable._trigger("out", event, sortable._uiHash(sortable)); 2951 sortable._mouseStop(event, true); 2952 2953 // Restore sortable behaviors that were modfied 2954 // when the draggable entered the sortable area (#9481) 2955 sortable.options.revert = sortable.options._revert; 2956 sortable.options.helper = sortable.options._helper; 2957 2958 if (sortable.placeholder) { 2959 sortable.placeholder.remove(); 2960 } 2961 2962 // Restore and recalculate the draggable's offset considering the sortable 2963 // may have modified them in unexpected ways. (#8809, #10669) 2964 ui.helper.appendTo(draggable._parent); 2965 draggable._refreshOffsets(event); 2966 ui.position = draggable._generatePosition(event, true); 2967 2968 draggable._trigger("fromSortable", event); 2969 2970 // Inform draggable that the helper is no longer in a valid drop zone 2971 draggable.dropped = false; 2972 2973 // Need to refreshPositions of all sortables just in case removing 2974 // from one sortable changes the location of other sortables (#9675) 2975 $.each(draggable.sortables, function () { 2976 this.refreshPositions(); 2977 }); 2978 } 2979 } 2980 }); 2981 } 2982 }); 2983 2984 $.ui.plugin.add("draggable", "cursor", { 2985 start: function (event, ui, instance) { 2986 var t = $("body"), 2987 o = instance.options; 2988 2989 if (t.css("cursor")) { 2990 o._cursor = t.css("cursor"); 2991 } 2992 t.css("cursor", o.cursor); 2993 }, 2994 stop: function (event, ui, instance) { 2995 var o = instance.options; 2996 if (o._cursor) { 2997 $("body").css("cursor", o._cursor); 2998 } 2999 } 3000 }); 3001 3002 $.ui.plugin.add("draggable", "opacity", { 3003 start: function (event, ui, instance) { 3004 var t = $(ui.helper), 3005 o = instance.options; 3006 if (t.css("opacity")) { 3007 o._opacity = t.css("opacity"); 3008 } 3009 t.css("opacity", o.opacity); 3010 }, 3011 stop: function (event, ui, instance) { 3012 var o = instance.options; 3013 if (o._opacity) { 3014 $(ui.helper).css("opacity", o._opacity); 3015 } 3016 } 3017 }); 3018 3019 $.ui.plugin.add("draggable", "scroll", { 3020 start: function (event, ui, i) { 3021 if (!i.scrollParentNotHidden) { 3022 i.scrollParentNotHidden = i.helper.scrollParent(false); 3023 } 3024 3025 if (i.scrollParentNotHidden[0] !== i.document[0] && 3026 i.scrollParentNotHidden[0].tagName !== "HTML") { 3027 i.overflowOffset = i.scrollParentNotHidden.offset(); 3028 } 3029 }, 3030 drag: function (event, ui, i) { 3031 3032 var o = i.options, 3033 scrolled = false, 3034 scrollParent = i.scrollParentNotHidden[0], 3035 document = i.document[0]; 3036 3037 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 3038 if (!o.axis || o.axis !== "x") { 3039 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 3040 o.scrollSensitivity) { 3041 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 3042 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 3043 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 3044 } 3045 } 3046 3047 if (!o.axis || o.axis !== "y") { 3048 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 3049 o.scrollSensitivity) { 3050 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 3051 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 3052 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 3053 } 3054 } 3055 3056 } else { 3057 3058 if (!o.axis || o.axis !== "x") { 3059 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 3060 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 3061 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 3062 o.scrollSensitivity) { 3063 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 3064 } 3065 } 3066 3067 if (!o.axis || o.axis !== "y") { 3068 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 3069 scrolled = $(document).scrollLeft( 3070 $(document).scrollLeft() - o.scrollSpeed 3071 ); 3072 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 3073 o.scrollSensitivity) { 3074 scrolled = $(document).scrollLeft( 3075 $(document).scrollLeft() + o.scrollSpeed 3076 ); 3077 } 3078 } 3079 3080 } 3081 3082 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 3083 $.ui.ddmanager.prepareOffsets(i, event); 3084 } 3085 3086 } 3087 }); 3088 3089 $.ui.plugin.add("draggable", "snap", { 3090 start: function (event, ui, i) { 3091 3092 var o = i.options; 3093 3094 i.snapElements = []; 3095 3096 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 3097 .each(function () { 3098 var $t = $(this), 3099 $o = $t.offset(); 3100 if (this !== i.element[0]) { 3101 i.snapElements.push({ 3102 item: this, 3103 width: $t.outerWidth(), height: $t.outerHeight(), 3104 top: $o.top, left: $o.left 3105 }); 3106 } 3107 }); 3108 3109 }, 3110 drag: function (event, ui, inst) { 3111 3112 var ts, bs, ls, rs, l, r, t, b, i, first, 3113 o = inst.options, 3114 d = o.snapTolerance, 3115 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 3116 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 3117 3118 for (i = inst.snapElements.length - 1; i >= 0; i--) { 3119 3120 l = inst.snapElements[i].left - inst.margins.left; 3121 r = l + inst.snapElements[i].width; 3122 t = inst.snapElements[i].top - inst.margins.top; 3123 b = t + inst.snapElements[i].height; 3124 3125 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 3126 !$.contains(inst.snapElements[i].item.ownerDocument, 3127 inst.snapElements[i].item)) { 3128 if (inst.snapElements[i].snapping) { 3129 if (inst.options.snap.release) { 3130 inst.options.snap.release.call( 3131 inst.element, 3132 event, 3133 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 3134 ); 3135 } 3136 } 3137 inst.snapElements[i].snapping = false; 3138 continue; 3139 } 3140 3141 if (o.snapMode !== "inner") { 3142 ts = Math.abs(t - y2) <= d; 3143 bs = Math.abs(b - y1) <= d; 3144 ls = Math.abs(l - x2) <= d; 3145 rs = Math.abs(r - x1) <= d; 3146 if (ts) { 3147 ui.position.top = inst._convertPositionTo("relative", { 3148 top: t - inst.helperProportions.height, 3149 left: 0 3150 }).top; 3151 } 3152 if (bs) { 3153 ui.position.top = inst._convertPositionTo("relative", { 3154 top: b, 3155 left: 0 3156 }).top; 3157 } 3158 if (ls) { 3159 ui.position.left = inst._convertPositionTo("relative", { 3160 top: 0, 3161 left: l - inst.helperProportions.width 3162 }).left; 3163 } 3164 if (rs) { 3165 ui.position.left = inst._convertPositionTo("relative", { 3166 top: 0, 3167 left: r 3168 }).left; 3169 } 3170 } 3171 3172 first = (ts || bs || ls || rs); 3173 3174 if (o.snapMode !== "outer") { 3175 ts = Math.abs(t - y1) <= d; 3176 bs = Math.abs(b - y2) <= d; 3177 ls = Math.abs(l - x1) <= d; 3178 rs = Math.abs(r - x2) <= d; 3179 if (ts) { 3180 ui.position.top = inst._convertPositionTo("relative", { 3181 top: t, 3182 left: 0 3183 }).top; 3184 } 3185 if (bs) { 3186 ui.position.top = inst._convertPositionTo("relative", { 3187 top: b - inst.helperProportions.height, 3188 left: 0 3189 }).top; 3190 } 3191 if (ls) { 3192 ui.position.left = inst._convertPositionTo("relative", { 3193 top: 0, 3194 left: l 3195 }).left; 3196 } 3197 if (rs) { 3198 ui.position.left = inst._convertPositionTo("relative", { 3199 top: 0, 3200 left: r - inst.helperProportions.width 3201 }).left; 3202 } 3203 } 3204 3205 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 3206 if (inst.options.snap.snap) { 3207 inst.options.snap.snap.call( 3208 inst.element, 3209 event, 3210 $.extend(inst._uiHash(), { 3211 snapItem: inst.snapElements[i].item 3212 })); 3213 } 3214 } 3215 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 3216 3217 } 3218 3219 } 3220 }); 3221 3222 $.ui.plugin.add("draggable", "stack", { 3223 start: function (event, ui, instance) { 3224 var min, 3225 o = instance.options, 3226 group = $.makeArray($(o.stack)).sort(function (a, b) { 3227 return (parseInt($(a).css("zIndex"), 10) || 0) - 3228 (parseInt($(b).css("zIndex"), 10) || 0); 3229 }); 3230 3231 if (!group.length) { 3232 return; 3233 } 3234 3235 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 3236 $(group).each(function (i) { 3237 $(this).css("zIndex", min + i); 3238 }); 3239 this.css("zIndex", (min + group.length)); 3240 } 3241 }); 3242 3243 $.ui.plugin.add("draggable", "zIndex", { 3244 start: function (event, ui, instance) { 3245 var t = $(ui.helper), 3246 o = instance.options; 3247 3248 if (t.css("zIndex")) { 3249 o._zIndex = t.css("zIndex"); 3250 } 3251 t.css("zIndex", o.zIndex); 3252 }, 3253 stop: function (event, ui, instance) { 3254 var o = instance.options; 3255 3256 if (o._zIndex) { 3257 $(ui.helper).css("zIndex", o._zIndex); 3258 } 3259 } 3260 }); 3261 3262 var widgetsDraggable = $.ui.draggable; 3263 3264 3265 /*! 3266 * jQuery UI Droppable 1.13.2 3267 * http://jqueryui.com 3268 * 3269 * Copyright jQuery Foundation and other contributors 3270 * Released under the MIT license. 3271 * http://jquery.org/license 3272 */ 3273 3274 //>>label: Droppable 3275 //>>group: Interactions 3276 //>>description: Enables drop targets for draggable elements. 3277 //>>docs: http://api.jqueryui.com/droppable/ 3278 //>>demos: http://jqueryui.com/droppable/ 3279 3280 3281 $.widget("ui.droppable", { 3282 version: "1.13.2", 3283 widgetEventPrefix: "drop", 3284 options: { 3285 accept: "*", 3286 addClasses: true, 3287 greedy: false, 3288 scope: "default", 3289 tolerance: "intersect", 3290 3291 // Callbacks 3292 activate: null, 3293 deactivate: null, 3294 drop: null, 3295 out: null, 3296 over: null 3297 }, 3298 _create: function () { 3299 3300 var proportions, 3301 o = this.options, 3302 accept = o.accept; 3303 3304 this.isover = false; 3305 this.isout = true; 3306 3307 this.accept = typeof accept === "function" ? accept : function (d) { 3308 return d.is(accept); 3309 }; 3310 3311 this.proportions = function ( /* valueToWrite */) { 3312 if (arguments.length) { 3313 3314 // Store the droppable's proportions 3315 proportions = arguments[0]; 3316 } else { 3317 3318 // Retrieve or derive the droppable's proportions 3319 return proportions ? 3320 proportions : 3321 proportions = { 3322 width: this.element[0].offsetWidth, 3323 height: this.element[0].offsetHeight 3324 }; 3325 } 3326 }; 3327 3328 this._addToManager(o.scope); 3329 3330 if (o.addClasses) { 3331 this._addClass("ui-droppable"); 3332 } 3333 3334 }, 3335 3336 _addToManager: function (scope) { 3337 3338 // Add the reference and positions to the manager 3339 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 3340 $.ui.ddmanager.droppables[scope].push(this); 3341 }, 3342 3343 _splice: function (drop) { 3344 var i = 0; 3345 for (; i < drop.length; i++) { 3346 if (drop[i] === this) { 3347 drop.splice(i, 1); 3348 } 3349 } 3350 }, 3351 3352 _destroy: function () { 3353 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3354 3355 this._splice(drop); 3356 }, 3357 3358 _setOption: function (key, value) { 3359 3360 if (key === "accept") { 3361 this.accept = typeof value === "function" ? value : function (d) { 3362 return d.is(value); 3363 }; 3364 } else if (key === "scope") { 3365 var drop = $.ui.ddmanager.droppables[this.options.scope]; 3366 3367 this._splice(drop); 3368 this._addToManager(value); 3369 } 3370 3371 this._super(key, value); 3372 }, 3373 3374 _activate: function (event) { 3375 var draggable = $.ui.ddmanager.current; 3376 3377 this._addActiveClass(); 3378 if (draggable) { 3379 this._trigger("activate", event, this.ui(draggable)); 3380 } 3381 }, 3382 3383 _deactivate: function (event) { 3384 var draggable = $.ui.ddmanager.current; 3385 3386 this._removeActiveClass(); 3387 if (draggable) { 3388 this._trigger("deactivate", event, this.ui(draggable)); 3389 } 3390 }, 3391 3392 _over: function (event) { 3393 3394 var draggable = $.ui.ddmanager.current; 3395 3396 // Bail if draggable and droppable are same element 3397 if (!draggable || (draggable.currentItem || 3398 draggable.element)[0] === this.element[0]) { 3399 return; 3400 } 3401 3402 if (this.accept.call(this.element[0], (draggable.currentItem || 3403 draggable.element))) { 3404 this._addHoverClass(); 3405 this._trigger("over", event, this.ui(draggable)); 3406 } 3407 3408 }, 3409 3410 _out: function (event) { 3411 3412 var draggable = $.ui.ddmanager.current; 3413 3414 // Bail if draggable and droppable are same element 3415 if (!draggable || (draggable.currentItem || 3416 draggable.element)[0] === this.element[0]) { 3417 return; 3418 } 3419 3420 if (this.accept.call(this.element[0], (draggable.currentItem || 3421 draggable.element))) { 3422 this._removeHoverClass(); 3423 this._trigger("out", event, this.ui(draggable)); 3424 } 3425 3426 }, 3427 3428 _drop: function (event, custom) { 3429 3430 var draggable = custom || $.ui.ddmanager.current, 3431 childrenIntersection = false; 3432 3433 // Bail if draggable and droppable are same element 3434 if (!draggable || (draggable.currentItem || 3435 draggable.element)[0] === this.element[0]) { 3436 return false; 3437 } 3438 3439 this.element 3440 .find(":data(ui-droppable)") 3441 .not(".ui-draggable-dragging") 3442 .each(function () { 3443 var inst = $(this).droppable("instance"); 3444 if ( 3445 inst.options.greedy && 3446 !inst.options.disabled && 3447 inst.options.scope === draggable.options.scope && 3448 inst.accept.call( 3449 inst.element[0], (draggable.currentItem || draggable.element) 3450 ) && 3451 $.ui.intersect( 3452 draggable, 3453 $.extend(inst, { offset: inst.element.offset() }), 3454 inst.options.tolerance, event 3455 ) 3456 ) { 3457 childrenIntersection = true; 3458 return false; 3459 } 3460 }); 3461 if (childrenIntersection) { 3462 return false; 3463 } 3464 3465 if (this.accept.call(this.element[0], 3466 (draggable.currentItem || draggable.element))) { 3467 this._removeActiveClass(); 3468 this._removeHoverClass(); 3469 3470 this._trigger("drop", event, this.ui(draggable)); 3471 return this.element; 3472 } 3473 3474 return false; 3475 3476 }, 3477 3478 ui: function (c) { 3479 return { 3480 draggable: (c.currentItem || c.element), 3481 helper: c.helper, 3482 position: c.position, 3483 offset: c.positionAbs 3484 }; 3485 }, 3486 3487 // Extension points just to make backcompat sane and avoid duplicating logic 3488 // TODO: Remove in 1.14 along with call to it below 3489 _addHoverClass: function () { 3490 this._addClass("ui-droppable-hover"); 3491 }, 3492 3493 _removeHoverClass: function () { 3494 this._removeClass("ui-droppable-hover"); 3495 }, 3496 3497 _addActiveClass: function () { 3498 this._addClass("ui-droppable-active"); 3499 }, 3500 3501 _removeActiveClass: function () { 3502 this._removeClass("ui-droppable-active"); 3503 } 3504 }); 3505 3506 $.ui.intersect = (function () { 3507 function isOverAxis(x, reference, size) { 3508 return (x >= reference) && (x < (reference + size)); 3509 } 3510 3511 return function (draggable, droppable, toleranceMode, event) { 3512 3513 if (!droppable.offset) { 3514 return false; 3515 } 3516 3517 var x1 = (draggable.positionAbs || 3518 draggable.position.absolute).left + draggable.margins.left, 3519 y1 = (draggable.positionAbs || 3520 draggable.position.absolute).top + draggable.margins.top, 3521 x2 = x1 + draggable.helperProportions.width, 3522 y2 = y1 + draggable.helperProportions.height, 3523 l = droppable.offset.left, 3524 t = droppable.offset.top, 3525 r = l + droppable.proportions().width, 3526 b = t + droppable.proportions().height; 3527 3528 switch (toleranceMode) { 3529 case "fit": 3530 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 3531 case "intersect": 3532 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 3533 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 3534 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 3535 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 3536 case "pointer": 3537 return isOverAxis(event.pageY, t, droppable.proportions().height) && 3538 isOverAxis(event.pageX, l, droppable.proportions().width); 3539 case "touch": 3540 return ( 3541 (y1 >= t && y1 <= b) || // Top edge touching 3542 (y2 >= t && y2 <= b) || // Bottom edge touching 3543 (y1 < t && y2 > b) // Surrounded vertically 3544 ) && ( 3545 (x1 >= l && x1 <= r) || // Left edge touching 3546 (x2 >= l && x2 <= r) || // Right edge touching 3547 (x1 < l && x2 > r) // Surrounded horizontally 3548 ); 3549 default: 3550 return false; 3551 } 3552 }; 3553 })(); 3554 3555 /* 3556 This manager tracks offsets of draggables and droppables 3557 */ 3558 $.ui.ddmanager = { 3559 current: null, 3560 droppables: { "default": [] }, 3561 prepareOffsets: function (t, event) { 3562 3563 var i, j, 3564 m = $.ui.ddmanager.droppables[t.options.scope] || [], 3565 type = event ? event.type : null, // workaround for #2317 3566 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 3567 3568 droppablesLoop: for (i = 0; i < m.length; i++) { 3569 3570 // No disabled and non-accepted 3571 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 3572 (t.currentItem || t.element)))) { 3573 continue; 3574 } 3575 3576 // Filter out elements in the current dragged item 3577 for (j = 0; j < list.length; j++) { 3578 if (list[j] === m[i].element[0]) { 3579 m[i].proportions().height = 0; 3580 continue droppablesLoop; 3581 } 3582 } 3583 3584 m[i].visible = m[i].element.css("display") !== "none"; 3585 if (!m[i].visible) { 3586 continue; 3587 } 3588 3589 // Activate the droppable if used directly from draggables 3590 if (type === "mousedown") { 3591 m[i]._activate.call(m[i], event); 3592 } 3593 3594 m[i].offset = m[i].element.offset(); 3595 m[i].proportions({ 3596 width: m[i].element[0].offsetWidth, 3597 height: m[i].element[0].offsetHeight 3598 }); 3599 3600 } 3601 3602 }, 3603 drop: function (draggable, event) { 3604 3605 var dropped = false; 3606 3607 // Create a copy of the droppables in case the list changes during the drop (#9116)
vendor: 22,499 bytes, lines 3608-4463
3608 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 3609 3610 if (!this.options) { 3611 return; 3612 } 3613 if (!this.options.disabled && this.visible && 3614 $.ui.intersect(draggable, this, this.options.tolerance, event)) { 3615 dropped = this._drop.call(this, event) || dropped; 3616 } 3617 3618 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 3619 (draggable.currentItem || draggable.element))) { 3620 this.isout = true; 3621 this.isover = false; 3622 this._deactivate.call(this, event); 3623 } 3624 3625 }); 3626 return dropped; 3627 3628 }, 3629 dragStart: function (draggable, event) { 3630 3631 // Listen for scrolling so that if the dragging causes scrolling the position of the 3632 // droppables can be recalculated (see #5003) 3633 draggable.element.parentsUntil("body").on("scroll.droppable", function () { 3634 if (!draggable.options.refreshPositions) { 3635 $.ui.ddmanager.prepareOffsets(draggable, event); 3636 } 3637 }); 3638 }, 3639 drag: function (draggable, event) { 3640 3641 // If you have a highly dynamic page, you might try this option. It renders positions 3642 // every time you move the mouse. 3643 if (draggable.options.refreshPositions) { 3644 $.ui.ddmanager.prepareOffsets(draggable, event); 3645 } 3646 3647 // Run through all droppables and check their positions based on specific tolerance options 3648 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 3649 3650 if (this.options.disabled || this.greedyChild || !this.visible) { 3651 return; 3652 } 3653 3654 var parentInstance, scope, parent, 3655 intersects = $.ui.intersect(draggable, this, this.options.tolerance, event), 3656 c = !intersects && this.isover ? 3657 "isout" : 3658 (intersects && !this.isover ? "isover" : null); 3659 if (!c) { 3660 return; 3661 } 3662 3663 if (this.options.greedy) { 3664 3665 // find droppable parents with same scope 3666 scope = this.options.scope; 3667 parent = this.element.parents(":data(ui-droppable)").filter(function () { 3668 return $(this).droppable("instance").options.scope === scope; 3669 }); 3670 3671 if (parent.length) { 3672 parentInstance = $(parent[0]).droppable("instance"); 3673 parentInstance.greedyChild = (c === "isover"); 3674 } 3675 } 3676 3677 // We just moved into a greedy child 3678 if (parentInstance && c === "isover") { 3679 parentInstance.isover = false; 3680 parentInstance.isout = true; 3681 parentInstance._out.call(parentInstance, event); 3682 } 3683 3684 this[c] = true; 3685 this[c === "isout" ? "isover" : "isout"] = false; 3686 this[c === "isover" ? "_over" : "_out"].call(this, event); 3687 3688 // We just moved out of a greedy child 3689 if (parentInstance && c === "isout") { 3690 parentInstance.isout = false; 3691 parentInstance.isover = true; 3692 parentInstance._over.call(parentInstance, event); 3693 } 3694 }); 3695 3696 }, 3697 dragStop: function (draggable, event) { 3698 draggable.element.parentsUntil("body").off("scroll.droppable"); 3699 3700 // Call prepareOffsets one final time since IE does not fire return scroll events when 3701 // overflow was caused by drag (see #5003) 3702 if (!draggable.options.refreshPositions) { 3703 $.ui.ddmanager.prepareOffsets(draggable, event); 3704 } 3705 } 3706 }; 3707 3708 // DEPRECATED 3709 // TODO: switch return back to widget declaration at top of file when this is removed 3710 if ($.uiBackCompat !== false) { 3711 3712 // Backcompat for activeClass and hoverClass options 3713 $.widget("ui.droppable", $.ui.droppable, { 3714 options: { 3715 hoverClass: false, 3716 activeClass: false 3717 }, 3718 _addActiveClass: function () { 3719 this._super(); 3720 if (this.options.activeClass) { 3721 this.element.addClass(this.options.activeClass); 3722 } 3723 }, 3724 _removeActiveClass: function () { 3725 this._super(); 3726 if (this.options.activeClass) { 3727 this.element.removeClass(this.options.activeClass); 3728 } 3729 }, 3730 _addHoverClass: function () { 3731 this._super(); 3732 if (this.options.hoverClass) { 3733 this.element.addClass(this.options.hoverClass); 3734 } 3735 }, 3736 _removeHoverClass: function () { 3737 this._super(); 3738 if (this.options.hoverClass) { 3739 this.element.removeClass(this.options.hoverClass); 3740 } 3741 } 3742 }); 3743 } 3744 3745 var widgetsDroppable = $.ui.droppable; 3746 3747 3748 /*! 3749 * jQuery UI Resizable 1.13.2 3750 * http://jqueryui.com 3751 * 3752 * Copyright jQuery Foundation and other contributors 3753 * Released under the MIT license. 3754 * http://jquery.org/license 3755 */ 3756 3757 //>>label: Resizable 3758 //>>group: Interactions 3759 //>>description: Enables resize functionality for any element. 3760 //>>docs: http://api.jqueryui.com/resizable/ 3761 //>>demos: http://jqueryui.com/resizable/ 3762 //>>css.structure: ../../themes/base/core.css 3763 //>>css.structure: ../../themes/base/resizable.css 3764 //>>css.theme: ../../themes/base/theme.css 3765 3766 3767 $.widget("ui.resizable", $.ui.mouse, { 3768 version: "1.13.2", 3769 widgetEventPrefix: "resize", 3770 options: { 3771 alsoResize: false, 3772 animate: false, 3773 animateDuration: "slow", 3774 animateEasing: "swing", 3775 aspectRatio: false, 3776 autoHide: false, 3777 classes: { 3778 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3779 }, 3780 containment: false, 3781 ghost: false, 3782 grid: false, 3783 handles: "e,s,se", 3784 helper: false, 3785 maxHeight: null, 3786 maxWidth: null, 3787 minHeight: 10, 3788 minWidth: 10, 3789 3790 // See #7960 3791 zIndex: 90, 3792 3793 // Callbacks 3794 resize: null, 3795 start: null, 3796 stop: null 3797 }, 3798 3799 _num: function (value) { 3800 return parseFloat(value) || 0; 3801 }, 3802 3803 _isNumber: function (value) { 3804 return !isNaN(parseFloat(value)); 3805 }, 3806 3807 _hasScroll: function (el, a) { 3808 3809 if ($(el).css("overflow") === "hidden") { 3810 return false; 3811 } 3812 3813 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 3814 has = false; 3815 3816 if (el[scroll] > 0) { 3817 return true; 3818 } 3819 3820 // TODO: determine which cases actually cause this to happen 3821 // if the element doesn't have the scroll set, see if it's possible to 3822 // set the scroll 3823 try { 3824 el[scroll] = 1; 3825 has = (el[scroll] > 0); 3826 el[scroll] = 0; 3827 } catch (e) { 3828 3829 // `el` might be a string, then setting `scroll` will throw 3830 // an error in strict mode; ignore it. 3831 } 3832 return has; 3833 }, 3834 3835 _create: function () { 3836 3837 var margins, 3838 o = this.options, 3839 that = this; 3840 this._addClass("ui-resizable"); 3841 3842 $.extend(this, { 3843 _aspectRatio: !!(o.aspectRatio), 3844 aspectRatio: o.aspectRatio, 3845 originalElement: this.element, 3846 _proportionallyResizeElements: [], 3847 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3848 }); 3849 3850 // Wrap the element if it cannot hold child nodes 3851 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 3852 3853 this.element.wrap( 3854 $("<div class='ui-wrapper'></div>").css({ 3855 overflow: "hidden", 3856 position: this.element.css("position"), 3857 width: this.element.outerWidth(), 3858 height: this.element.outerHeight(), 3859 top: this.element.css("top"), 3860 left: this.element.css("left") 3861 }) 3862 ); 3863 3864 this.element = this.element.parent().data( 3865 "ui-resizable", this.element.resizable("instance") 3866 ); 3867 3868 this.elementIsWrapper = true; 3869 3870 margins = { 3871 marginTop: this.originalElement.css("marginTop"), 3872 marginRight: this.originalElement.css("marginRight"), 3873 marginBottom: this.originalElement.css("marginBottom"), 3874 marginLeft: this.originalElement.css("marginLeft") 3875 }; 3876 3877 this.element.css(margins); 3878 this.originalElement.css("margin", 0); 3879 3880 // support: Safari 3881 // Prevent Safari textarea resize 3882 this.originalResizeStyle = this.originalElement.css("resize"); 3883 this.originalElement.css("resize", "none"); 3884 3885 this._proportionallyResizeElements.push(this.originalElement.css({ 3886 position: "static", 3887 zoom: 1, 3888 display: "block" 3889 })); 3890 3891 // Support: IE9 3892 // avoid IE jump (hard set the margin) 3893 this.originalElement.css(margins); 3894 3895 this._proportionallyResize(); 3896 } 3897 3898 this._setupHandles(); 3899 3900 if (o.autoHide) { 3901 $(this.element) 3902 .on("mouseenter", function () { 3903 if (o.disabled) { 3904 return; 3905 } 3906 that._removeClass("ui-resizable-autohide"); 3907 that._handles.show(); 3908 }) 3909 .on("mouseleave", function () { 3910 if (o.disabled) { 3911 return; 3912 } 3913 if (!that.resizing) { 3914 that._addClass("ui-resizable-autohide"); 3915 that._handles.hide(); 3916 } 3917 }); 3918 } 3919 3920 this._mouseInit(); 3921 }, 3922 3923 _destroy: function () { 3924 3925 this._mouseDestroy(); 3926 this._addedHandles.remove(); 3927 3928 var wrapper, 3929 _destroy = function (exp) { 3930 $(exp) 3931 .removeData("resizable") 3932 .removeData("ui-resizable") 3933 .off(".resizable"); 3934 }; 3935 3936 // TODO: Unwrap at same DOM position 3937 if (this.elementIsWrapper) { 3938 _destroy(this.element); 3939 wrapper = this.element; 3940 this.originalElement.css({ 3941 position: wrapper.css("position"), 3942 width: wrapper.outerWidth(), 3943 height: wrapper.outerHeight(), 3944 top: wrapper.css("top"), 3945 left: wrapper.css("left") 3946 }).insertAfter(wrapper); 3947 wrapper.remove(); 3948 } 3949 3950 this.originalElement.css("resize", this.originalResizeStyle); 3951 _destroy(this.originalElement); 3952 3953 return this; 3954 }, 3955 3956 _setOption: function (key, value) { 3957 this._super(key, value); 3958 3959 switch (key) { 3960 case "handles": 3961 this._removeHandles(); 3962 this._setupHandles(); 3963 break; 3964 case "aspectRatio": 3965 this._aspectRatio = !!value; 3966 break; 3967 default: 3968 break; 3969 } 3970 }, 3971 3972 _setupHandles: function () { 3973 var o = this.options, handle, i, n, hname, axis, that = this; 3974 this.handles = o.handles || 3975 (!$(".ui-resizable-handle", this.element).length ? 3976 "e,s,se" : { 3977 n: ".ui-resizable-n", 3978 e: ".ui-resizable-e", 3979 s: ".ui-resizable-s", 3980 w: ".ui-resizable-w", 3981 se: ".ui-resizable-se", 3982 sw: ".ui-resizable-sw", 3983 ne: ".ui-resizable-ne", 3984 nw: ".ui-resizable-nw" 3985 }); 3986 3987 this._handles = $(); 3988 this._addedHandles = $(); 3989 if (this.handles.constructor === String) { 3990 3991 if (this.handles === "all") { 3992 this.handles = "n,e,s,w,se,sw,ne,nw"; 3993 } 3994 3995 n = this.handles.split(","); 3996 this.handles = {}; 3997 3998 for (i = 0; i < n.length; i++) { 3999 4000 handle = String.prototype.trim.call(n[i]); 4001 hname = "ui-resizable-" + handle; 4002 axis = $("<div>"); 4003 this._addClass(axis, "ui-resizable-handle " + hname); 4004 4005 axis.css({ zIndex: o.zIndex }); 4006 4007 this.handles[handle] = ".ui-resizable-" + handle; 4008 if (!this.element.children(this.handles[handle]).length) { 4009 this.element.append(axis); 4010 this._addedHandles = this._addedHandles.add(axis); 4011 } 4012 } 4013 4014 } 4015 4016 this._renderAxis = function (target) { 4017 4018 var i, axis, padPos, padWrapper; 4019 4020 target = target || this.element; 4021 4022 for (i in this.handles) { 4023 4024 if (this.handles[i].constructor === String) { 4025 this.handles[i] = this.element.children(this.handles[i]).first().show(); 4026 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 4027 this.handles[i] = $(this.handles[i]); 4028 this._on(this.handles[i], { "mousedown": that._mouseDown }); 4029 } 4030 4031 if (this.elementIsWrapper && 4032 this.originalElement[0] 4033 .nodeName 4034 .match(/^(textarea|input|select|button)$/i)) { 4035 axis = $(this.handles[i], this.element); 4036 4037 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 4038 axis.outerHeight() : 4039 axis.outerWidth(); 4040 4041 padPos = ["padding", 4042 /ne|nw|n/.test(i) ? "Top" : 4043 /se|sw|s/.test(i) ? "Bottom" : 4044 /^e$/.test(i) ? "Right" : "Left"].join(""); 4045 4046 target.css(padPos, padWrapper); 4047 4048 this._proportionallyResize(); 4049 } 4050 4051 this._handles = this._handles.add(this.handles[i]); 4052 } 4053 }; 4054 4055 // TODO: make renderAxis a prototype function 4056 this._renderAxis(this.element); 4057 4058 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 4059 this._handles.disableSelection(); 4060 4061 this._handles.on("mouseover", function () { 4062 if (!that.resizing) { 4063 if (this.className) { 4064 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 4065 } 4066 that.axis = axis && axis[1] ? axis[1] : "se"; 4067 } 4068 }); 4069 4070 if (o.autoHide) { 4071 this._handles.hide(); 4072 this._addClass("ui-resizable-autohide"); 4073 } 4074 }, 4075 4076 _removeHandles: function () { 4077 this._addedHandles.remove(); 4078 }, 4079 4080 _mouseCapture: function (event) { 4081 var i, handle, 4082 capture = false; 4083 4084 for (i in this.handles) { 4085 handle = $(this.handles[i])[0]; 4086 if (handle === event.target || $.contains(handle, event.target)) { 4087 capture = true; 4088 } 4089 } 4090 4091 return !this.options.disabled && capture; 4092 }, 4093 4094 _mouseStart: function (event) { 4095 4096 var curleft, curtop, cursor, 4097 o = this.options, 4098 el = this.element; 4099 4100 this.resizing = true; 4101 4102 this._renderProxy(); 4103 4104 curleft = this._num(this.helper.css("left")); 4105 curtop = this._num(this.helper.css("top")); 4106 4107 if (o.containment) { 4108 curleft += $(o.containment).scrollLeft() || 0; 4109 curtop += $(o.containment).scrollTop() || 0; 4110 } 4111 4112 this.offset = this.helper.offset(); 4113 this.position = { left: curleft, top: curtop }; 4114 4115 this.size = this._helper ? { 4116 width: this.helper.width(), 4117 height: this.helper.height() 4118 } : { 4119 width: el.width(), 4120 height: el.height() 4121 }; 4122 4123 this.originalSize = this._helper ? { 4124 width: el.outerWidth(), 4125 height: el.outerHeight() 4126 } : { 4127 width: el.width(), 4128 height: el.height() 4129 }; 4130 4131 this.sizeDiff = { 4132 width: el.outerWidth() - el.width(), 4133 height: el.outerHeight() - el.height() 4134 }; 4135 4136 this.originalPosition = { left: curleft, top: curtop }; 4137 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 4138 4139 this.aspectRatio = (typeof o.aspectRatio === "number") ? 4140 o.aspectRatio : 4141 ((this.originalSize.width / this.originalSize.height) || 1); 4142 4143 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 4144 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 4145 4146 this._addClass("ui-resizable-resizing"); 4147 this._propagate("start", event); 4148 return true; 4149 }, 4150 4151 _mouseDrag: function (event) { 4152 4153 var data, props, 4154 smp = this.originalMousePosition, 4155 a = this.axis, 4156 dx = (event.pageX - smp.left) || 0, 4157 dy = (event.pageY - smp.top) || 0, 4158 trigger = this._change[a]; 4159 4160 this._updatePrevProperties(); 4161 4162 if (!trigger) { 4163 return false; 4164 } 4165 4166 data = trigger.apply(this, [event, dx, dy]); 4167 4168 this._updateVirtualBoundaries(event.shiftKey); 4169 if (this._aspectRatio || event.shiftKey) { 4170 data = this._updateRatio(data, event); 4171 } 4172 4173 data = this._respectSize(data, event); 4174 4175 this._updateCache(data); 4176 4177 this._propagate("resize", event); 4178 4179 props = this._applyChanges(); 4180 4181 if (!this._helper && this._proportionallyResizeElements.length) { 4182 this._proportionallyResize(); 4183 } 4184 4185 if (!$.isEmptyObject(props)) { 4186 this._updatePrevProperties(); 4187 this._trigger("resize", event, this.ui()); 4188 this._applyChanges(); 4189 } 4190 4191 return false; 4192 }, 4193 4194 _mouseStop: function (event) { 4195 4196 this.resizing = false; 4197 var pr, ista, soffseth, soffsetw, s, left, top, 4198 o = this.options, that = this; 4199 4200 if (this._helper) { 4201 4202 pr = this._proportionallyResizeElements; 4203 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 4204 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 4205 soffsetw = ista ? 0 : that.sizeDiff.width; 4206 4207 s = { 4208 width: (that.helper.width() - soffsetw), 4209 height: (that.helper.height() - soffseth) 4210 }; 4211 left = (parseFloat(that.element.css("left")) + 4212 (that.position.left - that.originalPosition.left)) || null; 4213 top = (parseFloat(that.element.css("top")) + 4214 (that.position.top - that.originalPosition.top)) || null; 4215 4216 if (!o.animate) { 4217 this.element.css($.extend(s, { top: top, left: left })); 4218 } 4219 4220 that.helper.height(that.size.height); 4221 that.helper.width(that.size.width); 4222 4223 if (this._helper && !o.animate) { 4224 this._proportionallyResize(); 4225 } 4226 } 4227 4228 $("body").css("cursor", "auto"); 4229 4230 this._removeClass("ui-resizable-resizing"); 4231 4232 this._propagate("stop", event); 4233 4234 if (this._helper) { 4235 this.helper.remove(); 4236 } 4237 4238 return false; 4239 4240 }, 4241 4242 _updatePrevProperties: function () { 4243 this.prevPosition = { 4244 top: this.position.top, 4245 left: this.position.left 4246 }; 4247 this.prevSize = { 4248 width: this.size.width, 4249 height: this.size.height 4250 }; 4251 }, 4252 4253 _applyChanges: function () { 4254 var props = {}; 4255 4256 if (this.position.top !== this.prevPosition.top) { 4257 props.top = this.position.top + "px"; 4258 } 4259 if (this.position.left !== this.prevPosition.left) { 4260 props.left = this.position.left + "px"; 4261 } 4262 if (this.size.width !== this.prevSize.width) { 4263 props.width = this.size.width + "px"; 4264 } 4265 if (this.size.height !== this.prevSize.height) { 4266 props.height = this.size.height + "px"; 4267 } 4268 4269 this.helper.css(props); 4270 4271 return props; 4272 }, 4273 4274 _updateVirtualBoundaries: function (forceAspectRatio) { 4275 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 4276 o = this.options; 4277 4278 b = { 4279 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 4280 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 4281 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 4282 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 4283 }; 4284 4285 if (this._aspectRatio || forceAspectRatio) { 4286 pMinWidth = b.minHeight * this.aspectRatio; 4287 pMinHeight = b.minWidth / this.aspectRatio; 4288 pMaxWidth = b.maxHeight * this.aspectRatio; 4289 pMaxHeight = b.maxWidth / this.aspectRatio; 4290 4291 if (pMinWidth > b.minWidth) { 4292 b.minWidth = pMinWidth; 4293 } 4294 if (pMinHeight > b.minHeight) { 4295 b.minHeight = pMinHeight; 4296 } 4297 if (pMaxWidth < b.maxWidth) { 4298 b.maxWidth = pMaxWidth; 4299 } 4300 if (pMaxHeight < b.maxHeight) { 4301 b.maxHeight = pMaxHeight; 4302 } 4303 } 4304 this._vBoundaries = b; 4305 }, 4306 4307 _updateCache: function (data) { 4308 this.offset = this.helper.offset(); 4309 if (this._isNumber(data.left)) { 4310 this.position.left = data.left; 4311 } 4312 if (this._isNumber(data.top)) { 4313 this.position.top = data.top; 4314 } 4315 if (this._isNumber(data.height)) { 4316 this.size.height = data.height; 4317 } 4318 if (this._isNumber(data.width)) { 4319 this.size.width = data.width; 4320 } 4321 }, 4322 4323 _updateRatio: function (data) { 4324 4325 var cpos = this.position, 4326 csize = this.size, 4327 a = this.axis; 4328 4329 if (this._isNumber(data.height)) { 4330 data.width = (data.height * this.aspectRatio); 4331 } else if (this._isNumber(data.width)) { 4332 data.height = (data.width / this.aspectRatio); 4333 } 4334 4335 if (a === "sw") { 4336 data.left = cpos.left + (csize.width - data.width); 4337 data.top = null; 4338 } 4339 if (a === "nw") { 4340 data.top = cpos.top + (csize.height - data.height); 4341 data.left = cpos.left + (csize.width - data.width); 4342 } 4343 4344 return data; 4345 }, 4346 4347 _respectSize: function (data) { 4348 4349 var o = this._vBoundaries, 4350 a = this.axis, 4351 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 4352 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 4353 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 4354 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 4355 dw = this.originalPosition.left + this.originalSize.width, 4356 dh = this.originalPosition.top + this.originalSize.height, 4357 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 4358 if (isminw) { 4359 data.width = o.minWidth; 4360 } 4361 if (isminh) { 4362 data.height = o.minHeight; 4363 } 4364 if (ismaxw) { 4365 data.width = o.maxWidth; 4366 } 4367 if (ismaxh) { 4368 data.height = o.maxHeight; 4369 } 4370 4371 if (isminw && cw) { 4372 data.left = dw - o.minWidth; 4373 } 4374 if (ismaxw && cw) { 4375 data.left = dw - o.maxWidth; 4376 } 4377 if (isminh && ch) { 4378 data.top = dh - o.minHeight; 4379 } 4380 if (ismaxh && ch) { 4381 data.top = dh - o.maxHeight; 4382 } 4383 4384 // Fixing jump error on top/left - bug #2330 4385 if (!data.width && !data.height && !data.left && data.top) { 4386 data.top = null; 4387 } else if (!data.width && !data.height && !data.top && data.left) { 4388 data.left = null; 4389 } 4390 4391 return data; 4392 }, 4393 4394 _getPaddingPlusBorderDimensions: function (element) { 4395 var i = 0, 4396 widths = [], 4397 borders = [ 4398 element.css("borderTopWidth"), 4399 element.css("borderRightWidth"), 4400 element.css("borderBottomWidth"), 4401 element.css("borderLeftWidth") 4402 ], 4403 paddings = [ 4404 element.css("paddingTop"), 4405 element.css("paddingRight"), 4406 element.css("paddingBottom"), 4407 element.css("paddingLeft") 4408 ]; 4409 4410 for (; i < 4; i++) { 4411 widths[i] = (parseFloat(borders[i]) || 0); 4412 widths[i] += (parseFloat(paddings[i]) || 0); 4413 } 4414 4415 return { 4416 height: widths[0] + widths[2], 4417 width: widths[1] + widths[3] 4418 }; 4419 }, 4420 4421 _proportionallyResize: function () { 4422 4423 if (!this._proportionallyResizeElements.length) { 4424 return; 4425 } 4426 4427 var prel, 4428 i = 0, 4429 element = this.helper || this.element; 4430 4431 for (; i < this._proportionallyResizeElements.length; i++) { 4432 4433 prel = this._proportionallyResizeElements[i]; 4434 4435 // TODO: Seems like a bug to cache this.outerDimensions 4436 // considering that we are in a loop. 4437 if (!this.outerDimensions) { 4438 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 4439 } 4440 4441 prel.css({ 4442 height: (element.height() - this.outerDimensions.height) || 0, 4443 width: (element.width() - this.outerDimensions.width) || 0 4444 }); 4445 4446 } 4447 4448 }, 4449 4450 _renderProxy: function () { 4451 4452 var el = this.element, o = this.options; 4453 this.elementOffset = el.offset(); 4454 4455 if (this._helper) { 4456 4457 this.helper = this.helper || $("<div></div>").css({ overflow: "hidden" }); 4458 4459 this._addClass(this.helper, this._helper); 4460 this.helper.css({ 4461 width: this.element.outerWidth(), 4462 height: this.element.outerHeight(), 4463 position: "absolute",
vendor: 4,474 bytes, lines 4464-4629
4464 left: this.elementOffset.left + "px", 4465 top: this.elementOffset.top + "px", 4466 zIndex: ++o.zIndex //TODO: Don't modify option 4467 }); 4468 4469 this.helper 4470 .appendTo("body") 4471 .disableSelection(); 4472 4473 } else { 4474 this.helper = this.element; 4475 } 4476 4477 }, 4478 4479 _change: { 4480 e: function (event, dx) { 4481 return { width: this.originalSize.width + dx }; 4482 }, 4483 w: function (event, dx) { 4484 var cs = this.originalSize, sp = this.originalPosition; 4485 return { left: sp.left + dx, width: cs.width - dx }; 4486 }, 4487 n: function (event, dx, dy) { 4488 var cs = this.originalSize, sp = this.originalPosition; 4489 return { top: sp.top + dy, height: cs.height - dy }; 4490 }, 4491 s: function (event, dx, dy) { 4492 return { height: this.originalSize.height + dy }; 4493 }, 4494 se: function (event, dx, dy) { 4495 return $.extend(this._change.s.apply(this, arguments), 4496 this._change.e.apply(this, [event, dx, dy])); 4497 }, 4498 sw: function (event, dx, dy) { 4499 return $.extend(this._change.s.apply(this, arguments), 4500 this._change.w.apply(this, [event, dx, dy])); 4501 }, 4502 ne: function (event, dx, dy) { 4503 return $.extend(this._change.n.apply(this, arguments), 4504 this._change.e.apply(this, [event, dx, dy])); 4505 }, 4506 nw: function (event, dx, dy) { 4507 return $.extend(this._change.n.apply(this, arguments), 4508 this._change.w.apply(this, [event, dx, dy])); 4509 } 4510 }, 4511 4512 _propagate: function (n, event) { 4513 $.ui.plugin.call(this, n, [event, this.ui()]); 4514 if (n !== "resize") { 4515 this._trigger(n, event, this.ui()); 4516 } 4517 }, 4518 4519 plugins: {}, 4520 4521 ui: function () { 4522 return { 4523 originalElement: this.originalElement, 4524 element: this.element, 4525 helper: this.helper, 4526 position: this.position, 4527 size: this.size, 4528 originalSize: this.originalSize, 4529 originalPosition: this.originalPosition 4530 }; 4531 } 4532 4533 }); 4534 4535 /* 4536 * Resizable Extensions 4537 */ 4538 4539 $.ui.plugin.add("resizable", "animate", { 4540 4541 stop: function (event) { 4542 var that = $(this).resizable("instance"), 4543 o = that.options, 4544 pr = that._proportionallyResizeElements, 4545 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 4546 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 4547 soffsetw = ista ? 0 : that.sizeDiff.width, 4548 style = { 4549 width: (that.size.width - soffsetw), 4550 height: (that.size.height - soffseth) 4551 }, 4552 left = (parseFloat(that.element.css("left")) + 4553 (that.position.left - that.originalPosition.left)) || null, 4554 top = (parseFloat(that.element.css("top")) + 4555 (that.position.top - that.originalPosition.top)) || null; 4556 4557 that.element.animate( 4558 $.extend(style, top && left ? { top: top, left: left } : {}), { 4559 duration: o.animateDuration, 4560 easing: o.animateEasing, 4561 step: function () { 4562 4563 var data = { 4564 width: parseFloat(that.element.css("width")), 4565 height: parseFloat(that.element.css("height")), 4566 top: parseFloat(that.element.css("top")), 4567 left: parseFloat(that.element.css("left")) 4568 }; 4569 4570 if (pr && pr.length) { 4571 $(pr[0]).css({ width: data.width, height: data.height }); 4572 } 4573 4574 // Propagating resize, and updating values for each animation step 4575 that._updateCache(data); 4576 that._propagate("resize", event); 4577 4578 } 4579 } 4580 ); 4581 } 4582 4583 }); 4584 4585 $.ui.plugin.add("resizable", "containment", { 4586 4587 start: function () { 4588 var element, p, co, ch, cw, width, height, 4589 that = $(this).resizable("instance"), 4590 o = that.options, 4591 el = that.element, 4592 oc = o.containment, 4593 ce = (oc instanceof $) ? 4594 oc.get(0) : 4595 (/parent/.test(oc)) ? el.parent().get(0) : oc; 4596 4597 if (!ce) { 4598 return; 4599 } 4600 4601 that.containerElement = $(ce); 4602 4603 if (/document/.test(oc) || oc === document) { 4604 that.containerOffset = { 4605 left: 0, 4606 top: 0 4607 }; 4608 that.containerPosition = { 4609 left: 0, 4610 top: 0 4611 }; 4612 4613 that.parentData = { 4614 element: $(document), 4615 left: 0, 4616 top: 0, 4617 width: $(document).width(), 4618 height: $(document).height() || document.body.parentNode.scrollHeight 4619 }; 4620 } else { 4621 element = $(ce); 4622 p = []; 4623 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 4624 p[i] = that._num(element.css("padding" + name)); 4625 }); 4626 4627 that.containerOffset = element.offset(); 4628 that.containerPosition = element.position(); 4629 that.containerSize = {
vendor: 4,908 bytes, lines 4630-4800
4630 height: (element.innerHeight() - p[3]), 4631 width: (element.innerWidth() - p[1]) 4632 }; 4633 4634 co = that.containerOffset; 4635 ch = that.containerSize.height; 4636 cw = that.containerSize.width; 4637 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 4638 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 4639 4640 that.parentData = { 4641 element: ce, 4642 left: co.left, 4643 top: co.top, 4644 width: width, 4645 height: height 4646 }; 4647 } 4648 }, 4649 4650 resize: function (event) { 4651 var woset, hoset, isParent, isOffsetRelative, 4652 that = $(this).resizable("instance"), 4653 o = that.options, 4654 co = that.containerOffset, 4655 cp = that.position, 4656 pRatio = that._aspectRatio || event.shiftKey, 4657 cop = { 4658 top: 0, 4659 left: 0 4660 }, 4661 ce = that.containerElement, 4662 continueResize = true; 4663 4664 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 4665 cop = co; 4666 } 4667 4668 if (cp.left < (that._helper ? co.left : 0)) { 4669 that.size.width = that.size.width + 4670 (that._helper ? 4671 (that.position.left - co.left) : 4672 (that.position.left - cop.left)); 4673 4674 if (pRatio) { 4675 that.size.height = that.size.width / that.aspectRatio; 4676 continueResize = false; 4677 } 4678 that.position.left = o.helper ? co.left : 0; 4679 } 4680 4681 if (cp.top < (that._helper ? co.top : 0)) { 4682 that.size.height = that.size.height + 4683 (that._helper ? 4684 (that.position.top - co.top) : 4685 that.position.top); 4686 4687 if (pRatio) { 4688 that.size.width = that.size.height * that.aspectRatio; 4689 continueResize = false; 4690 } 4691 that.position.top = that._helper ? co.top : 0; 4692 } 4693 4694 isParent = that.containerElement.get(0) === that.element.parent().get(0); 4695 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 4696 4697 if (isParent && isOffsetRelative) { 4698 that.offset.left = that.parentData.left + that.position.left; 4699 that.offset.top = that.parentData.top + that.position.top; 4700 } else { 4701 that.offset.left = that.element.offset().left; 4702 that.offset.top = that.element.offset().top; 4703 } 4704 4705 woset = Math.abs(that.sizeDiff.width + 4706 (that._helper ? 4707 that.offset.left - cop.left : 4708 (that.offset.left - co.left))); 4709 4710 hoset = Math.abs(that.sizeDiff.height + 4711 (that._helper ? 4712 that.offset.top - cop.top : 4713 (that.offset.top - co.top))); 4714 4715 if (woset + that.size.width >= that.parentData.width) { 4716 that.size.width = that.parentData.width - woset; 4717 if (pRatio) { 4718 that.size.height = that.size.width / that.aspectRatio; 4719 continueResize = false; 4720 } 4721 } 4722 4723 if (hoset + that.size.height >= that.parentData.height) { 4724 that.size.height = that.parentData.height - hoset; 4725 if (pRatio) { 4726 that.size.width = that.size.height * that.aspectRatio; 4727 continueResize = false; 4728 } 4729 } 4730 4731 if (!continueResize) { 4732 that.position.left = that.prevPosition.left; 4733 that.position.top = that.prevPosition.top; 4734 that.size.width = that.prevSize.width; 4735 that.size.height = that.prevSize.height; 4736 } 4737 }, 4738 4739 stop: function () { 4740 var that = $(this).resizable("instance"), 4741 o = that.options, 4742 co = that.containerOffset, 4743 cop = that.containerPosition, 4744 ce = that.containerElement, 4745 helper = $(that.helper), 4746 ho = helper.offset(), 4747 w = helper.outerWidth() - that.sizeDiff.width, 4748 h = helper.outerHeight() - that.sizeDiff.height; 4749 4750 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 4751 $(this).css({ 4752 left: ho.left - cop.left - co.left, 4753 width: w, 4754 height: h 4755 }); 4756 } 4757 4758 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 4759 $(this).css({ 4760 left: ho.left - cop.left - co.left, 4761 width: w, 4762 height: h 4763 }); 4764 } 4765 } 4766 }); 4767 4768 $.ui.plugin.add("resizable", "alsoResize", { 4769 4770 start: function () { 4771 var that = $(this).resizable("instance"), 4772 o = that.options; 4773 4774 $(o.alsoResize).each(function () { 4775 var el = $(this); 4776 el.data("ui-resizable-alsoresize", { 4777 width: parseFloat(el.width()), height: parseFloat(el.height()), 4778 left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) 4779 }); 4780 }); 4781 }, 4782 4783 resize: function (event, ui) { 4784 var that = $(this).resizable("instance"), 4785 o = that.options, 4786 os = that.originalSize, 4787 op = that.originalPosition, 4788 delta = { 4789 height: (that.size.height - os.height) || 0, 4790 width: (that.size.width - os.width) || 0, 4791 top: (that.position.top - op.top) || 0, 4792 left: (that.position.left - op.left) || 0 4793 }; 4794 4795 $(o.alsoResize).each(function () { 4796 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 4797 css = el.parents(ui.originalElement[0]).length ? 4798 ["width", "height"] : 4799 ["width", "height", "top", "left"]; 4800
vendor: 5,423 bytes, lines 4801-5010
4801 $.each(css, function (i, prop) { 4802 var sum = (start[prop] || 0) + (delta[prop] || 0); 4803 if (sum && sum >= 0) { 4804 style[prop] = sum || null; 4805 } 4806 }); 4807 4808 el.css(style); 4809 }); 4810 }, 4811 4812 stop: function () { 4813 $(this).removeData("ui-resizable-alsoresize"); 4814 } 4815 }); 4816 4817 $.ui.plugin.add("resizable", "ghost", { 4818 4819 start: function () { 4820 4821 var that = $(this).resizable("instance"), cs = that.size; 4822 4823 that.ghost = that.originalElement.clone(); 4824 that.ghost.css({ 4825 opacity: 0.25, 4826 display: "block", 4827 position: "relative", 4828 height: cs.height, 4829 width: cs.width, 4830 margin: 0, 4831 left: 0, 4832 top: 0 4833 }); 4834 4835 that._addClass(that.ghost, "ui-resizable-ghost"); 4836 4837 // DEPRECATED 4838 // TODO: remove after 1.12 4839 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 4840 4841 // Ghost option 4842 that.ghost.addClass(this.options.ghost); 4843 } 4844 4845 that.ghost.appendTo(that.helper); 4846 4847 }, 4848 4849 resize: function () { 4850 var that = $(this).resizable("instance"); 4851 if (that.ghost) { 4852 that.ghost.css({ 4853 position: "relative", 4854 height: that.size.height, 4855 width: that.size.width 4856 }); 4857 } 4858 }, 4859 4860 stop: function () { 4861 var that = $(this).resizable("instance"); 4862 if (that.ghost && that.helper) { 4863 that.helper.get(0).removeChild(that.ghost.get(0)); 4864 } 4865 } 4866 4867 }); 4868 4869 $.ui.plugin.add("resizable", "grid", { 4870 4871 resize: function () { 4872 var outerDimensions, 4873 that = $(this).resizable("instance"), 4874 o = that.options, 4875 cs = that.size, 4876 os = that.originalSize, 4877 op = that.originalPosition, 4878 a = that.axis, 4879 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 4880 gridX = (grid[0] || 1), 4881 gridY = (grid[1] || 1), 4882 ox = Math.round((cs.width - os.width) / gridX) * gridX, 4883 oy = Math.round((cs.height - os.height) / gridY) * gridY, 4884 newWidth = os.width + ox, 4885 newHeight = os.height + oy, 4886 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 4887 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 4888 isMinWidth = o.minWidth && (o.minWidth > newWidth), 4889 isMinHeight = o.minHeight && (o.minHeight > newHeight); 4890 4891 o.grid = grid; 4892 4893 if (isMinWidth) { 4894 newWidth += gridX; 4895 } 4896 if (isMinHeight) { 4897 newHeight += gridY; 4898 } 4899 if (isMaxWidth) { 4900 newWidth -= gridX; 4901 } 4902 if (isMaxHeight) { 4903 newHeight -= gridY; 4904 } 4905 4906 if (/^(se|s|e)$/.test(a)) { 4907 that.size.width = newWidth; 4908 that.size.height = newHeight; 4909 } else if (/^(ne)$/.test(a)) { 4910 that.size.width = newWidth; 4911 that.size.height = newHeight; 4912 that.position.top = op.top - oy; 4913 } else if (/^(sw)$/.test(a)) { 4914 that.size.width = newWidth; 4915 that.size.height = newHeight; 4916 that.position.left = op.left - ox; 4917 } else { 4918 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 4919 outerDimensions = that._getPaddingPlusBorderDimensions(this); 4920 } 4921 4922 if (newHeight - gridY > 0) { 4923 that.size.height = newHeight; 4924 that.position.top = op.top - oy; 4925 } else { 4926 newHeight = gridY - outerDimensions.height; 4927 that.size.height = newHeight; 4928 that.position.top = op.top + os.height - newHeight; 4929 } 4930 if (newWidth - gridX > 0) { 4931 that.size.width = newWidth; 4932 that.position.left = op.left - ox; 4933 } else { 4934 newWidth = gridX - outerDimensions.width; 4935 that.size.width = newWidth; 4936 that.position.left = op.left + os.width - newWidth; 4937 } 4938 } 4939 } 4940 4941 }); 4942 4943 var widgetsResizable = $.ui.resizable; 4944 4945 4946 /*! 4947 * jQuery UI Selectable 1.13.2 4948 * http://jqueryui.com 4949 * 4950 * Copyright jQuery Foundation and other contributors 4951 * Released under the MIT license. 4952 * http://jquery.org/license 4953 */ 4954 4955 //>>label: Selectable 4956 //>>group: Interactions 4957 //>>description: Allows groups of elements to be selected with the mouse. 4958 //>>docs: http://api.jqueryui.com/selectable/ 4959 //>>demos: http://jqueryui.com/selectable/ 4960 //>>css.structure: ../../themes/base/selectable.css 4961 4962 4963 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 4964 version: "1.13.2", 4965 options: { 4966 appendTo: "body", 4967 autoRefresh: true, 4968 distance: 0, 4969 filter: "*", 4970 tolerance: "touch", 4971 4972 // Callbacks 4973 selected: null, 4974 selecting: null, 4975 start: null, 4976 stop: null, 4977 unselected: null, 4978 unselecting: null 4979 }, 4980 _create: function () { 4981 var that = this; 4982 4983 this._addClass("ui-selectable"); 4984 4985 this.dragged = false; 4986 4987 // Cache selectee children based on filter 4988 this.refresh = function () { 4989 that.elementPos = $(that.element[0]).offset(); 4990 that.selectees = $(that.options.filter, that.element[0]); 4991 that._addClass(that.selectees, "ui-selectee"); 4992 that.selectees.each(function () { 4993 var $this = $(this), 4994 selecteeOffset = $this.offset(), 4995 pos = { 4996 left: selecteeOffset.left - that.elementPos.left, 4997 top: selecteeOffset.top - that.elementPos.top 4998 }; 4999 $.data(this, "selectable-item", { 5000 element: this, 5001 $element: $this, 5002 left: pos.left, 5003 top: pos.top, 5004 right: pos.left + $this.outerWidth(), 5005 bottom: pos.top + $this.outerHeight(), 5006 startselected: false, 5007 selected: $this.hasClass("ui-selected"), 5008 selecting: $this.hasClass("ui-selecting"), 5009 unselecting: $this.hasClass("ui-unselecting") 5010 });
vendor: 10,126 bytes, lines 5011-5406
5011 }); 5012 }; 5013 this.refresh(); 5014 5015 this._mouseInit(); 5016 5017 this.helper = $("<div>"); 5018 this._addClass(this.helper, "ui-selectable-helper"); 5019 }, 5020 5021 _destroy: function () { 5022 this.selectees.removeData("selectable-item"); 5023 this._mouseDestroy(); 5024 }, 5025 5026 _mouseStart: function (event) { 5027 var that = this, 5028 options = this.options; 5029 5030 this.opos = [event.pageX, event.pageY]; 5031 this.elementPos = $(this.element[0]).offset(); 5032 5033 if (this.options.disabled) { 5034 return; 5035 } 5036 5037 this.selectees = $(options.filter, this.element[0]); 5038 5039 this._trigger("start", event); 5040 5041 $(options.appendTo).append(this.helper); 5042 5043 // position helper (lasso) 5044 this.helper.css({ 5045 "left": event.pageX, 5046 "top": event.pageY, 5047 "width": 0, 5048 "height": 0 5049 }); 5050 5051 if (options.autoRefresh) { 5052 this.refresh(); 5053 } 5054 5055 this.selectees.filter(".ui-selected").each(function () { 5056 var selectee = $.data(this, "selectable-item"); 5057 selectee.startselected = true; 5058 if (!event.metaKey && !event.ctrlKey) { 5059 that._removeClass(selectee.$element, "ui-selected"); 5060 selectee.selected = false; 5061 that._addClass(selectee.$element, "ui-unselecting"); 5062 selectee.unselecting = true; 5063 5064 // selectable UNSELECTING callback 5065 that._trigger("unselecting", event, { 5066 unselecting: selectee.element 5067 }); 5068 } 5069 }); 5070 5071 $(event.target).parents().addBack().each(function () { 5072 var doSelect, 5073 selectee = $.data(this, "selectable-item"); 5074 if (selectee) { 5075 doSelect = (!event.metaKey && !event.ctrlKey) || 5076 !selectee.$element.hasClass("ui-selected"); 5077 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 5078 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 5079 selectee.unselecting = !doSelect; 5080 selectee.selecting = doSelect; 5081 selectee.selected = doSelect; 5082 5083 // selectable (UN)SELECTING callback 5084 if (doSelect) { 5085 that._trigger("selecting", event, { 5086 selecting: selectee.element 5087 }); 5088 } else { 5089 that._trigger("unselecting", event, { 5090 unselecting: selectee.element 5091 }); 5092 } 5093 return false; 5094 } 5095 }); 5096 5097 }, 5098 5099 _mouseDrag: function (event) { 5100 5101 this.dragged = true; 5102 5103 if (this.options.disabled) { 5104 return; 5105 } 5106 5107 var tmp, 5108 that = this, 5109 options = this.options, 5110 x1 = this.opos[0], 5111 y1 = this.opos[1], 5112 x2 = event.pageX, 5113 y2 = event.pageY; 5114 5115 if (x1 > x2) { 5116 tmp = x2; x2 = x1; x1 = tmp; 5117 } 5118 if (y1 > y2) { 5119 tmp = y2; y2 = y1; y1 = tmp; 5120 } 5121 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 5122 5123 this.selectees.each(function () { 5124 var selectee = $.data(this, "selectable-item"), 5125 hit = false, 5126 offset = {}; 5127 5128 //prevent helper from being selected if appendTo: selectable 5129 if (!selectee || selectee.element === that.element[0]) { 5130 return; 5131 } 5132 5133 offset.left = selectee.left + that.elementPos.left; 5134 offset.right = selectee.right + that.elementPos.left; 5135 offset.top = selectee.top + that.elementPos.top; 5136 offset.bottom = selectee.bottom + that.elementPos.top; 5137 5138 if (options.tolerance === "touch") { 5139 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 5140 offset.bottom < y1)); 5141 } else if (options.tolerance === "fit") { 5142 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 5143 offset.bottom < y2); 5144 } 5145 5146 if (hit) { 5147 5148 // SELECT 5149 if (selectee.selected) { 5150 that._removeClass(selectee.$element, "ui-selected"); 5151 selectee.selected = false; 5152 } 5153 if (selectee.unselecting) { 5154 that._removeClass(selectee.$element, "ui-unselecting"); 5155 selectee.unselecting = false; 5156 } 5157 if (!selectee.selecting) { 5158 that._addClass(selectee.$element, "ui-selecting"); 5159 selectee.selecting = true; 5160 5161 // selectable SELECTING callback 5162 that._trigger("selecting", event, { 5163 selecting: selectee.element 5164 }); 5165 } 5166 } else { 5167 5168 // UNSELECT 5169 if (selectee.selecting) { 5170 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 5171 that._removeClass(selectee.$element, "ui-selecting"); 5172 selectee.selecting = false; 5173 that._addClass(selectee.$element, "ui-selected"); 5174 selectee.selected = true; 5175 } else { 5176 that._removeClass(selectee.$element, "ui-selecting"); 5177 selectee.selecting = false; 5178 if (selectee.startselected) { 5179 that._addClass(selectee.$element, "ui-unselecting"); 5180 selectee.unselecting = true; 5181 } 5182 5183 // selectable UNSELECTING callback 5184 that._trigger("unselecting", event, { 5185 unselecting: selectee.element 5186 }); 5187 } 5188 } 5189 if (selectee.selected) { 5190 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 5191 that._removeClass(selectee.$element, "ui-selected"); 5192 selectee.selected = false; 5193 5194 that._addClass(selectee.$element, "ui-unselecting"); 5195 selectee.unselecting = true; 5196 5197 // selectable UNSELECTING callback 5198 that._trigger("unselecting", event, { 5199 unselecting: selectee.element 5200 }); 5201 } 5202 } 5203 } 5204 }); 5205 5206 return false; 5207 }, 5208 5209 _mouseStop: function (event) { 5210 var that = this; 5211 5212 this.dragged = false; 5213 5214 $(".ui-unselecting", this.element[0]).each(function () { 5215 var selectee = $.data(this, "selectable-item"); 5216 that._removeClass(selectee.$element, "ui-unselecting"); 5217 selectee.unselecting = false; 5218 selectee.startselected = false; 5219 that._trigger("unselected", event, { 5220 unselected: selectee.element 5221 }); 5222 }); 5223 $(".ui-selecting", this.element[0]).each(function () { 5224 var selectee = $.data(this, "selectable-item"); 5225 that._removeClass(selectee.$element, "ui-selecting") 5226 ._addClass(selectee.$element, "ui-selected"); 5227 selectee.selecting = false; 5228 selectee.selected = true; 5229 selectee.startselected = true; 5230 that._trigger("selected", event, { 5231 selected: selectee.element 5232 }); 5233 }); 5234 this._trigger("stop", event); 5235 5236 this.helper.remove(); 5237 5238 return false; 5239 } 5240 5241 }); 5242 5243 5244 /*! 5245 * jQuery UI Sortable 1.13.2 5246 * http://jqueryui.com 5247 * 5248 * Copyright jQuery Foundation and other contributors 5249 * Released under the MIT license. 5250 * http://jquery.org/license 5251 */ 5252 5253 //>>label: Sortable 5254 //>>group: Interactions 5255 //>>description: Enables items in a list to be sorted using the mouse. 5256 //>>docs: http://api.jqueryui.com/sortable/ 5257 //>>demos: http://jqueryui.com/sortable/ 5258 //>>css.structure: ../../themes/base/sortable.css 5259 5260 5261 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 5262 version: "1.13.2", 5263 widgetEventPrefix: "sort", 5264 ready: false, 5265 options: { 5266 appendTo: "parent", 5267 axis: false, 5268 connectWith: false, 5269 containment: false, 5270 cursor: "auto", 5271 cursorAt: false, 5272 dropOnEmpty: true, 5273 forcePlaceholderSize: false, 5274 forceHelperSize: false, 5275 grid: false, 5276 handle: false, 5277 helper: "original", 5278 items: "> *", 5279 opacity: false, 5280 placeholder: false, 5281 revert: false, 5282 scroll: true, 5283 scrollSensitivity: 20, 5284 scrollSpeed: 20, 5285 scope: "default", 5286 tolerance: "intersect", 5287 zIndex: 1000, 5288 5289 // Callbacks 5290 activate: null, 5291 beforeStop: null, 5292 change: null, 5293 deactivate: null, 5294 out: null, 5295 over: null, 5296 receive: null, 5297 remove: null, 5298 sort: null, 5299 start: null, 5300 stop: null, 5301 update: null 5302 }, 5303 5304 _isOverAxis: function (x, reference, size) { 5305 return (x >= reference) && (x < (reference + size)); 5306 }, 5307 5308 _isFloating: function (item) { 5309 return (/left|right/).test(item.css("float")) || 5310 (/inline|table-cell/).test(item.css("display")); 5311 }, 5312 5313 _create: function () { 5314 this.containerCache = {}; 5315 this._addClass("ui-sortable"); 5316 5317 //Get the items 5318 this.refresh(); 5319 5320 //Let's determine the parent's offset 5321 this.offset = this.element.offset(); 5322 5323 //Initialize mouse events for interaction 5324 this._mouseInit(); 5325 5326 this._setHandleClassName(); 5327 5328 //We're ready to go 5329 this.ready = true; 5330 5331 }, 5332 5333 _setOption: function (key, value) { 5334 this._super(key, value); 5335 5336 if (key === "handle") { 5337 this._setHandleClassName(); 5338 } 5339 }, 5340 5341 _setHandleClassName: function () { 5342 var that = this; 5343 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 5344 $.each(this.items, function () { 5345 that._addClass( 5346 this.instance.options.handle ? 5347 this.item.find(this.instance.options.handle) : 5348 this.item, 5349 "ui-sortable-handle" 5350 ); 5351 }); 5352 }, 5353 5354 _destroy: function () { 5355 this._mouseDestroy(); 5356 5357 for (var i = this.items.length - 1; i >= 0; i--) { 5358 this.items[i].item.removeData(this.widgetName + "-item"); 5359 } 5360 5361 return this; 5362 }, 5363 5364 _mouseCapture: function (event, overrideHandle) { 5365 var currentItem = null, 5366 validHandle = false, 5367 that = this; 5368 5369 if (this.reverting) { 5370 return false; 5371 } 5372 5373 if (this.options.disabled || this.options.type === "static") { 5374 return false; 5375 } 5376 5377 //We have to refresh the items data once first 5378 this._refreshItems(event); 5379 5380 //Find out if the clicked node (or one of its parents) is a actual item in this.items 5381 $(event.target).parents().each(function () { 5382 if ($.data(this, that.widgetName + "-item") === that) { 5383 currentItem = $(this); 5384 return false; 5385 } 5386 }); 5387 if ($.data(event.target, that.widgetName + "-item") === that) { 5388 currentItem = $(event.target); 5389 } 5390 5391 if (!currentItem) { 5392 return false; 5393 } 5394 if (this.options.handle && !overrideHandle) { 5395 $(this.options.handle, currentItem).find("*").addBack().each(function () { 5396 if (this === event.target) { 5397 validHandle = true; 5398 } 5399 }); 5400 if (!validHandle) { 5401 return false; 5402 } 5403 } 5404 5405 this.currentItem = currentItem; 5406 this._removeCurrentsFromItems();
vendor: 8,336 bytes, lines 5407-5678
5407 return true; 5408 5409 }, 5410 5411 _mouseStart: function (event, overrideHandle, noActivation) { 5412 5413 var i, body, 5414 o = this.options; 5415 5416 this.currentContainer = this; 5417 5418 //We only need to call refreshPositions, because the refreshItems call has been moved to 5419 // mouseCapture 5420 this.refreshPositions(); 5421 5422 //Prepare the dragged items parent 5423 this.appendTo = $(o.appendTo !== "parent" ? 5424 o.appendTo : 5425 this.currentItem.parent()); 5426 5427 //Create and append the visible helper 5428 this.helper = this._createHelper(event); 5429 5430 //Cache the helper size 5431 this._cacheHelperProportions(); 5432 5433 /* 5434 * - Position generation - 5435 * This block generates everything position related - it's the core of draggables. 5436 */ 5437 5438 //Cache the margins of the original element 5439 this._cacheMargins(); 5440 5441 //The element's absolute position on the page minus margins 5442 this.offset = this.currentItem.offset(); 5443 this.offset = { 5444 top: this.offset.top - this.margins.top, 5445 left: this.offset.left - this.margins.left 5446 }; 5447 5448 $.extend(this.offset, { 5449 click: { //Where the click happened, relative to the element 5450 left: event.pageX - this.offset.left, 5451 top: event.pageY - this.offset.top 5452 }, 5453 5454 // This is a relative to absolute position minus the actual position calculation - 5455 // only used for relative positioned helper 5456 relative: this._getRelativeOffset() 5457 }); 5458 5459 // After we get the helper offset, but before we get the parent offset we can 5460 // change the helper's position to absolute 5461 // TODO: Still need to figure out a way to make relative sorting possible 5462 this.helper.css("position", "absolute"); 5463 this.cssPosition = this.helper.css("position"); 5464 5465 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5466 if (o.cursorAt) { 5467 this._adjustOffsetFromHelper(o.cursorAt); 5468 } 5469 5470 //Cache the former DOM position 5471 this.domPosition = { 5472 prev: this.currentItem.prev()[0], 5473 parent: this.currentItem.parent()[0] 5474 }; 5475 5476 // If the helper is not the original, hide the original so it's not playing any role during 5477 // the drag, won't cause anything bad this way 5478 if (this.helper[0] !== this.currentItem[0]) { 5479 this.currentItem.hide(); 5480 } 5481 5482 //Create the placeholder 5483 this._createPlaceholder(); 5484 5485 //Get the next scrolling parent 5486 this.scrollParent = this.placeholder.scrollParent(); 5487 5488 $.extend(this.offset, { 5489 parent: this._getParentOffset() 5490 }); 5491 5492 //Set a containment if given in the options 5493 if (o.containment) { 5494 this._setContainment(); 5495 } 5496 5497 if (o.cursor && o.cursor !== "auto") { // cursor option 5498 body = this.document.find("body"); 5499 5500 // Support: IE 5501 this.storedCursor = body.css("cursor"); 5502 body.css("cursor", o.cursor); 5503 5504 this.storedStylesheet = 5505 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 5506 } 5507 5508 // We need to make sure to grab the zIndex before setting the 5509 // opacity, because setting the opacity to anything lower than 1 5510 // causes the zIndex to change from "auto" to 0. 5511 if (o.zIndex) { // zIndex option 5512 if (this.helper.css("zIndex")) { 5513 this._storedZIndex = this.helper.css("zIndex"); 5514 } 5515 this.helper.css("zIndex", o.zIndex); 5516 } 5517 5518 if (o.opacity) { // opacity option 5519 if (this.helper.css("opacity")) { 5520 this._storedOpacity = this.helper.css("opacity"); 5521 } 5522 this.helper.css("opacity", o.opacity); 5523 } 5524 5525 //Prepare scrolling 5526 if (this.scrollParent[0] !== this.document[0] && 5527 this.scrollParent[0].tagName !== "HTML") { 5528 this.overflowOffset = this.scrollParent.offset(); 5529 } 5530 5531 //Call callbacks 5532 this._trigger("start", event, this._uiHash()); 5533 5534 //Recache the helper size 5535 if (!this._preserveHelperProportions) { 5536 this._cacheHelperProportions(); 5537 } 5538 5539 //Post "activate" events to possible containers 5540 if (!noActivation) { 5541 for (i = this.containers.length - 1; i >= 0; i--) { 5542 this.containers[i]._trigger("activate", event, this._uiHash(this)); 5543 } 5544 } 5545 5546 //Prepare possible droppables 5547 if ($.ui.ddmanager) { 5548 $.ui.ddmanager.current = this; 5549 } 5550 5551 if ($.ui.ddmanager && !o.dropBehaviour) { 5552 $.ui.ddmanager.prepareOffsets(this, event); 5553 } 5554 5555 this.dragging = true; 5556 5557 this._addClass(this.helper, "ui-sortable-helper"); 5558 5559 //Move the helper, if needed 5560 if (!this.helper.parent().is(this.appendTo)) { 5561 this.helper.detach().appendTo(this.appendTo); 5562 5563 //Update position 5564 this.offset.parent = this._getParentOffset(); 5565 } 5566 5567 //Generate the original position 5568 this.position = this.originalPosition = this._generatePosition(event); 5569 this.originalPageX = event.pageX; 5570 this.originalPageY = event.pageY; 5571 this.lastPositionAbs = this.positionAbs = this._convertPositionTo("absolute"); 5572 5573 this._mouseDrag(event); 5574 5575 return true; 5576 5577 }, 5578 5579 _scroll: function (event) { 5580 var o = this.options, 5581 scrolled = false; 5582 5583 if (this.scrollParent[0] !== this.document[0] && 5584 this.scrollParent[0].tagName !== "HTML") { 5585 5586 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 5587 event.pageY < o.scrollSensitivity) { 5588 this.scrollParent[0].scrollTop = 5589 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 5590 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 5591 this.scrollParent[0].scrollTop = 5592 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 5593 } 5594 5595 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 5596 event.pageX < o.scrollSensitivity) { 5597 this.scrollParent[0].scrollLeft = scrolled = 5598 this.scrollParent[0].scrollLeft + o.scrollSpeed; 5599 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 5600 this.scrollParent[0].scrollLeft = scrolled = 5601 this.scrollParent[0].scrollLeft - o.scrollSpeed; 5602 } 5603 5604 } else { 5605 5606 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 5607 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 5608 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 5609 o.scrollSensitivity) { 5610 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 5611 } 5612 5613 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 5614 scrolled = this.document.scrollLeft( 5615 this.document.scrollLeft() - o.scrollSpeed 5616 ); 5617 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 5618 o.scrollSensitivity) { 5619 scrolled = this.document.scrollLeft( 5620 this.document.scrollLeft() + o.scrollSpeed 5621 ); 5622 } 5623 5624 } 5625 5626 return scrolled; 5627 }, 5628 5629 _mouseDrag: function (event) { 5630 var i, item, itemElement, intersection, 5631 o = this.options; 5632 5633 //Compute the helpers position 5634 this.position = this._generatePosition(event); 5635 this.positionAbs = this._convertPositionTo("absolute"); 5636 5637 //Set the helper position 5638 if (!this.options.axis || this.options.axis !== "y") { 5639 this.helper[0].style.left = this.position.left + "px"; 5640 } 5641 if (!this.options.axis || this.options.axis !== "x") { 5642 this.helper[0].style.top = this.position.top + "px"; 5643 } 5644 5645 //Do scrolling 5646 if (o.scroll) { 5647 if (this._scroll(event) !== false) { 5648 5649 //Update item positions used in position checks 5650 this._refreshItemPositions(true); 5651 5652 if ($.ui.ddmanager && !o.dropBehaviour) { 5653 $.ui.ddmanager.prepareOffsets(this, event); 5654 } 5655 } 5656 } 5657 5658 this.dragDirection = { 5659 vertical: this._getDragVerticalDirection(), 5660 horizontal: this._getDragHorizontalDirection() 5661 }; 5662 5663 //Rearrange 5664 for (i = this.items.length - 1; i >= 0; i--) { 5665 5666 //Cache variables and intersection, continue if no intersection 5667 item = this.items[i]; 5668 itemElement = item.item[0]; 5669 intersection = this._intersectsWithPointer(item); 5670 if (!intersection) { 5671 continue; 5672 } 5673 5674 // Only put the placeholder inside the current Container, skip all 5675 // items from other containers. This works because when moving 5676 // an item from one container to another the 5677 // currentContainer is switched before the placeholder is moved. 5678 //
vendor: 15,297 bytes, lines 5679-6189
5679 // Without this, moving items in "sub-sortables" can cause 5680 // the placeholder to jitter between the outer and inner container. 5681 if (item.instance !== this.currentContainer) { 5682 continue; 5683 } 5684 5685 // Cannot intersect with itself 5686 // no useless actions that have been done before 5687 // no action if the item moved is the parent of the item checked 5688 if (itemElement !== this.currentItem[0] && 5689 this.placeholder[intersection === 1 ? 5690 "next" : "prev"]()[0] !== itemElement && 5691 !$.contains(this.placeholder[0], itemElement) && 5692 (this.options.type === "semi-dynamic" ? 5693 !$.contains(this.element[0], itemElement) : 5694 true 5695 ) 5696 ) { 5697 5698 this.direction = intersection === 1 ? "down" : "up"; 5699 5700 if (this.options.tolerance === "pointer" || 5701 this._intersectsWithSides(item)) { 5702 this._rearrange(event, item); 5703 } else { 5704 break; 5705 } 5706 5707 this._trigger("change", event, this._uiHash()); 5708 break; 5709 } 5710 } 5711 5712 //Post events to containers 5713 this._contactContainers(event); 5714 5715 //Interconnect with droppables 5716 if ($.ui.ddmanager) { 5717 $.ui.ddmanager.drag(this, event); 5718 } 5719 5720 //Call callbacks 5721 this._trigger("sort", event, this._uiHash()); 5722 5723 this.lastPositionAbs = this.positionAbs; 5724 return false; 5725 5726 }, 5727 5728 _mouseStop: function (event, noPropagation) { 5729 5730 if (!event) { 5731 return; 5732 } 5733 5734 //If we are using droppables, inform the manager about the drop 5735 if ($.ui.ddmanager && !this.options.dropBehaviour) { 5736 $.ui.ddmanager.drop(this, event); 5737 } 5738 5739 if (this.options.revert) { 5740 var that = this, 5741 cur = this.placeholder.offset(), 5742 axis = this.options.axis, 5743 animation = {}; 5744 5745 if (!axis || axis === "x") { 5746 animation.left = cur.left - this.offset.parent.left - this.margins.left + 5747 (this.offsetParent[0] === this.document[0].body ? 5748 0 : 5749 this.offsetParent[0].scrollLeft 5750 ); 5751 } 5752 if (!axis || axis === "y") { 5753 animation.top = cur.top - this.offset.parent.top - this.margins.top + 5754 (this.offsetParent[0] === this.document[0].body ? 5755 0 : 5756 this.offsetParent[0].scrollTop 5757 ); 5758 } 5759 this.reverting = true; 5760 $(this.helper).animate( 5761 animation, 5762 parseInt(this.options.revert, 10) || 500, 5763 function () { 5764 that._clear(event); 5765 } 5766 ); 5767 } else { 5768 this._clear(event, noPropagation); 5769 } 5770 5771 return false; 5772 5773 }, 5774 5775 cancel: function () { 5776 5777 if (this.dragging) { 5778 5779 this._mouseUp(new $.Event("mouseup", { target: null })); 5780 5781 if (this.options.helper === "original") { 5782 this.currentItem.css(this._storedCSS); 5783 this._removeClass(this.currentItem, "ui-sortable-helper"); 5784 } else { 5785 this.currentItem.show(); 5786 } 5787 5788 //Post deactivating events to containers 5789 for (var i = this.containers.length - 1; i >= 0; i--) { 5790 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 5791 if (this.containers[i].containerCache.over) { 5792 this.containers[i]._trigger("out", null, this._uiHash(this)); 5793 this.containers[i].containerCache.over = 0; 5794 } 5795 } 5796 5797 } 5798 5799 if (this.placeholder) { 5800 5801 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 5802 // it unbinds ALL events from the original node! 5803 if (this.placeholder[0].parentNode) { 5804 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 5805 } 5806 if (this.options.helper !== "original" && this.helper && 5807 this.helper[0].parentNode) { 5808 this.helper.remove(); 5809 } 5810 5811 $.extend(this, { 5812 helper: null, 5813 dragging: false, 5814 reverting: false, 5815 _noFinalSort: null 5816 }); 5817 5818 if (this.domPosition.prev) { 5819 $(this.domPosition.prev).after(this.currentItem); 5820 } else { 5821 $(this.domPosition.parent).prepend(this.currentItem); 5822 } 5823 } 5824 5825 return this; 5826 5827 }, 5828 5829 serialize: function (o) { 5830 5831 var items = this._getItemsAsjQuery(o && o.connected), 5832 str = []; 5833 o = o || {}; 5834 5835 $(items).each(function () { 5836 var res = ($(o.item || this).attr(o.attribute || "id") || "") 5837 .match(o.expression || (/(.+)[\-=_](.+)/)); 5838 if (res) { 5839 str.push( 5840 (o.key || res[1] + "[]") + 5841 "=" + (o.key && o.expression ? res[1] : res[2])); 5842 } 5843 }); 5844 5845 if (!str.length && o.key) { 5846 str.push(o.key + "="); 5847 } 5848 5849 return str.join("&"); 5850 5851 }, 5852 5853 toArray: function (o) { 5854 5855 var items = this._getItemsAsjQuery(o && o.connected), 5856 ret = []; 5857 5858 o = o || {}; 5859 5860 items.each(function () { 5861 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 5862 }); 5863 return ret; 5864 5865 }, 5866 5867 /* Be careful with the following core functions */ 5868 _intersectsWith: function (item) { 5869 5870 var x1 = this.positionAbs.left, 5871 x2 = x1 + this.helperProportions.width, 5872 y1 = this.positionAbs.top, 5873 y2 = y1 + this.helperProportions.height, 5874 l = item.left, 5875 r = l + item.width, 5876 t = item.top, 5877 b = t + item.height, 5878 dyClick = this.offset.click.top, 5879 dxClick = this.offset.click.left, 5880 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 5881 (y1 + dyClick) < b), 5882 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 5883 (x1 + dxClick) < r), 5884 isOverElement = isOverElementHeight && isOverElementWidth; 5885 5886 if (this.options.tolerance === "pointer" || 5887 this.options.forcePointerForContainers || 5888 (this.options.tolerance !== "pointer" && 5889 this.helperProportions[this.floating ? "width" : "height"] > 5890 item[this.floating ? "width" : "height"]) 5891 ) { 5892 return isOverElement; 5893 } else { 5894 5895 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 5896 x2 - (this.helperProportions.width / 2) < r && // Left Half 5897 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 5898 y2 - (this.helperProportions.height / 2) < b); // Top Half 5899 5900 } 5901 }, 5902 5903 _intersectsWithPointer: function (item) { 5904 var verticalDirection, horizontalDirection, 5905 isOverElementHeight = (this.options.axis === "x") || 5906 this._isOverAxis( 5907 this.positionAbs.top + this.offset.click.top, item.top, item.height), 5908 isOverElementWidth = (this.options.axis === "y") || 5909 this._isOverAxis( 5910 this.positionAbs.left + this.offset.click.left, item.left, item.width), 5911 isOverElement = isOverElementHeight && isOverElementWidth; 5912 5913 if (!isOverElement) { 5914 return false; 5915 } 5916 5917 verticalDirection = this.dragDirection.vertical; 5918 horizontalDirection = this.dragDirection.horizontal; 5919 5920 return this.floating ? 5921 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) : 5922 (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 5923 5924 }, 5925 5926 _intersectsWithSides: function (item) { 5927 5928 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 5929 this.offset.click.top, item.top + (item.height / 2), item.height), 5930 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 5931 this.offset.click.left, item.left + (item.width / 2), item.width), 5932 verticalDirection = this.dragDirection.vertical, 5933 horizontalDirection = this.dragDirection.horizontal; 5934 5935 if (this.floating && horizontalDirection) { 5936 return ((horizontalDirection === "right" && isOverRightHalf) || 5937 (horizontalDirection === "left" && !isOverRightHalf)); 5938 } else { 5939 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 5940 (verticalDirection === "up" && !isOverBottomHalf)); 5941 } 5942 5943 }, 5944 5945 _getDragVerticalDirection: function () { 5946 var delta = this.positionAbs.top - this.lastPositionAbs.top; 5947 return delta !== 0 && (delta > 0 ? "down" : "up"); 5948 }, 5949 5950 _getDragHorizontalDirection: function () { 5951 var delta = this.positionAbs.left - this.lastPositionAbs.left; 5952 return delta !== 0 && (delta > 0 ? "right" : "left"); 5953 }, 5954 5955 refresh: function (event) { 5956 this._refreshItems(event); 5957 this._setHandleClassName(); 5958 this.refreshPositions(); 5959 return this; 5960 }, 5961 5962 _connectWith: function () { 5963 var options = this.options; 5964 return options.connectWith.constructor === String ? 5965 [options.connectWith] : 5966 options.connectWith; 5967 }, 5968 5969 _getItemsAsjQuery: function (connected) { 5970 5971 var i, j, cur, inst, 5972 items = [], 5973 queries = [], 5974 connectWith = this._connectWith(); 5975 5976 if (connectWith && connected) { 5977 for (i = connectWith.length - 1; i >= 0; i--) { 5978 cur = $(connectWith[i], this.document[0]); 5979 for (j = cur.length - 1; j >= 0; j--) { 5980 inst = $.data(cur[j], this.widgetFullName); 5981 if (inst && inst !== this && !inst.options.disabled) { 5982 queries.push([typeof inst.options.items === "function" ? 5983 inst.options.items.call(inst.element) : 5984 $(inst.options.items, inst.element) 5985 .not(".ui-sortable-helper") 5986 .not(".ui-sortable-placeholder"), inst]); 5987 } 5988 } 5989 } 5990 } 5991 5992 queries.push([typeof this.options.items === "function" ? 5993 this.options.items 5994 .call(this.element, null, { options: this.options, item: this.currentItem }) : 5995 $(this.options.items, this.element) 5996 .not(".ui-sortable-helper") 5997 .not(".ui-sortable-placeholder"), this]); 5998 5999 function addItems() { 6000 items.push(this); 6001 } 6002 for (i = queries.length - 1; i >= 0; i--) { 6003 queries[i][0].each(addItems); 6004 } 6005 6006 return $(items); 6007 6008 }, 6009 6010 _removeCurrentsFromItems: function () { 6011 6012 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 6013 6014 this.items = $.grep(this.items, function (item) { 6015 for (var j = 0; j < list.length; j++) { 6016 if (list[j] === item.item[0]) { 6017 return false; 6018 } 6019 } 6020 return true; 6021 }); 6022 6023 }, 6024 6025 _refreshItems: function (event) { 6026 6027 this.items = []; 6028 this.containers = [this]; 6029 6030 var i, j, cur, inst, targetData, _queries, item, queriesLength, 6031 items = this.items, 6032 queries = [[typeof this.options.items === "function" ? 6033 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 6034 $(this.options.items, this.element), this]], 6035 connectWith = this._connectWith(); 6036 6037 //Shouldn't be run the first time through due to massive slow-down 6038 if (connectWith && this.ready) { 6039 for (i = connectWith.length - 1; i >= 0; i--) { 6040 cur = $(connectWith[i], this.document[0]); 6041 for (j = cur.length - 1; j >= 0; j--) { 6042 inst = $.data(cur[j], this.widgetFullName); 6043 if (inst && inst !== this && !inst.options.disabled) { 6044 queries.push([typeof inst.options.items === "function" ? 6045 inst.options.items 6046 .call(inst.element[0], event, { item: this.currentItem }) : 6047 $(inst.options.items, inst.element), inst]); 6048 this.containers.push(inst); 6049 } 6050 } 6051 } 6052 } 6053 6054 for (i = queries.length - 1; i >= 0; i--) { 6055 targetData = queries[i][1]; 6056 _queries = queries[i][0]; 6057 6058 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 6059 item = $(_queries[j]); 6060 6061 // Data for target checking (mouse manager) 6062 item.data(this.widgetName + "-item", targetData); 6063 6064 items.push({ 6065 item: item, 6066 instance: targetData, 6067 width: 0, height: 0, 6068 left: 0, top: 0 6069 }); 6070 } 6071 } 6072 6073 }, 6074 6075 _refreshItemPositions: function (fast) { 6076 var i, item, t, p; 6077 6078 for (i = this.items.length - 1; i >= 0; i--) { 6079 item = this.items[i]; 6080 6081 //We ignore calculating positions of all connected containers when we're not over them 6082 if (this.currentContainer && item.instance !== this.currentContainer && 6083 item.item[0] !== this.currentItem[0]) { 6084 continue; 6085 } 6086 6087 t = this.options.toleranceElement ? 6088 $(this.options.toleranceElement, item.item) : 6089 item.item; 6090 6091 if (!fast) { 6092 item.width = t.outerWidth(); 6093 item.height = t.outerHeight(); 6094 } 6095 6096 p = t.offset(); 6097 item.left = p.left; 6098 item.top = p.top; 6099 } 6100 }, 6101 6102 refreshPositions: function (fast) { 6103 6104 // Determine whether items are being displayed horizontally 6105 this.floating = this.items.length ? 6106 this.options.axis === "x" || this._isFloating(this.items[0].item) : 6107 false; 6108 6109 // This has to be redone because due to the item being moved out/into the offsetParent, 6110 // the offsetParent's position will change 6111 if (this.offsetParent && this.helper) { 6112 this.offset.parent = this._getParentOffset(); 6113 } 6114 6115 this._refreshItemPositions(fast); 6116 6117 var i, p; 6118 6119 if (this.options.custom && this.options.custom.refreshContainers) { 6120 this.options.custom.refreshContainers.call(this); 6121 } else { 6122 for (i = this.containers.length - 1; i >= 0; i--) { 6123 p = this.containers[i].element.offset(); 6124 this.containers[i].containerCache.left = p.left; 6125 this.containers[i].containerCache.top = p.top; 6126 this.containers[i].containerCache.width = 6127 this.containers[i].element.outerWidth(); 6128 this.containers[i].containerCache.height = 6129 this.containers[i].element.outerHeight(); 6130 } 6131 } 6132 6133 return this; 6134 }, 6135 6136 _createPlaceholder: function (that) { 6137 that = that || this; 6138 var className, nodeName, 6139 o = that.options; 6140 6141 if (!o.placeholder || o.placeholder.constructor === String) { 6142 className = o.placeholder; 6143 nodeName = that.currentItem[0].nodeName.toLowerCase(); 6144 o.placeholder = { 6145 element: function () { 6146 6147 var element = $("<" + nodeName + ">", that.document[0]); 6148 6149 that._addClass(element, "ui-sortable-placeholder", 6150 className || that.currentItem[0].className) 6151 ._removeClass(element, "ui-sortable-helper"); 6152 6153 if (nodeName === "tbody") { 6154 that._createTrPlaceholder( 6155 that.currentItem.find("tr").eq(0), 6156 $("<tr>", that.document[0]).appendTo(element) 6157 ); 6158 } else if (nodeName === "tr") { 6159 that._createTrPlaceholder(that.currentItem, element); 6160 } else if (nodeName === "img") { 6161 element.attr("src", that.currentItem.attr("src")); 6162 } 6163 6164 if (!className) { 6165 element.css("visibility", "hidden"); 6166 } 6167 6168 return element; 6169 }, 6170 update: function (container, p) { 6171 6172 // 1. If a className is set as 'placeholder option, we don't force sizes - 6173 // the class is responsible for that 6174 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 6175 // class name is specified 6176 if (className && !o.forcePlaceholderSize) { 6177 return; 6178 } 6179 6180 // If the element doesn't have a actual height or width by itself (without 6181 // styles coming from a stylesheet), it receives the inline height and width 6182 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 6183 // anyway since we're populating them with <td>s above, but they're unlikely to 6184 // be the correct height on their own if the row heights are dynamic, so we'll 6185 // always assign the height of the dragged item given forcePlaceholderSize 6186 // is true. 6187 if (!p.height() || (o.forcePlaceholderSize && 6188 (nodeName === "tbody" || nodeName === "tr"))) { 6189 p.height(
vendor: 12,083 bytes, lines 6190-6549
6190 that.currentItem.innerHeight() - 6191 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 6192 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 6193 } 6194 if (!p.width()) { 6195 p.width( 6196 that.currentItem.innerWidth() - 6197 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 6198 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 6199 } 6200 } 6201 }; 6202 } 6203 6204 //Create the placeholder 6205 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 6206 6207 //Append it after the actual current item 6208 that.currentItem.after(that.placeholder); 6209 6210 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 6211 o.placeholder.update(that, that.placeholder); 6212 6213 }, 6214 6215 _createTrPlaceholder: function (sourceTr, targetTr) { 6216 var that = this; 6217 6218 sourceTr.children().each(function () { 6219 $("<td> </td>", that.document[0]) 6220 .attr("colspan", $(this).attr("colspan") || 1) 6221 .appendTo(targetTr); 6222 }); 6223 }, 6224 6225 _contactContainers: function (event) { 6226 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 6227 floating, axis, 6228 innermostContainer = null, 6229 innermostIndex = null; 6230 6231 // Get innermost container that intersects with item 6232 for (i = this.containers.length - 1; i >= 0; i--) { 6233 6234 // Never consider a container that's located within the item itself 6235 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 6236 continue; 6237 } 6238 6239 if (this._intersectsWith(this.containers[i].containerCache)) { 6240 6241 // If we've already found a container and it's more "inner" than this, then continue 6242 if (innermostContainer && 6243 $.contains( 6244 this.containers[i].element[0], 6245 innermostContainer.element[0])) { 6246 continue; 6247 } 6248 6249 innermostContainer = this.containers[i]; 6250 innermostIndex = i; 6251 6252 } else { 6253 6254 // container doesn't intersect. trigger "out" event if necessary 6255 if (this.containers[i].containerCache.over) { 6256 this.containers[i]._trigger("out", event, this._uiHash(this)); 6257 this.containers[i].containerCache.over = 0; 6258 } 6259 } 6260 6261 } 6262 6263 // If no intersecting containers found, return 6264 if (!innermostContainer) { 6265 return; 6266 } 6267 6268 // Move the item into the container if it's not there already 6269 if (this.containers.length === 1) { 6270 if (!this.containers[innermostIndex].containerCache.over) { 6271 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6272 this.containers[innermostIndex].containerCache.over = 1; 6273 } 6274 } else { 6275 6276 // When entering a new container, we will find the item with the least distance and 6277 // append our item near it 6278 dist = 10000; 6279 itemWithLeastDistance = null; 6280 floating = innermostContainer.floating || this._isFloating(this.currentItem); 6281 posProperty = floating ? "left" : "top"; 6282 sizeProperty = floating ? "width" : "height"; 6283 axis = floating ? "pageX" : "pageY"; 6284 6285 for (j = this.items.length - 1; j >= 0; j--) { 6286 if (!$.contains( 6287 this.containers[innermostIndex].element[0], this.items[j].item[0]) 6288 ) { 6289 continue; 6290 } 6291 if (this.items[j].item[0] === this.currentItem[0]) { 6292 continue; 6293 } 6294 6295 cur = this.items[j].item.offset()[posProperty]; 6296 nearBottom = false; 6297 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 6298 nearBottom = true; 6299 } 6300 6301 if (Math.abs(event[axis] - cur) < dist) { 6302 dist = Math.abs(event[axis] - cur); 6303 itemWithLeastDistance = this.items[j]; 6304 this.direction = nearBottom ? "up" : "down"; 6305 } 6306 } 6307 6308 //Check if dropOnEmpty is enabled 6309 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 6310 return; 6311 } 6312 6313 if (this.currentContainer === this.containers[innermostIndex]) { 6314 if (!this.currentContainer.containerCache.over) { 6315 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 6316 this.currentContainer.containerCache.over = 1; 6317 } 6318 return; 6319 } 6320 6321 if (itemWithLeastDistance) { 6322 this._rearrange(event, itemWithLeastDistance, null, true); 6323 } else { 6324 this._rearrange(event, null, this.containers[innermostIndex].element, true); 6325 } 6326 this._trigger("change", event, this._uiHash()); 6327 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 6328 this.currentContainer = this.containers[innermostIndex]; 6329 6330 //Update the placeholder 6331 this.options.placeholder.update(this.currentContainer, this.placeholder); 6332 6333 //Update scrollParent 6334 this.scrollParent = this.placeholder.scrollParent(); 6335 6336 //Update overflowOffset 6337 if (this.scrollParent[0] !== this.document[0] && 6338 this.scrollParent[0].tagName !== "HTML") { 6339 this.overflowOffset = this.scrollParent.offset(); 6340 } 6341 6342 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 6343 this.containers[innermostIndex].containerCache.over = 1; 6344 } 6345 6346 }, 6347 6348 _createHelper: function (event) { 6349 6350 var o = this.options, 6351 helper = typeof o.helper === "function" ? 6352 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 6353 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 6354 6355 //Add the helper to the DOM if that didn't happen already 6356 if (!helper.parents("body").length) { 6357 this.appendTo[0].appendChild(helper[0]); 6358 } 6359 6360 if (helper[0] === this.currentItem[0]) { 6361 this._storedCSS = { 6362 width: this.currentItem[0].style.width, 6363 height: this.currentItem[0].style.height, 6364 position: this.currentItem.css("position"), 6365 top: this.currentItem.css("top"), 6366 left: this.currentItem.css("left") 6367 }; 6368 } 6369 6370 if (!helper[0].style.width || o.forceHelperSize) { 6371 helper.width(this.currentItem.width()); 6372 } 6373 if (!helper[0].style.height || o.forceHelperSize) { 6374 helper.height(this.currentItem.height()); 6375 } 6376 6377 return helper; 6378 6379 }, 6380 6381 _adjustOffsetFromHelper: function (obj) { 6382 if (typeof obj === "string") { 6383 obj = obj.split(" "); 6384 } 6385 if (Array.isArray(obj)) { 6386 obj = { left: +obj[0], top: +obj[1] || 0 }; 6387 } 6388 if ("left" in obj) { 6389 this.offset.click.left = obj.left + this.margins.left; 6390 } 6391 if ("right" in obj) { 6392 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6393 } 6394 if ("top" in obj) { 6395 this.offset.click.top = obj.top + this.margins.top; 6396 } 6397 if ("bottom" in obj) { 6398 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6399 } 6400 }, 6401 6402 _getParentOffset: function () { 6403 6404 //Get the offsetParent and cache its position 6405 this.offsetParent = this.helper.offsetParent(); 6406 var po = this.offsetParent.offset(); 6407 6408 // This is a special case where we need to modify a offset calculated on start, since the 6409 // following happened: 6410 // 1. The position of the helper is absolute, so it's position is calculated based on the 6411 // next positioned parent 6412 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 6413 // the document, which means that the scroll is included in the initial calculation of the 6414 // offset of the parent, and never recalculated upon drag 6415 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 6416 $.contains(this.scrollParent[0], this.offsetParent[0])) { 6417 po.left += this.scrollParent.scrollLeft(); 6418 po.top += this.scrollParent.scrollTop(); 6419 } 6420 6421 // This needs to be actually done for all browsers, since pageX/pageY includes this 6422 // information with an ugly IE fix 6423 if (this.offsetParent[0] === this.document[0].body || 6424 (this.offsetParent[0].tagName && 6425 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 6426 po = { top: 0, left: 0 }; 6427 } 6428 6429 return { 6430 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 6431 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 6432 }; 6433 6434 }, 6435 6436 _getRelativeOffset: function () { 6437 6438 if (this.cssPosition === "relative") { 6439 var p = this.currentItem.position(); 6440 return { 6441 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 6442 this.scrollParent.scrollTop(), 6443 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 6444 this.scrollParent.scrollLeft() 6445 }; 6446 } else { 6447 return { top: 0, left: 0 }; 6448 } 6449 6450 }, 6451 6452 _cacheMargins: function () { 6453 this.margins = { 6454 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 6455 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 6456 }; 6457 }, 6458 6459 _cacheHelperProportions: function () { 6460 this.helperProportions = { 6461 width: this.helper.outerWidth(), 6462 height: this.helper.outerHeight() 6463 }; 6464 }, 6465 6466 _setContainment: function () { 6467 6468 var ce, co, over, 6469 o = this.options; 6470 if (o.containment === "parent") { 6471 o.containment = this.helper[0].parentNode; 6472 } 6473 if (o.containment === "document" || o.containment === "window") { 6474 this.containment = [ 6475 0 - this.offset.relative.left - this.offset.parent.left, 6476 0 - this.offset.relative.top - this.offset.parent.top, 6477 o.containment === "document" ? 6478 this.document.width() : 6479 this.window.width() - this.helperProportions.width - this.margins.left, 6480 (o.containment === "document" ? 6481 (this.document.height() || document.body.parentNode.scrollHeight) : 6482 this.window.height() || this.document[0].body.parentNode.scrollHeight 6483 ) - this.helperProportions.height - this.margins.top 6484 ]; 6485 } 6486 6487 if (!(/^(document|window|parent)$/).test(o.containment)) { 6488 ce = $(o.containment)[0]; 6489 co = $(o.containment).offset(); 6490 over = ($(ce).css("overflow") !== "hidden"); 6491 6492 this.containment = [ 6493 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 6494 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 6495 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 6496 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 6497 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 6498 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 6499 (parseInt($(ce).css("paddingRight"), 10) || 0) - 6500 this.helperProportions.width - this.margins.left, 6501 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 6502 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 6503 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 6504 this.helperProportions.height - this.margins.top 6505 ]; 6506 } 6507 6508 }, 6509 6510 _convertPositionTo: function (d, pos) { 6511 6512 if (!pos) { 6513 pos = this.position; 6514 } 6515 var mod = d === "absolute" ? 1 : -1, 6516 scroll = this.cssPosition === "absolute" && 6517 !(this.scrollParent[0] !== this.document[0] && 6518 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6519 this.offsetParent : 6520 this.scrollParent, 6521 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6522 6523 return { 6524 top: ( 6525 6526 // The absolute mouse position 6527 pos.top + 6528 6529 // Only for relative positioned nodes: Relative offset from element to offset parent 6530 this.offset.relative.top * mod + 6531 6532 // The offsetParent's offset without borders (offset + border) 6533 this.offset.parent.top * mod - 6534 ((this.cssPosition === "fixed" ? 6535 -this.scrollParent.scrollTop() : 6536 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 6537 ), 6538 left: ( 6539 6540 // The absolute mouse position 6541 pos.left + 6542 6543 // Only for relative positioned nodes: Relative offset from element to offset parent 6544 this.offset.relative.left * mod + 6545 6546 // The offsetParent's offset without borders (offset + border) 6547 this.offset.parent.left * mod - 6548 ((this.cssPosition === "fixed" ? 6549 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,583 bytes, lines 6550-6684
6550 scroll.scrollLeft()) * mod) 6551 ) 6552 }; 6553 6554 }, 6555 6556 _generatePosition: function (event) { 6557 6558 var top, left, 6559 o = this.options, 6560 pageX = event.pageX, 6561 pageY = event.pageY, 6562 scroll = this.cssPosition === "absolute" && 6563 !(this.scrollParent[0] !== this.document[0] && 6564 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 6565 this.offsetParent : 6566 this.scrollParent, 6567 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 6568 6569 // This is another very weird special case that only happens for relative elements: 6570 // 1. If the css position is relative 6571 // 2. and the scroll parent is the document or similar to the offset parent 6572 // we have to refresh the relative offset during the scroll so there are no jumps 6573 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 6574 this.scrollParent[0] !== this.offsetParent[0])) { 6575 this.offset.relative = this._getRelativeOffset(); 6576 } 6577 6578 /* 6579 * - Position constraining - 6580 * Constrain the position to a mix of grid, containment. 6581 */ 6582 6583 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 6584 6585 if (this.containment) { 6586 if (event.pageX - this.offset.click.left < this.containment[0]) { 6587 pageX = this.containment[0] + this.offset.click.left; 6588 } 6589 if (event.pageY - this.offset.click.top < this.containment[1]) { 6590 pageY = this.containment[1] + this.offset.click.top; 6591 } 6592 if (event.pageX - this.offset.click.left > this.containment[2]) { 6593 pageX = this.containment[2] + this.offset.click.left; 6594 } 6595 if (event.pageY - this.offset.click.top > this.containment[3]) { 6596 pageY = this.containment[3] + this.offset.click.top; 6597 } 6598 } 6599 6600 if (o.grid) { 6601 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 6602 o.grid[1]) * o.grid[1]; 6603 pageY = this.containment ? 6604 ((top - this.offset.click.top >= this.containment[1] && 6605 top - this.offset.click.top <= this.containment[3]) ? 6606 top : 6607 ((top - this.offset.click.top >= this.containment[1]) ? 6608 top - o.grid[1] : top + o.grid[1])) : 6609 top; 6610 6611 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 6612 o.grid[0]) * o.grid[0]; 6613 pageX = this.containment ? 6614 ((left - this.offset.click.left >= this.containment[0] && 6615 left - this.offset.click.left <= this.containment[2]) ? 6616 left : 6617 ((left - this.offset.click.left >= this.containment[0]) ? 6618 left - o.grid[0] : left + o.grid[0])) : 6619 left; 6620 } 6621 6622 } 6623 6624 return { 6625 top: ( 6626 6627 // The absolute mouse position 6628 pageY - 6629 6630 // Click offset (relative to the element) 6631 this.offset.click.top - 6632 6633 // Only for relative positioned nodes: Relative offset from element to offset parent 6634 this.offset.relative.top - 6635 6636 // The offsetParent's offset without borders (offset + border) 6637 this.offset.parent.top + 6638 ((this.cssPosition === "fixed" ? 6639 -this.scrollParent.scrollTop() : 6640 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 6641 ), 6642 left: ( 6643 6644 // The absolute mouse position 6645 pageX - 6646 6647 // Click offset (relative to the element) 6648 this.offset.click.left - 6649 6650 // Only for relative positioned nodes: Relative offset from element to offset parent 6651 this.offset.relative.left - 6652 6653 // The offsetParent's offset without borders (offset + border) 6654 this.offset.parent.left + 6655 ((this.cssPosition === "fixed" ? 6656 -this.scrollParent.scrollLeft() : 6657 scrollIsRootNode ? 0 : scroll.scrollLeft())) 6658 ) 6659 }; 6660 6661 }, 6662 6663 _rearrange: function (event, i, a, hardRefresh) { 6664 6665 if (a) { 6666 a[0].appendChild(this.placeholder[0]); 6667 } else { 6668 i.item[0].parentNode.insertBefore(this.placeholder[0], 6669 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 6670 } 6671 6672 //Various things done here to improve the performance: 6673 // 1. we create a setTimeout, that calls refreshPositions 6674 // 2. on the instance, we have a counter variable, that get's higher after every append 6675 // 3. on the local scope, we copy the counter variable, and check in the timeout, 6676 // if it's still the same 6677 // 4. this lets only the last addition to the timeout stack through 6678 this.counter = this.counter ? ++this.counter : 1; 6679 var counter = this.counter; 6680 6681 this._delay(function () { 6682 if (counter === this.counter) { 6683 6684 //Precompute after each DOM insertion, NOT on mousemove
vendor: 13,431 bytes, lines 6685-7171
6685 this.refreshPositions(!hardRefresh); 6686 } 6687 }); 6688 6689 }, 6690 6691 _clear: function (event, noPropagation) { 6692 6693 this.reverting = false; 6694 6695 // We delay all events that have to be triggered to after the point where the placeholder 6696 // has been removed and everything else normalized again 6697 var i, 6698 delayedTriggers = []; 6699 6700 // We first have to update the dom position of the actual currentItem 6701 // Note: don't do it if the current item is already removed (by a user), or it gets 6702 // reappended (see #4088) 6703 if (!this._noFinalSort && this.currentItem.parent().length) { 6704 this.placeholder.before(this.currentItem); 6705 } 6706 this._noFinalSort = null; 6707 6708 if (this.helper[0] === this.currentItem[0]) { 6709 for (i in this._storedCSS) { 6710 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 6711 this._storedCSS[i] = ""; 6712 } 6713 } 6714 this.currentItem.css(this._storedCSS); 6715 this._removeClass(this.currentItem, "ui-sortable-helper"); 6716 } else { 6717 this.currentItem.show(); 6718 } 6719 6720 if (this.fromOutside && !noPropagation) { 6721 delayedTriggers.push(function (event) { 6722 this._trigger("receive", event, this._uiHash(this.fromOutside)); 6723 }); 6724 } 6725 if ((this.fromOutside || 6726 this.domPosition.prev !== 6727 this.currentItem.prev().not(".ui-sortable-helper")[0] || 6728 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 6729 6730 // Trigger update callback if the DOM position has changed 6731 delayedTriggers.push(function (event) { 6732 this._trigger("update", event, this._uiHash()); 6733 }); 6734 } 6735 6736 // Check if the items Container has Changed and trigger appropriate 6737 // events. 6738 if (this !== this.currentContainer) { 6739 if (!noPropagation) { 6740 delayedTriggers.push(function (event) { 6741 this._trigger("remove", event, this._uiHash()); 6742 }); 6743 delayedTriggers.push((function (c) { 6744 return function (event) { 6745 c._trigger("receive", event, this._uiHash(this)); 6746 }; 6747 }).call(this, this.currentContainer)); 6748 delayedTriggers.push((function (c) { 6749 return function (event) { 6750 c._trigger("update", event, this._uiHash(this)); 6751 }; 6752 }).call(this, this.currentContainer)); 6753 } 6754 } 6755 6756 //Post events to containers 6757 function delayEvent(type, instance, container) { 6758 return function (event) { 6759 container._trigger(type, event, instance._uiHash(instance)); 6760 }; 6761 } 6762 for (i = this.containers.length - 1; i >= 0; i--) { 6763 if (!noPropagation) { 6764 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 6765 } 6766 if (this.containers[i].containerCache.over) { 6767 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 6768 this.containers[i].containerCache.over = 0; 6769 } 6770 } 6771 6772 //Do what was originally in plugins 6773 if (this.storedCursor) { 6774 this.document.find("body").css("cursor", this.storedCursor); 6775 this.storedStylesheet.remove(); 6776 } 6777 if (this._storedOpacity) { 6778 this.helper.css("opacity", this._storedOpacity); 6779 } 6780 if (this._storedZIndex) { 6781 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 6782 } 6783 6784 this.dragging = false; 6785 6786 if (!noPropagation) { 6787 this._trigger("beforeStop", event, this._uiHash()); 6788 } 6789 6790 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 6791 // it unbinds ALL events from the original node! 6792 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 6793 6794 if (!this.cancelHelperRemoval) { 6795 if (this.helper[0] !== this.currentItem[0]) { 6796 this.helper.remove(); 6797 } 6798 this.helper = null; 6799 } 6800 6801 if (!noPropagation) { 6802 for (i = 0; i < delayedTriggers.length; i++) { 6803 6804 // Trigger all delayed events 6805 delayedTriggers[i].call(this, event); 6806 } 6807 this._trigger("stop", event, this._uiHash()); 6808 } 6809 6810 this.fromOutside = false; 6811 return !this.cancelHelperRemoval; 6812 6813 }, 6814 6815 _trigger: function () { 6816 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 6817 this.cancel(); 6818 } 6819 }, 6820 6821 _uiHash: function (_inst) { 6822 var inst = _inst || this; 6823 return { 6824 helper: inst.helper, 6825 placeholder: inst.placeholder || $([]), 6826 position: inst.position, 6827 originalPosition: inst.originalPosition, 6828 offset: inst.positionAbs, 6829 item: inst.currentItem, 6830 sender: _inst ? _inst.element : null 6831 }; 6832 } 6833 6834 }); 6835 6836 6837 /*! 6838 * jQuery UI Accordion 1.13.2 6839 * http://jqueryui.com 6840 * 6841 * Copyright jQuery Foundation and other contributors 6842 * Released under the MIT license. 6843 * http://jquery.org/license 6844 */ 6845 6846 //>>label: Accordion 6847 //>>group: Widgets 6848 /* eslint-disable max-len */ 6849 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 6850 /* eslint-enable max-len */ 6851 //>>docs: http://api.jqueryui.com/accordion/ 6852 //>>demos: http://jqueryui.com/accordion/ 6853 //>>css.structure: ../../themes/base/core.css 6854 //>>css.structure: ../../themes/base/accordion.css 6855 //>>css.theme: ../../themes/base/theme.css 6856 6857 6858 var widgetsAccordion = $.widget("ui.accordion", { 6859 version: "1.13.2", 6860 options: { 6861 active: 0, 6862 animate: {}, 6863 classes: { 6864 "ui-accordion-header": "ui-corner-top", 6865 "ui-accordion-header-collapsed": "ui-corner-all", 6866 "ui-accordion-content": "ui-corner-bottom" 6867 }, 6868 collapsible: false, 6869 event: "click", 6870 header: function (elem) { 6871 return elem.find("> li > :first-child").add(elem.find("> :not(li)").even()); 6872 }, 6873 heightStyle: "auto", 6874 icons: { 6875 activeHeader: "ui-icon-triangle-1-s", 6876 header: "ui-icon-triangle-1-e" 6877 }, 6878 6879 // Callbacks 6880 activate: null, 6881 beforeActivate: null 6882 }, 6883 6884 hideProps: { 6885 borderTopWidth: "hide", 6886 borderBottomWidth: "hide", 6887 paddingTop: "hide", 6888 paddingBottom: "hide", 6889 height: "hide" 6890 }, 6891 6892 showProps: { 6893 borderTopWidth: "show", 6894 borderBottomWidth: "show", 6895 paddingTop: "show", 6896 paddingBottom: "show", 6897 height: "show" 6898 }, 6899 6900 _create: function () { 6901 var options = this.options; 6902 6903 this.prevShow = this.prevHide = $(); 6904 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 6905 this.element.attr("role", "tablist"); 6906 6907 // Don't allow collapsible: false and active: false / null 6908 if (!options.collapsible && (options.active === false || options.active == null)) { 6909 options.active = 0; 6910 } 6911 6912 this._processPanels(); 6913 6914 // handle negative values 6915 if (options.active < 0) { 6916 options.active += this.headers.length; 6917 } 6918 this._refresh(); 6919 }, 6920 6921 _getCreateEventData: function () { 6922 return { 6923 header: this.active, 6924 panel: !this.active.length ? $() : this.active.next() 6925 }; 6926 }, 6927 6928 _createIcons: function () { 6929 var icon, children, 6930 icons = this.options.icons; 6931 6932 if (icons) { 6933 icon = $("<span>"); 6934 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 6935 icon.prependTo(this.headers); 6936 children = this.active.children(".ui-accordion-header-icon"); 6937 this._removeClass(children, icons.header) 6938 ._addClass(children, null, icons.activeHeader) 6939 ._addClass(this.headers, "ui-accordion-icons"); 6940 } 6941 }, 6942 6943 _destroyIcons: function () { 6944 this._removeClass(this.headers, "ui-accordion-icons"); 6945 this.headers.children(".ui-accordion-header-icon").remove(); 6946 }, 6947 6948 _destroy: function () { 6949 var contents; 6950 6951 // Clean up main element 6952 this.element.removeAttr("role"); 6953 6954 // Clean up headers 6955 this.headers 6956 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 6957 .removeUniqueId(); 6958 6959 this._destroyIcons(); 6960 6961 // Clean up content panels 6962 contents = this.headers.next() 6963 .css("display", "") 6964 .removeAttr("role aria-hidden aria-labelledby") 6965 .removeUniqueId(); 6966 6967 if (this.options.heightStyle !== "content") { 6968 contents.css("height", ""); 6969 } 6970 }, 6971 6972 _setOption: function (key, value) { 6973 if (key === "active") { 6974 6975 // _activate() will handle invalid values and update this.options 6976 this._activate(value); 6977 return; 6978 } 6979 6980 if (key === "event") { 6981 if (this.options.event) { 6982 this._off(this.headers, this.options.event); 6983 } 6984 this._setupEvents(value); 6985 } 6986 6987 this._super(key, value); 6988 6989 // Setting collapsible: false while collapsed; open first panel 6990 if (key === "collapsible" && !value && this.options.active === false) { 6991 this._activate(0); 6992 } 6993 6994 if (key === "icons") { 6995 this._destroyIcons(); 6996 if (value) { 6997 this._createIcons(); 6998 } 6999 } 7000 }, 7001 7002 _setOptionDisabled: function (value) { 7003 this._super(value); 7004 7005 this.element.attr("aria-disabled", value); 7006 7007 // Support: IE8 Only 7008 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 7009 // so we need to add the disabled class to the headers and panels 7010 this._toggleClass(null, "ui-state-disabled", !!value); 7011 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", 7012 !!value); 7013 }, 7014 7015 _keydown: function (event) { 7016 if (event.altKey || event.ctrlKey) { 7017 return; 7018 } 7019 7020 var keyCode = $.ui.keyCode, 7021 length = this.headers.length, 7022 currentIndex = this.headers.index(event.target), 7023 toFocus = false; 7024 7025 switch (event.keyCode) { 7026 case keyCode.RIGHT: 7027 case keyCode.DOWN: 7028 toFocus = this.headers[(currentIndex + 1) % length]; 7029 break; 7030 case keyCode.LEFT: 7031 case keyCode.UP: 7032 toFocus = this.headers[(currentIndex - 1 + length) % length]; 7033 break; 7034 case keyCode.SPACE: 7035 case keyCode.ENTER: 7036 this._eventHandler(event); 7037 break; 7038 case keyCode.HOME: 7039 toFocus = this.headers[0]; 7040 break; 7041 case keyCode.END: 7042 toFocus = this.headers[length - 1]; 7043 break; 7044 } 7045 7046 if (toFocus) { 7047 $(event.target).attr("tabIndex", -1); 7048 $(toFocus).attr("tabIndex", 0); 7049 $(toFocus).trigger("focus"); 7050 event.preventDefault(); 7051 } 7052 }, 7053 7054 _panelKeyDown: function (event) { 7055 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 7056 $(event.currentTarget).prev().trigger("focus"); 7057 } 7058 }, 7059 7060 refresh: function () { 7061 var options = this.options; 7062 this._processPanels(); 7063 7064 // Was collapsed or no panel 7065 if ((options.active === false && options.collapsible === true) || 7066 !this.headers.length) { 7067 options.active = false; 7068 this.active = $(); 7069 7070 // active false only when collapsible is true 7071 } else if (options.active === false) { 7072 this._activate(0); 7073 7074 // was active, but active panel is gone 7075 } else if (this.active.length && !$.contains(this.element[0], this.active[0])) { 7076 7077 // all remaining panel are disabled 7078 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 7079 options.active = false; 7080 this.active = $(); 7081 7082 // activate previous panel 7083 } else { 7084 this._activate(Math.max(0, options.active - 1)); 7085 } 7086 7087 // was active, active panel still exists 7088 } else { 7089 7090 // make sure active index is correct 7091 options.active = this.headers.index(this.active); 7092 } 7093 7094 this._destroyIcons(); 7095 7096 this._refresh(); 7097 }, 7098 7099 _processPanels: function () { 7100 var prevHeaders = this.headers, 7101 prevPanels = this.panels; 7102 7103 if (typeof this.options.header === "function") { 7104 this.headers = this.options.header(this.element); 7105 } else { 7106 this.headers = this.element.find(this.options.header); 7107 } 7108 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 7109 "ui-state-default"); 7110 7111 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 7112 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 7113 7114 // Avoid memory leaks (#10056) 7115 if (prevPanels) { 7116 this._off(prevHeaders.not(this.headers)); 7117 this._off(prevPanels.not(this.panels)); 7118 } 7119 }, 7120 7121 _refresh: function () { 7122 var maxHeight, 7123 options = this.options, 7124 heightStyle = options.heightStyle, 7125 parent = this.element.parent(); 7126 7127 this.active = this._findActive(options.active); 7128 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 7129 ._removeClass(this.active, "ui-accordion-header-collapsed"); 7130 this._addClass(this.active.next(), "ui-accordion-content-active"); 7131 this.active.next().show(); 7132 7133 this.headers 7134 .attr("role", "tab") 7135 .each(function () { 7136 var header = $(this), 7137 headerId = header.uniqueId().attr("id"), 7138 panel = header.next(), 7139 panelId = panel.uniqueId().attr("id"); 7140 header.attr("aria-controls", panelId); 7141 panel.attr("aria-labelledby", headerId); 7142 }) 7143 .next() 7144 .attr("role", "tabpanel"); 7145 7146 this.headers 7147 .not(this.active) 7148 .attr({ 7149 "aria-selected": "false", 7150 "aria-expanded": "false", 7151 tabIndex: -1 7152 }) 7153 .next() 7154 .attr({ 7155 "aria-hidden": "true" 7156 }) 7157 .hide(); 7158 7159 // Make sure at least one header is in the tab order 7160 if (!this.active.length) { 7161 this.headers.eq(0).attr("tabIndex", 0); 7162 } else { 7163 this.active.attr({ 7164 "aria-selected": "true", 7165 "aria-expanded": "true", 7166 tabIndex: 0 7167 }) 7168 .next() 7169 .attr({ 7170 "aria-hidden": "false" 7171 });
vendor: 4,766 bytes, lines 7172-7338
7172 } 7173 7174 this._createIcons(); 7175 7176 this._setupEvents(options.event); 7177 7178 if (heightStyle === "fill") { 7179 maxHeight = parent.height(); 7180 this.element.siblings(":visible").each(function () { 7181 var elem = $(this), 7182 position = elem.css("position"); 7183 7184 if (position === "absolute" || position === "fixed") { 7185 return; 7186 } 7187 maxHeight -= elem.outerHeight(true); 7188 }); 7189 7190 this.headers.each(function () { 7191 maxHeight -= $(this).outerHeight(true); 7192 }); 7193 7194 this.headers.next() 7195 .each(function () { 7196 $(this).height(Math.max(0, maxHeight - 7197 $(this).innerHeight() + $(this).height())); 7198 }) 7199 .css("overflow", "auto"); 7200 } else if (heightStyle === "auto") { 7201 maxHeight = 0; 7202 this.headers.next() 7203 .each(function () { 7204 var isVisible = $(this).is(":visible"); 7205 if (!isVisible) { 7206 $(this).show(); 7207 } 7208 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 7209 if (!isVisible) { 7210 $(this).hide(); 7211 } 7212 }) 7213 .height(maxHeight); 7214 } 7215 }, 7216 7217 _activate: function (index) { 7218 var active = this._findActive(index)[0]; 7219 7220 // Trying to activate the already active panel 7221 if (active === this.active[0]) { 7222 return; 7223 } 7224 7225 // Trying to collapse, simulate a click on the currently active header 7226 active = active || this.active[0]; 7227 7228 this._eventHandler({ 7229 target: active, 7230 currentTarget: active, 7231 preventDefault: $.noop 7232 }); 7233 }, 7234 7235 _findActive: function (selector) { 7236 return typeof selector === "number" ? this.headers.eq(selector) : $(); 7237 }, 7238 7239 _setupEvents: function (event) { 7240 var events = { 7241 keydown: "_keydown" 7242 }; 7243 if (event) { 7244 $.each(event.split(" "), function (index, eventName) { 7245 events[eventName] = "_eventHandler"; 7246 }); 7247 } 7248 7249 this._off(this.headers.add(this.headers.next())); 7250 this._on(this.headers, events); 7251 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 7252 this._hoverable(this.headers); 7253 this._focusable(this.headers); 7254 }, 7255 7256 _eventHandler: function (event) { 7257 var activeChildren, clickedChildren, 7258 options = this.options, 7259 active = this.active, 7260 clicked = $(event.currentTarget), 7261 clickedIsActive = clicked[0] === active[0], 7262 collapsing = clickedIsActive && options.collapsible, 7263 toShow = collapsing ? $() : clicked.next(), 7264 toHide = active.next(), 7265 eventData = { 7266 oldHeader: active, 7267 oldPanel: toHide, 7268 newHeader: collapsing ? $() : clicked, 7269 newPanel: toShow 7270 }; 7271 7272 event.preventDefault(); 7273 7274 if ( 7275 7276 // click on active header, but not collapsible 7277 (clickedIsActive && !options.collapsible) || 7278 7279 // allow canceling activation 7280 (this._trigger("beforeActivate", event, eventData) === false)) { 7281 return; 7282 } 7283 7284 options.active = collapsing ? false : this.headers.index(clicked); 7285 7286 // When the call to ._toggle() comes after the class changes 7287 // it causes a very odd bug in IE 8 (see #6720) 7288 this.active = clickedIsActive ? $() : clicked; 7289 this._toggle(eventData); 7290 7291 // Switch classes 7292 // corner classes on the previously active header stay after the animation 7293 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 7294 if (options.icons) { 7295 activeChildren = active.children(".ui-accordion-header-icon"); 7296 this._removeClass(activeChildren, null, options.icons.activeHeader) 7297 ._addClass(activeChildren, null, options.icons.header); 7298 } 7299 7300 if (!clickedIsActive) { 7301 this._removeClass(clicked, "ui-accordion-header-collapsed") 7302 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 7303 if (options.icons) { 7304 clickedChildren = clicked.children(".ui-accordion-header-icon"); 7305 this._removeClass(clickedChildren, null, options.icons.header) 7306 ._addClass(clickedChildren, null, options.icons.activeHeader); 7307 } 7308 7309 this._addClass(clicked.next(), "ui-accordion-content-active"); 7310 } 7311 }, 7312 7313 _toggle: function (data) { 7314 var toShow = data.newPanel, 7315 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 7316 7317 // Handle activating a panel during the animation for another activation 7318 this.prevShow.add(this.prevHide).stop(true, true); 7319 this.prevShow = toShow; 7320 this.prevHide = toHide; 7321 7322 if (this.options.animate) { 7323 this._animate(toShow, toHide, data); 7324 } else { 7325 toHide.hide(); 7326 toShow.show(); 7327 this._toggleComplete(data); 7328 } 7329 7330 toHide.attr({ 7331 "aria-hidden": "true" 7332 }); 7333 toHide.prev().attr({ 7334 "aria-selected": "false", 7335 "aria-expanded": "false" 7336 }); 7337 7338 // if we're switching panels, remove the old header from the tab order
vendor: 6,077 bytes, lines 7339-7555
7339 // if we're opening from collapsed state, remove the previous header from the tab order 7340 // if we're collapsing, then keep the collapsing header in the tab order 7341 if (toShow.length && toHide.length) { 7342 toHide.prev().attr({ 7343 "tabIndex": -1, 7344 "aria-expanded": "false" 7345 }); 7346 } else if (toShow.length) { 7347 this.headers.filter(function () { 7348 return parseInt($(this).attr("tabIndex"), 10) === 0; 7349 }) 7350 .attr("tabIndex", -1); 7351 } 7352 7353 toShow 7354 .attr("aria-hidden", "false") 7355 .prev() 7356 .attr({ 7357 "aria-selected": "true", 7358 "aria-expanded": "true", 7359 tabIndex: 0 7360 }); 7361 }, 7362 7363 _animate: function (toShow, toHide, data) { 7364 var total, easing, duration, 7365 that = this, 7366 adjust = 0, 7367 boxSizing = toShow.css("box-sizing"), 7368 down = toShow.length && 7369 (!toHide.length || (toShow.index() < toHide.index())), 7370 animate = this.options.animate || {}, 7371 options = down && animate.down || animate, 7372 complete = function () { 7373 that._toggleComplete(data); 7374 }; 7375 7376 if (typeof options === "number") { 7377 duration = options; 7378 } 7379 if (typeof options === "string") { 7380 easing = options; 7381 } 7382 7383 // fall back from options to animation in case of partial down settings 7384 easing = easing || options.easing || animate.easing; 7385 duration = duration || options.duration || animate.duration; 7386 7387 if (!toHide.length) { 7388 return toShow.animate(this.showProps, duration, easing, complete); 7389 } 7390 if (!toShow.length) { 7391 return toHide.animate(this.hideProps, duration, easing, complete); 7392 } 7393 7394 total = toShow.show().outerHeight(); 7395 toHide.animate(this.hideProps, { 7396 duration: duration, 7397 easing: easing, 7398 step: function (now, fx) { 7399 fx.now = Math.round(now); 7400 } 7401 }); 7402 toShow 7403 .hide() 7404 .animate(this.showProps, { 7405 duration: duration, 7406 easing: easing, 7407 complete: complete, 7408 step: function (now, fx) { 7409 fx.now = Math.round(now); 7410 if (fx.prop !== "height") { 7411 if (boxSizing === "content-box") { 7412 adjust += fx.now; 7413 } 7414 } else if (that.options.heightStyle !== "content") { 7415 fx.now = Math.round(total - toHide.outerHeight() - adjust); 7416 adjust = 0; 7417 } 7418 } 7419 }); 7420 }, 7421 7422 _toggleComplete: function (data) { 7423 var toHide = data.oldPanel, 7424 prev = toHide.prev(); 7425 7426 this._removeClass(toHide, "ui-accordion-content-active"); 7427 this._removeClass(prev, "ui-accordion-header-active") 7428 ._addClass(prev, "ui-accordion-header-collapsed"); 7429 7430 // Work around for rendering bug in IE (#5421) 7431 if (toHide.length) { 7432 toHide.parent()[0].className = toHide.parent()[0].className; 7433 } 7434 this._trigger("activate", null, data); 7435 } 7436 }); 7437 7438 7439 /*! 7440 * jQuery UI Menu 1.13.2 7441 * http://jqueryui.com 7442 * 7443 * Copyright jQuery Foundation and other contributors 7444 * Released under the MIT license. 7445 * http://jquery.org/license 7446 */ 7447 7448 //>>label: Menu 7449 //>>group: Widgets 7450 //>>description: Creates nestable menus. 7451 //>>docs: http://api.jqueryui.com/menu/ 7452 //>>demos: http://jqueryui.com/menu/ 7453 //>>css.structure: ../../themes/base/core.css 7454 //>>css.structure: ../../themes/base/menu.css 7455 //>>css.theme: ../../themes/base/theme.css 7456 7457 7458 var widgetsMenu = $.widget("ui.menu", { 7459 version: "1.13.2", 7460 defaultElement: "<ul>", 7461 delay: 300, 7462 options: { 7463 icons: { 7464 submenu: "ui-icon-caret-1-e" 7465 }, 7466 items: "> *", 7467 menus: "ul", 7468 position: { 7469 my: "left top", 7470 at: "right top" 7471 }, 7472 role: "menu", 7473 7474 // Callbacks 7475 blur: null, 7476 focus: null, 7477 select: null 7478 }, 7479 7480 _create: function () { 7481 this.activeMenu = this.element; 7482 7483 // Flag used to prevent firing of the click handler 7484 // as the event bubbles up through nested menus 7485 this.mouseHandled = false; 7486 this.lastMousePosition = { x: null, y: null }; 7487 this.element 7488 .uniqueId() 7489 .attr({ 7490 role: this.options.role, 7491 tabIndex: 0 7492 }); 7493 7494 this._addClass("ui-menu", "ui-widget ui-widget-content"); 7495 this._on({ 7496 7497 // Prevent focus from sticking to links inside menu after clicking 7498 // them (focus should always stay on UL during navigation). 7499 "mousedown .ui-menu-item": function (event) { 7500 event.preventDefault(); 7501 7502 this._activateItem(event); 7503 }, 7504 "click .ui-menu-item": function (event) { 7505 var target = $(event.target); 7506 var active = $($.ui.safeActiveElement(this.document[0])); 7507 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 7508 this.select(event); 7509 7510 // Only set the mouseHandled flag if the event will bubble, see #9469. 7511 if (!event.isPropagationStopped()) { 7512 this.mouseHandled = true; 7513 } 7514 7515 // Open submenu on click 7516 if (target.has(".ui-menu").length) { 7517 this.expand(event); 7518 } else if (!this.element.is(":focus") && 7519 active.closest(".ui-menu").length) { 7520 7521 // Redirect focus to the menu 7522 this.element.trigger("focus", [true]); 7523 7524 // If the active item is on the top level, let it stay active. 7525 // Otherwise, blur the active item since it is no longer visible. 7526 if (this.active && this.active.parents(".ui-menu").length === 1) { 7527 clearTimeout(this.timer); 7528 } 7529 } 7530 } 7531 }, 7532 "mouseenter .ui-menu-item": "_activateItem", 7533 "mousemove .ui-menu-item": "_activateItem", 7534 mouseleave: "collapseAll", 7535 "mouseleave .ui-menu": "collapseAll", 7536 focus: function (event, keepActiveItem) { 7537 7538 // If there's already an active item, keep it active 7539 // If not, activate the first item 7540 var item = this.active || this._menuItems().first(); 7541 7542 if (!keepActiveItem) { 7543 this.focus(event, item); 7544 } 7545 }, 7546 blur: function (event) { 7547 this._delay(function () { 7548 var notContained = !$.contains( 7549 this.element[0], 7550 $.ui.safeActiveElement(this.document[0]) 7551 ); 7552 if (notContained) { 7553 this.collapseAll(event); 7554 } 7555 });
vendor: 13,718 bytes, lines 7556-8049
7556 }, 7557 keydown: "_keydown" 7558 }); 7559 7560 this.refresh(); 7561 7562 // Clicks outside of a menu collapse any open menus 7563 this._on(this.document, { 7564 click: function (event) { 7565 if (this._closeOnDocumentClick(event)) { 7566 this.collapseAll(event, true); 7567 } 7568 7569 // Reset the mouseHandled flag 7570 this.mouseHandled = false; 7571 } 7572 }); 7573 }, 7574 7575 _activateItem: function (event) { 7576 7577 // Ignore mouse events while typeahead is active, see #10458. 7578 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 7579 // is over an item in the menu 7580 if (this.previousFilter) { 7581 return; 7582 } 7583 7584 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 7585 if (event.clientX === this.lastMousePosition.x && 7586 event.clientY === this.lastMousePosition.y) { 7587 return; 7588 } 7589 7590 this.lastMousePosition = { 7591 x: event.clientX, 7592 y: event.clientY 7593 }; 7594 7595 var actualTarget = $(event.target).closest(".ui-menu-item"), 7596 target = $(event.currentTarget); 7597 7598 // Ignore bubbled events on parent items, see #11641 7599 if (actualTarget[0] !== target[0]) { 7600 return; 7601 } 7602 7603 // If the item is already active, there's nothing to do 7604 if (target.is(".ui-state-active")) { 7605 return; 7606 } 7607 7608 // Remove ui-state-active class from siblings of the newly focused menu item 7609 // to avoid a jump caused by adjacent elements both having a class with a border 7610 this._removeClass(target.siblings().children(".ui-state-active"), 7611 null, "ui-state-active"); 7612 this.focus(event, target); 7613 }, 7614 7615 _destroy: function () { 7616 var items = this.element.find(".ui-menu-item") 7617 .removeAttr("role aria-disabled"), 7618 submenus = items.children(".ui-menu-item-wrapper") 7619 .removeUniqueId() 7620 .removeAttr("tabIndex role aria-haspopup"); 7621 7622 // Destroy (sub)menus 7623 this.element 7624 .removeAttr("aria-activedescendant") 7625 .find(".ui-menu").addBack() 7626 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 7627 "tabIndex") 7628 .removeUniqueId() 7629 .show(); 7630 7631 submenus.children().each(function () { 7632 var elem = $(this); 7633 if (elem.data("ui-menu-submenu-caret")) { 7634 elem.remove(); 7635 } 7636 }); 7637 }, 7638 7639 _keydown: function (event) { 7640 var match, prev, character, skip, 7641 preventDefault = true; 7642 7643 switch (event.keyCode) { 7644 case $.ui.keyCode.PAGE_UP: 7645 this.previousPage(event); 7646 break; 7647 case $.ui.keyCode.PAGE_DOWN: 7648 this.nextPage(event); 7649 break; 7650 case $.ui.keyCode.HOME: 7651 this._move("first", "first", event); 7652 break; 7653 case $.ui.keyCode.END: 7654 this._move("last", "last", event); 7655 break; 7656 case $.ui.keyCode.UP: 7657 this.previous(event); 7658 break; 7659 case $.ui.keyCode.DOWN: 7660 this.next(event); 7661 break; 7662 case $.ui.keyCode.LEFT: 7663 this.collapse(event); 7664 break; 7665 case $.ui.keyCode.RIGHT: 7666 if (this.active && !this.active.is(".ui-state-disabled")) { 7667 this.expand(event); 7668 } 7669 break; 7670 case $.ui.keyCode.ENTER: 7671 case $.ui.keyCode.SPACE: 7672 this._activate(event); 7673 break; 7674 case $.ui.keyCode.ESCAPE: 7675 this.collapse(event); 7676 break; 7677 default: 7678 preventDefault = false; 7679 prev = this.previousFilter || ""; 7680 skip = false; 7681 7682 // Support number pad values 7683 character = event.keyCode >= 96 && event.keyCode <= 105 ? 7684 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 7685 7686 clearTimeout(this.filterTimer); 7687 7688 if (character === prev) { 7689 skip = true; 7690 } else { 7691 character = prev + character; 7692 } 7693 7694 match = this._filterMenuItems(character); 7695 match = skip && match.index(this.active.next()) !== -1 ? 7696 this.active.nextAll(".ui-menu-item") : 7697 match; 7698 7699 // If no matches on the current filter, reset to the last character pressed 7700 // to move down the menu to the first item that starts with that character 7701 if (!match.length) { 7702 character = String.fromCharCode(event.keyCode); 7703 match = this._filterMenuItems(character); 7704 } 7705 7706 if (match.length) { 7707 this.focus(event, match); 7708 this.previousFilter = character; 7709 this.filterTimer = this._delay(function () { 7710 delete this.previousFilter; 7711 }, 1000); 7712 } else { 7713 delete this.previousFilter; 7714 } 7715 } 7716 7717 if (preventDefault) { 7718 event.preventDefault(); 7719 } 7720 }, 7721 7722 _activate: function (event) { 7723 if (this.active && !this.active.is(".ui-state-disabled")) { 7724 if (this.active.children("[aria-haspopup='true']").length) { 7725 this.expand(event); 7726 } else { 7727 this.select(event); 7728 } 7729 } 7730 }, 7731 7732 refresh: function () { 7733 var menus, items, newSubmenus, newItems, newWrappers, 7734 that = this, 7735 icon = this.options.icons.submenu, 7736 submenus = this.element.find(this.options.menus); 7737 7738 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 7739 7740 // Initialize nested menus 7741 newSubmenus = submenus.filter(":not(.ui-menu)") 7742 .hide() 7743 .attr({ 7744 role: this.options.role, 7745 "aria-hidden": "true", 7746 "aria-expanded": "false" 7747 }) 7748 .each(function () { 7749 var menu = $(this), 7750 item = menu.prev(), 7751 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 7752 7753 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 7754 item 7755 .attr("aria-haspopup", "true") 7756 .prepend(submenuCaret); 7757 menu.attr("aria-labelledby", item.attr("id")); 7758 }); 7759 7760 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 7761 7762 menus = submenus.add(this.element); 7763 items = menus.find(this.options.items); 7764 7765 // Initialize menu-items containing spaces and/or dashes only as dividers 7766 items.not(".ui-menu-item").each(function () { 7767 var item = $(this); 7768 if (that._isDivider(item)) { 7769 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 7770 } 7771 }); 7772 7773 // Don't refresh list items that are already adapted 7774 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 7775 newWrappers = newItems.children() 7776 .not(".ui-menu") 7777 .uniqueId() 7778 .attr({ 7779 tabIndex: -1, 7780 role: this._itemRole() 7781 }); 7782 this._addClass(newItems, "ui-menu-item") 7783 ._addClass(newWrappers, "ui-menu-item-wrapper"); 7784 7785 // Add aria-disabled attribute to any disabled menu item 7786 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 7787 7788 // If the active item has been removed, blur the menu 7789 if (this.active && !$.contains(this.element[0], this.active[0])) { 7790 this.blur(); 7791 } 7792 }, 7793 7794 _itemRole: function () { 7795 return { 7796 menu: "menuitem", 7797 listbox: "option" 7798 }[this.options.role]; 7799 }, 7800 7801 _setOption: function (key, value) { 7802 if (key === "icons") { 7803 var icons = this.element.find(".ui-menu-icon"); 7804 this._removeClass(icons, null, this.options.icons.submenu) 7805 ._addClass(icons, null, value.submenu); 7806 } 7807 this._super(key, value); 7808 }, 7809 7810 _setOptionDisabled: function (value) { 7811 this._super(value); 7812 7813 this.element.attr("aria-disabled", String(value)); 7814 this._toggleClass(null, "ui-state-disabled", !!value); 7815 }, 7816 7817 focus: function (event, item) { 7818 var nested, focused, activeParent; 7819 this.blur(event, event && event.type === "focus"); 7820 7821 this._scrollIntoView(item); 7822 7823 this.active = item.first(); 7824 7825 focused = this.active.children(".ui-menu-item-wrapper"); 7826 this._addClass(focused, null, "ui-state-active"); 7827 7828 // Only update aria-activedescendant if there's a role 7829 // otherwise we assume focus is managed elsewhere 7830 if (this.options.role) { 7831 this.element.attr("aria-activedescendant", focused.attr("id")); 7832 } 7833 7834 // Highlight active parent menu item, if any 7835 activeParent = this.active 7836 .parent() 7837 .closest(".ui-menu-item") 7838 .children(".ui-menu-item-wrapper"); 7839 this._addClass(activeParent, null, "ui-state-active"); 7840 7841 if (event && event.type === "keydown") { 7842 this._close(); 7843 } else { 7844 this.timer = this._delay(function () { 7845 this._close(); 7846 }, this.delay); 7847 } 7848 7849 nested = item.children(".ui-menu"); 7850 if (nested.length && event && (/^mouse/.test(event.type))) { 7851 this._startOpening(nested); 7852 } 7853 this.activeMenu = item.parent(); 7854 7855 this._trigger("focus", event, { item: item }); 7856 }, 7857 7858 _scrollIntoView: function (item) { 7859 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 7860 if (this._hasScroll()) { 7861 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 7862 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 7863 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 7864 scroll = this.activeMenu.scrollTop(); 7865 elementHeight = this.activeMenu.height(); 7866 itemHeight = item.outerHeight(); 7867 7868 if (offset < 0) { 7869 this.activeMenu.scrollTop(scroll + offset); 7870 } else if (offset + itemHeight > elementHeight) { 7871 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 7872 } 7873 } 7874 }, 7875 7876 blur: function (event, fromFocus) { 7877 if (!fromFocus) { 7878 clearTimeout(this.timer); 7879 } 7880 7881 if (!this.active) { 7882 return; 7883 } 7884 7885 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 7886 null, "ui-state-active"); 7887 7888 this._trigger("blur", event, { item: this.active }); 7889 this.active = null; 7890 }, 7891 7892 _startOpening: function (submenu) { 7893 clearTimeout(this.timer); 7894 7895 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 7896 // shift in the submenu position when mousing over the caret icon 7897 if (submenu.attr("aria-hidden") !== "true") { 7898 return; 7899 } 7900 7901 this.timer = this._delay(function () { 7902 this._close(); 7903 this._open(submenu); 7904 }, this.delay); 7905 }, 7906 7907 _open: function (submenu) { 7908 var position = $.extend({ 7909 of: this.active 7910 }, this.options.position); 7911 7912 clearTimeout(this.timer); 7913 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 7914 .hide() 7915 .attr("aria-hidden", "true"); 7916 7917 submenu 7918 .show() 7919 .removeAttr("aria-hidden") 7920 .attr("aria-expanded", "true") 7921 .position(position); 7922 }, 7923 7924 collapseAll: function (event, all) { 7925 clearTimeout(this.timer); 7926 this.timer = this._delay(function () { 7927 7928 // If we were passed an event, look for the submenu that contains the event 7929 var currentMenu = all ? this.element : 7930 $(event && event.target).closest(this.element.find(".ui-menu")); 7931 7932 // If we found no valid submenu ancestor, use the main menu to close all 7933 // sub menus anyway 7934 if (!currentMenu.length) { 7935 currentMenu = this.element; 7936 } 7937 7938 this._close(currentMenu); 7939 7940 this.blur(event); 7941 7942 // Work around active item staying active after menu is blurred 7943 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 7944 7945 this.activeMenu = currentMenu; 7946 }, all ? 0 : this.delay); 7947 }, 7948 7949 // With no arguments, closes the currently active menu - if nothing is active 7950 // it closes all menus. If passed an argument, it will search for menus BELOW 7951 _close: function (startMenu) { 7952 if (!startMenu) { 7953 startMenu = this.active ? this.active.parent() : this.element; 7954 } 7955 7956 startMenu.find(".ui-menu") 7957 .hide() 7958 .attr("aria-hidden", "true") 7959 .attr("aria-expanded", "false"); 7960 }, 7961 7962 _closeOnDocumentClick: function (event) { 7963 return !$(event.target).closest(".ui-menu").length; 7964 }, 7965 7966 _isDivider: function (item) { 7967 7968 // Match hyphen, em dash, en dash 7969 return !/[^\-\u2014\u2013\s]/.test(item.text()); 7970 }, 7971 7972 collapse: function (event) { 7973 var newItem = this.active && 7974 this.active.parent().closest(".ui-menu-item", this.element); 7975 if (newItem && newItem.length) { 7976 this._close(); 7977 this.focus(event, newItem); 7978 } 7979 }, 7980 7981 expand: function (event) { 7982 var newItem = this.active && this._menuItems(this.active.children(".ui-menu")).first(); 7983 7984 if (newItem && newItem.length) { 7985 this._open(newItem.parent()); 7986 7987 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 7988 this._delay(function () { 7989 this.focus(event, newItem); 7990 }); 7991 } 7992 }, 7993 7994 next: function (event) { 7995 this._move("next", "first", event); 7996 }, 7997 7998 previous: function (event) { 7999 this._move("prev", "last", event); 8000 }, 8001 8002 isFirstItem: function () { 8003 return this.active && !this.active.prevAll(".ui-menu-item").length; 8004 }, 8005 8006 isLastItem: function () { 8007 return this.active && !this.active.nextAll(".ui-menu-item").length; 8008 }, 8009 8010 _menuItems: function (menu) { 8011 return (menu || this.element) 8012 .find(this.options.items) 8013 .filter(".ui-menu-item"); 8014 }, 8015 8016 _move: function (direction, filter, event) { 8017 var next; 8018 if (this.active) { 8019 if (direction === "first" || direction === "last") { 8020 next = this.active 8021 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 8022 .last(); 8023 } else { 8024 next = this.active 8025 [direction + "All"](".ui-menu-item") 8026 .first(); 8027 } 8028 } 8029 if (!next || !next.length || !this.active) { 8030 next = this._menuItems(this.activeMenu)[filter](); 8031 } 8032 8033 this.focus(event, next); 8034 }, 8035 8036 nextPage: function (event) { 8037 var item, base, height; 8038 8039 if (!this.active) { 8040 this.next(event); 8041 return; 8042 } 8043 if (this.isLastItem()) { 8044 return; 8045 } 8046 if (this._hasScroll()) { 8047 base = this.active.offset().top; 8048 height = this.element.innerHeight(); 8049
vendor: 13,108 bytes, lines 8050-8502
8050 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 8051 if ($.fn.jquery.indexOf("3.2.") === 0) { 8052 height += this.element[0].offsetHeight - this.element.outerHeight(); 8053 } 8054 8055 this.active.nextAll(".ui-menu-item").each(function () { 8056 item = $(this); 8057 return item.offset().top - base - height < 0; 8058 }); 8059 8060 this.focus(event, item); 8061 } else { 8062 this.focus(event, this._menuItems(this.activeMenu) 8063 [!this.active ? "first" : "last"]()); 8064 } 8065 }, 8066 8067 previousPage: function (event) { 8068 var item, base, height; 8069 if (!this.active) { 8070 this.next(event); 8071 return; 8072 } 8073 if (this.isFirstItem()) { 8074 return; 8075 } 8076 if (this._hasScroll()) { 8077 base = this.active.offset().top; 8078 height = this.element.innerHeight(); 8079 8080 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 8081 if ($.fn.jquery.indexOf("3.2.") === 0) { 8082 height += this.element[0].offsetHeight - this.element.outerHeight(); 8083 } 8084 8085 this.active.prevAll(".ui-menu-item").each(function () { 8086 item = $(this); 8087 return item.offset().top - base + height > 0; 8088 }); 8089 8090 this.focus(event, item); 8091 } else { 8092 this.focus(event, this._menuItems(this.activeMenu).first()); 8093 } 8094 }, 8095 8096 _hasScroll: function () { 8097 return this.element.outerHeight() < this.element.prop("scrollHeight"); 8098 }, 8099 8100 select: function (event) { 8101 8102 // TODO: It should never be possible to not have an active item at this 8103 // point, but the tests don't trigger mouseenter before click. 8104 this.active = this.active || $(event.target).closest(".ui-menu-item"); 8105 var ui = { item: this.active }; 8106 if (!this.active.has(".ui-menu").length) { 8107 this.collapseAll(event, true); 8108 } 8109 this._trigger("select", event, ui); 8110 }, 8111 8112 _filterMenuItems: function (character) { 8113 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 8114 regex = new RegExp("^" + escapedCharacter, "i"); 8115 8116 return this.activeMenu 8117 .find(this.options.items) 8118 8119 // Only match on items, not dividers or other content (#10571) 8120 .filter(".ui-menu-item") 8121 .filter(function () { 8122 return regex.test( 8123 String.prototype.trim.call( 8124 $(this).children(".ui-menu-item-wrapper").text())); 8125 }); 8126 } 8127 }); 8128 8129 8130 /*! 8131 * jQuery UI Autocomplete 1.13.2 8132 * http://jqueryui.com 8133 * 8134 * Copyright jQuery Foundation and other contributors 8135 * Released under the MIT license. 8136 * http://jquery.org/license 8137 */ 8138 8139 //>>label: Autocomplete 8140 //>>group: Widgets 8141 //>>description: Lists suggested words as the user is typing. 8142 //>>docs: http://api.jqueryui.com/autocomplete/ 8143 //>>demos: http://jqueryui.com/autocomplete/ 8144 //>>css.structure: ../../themes/base/core.css 8145 //>>css.structure: ../../themes/base/autocomplete.css 8146 //>>css.theme: ../../themes/base/theme.css 8147 8148 8149 $.widget("ui.autocomplete", { 8150 version: "1.13.2", 8151 defaultElement: "<input>", 8152 options: { 8153 appendTo: null, 8154 autoFocus: false, 8155 delay: 300, 8156 minLength: 1, 8157 position: { 8158 my: "left top", 8159 at: "left bottom", 8160 collision: "none" 8161 }, 8162 source: null, 8163 8164 // Callbacks 8165 change: null, 8166 close: null, 8167 focus: null, 8168 open: null, 8169 response: null, 8170 search: null, 8171 select: null 8172 }, 8173 8174 requestIndex: 0, 8175 pending: 0, 8176 liveRegionTimer: null, 8177 8178 _create: function () { 8179 8180 // Some browsers only repeat keydown events, not keypress events, 8181 // so we use the suppressKeyPress flag to determine if we've already 8182 // handled the keydown event. #7269 8183 // Unfortunately the code for & in keypress is the same as the up arrow, 8184 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 8185 // events when we know the keydown event was used to modify the 8186 // search term. #7799 8187 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 8188 nodeName = this.element[0].nodeName.toLowerCase(), 8189 isTextarea = nodeName === "textarea", 8190 isInput = nodeName === "input"; 8191 8192 // Textareas are always multi-line 8193 // Inputs are always single-line, even if inside a contentEditable element 8194 // IE also treats inputs as contentEditable 8195 // All other element types are determined by whether or not they're contentEditable 8196 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 8197 8198 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 8199 this.isNewMenu = true; 8200 8201 this._addClass("ui-autocomplete-input"); 8202 this.element.attr("autocomplete", "off"); 8203 8204 this._on(this.element, { 8205 keydown: function (event) { 8206 if (this.element.prop("readOnly")) { 8207 suppressKeyPress = true; 8208 suppressInput = true; 8209 suppressKeyPressRepeat = true; 8210 return; 8211 } 8212 8213 suppressKeyPress = false; 8214 suppressInput = false; 8215 suppressKeyPressRepeat = false; 8216 var keyCode = $.ui.keyCode; 8217 switch (event.keyCode) { 8218 case keyCode.PAGE_UP: 8219 suppressKeyPress = true; 8220 this._move("previousPage", event); 8221 break; 8222 case keyCode.PAGE_DOWN: 8223 suppressKeyPress = true; 8224 this._move("nextPage", event); 8225 break; 8226 case keyCode.UP: 8227 suppressKeyPress = true; 8228 this._keyEvent("previous", event); 8229 break; 8230 case keyCode.DOWN: 8231 suppressKeyPress = true; 8232 this._keyEvent("next", event); 8233 break; 8234 case keyCode.ENTER: 8235 8236 // when menu is open and has focus 8237 if (this.menu.active) { 8238 8239 // #6055 - Opera still allows the keypress to occur 8240 // which causes forms to submit 8241 suppressKeyPress = true; 8242 event.preventDefault(); 8243 this.menu.select(event); 8244 } 8245 break; 8246 case keyCode.TAB: 8247 if (this.menu.active) { 8248 this.menu.select(event); 8249 } 8250 break; 8251 case keyCode.ESCAPE: 8252 if (this.menu.element.is(":visible")) { 8253 if (!this.isMultiLine) { 8254 this._value(this.term); 8255 } 8256 this.close(event); 8257 8258 // Different browsers have different default behavior for escape 8259 // Single press can mean undo or clear 8260 // Double press in IE means clear the whole form 8261 event.preventDefault(); 8262 } 8263 break; 8264 default: 8265 suppressKeyPressRepeat = true; 8266 8267 // search timeout should be triggered before the input value is changed 8268 this._searchTimeout(event); 8269 break; 8270 } 8271 }, 8272 keypress: function (event) { 8273 if (suppressKeyPress) { 8274 suppressKeyPress = false; 8275 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8276 event.preventDefault(); 8277 } 8278 return; 8279 } 8280 if (suppressKeyPressRepeat) { 8281 return; 8282 } 8283 8284 // Replicate some key handlers to allow them to repeat in Firefox and Opera 8285 var keyCode = $.ui.keyCode; 8286 switch (event.keyCode) { 8287 case keyCode.PAGE_UP: 8288 this._move("previousPage", event); 8289 break; 8290 case keyCode.PAGE_DOWN: 8291 this._move("nextPage", event); 8292 break; 8293 case keyCode.UP: 8294 this._keyEvent("previous", event); 8295 break; 8296 case keyCode.DOWN: 8297 this._keyEvent("next", event); 8298 break; 8299 } 8300 }, 8301 input: function (event) { 8302 if (suppressInput) { 8303 suppressInput = false; 8304 event.preventDefault(); 8305 return; 8306 } 8307 this._searchTimeout(event); 8308 }, 8309 focus: function () { 8310 this.selectedItem = null; 8311 this.previous = this._value(); 8312 }, 8313 blur: function (event) { 8314 clearTimeout(this.searching); 8315 this.close(event); 8316 this._change(event); 8317 } 8318 }); 8319 8320 this._initSource(); 8321 this.menu = $("<ul>") 8322 .appendTo(this._appendTo()) 8323 .menu({ 8324 8325 // disable ARIA support, the live region takes care of that 8326 role: null 8327 }) 8328 .hide() 8329 8330 // Support: IE 11 only, Edge <= 14 8331 // For other browsers, we preventDefault() on the mousedown event 8332 // to keep the dropdown from taking focus from the input. This doesn't 8333 // work for IE/Edge, causing problems with selection and scrolling (#9638) 8334 // Happily, IE and Edge support an "unselectable" attribute that 8335 // prevents an element from receiving focus, exactly what we want here. 8336 .attr({ 8337 "unselectable": "on" 8338 }) 8339 .menu("instance"); 8340 8341 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 8342 this._on(this.menu.element, { 8343 mousedown: function (event) { 8344 8345 // Prevent moving focus out of the text field 8346 event.preventDefault(); 8347 }, 8348 menufocus: function (event, ui) { 8349 var label, item; 8350 8351 // support: Firefox 8352 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 8353 if (this.isNewMenu) { 8354 this.isNewMenu = false; 8355 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 8356 this.menu.blur(); 8357 8358 this.document.one("mousemove", function () { 8359 $(event.target).trigger(event.originalEvent); 8360 }); 8361 8362 return; 8363 } 8364 } 8365 8366 item = ui.item.data("ui-autocomplete-item"); 8367 if (false !== this._trigger("focus", event, { item: item })) { 8368 8369 // use value to match what will end up in the input, if it was a key event 8370 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 8371 this._value(item.value); 8372 } 8373 } 8374 8375 // Announce the value in the liveRegion 8376 label = ui.item.attr("aria-label") || item.value; 8377 if (label && String.prototype.trim.call(label).length) { 8378 clearTimeout(this.liveRegionTimer); 8379 this.liveRegionTimer = this._delay(function () { 8380 this.liveRegion.html($("<div>").text(label)); 8381 }, 100); 8382 } 8383 }, 8384 menuselect: function (event, ui) { 8385 var item = ui.item.data("ui-autocomplete-item"), 8386 previous = this.previous; 8387 8388 // Only trigger when focus was lost (click on menu) 8389 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 8390 this.element.trigger("focus"); 8391 this.previous = previous; 8392 8393 // #6109 - IE triggers two focus events and the second 8394 // is asynchronous, so we need to reset the previous 8395 // term synchronously and asynchronously :-( 8396 this._delay(function () { 8397 this.previous = previous; 8398 this.selectedItem = item; 8399 }); 8400 } 8401 8402 if (false !== this._trigger("select", event, { item: item })) { 8403 this._value(item.value); 8404 } 8405 8406 // reset the term after the select event 8407 // this allows custom select handling to work properly 8408 this.term = this._value(); 8409 8410 this.close(event); 8411 this.selectedItem = item; 8412 } 8413 }); 8414 8415 this.liveRegion = $("<div>", { 8416 role: "status", 8417 "aria-live": "assertive", 8418 "aria-relevant": "additions" 8419 }) 8420 .appendTo(this.document[0].body); 8421 8422 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 8423 8424 // Turning off autocomplete prevents the browser from remembering the 8425 // value when navigating through history, so we re-enable autocomplete 8426 // if the page is unloaded before the widget is destroyed. #7790 8427 this._on(this.window, { 8428 beforeunload: function () { 8429 this.element.removeAttr("autocomplete"); 8430 } 8431 }); 8432 }, 8433 8434 _destroy: function () { 8435 clearTimeout(this.searching); 8436 this.element.removeAttr("autocomplete"); 8437 this.menu.element.remove(); 8438 this.liveRegion.remove(); 8439 }, 8440 8441 _setOption: function (key, value) { 8442 this._super(key, value); 8443 if (key === "source") { 8444 this._initSource(); 8445 } 8446 if (key === "appendTo") { 8447 this.menu.element.appendTo(this._appendTo()); 8448 } 8449 if (key === "disabled" && value && this.xhr) { 8450 this.xhr.abort(); 8451 } 8452 }, 8453 8454 _isEventTargetInWidget: function (event) { 8455 var menuElement = this.menu.element[0]; 8456 8457 return event.target === this.element[0] || 8458 event.target === menuElement || 8459 $.contains(menuElement, event.target); 8460 }, 8461 8462 _closeOnClickOutside: function (event) { 8463 if (!this._isEventTargetInWidget(event)) { 8464 this.close(); 8465 } 8466 }, 8467 8468 _appendTo: function () { 8469 var element = this.options.appendTo; 8470 8471 if (element) { 8472 element = element.jquery || element.nodeType ? 8473 $(element) : 8474 this.document.find(element).eq(0); 8475 } 8476 8477 if (!element || !element[0]) { 8478 element = this.element.closest(".ui-front, dialog"); 8479 } 8480 8481 if (!element.length) { 8482 element = this.document[0].body; 8483 } 8484 8485 return element; 8486 }, 8487 8488 _initSource: function () { 8489 var array, url, 8490 that = this; 8491 if (Array.isArray(this.options.source)) { 8492 array = this.options.source; 8493 this.source = function (request, response) { 8494 response($.ui.autocomplete.filter(array, request.term)); 8495 }; 8496 } else if (typeof this.options.source === "string") { 8497 url = this.options.source; 8498 this.source = function (request, response) { 8499 if (that.xhr) { 8500 that.xhr.abort(); 8501 } 8502 that.xhr = $.ajax({
vendor: 5,291 bytes, lines 8503-8719
8503 url: url, 8504 data: request, 8505 dataType: "json", 8506 success: function (data) { 8507 response(data); 8508 }, 8509 error: function () { 8510 response([]); 8511 } 8512 }); 8513 }; 8514 } else { 8515 this.source = this.options.source; 8516 } 8517 }, 8518 8519 _searchTimeout: function (event) { 8520 clearTimeout(this.searching); 8521 this.searching = this._delay(function () { 8522 8523 // Search if the value has changed, or if the user retypes the same value (see #7434) 8524 var equalValues = this.term === this._value(), 8525 menuVisible = this.menu.element.is(":visible"), 8526 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 8527 8528 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 8529 this.selectedItem = null; 8530 this.search(null, event); 8531 } 8532 }, this.options.delay); 8533 }, 8534 8535 search: function (value, event) { 8536 value = value != null ? value : this._value(); 8537 8538 // Always save the actual value, not the one passed as an argument 8539 this.term = this._value(); 8540 8541 if (value.length < this.options.minLength) { 8542 return this.close(event); 8543 } 8544 8545 if (this._trigger("search", event) === false) { 8546 return; 8547 } 8548 8549 return this._search(value); 8550 }, 8551 8552 _search: function (value) { 8553 this.pending++; 8554 this._addClass("ui-autocomplete-loading"); 8555 this.cancelSearch = false; 8556 8557 this.source({ term: value }, this._response()); 8558 }, 8559 8560 _response: function () { 8561 var index = ++this.requestIndex; 8562 8563 return function (content) { 8564 if (index === this.requestIndex) { 8565 this.__response(content); 8566 } 8567 8568 this.pending--; 8569 if (!this.pending) { 8570 this._removeClass("ui-autocomplete-loading"); 8571 } 8572 }.bind(this); 8573 }, 8574 8575 __response: function (content) { 8576 if (content) { 8577 content = this._normalize(content); 8578 } 8579 this._trigger("response", null, { content: content }); 8580 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 8581 this._suggest(content); 8582 this._trigger("open"); 8583 } else { 8584 8585 // use ._close() instead of .close() so we don't cancel future searches 8586 this._close(); 8587 } 8588 }, 8589 8590 close: function (event) { 8591 this.cancelSearch = true; 8592 this._close(event); 8593 }, 8594 8595 _close: function (event) { 8596 8597 // Remove the handler that closes the menu on outside clicks 8598 this._off(this.document, "mousedown"); 8599 8600 if (this.menu.element.is(":visible")) { 8601 this.menu.element.hide(); 8602 this.menu.blur(); 8603 this.isNewMenu = true; 8604 this._trigger("close", event); 8605 } 8606 }, 8607 8608 _change: function (event) { 8609 if (this.previous !== this._value()) { 8610 this._trigger("change", event, { item: this.selectedItem }); 8611 } 8612 }, 8613 8614 _normalize: function (items) { 8615 8616 // assume all items have the right format when the first item is complete 8617 if (items.length && items[0].label && items[0].value) { 8618 return items; 8619 } 8620 return $.map(items, function (item) { 8621 if (typeof item === "string") { 8622 return { 8623 label: item, 8624 value: item 8625 }; 8626 } 8627 return $.extend({}, item, { 8628 label: item.label || item.value, 8629 value: item.value || item.label 8630 }); 8631 }); 8632 }, 8633 8634 _suggest: function (items) { 8635 var ul = this.menu.element.empty(); 8636 this._renderMenu(ul, items); 8637 this.isNewMenu = true; 8638 this.menu.refresh(); 8639 8640 // Size and position menu 8641 ul.show(); 8642 this._resizeMenu(); 8643 ul.position($.extend({ 8644 of: this.element 8645 }, this.options.position)); 8646 8647 if (this.options.autoFocus) { 8648 this.menu.next(); 8649 } 8650 8651 // Listen for interactions outside of the widget (#6642) 8652 this._on(this.document, { 8653 mousedown: "_closeOnClickOutside" 8654 }); 8655 }, 8656 8657 _resizeMenu: function () { 8658 var ul = this.menu.element; 8659 ul.outerWidth(Math.max( 8660 8661 // Firefox wraps long text (possibly a rounding bug) 8662 // so we add 1px to avoid the wrapping (#7513) 8663 ul.width("").outerWidth() + 1, 8664 this.element.outerWidth() 8665 )); 8666 }, 8667 8668 _renderMenu: function (ul, items) { 8669 var that = this; 8670 $.each(items, function (index, item) { 8671 that._renderItemData(ul, item); 8672 }); 8673 }, 8674 8675 _renderItemData: function (ul, item) { 8676 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 8677 }, 8678 8679 _renderItem: function (ul, item) { 8680 return $("<li>") 8681 .append($("<div>").text(item.label)) 8682 .appendTo(ul); 8683 }, 8684 8685 _move: function (direction, event) { 8686 if (!this.menu.element.is(":visible")) { 8687 this.search(null, event); 8688 return; 8689 } 8690 if (this.menu.isFirstItem() && /^previous/.test(direction) || 8691 this.menu.isLastItem() && /^next/.test(direction)) { 8692 8693 if (!this.isMultiLine) { 8694 this._value(this.term); 8695 } 8696 8697 this.menu.blur(); 8698 return; 8699 } 8700 this.menu[direction](event); 8701 }, 8702 8703 widget: function () { 8704 return this.menu.element; 8705 }, 8706 8707 _value: function () { 8708 return this.valueMethod.apply(this.element, arguments); 8709 }, 8710 8711 _keyEvent: function (keyEvent, event) { 8712 if (!this.isMultiLine || this.menu.element.is(":visible")) { 8713 this._move(keyEvent, event); 8714 8715 // Prevents moving cursor to beginning/end of the text field in some browsers 8716 event.preventDefault(); 8717 } 8718 }, 8719
vendor: 4,339 bytes, lines 8720-8869
8720 // Support: Chrome <=50 8721 // We should be able to just use this.element.prop( "isContentEditable" ) 8722 // but hidden elements always report false in Chrome. 8723 // https://code.google.com/p/chromium/issues/detail?id=313082 8724 _isContentEditable: function (element) { 8725 if (!element.length) { 8726 return false; 8727 } 8728 8729 var editable = element.prop("contentEditable"); 8730 8731 if (editable === "inherit") { 8732 return this._isContentEditable(element.parent()); 8733 } 8734 8735 return editable === "true"; 8736 } 8737 }); 8738 8739 $.extend($.ui.autocomplete, { 8740 escapeRegex: function (value) { 8741 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 8742 }, 8743 filter: function (array, term) { 8744 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 8745 return $.grep(array, function (value) { 8746 return matcher.test(value.label || value.value || value); 8747 }); 8748 } 8749 }); 8750 8751 // Live region extension, adding a `messages` option 8752 // NOTE: This is an experimental API. We are still investigating 8753 // a full solution for string manipulation and internationalization. 8754 $.widget("ui.autocomplete", $.ui.autocomplete, { 8755 options: { 8756 messages: { 8757 noResults: "No search results.", 8758 results: function (amount) { 8759 return amount + (amount > 1 ? " results are" : " result is") + 8760 " available, use up and down arrow keys to navigate."; 8761 } 8762 } 8763 }, 8764 8765 __response: function (content) { 8766 var message; 8767 this._superApply(arguments); 8768 if (this.options.disabled || this.cancelSearch) { 8769 return; 8770 } 8771 if (content && content.length) { 8772 message = this.options.messages.results(content.length); 8773 } else { 8774 message = this.options.messages.noResults; 8775 } 8776 clearTimeout(this.liveRegionTimer); 8777 this.liveRegionTimer = this._delay(function () { 8778 this.liveRegion.html($("<div>").text(message)); 8779 }, 100); 8780 } 8781 }); 8782 8783 var widgetsAutocomplete = $.ui.autocomplete; 8784 8785 8786 /*! 8787 * jQuery UI Controlgroup 1.13.2 8788 * http://jqueryui.com 8789 * 8790 * Copyright jQuery Foundation and other contributors 8791 * Released under the MIT license. 8792 * http://jquery.org/license 8793 */ 8794 8795 //>>label: Controlgroup 8796 //>>group: Widgets 8797 //>>description: Visually groups form control widgets 8798 //>>docs: http://api.jqueryui.com/controlgroup/ 8799 //>>demos: http://jqueryui.com/controlgroup/ 8800 //>>css.structure: ../../themes/base/core.css 8801 //>>css.structure: ../../themes/base/controlgroup.css 8802 //>>css.theme: ../../themes/base/theme.css 8803 8804 8805 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 8806 8807 var widgetsControlgroup = $.widget("ui.controlgroup", { 8808 version: "1.13.2", 8809 defaultElement: "<div>", 8810 options: { 8811 direction: "horizontal", 8812 disabled: null, 8813 onlyVisible: true, 8814 items: { 8815 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 8816 "controlgroupLabel": ".ui-controlgroup-label", 8817 "checkboxradio": "input[type='checkbox'], input[type='radio']", 8818 "selectmenu": "select", 8819 "spinner": ".ui-spinner-input" 8820 } 8821 }, 8822 8823 _create: function () { 8824 this._enhance(); 8825 }, 8826 8827 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 8828 _enhance: function () { 8829 this.element.attr("role", "toolbar"); 8830 this.refresh(); 8831 }, 8832 8833 _destroy: function () { 8834 this._callChildMethod("destroy"); 8835 this.childWidgets.removeData("ui-controlgroup-data"); 8836 this.element.removeAttr("role"); 8837 if (this.options.items.controlgroupLabel) { 8838 this.element 8839 .find(this.options.items.controlgroupLabel) 8840 .find(".ui-controlgroup-label-contents") 8841 .contents().unwrap(); 8842 } 8843 }, 8844 8845 _initWidgets: function () { 8846 var that = this, 8847 childWidgets = []; 8848 8849 // First we iterate over each of the items options 8850 $.each(this.options.items, function (widget, selector) { 8851 var labels; 8852 var options = {}; 8853 8854 // Make sure the widget has a selector set 8855 if (!selector) { 8856 return; 8857 } 8858 8859 if (widget === "controlgroupLabel") { 8860 labels = that.element.find(selector); 8861 labels.each(function () { 8862 var element = $(this); 8863 8864 if (element.children(".ui-controlgroup-label-contents").length) { 8865 return; 8866 } 8867 element.contents() 8868 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 8869 });
vendor: 9,049 bytes, lines 8870-9161
8870 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 8871 childWidgets = childWidgets.concat(labels.get()); 8872 return; 8873 } 8874 8875 // Make sure the widget actually exists 8876 if (!$.fn[widget]) { 8877 return; 8878 } 8879 8880 // We assume everything is in the middle to start because we can't determine 8881 // first / last elements until all enhancments are done. 8882 if (that["_" + widget + "Options"]) { 8883 options = that["_" + widget + "Options"]("middle"); 8884 } else { 8885 options = { classes: {} }; 8886 } 8887 8888 // Find instances of this widget inside controlgroup and init them 8889 that.element 8890 .find(selector) 8891 .each(function () { 8892 var element = $(this); 8893 var instance = element[widget]("instance"); 8894 8895 // We need to clone the default options for this type of widget to avoid 8896 // polluting the variable options which has a wider scope than a single widget. 8897 var instanceOptions = $.widget.extend({}, options); 8898 8899 // If the button is the child of a spinner ignore it 8900 // TODO: Find a more generic solution 8901 if (widget === "button" && element.parent(".ui-spinner").length) { 8902 return; 8903 } 8904 8905 // Create the widget if it doesn't exist 8906 if (!instance) { 8907 instance = element[widget]()[widget]("instance"); 8908 } 8909 if (instance) { 8910 instanceOptions.classes = 8911 that._resolveClassesValues(instanceOptions.classes, instance); 8912 } 8913 element[widget](instanceOptions); 8914 8915 // Store an instance of the controlgroup to be able to reference 8916 // from the outermost element for changing options and refresh 8917 var widgetElement = element[widget]("widget"); 8918 $.data(widgetElement[0], "ui-controlgroup-data", 8919 instance ? instance : element[widget]("instance")); 8920 8921 childWidgets.push(widgetElement[0]); 8922 }); 8923 }); 8924 8925 this.childWidgets = $($.uniqueSort(childWidgets)); 8926 this._addClass(this.childWidgets, "ui-controlgroup-item"); 8927 }, 8928 8929 _callChildMethod: function (method) { 8930 this.childWidgets.each(function () { 8931 var element = $(this), 8932 data = element.data("ui-controlgroup-data"); 8933 if (data && data[method]) { 8934 data[method](); 8935 } 8936 }); 8937 }, 8938 8939 _updateCornerClass: function (element, position) { 8940 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 8941 var add = this._buildSimpleOptions(position, "label").classes.label; 8942 8943 this._removeClass(element, null, remove); 8944 this._addClass(element, null, add); 8945 }, 8946 8947 _buildSimpleOptions: function (position, key) { 8948 var direction = this.options.direction === "vertical"; 8949 var result = { 8950 classes: {} 8951 }; 8952 result.classes[key] = { 8953 "middle": "", 8954 "first": "ui-corner-" + (direction ? "top" : "left"), 8955 "last": "ui-corner-" + (direction ? "bottom" : "right"), 8956 "only": "ui-corner-all" 8957 }[position]; 8958 8959 return result; 8960 }, 8961 8962 _spinnerOptions: function (position) { 8963 var options = this._buildSimpleOptions(position, "ui-spinner"); 8964 8965 options.classes["ui-spinner-up"] = ""; 8966 options.classes["ui-spinner-down"] = ""; 8967 8968 return options; 8969 }, 8970 8971 _buttonOptions: function (position) { 8972 return this._buildSimpleOptions(position, "ui-button"); 8973 }, 8974 8975 _checkboxradioOptions: function (position) { 8976 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 8977 }, 8978 8979 _selectmenuOptions: function (position) { 8980 var direction = this.options.direction === "vertical"; 8981 return { 8982 width: direction ? "auto" : false, 8983 classes: { 8984 middle: { 8985 "ui-selectmenu-button-open": "", 8986 "ui-selectmenu-button-closed": "" 8987 }, 8988 first: { 8989 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 8990 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 8991 }, 8992 last: { 8993 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 8994 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 8995 }, 8996 only: { 8997 "ui-selectmenu-button-open": "ui-corner-top", 8998 "ui-selectmenu-button-closed": "ui-corner-all" 8999 } 9000 9001 }[position] 9002 }; 9003 }, 9004 9005 _resolveClassesValues: function (classes, instance) { 9006 var result = {}; 9007 $.each(classes, function (key) { 9008 var current = instance.options.classes[key] || ""; 9009 current = String.prototype.trim.call(current.replace(controlgroupCornerRegex, "")); 9010 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 9011 }); 9012 return result; 9013 }, 9014 9015 _setOption: function (key, value) { 9016 if (key === "direction") { 9017 this._removeClass("ui-controlgroup-" + this.options.direction); 9018 } 9019 9020 this._super(key, value); 9021 if (key === "disabled") { 9022 this._callChildMethod(value ? "disable" : "enable"); 9023 return; 9024 } 9025 9026 this.refresh(); 9027 }, 9028 9029 refresh: function () { 9030 var children, 9031 that = this; 9032 9033 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 9034 9035 if (this.options.direction === "horizontal") { 9036 this._addClass(null, "ui-helper-clearfix"); 9037 } 9038 this._initWidgets(); 9039 9040 children = this.childWidgets; 9041 9042 // We filter here because we need to track all childWidgets not just the visible ones 9043 if (this.options.onlyVisible) { 9044 children = children.filter(":visible"); 9045 } 9046 9047 if (children.length) { 9048 9049 // We do this last because we need to make sure all enhancment is done 9050 // before determining first and last 9051 $.each(["first", "last"], function (index, value) { 9052 var instance = children[value]().data("ui-controlgroup-data"); 9053 9054 if (instance && that["_" + instance.widgetName + "Options"]) { 9055 var options = that["_" + instance.widgetName + "Options"]( 9056 children.length === 1 ? "only" : value 9057 ); 9058 options.classes = that._resolveClassesValues(options.classes, instance); 9059 instance.element[instance.widgetName](options); 9060 } else { 9061 that._updateCornerClass(children[value](), value); 9062 } 9063 }); 9064 9065 // Finally call the refresh method on each of the child widgets. 9066 this._callChildMethod("refresh"); 9067 } 9068 } 9069 }); 9070 9071 /*! 9072 * jQuery UI Checkboxradio 1.13.2 9073 * http://jqueryui.com 9074 * 9075 * Copyright jQuery Foundation and other contributors 9076 * Released under the MIT license. 9077 * http://jquery.org/license 9078 */ 9079 9080 //>>label: Checkboxradio 9081 //>>group: Widgets 9082 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 9083 //>>docs: http://api.jqueryui.com/checkboxradio/ 9084 //>>demos: http://jqueryui.com/checkboxradio/ 9085 //>>css.structure: ../../themes/base/core.css 9086 //>>css.structure: ../../themes/base/button.css 9087 //>>css.structure: ../../themes/base/checkboxradio.css 9088 //>>css.theme: ../../themes/base/theme.css 9089 9090 9091 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 9092 version: "1.13.2", 9093 options: { 9094 disabled: null, 9095 label: null, 9096 icon: true, 9097 classes: { 9098 "ui-checkboxradio-label": "ui-corner-all", 9099 "ui-checkboxradio-icon": "ui-corner-all" 9100 } 9101 }, 9102 9103 _getCreateOptions: function () { 9104 var disabled, labels, labelContents; 9105 var options = this._super() || {}; 9106 9107 // We read the type here, because it makes more sense to throw a element type error first, 9108 // rather then the error for lack of a label. Often if its the wrong type, it 9109 // won't have a label (e.g. calling on a div, btn, etc) 9110 this._readType(); 9111 9112 labels = this.element.labels(); 9113 9114 // If there are multiple labels, use the last one 9115 this.label = $(labels[labels.length - 1]); 9116 if (!this.label.length) { 9117 $.error("No label found for checkboxradio widget"); 9118 } 9119 9120 this.originalLabel = ""; 9121 9122 // We need to get the label text but this may also need to make sure it does not contain the 9123 // input itself. 9124 // The label contents could be text, html, or a mix. We wrap all elements 9125 // and read the wrapper's `innerHTML` to get a string representation of 9126 // the label, without the input as part of it. 9127 labelContents = this.label.contents().not(this.element[0]); 9128 9129 if (labelContents.length) { 9130 this.originalLabel += labelContents 9131 .clone() 9132 .wrapAll("<div></div>") 9133 .parent() 9134 .html(); 9135 } 9136 9137 // Set the label option if we found label text 9138 if (this.originalLabel) { 9139 options.label = this.originalLabel; 9140 } 9141 9142 disabled = this.element[0].disabled; 9143 if (disabled != null) { 9144 options.disabled = disabled; 9145 } 9146 return options; 9147 }, 9148 9149 _create: function () { 9150 var checked = this.element[0].checked; 9151 9152 this._bindFormResetHandler(); 9153 9154 if (this.options.disabled == null) { 9155 this.options.disabled = this.element[0].disabled; 9156 } 9157 9158 this._setOption("disabled", this.options.disabled); 9159 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 9160 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 9161
vendor: 3,218 bytes, lines 9162-9285
9162 if (this.type === "radio") { 9163 this._addClass(this.label, "ui-checkboxradio-radio-label"); 9164 } 9165 9166 if (this.options.label && this.options.label !== this.originalLabel) { 9167 this._updateLabel(); 9168 } else if (this.originalLabel) { 9169 this.options.label = this.originalLabel; 9170 } 9171 9172 this._enhance(); 9173 9174 if (checked) { 9175 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 9176 } 9177 9178 this._on({ 9179 change: "_toggleClasses", 9180 focus: function () { 9181 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 9182 }, 9183 blur: function () { 9184 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 9185 } 9186 }); 9187 }, 9188 9189 _readType: function () { 9190 var nodeName = this.element[0].nodeName.toLowerCase(); 9191 this.type = this.element[0].type; 9192 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 9193 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 9194 " and element.type=" + this.type); 9195 } 9196 }, 9197 9198 // Support jQuery Mobile enhanced option 9199 _enhance: function () { 9200 this._updateIcon(this.element[0].checked); 9201 }, 9202 9203 widget: function () { 9204 return this.label; 9205 }, 9206 9207 _getRadioGroup: function () { 9208 var group; 9209 var name = this.element[0].name; 9210 var nameSelector = "input[name='" + $.escapeSelector(name) + "']"; 9211 9212 if (!name) { 9213 return $([]); 9214 } 9215 9216 if (this.form.length) { 9217 group = $(this.form[0].elements).filter(nameSelector); 9218 } else { 9219 9220 // Not inside a form, check all inputs that also are not inside a form 9221 group = $(nameSelector).filter(function () { 9222 return $(this)._form().length === 0; 9223 }); 9224 } 9225 9226 return group.not(this.element); 9227 }, 9228 9229 _toggleClasses: function () { 9230 var checked = this.element[0].checked; 9231 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9232 9233 if (this.options.icon && this.type === "checkbox") { 9234 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 9235 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 9236 } 9237 9238 if (this.type === "radio") { 9239 this._getRadioGroup() 9240 .each(function () { 9241 var instance = $(this).checkboxradio("instance"); 9242 9243 if (instance) { 9244 instance._removeClass(instance.label, 9245 "ui-checkboxradio-checked", "ui-state-active"); 9246 } 9247 }); 9248 } 9249 }, 9250 9251 _destroy: function () { 9252 this._unbindFormResetHandler(); 9253 9254 if (this.icon) { 9255 this.icon.remove(); 9256 this.iconSpace.remove(); 9257 } 9258 }, 9259 9260 _setOption: function (key, value) { 9261 9262 // We don't allow the value to be set to nothing 9263 if (key === "label" && !value) { 9264 return; 9265 } 9266 9267 this._super(key, value); 9268 9269 if (key === "disabled") { 9270 this._toggleClass(this.label, null, "ui-state-disabled", value); 9271 this.element[0].disabled = value; 9272 9273 // Don't refresh when setting disabled 9274 return; 9275 } 9276 this.refresh(); 9277 }, 9278 9279 _updateIcon: function (checked) { 9280 var toAdd = "ui-icon ui-icon-background "; 9281 9282 if (this.options.icon) { 9283 if (!this.icon) { 9284 this.icon = $("<span>"); 9285 this.iconSpace = $("<span> </span>");
vendor: 5,778 bytes, lines 9286-9492
9286 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 9287 } 9288 9289 if (this.type === "checkbox") { 9290 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 9291 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 9292 } else { 9293 toAdd += "ui-icon-blank"; 9294 } 9295 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 9296 if (!checked) { 9297 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 9298 } 9299 this.icon.prependTo(this.label).after(this.iconSpace); 9300 } else if (this.icon !== undefined) { 9301 this.icon.remove(); 9302 this.iconSpace.remove(); 9303 delete this.icon; 9304 } 9305 }, 9306 9307 _updateLabel: function () { 9308 9309 // Remove the contents of the label ( minus the icon, icon space, and input ) 9310 var contents = this.label.contents().not(this.element[0]); 9311 if (this.icon) { 9312 contents = contents.not(this.icon[0]); 9313 } 9314 if (this.iconSpace) { 9315 contents = contents.not(this.iconSpace[0]); 9316 } 9317 contents.remove(); 9318 9319 this.label.append(this.options.label); 9320 }, 9321 9322 refresh: function () { 9323 var checked = this.element[0].checked, 9324 isDisabled = this.element[0].disabled; 9325 9326 this._updateIcon(checked); 9327 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 9328 if (this.options.label !== null) { 9329 this._updateLabel(); 9330 } 9331 9332 if (isDisabled !== this.options.disabled) { 9333 this._setOptions({ "disabled": isDisabled }); 9334 } 9335 } 9336 9337 }]); 9338 9339 var widgetsCheckboxradio = $.ui.checkboxradio; 9340 9341 9342 /*! 9343 * jQuery UI Button 1.13.2 9344 * http://jqueryui.com 9345 * 9346 * Copyright jQuery Foundation and other contributors 9347 * Released under the MIT license. 9348 * http://jquery.org/license 9349 */ 9350 9351 //>>label: Button 9352 //>>group: Widgets 9353 //>>description: Enhances a form with themeable buttons. 9354 //>>docs: http://api.jqueryui.com/button/ 9355 //>>demos: http://jqueryui.com/button/ 9356 //>>css.structure: ../../themes/base/core.css 9357 //>>css.structure: ../../themes/base/button.css 9358 //>>css.theme: ../../themes/base/theme.css 9359 9360 9361 $.widget("ui.button", { 9362 version: "1.13.2", 9363 defaultElement: "<button>", 9364 options: { 9365 classes: { 9366 "ui-button": "ui-corner-all" 9367 }, 9368 disabled: null, 9369 icon: null, 9370 iconPosition: "beginning", 9371 label: null, 9372 showLabel: true 9373 }, 9374 9375 _getCreateOptions: function () { 9376 var disabled, 9377 9378 // This is to support cases like in jQuery Mobile where the base widget does have 9379 // an implementation of _getCreateOptions 9380 options = this._super() || {}; 9381 9382 this.isInput = this.element.is("input"); 9383 9384 disabled = this.element[0].disabled; 9385 if (disabled != null) { 9386 options.disabled = disabled; 9387 } 9388 9389 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 9390 if (this.originalLabel) { 9391 options.label = this.originalLabel; 9392 } 9393 9394 return options; 9395 }, 9396 9397 _create: function () { 9398 if (!this.option.showLabel & !this.options.icon) { 9399 this.options.showLabel = true; 9400 } 9401 9402 // We have to check the option again here even though we did in _getCreateOptions, 9403 // because null may have been passed on init which would override what was set in 9404 // _getCreateOptions 9405 if (this.options.disabled == null) { 9406 this.options.disabled = this.element[0].disabled || false; 9407 } 9408 9409 this.hasTitle = !!this.element.attr("title"); 9410 9411 // Check to see if the label needs to be set or if its already correct 9412 if (this.options.label && this.options.label !== this.originalLabel) { 9413 if (this.isInput) { 9414 this.element.val(this.options.label); 9415 } else { 9416 this.element.html(this.options.label); 9417 } 9418 } 9419 this._addClass("ui-button", "ui-widget"); 9420 this._setOption("disabled", this.options.disabled); 9421 this._enhance(); 9422 9423 if (this.element.is("a")) { 9424 this._on({ 9425 "keyup": function (event) { 9426 if (event.keyCode === $.ui.keyCode.SPACE) { 9427 event.preventDefault(); 9428 9429 // Support: PhantomJS <= 1.9, IE 8 Only 9430 // If a native click is available use it so we actually cause navigation 9431 // otherwise just trigger a click event 9432 if (this.element[0].click) { 9433 this.element[0].click(); 9434 } else { 9435 this.element.trigger("click"); 9436 } 9437 } 9438 } 9439 }); 9440 } 9441 }, 9442 9443 _enhance: function () { 9444 if (!this.element.is("button")) { 9445 this.element.attr("role", "button"); 9446 } 9447 9448 if (this.options.icon) { 9449 this._updateIcon("icon", this.options.icon); 9450 this._updateTooltip(); 9451 } 9452 }, 9453 9454 _updateTooltip: function () { 9455 this.title = this.element.attr("title"); 9456 9457 if (!this.options.showLabel && !this.title) { 9458 this.element.attr("title", this.options.label); 9459 } 9460 }, 9461 9462 _updateIcon: function (option, value) { 9463 var icon = option !== "iconPosition", 9464 position = icon ? this.options.iconPosition : value, 9465 displayBlock = position === "top" || position === "bottom"; 9466 9467 // Create icon 9468 if (!this.icon) { 9469 this.icon = $("<span>"); 9470 9471 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 9472 9473 if (!this.options.showLabel) { 9474 this._addClass("ui-button-icon-only"); 9475 } 9476 } else if (icon) { 9477 9478 // If we are updating the icon remove the old icon class 9479 this._removeClass(this.icon, null, this.options.icon); 9480 } 9481 9482 // If we are updating the icon add the new icon class 9483 if (icon) { 9484 this._addClass(this.icon, null, value); 9485 } 9486 9487 this._attachIcon(position); 9488 9489 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 9490 // the iconSpace if there is one. 9491 if (displayBlock) { 9492 this._addClass(this.icon, null, "ui-widget-icon-block");
vendor: 6,075 bytes, lines 9493-9710
9493 if (this.iconSpace) { 9494 this.iconSpace.remove(); 9495 } 9496 } else { 9497 9498 // Position is beginning or end so remove the ui-widget-icon-block class and add the 9499 // space if it does not exist 9500 if (!this.iconSpace) { 9501 this.iconSpace = $("<span> </span>"); 9502 this._addClass(this.iconSpace, "ui-button-icon-space"); 9503 } 9504 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 9505 this._attachIconSpace(position); 9506 } 9507 }, 9508 9509 _destroy: function () { 9510 this.element.removeAttr("role"); 9511 9512 if (this.icon) { 9513 this.icon.remove(); 9514 } 9515 if (this.iconSpace) { 9516 this.iconSpace.remove(); 9517 } 9518 if (!this.hasTitle) { 9519 this.element.removeAttr("title"); 9520 } 9521 }, 9522 9523 _attachIconSpace: function (iconPosition) { 9524 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 9525 }, 9526 9527 _attachIcon: function (iconPosition) { 9528 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 9529 }, 9530 9531 _setOptions: function (options) { 9532 var newShowLabel = options.showLabel === undefined ? 9533 this.options.showLabel : 9534 options.showLabel, 9535 newIcon = options.icon === undefined ? this.options.icon : options.icon; 9536 9537 if (!newShowLabel && !newIcon) { 9538 options.showLabel = true; 9539 } 9540 this._super(options); 9541 }, 9542 9543 _setOption: function (key, value) { 9544 if (key === "icon") { 9545 if (value) { 9546 this._updateIcon(key, value); 9547 } else if (this.icon) { 9548 this.icon.remove(); 9549 if (this.iconSpace) { 9550 this.iconSpace.remove(); 9551 } 9552 } 9553 } 9554 9555 if (key === "iconPosition") { 9556 this._updateIcon(key, value); 9557 } 9558 9559 // Make sure we can't end up with a button that has neither text nor icon 9560 if (key === "showLabel") { 9561 this._toggleClass("ui-button-icon-only", null, !value); 9562 this._updateTooltip(); 9563 } 9564 9565 if (key === "label") { 9566 if (this.isInput) { 9567 this.element.val(value); 9568 } else { 9569 9570 // If there is an icon, append it, else nothing then append the value 9571 // this avoids removal of the icon when setting label text 9572 this.element.html(value); 9573 if (this.icon) { 9574 this._attachIcon(this.options.iconPosition); 9575 this._attachIconSpace(this.options.iconPosition); 9576 } 9577 } 9578 } 9579 9580 this._super(key, value); 9581 9582 if (key === "disabled") { 9583 this._toggleClass(null, "ui-state-disabled", value); 9584 this.element[0].disabled = value; 9585 if (value) { 9586 this.element.trigger("blur"); 9587 } 9588 } 9589 }, 9590 9591 refresh: function () { 9592 9593 // Make sure to only check disabled if its an element that supports this otherwise 9594 // check for the disabled class to determine state 9595 var isDisabled = this.element.is("input, button") ? 9596 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 9597 9598 if (isDisabled !== this.options.disabled) { 9599 this._setOptions({ disabled: isDisabled }); 9600 } 9601 9602 this._updateTooltip(); 9603 } 9604 }); 9605 9606 // DEPRECATED 9607 if ($.uiBackCompat !== false) { 9608 9609 // Text and Icons options 9610 $.widget("ui.button", $.ui.button, { 9611 options: { 9612 text: true, 9613 icons: { 9614 primary: null, 9615 secondary: null 9616 } 9617 }, 9618 9619 _create: function () { 9620 if (this.options.showLabel && !this.options.text) { 9621 this.options.showLabel = this.options.text; 9622 } 9623 if (!this.options.showLabel && this.options.text) { 9624 this.options.text = this.options.showLabel; 9625 } 9626 if (!this.options.icon && (this.options.icons.primary || 9627 this.options.icons.secondary)) { 9628 if (this.options.icons.primary) { 9629 this.options.icon = this.options.icons.primary; 9630 } else { 9631 this.options.icon = this.options.icons.secondary; 9632 this.options.iconPosition = "end"; 9633 } 9634 } else if (this.options.icon) { 9635 this.options.icons.primary = this.options.icon; 9636 } 9637 this._super(); 9638 }, 9639 9640 _setOption: function (key, value) { 9641 if (key === "text") { 9642 this._super("showLabel", value); 9643 return; 9644 } 9645 if (key === "showLabel") { 9646 this.options.text = value; 9647 } 9648 if (key === "icon") { 9649 this.options.icons.primary = value; 9650 } 9651 if (key === "icons") { 9652 if (value.primary) { 9653 this._super("icon", value.primary); 9654 this._super("iconPosition", "beginning"); 9655 } else if (value.secondary) { 9656 this._super("icon", value.secondary); 9657 this._super("iconPosition", "end"); 9658 } 9659 } 9660 this._superApply(arguments); 9661 } 9662 }); 9663 9664 $.fn.button = (function (orig) { 9665 return function (options) { 9666 var isMethodCall = typeof options === "string"; 9667 var args = Array.prototype.slice.call(arguments, 1); 9668 var returnValue = this; 9669 9670 if (isMethodCall) { 9671 9672 // If this is an empty collection, we need to have the instance method 9673 // return undefined instead of the jQuery instance 9674 if (!this.length && options === "instance") { 9675 returnValue = undefined; 9676 } else { 9677 this.each(function () { 9678 var methodValue; 9679 var type = $(this).attr("type"); 9680 var name = type !== "checkbox" && type !== "radio" ? 9681 "button" : 9682 "checkboxradio"; 9683 var instance = $.data(this, "ui-" + name); 9684 9685 if (options === "instance") { 9686 returnValue = instance; 9687 return false; 9688 } 9689 9690 if (!instance) { 9691 return $.error("cannot call methods on button" + 9692 " prior to initialization; " + 9693 "attempted to call method '" + options + "'"); 9694 } 9695 9696 if (typeof instance[options] !== "function" || 9697 options.charAt(0) === "_") { 9698 return $.error("no such method '" + options + "' for button" + 9699 " widget instance"); 9700 } 9701 9702 methodValue = instance[options].apply(instance, args); 9703 9704 if (methodValue !== instance && methodValue !== undefined) { 9705 returnValue = methodValue && methodValue.jquery ? 9706 returnValue.pushStack(methodValue.get()) : 9707 methodValue; 9708 return false; 9709 } 9710 });
vendor: 5,001 bytes, lines 9711-9842
9711 } 9712 } else { 9713 9714 // Allow multiple hashes to be passed on init 9715 if (args.length) { 9716 options = $.widget.extend.apply(null, [options].concat(args)); 9717 } 9718 9719 this.each(function () { 9720 var type = $(this).attr("type"); 9721 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 9722 var instance = $.data(this, "ui-" + name); 9723 9724 if (instance) { 9725 instance.option(options || {}); 9726 if (instance._init) { 9727 instance._init(); 9728 } 9729 } else { 9730 if (name === "button") { 9731 orig.call($(this), options); 9732 return; 9733 } 9734 9735 $(this).checkboxradio($.extend({ icon: false }, options)); 9736 } 9737 }); 9738 } 9739 9740 return returnValue; 9741 }; 9742 })($.fn.button); 9743 9744 $.fn.buttonset = function () { 9745 if (!$.ui.controlgroup) { 9746 $.error("Controlgroup widget missing"); 9747 } 9748 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 9749 return this.controlgroup.apply(this, 9750 [arguments[0], "items.button", arguments[2]]); 9751 } 9752 if (arguments[0] === "option" && arguments[1] === "items") { 9753 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 9754 } 9755 if (typeof arguments[0] === "object" && arguments[0].items) { 9756 arguments[0].items = { 9757 button: arguments[0].items 9758 }; 9759 } 9760 return this.controlgroup.apply(this, arguments); 9761 }; 9762 } 9763 9764 var widgetsButton = $.ui.button; 9765 9766 9767 /* eslint-disable max-len, camelcase */ 9768 /*! 9769 * jQuery UI Datepicker 1.13.2 9770 * http://jqueryui.com 9771 * 9772 * Copyright jQuery Foundation and other contributors 9773 * Released under the MIT license. 9774 * http://jquery.org/license 9775 */ 9776 9777 //>>label: Datepicker 9778 //>>group: Widgets 9779 //>>description: Displays a calendar from an input or inline for selecting dates. 9780 //>>docs: http://api.jqueryui.com/datepicker/ 9781 //>>demos: http://jqueryui.com/datepicker/ 9782 //>>css.structure: ../../themes/base/core.css 9783 //>>css.structure: ../../themes/base/datepicker.css 9784 //>>css.theme: ../../themes/base/theme.css 9785 9786 9787 $.extend($.ui, { datepicker: { version: "1.13.2" } }); 9788 9789 var datepicker_instActive; 9790 9791 function datepicker_getZindex(elem) { 9792 var position, value; 9793 while (elem.length && elem[0] !== document) { 9794 9795 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9796 // This makes behavior of this function consistent across browsers 9797 // WebKit always returns auto if the element is positioned 9798 position = elem.css("position"); 9799 if (position === "absolute" || position === "relative" || position === "fixed") { 9800 9801 // IE returns 0 when zIndex is not specified 9802 // other browsers return a string 9803 // we ignore the case of nested elements with an explicit value of 0 9804 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9805 value = parseInt(elem.css("zIndex"), 10); 9806 if (!isNaN(value) && value !== 0) { 9807 return value; 9808 } 9809 } 9810 elem = elem.parent(); 9811 } 9812 9813 return 0; 9814 } 9815 9816 /* Date picker manager. 9817 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 9818 Settings for (groups of) date pickers are maintained in an instance object, 9819 allowing multiple different settings on the same page. */ 9820 9821 function Datepicker() { 9822 this._curInst = null; // The current instance in use 9823 this._keyEvent = false; // If the last event was a key event 9824 this._disabledInputs = []; // List of date picker inputs that have been disabled 9825 this._datepickerShowing = false; // True if the popup picker is showing , false if not 9826 this._inDialog = false; // True if showing within a "dialog", false if not 9827 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 9828 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 9829 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 9830 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 9831 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 9832 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 9833 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 9834 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 9835 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 9836 this.regional = []; // Available regional settings, indexed by language code 9837 this.regional[""] = { // Default regional settings 9838 closeText: "Done", // Display text for close link 9839 prevText: "Prev", // Display text for previous month link 9840 nextText: "Next", // Display text for next month link 9841 currentText: "Today", // Display text for current month link 9842 monthNames: ["January", "February", "March", "April", "May", "June",
9843 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 9844 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 9845 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 9846 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 9847 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 9848 weekHeader: "Wk", // Column header for week of the year 9849 dateFormat: "mm/dd/yy", // See format options on parseDate 9850 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 9851 isRTL: false, // True if right-to-left language, false if left-to-right 9852 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 9853 yearSuffix: "", // Additional text to append to the year in the month headers, 9854 selectMonthLabel: "Select month", // Invisible label for month selector 9855 selectYearLabel: "Select year" // Invisible label for year selector 9856 }; 9857 this._defaults = { // Global defaults for all the date picker instances 9858 showOn: "focus", // "focus" for popup on focus, 9859 // "button" for trigger button, or "both" for either 9860 showAnim: "fadeIn", // Name of jQuery animation for popup 9861 showOptions: {}, // Options for enhanced animations 9862 defaultDate: null, // Used when field is blank: actual date, 9863 // +/-number for offset from today, null for today 9864 appendText: "", // Display text following the input box, e.g. showing the format 9865 buttonText: "...", // Text for trigger button 9866 buttonImage: "", // URL for trigger button image 9867 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 9868 hideIfNoPrevNext: false, // True to hide next/previous month links 9869 // if not applicable, false to just disable them 9870 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 9871 gotoCurrent: false, // True if today link goes back to current selection instead 9872 changeMonth: false, // True if month can be selected directly, false if only prev/next 9873 changeYear: false, // True if year can be selected directly, false if only prev/next 9874 yearRange: "c-10:c+10", // Range of years to display in drop-down, 9875 // either relative to today's year (-nn:+nn), relative to currently displayed year 9876 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 9877 showOtherMonths: false, // True to show dates in other months, false to leave blank 9878 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 9879 showWeek: false, // True to show week of the year, false to not show it 9880 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 9881 // takes a Date and returns the number of the week for it 9882 shortYearCutoff: "+10", // Short year values < this are in the current century, 9883 // > this are in the previous century, 9884 // string value starting with "+" for current year + value 9885 minDate: null, // The earliest selectable date, or null for no limit 9886 maxDate: null, // The latest selectable date, or null for no limit 9887 duration: "fast", // Duration of display/closure 9888 beforeShowDay: null, // Function that takes a date and returns an array with 9889 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 9890 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 9891 beforeShow: null, // Function that takes an input field and 9892 // returns a set of custom settings for the date picker 9893 onSelect: null, // Define a callback function when a date is selected 9894 onChangeMonthYear: null, // Define a callback function when the month or year is changed 9895 onClose: null, // Define a callback function when the datepicker is closed
vendor: 10,578 bytes, lines 9896-10176
9896 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 9897 numberOfMonths: 1, // Number of months to show at a time 9898 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 9899 stepMonths: 1, // Number of months to step back/forward 9900 stepBigMonths: 12, // Number of months to step back/forward for the big links 9901 altField: "", // Selector for an alternate field to store selected dates into 9902 altFormat: "", // The date format to use for the alternate field 9903 constrainInput: true, // The input is constrained by the current date format 9904 showButtonPanel: false, // True to show button panel, false to not show it 9905 autoSize: false, // True to size the input for the date format, false to leave as is 9906 disabled: false // The initial disabled state 9907 }; 9908 $.extend(this._defaults, this.regional[""]); 9909 this.regional.en = $.extend(true, {}, this.regional[""]); 9910 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 9911 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 9912 } 9913 9914 $.extend(Datepicker.prototype, { 9915 9916 /* Class name added to elements to indicate already configured with a date picker. */ 9917 markerClassName: "hasDatepicker", 9918 9919 //Keep track of the maximum number of rows displayed (see #7043) 9920 maxRows: 4, 9921 9922 // TODO rename to "widget" when switching to widget factory 9923 _widgetDatepicker: function () { 9924 return this.dpDiv; 9925 }, 9926 9927 /* Override the default settings for all instances of the date picker. 9928 * @param settings object - the new settings to use as defaults (anonymous object) 9929 * @return the manager object 9930 */ 9931 setDefaults: function (settings) { 9932 datepicker_extendRemove(this._defaults, settings || {}); 9933 return this; 9934 }, 9935 9936 /* Attach the date picker to a jQuery selection. 9937 * @param target element - the target input field or division or span 9938 * @param settings object - the new settings to use for this date picker instance (anonymous) 9939 */ 9940 _attachDatepicker: function (target, settings) { 9941 var nodeName, inline, inst; 9942 nodeName = target.nodeName.toLowerCase(); 9943 inline = (nodeName === "div" || nodeName === "span"); 9944 if (!target.id) { 9945 this.uuid += 1; 9946 target.id = "dp" + this.uuid; 9947 } 9948 inst = this._newInst($(target), inline); 9949 inst.settings = $.extend({}, settings || {}); 9950 if (nodeName === "input") { 9951 this._connectDatepicker(target, inst); 9952 } else if (inline) { 9953 this._inlineDatepicker(target, inst); 9954 } 9955 }, 9956 9957 /* Create a new instance object. */ 9958 _newInst: function (target, inline) { 9959 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 9960 return { 9961 id: id, input: target, // associated target 9962 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 9963 drawMonth: 0, drawYear: 0, // month being drawn 9964 inline: inline, // is datepicker inline or not 9965 dpDiv: (!inline ? this.dpDiv : // presentation div 9966 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 9967 }; 9968 }, 9969 9970 /* Attach the date picker to an input field. */ 9971 _connectDatepicker: function (target, inst) { 9972 var input = $(target); 9973 inst.append = $([]); 9974 inst.trigger = $([]); 9975 if (input.hasClass(this.markerClassName)) { 9976 return; 9977 } 9978 this._attachments(input, inst); 9979 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 9980 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 9981 this._autoSize(inst); 9982 $.data(target, "datepicker", inst); 9983 9984 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 9985 if (inst.settings.disabled) { 9986 this._disableDatepicker(target); 9987 } 9988 }, 9989 9990 /* Make attachments based on settings. */ 9991 _attachments: function (input, inst) { 9992 var showOn, buttonText, buttonImage, 9993 appendText = this._get(inst, "appendText"), 9994 isRTL = this._get(inst, "isRTL"); 9995 9996 if (inst.append) { 9997 inst.append.remove(); 9998 } 9999 if (appendText) { 10000 inst.append = $("<span>") 10001 .addClass(this._appendClass) 10002 .text(appendText); 10003 input[isRTL ? "before" : "after"](inst.append); 10004 } 10005 10006 input.off("focus", this._showDatepicker); 10007 10008 if (inst.trigger) { 10009 inst.trigger.remove(); 10010 } 10011 10012 showOn = this._get(inst, "showOn"); 10013 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 10014 input.on("focus", this._showDatepicker); 10015 } 10016 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 10017 buttonText = this._get(inst, "buttonText"); 10018 buttonImage = this._get(inst, "buttonImage"); 10019 10020 if (this._get(inst, "buttonImageOnly")) { 10021 inst.trigger = $("<img>") 10022 .addClass(this._triggerClass) 10023 .attr({ 10024 src: buttonImage, 10025 alt: buttonText, 10026 title: buttonText 10027 }); 10028 } else { 10029 inst.trigger = $("<button type='button'>") 10030 .addClass(this._triggerClass); 10031 if (buttonImage) { 10032 inst.trigger.html( 10033 $("<img>") 10034 .attr({ 10035 src: buttonImage, 10036 alt: buttonText, 10037 title: buttonText 10038 }) 10039 ); 10040 } else { 10041 inst.trigger.text(buttonText); 10042 } 10043 } 10044 10045 input[isRTL ? "before" : "after"](inst.trigger); 10046 inst.trigger.on("click", function () { 10047 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 10048 $.datepicker._hideDatepicker(); 10049 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 10050 $.datepicker._hideDatepicker(); 10051 $.datepicker._showDatepicker(input[0]); 10052 } else { 10053 $.datepicker._showDatepicker(input[0]); 10054 } 10055 return false; 10056 }); 10057 } 10058 }, 10059 10060 /* Apply the maximum length for the date format. */ 10061 _autoSize: function (inst) { 10062 if (this._get(inst, "autoSize") && !inst.inline) { 10063 var findMax, max, maxI, i, 10064 date = new Date(2009, 12 - 1, 20), // Ensure double digits 10065 dateFormat = this._get(inst, "dateFormat"); 10066 10067 if (dateFormat.match(/[DM]/)) { 10068 findMax = function (names) { 10069 max = 0; 10070 maxI = 0; 10071 for (i = 0; i < names.length; i++) { 10072 if (names[i].length > max) { 10073 max = names[i].length; 10074 maxI = i; 10075 } 10076 } 10077 return maxI; 10078 }; 10079 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 10080 "monthNames" : "monthNamesShort")))); 10081 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 10082 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 10083 } 10084 inst.input.attr("size", this._formatDate(inst, date).length); 10085 } 10086 }, 10087 10088 /* Attach an inline date picker to a div. */ 10089 _inlineDatepicker: function (target, inst) { 10090 var divSpan = $(target); 10091 if (divSpan.hasClass(this.markerClassName)) { 10092 return; 10093 } 10094 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 10095 $.data(target, "datepicker", inst); 10096 this._setDate(inst, this._getDefaultDate(inst), true); 10097 this._updateDatepicker(inst); 10098 this._updateAlternate(inst); 10099 10100 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 10101 if (inst.settings.disabled) { 10102 this._disableDatepicker(target); 10103 } 10104 10105 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 10106 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 10107 inst.dpDiv.css("display", "block"); 10108 }, 10109 10110 /* Pop-up the date picker in a "dialog" box. 10111 * @param input element - ignored 10112 * @param date string or Date - the initial date to display 10113 * @param onSelect function - the function to call when a date is selected 10114 * @param settings object - update the dialog date picker instance's settings (anonymous object) 10115 * @param pos int[2] - coordinates for the dialog's position within the screen or 10116 * event - with x/y coordinates or 10117 * leave empty for default (screen centre) 10118 * @return the manager object 10119 */ 10120 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 10121 var id, browserWidth, browserHeight, scrollX, scrollY, 10122 inst = this._dialogInst; // internal instance 10123 10124 if (!inst) { 10125 this.uuid += 1; 10126 id = "dp" + this.uuid; 10127 this._dialogInput = $("<input type='text' id='" + id + 10128 "' style='position: absolute; top: -100px; width: 0px;'/>"); 10129 this._dialogInput.on("keydown", this._doKeyDown); 10130 $("body").append(this._dialogInput); 10131 inst = this._dialogInst = this._newInst(this._dialogInput, false); 10132 inst.settings = {}; 10133 $.data(this._dialogInput[0], "datepicker", inst); 10134 } 10135 datepicker_extendRemove(inst.settings, settings || {}); 10136 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 10137 this._dialogInput.val(date); 10138 10139 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 10140 if (!this._pos) { 10141 browserWidth = document.documentElement.clientWidth; 10142 browserHeight = document.documentElement.clientHeight; 10143 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 10144 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 10145 this._pos = // should use actual width/height below 10146 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 10147 } 10148 10149 // Move input on screen for focus, but hidden behind dialog 10150 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 10151 inst.settings.onSelect = onSelect; 10152 this._inDialog = true; 10153 this.dpDiv.addClass(this._dialogClass); 10154 this._showDatepicker(this._dialogInput[0]); 10155 if ($.blockUI) { 10156 $.blockUI(this.dpDiv); 10157 } 10158 $.data(this._dialogInput[0], "datepicker", inst); 10159 return this; 10160 }, 10161 10162 /* Detach a datepicker from its control. 10163 * @param target element - the target input field or division or span 10164 */ 10165 _destroyDatepicker: function (target) { 10166 var nodeName, 10167 $target = $(target), 10168 inst = $.data(target, "datepicker"); 10169 10170 if (!$target.hasClass(this.markerClassName)) { 10171 return; 10172 } 10173 10174 nodeName = target.nodeName.toLowerCase(); 10175 $.removeData(target, "datepicker"); 10176 if (nodeName === "input") {
vendor: 12,085 bytes, lines 10177-10528
10177 inst.append.remove(); 10178 inst.trigger.remove(); 10179 $target.removeClass(this.markerClassName). 10180 off("focus", this._showDatepicker). 10181 off("keydown", this._doKeyDown). 10182 off("keypress", this._doKeyPress). 10183 off("keyup", this._doKeyUp); 10184 } else if (nodeName === "div" || nodeName === "span") { 10185 $target.removeClass(this.markerClassName).empty(); 10186 } 10187 10188 if (datepicker_instActive === inst) { 10189 datepicker_instActive = null; 10190 this._curInst = null; 10191 } 10192 }, 10193 10194 /* Enable the date picker to a jQuery selection. 10195 * @param target element - the target input field or division or span 10196 */ 10197 _enableDatepicker: function (target) { 10198 var nodeName, inline, 10199 $target = $(target), 10200 inst = $.data(target, "datepicker"); 10201 10202 if (!$target.hasClass(this.markerClassName)) { 10203 return; 10204 } 10205 10206 nodeName = target.nodeName.toLowerCase(); 10207 if (nodeName === "input") { 10208 target.disabled = false; 10209 inst.trigger.filter("button"). 10210 each(function () { 10211 this.disabled = false; 10212 }).end(). 10213 filter("img").css({ opacity: "1.0", cursor: "" }); 10214 } else if (nodeName === "div" || nodeName === "span") { 10215 inline = $target.children("." + this._inlineClass); 10216 inline.children().removeClass("ui-state-disabled"); 10217 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10218 prop("disabled", false); 10219 } 10220 this._disabledInputs = $.map(this._disabledInputs, 10221 10222 // Delete entry 10223 function (value) { 10224 return (value === target ? null : value); 10225 }); 10226 }, 10227 10228 /* Disable the date picker to a jQuery selection. 10229 * @param target element - the target input field or division or span 10230 */ 10231 _disableDatepicker: function (target) { 10232 var nodeName, inline, 10233 $target = $(target), 10234 inst = $.data(target, "datepicker"); 10235 10236 if (!$target.hasClass(this.markerClassName)) { 10237 return; 10238 } 10239 10240 nodeName = target.nodeName.toLowerCase(); 10241 if (nodeName === "input") { 10242 target.disabled = true; 10243 inst.trigger.filter("button"). 10244 each(function () { 10245 this.disabled = true; 10246 }).end(). 10247 filter("img").css({ opacity: "0.5", cursor: "default" }); 10248 } else if (nodeName === "div" || nodeName === "span") { 10249 inline = $target.children("." + this._inlineClass); 10250 inline.children().addClass("ui-state-disabled"); 10251 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 10252 prop("disabled", true); 10253 } 10254 this._disabledInputs = $.map(this._disabledInputs, 10255 10256 // Delete entry 10257 function (value) { 10258 return (value === target ? null : value); 10259 }); 10260 this._disabledInputs[this._disabledInputs.length] = target; 10261 }, 10262 10263 /* Is the first field in a jQuery collection disabled as a datepicker? 10264 * @param target element - the target input field or division or span 10265 * @return boolean - true if disabled, false if enabled 10266 */ 10267 _isDisabledDatepicker: function (target) { 10268 if (!target) { 10269 return false; 10270 } 10271 for (var i = 0; i < this._disabledInputs.length; i++) { 10272 if (this._disabledInputs[i] === target) { 10273 return true; 10274 } 10275 } 10276 return false; 10277 }, 10278 10279 /* Retrieve the instance data for the target control. 10280 * @param target element - the target input field or division or span 10281 * @return object - the associated instance data 10282 * @throws error if a jQuery problem getting data 10283 */ 10284 _getInst: function (target) { 10285 try { 10286 return $.data(target, "datepicker"); 10287 } catch (err) { 10288 throw "Missing instance data for this datepicker"; 10289 } 10290 }, 10291 10292 /* Update or retrieve the settings for a date picker attached to an input field or division. 10293 * @param target element - the target input field or division or span 10294 * @param name object - the new settings to update or 10295 * string - the name of the setting to change or retrieve, 10296 * when retrieving also "all" for all instance settings or 10297 * "defaults" for all global defaults 10298 * @param value any - the new value for the setting 10299 * (omit if above is an object or to retrieve a value) 10300 */ 10301 _optionDatepicker: function (target, name, value) { 10302 var settings, date, minDate, maxDate, 10303 inst = this._getInst(target); 10304 10305 if (arguments.length === 2 && typeof name === "string") { 10306 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 10307 (inst ? (name === "all" ? $.extend({}, inst.settings) : 10308 this._get(inst, name)) : null)); 10309 } 10310 10311 settings = name || {}; 10312 if (typeof name === "string") { 10313 settings = {}; 10314 settings[name] = value; 10315 } 10316 10317 if (inst) { 10318 if (this._curInst === inst) { 10319 this._hideDatepicker(); 10320 } 10321 10322 date = this._getDateDatepicker(target, true); 10323 minDate = this._getMinMaxDate(inst, "min"); 10324 maxDate = this._getMinMaxDate(inst, "max"); 10325 datepicker_extendRemove(inst.settings, settings); 10326 10327 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 10328 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 10329 inst.settings.minDate = this._formatDate(inst, minDate); 10330 } 10331 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 10332 inst.settings.maxDate = this._formatDate(inst, maxDate); 10333 } 10334 if ("disabled" in settings) { 10335 if (settings.disabled) { 10336 this._disableDatepicker(target); 10337 } else { 10338 this._enableDatepicker(target); 10339 } 10340 } 10341 this._attachments($(target), inst); 10342 this._autoSize(inst); 10343 this._setDate(inst, date); 10344 this._updateAlternate(inst); 10345 this._updateDatepicker(inst); 10346 } 10347 }, 10348 10349 // Change method deprecated 10350 _changeDatepicker: function (target, name, value) { 10351 this._optionDatepicker(target, name, value); 10352 }, 10353 10354 /* Redraw the date picker attached to an input field or division. 10355 * @param target element - the target input field or division or span 10356 */ 10357 _refreshDatepicker: function (target) { 10358 var inst = this._getInst(target); 10359 if (inst) { 10360 this._updateDatepicker(inst); 10361 } 10362 }, 10363 10364 /* Set the dates for a jQuery selection. 10365 * @param target element - the target input field or division or span 10366 * @param date Date - the new date 10367 */ 10368 _setDateDatepicker: function (target, date) { 10369 var inst = this._getInst(target); 10370 if (inst) { 10371 this._setDate(inst, date); 10372 this._updateDatepicker(inst); 10373 this._updateAlternate(inst); 10374 } 10375 }, 10376 10377 /* Get the date(s) for the first entry in a jQuery selection. 10378 * @param target element - the target input field or division or span 10379 * @param noDefault boolean - true if no default date is to be used 10380 * @return Date - the current date 10381 */ 10382 _getDateDatepicker: function (target, noDefault) { 10383 var inst = this._getInst(target); 10384 if (inst && !inst.inline) { 10385 this._setDateFromField(inst, noDefault); 10386 } 10387 return (inst ? this._getDate(inst) : null); 10388 }, 10389 10390 /* Handle keystrokes. */ 10391 _doKeyDown: function (event) { 10392 var onSelect, dateStr, sel, 10393 inst = $.datepicker._getInst(event.target), 10394 handled = true, 10395 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 10396 10397 inst._keyEvent = true; 10398 if ($.datepicker._datepickerShowing) { 10399 switch (event.keyCode) { 10400 case 9: $.datepicker._hideDatepicker(); 10401 handled = false; 10402 break; // hide on tab out 10403 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 10404 $.datepicker._currentClass + ")", inst.dpDiv); 10405 if (sel[0]) { 10406 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 10407 } 10408 10409 onSelect = $.datepicker._get(inst, "onSelect"); 10410 if (onSelect) { 10411 dateStr = $.datepicker._formatDate(inst); 10412 10413 // Trigger custom callback 10414 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 10415 } else { 10416 $.datepicker._hideDatepicker(); 10417 } 10418 10419 return false; // don't submit the form 10420 case 27: $.datepicker._hideDatepicker(); 10421 break; // hide on escape 10422 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10423 -$.datepicker._get(inst, "stepBigMonths") : 10424 -$.datepicker._get(inst, "stepMonths")), "M"); 10425 break; // previous month/year on page up/+ ctrl 10426 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10427 +$.datepicker._get(inst, "stepBigMonths") : 10428 +$.datepicker._get(inst, "stepMonths")), "M"); 10429 break; // next month/year on page down/+ ctrl 10430 case 35: if (event.ctrlKey || event.metaKey) { 10431 $.datepicker._clearDate(event.target); 10432 } 10433 handled = event.ctrlKey || event.metaKey; 10434 break; // clear on ctrl or command +end 10435 case 36: if (event.ctrlKey || event.metaKey) { 10436 $.datepicker._gotoToday(event.target); 10437 } 10438 handled = event.ctrlKey || event.metaKey; 10439 break; // current on ctrl or command +home 10440 case 37: if (event.ctrlKey || event.metaKey) { 10441 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 10442 } 10443 handled = event.ctrlKey || event.metaKey; 10444 10445 // -1 day on ctrl or command +left 10446 if (event.originalEvent.altKey) { 10447 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10448 -$.datepicker._get(inst, "stepBigMonths") : 10449 -$.datepicker._get(inst, "stepMonths")), "M"); 10450 } 10451 10452 // next month/year on alt +left on Mac 10453 break; 10454 case 38: if (event.ctrlKey || event.metaKey) { 10455 $.datepicker._adjustDate(event.target, -7, "D"); 10456 } 10457 handled = event.ctrlKey || event.metaKey; 10458 break; // -1 week on ctrl or command +up 10459 case 39: if (event.ctrlKey || event.metaKey) { 10460 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 10461 } 10462 handled = event.ctrlKey || event.metaKey; 10463 10464 // +1 day on ctrl or command +right 10465 if (event.originalEvent.altKey) { 10466 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 10467 +$.datepicker._get(inst, "stepBigMonths") : 10468 +$.datepicker._get(inst, "stepMonths")), "M"); 10469 } 10470 10471 // next month/year on alt +right 10472 break; 10473 case 40: if (event.ctrlKey || event.metaKey) { 10474 $.datepicker._adjustDate(event.target, +7, "D"); 10475 } 10476 handled = event.ctrlKey || event.metaKey; 10477 break; // +1 week on ctrl or command +down 10478 default: handled = false; 10479 } 10480 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 10481 $.datepicker._showDatepicker(this); 10482 } else { 10483 handled = false; 10484 } 10485 10486 if (handled) { 10487 event.preventDefault(); 10488 event.stopPropagation(); 10489 } 10490 }, 10491 10492 /* Filter entered characters - based on date format. */ 10493 _doKeyPress: function (event) { 10494 var chars, chr, 10495 inst = $.datepicker._getInst(event.target); 10496 10497 if ($.datepicker._get(inst, "constrainInput")) { 10498 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 10499 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 10500 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 10501 } 10502 }, 10503 10504 /* Synchronise manual entry and field/alternate field. */ 10505 _doKeyUp: function (event) { 10506 var date, 10507 inst = $.datepicker._getInst(event.target); 10508 10509 if (inst.input.val() !== inst.lastVal) { 10510 try { 10511 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 10512 (inst.input ? inst.input.val() : null), 10513 $.datepicker._getFormatConfig(inst)); 10514 10515 if (date) { // only if valid 10516 $.datepicker._setDateFromField(inst); 10517 $.datepicker._updateAlternate(inst); 10518 $.datepicker._updateDatepicker(inst); 10519 } 10520 } catch (err) { 10521 } 10522 } 10523 return true; 10524 }, 10525 10526 /* Pop-up the date picker for a given input field. 10527 * If false returned from beforeShow event handler do not show. 10528 * @param input element - the input field attached to the date picker or
vendor: 4,409 bytes, lines 10529-10653
10529 * event - if triggered by focus 10530 */ 10531 _showDatepicker: function (input) { 10532 input = input.target || input; 10533 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 10534 input = $("input", input.parentNode)[0]; 10535 } 10536 10537 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 10538 return; 10539 } 10540 10541 var inst, beforeShow, beforeShowSettings, isFixed, 10542 offset, showAnim, duration; 10543 10544 inst = $.datepicker._getInst(input); 10545 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 10546 $.datepicker._curInst.dpDiv.stop(true, true); 10547 if (inst && $.datepicker._datepickerShowing) { 10548 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 10549 } 10550 } 10551 10552 beforeShow = $.datepicker._get(inst, "beforeShow"); 10553 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 10554 if (beforeShowSettings === false) { 10555 return; 10556 } 10557 datepicker_extendRemove(inst.settings, beforeShowSettings); 10558 10559 inst.lastVal = null; 10560 $.datepicker._lastInput = input; 10561 $.datepicker._setDateFromField(inst); 10562 10563 if ($.datepicker._inDialog) { // hide cursor 10564 input.value = ""; 10565 } 10566 if (!$.datepicker._pos) { // position below input 10567 $.datepicker._pos = $.datepicker._findPos(input); 10568 $.datepicker._pos[1] += input.offsetHeight; // add the height 10569 } 10570 10571 isFixed = false; 10572 $(input).parents().each(function () { 10573 isFixed |= $(this).css("position") === "fixed"; 10574 return !isFixed; 10575 }); 10576 10577 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 10578 $.datepicker._pos = null; 10579 10580 //to avoid flashes on Firefox 10581 inst.dpDiv.empty(); 10582 10583 // determine sizing offscreen 10584 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 10585 $.datepicker._updateDatepicker(inst); 10586 10587 // fix width for dynamic number of date pickers 10588 // and adjust position before showing 10589 offset = $.datepicker._checkOffset(inst, offset, isFixed); 10590 inst.dpDiv.css({ 10591 position: ($.datepicker._inDialog && $.blockUI ? 10592 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 10593 left: offset.left + "px", top: offset.top + "px" 10594 }); 10595 10596 if (!inst.inline) { 10597 showAnim = $.datepicker._get(inst, "showAnim"); 10598 duration = $.datepicker._get(inst, "duration"); 10599 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 10600 $.datepicker._datepickerShowing = true; 10601 10602 if ($.effects && $.effects.effect[showAnim]) { 10603 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 10604 } else { 10605 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 10606 } 10607 10608 if ($.datepicker._shouldFocusInput(inst)) { 10609 inst.input.trigger("focus"); 10610 } 10611 10612 $.datepicker._curInst = inst; 10613 } 10614 }, 10615 10616 /* Generate the date picker content. */ 10617 _updateDatepicker: function (inst) { 10618 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 10619 datepicker_instActive = inst; // for delegate hover events 10620 inst.dpDiv.empty().append(this._generateHTML(inst)); 10621 this._attachHandlers(inst); 10622 10623 var origyearshtml, 10624 numMonths = this._getNumberOfMonths(inst), 10625 cols = numMonths[1], 10626 width = 17, 10627 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"), 10628 onUpdateDatepicker = $.datepicker._get(inst, "onUpdateDatepicker"); 10629 10630 if (activeCell.length > 0) { 10631 datepicker_handleMouseover.apply(activeCell.get(0)); 10632 } 10633 10634 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 10635 if (cols > 1) { 10636 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 10637 } 10638 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 10639 "Class"]("ui-datepicker-multi"); 10640 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 10641 "Class"]("ui-datepicker-rtl"); 10642 10643 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 10644 inst.input.trigger("focus"); 10645 } 10646 10647 // Deffered render of the years select (to avoid flashes on Firefox) 10648 if (inst.yearshtml) { 10649 origyearshtml = inst.yearshtml; 10650 setTimeout(function () { 10651 10652 //assure that inst.yearshtml didn't change. 10653 if (origyearshtml === inst.yearshtml && inst.yearshtml) {
vendor: 5,592 bytes, lines 10654-10812
10654 inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml); 10655 } 10656 origyearshtml = inst.yearshtml = null; 10657 }, 0); 10658 } 10659 10660 if (onUpdateDatepicker) { 10661 onUpdateDatepicker.apply((inst.input ? inst.input[0] : null), [inst]); 10662 } 10663 }, 10664 10665 // #6694 - don't focus the input if it's already focused 10666 // this breaks the change event in IE 10667 // Support: IE and jQuery <1.9 10668 _shouldFocusInput: function (inst) { 10669 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 10670 }, 10671 10672 /* Check positioning to remain on screen. */ 10673 _checkOffset: function (inst, offset, isFixed) { 10674 var dpWidth = inst.dpDiv.outerWidth(), 10675 dpHeight = inst.dpDiv.outerHeight(), 10676 inputWidth = inst.input ? inst.input.outerWidth() : 0, 10677 inputHeight = inst.input ? inst.input.outerHeight() : 0, 10678 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 10679 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 10680 10681 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 10682 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 10683 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 10684 10685 // Now check if datepicker is showing outside window viewport - move to a better place if so. 10686 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 10687 Math.abs(offset.left + dpWidth - viewWidth) : 0); 10688 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 10689 Math.abs(dpHeight + inputHeight) : 0); 10690 10691 return offset; 10692 }, 10693 10694 /* Find an object's position on the screen. */ 10695 _findPos: function (obj) { 10696 var position, 10697 inst = this._getInst(obj), 10698 isRTL = this._get(inst, "isRTL"); 10699 10700 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden(obj))) { 10701 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 10702 } 10703 10704 position = $(obj).offset(); 10705 return [position.left, position.top]; 10706 }, 10707 10708 /* Hide the date picker from view. 10709 * @param input element - the input field attached to the date picker 10710 */ 10711 _hideDatepicker: function (input) { 10712 var showAnim, duration, postProcess, onClose, 10713 inst = this._curInst; 10714 10715 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 10716 return; 10717 } 10718 10719 if (this._datepickerShowing) { 10720 showAnim = this._get(inst, "showAnim"); 10721 duration = this._get(inst, "duration"); 10722 postProcess = function () { 10723 $.datepicker._tidyDialog(inst); 10724 }; 10725 10726 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 10727 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 10728 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 10729 } else { 10730 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 10731 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 10732 } 10733 10734 if (!showAnim) { 10735 postProcess(); 10736 } 10737 this._datepickerShowing = false; 10738 10739 onClose = this._get(inst, "onClose"); 10740 if (onClose) { 10741 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 10742 } 10743 10744 this._lastInput = null; 10745 if (this._inDialog) { 10746 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 10747 if ($.blockUI) { 10748 $.unblockUI(); 10749 $("body").append(this.dpDiv); 10750 } 10751 } 10752 this._inDialog = false; 10753 } 10754 }, 10755 10756 /* Tidy up after a dialog display. */ 10757 _tidyDialog: function (inst) { 10758 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 10759 }, 10760 10761 /* Close date picker if clicked elsewhere. */ 10762 _checkExternalClick: function (event) { 10763 if (!$.datepicker._curInst) { 10764 return; 10765 } 10766 10767 var $target = $(event.target), 10768 inst = $.datepicker._getInst($target[0]); 10769 10770 if ((($target[0].id !== $.datepicker._mainDivId && 10771 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 10772 !$target.hasClass($.datepicker.markerClassName) && 10773 !$target.closest("." + $.datepicker._triggerClass).length && 10774 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 10775 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 10776 $.datepicker._hideDatepicker(); 10777 } 10778 }, 10779 10780 /* Adjust one of the date sub-fields. */ 10781 _adjustDate: function (id, offset, period) { 10782 var target = $(id), 10783 inst = this._getInst(target[0]); 10784 10785 if (this._isDisabledDatepicker(target[0])) { 10786 return; 10787 } 10788 this._adjustInstDate(inst, offset, period); 10789 this._updateDatepicker(inst); 10790 }, 10791 10792 /* Action for current link. */ 10793 _gotoToday: function (id) { 10794 var date, 10795 target = $(id), 10796 inst = this._getInst(target[0]); 10797 10798 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 10799 inst.selectedDay = inst.currentDay; 10800 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 10801 inst.drawYear = inst.selectedYear = inst.currentYear; 10802 } else { 10803 date = new Date(); 10804 inst.selectedDay = date.getDate(); 10805 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10806 inst.drawYear = inst.selectedYear = date.getFullYear(); 10807 } 10808 this._notifyChange(inst); 10809 this._adjustDate(target); 10810 }, 10811 10812 /* Action for selecting a new month/year. */
vendor: 43,825 bytes, lines 10813-11997
10813 _selectMonthYear: function (id, select, period) { 10814 var target = $(id), 10815 inst = this._getInst(target[0]); 10816 10817 inst["selected" + (period === "M" ? "Month" : "Year")] = 10818 inst["draw" + (period === "M" ? "Month" : "Year")] = 10819 parseInt(select.options[select.selectedIndex].value, 10); 10820 10821 this._notifyChange(inst); 10822 this._adjustDate(target); 10823 }, 10824 10825 /* Action for selecting a day. */ 10826 _selectDay: function (id, month, year, td) { 10827 var inst, 10828 target = $(id); 10829 10830 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 10831 return; 10832 } 10833 10834 inst = this._getInst(target[0]); 10835 inst.selectedDay = inst.currentDay = parseInt($("a", td).attr("data-date")); 10836 inst.selectedMonth = inst.currentMonth = month; 10837 inst.selectedYear = inst.currentYear = year; 10838 this._selectDate(id, this._formatDate(inst, 10839 inst.currentDay, inst.currentMonth, inst.currentYear)); 10840 }, 10841 10842 /* Erase the input field and hide the date picker. */ 10843 _clearDate: function (id) { 10844 var target = $(id); 10845 this._selectDate(target, ""); 10846 }, 10847 10848 /* Update the input field with the selected date. */ 10849 _selectDate: function (id, dateStr) { 10850 var onSelect, 10851 target = $(id), 10852 inst = this._getInst(target[0]); 10853 10854 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 10855 if (inst.input) { 10856 inst.input.val(dateStr); 10857 } 10858 this._updateAlternate(inst); 10859 10860 onSelect = this._get(inst, "onSelect"); 10861 if (onSelect) { 10862 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 10863 } else if (inst.input) { 10864 inst.input.trigger("change"); // fire the change event 10865 } 10866 10867 if (inst.inline) { 10868 this._updateDatepicker(inst); 10869 } else { 10870 this._hideDatepicker(); 10871 this._lastInput = inst.input[0]; 10872 if (typeof (inst.input[0]) !== "object") { 10873 inst.input.trigger("focus"); // restore focus 10874 } 10875 this._lastInput = null; 10876 } 10877 }, 10878 10879 /* Update any alternate field to synchronise with the main field. */ 10880 _updateAlternate: function (inst) { 10881 var altFormat, date, dateStr, 10882 altField = this._get(inst, "altField"); 10883 10884 if (altField) { // update alternate field too 10885 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 10886 date = this._getDate(inst); 10887 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 10888 $(document).find(altField).val(dateStr); 10889 } 10890 }, 10891 10892 /* Set as beforeShowDay function to prevent selection of weekends. 10893 * @param date Date - the date to customise 10894 * @return [boolean, string] - is this date selectable?, what is its CSS class? 10895 */ 10896 noWeekends: function (date) { 10897 var day = date.getDay(); 10898 return [(day > 0 && day < 6), ""]; 10899 }, 10900 10901 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 10902 * @param date Date - the date to get the week for 10903 * @return number - the number of the week within the year that contains this date 10904 */ 10905 iso8601Week: function (date) { 10906 var time, 10907 checkDate = new Date(date.getTime()); 10908 10909 // Find Thursday of this week starting on Monday 10910 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 10911 10912 time = checkDate.getTime(); 10913 checkDate.setMonth(0); // Compare with Jan 1 10914 checkDate.setDate(1); 10915 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 10916 }, 10917 10918 /* Parse a string value into a date object. 10919 * See formatDate below for the possible formats. 10920 * 10921 * @param format string - the expected format of the date 10922 * @param value string - the date in the above format 10923 * @param settings Object - attributes include: 10924 * shortYearCutoff number - the cutoff year for determining the century (optional) 10925 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10926 * dayNames string[7] - names of the days from Sunday (optional) 10927 * monthNamesShort string[12] - abbreviated names of the months (optional) 10928 * monthNames string[12] - names of the months (optional) 10929 * @return Date - the extracted date value or null if value is blank 10930 */ 10931 parseDate: function (format, value, settings) { 10932 if (format == null || value == null) { 10933 throw "Invalid arguments"; 10934 } 10935 10936 value = (typeof value === "object" ? value.toString() : value + ""); 10937 if (value === "") { 10938 return null; 10939 } 10940 10941 var iFormat, dim, extra, 10942 iValue = 0, 10943 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 10944 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 10945 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 10946 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 10947 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 10948 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 10949 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 10950 year = -1, 10951 month = -1, 10952 day = -1, 10953 doy = -1, 10954 literal = false, 10955 date, 10956 10957 // Check whether a format character is doubled 10958 lookAhead = function (match) { 10959 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 10960 if (matches) { 10961 iFormat++; 10962 } 10963 return matches; 10964 }, 10965 10966 // Extract a number from the string value 10967 getNumber = function (match) { 10968 var isDoubled = lookAhead(match), 10969 size = (match === "@" ? 14 : (match === "!" ? 20 : 10970 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 10971 minSize = (match === "y" ? size : 1), 10972 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 10973 num = value.substring(iValue).match(digits); 10974 if (!num) { 10975 throw "Missing number at position " + iValue; 10976 } 10977 iValue += num[0].length; 10978 return parseInt(num[0], 10); 10979 }, 10980 10981 // Extract a name from the string value and convert to an index 10982 getName = function (match, shortNames, longNames) { 10983 var index = -1, 10984 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 10985 return [[k, v]]; 10986 }).sort(function (a, b) { 10987 return -(a[1].length - b[1].length); 10988 }); 10989 10990 $.each(names, function (i, pair) { 10991 var name = pair[1]; 10992 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 10993 index = pair[0]; 10994 iValue += name.length; 10995 return false; 10996 } 10997 }); 10998 if (index !== -1) { 10999 return index + 1; 11000 } else { 11001 throw "Unknown name at position " + iValue; 11002 } 11003 }, 11004 11005 // Confirm that a literal character matches the string value 11006 checkLiteral = function () { 11007 if (value.charAt(iValue) !== format.charAt(iFormat)) { 11008 throw "Unexpected literal at position " + iValue; 11009 } 11010 iValue++; 11011 }; 11012 11013 for (iFormat = 0; iFormat < format.length; iFormat++) { 11014 if (literal) { 11015 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 11016 literal = false; 11017 } else { 11018 checkLiteral(); 11019 } 11020 } else { 11021 switch (format.charAt(iFormat)) { 11022 case "d": 11023 day = getNumber("d"); 11024 break; 11025 case "D": 11026 getName("D", dayNamesShort, dayNames); 11027 break; 11028 case "o": 11029 doy = getNumber("o"); 11030 break; 11031 case "m": 11032 month = getNumber("m"); 11033 break; 11034 case "M": 11035 month = getName("M", monthNamesShort, monthNames); 11036 break; 11037 case "y": 11038 year = getNumber("y"); 11039 break; 11040 case "@": 11041 date = new Date(getNumber("@")); 11042 year = date.getFullYear(); 11043 month = date.getMonth() + 1; 11044 day = date.getDate(); 11045 break; 11046 case "!": 11047 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 11048 year = date.getFullYear(); 11049 month = date.getMonth() + 1; 11050 day = date.getDate(); 11051 break; 11052 case "'": 11053 if (lookAhead("'")) { 11054 checkLiteral(); 11055 } else { 11056 literal = true; 11057 } 11058 break; 11059 default: 11060 checkLiteral(); 11061 } 11062 } 11063 } 11064 11065 if (iValue < value.length) { 11066 extra = value.substr(iValue); 11067 if (!/^\s+/.test(extra)) { 11068 throw "Extra/unparsed characters found in date: " + extra; 11069 } 11070 } 11071 11072 if (year === -1) { 11073 year = new Date().getFullYear(); 11074 } else if (year < 100) { 11075 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 11076 (year <= shortYearCutoff ? 0 : -100); 11077 } 11078 11079 if (doy > -1) { 11080 month = 1; 11081 day = doy; 11082 do { 11083 dim = this._getDaysInMonth(year, month - 1); 11084 if (day <= dim) { 11085 break; 11086 } 11087 month++; 11088 day -= dim; 11089 } while (true); 11090 } 11091 11092 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 11093 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 11094 throw "Invalid date"; // E.g. 31/02/00 11095 } 11096 return date; 11097 }, 11098 11099 /* Standard date formats. */ 11100 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 11101 COOKIE: "D, dd M yy", 11102 ISO_8601: "yy-mm-dd", 11103 RFC_822: "D, d M y", 11104 RFC_850: "DD, dd-M-y", 11105 RFC_1036: "D, d M y", 11106 RFC_1123: "D, d M yy", 11107 RFC_2822: "D, d M yy", 11108 RSS: "D, d M y", // RFC 822 11109 TICKS: "!", 11110 TIMESTAMP: "@", 11111 W3C: "yy-mm-dd", // ISO 8601 11112 11113 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 11114 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 11115 11116 /* Format a date object into a string value. 11117 * The format can be combinations of the following: 11118 * d - day of month (no leading zero) 11119 * dd - day of month (two digit) 11120 * o - day of year (no leading zeros) 11121 * oo - day of year (three digit) 11122 * D - day name short 11123 * DD - day name long 11124 * m - month of year (no leading zero) 11125 * mm - month of year (two digit) 11126 * M - month name short 11127 * MM - month name long 11128 * y - year (two digit) 11129 * yy - year (four digit) 11130 * @ - Unix timestamp (ms since 01/01/1970) 11131 * ! - Windows ticks (100ns since 01/01/0001) 11132 * "..." - literal text 11133 * '' - single quote 11134 * 11135 * @param format string - the desired format of the date 11136 * @param date Date - the date value to format 11137 * @param settings Object - attributes include: 11138 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 11139 * dayNames string[7] - names of the days from Sunday (optional) 11140 * monthNamesShort string[12] - abbreviated names of the months (optional) 11141 * monthNames string[12] - names of the months (optional) 11142 * @return string - the date in the above format 11143 */ 11144 formatDate: function (format, date, settings) { 11145 if (!date) { 11146 return ""; 11147 } 11148 11149 var iFormat, 11150 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 11151 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 11152 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 11153 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 11154 11155 // Check whether a format character is doubled 11156 lookAhead = function (match) { 11157 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 11158 if (matches) { 11159 iFormat++; 11160 } 11161 return matches; 11162 }, 11163 11164 // Format a number, with leading zero if necessary 11165 formatNumber = function (match, value, len) { 11166 var num = "" + value; 11167 if (lookAhead(match)) { 11168 while (num.length < len) { 11169 num = "0" + num; 11170 } 11171 } 11172 return num; 11173 }, 11174 11175 // Format a name, short or long as requested 11176 formatName = function (match, value, shortNames, longNames) { 11177 return (lookAhead(match) ? longNames[value] : shortNames[value]); 11178 }, 11179 output = "", 11180 literal = false; 11181 11182 if (date) { 11183 for (iFormat = 0; iFormat < format.length; iFormat++) { 11184 if (literal) { 11185 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 11186 literal = false; 11187 } else { 11188 output += format.charAt(iFormat); 11189 } 11190 } else { 11191 switch (format.charAt(iFormat)) { 11192 case "d": 11193 output += formatNumber("d", date.getDate(), 2); 11194 break; 11195 case "D": 11196 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 11197 break; 11198 case "o": 11199 output += formatNumber("o", 11200 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 11201 break; 11202 case "m": 11203 output += formatNumber("m", date.getMonth() + 1, 2); 11204 break; 11205 case "M": 11206 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 11207 break; 11208 case "y": 11209 output += (lookAhead("y") ? date.getFullYear() : 11210 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 11211 break; 11212 case "@": 11213 output += date.getTime(); 11214 break; 11215 case "!": 11216 output += date.getTime() * 10000 + this._ticksTo1970; 11217 break; 11218 case "'": 11219 if (lookAhead("'")) { 11220 output += "'"; 11221 } else { 11222 literal = true; 11223 } 11224 break; 11225 default: 11226 output += format.charAt(iFormat); 11227 } 11228 } 11229 } 11230 } 11231 return output; 11232 }, 11233 11234 /* Extract all possible characters from the date format. */ 11235 _possibleChars: function (format) { 11236 var iFormat, 11237 chars = "", 11238 literal = false, 11239 11240 // Check whether a format character is doubled 11241 lookAhead = function (match) { 11242 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 11243 if (matches) { 11244 iFormat++; 11245 } 11246 return matches; 11247 }; 11248 11249 for (iFormat = 0; iFormat < format.length; iFormat++) { 11250 if (literal) { 11251 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 11252 literal = false; 11253 } else { 11254 chars += format.charAt(iFormat); 11255 } 11256 } else { 11257 switch (format.charAt(iFormat)) { 11258 case "d": case "m": case "y": case "@": 11259 chars += "0123456789"; 11260 break; 11261 case "D": case "M": 11262 return null; // Accept anything 11263 case "'": 11264 if (lookAhead("'")) { 11265 chars += "'"; 11266 } else { 11267 literal = true; 11268 } 11269 break; 11270 default: 11271 chars += format.charAt(iFormat); 11272 } 11273 } 11274 } 11275 return chars; 11276 }, 11277 11278 /* Get a setting value, defaulting if necessary. */ 11279 _get: function (inst, name) { 11280 return inst.settings[name] !== undefined ? 11281 inst.settings[name] : this._defaults[name]; 11282 }, 11283 11284 /* Parse existing date and initialise date picker. */ 11285 _setDateFromField: function (inst, noDefault) { 11286 if (inst.input.val() === inst.lastVal) { 11287 return; 11288 } 11289 11290 var dateFormat = this._get(inst, "dateFormat"), 11291 dates = inst.lastVal = inst.input ? inst.input.val() : null, 11292 defaultDate = this._getDefaultDate(inst), 11293 date = defaultDate, 11294 settings = this._getFormatConfig(inst); 11295 11296 try { 11297 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 11298 } catch (event) { 11299 dates = (noDefault ? "" : dates); 11300 } 11301 inst.selectedDay = date.getDate(); 11302 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11303 inst.drawYear = inst.selectedYear = date.getFullYear(); 11304 inst.currentDay = (dates ? date.getDate() : 0); 11305 inst.currentMonth = (dates ? date.getMonth() : 0); 11306 inst.currentYear = (dates ? date.getFullYear() : 0); 11307 this._adjustInstDate(inst); 11308 }, 11309 11310 /* Retrieve the default date shown on opening. */ 11311 _getDefaultDate: function (inst) { 11312 return this._restrictMinMax(inst, 11313 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 11314 }, 11315 11316 /* A date may be specified as an exact value or a relative one. */ 11317 _determineDate: function (inst, date, defaultDate) { 11318 var offsetNumeric = function (offset) { 11319 var date = new Date(); 11320 date.setDate(date.getDate() + offset); 11321 return date; 11322 }, 11323 offsetString = function (offset) { 11324 try { 11325 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 11326 offset, $.datepicker._getFormatConfig(inst)); 11327 } catch (e) { 11328 11329 // Ignore 11330 } 11331 11332 var date = (offset.toLowerCase().match(/^c/) ? 11333 $.datepicker._getDate(inst) : null) || new Date(), 11334 year = date.getFullYear(), 11335 month = date.getMonth(), 11336 day = date.getDate(), 11337 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 11338 matches = pattern.exec(offset); 11339 11340 while (matches) { 11341 switch (matches[2] || "d") { 11342 case "d": case "D": 11343 day += parseInt(matches[1], 10); break; 11344 case "w": case "W": 11345 day += parseInt(matches[1], 10) * 7; break; 11346 case "m": case "M": 11347 month += parseInt(matches[1], 10); 11348 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11349 break; 11350 case "y": case "Y": 11351 year += parseInt(matches[1], 10); 11352 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 11353 break; 11354 } 11355 matches = pattern.exec(offset); 11356 } 11357 return new Date(year, month, day); 11358 }, 11359 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 11360 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 11361 11362 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 11363 if (newDate) { 11364 newDate.setHours(0); 11365 newDate.setMinutes(0); 11366 newDate.setSeconds(0); 11367 newDate.setMilliseconds(0); 11368 } 11369 return this._daylightSavingAdjust(newDate); 11370 }, 11371 11372 /* Handle switch to/from daylight saving. 11373 * Hours may be non-zero on daylight saving cut-over: 11374 * > 12 when midnight changeover, but then cannot generate 11375 * midnight datetime, so jump to 1AM, otherwise reset. 11376 * @param date (Date) the date to check 11377 * @return (Date) the corrected date 11378 */ 11379 _daylightSavingAdjust: function (date) { 11380 if (!date) { 11381 return null; 11382 } 11383 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 11384 return date; 11385 }, 11386 11387 /* Set the date(s) directly. */ 11388 _setDate: function (inst, date, noChange) { 11389 var clear = !date, 11390 origMonth = inst.selectedMonth, 11391 origYear = inst.selectedYear, 11392 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 11393 11394 inst.selectedDay = inst.currentDay = newDate.getDate(); 11395 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 11396 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 11397 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 11398 this._notifyChange(inst); 11399 } 11400 this._adjustInstDate(inst); 11401 if (inst.input) { 11402 inst.input.val(clear ? "" : this._formatDate(inst)); 11403 } 11404 }, 11405 11406 /* Retrieve the date(s) directly. */ 11407 _getDate: function (inst) { 11408 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 11409 this._daylightSavingAdjust(new Date( 11410 inst.currentYear, inst.currentMonth, inst.currentDay))); 11411 return startDate; 11412 }, 11413 11414 /* Attach the onxxx handlers. These are declared statically so 11415 * they work with static code transformers like Caja. 11416 */ 11417 _attachHandlers: function (inst) { 11418 var stepMonths = this._get(inst, "stepMonths"), 11419 id = "#" + inst.id.replace(/\\\\/g, "\\"); 11420 inst.dpDiv.find("[data-handler]").map(function () { 11421 var handler = { 11422 prev: function () { 11423 $.datepicker._adjustDate(id, -stepMonths, "M"); 11424 }, 11425 next: function () { 11426 $.datepicker._adjustDate(id, +stepMonths, "M"); 11427 }, 11428 hide: function () { 11429 $.datepicker._hideDatepicker(); 11430 }, 11431 today: function () { 11432 $.datepicker._gotoToday(id); 11433 }, 11434 selectDay: function () { 11435 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 11436 return false; 11437 }, 11438 selectMonth: function () { 11439 $.datepicker._selectMonthYear(id, this, "M"); 11440 return false; 11441 }, 11442 selectYear: function () { 11443 $.datepicker._selectMonthYear(id, this, "Y"); 11444 return false; 11445 } 11446 }; 11447 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 11448 }); 11449 }, 11450 11451 /* Generate the HTML for the current state of the date picker. */ 11452 _generateHTML: function (inst) { 11453 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 11454 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 11455 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 11456 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 11457 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 11458 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 11459 tempDate = new Date(), 11460 today = this._daylightSavingAdjust( 11461 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 11462 isRTL = this._get(inst, "isRTL"), 11463 showButtonPanel = this._get(inst, "showButtonPanel"), 11464 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 11465 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 11466 numMonths = this._getNumberOfMonths(inst), 11467 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 11468 stepMonths = this._get(inst, "stepMonths"), 11469 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 11470 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 11471 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 11472 minDate = this._getMinMaxDate(inst, "min"), 11473 maxDate = this._getMinMaxDate(inst, "max"), 11474 drawMonth = inst.drawMonth - showCurrentAtPos, 11475 drawYear = inst.drawYear; 11476 11477 if (drawMonth < 0) { 11478 drawMonth += 12; 11479 drawYear--; 11480 } 11481 if (maxDate) { 11482 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 11483 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 11484 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 11485 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 11486 drawMonth--; 11487 if (drawMonth < 0) { 11488 drawMonth = 11; 11489 drawYear--; 11490 } 11491 } 11492 } 11493 inst.drawMonth = drawMonth; 11494 inst.drawYear = drawYear; 11495 11496 prevText = this._get(inst, "prevText"); 11497 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 11498 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 11499 this._getFormatConfig(inst))); 11500 11501 if (this._canAdjustMonth(inst, -1, drawYear, drawMonth)) { 11502 prev = $("<a>") 11503 .attr({ 11504 "class": "ui-datepicker-prev ui-corner-all", 11505 "data-handler": "prev", 11506 "data-event": "click", 11507 title: prevText 11508 }) 11509 .append( 11510 $("<span>") 11511 .addClass("ui-icon ui-icon-circle-triangle-" + 11512 (isRTL ? "e" : "w")) 11513 .text(prevText) 11514 )[0].outerHTML; 11515 } else if (hideIfNoPrevNext) { 11516 prev = ""; 11517 } else { 11518 prev = $("<a>") 11519 .attr({ 11520 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 11521 title: prevText 11522 }) 11523 .append( 11524 $("<span>") 11525 .addClass("ui-icon ui-icon-circle-triangle-" + 11526 (isRTL ? "e" : "w")) 11527 .text(prevText) 11528 )[0].outerHTML; 11529 } 11530 11531 nextText = this._get(inst, "nextText"); 11532 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 11533 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 11534 this._getFormatConfig(inst))); 11535 11536 if (this._canAdjustMonth(inst, +1, drawYear, drawMonth)) { 11537 next = $("<a>") 11538 .attr({ 11539 "class": "ui-datepicker-next ui-corner-all", 11540 "data-handler": "next", 11541 "data-event": "click", 11542 title: nextText 11543 }) 11544 .append( 11545 $("<span>") 11546 .addClass("ui-icon ui-icon-circle-triangle-" + 11547 (isRTL ? "w" : "e")) 11548 .text(nextText) 11549 )[0].outerHTML; 11550 } else if (hideIfNoPrevNext) { 11551 next = ""; 11552 } else { 11553 next = $("<a>") 11554 .attr({ 11555 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 11556 title: nextText 11557 }) 11558 .append( 11559 $("<span>") 11560 .attr("class", "ui-icon ui-icon-circle-triangle-" + 11561 (isRTL ? "w" : "e")) 11562 .text(nextText) 11563 )[0].outerHTML; 11564 } 11565 11566 currentText = this._get(inst, "currentText"); 11567 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 11568 currentText = (!navigationAsDateFormat ? currentText : 11569 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 11570 11571 controls = ""; 11572 if (!inst.inline) { 11573 controls = $("<button>") 11574 .attr({ 11575 type: "button", 11576 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 11577 "data-handler": "hide", 11578 "data-event": "click" 11579 }) 11580 .text(this._get(inst, "closeText"))[0].outerHTML; 11581 } 11582 11583 buttonPanel = ""; 11584 if (showButtonPanel) { 11585 buttonPanel = $("<div class='ui-datepicker-buttonpane ui-widget-content'>") 11586 .append(isRTL ? controls : "") 11587 .append(this._isInRange(inst, gotoDate) ? 11588 $("<button>") 11589 .attr({ 11590 type: "button", 11591 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 11592 "data-handler": "today", 11593 "data-event": "click" 11594 }) 11595 .text(currentText) : 11596 "") 11597 .append(isRTL ? "" : controls)[0].outerHTML; 11598 } 11599 11600 firstDay = parseInt(this._get(inst, "firstDay"), 10); 11601 firstDay = (isNaN(firstDay) ? 0 : firstDay); 11602 11603 showWeek = this._get(inst, "showWeek"); 11604 dayNames = this._get(inst, "dayNames"); 11605 dayNamesMin = this._get(inst, "dayNamesMin"); 11606 monthNames = this._get(inst, "monthNames"); 11607 monthNamesShort = this._get(inst, "monthNamesShort"); 11608 beforeShowDay = this._get(inst, "beforeShowDay"); 11609 showOtherMonths = this._get(inst, "showOtherMonths"); 11610 selectOtherMonths = this._get(inst, "selectOtherMonths"); 11611 defaultDate = this._getDefaultDate(inst); 11612 html = ""; 11613 11614 for (row = 0; row < numMonths[0]; row++) { 11615 group = ""; 11616 this.maxRows = 4; 11617 for (col = 0; col < numMonths[1]; col++) { 11618 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 11619 cornerClass = " ui-corner-all"; 11620 calender = ""; 11621 if (isMultiMonth) { 11622 calender += "<div class='ui-datepicker-group"; 11623 if (numMonths[1] > 1) { 11624 switch (col) { 11625 case 0: calender += " ui-datepicker-group-first"; 11626 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 11627 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 11628 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 11629 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 11630 } 11631 } 11632 calender += "'>"; 11633 } 11634 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 11635 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 11636 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 11637 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 11638 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 11639 "</div><table class='ui-datepicker-calendar'><thead>" + 11640 "<tr>"; 11641 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 11642 for (dow = 0; dow < 7; dow++) { // days of the week 11643 day = (dow + firstDay) % 7; 11644 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 11645 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 11646 } 11647 calender += thead + "</tr></thead><tbody>"; 11648 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 11649 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 11650 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 11651 } 11652 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 11653 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 11654 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 11655 this.maxRows = numRows; 11656 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 11657 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 11658 calender += "<tr>"; 11659 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 11660 this._get(inst, "calculateWeek")(printDate) + "</td>"); 11661 for (dow = 0; dow < 7; dow++) { // create date picker days 11662 daySettings = (beforeShowDay ? 11663 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 11664 otherMonth = (printDate.getMonth() !== drawMonth); 11665 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 11666 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 11667 tbody += "<td class='" + 11668 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 11669 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 11670 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 11671 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 11672 11673 // or defaultDate is current printedDate and defaultDate is selectedDate 11674 " " + this._dayOverClass : "") + // highlight selected day 11675 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 11676 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 11677 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 11678 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 11679 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 11680 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 11681 (otherMonth && !showOtherMonths ? " " : // display for other months 11682 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 11683 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 11684 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 11685 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 11686 "' href='#' aria-current='" + (printDate.getTime() === currentDate.getTime() ? "true" : "false") + // mark date as selected for screen reader 11687 "' data-date='" + printDate.getDate() + // store date as data 11688 "'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 11689 printDate.setDate(printDate.getDate() + 1); 11690 printDate = this._daylightSavingAdjust(printDate); 11691 } 11692 calender += tbody + "</tr>"; 11693 } 11694 drawMonth++; 11695 if (drawMonth > 11) { 11696 drawMonth = 0; 11697 drawYear++; 11698 } 11699 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 11700 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 11701 group += calender; 11702 } 11703 html += group; 11704 } 11705 html += buttonPanel; 11706 inst._keyEvent = false; 11707 return html; 11708 }, 11709 11710 /* Generate the month and year header. */ 11711 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 11712 secondary, monthNames, monthNamesShort) { 11713 11714 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 11715 changeMonth = this._get(inst, "changeMonth"), 11716 changeYear = this._get(inst, "changeYear"), 11717 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 11718 selectMonthLabel = this._get(inst, "selectMonthLabel"), 11719 selectYearLabel = this._get(inst, "selectYearLabel"), 11720 html = "<div class='ui-datepicker-title'>", 11721 monthHtml = ""; 11722 11723 // Month selection 11724 if (secondary || !changeMonth) { 11725 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 11726 } else { 11727 inMinYear = (minDate && minDate.getFullYear() === drawYear); 11728 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 11729 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 11730 for (month = 0; month < 12; month++) { 11731 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 11732 monthHtml += "<option value='" + month + "'" + 11733 (month === drawMonth ? " selected='selected'" : "") + 11734 ">" + monthNamesShort[month] + "</option>"; 11735 } 11736 } 11737 monthHtml += "</select>"; 11738 } 11739 11740 if (!showMonthAfterYear) { 11741 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 11742 } 11743 11744 // Year selection 11745 if (!inst.yearshtml) { 11746 inst.yearshtml = ""; 11747 if (secondary || !changeYear) { 11748 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 11749 } else { 11750 11751 // determine range of years to display 11752 years = this._get(inst, "yearRange").split(":"); 11753 thisYear = new Date().getFullYear(); 11754 determineYear = function (value) { 11755 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 11756 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 11757 parseInt(value, 10))); 11758 return (isNaN(year) ? thisYear : year); 11759 }; 11760 year = determineYear(years[0]); 11761 endYear = Math.max(year, determineYear(years[1] || "")); 11762 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 11763 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 11764 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 11765 for (; year <= endYear; year++) { 11766 inst.yearshtml += "<option value='" + year + "'" + 11767 (year === drawYear ? " selected='selected'" : "") + 11768 ">" + year + "</option>"; 11769 } 11770 inst.yearshtml += "</select>"; 11771 11772 html += inst.yearshtml; 11773 inst.yearshtml = null; 11774 } 11775 } 11776 11777 html += this._get(inst, "yearSuffix"); 11778 if (showMonthAfterYear) { 11779 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 11780 } 11781 html += "</div>"; // Close datepicker_header 11782 return html; 11783 }, 11784 11785 /* Adjust one of the date sub-fields. */ 11786 _adjustInstDate: function (inst, offset, period) { 11787 var year = inst.selectedYear + (period === "Y" ? offset : 0), 11788 month = inst.selectedMonth + (period === "M" ? offset : 0), 11789 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 11790 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 11791 11792 inst.selectedDay = date.getDate(); 11793 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11794 inst.drawYear = inst.selectedYear = date.getFullYear(); 11795 if (period === "M" || period === "Y") { 11796 this._notifyChange(inst); 11797 } 11798 }, 11799 11800 /* Ensure a date is within any min/max bounds. */ 11801 _restrictMinMax: function (inst, date) { 11802 var minDate = this._getMinMaxDate(inst, "min"), 11803 maxDate = this._getMinMaxDate(inst, "max"), 11804 newDate = (minDate && date < minDate ? minDate : date); 11805 return (maxDate && newDate > maxDate ? maxDate : newDate); 11806 }, 11807 11808 /* Notify change of month/year. */ 11809 _notifyChange: function (inst) { 11810 var onChange = this._get(inst, "onChangeMonthYear"); 11811 if (onChange) { 11812 onChange.apply((inst.input ? inst.input[0] : null), 11813 [inst.selectedYear, inst.selectedMonth + 1, inst]); 11814 } 11815 }, 11816 11817 /* Determine the number of months to show. */ 11818 _getNumberOfMonths: function (inst) { 11819 var numMonths = this._get(inst, "numberOfMonths"); 11820 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 11821 }, 11822 11823 /* Determine the current maximum date - ensure no time components are set. */ 11824 _getMinMaxDate: function (inst, minMax) { 11825 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 11826 }, 11827 11828 /* Find the number of days in a given month. */ 11829 _getDaysInMonth: function (year, month) { 11830 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 11831 }, 11832 11833 /* Find the day of the week of the first of a month. */ 11834 _getFirstDayOfMonth: function (year, month) { 11835 return new Date(year, month, 1).getDay(); 11836 }, 11837 11838 /* Determines if we should allow a "next/prev" month display change. */ 11839 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 11840 var numMonths = this._getNumberOfMonths(inst), 11841 date = this._daylightSavingAdjust(new Date(curYear, 11842 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 11843 11844 if (offset < 0) { 11845 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 11846 } 11847 return this._isInRange(inst, date); 11848 }, 11849 11850 /* Is the given date in the accepted range? */ 11851 _isInRange: function (inst, date) { 11852 var yearSplit, currentYear, 11853 minDate = this._getMinMaxDate(inst, "min"), 11854 maxDate = this._getMinMaxDate(inst, "max"), 11855 minYear = null, 11856 maxYear = null, 11857 years = this._get(inst, "yearRange"); 11858 if (years) { 11859 yearSplit = years.split(":"); 11860 currentYear = new Date().getFullYear(); 11861 minYear = parseInt(yearSplit[0], 10); 11862 maxYear = parseInt(yearSplit[1], 10); 11863 if (yearSplit[0].match(/[+\-].*/)) { 11864 minYear += currentYear; 11865 } 11866 if (yearSplit[1].match(/[+\-].*/)) { 11867 maxYear += currentYear; 11868 } 11869 } 11870 11871 return ((!minDate || date.getTime() >= minDate.getTime()) && 11872 (!maxDate || date.getTime() <= maxDate.getTime()) && 11873 (!minYear || date.getFullYear() >= minYear) && 11874 (!maxYear || date.getFullYear() <= maxYear)); 11875 }, 11876 11877 /* Provide the configuration settings for formatting/parsing. */ 11878 _getFormatConfig: function (inst) { 11879 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 11880 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 11881 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 11882 return { 11883 shortYearCutoff: shortYearCutoff, 11884 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 11885 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 11886 }; 11887 }, 11888 11889 /* Format the given date for display. */ 11890 _formatDate: function (inst, day, month, year) { 11891 if (!day) { 11892 inst.currentDay = inst.selectedDay; 11893 inst.currentMonth = inst.selectedMonth; 11894 inst.currentYear = inst.selectedYear; 11895 } 11896 var date = (day ? (typeof day === "object" ? day : 11897 this._daylightSavingAdjust(new Date(year, month, day))) : 11898 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 11899 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 11900 } 11901 }); 11902 11903 /* 11904 * Bind hover events for datepicker elements. 11905 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 11906 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 11907 */ 11908 function datepicker_bindHover(dpDiv) { 11909 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 11910 return dpDiv.on("mouseout", selector, function () { 11911 $(this).removeClass("ui-state-hover"); 11912 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11913 $(this).removeClass("ui-datepicker-prev-hover"); 11914 } 11915 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11916 $(this).removeClass("ui-datepicker-next-hover"); 11917 } 11918 }) 11919 .on("mouseover", selector, datepicker_handleMouseover); 11920 } 11921 11922 function datepicker_handleMouseover() { 11923 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 11924 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 11925 $(this).addClass("ui-state-hover"); 11926 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 11927 $(this).addClass("ui-datepicker-prev-hover"); 11928 } 11929 if (this.className.indexOf("ui-datepicker-next") !== -1) { 11930 $(this).addClass("ui-datepicker-next-hover"); 11931 } 11932 } 11933 } 11934 11935 /* jQuery extend now ignores nulls! */ 11936 function datepicker_extendRemove(target, props) { 11937 $.extend(target, props); 11938 for (var name in props) { 11939 if (props[name] == null) { 11940 target[name] = props[name]; 11941 } 11942 } 11943 return target; 11944 } 11945 11946 /* Invoke the datepicker functionality. 11947 @param options string - a command, optionally followed by additional parameters or 11948 Object - settings for attaching new datepicker functionality 11949 @return jQuery object */ 11950 $.fn.datepicker = function (options) { 11951 11952 /* Verify an empty collection wasn't passed - Fixes #6976 */ 11953 if (!this.length) { 11954 return this; 11955 } 11956 11957 /* Initialise the date picker. */ 11958 if (!$.datepicker.initialized) { 11959 $(document).on("mousedown", $.datepicker._checkExternalClick); 11960 $.datepicker.initialized = true; 11961 } 11962 11963 /* Append datepicker main container to body if not exist. */ 11964 if ($("#" + $.datepicker._mainDivId).length === 0) { 11965 $("body").append($.datepicker.dpDiv); 11966 } 11967 11968 var otherArgs = Array.prototype.slice.call(arguments, 1); 11969 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 11970 return $.datepicker["_" + options + "Datepicker"]. 11971 apply($.datepicker, [this[0]].concat(otherArgs)); 11972 } 11973 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 11974 return $.datepicker["_" + options + "Datepicker"]. 11975 apply($.datepicker, [this[0]].concat(otherArgs)); 11976 } 11977 return this.each(function () { 11978 if (typeof options === "string") { 11979 $.datepicker["_" + options + "Datepicker"] 11980 .apply($.datepicker, [this].concat(otherArgs)); 11981 } else { 11982 $.datepicker._attachDatepicker(this, options); 11983 } 11984 }); 11985 }; 11986 11987 $.datepicker = new Datepicker(); // singleton instance 11988 $.datepicker.initialized = false; 11989 $.datepicker.uuid = new Date().getTime(); 11990 $.datepicker.version = "1.13.2"; 11991 11992 var widgetsDatepicker = $.datepicker; 11993 11994 11995 /*! 11996 * jQuery UI Dialog 1.13.2 11997 * http://jqueryui.com
vendor: 25,277 bytes, lines 11998-12952
11998 * 11999 * Copyright jQuery Foundation and other contributors 12000 * Released under the MIT license. 12001 * http://jquery.org/license 12002 */ 12003 12004 //>>label: Dialog 12005 //>>group: Widgets 12006 //>>description: Displays customizable dialog windows. 12007 //>>docs: http://api.jqueryui.com/dialog/ 12008 //>>demos: http://jqueryui.com/dialog/ 12009 //>>css.structure: ../../themes/base/core.css 12010 //>>css.structure: ../../themes/base/dialog.css 12011 //>>css.theme: ../../themes/base/theme.css 12012 12013 12014 $.widget("ui.dialog", { 12015 version: "1.13.2", 12016 options: { 12017 appendTo: "body", 12018 autoOpen: true, 12019 buttons: [], 12020 classes: { 12021 "ui-dialog": "ui-corner-all", 12022 "ui-dialog-titlebar": "ui-corner-all" 12023 }, 12024 closeOnEscape: true, 12025 closeText: "Close", 12026 draggable: true, 12027 hide: null, 12028 height: "auto", 12029 maxHeight: null, 12030 maxWidth: null, 12031 minHeight: 150, 12032 minWidth: 150, 12033 modal: false, 12034 position: { 12035 my: "center", 12036 at: "center", 12037 of: window, 12038 collision: "fit", 12039 12040 // Ensure the titlebar is always visible 12041 using: function (pos) { 12042 var topOffset = $(this).css(pos).offset().top; 12043 if (topOffset < 0) { 12044 $(this).css("top", pos.top - topOffset); 12045 } 12046 } 12047 }, 12048 resizable: true, 12049 show: null, 12050 title: null, 12051 width: 300, 12052 12053 // Callbacks 12054 beforeClose: null, 12055 close: null, 12056 drag: null, 12057 dragStart: null, 12058 dragStop: null, 12059 focus: null, 12060 open: null, 12061 resize: null, 12062 resizeStart: null, 12063 resizeStop: null 12064 }, 12065 12066 sizeRelatedOptions: { 12067 buttons: true, 12068 height: true, 12069 maxHeight: true, 12070 maxWidth: true, 12071 minHeight: true, 12072 minWidth: true, 12073 width: true 12074 }, 12075 12076 resizableRelatedOptions: { 12077 maxHeight: true, 12078 maxWidth: true, 12079 minHeight: true, 12080 minWidth: true 12081 }, 12082 12083 _create: function () { 12084 this.originalCss = { 12085 display: this.element[0].style.display, 12086 width: this.element[0].style.width, 12087 minHeight: this.element[0].style.minHeight, 12088 maxHeight: this.element[0].style.maxHeight, 12089 height: this.element[0].style.height 12090 }; 12091 this.originalPosition = { 12092 parent: this.element.parent(), 12093 index: this.element.parent().children().index(this.element) 12094 }; 12095 this.originalTitle = this.element.attr("title"); 12096 if (this.options.title == null && this.originalTitle != null) { 12097 this.options.title = this.originalTitle; 12098 } 12099 12100 // Dialogs can't be disabled 12101 if (this.options.disabled) { 12102 this.options.disabled = false; 12103 } 12104 12105 this._createWrapper(); 12106 12107 this.element 12108 .show() 12109 .removeAttr("title") 12110 .appendTo(this.uiDialog); 12111 12112 this._addClass("ui-dialog-content", "ui-widget-content"); 12113 12114 this._createTitlebar(); 12115 this._createButtonPane(); 12116 12117 if (this.options.draggable && $.fn.draggable) { 12118 this._makeDraggable(); 12119 } 12120 if (this.options.resizable && $.fn.resizable) { 12121 this._makeResizable(); 12122 } 12123 12124 this._isOpen = false; 12125 12126 this._trackFocus(); 12127 }, 12128 12129 _init: function () { 12130 if (this.options.autoOpen) { 12131 this.open(); 12132 } 12133 }, 12134 12135 _appendTo: function () { 12136 var element = this.options.appendTo; 12137 if (element && (element.jquery || element.nodeType)) { 12138 return $(element); 12139 } 12140 return this.document.find(element || "body").eq(0); 12141 }, 12142 12143 _destroy: function () { 12144 var next, 12145 originalPosition = this.originalPosition; 12146 12147 this._untrackInstance(); 12148 this._destroyOverlay(); 12149 12150 this.element 12151 .removeUniqueId() 12152 .css(this.originalCss) 12153 12154 // Without detaching first, the following becomes really slow 12155 .detach(); 12156 12157 this.uiDialog.remove(); 12158 12159 if (this.originalTitle) { 12160 this.element.attr("title", this.originalTitle); 12161 } 12162 12163 next = originalPosition.parent.children().eq(originalPosition.index); 12164 12165 // Don't try to place the dialog next to itself (#8613) 12166 if (next.length && next[0] !== this.element[0]) { 12167 next.before(this.element); 12168 } else { 12169 originalPosition.parent.append(this.element); 12170 } 12171 }, 12172 12173 widget: function () { 12174 return this.uiDialog; 12175 }, 12176 12177 disable: $.noop, 12178 enable: $.noop, 12179 12180 close: function (event) { 12181 var that = this; 12182 12183 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 12184 return; 12185 } 12186 12187 this._isOpen = false; 12188 this._focusedElement = null; 12189 this._destroyOverlay(); 12190 this._untrackInstance(); 12191 12192 if (!this.opener.filter(":focusable").trigger("focus").length) { 12193 12194 // Hiding a focused element doesn't trigger blur in WebKit 12195 // so in case we have nothing to focus on, explicitly blur the active element 12196 // https://bugs.webkit.org/show_bug.cgi?id=47182 12197 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 12198 } 12199 12200 this._hide(this.uiDialog, this.options.hide, function () { 12201 that._trigger("close", event); 12202 }); 12203 }, 12204 12205 isOpen: function () { 12206 return this._isOpen; 12207 }, 12208 12209 moveToTop: function () { 12210 this._moveToTop(); 12211 }, 12212 12213 _moveToTop: function (event, silent) { 12214 var moved = false, 12215 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 12216 return +$(this).css("z-index"); 12217 }).get(), 12218 zIndexMax = Math.max.apply(null, zIndices); 12219 12220 if (zIndexMax >= +this.uiDialog.css("z-index")) { 12221 this.uiDialog.css("z-index", zIndexMax + 1); 12222 moved = true; 12223 } 12224 12225 if (moved && !silent) { 12226 this._trigger("focus", event); 12227 } 12228 return moved; 12229 }, 12230 12231 open: function () { 12232 var that = this; 12233 if (this._isOpen) { 12234 if (this._moveToTop()) { 12235 this._focusTabbable(); 12236 } 12237 return; 12238 } 12239 12240 this._isOpen = true; 12241 this.opener = $($.ui.safeActiveElement(this.document[0])); 12242 12243 this._size(); 12244 this._position(); 12245 this._createOverlay(); 12246 this._moveToTop(null, true); 12247 12248 // Ensure the overlay is moved to the top with the dialog, but only when 12249 // opening. The overlay shouldn't move after the dialog is open so that 12250 // modeless dialogs opened after the modal dialog stack properly. 12251 if (this.overlay) { 12252 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 12253 } 12254 12255 this._show(this.uiDialog, this.options.show, function () { 12256 that._focusTabbable(); 12257 that._trigger("focus"); 12258 }); 12259 12260 // Track the dialog immediately upon opening in case a focus event 12261 // somehow occurs outside of the dialog before an element inside the 12262 // dialog is focused (#10152) 12263 this._makeFocusTarget(); 12264 12265 this._trigger("open"); 12266 }, 12267 12268 _focusTabbable: function () { 12269 12270 // Set focus to the first match: 12271 // 1. An element that was focused previously 12272 // 2. First element inside the dialog matching [autofocus] 12273 // 3. Tabbable element inside the content element 12274 // 4. Tabbable element inside the buttonpane 12275 // 5. The close button 12276 // 6. The dialog itself 12277 var hasFocus = this._focusedElement; 12278 if (!hasFocus) { 12279 hasFocus = this.element.find("[autofocus]"); 12280 } 12281 if (!hasFocus.length) { 12282 hasFocus = this.element.find(":tabbable"); 12283 } 12284 if (!hasFocus.length) { 12285 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 12286 } 12287 if (!hasFocus.length) { 12288 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 12289 } 12290 if (!hasFocus.length) { 12291 hasFocus = this.uiDialog; 12292 } 12293 hasFocus.eq(0).trigger("focus"); 12294 }, 12295 12296 _restoreTabbableFocus: function () { 12297 var activeElement = $.ui.safeActiveElement(this.document[0]), 12298 isActive = this.uiDialog[0] === activeElement || 12299 $.contains(this.uiDialog[0], activeElement); 12300 if (!isActive) { 12301 this._focusTabbable(); 12302 } 12303 }, 12304 12305 _keepFocus: function (event) { 12306 event.preventDefault(); 12307 this._restoreTabbableFocus(); 12308 12309 // support: IE 12310 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12311 // so we check again later 12312 this._delay(this._restoreTabbableFocus); 12313 }, 12314 12315 _createWrapper: function () { 12316 this.uiDialog = $("<div>") 12317 .hide() 12318 .attr({ 12319 12320 // Setting tabIndex makes the div focusable 12321 tabIndex: -1, 12322 role: "dialog" 12323 }) 12324 .appendTo(this._appendTo()); 12325 12326 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 12327 this._on(this.uiDialog, { 12328 keydown: function (event) { 12329 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12330 event.keyCode === $.ui.keyCode.ESCAPE) { 12331 event.preventDefault(); 12332 this.close(event); 12333 return; 12334 } 12335 12336 // Prevent tabbing out of dialogs 12337 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 12338 return; 12339 } 12340 var tabbables = this.uiDialog.find(":tabbable"), 12341 first = tabbables.first(), 12342 last = tabbables.last(); 12343 12344 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 12345 !event.shiftKey) { 12346 this._delay(function () { 12347 first.trigger("focus"); 12348 }); 12349 event.preventDefault(); 12350 } else if ((event.target === first[0] || 12351 event.target === this.uiDialog[0]) && event.shiftKey) { 12352 this._delay(function () { 12353 last.trigger("focus"); 12354 }); 12355 event.preventDefault(); 12356 } 12357 }, 12358 mousedown: function (event) { 12359 if (this._moveToTop(event)) { 12360 this._focusTabbable(); 12361 } 12362 } 12363 }); 12364 12365 // We assume that any existing aria-describedby attribute means 12366 // that the dialog content is marked up properly 12367 // otherwise we brute force the content as the description 12368 if (!this.element.find("[aria-describedby]").length) { 12369 this.uiDialog.attr({ 12370 "aria-describedby": this.element.uniqueId().attr("id") 12371 }); 12372 } 12373 }, 12374 12375 _createTitlebar: function () { 12376 var uiDialogTitle; 12377 12378 this.uiDialogTitlebar = $("<div>"); 12379 this._addClass(this.uiDialogTitlebar, 12380 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 12381 this._on(this.uiDialogTitlebar, { 12382 mousedown: function (event) { 12383 12384 // Don't prevent click on close button (#8838) 12385 // Focusing a dialog that is partially scrolled out of view 12386 // causes the browser to scroll it into view, preventing the click event 12387 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 12388 12389 // Dialog isn't getting focus when dragging (#8063) 12390 this.uiDialog.trigger("focus"); 12391 } 12392 } 12393 }); 12394 12395 // Support: IE 12396 // Use type="button" to prevent enter keypresses in textboxes from closing the 12397 // dialog in IE (#9312) 12398 this.uiDialogTitlebarClose = $("<button type='button'></button>") 12399 .button({ 12400 label: $("<a>").text(this.options.closeText).html(), 12401 icon: "ui-icon-closethick", 12402 showLabel: false 12403 }) 12404 .appendTo(this.uiDialogTitlebar); 12405 12406 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 12407 this._on(this.uiDialogTitlebarClose, { 12408 click: function (event) { 12409 event.preventDefault(); 12410 this.close(event); 12411 } 12412 }); 12413 12414 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 12415 this._addClass(uiDialogTitle, "ui-dialog-title"); 12416 this._title(uiDialogTitle); 12417 12418 this.uiDialogTitlebar.prependTo(this.uiDialog); 12419 12420 this.uiDialog.attr({ 12421 "aria-labelledby": uiDialogTitle.attr("id") 12422 }); 12423 }, 12424 12425 _title: function (title) { 12426 if (this.options.title) { 12427 title.text(this.options.title); 12428 } else { 12429 title.html(" "); 12430 } 12431 }, 12432 12433 _createButtonPane: function () { 12434 this.uiDialogButtonPane = $("<div>"); 12435 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 12436 "ui-widget-content ui-helper-clearfix"); 12437 12438 this.uiButtonSet = $("<div>") 12439 .appendTo(this.uiDialogButtonPane); 12440 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 12441 12442 this._createButtons(); 12443 }, 12444 12445 _createButtons: function () { 12446 var that = this, 12447 buttons = this.options.buttons; 12448 12449 // If we already have a button pane, remove it 12450 this.uiDialogButtonPane.remove(); 12451 this.uiButtonSet.empty(); 12452 12453 if ($.isEmptyObject(buttons) || (Array.isArray(buttons) && !buttons.length)) { 12454 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 12455 return; 12456 } 12457 12458 $.each(buttons, function (name, props) { 12459 var click, buttonOptions; 12460 props = typeof props === "function" ? 12461 { click: props, text: name } : 12462 props; 12463 12464 // Default to a non-submitting button 12465 props = $.extend({ type: "button" }, props); 12466 12467 // Change the context for the click callback to be the main element 12468 click = props.click; 12469 buttonOptions = { 12470 icon: props.icon, 12471 iconPosition: props.iconPosition, 12472 showLabel: props.showLabel, 12473 12474 // Deprecated options 12475 icons: props.icons, 12476 text: props.text 12477 }; 12478 12479 delete props.click; 12480 delete props.icon; 12481 delete props.iconPosition; 12482 delete props.showLabel; 12483 12484 // Deprecated options 12485 delete props.icons; 12486 if (typeof props.text === "boolean") { 12487 delete props.text; 12488 } 12489 12490 $("<button></button>", props) 12491 .button(buttonOptions) 12492 .appendTo(that.uiButtonSet) 12493 .on("click", function () { 12494 click.apply(that.element[0], arguments); 12495 }); 12496 }); 12497 this._addClass(this.uiDialog, "ui-dialog-buttons"); 12498 this.uiDialogButtonPane.appendTo(this.uiDialog); 12499 }, 12500 12501 _makeDraggable: function () { 12502 var that = this, 12503 options = this.options; 12504 12505 function filteredUi(ui) { 12506 return { 12507 position: ui.position, 12508 offset: ui.offset 12509 }; 12510 } 12511 12512 this.uiDialog.draggable({ 12513 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12514 handle: ".ui-dialog-titlebar", 12515 containment: "document", 12516 start: function (event, ui) { 12517 that._addClass($(this), "ui-dialog-dragging"); 12518 that._blockFrames(); 12519 that._trigger("dragStart", event, filteredUi(ui)); 12520 }, 12521 drag: function (event, ui) { 12522 that._trigger("drag", event, filteredUi(ui)); 12523 }, 12524 stop: function (event, ui) { 12525 var left = ui.offset.left - that.document.scrollLeft(), 12526 top = ui.offset.top - that.document.scrollTop(); 12527 12528 options.position = { 12529 my: "left top", 12530 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12531 "top" + (top >= 0 ? "+" : "") + top, 12532 of: that.window 12533 }; 12534 that._removeClass($(this), "ui-dialog-dragging"); 12535 that._unblockFrames(); 12536 that._trigger("dragStop", event, filteredUi(ui)); 12537 } 12538 }); 12539 }, 12540 12541 _makeResizable: function () { 12542 var that = this, 12543 options = this.options, 12544 handles = options.resizable, 12545 12546 // .ui-resizable has position: relative defined in the stylesheet 12547 // but dialogs have to use absolute or fixed positioning 12548 position = this.uiDialog.css("position"), 12549 resizeHandles = typeof handles === "string" ? 12550 handles : 12551 "n,e,s,w,se,sw,ne,nw"; 12552 12553 function filteredUi(ui) { 12554 return { 12555 originalPosition: ui.originalPosition, 12556 originalSize: ui.originalSize, 12557 position: ui.position, 12558 size: ui.size 12559 }; 12560 } 12561 12562 this.uiDialog.resizable({ 12563 cancel: ".ui-dialog-content", 12564 containment: "document", 12565 alsoResize: this.element, 12566 maxWidth: options.maxWidth, 12567 maxHeight: options.maxHeight, 12568 minWidth: options.minWidth, 12569 minHeight: this._minHeight(), 12570 handles: resizeHandles, 12571 start: function (event, ui) { 12572 that._addClass($(this), "ui-dialog-resizing"); 12573 that._blockFrames(); 12574 that._trigger("resizeStart", event, filteredUi(ui)); 12575 }, 12576 resize: function (event, ui) { 12577 that._trigger("resize", event, filteredUi(ui)); 12578 }, 12579 stop: function (event, ui) { 12580 var offset = that.uiDialog.offset(), 12581 left = offset.left - that.document.scrollLeft(), 12582 top = offset.top - that.document.scrollTop(); 12583 12584 options.height = that.uiDialog.height(); 12585 options.width = that.uiDialog.width(); 12586 options.position = { 12587 my: "left top", 12588 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12589 "top" + (top >= 0 ? "+" : "") + top, 12590 of: that.window 12591 }; 12592 that._removeClass($(this), "ui-dialog-resizing"); 12593 that._unblockFrames(); 12594 that._trigger("resizeStop", event, filteredUi(ui)); 12595 } 12596 }) 12597 .css("position", position); 12598 }, 12599 12600 _trackFocus: function () { 12601 this._on(this.widget(), { 12602 focusin: function (event) { 12603 this._makeFocusTarget(); 12604 this._focusedElement = $(event.target); 12605 } 12606 }); 12607 }, 12608 12609 _makeFocusTarget: function () { 12610 this._untrackInstance(); 12611 this._trackingInstances().unshift(this); 12612 }, 12613 12614 _untrackInstance: function () { 12615 var instances = this._trackingInstances(), 12616 exists = $.inArray(this, instances); 12617 if (exists !== -1) { 12618 instances.splice(exists, 1); 12619 } 12620 }, 12621 12622 _trackingInstances: function () { 12623 var instances = this.document.data("ui-dialog-instances"); 12624 if (!instances) { 12625 instances = []; 12626 this.document.data("ui-dialog-instances", instances); 12627 } 12628 return instances; 12629 }, 12630 12631 _minHeight: function () { 12632 var options = this.options; 12633 12634 return options.height === "auto" ? 12635 options.minHeight : 12636 Math.min(options.minHeight, options.height); 12637 }, 12638 12639 _position: function () { 12640 12641 // Need to show the dialog to get the actual offset in the position plugin 12642 var isVisible = this.uiDialog.is(":visible"); 12643 if (!isVisible) { 12644 this.uiDialog.show(); 12645 } 12646 this.uiDialog.position(this.options.position); 12647 if (!isVisible) { 12648 this.uiDialog.hide(); 12649 } 12650 }, 12651 12652 _setOptions: function (options) { 12653 var that = this, 12654 resize = false, 12655 resizableOptions = {}; 12656 12657 $.each(options, function (key, value) { 12658 that._setOption(key, value); 12659 12660 if (key in that.sizeRelatedOptions) { 12661 resize = true; 12662 } 12663 if (key in that.resizableRelatedOptions) { 12664 resizableOptions[key] = value; 12665 } 12666 }); 12667 12668 if (resize) { 12669 this._size(); 12670 this._position(); 12671 } 12672 if (this.uiDialog.is(":data(ui-resizable)")) { 12673 this.uiDialog.resizable("option", resizableOptions); 12674 } 12675 }, 12676 12677 _setOption: function (key, value) { 12678 var isDraggable, isResizable, 12679 uiDialog = this.uiDialog; 12680 12681 if (key === "disabled") { 12682 return; 12683 } 12684 12685 this._super(key, value); 12686 12687 if (key === "appendTo") { 12688 this.uiDialog.appendTo(this._appendTo()); 12689 } 12690 12691 if (key === "buttons") { 12692 this._createButtons(); 12693 } 12694 12695 if (key === "closeText") { 12696 this.uiDialogTitlebarClose.button({ 12697 12698 // Ensure that we always pass a string 12699 label: $("<a>").text("" + this.options.closeText).html() 12700 }); 12701 } 12702 12703 if (key === "draggable") { 12704 isDraggable = uiDialog.is(":data(ui-draggable)"); 12705 if (isDraggable && !value) { 12706 uiDialog.draggable("destroy"); 12707 } 12708 12709 if (!isDraggable && value) { 12710 this._makeDraggable(); 12711 } 12712 } 12713 12714 if (key === "position") { 12715 this._position(); 12716 } 12717 12718 if (key === "resizable") { 12719 12720 // currently resizable, becoming non-resizable 12721 isResizable = uiDialog.is(":data(ui-resizable)"); 12722 if (isResizable && !value) { 12723 uiDialog.resizable("destroy"); 12724 } 12725 12726 // Currently resizable, changing handles 12727 if (isResizable && typeof value === "string") { 12728 uiDialog.resizable("option", "handles", value); 12729 } 12730 12731 // Currently non-resizable, becoming resizable 12732 if (!isResizable && value !== false) { 12733 this._makeResizable(); 12734 } 12735 } 12736 12737 if (key === "title") { 12738 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 12739 } 12740 }, 12741 12742 _size: function () { 12743 12744 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12745 // divs will both have width and height set, so we need to reset them 12746 var nonContentHeight, minContentHeight, maxContentHeight, 12747 options = this.options; 12748 12749 // Reset content sizing 12750 this.element.show().css({ 12751 width: "auto", 12752 minHeight: 0, 12753 maxHeight: "none", 12754 height: 0 12755 }); 12756 12757 if (options.minWidth > options.width) { 12758 options.width = options.minWidth; 12759 } 12760 12761 // Reset wrapper sizing 12762 // determine the height of all the non-content elements 12763 nonContentHeight = this.uiDialog.css({ 12764 height: "auto", 12765 width: options.width 12766 }) 12767 .outerHeight(); 12768 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 12769 maxContentHeight = typeof options.maxHeight === "number" ? 12770 Math.max(0, options.maxHeight - nonContentHeight) : 12771 "none"; 12772 12773 if (options.height === "auto") { 12774 this.element.css({ 12775 minHeight: minContentHeight, 12776 maxHeight: maxContentHeight, 12777 height: "auto" 12778 }); 12779 } else { 12780 this.element.height(Math.max(0, options.height - nonContentHeight)); 12781 } 12782 12783 if (this.uiDialog.is(":data(ui-resizable)")) { 12784 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 12785 } 12786 }, 12787 12788 _blockFrames: function () { 12789 this.iframeBlocks = this.document.find("iframe").map(function () { 12790 var iframe = $(this); 12791 12792 return $("<div>") 12793 .css({ 12794 position: "absolute", 12795 width: iframe.outerWidth(), 12796 height: iframe.outerHeight() 12797 }) 12798 .appendTo(iframe.parent()) 12799 .offset(iframe.offset())[0]; 12800 }); 12801 }, 12802 12803 _unblockFrames: function () { 12804 if (this.iframeBlocks) { 12805 this.iframeBlocks.remove(); 12806 delete this.iframeBlocks; 12807 } 12808 }, 12809 12810 _allowInteraction: function (event) { 12811 if ($(event.target).closest(".ui-dialog").length) { 12812 return true; 12813 } 12814 12815 // TODO: Remove hack when datepicker implements 12816 // the .ui-front logic (#8989) 12817 return !!$(event.target).closest(".ui-datepicker").length; 12818 }, 12819 12820 _createOverlay: function () { 12821 if (!this.options.modal) { 12822 return; 12823 } 12824 12825 var jqMinor = $.fn.jquery.substring(0, 4); 12826 12827 // We use a delay in case the overlay is created from an 12828 // event that we're going to be cancelling (#2804) 12829 var isOpening = true; 12830 this._delay(function () { 12831 isOpening = false; 12832 }); 12833 12834 if (!this.document.data("ui-dialog-overlays")) { 12835 12836 // Prevent use of anchors and inputs 12837 // This doesn't use `_on()` because it is a shared event handler 12838 // across all open modal dialogs. 12839 this.document.on("focusin.ui-dialog", function (event) { 12840 if (isOpening) { 12841 return; 12842 } 12843 12844 var instance = this._trackingInstances()[0]; 12845 if (!instance._allowInteraction(event)) { 12846 event.preventDefault(); 12847 instance._focusTabbable(); 12848 12849 // Support: jQuery >=3.4 <3.6 only 12850 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 12851 // have its focus event propagated last, breaking the re-targeting. 12852 // Trigger focus in a delay in addition if needed to avoid the issue 12853 // See https://github.com/jquery/jquery/issues/4382 12854 if (jqMinor === "3.4." || jqMinor === "3.5.") { 12855 instance._delay(instance._restoreTabbableFocus); 12856 } 12857 } 12858 }.bind(this)); 12859 } 12860 12861 this.overlay = $("<div>") 12862 .appendTo(this._appendTo()); 12863 12864 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 12865 this._on(this.overlay, { 12866 mousedown: "_keepFocus" 12867 }); 12868 this.document.data("ui-dialog-overlays", 12869 (this.document.data("ui-dialog-overlays") || 0) + 1); 12870 }, 12871 12872 _destroyOverlay: function () { 12873 if (!this.options.modal) { 12874 return; 12875 } 12876 12877 if (this.overlay) { 12878 var overlays = this.document.data("ui-dialog-overlays") - 1; 12879 12880 if (!overlays) { 12881 this.document.off("focusin.ui-dialog"); 12882 this.document.removeData("ui-dialog-overlays"); 12883 } else { 12884 this.document.data("ui-dialog-overlays", overlays); 12885 } 12886 12887 this.overlay.remove(); 12888 this.overlay = null; 12889 } 12890 } 12891 }); 12892 12893 // DEPRECATED 12894 // TODO: switch return back to widget declaration at top of file when this is removed 12895 if ($.uiBackCompat !== false) { 12896 12897 // Backcompat for dialogClass option 12898 $.widget("ui.dialog", $.ui.dialog, { 12899 options: { 12900 dialogClass: "" 12901 }, 12902 _createWrapper: function () { 12903 this._super(); 12904 this.uiDialog.addClass(this.options.dialogClass); 12905 }, 12906 _setOption: function (key, value) { 12907 if (key === "dialogClass") { 12908 this.uiDialog 12909 .removeClass(this.options.dialogClass) 12910 .addClass(value); 12911 } 12912 this._superApply(arguments); 12913 } 12914 }); 12915 } 12916 12917 var widgetsDialog = $.ui.dialog; 12918 12919 12920 /*! 12921 * jQuery UI Progressbar 1.13.2 12922 * http://jqueryui.com 12923 * 12924 * Copyright jQuery Foundation and other contributors 12925 * Released under the MIT license. 12926 * http://jquery.org/license 12927 */ 12928 12929 //>>label: Progressbar 12930 //>>group: Widgets 12931 /* eslint-disable max-len */ 12932 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 12933 /* eslint-enable max-len */ 12934 //>>docs: http://api.jqueryui.com/progressbar/ 12935 //>>demos: http://jqueryui.com/progressbar/ 12936 //>>css.structure: ../../themes/base/core.css 12937 //>>css.structure: ../../themes/base/progressbar.css 12938 //>>css.theme: ../../themes/base/theme.css 12939 12940 12941 var widgetsProgressbar = $.widget("ui.progressbar", { 12942 version: "1.13.2", 12943 options: { 12944 classes: { 12945 "ui-progressbar": "ui-corner-all", 12946 "ui-progressbar-value": "ui-corner-left", 12947 "ui-progressbar-complete": "ui-corner-right" 12948 }, 12949 max: 100, 12950 value: 0, 12951 12952 change: null,
vendor: 7,114 bytes, lines 12953-13228
12953 complete: null 12954 }, 12955 12956 min: 0, 12957 12958 _create: function () { 12959 12960 // Constrain initial value 12961 this.oldValue = this.options.value = this._constrainedValue(); 12962 12963 this.element.attr({ 12964 12965 // Only set static values; aria-valuenow and aria-valuemax are 12966 // set inside _refreshValue() 12967 role: "progressbar", 12968 "aria-valuemin": this.min 12969 }); 12970 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 12971 12972 this.valueDiv = $("<div>").appendTo(this.element); 12973 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 12974 this._refreshValue(); 12975 }, 12976 12977 _destroy: function () { 12978 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 12979 12980 this.valueDiv.remove(); 12981 }, 12982 12983 value: function (newValue) { 12984 if (newValue === undefined) { 12985 return this.options.value; 12986 } 12987 12988 this.options.value = this._constrainedValue(newValue); 12989 this._refreshValue(); 12990 }, 12991 12992 _constrainedValue: function (newValue) { 12993 if (newValue === undefined) { 12994 newValue = this.options.value; 12995 } 12996 12997 this.indeterminate = newValue === false; 12998 12999 // Sanitize value 13000 if (typeof newValue !== "number") { 13001 newValue = 0; 13002 } 13003 13004 return this.indeterminate ? false : 13005 Math.min(this.options.max, Math.max(this.min, newValue)); 13006 }, 13007 13008 _setOptions: function (options) { 13009 13010 // Ensure "value" option is set after other values (like max) 13011 var value = options.value; 13012 delete options.value; 13013 13014 this._super(options); 13015 13016 this.options.value = this._constrainedValue(value); 13017 this._refreshValue(); 13018 }, 13019 13020 _setOption: function (key, value) { 13021 if (key === "max") { 13022 13023 // Don't allow a max less than min 13024 value = Math.max(this.min, value); 13025 } 13026 this._super(key, value); 13027 }, 13028 13029 _setOptionDisabled: function (value) { 13030 this._super(value); 13031 13032 this.element.attr("aria-disabled", value); 13033 this._toggleClass(null, "ui-state-disabled", !!value); 13034 }, 13035 13036 _percentage: function () { 13037 return this.indeterminate ? 13038 100 : 13039 100 * (this.options.value - this.min) / (this.options.max - this.min); 13040 }, 13041 13042 _refreshValue: function () { 13043 var value = this.options.value, 13044 percentage = this._percentage(); 13045 13046 this.valueDiv 13047 .toggle(this.indeterminate || value > this.min) 13048 .width(percentage.toFixed(0) + "%"); 13049 13050 this 13051 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 13052 value === this.options.max) 13053 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 13054 13055 if (this.indeterminate) { 13056 this.element.removeAttr("aria-valuenow"); 13057 if (!this.overlayDiv) { 13058 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 13059 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 13060 } 13061 } else { 13062 this.element.attr({ 13063 "aria-valuemax": this.options.max, 13064 "aria-valuenow": value 13065 }); 13066 if (this.overlayDiv) { 13067 this.overlayDiv.remove(); 13068 this.overlayDiv = null; 13069 } 13070 } 13071 13072 if (this.oldValue !== value) { 13073 this.oldValue = value; 13074 this._trigger("change"); 13075 } 13076 if (value === this.options.max) { 13077 this._trigger("complete"); 13078 } 13079 } 13080 }); 13081 13082 13083 /*! 13084 * jQuery UI Selectmenu 1.13.2 13085 * http://jqueryui.com 13086 * 13087 * Copyright jQuery Foundation and other contributors 13088 * Released under the MIT license. 13089 * http://jquery.org/license 13090 */ 13091 13092 //>>label: Selectmenu 13093 //>>group: Widgets 13094 /* eslint-disable max-len */ 13095 //>>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. 13096 /* eslint-enable max-len */ 13097 //>>docs: http://api.jqueryui.com/selectmenu/ 13098 //>>demos: http://jqueryui.com/selectmenu/ 13099 //>>css.structure: ../../themes/base/core.css 13100 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 13101 //>>css.theme: ../../themes/base/theme.css 13102 13103 13104 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 13105 version: "1.13.2", 13106 defaultElement: "<select>", 13107 options: { 13108 appendTo: null, 13109 classes: { 13110 "ui-selectmenu-button-open": "ui-corner-top", 13111 "ui-selectmenu-button-closed": "ui-corner-all" 13112 }, 13113 disabled: null, 13114 icons: { 13115 button: "ui-icon-triangle-1-s" 13116 }, 13117 position: { 13118 my: "left top", 13119 at: "left bottom", 13120 collision: "none" 13121 }, 13122 width: false, 13123 13124 // Callbacks 13125 change: null, 13126 close: null, 13127 focus: null, 13128 open: null, 13129 select: null 13130 }, 13131 13132 _create: function () { 13133 var selectmenuId = this.element.uniqueId().attr("id"); 13134 this.ids = { 13135 element: selectmenuId, 13136 button: selectmenuId + "-button", 13137 menu: selectmenuId + "-menu" 13138 }; 13139 13140 this._drawButton(); 13141 this._drawMenu(); 13142 this._bindFormResetHandler(); 13143 13144 this._rendered = false; 13145 this.menuItems = $(); 13146 }, 13147 13148 _drawButton: function () { 13149 var icon, 13150 that = this, 13151 item = this._parseOption( 13152 this.element.find("option:selected"), 13153 this.element[0].selectedIndex 13154 ); 13155 13156 // Associate existing label with the new button 13157 this.labels = this.element.labels().attr("for", this.ids.button); 13158 this._on(this.labels, { 13159 click: function (event) { 13160 this.button.trigger("focus"); 13161 event.preventDefault(); 13162 } 13163 }); 13164 13165 // Hide original select element 13166 this.element.hide(); 13167 13168 // Create button 13169 this.button = $("<span>", { 13170 tabindex: this.options.disabled ? -1 : 0, 13171 id: this.ids.button, 13172 role: "combobox", 13173 "aria-expanded": "false", 13174 "aria-autocomplete": "list", 13175 "aria-owns": this.ids.menu, 13176 "aria-haspopup": "true", 13177 title: this.element.attr("title") 13178 }) 13179 .insertAfter(this.element); 13180 13181 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 13182 "ui-button ui-widget"); 13183 13184 icon = $("<span>").appendTo(this.button); 13185 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 13186 this.buttonItem = this._renderButtonItem(item) 13187 .appendTo(this.button); 13188 13189 if (this.options.width !== false) { 13190 this._resizeButton(); 13191 } 13192 13193 this._on(this.button, this._buttonEvents); 13194 this.button.one("focusin", function () { 13195 13196 // Delay rendering the menu items until the button receives focus. 13197 // The menu may have already been rendered via a programmatic open. 13198 if (!that._rendered) { 13199 that._refreshMenu(); 13200 } 13201 }); 13202 }, 13203 13204 _drawMenu: function () { 13205 var that = this; 13206 13207 // Create menu 13208 this.menu = $("<ul>", { 13209 "aria-hidden": "true", 13210 "aria-labelledby": this.ids.button, 13211 id: this.ids.menu 13212 }); 13213 13214 // Wrap menu 13215 this.menuWrap = $("<div>").append(this.menu); 13216 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 13217 this.menuWrap.appendTo(this._appendTo()); 13218 13219 // Initialize menu widget 13220 this.menuInstance = this.menu 13221 .menu({ 13222 classes: { 13223 "ui-menu": "ui-corner-bottom" 13224 }, 13225 role: "listbox", 13226 select: function (event, ui) { 13227 event.preventDefault(); 13228
vendor: 5,844 bytes, lines 13229-13469
13229 // Support: IE8 13230 // If the item was selected via a click, the text selection 13231 // will be destroyed in IE 13232 that._setSelection(); 13233 13234 that._select(ui.item.data("ui-selectmenu-item"), event); 13235 }, 13236 focus: function (event, ui) { 13237 var item = ui.item.data("ui-selectmenu-item"); 13238 13239 // Prevent inital focus from firing and check if its a newly focused item 13240 if (that.focusIndex != null && item.index !== that.focusIndex) { 13241 that._trigger("focus", event, { item: item }); 13242 if (!that.isOpen) { 13243 that._select(item, event); 13244 } 13245 } 13246 that.focusIndex = item.index; 13247 13248 that.button.attr("aria-activedescendant", 13249 that.menuItems.eq(item.index).attr("id")); 13250 } 13251 }) 13252 .menu("instance"); 13253 13254 // Don't close the menu on mouseleave 13255 this.menuInstance._off(this.menu, "mouseleave"); 13256 13257 // Cancel the menu's collapseAll on document click 13258 this.menuInstance._closeOnDocumentClick = function () { 13259 return false; 13260 }; 13261 13262 // Selects often contain empty items, but never contain dividers 13263 this.menuInstance._isDivider = function () { 13264 return false; 13265 }; 13266 }, 13267 13268 refresh: function () { 13269 this._refreshMenu(); 13270 this.buttonItem.replaceWith( 13271 this.buttonItem = this._renderButtonItem( 13272 13273 // Fall back to an empty object in case there are no options 13274 this._getSelectedItem().data("ui-selectmenu-item") || {} 13275 ) 13276 ); 13277 if (this.options.width === null) { 13278 this._resizeButton(); 13279 } 13280 }, 13281 13282 _refreshMenu: function () { 13283 var item, 13284 options = this.element.find("option"); 13285 13286 this.menu.empty(); 13287 13288 this._parseOptions(options); 13289 this._renderMenu(this.menu, this.items); 13290 13291 this.menuInstance.refresh(); 13292 this.menuItems = this.menu.find("li") 13293 .not(".ui-selectmenu-optgroup") 13294 .find(".ui-menu-item-wrapper"); 13295 13296 this._rendered = true; 13297 13298 if (!options.length) { 13299 return; 13300 } 13301 13302 item = this._getSelectedItem(); 13303 13304 // Update the menu to have the correct item focused 13305 this.menuInstance.focus(null, item); 13306 this._setAria(item.data("ui-selectmenu-item")); 13307 13308 // Set disabled state 13309 this._setOption("disabled", this.element.prop("disabled")); 13310 }, 13311 13312 open: function (event) { 13313 if (this.options.disabled) { 13314 return; 13315 } 13316 13317 // If this is the first time the menu is being opened, render the items 13318 if (!this._rendered) { 13319 this._refreshMenu(); 13320 } else { 13321 13322 // Menu clears focus on close, reset focus to selected item 13323 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 13324 this.menuInstance.focus(null, this._getSelectedItem()); 13325 } 13326 13327 // If there are no options, don't open the menu 13328 if (!this.menuItems.length) { 13329 return; 13330 } 13331 13332 this.isOpen = true; 13333 this._toggleAttr(); 13334 this._resizeMenu(); 13335 this._position(); 13336 13337 this._on(this.document, this._documentClick); 13338 13339 this._trigger("open", event); 13340 }, 13341 13342 _position: function () { 13343 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 13344 }, 13345 13346 close: function (event) { 13347 if (!this.isOpen) { 13348 return; 13349 } 13350 13351 this.isOpen = false; 13352 this._toggleAttr(); 13353 13354 this.range = null; 13355 this._off(this.document); 13356 13357 this._trigger("close", event); 13358 }, 13359 13360 widget: function () { 13361 return this.button; 13362 }, 13363 13364 menuWidget: function () { 13365 return this.menu; 13366 }, 13367 13368 _renderButtonItem: function (item) { 13369 var buttonItem = $("<span>"); 13370 13371 this._setText(buttonItem, item.label); 13372 this._addClass(buttonItem, "ui-selectmenu-text"); 13373 13374 return buttonItem; 13375 }, 13376 13377 _renderMenu: function (ul, items) { 13378 var that = this, 13379 currentOptgroup = ""; 13380 13381 $.each(items, function (index, item) { 13382 var li; 13383 13384 if (item.optgroup !== currentOptgroup) { 13385 li = $("<li>", { 13386 text: item.optgroup 13387 }); 13388 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13389 (item.element.parent("optgroup").prop("disabled") ? 13390 " ui-state-disabled" : 13391 "")); 13392 13393 li.appendTo(ul); 13394 13395 currentOptgroup = item.optgroup; 13396 } 13397 13398 that._renderItemData(ul, item); 13399 }); 13400 }, 13401 13402 _renderItemData: function (ul, item) { 13403 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 13404 }, 13405 13406 _renderItem: function (ul, item) { 13407 var li = $("<li>"), 13408 wrapper = $("<div>", { 13409 title: item.element.attr("title") 13410 }); 13411 13412 if (item.disabled) { 13413 this._addClass(li, null, "ui-state-disabled"); 13414 } 13415 this._setText(wrapper, item.label); 13416 13417 return li.append(wrapper).appendTo(ul); 13418 }, 13419 13420 _setText: function (element, value) { 13421 if (value) { 13422 element.text(value); 13423 } else { 13424 element.html(" "); 13425 } 13426 }, 13427 13428 _move: function (direction, event) { 13429 var item, next, 13430 filter = ".ui-menu-item"; 13431 13432 if (this.isOpen) { 13433 item = this.menuItems.eq(this.focusIndex).parent("li"); 13434 } else { 13435 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13436 filter += ":not(.ui-state-disabled)"; 13437 } 13438 13439 if (direction === "first" || direction === "last") { 13440 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 13441 } else { 13442 next = item[direction + "All"](filter).eq(0); 13443 } 13444 13445 if (next.length) { 13446 this.menuInstance.focus(event, next); 13447 } 13448 }, 13449 13450 _getSelectedItem: function () { 13451 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13452 }, 13453 13454 _toggle: function (event) { 13455 this[this.isOpen ? "close" : "open"](event); 13456 }, 13457 13458 _setSelection: function () { 13459 var selection; 13460 13461 if (!this.range) { 13462 return; 13463 } 13464 13465 if (window.getSelection) { 13466 selection = window.getSelection(); 13467 selection.removeAllRanges(); 13468 selection.addRange(this.range); 13469
vendor: 9,925 bytes, lines 13470-13866
13470 // Support: IE8 13471 } else { 13472 this.range.select(); 13473 } 13474 13475 // Support: IE 13476 // Setting the text selection kills the button focus in IE, but 13477 // restoring the focus doesn't kill the selection. 13478 this.button.trigger("focus"); 13479 }, 13480 13481 _documentClick: { 13482 mousedown: function (event) { 13483 if (!this.isOpen) { 13484 return; 13485 } 13486 13487 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 13488 $.escapeSelector(this.ids.button)).length) { 13489 this.close(event); 13490 } 13491 } 13492 }, 13493 13494 _buttonEvents: { 13495 13496 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13497 mousedown: function () { 13498 var selection; 13499 13500 if (window.getSelection) { 13501 selection = window.getSelection(); 13502 if (selection.rangeCount) { 13503 this.range = selection.getRangeAt(0); 13504 } 13505 13506 // Support: IE8 13507 } else { 13508 this.range = document.selection.createRange(); 13509 } 13510 }, 13511 13512 click: function (event) { 13513 this._setSelection(); 13514 this._toggle(event); 13515 }, 13516 13517 keydown: function (event) { 13518 var preventDefault = true; 13519 switch (event.keyCode) { 13520 case $.ui.keyCode.TAB: 13521 case $.ui.keyCode.ESCAPE: 13522 this.close(event); 13523 preventDefault = false; 13524 break; 13525 case $.ui.keyCode.ENTER: 13526 if (this.isOpen) { 13527 this._selectFocusedItem(event); 13528 } 13529 break; 13530 case $.ui.keyCode.UP: 13531 if (event.altKey) { 13532 this._toggle(event); 13533 } else { 13534 this._move("prev", event); 13535 } 13536 break; 13537 case $.ui.keyCode.DOWN: 13538 if (event.altKey) { 13539 this._toggle(event); 13540 } else { 13541 this._move("next", event); 13542 } 13543 break; 13544 case $.ui.keyCode.SPACE: 13545 if (this.isOpen) { 13546 this._selectFocusedItem(event); 13547 } else { 13548 this._toggle(event); 13549 } 13550 break; 13551 case $.ui.keyCode.LEFT: 13552 this._move("prev", event); 13553 break; 13554 case $.ui.keyCode.RIGHT: 13555 this._move("next", event); 13556 break; 13557 case $.ui.keyCode.HOME: 13558 case $.ui.keyCode.PAGE_UP: 13559 this._move("first", event); 13560 break; 13561 case $.ui.keyCode.END: 13562 case $.ui.keyCode.PAGE_DOWN: 13563 this._move("last", event); 13564 break; 13565 default: 13566 this.menu.trigger(event); 13567 preventDefault = false; 13568 } 13569 13570 if (preventDefault) { 13571 event.preventDefault(); 13572 } 13573 } 13574 }, 13575 13576 _selectFocusedItem: function (event) { 13577 var item = this.menuItems.eq(this.focusIndex).parent("li"); 13578 if (!item.hasClass("ui-state-disabled")) { 13579 this._select(item.data("ui-selectmenu-item"), event); 13580 } 13581 }, 13582 13583 _select: function (item, event) { 13584 var oldIndex = this.element[0].selectedIndex; 13585 13586 // Change native select element 13587 this.element[0].selectedIndex = item.index; 13588 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 13589 this._setAria(item); 13590 this._trigger("select", event, { item: item }); 13591 13592 if (item.index !== oldIndex) { 13593 this._trigger("change", event, { item: item }); 13594 } 13595 13596 this.close(event); 13597 }, 13598 13599 _setAria: function (item) { 13600 var id = this.menuItems.eq(item.index).attr("id"); 13601 13602 this.button.attr({ 13603 "aria-labelledby": id, 13604 "aria-activedescendant": id 13605 }); 13606 this.menu.attr("aria-activedescendant", id); 13607 }, 13608 13609 _setOption: function (key, value) { 13610 if (key === "icons") { 13611 var icon = this.button.find("span.ui-icon"); 13612 this._removeClass(icon, null, this.options.icons.button) 13613 ._addClass(icon, null, value.button); 13614 } 13615 13616 this._super(key, value); 13617 13618 if (key === "appendTo") { 13619 this.menuWrap.appendTo(this._appendTo()); 13620 } 13621 13622 if (key === "width") { 13623 this._resizeButton(); 13624 } 13625 }, 13626 13627 _setOptionDisabled: function (value) { 13628 this._super(value); 13629 13630 this.menuInstance.option("disabled", value); 13631 this.button.attr("aria-disabled", value); 13632 this._toggleClass(this.button, null, "ui-state-disabled", value); 13633 13634 this.element.prop("disabled", value); 13635 if (value) { 13636 this.button.attr("tabindex", -1); 13637 this.close(); 13638 } else { 13639 this.button.attr("tabindex", 0); 13640 } 13641 }, 13642 13643 _appendTo: function () { 13644 var element = this.options.appendTo; 13645 13646 if (element) { 13647 element = element.jquery || element.nodeType ? 13648 $(element) : 13649 this.document.find(element).eq(0); 13650 } 13651 13652 if (!element || !element[0]) { 13653 element = this.element.closest(".ui-front, dialog"); 13654 } 13655 13656 if (!element.length) { 13657 element = this.document[0].body; 13658 } 13659 13660 return element; 13661 }, 13662 13663 _toggleAttr: function () { 13664 this.button.attr("aria-expanded", this.isOpen); 13665 13666 // We can't use two _toggleClass() calls here, because we need to make sure 13667 // we always remove classes first and add them second, otherwise if both classes have the 13668 // same theme class, it will be removed after we add it. 13669 this._removeClass(this.button, "ui-selectmenu-button-" + 13670 (this.isOpen ? "closed" : "open")) 13671 ._addClass(this.button, "ui-selectmenu-button-" + 13672 (this.isOpen ? "open" : "closed")) 13673 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 13674 13675 this.menu.attr("aria-hidden", !this.isOpen); 13676 }, 13677 13678 _resizeButton: function () { 13679 var width = this.options.width; 13680 13681 // For `width: false`, just remove inline style and stop 13682 if (width === false) { 13683 this.button.css("width", ""); 13684 return; 13685 } 13686 13687 // For `width: null`, match the width of the original element 13688 if (width === null) { 13689 width = this.element.show().outerWidth(); 13690 this.element.hide(); 13691 } 13692 13693 this.button.outerWidth(width); 13694 }, 13695 13696 _resizeMenu: function () { 13697 this.menu.outerWidth(Math.max( 13698 this.button.outerWidth(), 13699 13700 // Support: IE10 13701 // IE10 wraps long text (possibly a rounding bug) 13702 // so we add 1px to avoid the wrapping 13703 this.menu.width("").outerWidth() + 1 13704 )); 13705 }, 13706 13707 _getCreateOptions: function () { 13708 var options = this._super(); 13709 13710 options.disabled = this.element.prop("disabled"); 13711 13712 return options; 13713 }, 13714 13715 _parseOptions: function (options) { 13716 var that = this, 13717 data = []; 13718 options.each(function (index, item) { 13719 if (item.hidden) { 13720 return; 13721 } 13722 13723 data.push(that._parseOption($(item), index)); 13724 }); 13725 this.items = data; 13726 }, 13727 13728 _parseOption: function (option, index) { 13729 var optgroup = option.parent("optgroup"); 13730 13731 return { 13732 element: option, 13733 index: index, 13734 value: option.val(), 13735 label: option.text(), 13736 optgroup: optgroup.attr("label") || "", 13737 disabled: optgroup.prop("disabled") || option.prop("disabled") 13738 }; 13739 }, 13740 13741 _destroy: function () { 13742 this._unbindFormResetHandler(); 13743 this.menuWrap.remove(); 13744 this.button.remove(); 13745 this.element.show(); 13746 this.element.removeUniqueId(); 13747 this.labels.attr("for", this.ids.element); 13748 } 13749 }]); 13750 13751 13752 /*! 13753 * jQuery UI Slider 1.13.2 13754 * http://jqueryui.com 13755 * 13756 * Copyright jQuery Foundation and other contributors 13757 * Released under the MIT license. 13758 * http://jquery.org/license 13759 */ 13760 13761 //>>label: Slider 13762 //>>group: Widgets 13763 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 13764 //>>docs: http://api.jqueryui.com/slider/ 13765 //>>demos: http://jqueryui.com/slider/ 13766 //>>css.structure: ../../themes/base/core.css 13767 //>>css.structure: ../../themes/base/slider.css 13768 //>>css.theme: ../../themes/base/theme.css 13769 13770 13771 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 13772 version: "1.13.2", 13773 widgetEventPrefix: "slide", 13774 13775 options: { 13776 animate: false, 13777 classes: { 13778 "ui-slider": "ui-corner-all", 13779 "ui-slider-handle": "ui-corner-all", 13780 13781 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 13782 // element, but worked best visually with a variety of themes 13783 "ui-slider-range": "ui-corner-all ui-widget-header" 13784 }, 13785 distance: 0, 13786 max: 100, 13787 min: 0, 13788 orientation: "horizontal", 13789 range: false, 13790 step: 1, 13791 value: 0, 13792 values: null, 13793 13794 // Callbacks 13795 change: null, 13796 slide: null, 13797 start: null, 13798 stop: null 13799 }, 13800 13801 // Number of pages in a slider 13802 // (how many times can you page up/down to go through the whole range) 13803 numPages: 5, 13804 13805 _create: function () { 13806 this._keySliding = false; 13807 this._mouseSliding = false; 13808 this._animateOff = true; 13809 this._handleIndex = null; 13810 this._detectOrientation(); 13811 this._mouseInit(); 13812 this._calculateNewMax(); 13813 13814 this._addClass("ui-slider ui-slider-" + this.orientation, 13815 "ui-widget ui-widget-content"); 13816 13817 this._refresh(); 13818 13819 this._animateOff = false; 13820 }, 13821 13822 _refresh: function () { 13823 this._createRange(); 13824 this._createHandles(); 13825 this._setupEvents(); 13826 this._refreshValue(); 13827 }, 13828 13829 _createHandles: function () { 13830 var i, handleCount, 13831 options = this.options, 13832 existingHandles = this.element.find(".ui-slider-handle"), 13833 handle = "<span tabindex='0'></span>", 13834 handles = []; 13835 13836 handleCount = (options.values && options.values.length) || 1; 13837 13838 if (existingHandles.length > handleCount) { 13839 existingHandles.slice(handleCount).remove(); 13840 existingHandles = existingHandles.slice(0, handleCount); 13841 } 13842 13843 for (i = existingHandles.length; i < handleCount; i++) { 13844 handles.push(handle); 13845 } 13846 13847 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 13848 13849 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 13850 13851 this.handle = this.handles.eq(0); 13852 13853 this.handles.each(function (i) { 13854 $(this) 13855 .data("ui-slider-handle-index", i) 13856 .attr("tabIndex", 0); 13857 }); 13858 }, 13859 13860 _createRange: function () { 13861 var options = this.options; 13862 13863 if (options.range) { 13864 if (options.range === true) { 13865 if (!options.values) { 13866 options.values = [this._valueMin(), this._valueMin()];
vendor: 13,292 bytes, lines 13867-14353
13867 } else if (options.values.length && options.values.length !== 2) { 13868 options.values = [options.values[0], options.values[0]]; 13869 } else if (Array.isArray(options.values)) { 13870 options.values = options.values.slice(0); 13871 } 13872 } 13873 13874 if (!this.range || !this.range.length) { 13875 this.range = $("<div>") 13876 .appendTo(this.element); 13877 13878 this._addClass(this.range, "ui-slider-range"); 13879 } else { 13880 this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"); 13881 13882 // Handle range switching from true to min/max 13883 this.range.css({ 13884 "left": "", 13885 "bottom": "" 13886 }); 13887 } 13888 if (options.range === "min" || options.range === "max") { 13889 this._addClass(this.range, "ui-slider-range-" + options.range); 13890 } 13891 } else { 13892 if (this.range) { 13893 this.range.remove(); 13894 } 13895 this.range = null; 13896 } 13897 }, 13898 13899 _setupEvents: function () { 13900 this._off(this.handles); 13901 this._on(this.handles, this._handleEvents); 13902 this._hoverable(this.handles); 13903 this._focusable(this.handles); 13904 }, 13905 13906 _destroy: function () { 13907 this.handles.remove(); 13908 if (this.range) { 13909 this.range.remove(); 13910 } 13911 13912 this._mouseDestroy(); 13913 }, 13914 13915 _mouseCapture: function (event) { 13916 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 13917 that = this, 13918 o = this.options; 13919 13920 if (o.disabled) { 13921 return false; 13922 } 13923 13924 this.elementSize = { 13925 width: this.element.outerWidth(), 13926 height: this.element.outerHeight() 13927 }; 13928 this.elementOffset = this.element.offset(); 13929 13930 position = { x: event.pageX, y: event.pageY }; 13931 normValue = this._normValueFromMouse(position); 13932 distance = this._valueMax() - this._valueMin() + 1; 13933 this.handles.each(function (i) { 13934 var thisDistance = Math.abs(normValue - that.values(i)); 13935 if ((distance > thisDistance) || 13936 (distance === thisDistance && 13937 (i === that._lastChangedValue || that.values(i) === o.min))) { 13938 distance = thisDistance; 13939 closestHandle = $(this); 13940 index = i; 13941 } 13942 }); 13943 13944 allowed = this._start(event, index); 13945 if (allowed === false) { 13946 return false; 13947 } 13948 this._mouseSliding = true; 13949 13950 this._handleIndex = index; 13951 13952 this._addClass(closestHandle, null, "ui-state-active"); 13953 closestHandle.trigger("focus"); 13954 13955 offset = closestHandle.offset(); 13956 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 13957 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 13958 left: event.pageX - offset.left - (closestHandle.width() / 2), 13959 top: event.pageY - offset.top - 13960 (closestHandle.height() / 2) - 13961 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 13962 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 13963 (parseInt(closestHandle.css("marginTop"), 10) || 0) 13964 }; 13965 13966 if (!this.handles.hasClass("ui-state-hover")) { 13967 this._slide(event, index, normValue); 13968 } 13969 this._animateOff = true; 13970 return true; 13971 }, 13972 13973 _mouseStart: function () { 13974 return true; 13975 }, 13976 13977 _mouseDrag: function (event) { 13978 var position = { x: event.pageX, y: event.pageY }, 13979 normValue = this._normValueFromMouse(position); 13980 13981 this._slide(event, this._handleIndex, normValue); 13982 13983 return false; 13984 }, 13985 13986 _mouseStop: function (event) { 13987 this._removeClass(this.handles, null, "ui-state-active"); 13988 this._mouseSliding = false; 13989 13990 this._stop(event, this._handleIndex); 13991 this._change(event, this._handleIndex); 13992 13993 this._handleIndex = null; 13994 this._clickOffset = null; 13995 this._animateOff = false; 13996 13997 return false; 13998 }, 13999 14000 _detectOrientation: function () { 14001 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 14002 }, 14003 14004 _normValueFromMouse: function (position) { 14005 var pixelTotal, 14006 pixelMouse, 14007 percentMouse, 14008 valueTotal, 14009 valueMouse; 14010 14011 if (this.orientation === "horizontal") { 14012 pixelTotal = this.elementSize.width; 14013 pixelMouse = position.x - this.elementOffset.left - 14014 (this._clickOffset ? this._clickOffset.left : 0); 14015 } else { 14016 pixelTotal = this.elementSize.height; 14017 pixelMouse = position.y - this.elementOffset.top - 14018 (this._clickOffset ? this._clickOffset.top : 0); 14019 } 14020 14021 percentMouse = (pixelMouse / pixelTotal); 14022 if (percentMouse > 1) { 14023 percentMouse = 1; 14024 } 14025 if (percentMouse < 0) { 14026 percentMouse = 0; 14027 } 14028 if (this.orientation === "vertical") { 14029 percentMouse = 1 - percentMouse; 14030 } 14031 14032 valueTotal = this._valueMax() - this._valueMin(); 14033 valueMouse = this._valueMin() + percentMouse * valueTotal; 14034 14035 return this._trimAlignValue(valueMouse); 14036 }, 14037 14038 _uiHash: function (index, value, values) { 14039 var uiHash = { 14040 handle: this.handles[index], 14041 handleIndex: index, 14042 value: value !== undefined ? value : this.value() 14043 }; 14044 14045 if (this._hasMultipleValues()) { 14046 uiHash.value = value !== undefined ? value : this.values(index); 14047 uiHash.values = values || this.values(); 14048 } 14049 14050 return uiHash; 14051 }, 14052 14053 _hasMultipleValues: function () { 14054 return this.options.values && this.options.values.length; 14055 }, 14056 14057 _start: function (event, index) { 14058 return this._trigger("start", event, this._uiHash(index)); 14059 }, 14060 14061 _slide: function (event, index, newVal) { 14062 var allowed, otherVal, 14063 currentValue = this.value(), 14064 newValues = this.values(); 14065 14066 if (this._hasMultipleValues()) { 14067 otherVal = this.values(index ? 0 : 1); 14068 currentValue = this.values(index); 14069 14070 if (this.options.values.length === 2 && this.options.range === true) { 14071 newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal); 14072 } 14073 14074 newValues[index] = newVal; 14075 } 14076 14077 if (newVal === currentValue) { 14078 return; 14079 } 14080 14081 allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); 14082 14083 // A slide can be canceled by returning false from the slide callback 14084 if (allowed === false) { 14085 return; 14086 } 14087 14088 if (this._hasMultipleValues()) { 14089 this.values(index, newVal); 14090 } else { 14091 this.value(newVal); 14092 } 14093 }, 14094 14095 _stop: function (event, index) { 14096 this._trigger("stop", event, this._uiHash(index)); 14097 }, 14098 14099 _change: function (event, index) { 14100 if (!this._keySliding && !this._mouseSliding) { 14101 14102 //store the last changed value index for reference when handles overlap 14103 this._lastChangedValue = index; 14104 this._trigger("change", event, this._uiHash(index)); 14105 } 14106 }, 14107 14108 value: function (newValue) { 14109 if (arguments.length) { 14110 this.options.value = this._trimAlignValue(newValue); 14111 this._refreshValue(); 14112 this._change(null, 0); 14113 return; 14114 } 14115 14116 return this._value(); 14117 }, 14118 14119 values: function (index, newValue) { 14120 var vals, 14121 newValues, 14122 i; 14123 14124 if (arguments.length > 1) { 14125 this.options.values[index] = this._trimAlignValue(newValue); 14126 this._refreshValue(); 14127 this._change(null, index); 14128 return; 14129 } 14130 14131 if (arguments.length) { 14132 if (Array.isArray(arguments[0])) { 14133 vals = this.options.values; 14134 newValues = arguments[0]; 14135 for (i = 0; i < vals.length; i += 1) { 14136 vals[i] = this._trimAlignValue(newValues[i]); 14137 this._change(null, i); 14138 } 14139 this._refreshValue(); 14140 } else { 14141 if (this._hasMultipleValues()) { 14142 return this._values(index); 14143 } else { 14144 return this.value(); 14145 } 14146 } 14147 } else { 14148 return this._values(); 14149 } 14150 }, 14151 14152 _setOption: function (key, value) { 14153 var i, 14154 valsLength = 0; 14155 14156 if (key === "range" && this.options.range === true) { 14157 if (value === "min") { 14158 this.options.value = this._values(0); 14159 this.options.values = null; 14160 } else if (value === "max") { 14161 this.options.value = this._values(this.options.values.length - 1); 14162 this.options.values = null; 14163 } 14164 } 14165 14166 if (Array.isArray(this.options.values)) { 14167 valsLength = this.options.values.length; 14168 } 14169 14170 this._super(key, value); 14171 14172 switch (key) { 14173 case "orientation": 14174 this._detectOrientation(); 14175 this._removeClass("ui-slider-horizontal ui-slider-vertical") 14176 ._addClass("ui-slider-" + this.orientation); 14177 this._refreshValue(); 14178 if (this.options.range) { 14179 this._refreshRange(value); 14180 } 14181 14182 // Reset positioning from previous orientation 14183 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 14184 break; 14185 case "value": 14186 this._animateOff = true; 14187 this._refreshValue(); 14188 this._change(null, 0); 14189 this._animateOff = false; 14190 break; 14191 case "values": 14192 this._animateOff = true; 14193 this._refreshValue(); 14194 14195 // Start from the last handle to prevent unreachable handles (#9046) 14196 for (i = valsLength - 1; i >= 0; i--) { 14197 this._change(null, i); 14198 } 14199 this._animateOff = false; 14200 break; 14201 case "step": 14202 case "min": 14203 case "max": 14204 this._animateOff = true; 14205 this._calculateNewMax(); 14206 this._refreshValue(); 14207 this._animateOff = false; 14208 break; 14209 case "range": 14210 this._animateOff = true; 14211 this._refresh(); 14212 this._animateOff = false; 14213 break; 14214 } 14215 }, 14216 14217 _setOptionDisabled: function (value) { 14218 this._super(value); 14219 14220 this._toggleClass(null, "ui-state-disabled", !!value); 14221 }, 14222 14223 //internal value getter 14224 // _value() returns value trimmed by min and max, aligned by step 14225 _value: function () { 14226 var val = this.options.value; 14227 val = this._trimAlignValue(val); 14228 14229 return val; 14230 }, 14231 14232 //internal values getter 14233 // _values() returns array of values trimmed by min and max, aligned by step 14234 // _values( index ) returns single value trimmed by min and max, aligned by step 14235 _values: function (index) { 14236 var val, 14237 vals, 14238 i; 14239 14240 if (arguments.length) { 14241 val = this.options.values[index]; 14242 val = this._trimAlignValue(val); 14243 14244 return val; 14245 } else if (this._hasMultipleValues()) { 14246 14247 // .slice() creates a copy of the array 14248 // this copy gets trimmed by min and max and then returned 14249 vals = this.options.values.slice(); 14250 for (i = 0; i < vals.length; i += 1) { 14251 vals[i] = this._trimAlignValue(vals[i]); 14252 } 14253 14254 return vals; 14255 } else { 14256 return []; 14257 } 14258 }, 14259 14260 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 14261 _trimAlignValue: function (val) { 14262 if (val <= this._valueMin()) { 14263 return this._valueMin(); 14264 } 14265 if (val >= this._valueMax()) { 14266 return this._valueMax(); 14267 } 14268 var step = (this.options.step > 0) ? this.options.step : 1, 14269 valModStep = (val - this._valueMin()) % step, 14270 alignValue = val - valModStep; 14271 14272 if (Math.abs(valModStep) * 2 >= step) { 14273 alignValue += (valModStep > 0) ? step : (-step); 14274 } 14275 14276 // Since JavaScript has problems with large floats, round 14277 // the final value to 5 digits after the decimal point (see #4124) 14278 return parseFloat(alignValue.toFixed(5)); 14279 }, 14280 14281 _calculateNewMax: function () { 14282 var max = this.options.max, 14283 min = this._valueMin(), 14284 step = this.options.step, 14285 aboveMin = Math.round((max - min) / step) * step; 14286 max = aboveMin + min; 14287 if (max > this.options.max) { 14288 14289 //If max is not divisible by step, rounding off may increase its value 14290 max -= step; 14291 } 14292 this.max = parseFloat(max.toFixed(this._precision())); 14293 }, 14294 14295 _precision: function () { 14296 var precision = this._precisionOf(this.options.step); 14297 if (this.options.min !== null) { 14298 precision = Math.max(precision, this._precisionOf(this.options.min)); 14299 } 14300 return precision; 14301 }, 14302 14303 _precisionOf: function (num) { 14304 var str = num.toString(), 14305 decimal = str.indexOf("."); 14306 return decimal === -1 ? 0 : str.length - decimal - 1; 14307 }, 14308 14309 _valueMin: function () { 14310 return this.options.min; 14311 }, 14312 14313 _valueMax: function () { 14314 return this.max; 14315 }, 14316 14317 _refreshRange: function (orientation) { 14318 if (orientation === "vertical") { 14319 this.range.css({ "width": "", "left": "" }); 14320 } 14321 if (orientation === "horizontal") { 14322 this.range.css({ "height": "", "bottom": "" }); 14323 } 14324 }, 14325 14326 _refreshValue: function () { 14327 var lastValPercent, valPercent, value, valueMin, valueMax, 14328 oRange = this.options.range, 14329 o = this.options, 14330 that = this, 14331 animate = (!this._animateOff) ? o.animate : false, 14332 _set = {}; 14333 14334 if (this._hasMultipleValues()) { 14335 this.handles.each(function (i) { 14336 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - 14337 that._valueMin()) * 100; 14338 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14339 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14340 if (that.options.range === true) { 14341 if (that.orientation === "horizontal") { 14342 if (i === 0) { 14343 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14344 left: valPercent + "%" 14345 }, o.animate); 14346 } 14347 if (i === 1) { 14348 that.range[animate ? "animate" : "css"]({ 14349 width: (valPercent - lastValPercent) + "%" 14350 }, { 14351 queue: false, 14352 duration: o.animate 14353 });
vendor: 4,498 bytes, lines 14354-14510
14354 } 14355 } else { 14356 if (i === 0) { 14357 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14358 bottom: (valPercent) + "%" 14359 }, o.animate); 14360 } 14361 if (i === 1) { 14362 that.range[animate ? "animate" : "css"]({ 14363 height: (valPercent - lastValPercent) + "%" 14364 }, { 14365 queue: false, 14366 duration: o.animate 14367 }); 14368 } 14369 } 14370 } 14371 lastValPercent = valPercent; 14372 }); 14373 } else { 14374 value = this.value(); 14375 valueMin = this._valueMin(); 14376 valueMax = this._valueMax(); 14377 valPercent = (valueMax !== valueMin) ? 14378 (value - valueMin) / (valueMax - valueMin) * 100 : 14379 0; 14380 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14381 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14382 14383 if (oRange === "min" && this.orientation === "horizontal") { 14384 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14385 width: valPercent + "%" 14386 }, o.animate); 14387 } 14388 if (oRange === "max" && this.orientation === "horizontal") { 14389 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14390 width: (100 - valPercent) + "%" 14391 }, o.animate); 14392 } 14393 if (oRange === "min" && this.orientation === "vertical") { 14394 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14395 height: valPercent + "%" 14396 }, o.animate); 14397 } 14398 if (oRange === "max" && this.orientation === "vertical") { 14399 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14400 height: (100 - valPercent) + "%" 14401 }, o.animate); 14402 } 14403 } 14404 }, 14405 14406 _handleEvents: { 14407 keydown: function (event) { 14408 var allowed, curVal, newVal, step, 14409 index = $(event.target).data("ui-slider-handle-index"); 14410 14411 switch (event.keyCode) { 14412 case $.ui.keyCode.HOME: 14413 case $.ui.keyCode.END: 14414 case $.ui.keyCode.PAGE_UP: 14415 case $.ui.keyCode.PAGE_DOWN: 14416 case $.ui.keyCode.UP: 14417 case $.ui.keyCode.RIGHT: 14418 case $.ui.keyCode.DOWN: 14419 case $.ui.keyCode.LEFT: 14420 event.preventDefault(); 14421 if (!this._keySliding) { 14422 this._keySliding = true; 14423 this._addClass($(event.target), null, "ui-state-active"); 14424 allowed = this._start(event, index); 14425 if (allowed === false) { 14426 return; 14427 } 14428 } 14429 break; 14430 } 14431 14432 step = this.options.step; 14433 if (this._hasMultipleValues()) { 14434 curVal = newVal = this.values(index); 14435 } else { 14436 curVal = newVal = this.value(); 14437 } 14438 14439 switch (event.keyCode) { 14440 case $.ui.keyCode.HOME: 14441 newVal = this._valueMin(); 14442 break; 14443 case $.ui.keyCode.END: 14444 newVal = this._valueMax(); 14445 break; 14446 case $.ui.keyCode.PAGE_UP: 14447 newVal = this._trimAlignValue( 14448 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 14449 ); 14450 break; 14451 case $.ui.keyCode.PAGE_DOWN: 14452 newVal = this._trimAlignValue( 14453 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 14454 break; 14455 case $.ui.keyCode.UP: 14456 case $.ui.keyCode.RIGHT: 14457 if (curVal === this._valueMax()) { 14458 return; 14459 } 14460 newVal = this._trimAlignValue(curVal + step); 14461 break; 14462 case $.ui.keyCode.DOWN: 14463 case $.ui.keyCode.LEFT: 14464 if (curVal === this._valueMin()) { 14465 return; 14466 } 14467 newVal = this._trimAlignValue(curVal - step); 14468 break; 14469 } 14470 14471 this._slide(event, index, newVal); 14472 }, 14473 keyup: function (event) { 14474 var index = $(event.target).data("ui-slider-handle-index"); 14475 14476 if (this._keySliding) { 14477 this._keySliding = false; 14478 this._stop(event, index); 14479 this._change(event, index); 14480 this._removeClass($(event.target), null, "ui-state-active"); 14481 } 14482 } 14483 } 14484 }); 14485 14486 14487 /*! 14488 * jQuery UI Spinner 1.13.2 14489 * http://jqueryui.com 14490 * 14491 * Copyright jQuery Foundation and other contributors 14492 * Released under the MIT license. 14493 * http://jquery.org/license 14494 */ 14495 14496 //>>label: Spinner 14497 //>>group: Widgets 14498 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 14499 //>>docs: http://api.jqueryui.com/spinner/ 14500 //>>demos: http://jqueryui.com/spinner/ 14501 //>>css.structure: ../../themes/base/core.css 14502 //>>css.structure: ../../themes/base/spinner.css 14503 //>>css.theme: ../../themes/base/theme.css 14504 14505 14506 function spinnerModifier(fn) { 14507 return function () { 14508 var previous = this.element.val(); 14509 fn.apply(this, arguments); 14510 this._refresh();
vendor: 26,389 bytes, lines 14511-15497
14511 if (previous !== this.element.val()) { 14512 this._trigger("change"); 14513 } 14514 }; 14515 } 14516 14517 $.widget("ui.spinner", { 14518 version: "1.13.2", 14519 defaultElement: "<input>", 14520 widgetEventPrefix: "spin", 14521 options: { 14522 classes: { 14523 "ui-spinner": "ui-corner-all", 14524 "ui-spinner-down": "ui-corner-br", 14525 "ui-spinner-up": "ui-corner-tr" 14526 }, 14527 culture: null, 14528 icons: { 14529 down: "ui-icon-triangle-1-s", 14530 up: "ui-icon-triangle-1-n" 14531 }, 14532 incremental: true, 14533 max: null, 14534 min: null, 14535 numberFormat: null, 14536 page: 10, 14537 step: 1, 14538 14539 change: null, 14540 spin: null, 14541 start: null, 14542 stop: null 14543 }, 14544 14545 _create: function () { 14546 14547 // handle string values that need to be parsed 14548 this._setOption("max", this.options.max); 14549 this._setOption("min", this.options.min); 14550 this._setOption("step", this.options.step); 14551 14552 // Only format if there is a value, prevents the field from being marked 14553 // as invalid in Firefox, see #9573. 14554 if (this.value() !== "") { 14555 14556 // Format the value, but don't constrain. 14557 this._value(this.element.val(), true); 14558 } 14559 14560 this._draw(); 14561 this._on(this._events); 14562 this._refresh(); 14563 14564 // Turning off autocomplete prevents the browser from remembering the 14565 // value when navigating through history, so we re-enable autocomplete 14566 // if the page is unloaded before the widget is destroyed. #7790 14567 this._on(this.window, { 14568 beforeunload: function () { 14569 this.element.removeAttr("autocomplete"); 14570 } 14571 }); 14572 }, 14573 14574 _getCreateOptions: function () { 14575 var options = this._super(); 14576 var element = this.element; 14577 14578 $.each(["min", "max", "step"], function (i, option) { 14579 var value = element.attr(option); 14580 if (value != null && value.length) { 14581 options[option] = value; 14582 } 14583 }); 14584 14585 return options; 14586 }, 14587 14588 _events: { 14589 keydown: function (event) { 14590 if (this._start(event) && this._keydown(event)) { 14591 event.preventDefault(); 14592 } 14593 }, 14594 keyup: "_stop", 14595 focus: function () { 14596 this.previous = this.element.val(); 14597 }, 14598 blur: function (event) { 14599 if (this.cancelBlur) { 14600 delete this.cancelBlur; 14601 return; 14602 } 14603 14604 this._stop(); 14605 this._refresh(); 14606 if (this.previous !== this.element.val()) { 14607 this._trigger("change", event); 14608 } 14609 }, 14610 mousewheel: function (event, delta) { 14611 var activeElement = $.ui.safeActiveElement(this.document[0]); 14612 var isActive = this.element[0] === activeElement; 14613 14614 if (!isActive || !delta) { 14615 return; 14616 } 14617 14618 if (!this.spinning && !this._start(event)) { 14619 return false; 14620 } 14621 14622 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 14623 clearTimeout(this.mousewheelTimer); 14624 this.mousewheelTimer = this._delay(function () { 14625 if (this.spinning) { 14626 this._stop(event); 14627 } 14628 }, 100); 14629 event.preventDefault(); 14630 }, 14631 "mousedown .ui-spinner-button": function (event) { 14632 var previous; 14633 14634 // We never want the buttons to have focus; whenever the user is 14635 // interacting with the spinner, the focus should be on the input. 14636 // If the input is focused then this.previous is properly set from 14637 // when the input first received focus. If the input is not focused 14638 // then we need to set this.previous based on the value before spinning. 14639 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 14640 this.previous : this.element.val(); 14641 function checkFocus() { 14642 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 14643 if (!isActive) { 14644 this.element.trigger("focus"); 14645 this.previous = previous; 14646 14647 // support: IE 14648 // IE sets focus asynchronously, so we need to check if focus 14649 // moved off of the input because the user clicked on the button. 14650 this._delay(function () { 14651 this.previous = previous; 14652 }); 14653 } 14654 } 14655 14656 // Ensure focus is on (or stays on) the text field 14657 event.preventDefault(); 14658 checkFocus.call(this); 14659 14660 // Support: IE 14661 // IE doesn't prevent moving focus even with event.preventDefault() 14662 // so we set a flag to know when we should ignore the blur event 14663 // and check (again) if focus moved off of the input. 14664 this.cancelBlur = true; 14665 this._delay(function () { 14666 delete this.cancelBlur; 14667 checkFocus.call(this); 14668 }); 14669 14670 if (this._start(event) === false) { 14671 return; 14672 } 14673 14674 this._repeat(null, $(event.currentTarget) 14675 .hasClass("ui-spinner-up") ? 1 : -1, event); 14676 }, 14677 "mouseup .ui-spinner-button": "_stop", 14678 "mouseenter .ui-spinner-button": function (event) { 14679 14680 // button will add ui-state-active if mouse was down while mouseleave and kept down 14681 if (!$(event.currentTarget).hasClass("ui-state-active")) { 14682 return; 14683 } 14684 14685 if (this._start(event) === false) { 14686 return false; 14687 } 14688 this._repeat(null, $(event.currentTarget) 14689 .hasClass("ui-spinner-up") ? 1 : -1, event); 14690 }, 14691 14692 // TODO: do we really want to consider this a stop? 14693 // shouldn't we just stop the repeater and wait until mouseup before 14694 // we trigger the stop event? 14695 "mouseleave .ui-spinner-button": "_stop" 14696 }, 14697 14698 // Support mobile enhanced option and make backcompat more sane 14699 _enhance: function () { 14700 this.uiSpinner = this.element 14701 .attr("autocomplete", "off") 14702 .wrap("<span>") 14703 .parent() 14704 14705 // Add buttons 14706 .append( 14707 "<a></a><a></a>" 14708 ); 14709 }, 14710 14711 _draw: function () { 14712 this._enhance(); 14713 14714 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 14715 this._addClass("ui-spinner-input"); 14716 14717 this.element.attr("role", "spinbutton"); 14718 14719 // Button bindings 14720 this.buttons = this.uiSpinner.children("a") 14721 .attr("tabIndex", -1) 14722 .attr("aria-hidden", true) 14723 .button({ 14724 classes: { 14725 "ui-button": "" 14726 } 14727 }); 14728 14729 // TODO: Right now button does not support classes this is already updated in button PR 14730 this._removeClass(this.buttons, "ui-corner-all"); 14731 14732 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 14733 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 14734 this.buttons.first().button({ 14735 "icon": this.options.icons.up, 14736 "showLabel": false 14737 }); 14738 this.buttons.last().button({ 14739 "icon": this.options.icons.down, 14740 "showLabel": false 14741 }); 14742 14743 // IE 6 doesn't understand height: 50% for the buttons 14744 // unless the wrapper has an explicit height 14745 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 14746 this.uiSpinner.height() > 0) { 14747 this.uiSpinner.height(this.uiSpinner.height()); 14748 } 14749 }, 14750 14751 _keydown: function (event) { 14752 var options = this.options, 14753 keyCode = $.ui.keyCode; 14754 14755 switch (event.keyCode) { 14756 case keyCode.UP: 14757 this._repeat(null, 1, event); 14758 return true; 14759 case keyCode.DOWN: 14760 this._repeat(null, -1, event); 14761 return true; 14762 case keyCode.PAGE_UP: 14763 this._repeat(null, options.page, event); 14764 return true; 14765 case keyCode.PAGE_DOWN: 14766 this._repeat(null, -options.page, event); 14767 return true; 14768 } 14769 14770 return false; 14771 }, 14772 14773 _start: function (event) { 14774 if (!this.spinning && this._trigger("start", event) === false) { 14775 return false; 14776 } 14777 14778 if (!this.counter) { 14779 this.counter = 1; 14780 } 14781 this.spinning = true; 14782 return true; 14783 }, 14784 14785 _repeat: function (i, steps, event) { 14786 i = i || 500; 14787 14788 clearTimeout(this.timer); 14789 this.timer = this._delay(function () { 14790 this._repeat(40, steps, event); 14791 }, i); 14792 14793 this._spin(steps * this.options.step, event); 14794 }, 14795 14796 _spin: function (step, event) { 14797 var value = this.value() || 0; 14798 14799 if (!this.counter) { 14800 this.counter = 1; 14801 } 14802 14803 value = this._adjustValue(value + step * this._increment(this.counter)); 14804 14805 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 14806 this._value(value); 14807 this.counter++; 14808 } 14809 }, 14810 14811 _increment: function (i) { 14812 var incremental = this.options.incremental; 14813 14814 if (incremental) { 14815 return typeof incremental === "function" ? 14816 incremental(i) : 14817 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 14818 } 14819 14820 return 1; 14821 }, 14822 14823 _precision: function () { 14824 var precision = this._precisionOf(this.options.step); 14825 if (this.options.min !== null) { 14826 precision = Math.max(precision, this._precisionOf(this.options.min)); 14827 } 14828 return precision; 14829 }, 14830 14831 _precisionOf: function (num) { 14832 var str = num.toString(), 14833 decimal = str.indexOf("."); 14834 return decimal === -1 ? 0 : str.length - decimal - 1; 14835 }, 14836 14837 _adjustValue: function (value) { 14838 var base, aboveMin, 14839 options = this.options; 14840 14841 // Make sure we're at a valid step 14842 // - find out where we are relative to the base (min or 0) 14843 base = options.min !== null ? options.min : 0; 14844 aboveMin = value - base; 14845 14846 // - round to the nearest step 14847 aboveMin = Math.round(aboveMin / options.step) * options.step; 14848 14849 // - rounding is based on 0, so adjust back to our base 14850 value = base + aboveMin; 14851 14852 // Fix precision from bad JS floating point math 14853 value = parseFloat(value.toFixed(this._precision())); 14854 14855 // Clamp the value 14856 if (options.max !== null && value > options.max) { 14857 return options.max; 14858 } 14859 if (options.min !== null && value < options.min) { 14860 return options.min; 14861 } 14862 14863 return value; 14864 }, 14865 14866 _stop: function (event) { 14867 if (!this.spinning) { 14868 return; 14869 } 14870 14871 clearTimeout(this.timer); 14872 clearTimeout(this.mousewheelTimer); 14873 this.counter = 0; 14874 this.spinning = false; 14875 this._trigger("stop", event); 14876 }, 14877 14878 _setOption: function (key, value) { 14879 var prevValue, first, last; 14880 14881 if (key === "culture" || key === "numberFormat") { 14882 prevValue = this._parse(this.element.val()); 14883 this.options[key] = value; 14884 this.element.val(this._format(prevValue)); 14885 return; 14886 } 14887 14888 if (key === "max" || key === "min" || key === "step") { 14889 if (typeof value === "string") { 14890 value = this._parse(value); 14891 } 14892 } 14893 if (key === "icons") { 14894 first = this.buttons.first().find(".ui-icon"); 14895 this._removeClass(first, null, this.options.icons.up); 14896 this._addClass(first, null, value.up); 14897 last = this.buttons.last().find(".ui-icon"); 14898 this._removeClass(last, null, this.options.icons.down); 14899 this._addClass(last, null, value.down); 14900 } 14901 14902 this._super(key, value); 14903 }, 14904 14905 _setOptionDisabled: function (value) { 14906 this._super(value); 14907 14908 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 14909 this.element.prop("disabled", !!value); 14910 this.buttons.button(value ? "disable" : "enable"); 14911 }, 14912 14913 _setOptions: spinnerModifier(function (options) { 14914 this._super(options); 14915 }), 14916 14917 _parse: function (val) { 14918 if (typeof val === "string" && val !== "") { 14919 val = window.Globalize && this.options.numberFormat ? 14920 Globalize.parseFloat(val, 10, this.options.culture) : +val; 14921 } 14922 return val === "" || isNaN(val) ? null : val; 14923 }, 14924 14925 _format: function (value) { 14926 if (value === "") { 14927 return ""; 14928 } 14929 return window.Globalize && this.options.numberFormat ? 14930 Globalize.format(value, this.options.numberFormat, this.options.culture) : 14931 value; 14932 }, 14933 14934 _refresh: function () { 14935 this.element.attr({ 14936 "aria-valuemin": this.options.min, 14937 "aria-valuemax": this.options.max, 14938 14939 // TODO: what should we do with values that can't be parsed? 14940 "aria-valuenow": this._parse(this.element.val()) 14941 }); 14942 }, 14943 14944 isValid: function () { 14945 var value = this.value(); 14946 14947 // Null is invalid 14948 if (value === null) { 14949 return false; 14950 } 14951 14952 // If value gets adjusted, it's invalid 14953 return value === this._adjustValue(value); 14954 }, 14955 14956 // Update the value without triggering change 14957 _value: function (value, allowAny) { 14958 var parsed; 14959 if (value !== "") { 14960 parsed = this._parse(value); 14961 if (parsed !== null) { 14962 if (!allowAny) { 14963 parsed = this._adjustValue(parsed); 14964 } 14965 value = this._format(parsed); 14966 } 14967 } 14968 this.element.val(value); 14969 this._refresh(); 14970 }, 14971 14972 _destroy: function () { 14973 this.element 14974 .prop("disabled", false) 14975 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 14976 14977 this.uiSpinner.replaceWith(this.element); 14978 }, 14979 14980 stepUp: spinnerModifier(function (steps) { 14981 this._stepUp(steps); 14982 }), 14983 _stepUp: function (steps) { 14984 if (this._start()) { 14985 this._spin((steps || 1) * this.options.step); 14986 this._stop(); 14987 } 14988 }, 14989 14990 stepDown: spinnerModifier(function (steps) { 14991 this._stepDown(steps); 14992 }), 14993 _stepDown: function (steps) { 14994 if (this._start()) { 14995 this._spin((steps || 1) * -this.options.step); 14996 this._stop(); 14997 } 14998 }, 14999 15000 pageUp: spinnerModifier(function (pages) { 15001 this._stepUp((pages || 1) * this.options.page); 15002 }), 15003 15004 pageDown: spinnerModifier(function (pages) { 15005 this._stepDown((pages || 1) * this.options.page); 15006 }), 15007 15008 value: function (newVal) { 15009 if (!arguments.length) { 15010 return this._parse(this.element.val()); 15011 } 15012 spinnerModifier(this._value).call(this, newVal); 15013 }, 15014 15015 widget: function () { 15016 return this.uiSpinner; 15017 } 15018 }); 15019 15020 // DEPRECATED 15021 // TODO: switch return back to widget declaration at top of file when this is removed 15022 if ($.uiBackCompat !== false) { 15023 15024 // Backcompat for spinner html extension points 15025 $.widget("ui.spinner", $.ui.spinner, { 15026 _enhance: function () { 15027 this.uiSpinner = this.element 15028 .attr("autocomplete", "off") 15029 .wrap(this._uiSpinnerHtml()) 15030 .parent() 15031 15032 // Add buttons 15033 .append(this._buttonHtml()); 15034 }, 15035 _uiSpinnerHtml: function () { 15036 return "<span>"; 15037 }, 15038 15039 _buttonHtml: function () { 15040 return "<a></a><a></a>"; 15041 } 15042 }); 15043 } 15044 15045 var widgetsSpinner = $.ui.spinner; 15046 15047 15048 /*! 15049 * jQuery UI Tabs 1.13.2 15050 * http://jqueryui.com 15051 * 15052 * Copyright jQuery Foundation and other contributors 15053 * Released under the MIT license. 15054 * http://jquery.org/license 15055 */ 15056 15057 //>>label: Tabs 15058 //>>group: Widgets 15059 //>>description: Transforms a set of container elements into a tab structure. 15060 //>>docs: http://api.jqueryui.com/tabs/ 15061 //>>demos: http://jqueryui.com/tabs/ 15062 //>>css.structure: ../../themes/base/core.css 15063 //>>css.structure: ../../themes/base/tabs.css 15064 //>>css.theme: ../../themes/base/theme.css 15065 15066 15067 $.widget("ui.tabs", { 15068 version: "1.13.2", 15069 delay: 300, 15070 options: { 15071 active: null, 15072 classes: { 15073 "ui-tabs": "ui-corner-all", 15074 "ui-tabs-nav": "ui-corner-all", 15075 "ui-tabs-panel": "ui-corner-bottom", 15076 "ui-tabs-tab": "ui-corner-top" 15077 }, 15078 collapsible: false, 15079 event: "click", 15080 heightStyle: "content", 15081 hide: null, 15082 show: null, 15083 15084 // Callbacks 15085 activate: null, 15086 beforeActivate: null, 15087 beforeLoad: null, 15088 load: null 15089 }, 15090 15091 _isLocal: (function () { 15092 var rhash = /#.*$/; 15093 15094 return function (anchor) { 15095 var anchorUrl, locationUrl; 15096 15097 anchorUrl = anchor.href.replace(rhash, ""); 15098 locationUrl = location.href.replace(rhash, ""); 15099 15100 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 15101 try { 15102 anchorUrl = decodeURIComponent(anchorUrl); 15103 } catch (error) { } 15104 try { 15105 locationUrl = decodeURIComponent(locationUrl); 15106 } catch (error) { } 15107 15108 return anchor.hash.length > 1 && anchorUrl === locationUrl; 15109 }; 15110 })(), 15111 15112 _create: function () { 15113 var that = this, 15114 options = this.options; 15115 15116 this.running = false; 15117 15118 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 15119 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 15120 15121 this._processTabs(); 15122 options.active = this._initialActive(); 15123 15124 // Take disabling tabs via class attribute from HTML 15125 // into account and update option properly. 15126 if (Array.isArray(options.disabled)) { 15127 options.disabled = $.uniqueSort(options.disabled.concat( 15128 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 15129 return that.tabs.index(li); 15130 }) 15131 )).sort(); 15132 } 15133 15134 // Check for length avoids error when initializing empty list 15135 if (this.options.active !== false && this.anchors.length) { 15136 this.active = this._findActive(options.active); 15137 } else { 15138 this.active = $(); 15139 } 15140 15141 this._refresh(); 15142 15143 if (this.active.length) { 15144 this.load(options.active); 15145 } 15146 }, 15147 15148 _initialActive: function () { 15149 var active = this.options.active, 15150 collapsible = this.options.collapsible, 15151 locationHash = location.hash.substring(1); 15152 15153 if (active === null) { 15154 15155 // check the fragment identifier in the URL 15156 if (locationHash) { 15157 this.tabs.each(function (i, tab) { 15158 if ($(tab).attr("aria-controls") === locationHash) { 15159 active = i; 15160 return false; 15161 } 15162 }); 15163 } 15164 15165 // Check for a tab marked active via a class 15166 if (active === null) { 15167 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 15168 } 15169 15170 // No active tab, set to false 15171 if (active === null || active === -1) { 15172 active = this.tabs.length ? 0 : false; 15173 } 15174 } 15175 15176 // Handle numbers: negative, out of range 15177 if (active !== false) { 15178 active = this.tabs.index(this.tabs.eq(active)); 15179 if (active === -1) { 15180 active = collapsible ? false : 0; 15181 } 15182 } 15183 15184 // Don't allow collapsible: false and active: false 15185 if (!collapsible && active === false && this.anchors.length) { 15186 active = 0; 15187 } 15188 15189 return active; 15190 }, 15191 15192 _getCreateEventData: function () { 15193 return { 15194 tab: this.active, 15195 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 15196 }; 15197 }, 15198 15199 _tabKeydown: function (event) { 15200 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 15201 selectedIndex = this.tabs.index(focusedTab), 15202 goingForward = true; 15203 15204 if (this._handlePageNav(event)) { 15205 return; 15206 } 15207 15208 switch (event.keyCode) { 15209 case $.ui.keyCode.RIGHT: 15210 case $.ui.keyCode.DOWN: 15211 selectedIndex++; 15212 break; 15213 case $.ui.keyCode.UP: 15214 case $.ui.keyCode.LEFT: 15215 goingForward = false; 15216 selectedIndex--; 15217 break; 15218 case $.ui.keyCode.END: 15219 selectedIndex = this.anchors.length - 1; 15220 break; 15221 case $.ui.keyCode.HOME: 15222 selectedIndex = 0; 15223 break; 15224 case $.ui.keyCode.SPACE: 15225 15226 // Activate only, no collapsing 15227 event.preventDefault(); 15228 clearTimeout(this.activating); 15229 this._activate(selectedIndex); 15230 return; 15231 case $.ui.keyCode.ENTER: 15232 15233 // Toggle (cancel delayed activation, allow collapsing) 15234 event.preventDefault(); 15235 clearTimeout(this.activating); 15236 15237 // Determine if we should collapse or activate 15238 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 15239 return; 15240 default: 15241 return; 15242 } 15243 15244 // Focus the appropriate tab, based on which key was pressed 15245 event.preventDefault(); 15246 clearTimeout(this.activating); 15247 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 15248 15249 // Navigating with control/command key will prevent automatic activation 15250 if (!event.ctrlKey && !event.metaKey) { 15251 15252 // Update aria-selected immediately so that AT think the tab is already selected. 15253 // Otherwise AT may confuse the user by stating that they need to activate the tab, 15254 // but the tab will already be activated by the time the announcement finishes. 15255 focusedTab.attr("aria-selected", "false"); 15256 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 15257 15258 this.activating = this._delay(function () { 15259 this.option("active", selectedIndex); 15260 }, this.delay); 15261 } 15262 }, 15263 15264 _panelKeydown: function (event) { 15265 if (this._handlePageNav(event)) { 15266 return; 15267 } 15268 15269 // Ctrl+up moves focus to the current tab 15270 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 15271 event.preventDefault(); 15272 this.active.trigger("focus"); 15273 } 15274 }, 15275 15276 // Alt+page up/down moves focus to the previous/next tab (and activates) 15277 _handlePageNav: function (event) { 15278 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 15279 this._activate(this._focusNextTab(this.options.active - 1, false)); 15280 return true; 15281 } 15282 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 15283 this._activate(this._focusNextTab(this.options.active + 1, true)); 15284 return true; 15285 } 15286 }, 15287 15288 _findNextTab: function (index, goingForward) { 15289 var lastTabIndex = this.tabs.length - 1; 15290 15291 function constrain() { 15292 if (index > lastTabIndex) { 15293 index = 0; 15294 } 15295 if (index < 0) { 15296 index = lastTabIndex; 15297 } 15298 return index; 15299 } 15300 15301 while ($.inArray(constrain(), this.options.disabled) !== -1) { 15302 index = goingForward ? index + 1 : index - 1; 15303 } 15304 15305 return index; 15306 }, 15307 15308 _focusNextTab: function (index, goingForward) { 15309 index = this._findNextTab(index, goingForward); 15310 this.tabs.eq(index).trigger("focus"); 15311 return index; 15312 }, 15313 15314 _setOption: function (key, value) { 15315 if (key === "active") { 15316 15317 // _activate() will handle invalid values and update this.options 15318 this._activate(value); 15319 return; 15320 } 15321 15322 this._super(key, value); 15323 15324 if (key === "collapsible") { 15325 this._toggleClass("ui-tabs-collapsible", null, value); 15326 15327 // Setting collapsible: false while collapsed; open first panel 15328 if (!value && this.options.active === false) { 15329 this._activate(0); 15330 } 15331 } 15332 15333 if (key === "event") { 15334 this._setupEvents(value); 15335 } 15336 15337 if (key === "heightStyle") { 15338 this._setupHeightStyle(value); 15339 } 15340 }, 15341 15342 _sanitizeSelector: function (hash) { 15343 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 15344 }, 15345 15346 refresh: function () { 15347 var options = this.options, 15348 lis = this.tablist.children(":has(a[href])"); 15349 15350 // Get disabled tabs from class attribute from HTML 15351 // this will get converted to a boolean if needed in _refresh() 15352 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 15353 return lis.index(tab); 15354 }); 15355 15356 this._processTabs(); 15357 15358 // Was collapsed or no tabs 15359 if (options.active === false || !this.anchors.length) { 15360 options.active = false; 15361 this.active = $(); 15362 15363 // was active, but active tab is gone 15364 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 15365 15366 // all remaining tabs are disabled 15367 if (this.tabs.length === options.disabled.length) { 15368 options.active = false; 15369 this.active = $(); 15370 15371 // activate previous tab 15372 } else { 15373 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 15374 } 15375 15376 // was active, active tab still exists 15377 } else { 15378 15379 // make sure active index is correct 15380 options.active = this.tabs.index(this.active); 15381 } 15382 15383 this._refresh(); 15384 }, 15385 15386 _refresh: function () { 15387 this._setOptionDisabled(this.options.disabled); 15388 this._setupEvents(this.options.event); 15389 this._setupHeightStyle(this.options.heightStyle); 15390 15391 this.tabs.not(this.active).attr({ 15392 "aria-selected": "false", 15393 "aria-expanded": "false", 15394 tabIndex: -1 15395 }); 15396 this.panels.not(this._getPanelForTab(this.active)) 15397 .hide() 15398 .attr({ 15399 "aria-hidden": "true" 15400 }); 15401 15402 // Make sure one tab is in the tab order 15403 if (!this.active.length) { 15404 this.tabs.eq(0).attr("tabIndex", 0); 15405 } else { 15406 this.active 15407 .attr({ 15408 "aria-selected": "true", 15409 "aria-expanded": "true", 15410 tabIndex: 0 15411 }); 15412 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 15413 this._getPanelForTab(this.active) 15414 .show() 15415 .attr({ 15416 "aria-hidden": "false" 15417 }); 15418 } 15419 }, 15420 15421 _processTabs: function () { 15422 var that = this, 15423 prevTabs = this.tabs, 15424 prevAnchors = this.anchors, 15425 prevPanels = this.panels; 15426 15427 this.tablist = this._getList().attr("role", "tablist"); 15428 this._addClass(this.tablist, "ui-tabs-nav", 15429 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 15430 15431 // Prevent users from focusing disabled tabs via click 15432 this.tablist 15433 .on("mousedown" + this.eventNamespace, "> li", function (event) { 15434 if ($(this).is(".ui-state-disabled")) { 15435 event.preventDefault(); 15436 } 15437 }) 15438 15439 // Support: IE <9 15440 // Preventing the default action in mousedown doesn't prevent IE 15441 // from focusing the element, so if the anchor gets focused, blur. 15442 // We don't have to worry about focusing the previously focused 15443 // element since clicking on a non-focusable element should focus 15444 // the body anyway. 15445 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 15446 if ($(this).closest("li").is(".ui-state-disabled")) { 15447 this.blur(); 15448 } 15449 }); 15450 15451 this.tabs = this.tablist.find("> li:has(a[href])") 15452 .attr({ 15453 role: "tab", 15454 tabIndex: -1 15455 }); 15456 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 15457 15458 this.anchors = this.tabs.map(function () { 15459 return $("a", this)[0]; 15460 }) 15461 .attr({ 15462 tabIndex: -1 15463 }); 15464 this._addClass(this.anchors, "ui-tabs-anchor"); 15465 15466 this.panels = $(); 15467 15468 this.anchors.each(function (i, anchor) { 15469 var selector, panel, panelId, 15470 anchorId = $(anchor).uniqueId().attr("id"), 15471 tab = $(anchor).closest("li"), 15472 originalAriaControls = tab.attr("aria-controls"); 15473 15474 // Inline tab 15475 if (that._isLocal(anchor)) { 15476 selector = anchor.hash; 15477 panelId = selector.substring(1); 15478 panel = that.element.find(that._sanitizeSelector(selector)); 15479 15480 // remote tab 15481 } else { 15482 15483 // If the tab doesn't already have aria-controls, 15484 // generate an id by using a throw-away element 15485 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 15486 selector = "#" + panelId; 15487 panel = that.element.find(selector); 15488 if (!panel.length) { 15489 panel = that._createPanel(panelId); 15490 panel.insertAfter(that.panels[i - 1] || that.tablist); 15491 } 15492 panel.attr("aria-live", "polite"); 15493 } 15494 15495 if (panel.length) { 15496 that.panels = that.panels.add(panel); 15497 }
vendor: 10,082 bytes, lines 15498-15885
15498 if (originalAriaControls) { 15499 tab.data("ui-tabs-aria-controls", originalAriaControls); 15500 } 15501 tab.attr({ 15502 "aria-controls": panelId, 15503 "aria-labelledby": anchorId 15504 }); 15505 panel.attr("aria-labelledby", anchorId); 15506 }); 15507 15508 this.panels.attr("role", "tabpanel"); 15509 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 15510 15511 // Avoid memory leaks (#10056) 15512 if (prevTabs) { 15513 this._off(prevTabs.not(this.tabs)); 15514 this._off(prevAnchors.not(this.anchors)); 15515 this._off(prevPanels.not(this.panels)); 15516 } 15517 }, 15518 15519 // Allow overriding how to find the list for rare usage scenarios (#7715) 15520 _getList: function () { 15521 return this.tablist || this.element.find("ol, ul").eq(0); 15522 }, 15523 15524 _createPanel: function (id) { 15525 return $("<div>") 15526 .attr("id", id) 15527 .data("ui-tabs-destroy", true); 15528 }, 15529 15530 _setOptionDisabled: function (disabled) { 15531 var currentItem, li, i; 15532 15533 if (Array.isArray(disabled)) { 15534 if (!disabled.length) { 15535 disabled = false; 15536 } else if (disabled.length === this.anchors.length) { 15537 disabled = true; 15538 } 15539 } 15540 15541 // Disable tabs 15542 for (i = 0; (li = this.tabs[i]); i++) { 15543 currentItem = $(li); 15544 if (disabled === true || $.inArray(i, disabled) !== -1) { 15545 currentItem.attr("aria-disabled", "true"); 15546 this._addClass(currentItem, null, "ui-state-disabled"); 15547 } else { 15548 currentItem.removeAttr("aria-disabled"); 15549 this._removeClass(currentItem, null, "ui-state-disabled"); 15550 } 15551 } 15552 15553 this.options.disabled = disabled; 15554 15555 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 15556 disabled === true); 15557 }, 15558 15559 _setupEvents: function (event) { 15560 var events = {}; 15561 if (event) { 15562 $.each(event.split(" "), function (index, eventName) { 15563 events[eventName] = "_eventHandler"; 15564 }); 15565 } 15566 15567 this._off(this.anchors.add(this.tabs).add(this.panels)); 15568 15569 // Always prevent the default action, even when disabled 15570 this._on(true, this.anchors, { 15571 click: function (event) { 15572 event.preventDefault(); 15573 } 15574 }); 15575 this._on(this.anchors, events); 15576 this._on(this.tabs, { keydown: "_tabKeydown" }); 15577 this._on(this.panels, { keydown: "_panelKeydown" }); 15578 15579 this._focusable(this.tabs); 15580 this._hoverable(this.tabs); 15581 }, 15582 15583 _setupHeightStyle: function (heightStyle) { 15584 var maxHeight, 15585 parent = this.element.parent(); 15586 15587 if (heightStyle === "fill") { 15588 maxHeight = parent.height(); 15589 maxHeight -= this.element.outerHeight() - this.element.height(); 15590 15591 this.element.siblings(":visible").each(function () { 15592 var elem = $(this), 15593 position = elem.css("position"); 15594 15595 if (position === "absolute" || position === "fixed") { 15596 return; 15597 } 15598 maxHeight -= elem.outerHeight(true); 15599 }); 15600 15601 this.element.children().not(this.panels).each(function () { 15602 maxHeight -= $(this).outerHeight(true); 15603 }); 15604 15605 this.panels.each(function () { 15606 $(this).height(Math.max(0, maxHeight - 15607 $(this).innerHeight() + $(this).height())); 15608 }) 15609 .css("overflow", "auto"); 15610 } else if (heightStyle === "auto") { 15611 maxHeight = 0; 15612 this.panels.each(function () { 15613 maxHeight = Math.max(maxHeight, $(this).height("").height()); 15614 }).height(maxHeight); 15615 } 15616 }, 15617 15618 _eventHandler: function (event) { 15619 var options = this.options, 15620 active = this.active, 15621 anchor = $(event.currentTarget), 15622 tab = anchor.closest("li"), 15623 clickedIsActive = tab[0] === active[0], 15624 collapsing = clickedIsActive && options.collapsible, 15625 toShow = collapsing ? $() : this._getPanelForTab(tab), 15626 toHide = !active.length ? $() : this._getPanelForTab(active), 15627 eventData = { 15628 oldTab: active, 15629 oldPanel: toHide, 15630 newTab: collapsing ? $() : tab, 15631 newPanel: toShow 15632 }; 15633 15634 event.preventDefault(); 15635 15636 if (tab.hasClass("ui-state-disabled") || 15637 15638 // tab is already loading 15639 tab.hasClass("ui-tabs-loading") || 15640 15641 // can't switch durning an animation 15642 this.running || 15643 15644 // click on active header, but not collapsible 15645 (clickedIsActive && !options.collapsible) || 15646 15647 // allow canceling activation 15648 (this._trigger("beforeActivate", event, eventData) === false)) { 15649 return; 15650 } 15651 15652 options.active = collapsing ? false : this.tabs.index(tab); 15653 15654 this.active = clickedIsActive ? $() : tab; 15655 if (this.xhr) { 15656 this.xhr.abort(); 15657 } 15658 15659 if (!toHide.length && !toShow.length) { 15660 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 15661 } 15662 15663 if (toShow.length) { 15664 this.load(this.tabs.index(tab), event); 15665 } 15666 this._toggle(event, eventData); 15667 }, 15668 15669 // Handles show/hide for selecting tabs 15670 _toggle: function (event, eventData) { 15671 var that = this, 15672 toShow = eventData.newPanel, 15673 toHide = eventData.oldPanel; 15674 15675 this.running = true; 15676 15677 function complete() { 15678 that.running = false; 15679 that._trigger("activate", event, eventData); 15680 } 15681 15682 function show() { 15683 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 15684 15685 if (toShow.length && that.options.show) { 15686 that._show(toShow, that.options.show, complete); 15687 } else { 15688 toShow.show(); 15689 complete(); 15690 } 15691 } 15692 15693 // Start out by hiding, then showing, then completing 15694 if (toHide.length && this.options.hide) { 15695 this._hide(toHide, this.options.hide, function () { 15696 that._removeClass(eventData.oldTab.closest("li"), 15697 "ui-tabs-active", "ui-state-active"); 15698 show(); 15699 }); 15700 } else { 15701 this._removeClass(eventData.oldTab.closest("li"), 15702 "ui-tabs-active", "ui-state-active"); 15703 toHide.hide(); 15704 show(); 15705 } 15706 15707 toHide.attr("aria-hidden", "true"); 15708 eventData.oldTab.attr({ 15709 "aria-selected": "false", 15710 "aria-expanded": "false" 15711 }); 15712 15713 // If we're switching tabs, remove the old tab from the tab order. 15714 // If we're opening from collapsed state, remove the previous tab from the tab order. 15715 // If we're collapsing, then keep the collapsing tab in the tab order. 15716 if (toShow.length && toHide.length) { 15717 eventData.oldTab.attr("tabIndex", -1); 15718 } else if (toShow.length) { 15719 this.tabs.filter(function () { 15720 return $(this).attr("tabIndex") === 0; 15721 }) 15722 .attr("tabIndex", -1); 15723 } 15724 15725 toShow.attr("aria-hidden", "false"); 15726 eventData.newTab.attr({ 15727 "aria-selected": "true", 15728 "aria-expanded": "true", 15729 tabIndex: 0 15730 }); 15731 }, 15732 15733 _activate: function (index) { 15734 var anchor, 15735 active = this._findActive(index); 15736 15737 // Trying to activate the already active panel 15738 if (active[0] === this.active[0]) { 15739 return; 15740 } 15741 15742 // Trying to collapse, simulate a click on the current active header 15743 if (!active.length) { 15744 active = this.active; 15745 } 15746 15747 anchor = active.find(".ui-tabs-anchor")[0]; 15748 this._eventHandler({ 15749 target: anchor, 15750 currentTarget: anchor, 15751 preventDefault: $.noop 15752 }); 15753 }, 15754 15755 _findActive: function (index) { 15756 return index === false ? $() : this.tabs.eq(index); 15757 }, 15758 15759 _getIndex: function (index) { 15760 15761 // meta-function to give users option to provide a href string instead of a numerical index. 15762 if (typeof index === "string") { 15763 index = this.anchors.index(this.anchors.filter("[href$='" + 15764 $.escapeSelector(index) + "']")); 15765 } 15766 15767 return index; 15768 }, 15769 15770 _destroy: function () { 15771 if (this.xhr) { 15772 this.xhr.abort(); 15773 } 15774 15775 this.tablist 15776 .removeAttr("role") 15777 .off(this.eventNamespace); 15778 15779 this.anchors 15780 .removeAttr("role tabIndex") 15781 .removeUniqueId(); 15782 15783 this.tabs.add(this.panels).each(function () { 15784 if ($.data(this, "ui-tabs-destroy")) { 15785 $(this).remove(); 15786 } else { 15787 $(this).removeAttr("role tabIndex " + 15788 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 15789 } 15790 }); 15791 15792 this.tabs.each(function () { 15793 var li = $(this), 15794 prev = li.data("ui-tabs-aria-controls"); 15795 if (prev) { 15796 li 15797 .attr("aria-controls", prev) 15798 .removeData("ui-tabs-aria-controls"); 15799 } else { 15800 li.removeAttr("aria-controls"); 15801 } 15802 }); 15803 15804 this.panels.show(); 15805 15806 if (this.options.heightStyle !== "content") { 15807 this.panels.css("height", ""); 15808 } 15809 }, 15810 15811 enable: function (index) { 15812 var disabled = this.options.disabled; 15813 if (disabled === false) { 15814 return; 15815 } 15816 15817 if (index === undefined) { 15818 disabled = false; 15819 } else { 15820 index = this._getIndex(index); 15821 if (Array.isArray(disabled)) { 15822 disabled = $.map(disabled, function (num) { 15823 return num !== index ? num : null; 15824 }); 15825 } else { 15826 disabled = $.map(this.tabs, function (li, num) { 15827 return num !== index ? num : null; 15828 }); 15829 } 15830 } 15831 this._setOptionDisabled(disabled); 15832 }, 15833 15834 disable: function (index) { 15835 var disabled = this.options.disabled; 15836 if (disabled === true) { 15837 return; 15838 } 15839 15840 if (index === undefined) { 15841 disabled = true; 15842 } else { 15843 index = this._getIndex(index); 15844 if ($.inArray(index, disabled) !== -1) { 15845 return; 15846 } 15847 if (Array.isArray(disabled)) { 15848 disabled = $.merge([index], disabled).sort(); 15849 } else { 15850 disabled = [index]; 15851 } 15852 } 15853 this._setOptionDisabled(disabled); 15854 }, 15855 15856 load: function (index, event) { 15857 index = this._getIndex(index); 15858 var that = this, 15859 tab = this.tabs.eq(index), 15860 anchor = tab.find(".ui-tabs-anchor"), 15861 panel = this._getPanelForTab(tab), 15862 eventData = { 15863 tab: tab, 15864 panel: panel 15865 }, 15866 complete = function (jqXHR, status) { 15867 if (status === "abort") { 15868 that.panels.stop(false, true); 15869 } 15870 15871 that._removeClass(tab, "ui-tabs-loading"); 15872 panel.removeAttr("aria-busy"); 15873 15874 if (jqXHR === that.xhr) { 15875 delete that.xhr; 15876 } 15877 }; 15878 15879 // Not remote 15880 if (this._isLocal(anchor[0])) { 15881 return; 15882 } 15883 15884 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 15885
vendor: 42,248 bytes, lines 15886-17464
15886 // Support: jQuery <1.8 15887 // jQuery <1.8 returns false if the request is canceled in beforeSend, 15888 // but as of 1.8, $.ajax() always returns a jqXHR object. 15889 if (this.xhr && this.xhr.statusText !== "canceled") { 15890 this._addClass(tab, "ui-tabs-loading"); 15891 panel.attr("aria-busy", "true"); 15892 15893 this.xhr 15894 .done(function (response, status, jqXHR) { 15895 15896 // support: jQuery <1.8 15897 // http://bugs.jquery.com/ticket/11778 15898 setTimeout(function () { 15899 panel.html(response); 15900 that._trigger("load", event, eventData); 15901 15902 complete(jqXHR, status); 15903 }, 1); 15904 }) 15905 .fail(function (jqXHR, status) { 15906 15907 // support: jQuery <1.8 15908 // http://bugs.jquery.com/ticket/11778 15909 setTimeout(function () { 15910 complete(jqXHR, status); 15911 }, 1); 15912 }); 15913 } 15914 }, 15915 15916 _ajaxSettings: function (anchor, event, eventData) { 15917 var that = this; 15918 return { 15919 15920 // Support: IE <11 only 15921 // Strip any hash that exists to prevent errors with the Ajax request 15922 url: anchor.attr("href").replace(/#.*$/, ""), 15923 beforeSend: function (jqXHR, settings) { 15924 return that._trigger("beforeLoad", event, 15925 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 15926 } 15927 }; 15928 }, 15929 15930 _getPanelForTab: function (tab) { 15931 var id = $(tab).attr("aria-controls"); 15932 return this.element.find(this._sanitizeSelector("#" + id)); 15933 } 15934 }); 15935 15936 // DEPRECATED 15937 // TODO: Switch return back to widget declaration at top of file when this is removed 15938 if ($.uiBackCompat !== false) { 15939 15940 // Backcompat for ui-tab class (now ui-tabs-tab) 15941 $.widget("ui.tabs", $.ui.tabs, { 15942 _processTabs: function () { 15943 this._superApply(arguments); 15944 this._addClass(this.tabs, "ui-tab"); 15945 } 15946 }); 15947 } 15948 15949 var widgetsTabs = $.ui.tabs; 15950 15951 15952 /*! 15953 * jQuery UI Tooltip 1.13.2 15954 * http://jqueryui.com 15955 * 15956 * Copyright jQuery Foundation and other contributors 15957 * Released under the MIT license. 15958 * http://jquery.org/license 15959 */ 15960 15961 //>>label: Tooltip 15962 //>>group: Widgets 15963 //>>description: Shows additional information for any element on hover or focus. 15964 //>>docs: http://api.jqueryui.com/tooltip/ 15965 //>>demos: http://jqueryui.com/tooltip/ 15966 //>>css.structure: ../../themes/base/core.css 15967 //>>css.structure: ../../themes/base/tooltip.css 15968 //>>css.theme: ../../themes/base/theme.css 15969 15970 15971 $.widget("ui.tooltip", { 15972 version: "1.13.2", 15973 options: { 15974 classes: { 15975 "ui-tooltip": "ui-corner-all ui-widget-shadow" 15976 }, 15977 content: function () { 15978 var title = $(this).attr("title"); 15979 15980 // Escape title, since we're going from an attribute to raw HTML 15981 return $("<a>").text(title).html(); 15982 }, 15983 hide: true, 15984 15985 // Disabled elements have inconsistent behavior across browsers (#8661) 15986 items: "[title]:not([disabled])", 15987 position: { 15988 my: "left top+15", 15989 at: "left bottom", 15990 collision: "flipfit flip" 15991 }, 15992 show: true, 15993 track: false, 15994 15995 // Callbacks 15996 close: null, 15997 open: null 15998 }, 15999 16000 _addDescribedBy: function (elem, id) { 16001 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 16002 describedby.push(id); 16003 elem 16004 .data("ui-tooltip-id", id) 16005 .attr("aria-describedby", String.prototype.trim.call(describedby.join(" "))); 16006 }, 16007 16008 _removeDescribedBy: function (elem) { 16009 var id = elem.data("ui-tooltip-id"), 16010 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 16011 index = $.inArray(id, describedby); 16012 16013 if (index !== -1) { 16014 describedby.splice(index, 1); 16015 } 16016 16017 elem.removeData("ui-tooltip-id"); 16018 describedby = String.prototype.trim.call(describedby.join(" ")); 16019 if (describedby) { 16020 elem.attr("aria-describedby", describedby); 16021 } else { 16022 elem.removeAttr("aria-describedby"); 16023 } 16024 }, 16025 16026 _create: function () { 16027 this._on({ 16028 mouseover: "open", 16029 focusin: "open" 16030 }); 16031 16032 // IDs of generated tooltips, needed for destroy 16033 this.tooltips = {}; 16034 16035 // IDs of parent tooltips where we removed the title attribute 16036 this.parents = {}; 16037 16038 // Append the aria-live region so tooltips announce correctly 16039 this.liveRegion = $("<div>") 16040 .attr({ 16041 role: "log", 16042 "aria-live": "assertive", 16043 "aria-relevant": "additions" 16044 }) 16045 .appendTo(this.document[0].body); 16046 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 16047 16048 this.disabledTitles = $([]); 16049 }, 16050 16051 _setOption: function (key, value) { 16052 var that = this; 16053 16054 this._super(key, value); 16055 16056 if (key === "content") { 16057 $.each(this.tooltips, function (id, tooltipData) { 16058 that._updateContent(tooltipData.element); 16059 }); 16060 } 16061 }, 16062 16063 _setOptionDisabled: function (value) { 16064 this[value ? "_disable" : "_enable"](); 16065 }, 16066 16067 _disable: function () { 16068 var that = this; 16069 16070 // Close open tooltips 16071 $.each(this.tooltips, function (id, tooltipData) { 16072 var event = $.Event("blur"); 16073 event.target = event.currentTarget = tooltipData.element[0]; 16074 that.close(event, true); 16075 }); 16076 16077 // Remove title attributes to prevent native tooltips 16078 this.disabledTitles = this.disabledTitles.add( 16079 this.element.find(this.options.items).addBack() 16080 .filter(function () { 16081 var element = $(this); 16082 if (element.is("[title]")) { 16083 return element 16084 .data("ui-tooltip-title", element.attr("title")) 16085 .removeAttr("title"); 16086 } 16087 }) 16088 ); 16089 }, 16090 16091 _enable: function () { 16092 16093 // restore title attributes 16094 this.disabledTitles.each(function () { 16095 var element = $(this); 16096 if (element.data("ui-tooltip-title")) { 16097 element.attr("title", element.data("ui-tooltip-title")); 16098 } 16099 }); 16100 this.disabledTitles = $([]); 16101 }, 16102 16103 open: function (event) { 16104 var that = this, 16105 target = $(event ? event.target : this.element) 16106 16107 // we need closest here due to mouseover bubbling, 16108 // but always pointing at the same event target 16109 .closest(this.options.items); 16110 16111 // No element to show a tooltip for or the tooltip is already open 16112 if (!target.length || target.data("ui-tooltip-id")) { 16113 return; 16114 } 16115 16116 if (target.attr("title")) { 16117 target.data("ui-tooltip-title", target.attr("title")); 16118 } 16119 16120 target.data("ui-tooltip-open", true); 16121 16122 // Kill parent tooltips, custom or native, for hover 16123 if (event && event.type === "mouseover") { 16124 target.parents().each(function () { 16125 var parent = $(this), 16126 blurEvent; 16127 if (parent.data("ui-tooltip-open")) { 16128 blurEvent = $.Event("blur"); 16129 blurEvent.target = blurEvent.currentTarget = this; 16130 that.close(blurEvent, true); 16131 } 16132 if (parent.attr("title")) { 16133 parent.uniqueId(); 16134 that.parents[this.id] = { 16135 element: this, 16136 title: parent.attr("title") 16137 }; 16138 parent.attr("title", ""); 16139 } 16140 }); 16141 } 16142 16143 this._registerCloseHandlers(event, target); 16144 this._updateContent(target, event); 16145 }, 16146 16147 _updateContent: function (target, event) { 16148 var content, 16149 contentOption = this.options.content, 16150 that = this, 16151 eventType = event ? event.type : null; 16152 16153 if (typeof contentOption === "string" || contentOption.nodeType || 16154 contentOption.jquery) { 16155 return this._open(event, target, contentOption); 16156 } 16157 16158 content = contentOption.call(target[0], function (response) { 16159 16160 // IE may instantly serve a cached response for ajax requests 16161 // delay this call to _open so the other call to _open runs first 16162 that._delay(function () { 16163 16164 // Ignore async response if tooltip was closed already 16165 if (!target.data("ui-tooltip-open")) { 16166 return; 16167 } 16168 16169 // JQuery creates a special event for focusin when it doesn't 16170 // exist natively. To improve performance, the native event 16171 // object is reused and the type is changed. Therefore, we can't 16172 // rely on the type being correct after the event finished 16173 // bubbling, so we set it back to the previous value. (#8740) 16174 if (event) { 16175 event.type = eventType; 16176 } 16177 this._open(event, target, response); 16178 }); 16179 }); 16180 if (content) { 16181 this._open(event, target, content); 16182 } 16183 }, 16184 16185 _open: function (event, target, content) { 16186 var tooltipData, tooltip, delayedShow, a11yContent, 16187 positionOption = $.extend({}, this.options.position); 16188 16189 if (!content) { 16190 return; 16191 } 16192 16193 // Content can be updated multiple times. If the tooltip already 16194 // exists, then just update the content and bail. 16195 tooltipData = this._find(target); 16196 if (tooltipData) { 16197 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 16198 return; 16199 } 16200 16201 // If we have a title, clear it to prevent the native tooltip 16202 // we have to check first to avoid defining a title if none exists 16203 // (we don't want to cause an element to start matching [title]) 16204 // 16205 // We use removeAttr only for key events, to allow IE to export the correct 16206 // accessible attributes. For mouse events, set to empty string to avoid 16207 // native tooltip showing up (happens only when removing inside mouseover). 16208 if (target.is("[title]")) { 16209 if (event && event.type === "mouseover") { 16210 target.attr("title", ""); 16211 } else { 16212 target.removeAttr("title"); 16213 } 16214 } 16215 16216 tooltipData = this._tooltip(target); 16217 tooltip = tooltipData.tooltip; 16218 this._addDescribedBy(target, tooltip.attr("id")); 16219 tooltip.find(".ui-tooltip-content").html(content); 16220 16221 // Support: Voiceover on OS X, JAWS on IE <= 9 16222 // JAWS announces deletions even when aria-relevant="additions" 16223 // Voiceover will sometimes re-read the entire log region's contents from the beginning 16224 this.liveRegion.children().hide(); 16225 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 16226 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 16227 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 16228 a11yContent.appendTo(this.liveRegion); 16229 16230 function position(event) { 16231 positionOption.of = event; 16232 if (tooltip.is(":hidden")) { 16233 return; 16234 } 16235 tooltip.position(positionOption); 16236 } 16237 if (this.options.track && event && /^mouse/.test(event.type)) { 16238 this._on(this.document, { 16239 mousemove: position 16240 }); 16241 16242 // trigger once to override element-relative positioning 16243 position(event); 16244 } else { 16245 tooltip.position($.extend({ 16246 of: target 16247 }, this.options.position)); 16248 } 16249 16250 tooltip.hide(); 16251 16252 this._show(tooltip, this.options.show); 16253 16254 // Handle tracking tooltips that are shown with a delay (#8644). As soon 16255 // as the tooltip is visible, position the tooltip using the most recent 16256 // event. 16257 // Adds the check to add the timers only when both delay and track options are set (#14682) 16258 if (this.options.track && this.options.show && this.options.show.delay) { 16259 delayedShow = this.delayedShow = setInterval(function () { 16260 if (tooltip.is(":visible")) { 16261 position(positionOption.of); 16262 clearInterval(delayedShow); 16263 } 16264 }, 13); 16265 } 16266 16267 this._trigger("open", event, { tooltip: tooltip }); 16268 }, 16269 16270 _registerCloseHandlers: function (event, target) { 16271 var events = { 16272 keyup: function (event) { 16273 if (event.keyCode === $.ui.keyCode.ESCAPE) { 16274 var fakeEvent = $.Event(event); 16275 fakeEvent.currentTarget = target[0]; 16276 this.close(fakeEvent, true); 16277 } 16278 } 16279 }; 16280 16281 // Only bind remove handler for delegated targets. Non-delegated 16282 // tooltips will handle this in destroy. 16283 if (target[0] !== this.element[0]) { 16284 events.remove = function () { 16285 var targetElement = this._find(target); 16286 if (targetElement) { 16287 this._removeTooltip(targetElement.tooltip); 16288 } 16289 }; 16290 } 16291 16292 if (!event || event.type === "mouseover") { 16293 events.mouseleave = "close"; 16294 } 16295 if (!event || event.type === "focusin") { 16296 events.focusout = "close"; 16297 } 16298 this._on(true, target, events); 16299 }, 16300 16301 close: function (event) { 16302 var tooltip, 16303 that = this, 16304 target = $(event ? event.currentTarget : this.element), 16305 tooltipData = this._find(target); 16306 16307 // The tooltip may already be closed 16308 if (!tooltipData) { 16309 16310 // We set ui-tooltip-open immediately upon open (in open()), but only set the 16311 // additional data once there's actually content to show (in _open()). So even if the 16312 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 16313 // the period between open() and _open(). 16314 target.removeData("ui-tooltip-open"); 16315 return; 16316 } 16317 16318 tooltip = tooltipData.tooltip; 16319 16320 // Disabling closes the tooltip, so we need to track when we're closing 16321 // to avoid an infinite loop in case the tooltip becomes disabled on close 16322 if (tooltipData.closing) { 16323 return; 16324 } 16325 16326 // Clear the interval for delayed tracking tooltips 16327 clearInterval(this.delayedShow); 16328 16329 // Only set title if we had one before (see comment in _open()) 16330 // If the title attribute has changed since open(), don't restore 16331 if (target.data("ui-tooltip-title") && !target.attr("title")) { 16332 target.attr("title", target.data("ui-tooltip-title")); 16333 } 16334 16335 this._removeDescribedBy(target); 16336 16337 tooltipData.hiding = true; 16338 tooltip.stop(true); 16339 this._hide(tooltip, this.options.hide, function () { 16340 that._removeTooltip($(this)); 16341 }); 16342 16343 target.removeData("ui-tooltip-open"); 16344 this._off(target, "mouseleave focusout keyup"); 16345 16346 // Remove 'remove' binding only on delegated targets 16347 if (target[0] !== this.element[0]) { 16348 this._off(target, "remove"); 16349 } 16350 this._off(this.document, "mousemove"); 16351 16352 if (event && event.type === "mouseleave") { 16353 $.each(this.parents, function (id, parent) { 16354 $(parent.element).attr("title", parent.title); 16355 delete that.parents[id]; 16356 }); 16357 } 16358 16359 tooltipData.closing = true; 16360 this._trigger("close", event, { tooltip: tooltip }); 16361 if (!tooltipData.hiding) { 16362 tooltipData.closing = false; 16363 } 16364 }, 16365 16366 _tooltip: function (element) { 16367 var tooltip = $("<div>").attr("role", "tooltip"), 16368 content = $("<div>").appendTo(tooltip), 16369 id = tooltip.uniqueId().attr("id"); 16370 16371 this._addClass(content, "ui-tooltip-content"); 16372 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 16373 16374 tooltip.appendTo(this._appendTo(element)); 16375 16376 return this.tooltips[id] = { 16377 element: element, 16378 tooltip: tooltip 16379 }; 16380 }, 16381 16382 _find: function (target) { 16383 var id = target.data("ui-tooltip-id"); 16384 return id ? this.tooltips[id] : null; 16385 }, 16386 16387 _removeTooltip: function (tooltip) { 16388 16389 // Clear the interval for delayed tracking tooltips 16390 clearInterval(this.delayedShow); 16391 16392 tooltip.remove(); 16393 delete this.tooltips[tooltip.attr("id")]; 16394 }, 16395 16396 _appendTo: function (target) { 16397 var element = target.closest(".ui-front, dialog"); 16398 16399 if (!element.length) { 16400 element = this.document[0].body; 16401 } 16402 16403 return element; 16404 }, 16405 16406 _destroy: function () { 16407 var that = this; 16408 16409 // Close open tooltips 16410 $.each(this.tooltips, function (id, tooltipData) { 16411 16412 // Delegate to close method to handle common cleanup 16413 var event = $.Event("blur"), 16414 element = tooltipData.element; 16415 event.target = event.currentTarget = element[0]; 16416 that.close(event, true); 16417 16418 // Remove immediately; destroying an open tooltip doesn't use the 16419 // hide animation 16420 $("#" + id).remove(); 16421 16422 // Restore the title 16423 if (element.data("ui-tooltip-title")) { 16424 16425 // If the title attribute has changed since open(), don't restore 16426 if (!element.attr("title")) { 16427 element.attr("title", element.data("ui-tooltip-title")); 16428 } 16429 element.removeData("ui-tooltip-title"); 16430 } 16431 }); 16432 this.liveRegion.remove(); 16433 } 16434 }); 16435 16436 // DEPRECATED 16437 // TODO: Switch return back to widget declaration at top of file when this is removed 16438 if ($.uiBackCompat !== false) { 16439 16440 // Backcompat for tooltipClass option 16441 $.widget("ui.tooltip", $.ui.tooltip, { 16442 options: { 16443 tooltipClass: null 16444 }, 16445 _tooltip: function () { 16446 var tooltipData = this._superApply(arguments); 16447 if (this.options.tooltipClass) { 16448 tooltipData.tooltip.addClass(this.options.tooltipClass); 16449 } 16450 return tooltipData; 16451 } 16452 }); 16453 } 16454 16455 var widgetsTooltip = $.ui.tooltip; 16456 16457 16458 16459 // Create a local jQuery because jQuery Color relies on it and the 16460 // global may not exist with AMD and a custom build (#10199). 16461 // This module is a noop if used as a regular AMD module. 16462 // eslint-disable-next-line no-unused-vars 16463 var jQuery = $; 16464 16465 16466 /*! 16467 * jQuery Color Animations v2.2.0 16468 * https://github.com/jquery/jquery-color 16469 * 16470 * Copyright OpenJS Foundation and other contributors 16471 * Released under the MIT license. 16472 * http://jquery.org/license 16473 * 16474 * Date: Sun May 10 09:02:36 2020 +0200 16475 */ 16476 16477 16478 16479 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 16480 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 16481 16482 class2type = {}, 16483 toString = class2type.toString, 16484 16485 // plusequals test for += 100 -= 100 16486 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 16487 16488 // a set of RE's that can match strings and generate color tuples. 16489 stringParsers = [{ 16490 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16491 parse: function (execResult) { 16492 return [ 16493 execResult[1], 16494 execResult[2], 16495 execResult[3], 16496 execResult[4] 16497 ]; 16498 } 16499 }, { 16500 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16501 parse: function (execResult) { 16502 return [ 16503 execResult[1] * 2.55, 16504 execResult[2] * 2.55, 16505 execResult[3] * 2.55, 16506 execResult[4] 16507 ]; 16508 } 16509 }, { 16510 16511 // this regex ignores A-F because it's compared against an already lowercased string 16512 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 16513 parse: function (execResult) { 16514 return [ 16515 parseInt(execResult[1], 16), 16516 parseInt(execResult[2], 16), 16517 parseInt(execResult[3], 16), 16518 execResult[4] ? 16519 (parseInt(execResult[4], 16) / 255).toFixed(2) : 16520 1 16521 ]; 16522 } 16523 }, { 16524 16525 // this regex ignores A-F because it's compared against an already lowercased string 16526 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 16527 parse: function (execResult) { 16528 return [ 16529 parseInt(execResult[1] + execResult[1], 16), 16530 parseInt(execResult[2] + execResult[2], 16), 16531 parseInt(execResult[3] + execResult[3], 16), 16532 execResult[4] ? 16533 (parseInt(execResult[4] + execResult[4], 16) / 255) 16534 .toFixed(2) : 16535 1 16536 ]; 16537 } 16538 }, { 16539 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16540 space: "hsla", 16541 parse: function (execResult) { 16542 return [ 16543 execResult[1], 16544 execResult[2] / 100, 16545 execResult[3] / 100, 16546 execResult[4] 16547 ]; 16548 } 16549 }], 16550 16551 // jQuery.Color( ) 16552 color = jQuery.Color = function (color, green, blue, alpha) { 16553 return new jQuery.Color.fn.parse(color, green, blue, alpha); 16554 }, 16555 spaces = { 16556 rgba: { 16557 props: { 16558 red: { 16559 idx: 0, 16560 type: "byte" 16561 }, 16562 green: { 16563 idx: 1, 16564 type: "byte" 16565 }, 16566 blue: { 16567 idx: 2, 16568 type: "byte" 16569 } 16570 } 16571 }, 16572 16573 hsla: { 16574 props: { 16575 hue: { 16576 idx: 0, 16577 type: "degrees" 16578 }, 16579 saturation: { 16580 idx: 1, 16581 type: "percent" 16582 }, 16583 lightness: { 16584 idx: 2, 16585 type: "percent" 16586 } 16587 } 16588 } 16589 }, 16590 propTypes = { 16591 "byte": { 16592 floor: true, 16593 max: 255 16594 }, 16595 "percent": { 16596 max: 1 16597 }, 16598 "degrees": { 16599 mod: 360, 16600 floor: true 16601 } 16602 }, 16603 support = color.support = {}, 16604 16605 // element for support tests 16606 supportElem = jQuery("<p>")[0], 16607 16608 // colors = jQuery.Color.names 16609 colors, 16610 16611 // local aliases of functions called often 16612 each = jQuery.each; 16613 16614 // determine rgba support immediately 16615 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 16616 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 16617 16618 // define cache name and alpha properties 16619 // for rgba and hsla spaces 16620 each(spaces, function (spaceName, space) { 16621 space.cache = "_" + spaceName; 16622 space.props.alpha = { 16623 idx: 3, 16624 type: "percent", 16625 def: 1 16626 }; 16627 }); 16628 16629 // Populate the class2type map 16630 jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 16631 function (_i, name) { 16632 class2type["[object " + name + "]"] = name.toLowerCase(); 16633 }); 16634 16635 function getType(obj) { 16636 if (obj == null) { 16637 return obj + ""; 16638 } 16639 16640 return typeof obj === "object" ? 16641 class2type[toString.call(obj)] || "object" : 16642 typeof obj; 16643 } 16644 16645 function clamp(value, prop, allowEmpty) { 16646 var type = propTypes[prop.type] || {}; 16647 16648 if (value == null) { 16649 return (allowEmpty || !prop.def) ? null : prop.def; 16650 } 16651 16652 // ~~ is an short way of doing floor for positive numbers 16653 value = type.floor ? ~~value : parseFloat(value); 16654 16655 // IE will pass in empty strings as value for alpha, 16656 // which will hit this case 16657 if (isNaN(value)) { 16658 return prop.def; 16659 } 16660 16661 if (type.mod) { 16662 16663 // we add mod before modding to make sure that negatives values 16664 // get converted properly: -10 -> 350 16665 return (value + type.mod) % type.mod; 16666 } 16667 16668 // for now all property types without mod have min and max 16669 return Math.min(type.max, Math.max(0, value)); 16670 } 16671 16672 function stringParse(string) { 16673 var inst = color(), 16674 rgba = inst._rgba = []; 16675 16676 string = string.toLowerCase(); 16677 16678 each(stringParsers, function (_i, parser) { 16679 var parsed, 16680 match = parser.re.exec(string), 16681 values = match && parser.parse(match), 16682 spaceName = parser.space || "rgba"; 16683 16684 if (values) { 16685 parsed = inst[spaceName](values); 16686 16687 // if this was an rgba parse the assignment might happen twice 16688 // oh well.... 16689 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 16690 rgba = inst._rgba = parsed._rgba; 16691 16692 // exit each( stringParsers ) here because we matched 16693 return false; 16694 } 16695 }); 16696 16697 // Found a stringParser that handled it 16698 if (rgba.length) { 16699 16700 // if this came from a parsed string, force "transparent" when alpha is 0 16701 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 16702 if (rgba.join() === "0,0,0,0") { 16703 jQuery.extend(rgba, colors.transparent); 16704 } 16705 return inst; 16706 } 16707 16708 // named colors 16709 return colors[string]; 16710 } 16711 16712 color.fn = jQuery.extend(color.prototype, { 16713 parse: function (red, green, blue, alpha) { 16714 if (red === undefined) { 16715 this._rgba = [null, null, null, null]; 16716 return this; 16717 } 16718 if (red.jquery || red.nodeType) { 16719 red = jQuery(red).css(green); 16720 green = undefined; 16721 } 16722 16723 var inst = this, 16724 type = getType(red), 16725 rgba = this._rgba = []; 16726 16727 // more than 1 argument specified - assume ( red, green, blue, alpha ) 16728 if (green !== undefined) { 16729 red = [red, green, blue, alpha]; 16730 type = "array"; 16731 } 16732 16733 if (type === "string") { 16734 return this.parse(stringParse(red) || colors._default); 16735 } 16736 16737 if (type === "array") { 16738 each(spaces.rgba.props, function (_key, prop) { 16739 rgba[prop.idx] = clamp(red[prop.idx], prop); 16740 }); 16741 return this; 16742 } 16743 16744 if (type === "object") { 16745 if (red instanceof color) { 16746 each(spaces, function (_spaceName, space) { 16747 if (red[space.cache]) { 16748 inst[space.cache] = red[space.cache].slice(); 16749 } 16750 }); 16751 } else { 16752 each(spaces, function (_spaceName, space) { 16753 var cache = space.cache; 16754 each(space.props, function (key, prop) { 16755 16756 // if the cache doesn't exist, and we know how to convert 16757 if (!inst[cache] && space.to) { 16758 16759 // if the value was null, we don't need to copy it 16760 // if the key was alpha, we don't need to copy it either 16761 if (key === "alpha" || red[key] == null) { 16762 return; 16763 } 16764 inst[cache] = space.to(inst._rgba); 16765 } 16766 16767 // this is the only case where we allow nulls for ALL properties. 16768 // call clamp with alwaysAllowEmpty 16769 inst[cache][prop.idx] = clamp(red[key], prop, true); 16770 }); 16771 16772 // everything defined but alpha? 16773 if (inst[cache] && jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 16774 16775 // use the default of 1 16776 if (inst[cache][3] == null) { 16777 inst[cache][3] = 1; 16778 } 16779 16780 if (space.from) { 16781 inst._rgba = space.from(inst[cache]); 16782 } 16783 } 16784 }); 16785 } 16786 return this; 16787 } 16788 }, 16789 is: function (compare) { 16790 var is = color(compare), 16791 same = true, 16792 inst = this; 16793 16794 each(spaces, function (_, space) { 16795 var localCache, 16796 isCache = is[space.cache]; 16797 if (isCache) { 16798 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 16799 each(space.props, function (_, prop) { 16800 if (isCache[prop.idx] != null) { 16801 same = (isCache[prop.idx] === localCache[prop.idx]); 16802 return same; 16803 } 16804 }); 16805 } 16806 return same; 16807 }); 16808 return same; 16809 }, 16810 _space: function () { 16811 var used = [], 16812 inst = this; 16813 each(spaces, function (spaceName, space) { 16814 if (inst[space.cache]) { 16815 used.push(spaceName); 16816 } 16817 }); 16818 return used.pop(); 16819 }, 16820 transition: function (other, distance) { 16821 var end = color(other), 16822 spaceName = end._space(), 16823 space = spaces[spaceName], 16824 startColor = this.alpha() === 0 ? color("transparent") : this, 16825 start = startColor[space.cache] || space.to(startColor._rgba), 16826 result = start.slice(); 16827 16828 end = end[space.cache]; 16829 each(space.props, function (_key, prop) { 16830 var index = prop.idx, 16831 startValue = start[index], 16832 endValue = end[index], 16833 type = propTypes[prop.type] || {}; 16834 16835 // if null, don't override start value 16836 if (endValue === null) { 16837 return; 16838 } 16839 16840 // if null - use end 16841 if (startValue === null) { 16842 result[index] = endValue; 16843 } else { 16844 if (type.mod) { 16845 if (endValue - startValue > type.mod / 2) { 16846 startValue += type.mod; 16847 } else if (startValue - endValue > type.mod / 2) { 16848 startValue -= type.mod; 16849 } 16850 } 16851 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 16852 } 16853 }); 16854 return this[spaceName](result); 16855 }, 16856 blend: function (opaque) { 16857 16858 // if we are already opaque - return ourself 16859 if (this._rgba[3] === 1) { 16860 return this; 16861 } 16862 16863 var rgb = this._rgba.slice(), 16864 a = rgb.pop(), 16865 blend = color(opaque)._rgba; 16866 16867 return color(jQuery.map(rgb, function (v, i) { 16868 return (1 - a) * blend[i] + a * v; 16869 })); 16870 }, 16871 toRgbaString: function () { 16872 var prefix = "rgba(", 16873 rgba = jQuery.map(this._rgba, function (v, i) { 16874 if (v != null) { 16875 return v; 16876 } 16877 return i > 2 ? 1 : 0; 16878 }); 16879 16880 if (rgba[3] === 1) { 16881 rgba.pop(); 16882 prefix = "rgb("; 16883 } 16884 16885 return prefix + rgba.join() + ")"; 16886 }, 16887 toHslaString: function () { 16888 var prefix = "hsla(", 16889 hsla = jQuery.map(this.hsla(), function (v, i) { 16890 if (v == null) { 16891 v = i > 2 ? 1 : 0; 16892 } 16893 16894 // catch 1 and 2 16895 if (i && i < 3) { 16896 v = Math.round(v * 100) + "%"; 16897 } 16898 return v; 16899 }); 16900 16901 if (hsla[3] === 1) { 16902 hsla.pop(); 16903 prefix = "hsl("; 16904 } 16905 return prefix + hsla.join() + ")"; 16906 }, 16907 toHexString: function (includeAlpha) { 16908 var rgba = this._rgba.slice(), 16909 alpha = rgba.pop(); 16910 16911 if (includeAlpha) { 16912 rgba.push(~~(alpha * 255)); 16913 } 16914 16915 return "#" + jQuery.map(rgba, function (v) { 16916 16917 // default to 0 when nulls exist 16918 v = (v || 0).toString(16); 16919 return v.length === 1 ? "0" + v : v; 16920 }).join(""); 16921 }, 16922 toString: function () { 16923 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 16924 } 16925 }); 16926 color.fn.parse.prototype = color.fn; 16927 16928 // hsla conversions adapted from: 16929 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 16930 16931 function hue2rgb(p, q, h) { 16932 h = (h + 1) % 1; 16933 if (h * 6 < 1) { 16934 return p + (q - p) * h * 6; 16935 } 16936 if (h * 2 < 1) { 16937 return q; 16938 } 16939 if (h * 3 < 2) { 16940 return p + (q - p) * ((2 / 3) - h) * 6; 16941 } 16942 return p; 16943 } 16944 16945 spaces.hsla.to = function (rgba) { 16946 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 16947 return [null, null, null, rgba[3]]; 16948 } 16949 var r = rgba[0] / 255, 16950 g = rgba[1] / 255, 16951 b = rgba[2] / 255, 16952 a = rgba[3], 16953 max = Math.max(r, g, b), 16954 min = Math.min(r, g, b), 16955 diff = max - min, 16956 add = max + min, 16957 l = add * 0.5, 16958 h, s; 16959 16960 if (min === max) { 16961 h = 0; 16962 } else if (r === max) { 16963 h = (60 * (g - b) / diff) + 360; 16964 } else if (g === max) { 16965 h = (60 * (b - r) / diff) + 120; 16966 } else { 16967 h = (60 * (r - g) / diff) + 240; 16968 } 16969 16970 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 16971 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 16972 if (diff === 0) { 16973 s = 0; 16974 } else if (l <= 0.5) { 16975 s = diff / add; 16976 } else { 16977 s = diff / (2 - add); 16978 } 16979 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 16980 }; 16981 16982 spaces.hsla.from = function (hsla) { 16983 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 16984 return [null, null, null, hsla[3]]; 16985 } 16986 var h = hsla[0] / 360, 16987 s = hsla[1], 16988 l = hsla[2], 16989 a = hsla[3], 16990 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 16991 p = 2 * l - q; 16992 16993 return [ 16994 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 16995 Math.round(hue2rgb(p, q, h) * 255), 16996 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 16997 a 16998 ]; 16999 }; 17000 17001 17002 each(spaces, function (spaceName, space) { 17003 var props = space.props, 17004 cache = space.cache, 17005 to = space.to, 17006 from = space.from; 17007 17008 // makes rgba() and hsla() 17009 color.fn[spaceName] = function (value) { 17010 17011 // generate a cache for this space if it doesn't exist 17012 if (to && !this[cache]) { 17013 this[cache] = to(this._rgba); 17014 } 17015 if (value === undefined) { 17016 return this[cache].slice(); 17017 } 17018 17019 var ret, 17020 type = getType(value), 17021 arr = (type === "array" || type === "object") ? value : arguments, 17022 local = this[cache].slice(); 17023 17024 each(props, function (key, prop) { 17025 var val = arr[type === "object" ? key : prop.idx]; 17026 if (val == null) { 17027 val = local[prop.idx]; 17028 } 17029 local[prop.idx] = clamp(val, prop); 17030 }); 17031 17032 if (from) { 17033 ret = color(from(local)); 17034 ret[cache] = local; 17035 return ret; 17036 } else { 17037 return color(local); 17038 } 17039 }; 17040 17041 // makes red() green() blue() alpha() hue() saturation() lightness() 17042 each(props, function (key, prop) { 17043 17044 // alpha is included in more than one space 17045 if (color.fn[key]) { 17046 return; 17047 } 17048 color.fn[key] = function (value) { 17049 var local, cur, match, fn, 17050 vtype = getType(value); 17051 17052 if (key === "alpha") { 17053 fn = this._hsla ? "hsla" : "rgba"; 17054 } else { 17055 fn = spaceName; 17056 } 17057 local = this[fn](); 17058 cur = local[prop.idx]; 17059 17060 if (vtype === "undefined") { 17061 return cur; 17062 } 17063 17064 if (vtype === "function") { 17065 value = value.call(this, cur); 17066 vtype = getType(value); 17067 } 17068 if (value == null && prop.empty) { 17069 return this; 17070 } 17071 if (vtype === "string") { 17072 match = rplusequals.exec(value); 17073 if (match) { 17074 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 17075 } 17076 } 17077 local[prop.idx] = value; 17078 return this[fn](local); 17079 }; 17080 }); 17081 }); 17082 17083 // add cssHook and .fx.step function for each named hook. 17084 // accept a space separated string of properties 17085 color.hook = function (hook) { 17086 var hooks = hook.split(" "); 17087 each(hooks, function (_i, hook) { 17088 jQuery.cssHooks[hook] = { 17089 set: function (elem, value) { 17090 var parsed, curElem, 17091 backgroundColor = ""; 17092 17093 if (value !== "transparent" && (getType(value) !== "string" || (parsed = stringParse(value)))) { 17094 value = color(parsed || value); 17095 if (!support.rgba && value._rgba[3] !== 1) { 17096 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 17097 while ( 17098 (backgroundColor === "" || backgroundColor === "transparent") && 17099 curElem && curElem.style 17100 ) { 17101 try { 17102 backgroundColor = jQuery.css(curElem, "backgroundColor"); 17103 curElem = curElem.parentNode; 17104 } catch (e) { 17105 } 17106 } 17107 17108 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 17109 backgroundColor : 17110 "_default"); 17111 } 17112 17113 value = value.toRgbaString(); 17114 } 17115 try { 17116 elem.style[hook] = value; 17117 } catch (e) { 17118 17119 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 17120 } 17121 } 17122 }; 17123 jQuery.fx.step[hook] = function (fx) { 17124 if (!fx.colorInit) { 17125 fx.start = color(fx.elem, hook); 17126 fx.end = color(fx.end); 17127 fx.colorInit = true; 17128 } 17129 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 17130 }; 17131 }); 17132 17133 }; 17134 17135 color.hook(stepHooks); 17136 17137 jQuery.cssHooks.borderColor = { 17138 expand: function (value) { 17139 var expanded = {}; 17140 17141 each(["Top", "Right", "Bottom", "Left"], function (_i, part) { 17142 expanded["border" + part + "Color"] = value; 17143 }); 17144 return expanded; 17145 } 17146 }; 17147 17148 // Basic color names only. 17149 // Usage of any of the other color names requires adding yourself or including 17150 // jquery.color.svg-names.js. 17151 colors = jQuery.Color.names = { 17152 17153 // 4.1. Basic color keywords 17154 aqua: "#00ffff", 17155 black: "#000000", 17156 blue: "#0000ff", 17157 fuchsia: "#ff00ff", 17158 gray: "#808080", 17159 green: "#008000", 17160 lime: "#00ff00", 17161 maroon: "#800000", 17162 navy: "#000080", 17163 olive: "#808000", 17164 purple: "#800080", 17165 red: "#ff0000", 17166 silver: "#c0c0c0", 17167 teal: "#008080", 17168 white: "#ffffff", 17169 yellow: "#ffff00", 17170 17171 // 4.2.3. "transparent" color keyword 17172 transparent: [null, null, null, 0], 17173 17174 _default: "#ffffff" 17175 }; 17176 17177 17178 /*! 17179 * jQuery UI Effects 1.13.2 17180 * http://jqueryui.com 17181 * 17182 * Copyright jQuery Foundation and other contributors 17183 * Released under the MIT license. 17184 * http://jquery.org/license 17185 */ 17186 17187 //>>label: Effects Core 17188 //>>group: Effects 17189 /* eslint-disable max-len */ 17190 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 17191 /* eslint-enable max-len */ 17192 //>>docs: http://api.jqueryui.com/category/effects-core/ 17193 //>>demos: http://jqueryui.com/effect/ 17194 17195 17196 var dataSpace = "ui-effects-", 17197 dataSpaceStyle = "ui-effects-style", 17198 dataSpaceAnimated = "ui-effects-animated"; 17199 17200 $.effects = { 17201 effect: {} 17202 }; 17203 17204 /******************************************************************************/ 17205 /****************************** CLASS ANIMATIONS ******************************/ 17206 /******************************************************************************/ 17207 (function () { 17208 17209 var classAnimationActions = ["add", "remove", "toggle"], 17210 shorthandStyles = { 17211 border: 1, 17212 borderBottom: 1, 17213 borderColor: 1, 17214 borderLeft: 1, 17215 borderRight: 1, 17216 borderTop: 1, 17217 borderWidth: 1, 17218 margin: 1, 17219 padding: 1 17220 }; 17221 17222 $.each( 17223 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 17224 function (_, prop) { 17225 $.fx.step[prop] = function (fx) { 17226 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 17227 jQuery.style(fx.elem, prop, fx.end); 17228 fx.setAttr = true; 17229 } 17230 }; 17231 } 17232 ); 17233 17234 function camelCase(string) { 17235 return string.replace(/-([\da-z])/gi, function (all, letter) { 17236 return letter.toUpperCase(); 17237 }); 17238 } 17239 17240 function getElementStyles(elem) { 17241 var key, len, 17242 style = elem.ownerDocument.defaultView ? 17243 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 17244 elem.currentStyle, 17245 styles = {}; 17246 17247 if (style && style.length && style[0] && style[style[0]]) { 17248 len = style.length; 17249 while (len--) { 17250 key = style[len]; 17251 if (typeof style[key] === "string") { 17252 styles[camelCase(key)] = style[key]; 17253 } 17254 } 17255 17256 // Support: Opera, IE <9 17257 } else { 17258 for (key in style) { 17259 if (typeof style[key] === "string") { 17260 styles[key] = style[key]; 17261 } 17262 } 17263 } 17264 17265 return styles; 17266 } 17267 17268 function styleDifference(oldStyle, newStyle) { 17269 var diff = {}, 17270 name, value; 17271 17272 for (name in newStyle) { 17273 value = newStyle[name]; 17274 if (oldStyle[name] !== value) { 17275 if (!shorthandStyles[name]) { 17276 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 17277 diff[name] = value; 17278 } 17279 } 17280 } 17281 } 17282 17283 return diff; 17284 } 17285 17286 // Support: jQuery <1.8 17287 if (!$.fn.addBack) { 17288 $.fn.addBack = function (selector) { 17289 return this.add(selector == null ? 17290 this.prevObject : this.prevObject.filter(selector) 17291 ); 17292 }; 17293 } 17294 17295 $.effects.animateClass = function (value, duration, easing, callback) { 17296 var o = $.speed(duration, easing, callback); 17297 17298 return this.queue(function () { 17299 var animated = $(this), 17300 baseClass = animated.attr("class") || "", 17301 applyClassChange, 17302 allAnimations = o.children ? animated.find("*").addBack() : animated; 17303 17304 // Map the animated objects to store the original styles. 17305 allAnimations = allAnimations.map(function () { 17306 var el = $(this); 17307 return { 17308 el: el, 17309 start: getElementStyles(this) 17310 }; 17311 }); 17312 17313 // Apply class change 17314 applyClassChange = function () { 17315 $.each(classAnimationActions, function (i, action) { 17316 if (value[action]) { 17317 animated[action + "Class"](value[action]); 17318 } 17319 }); 17320 }; 17321 applyClassChange(); 17322 17323 // Map all animated objects again - calculate new styles and diff 17324 allAnimations = allAnimations.map(function () { 17325 this.end = getElementStyles(this.el[0]); 17326 this.diff = styleDifference(this.start, this.end); 17327 return this; 17328 }); 17329 17330 // Apply original class 17331 animated.attr("class", baseClass); 17332 17333 // Map all animated objects again - this time collecting a promise 17334 allAnimations = allAnimations.map(function () { 17335 var styleInfo = this, 17336 dfd = $.Deferred(), 17337 opts = $.extend({}, o, { 17338 queue: false, 17339 complete: function () { 17340 dfd.resolve(styleInfo); 17341 } 17342 }); 17343 17344 this.el.animate(this.diff, opts); 17345 return dfd.promise(); 17346 }); 17347 17348 // Once all animations have completed: 17349 $.when.apply($, allAnimations.get()).done(function () { 17350 17351 // Set the final class 17352 applyClassChange(); 17353 17354 // For each animated element, 17355 // clear all css properties that were animated 17356 $.each(arguments, function () { 17357 var el = this.el; 17358 $.each(this.diff, function (key) { 17359 el.css(key, ""); 17360 }); 17361 }); 17362 17363 // This is guarnteed to be there if you use jQuery.speed() 17364 // it also handles dequeuing the next anim... 17365 o.complete.call(animated[0]); 17366 }); 17367 }); 17368 }; 17369 17370 $.fn.extend({ 17371 addClass: (function (orig) { 17372 return function (classNames, speed, easing, callback) { 17373 return speed ? 17374 $.effects.animateClass.call(this, 17375 { add: classNames }, speed, easing, callback) : 17376 orig.apply(this, arguments); 17377 }; 17378 })($.fn.addClass), 17379 17380 removeClass: (function (orig) { 17381 return function (classNames, speed, easing, callback) { 17382 return arguments.length > 1 ? 17383 $.effects.animateClass.call(this, 17384 { remove: classNames }, speed, easing, callback) : 17385 orig.apply(this, arguments); 17386 }; 17387 })($.fn.removeClass), 17388 17389 toggleClass: (function (orig) { 17390 return function (classNames, force, speed, easing, callback) { 17391 if (typeof force === "boolean" || force === undefined) { 17392 if (!speed) { 17393 17394 // Without speed parameter 17395 return orig.apply(this, arguments); 17396 } else { 17397 return $.effects.animateClass.call(this, 17398 (force ? { add: classNames } : { remove: classNames }), 17399 speed, easing, callback); 17400 } 17401 } else { 17402 17403 // Without force parameter 17404 return $.effects.animateClass.call(this, 17405 { toggle: classNames }, force, speed, easing); 17406 } 17407 }; 17408 })($.fn.toggleClass), 17409 17410 switchClass: function (remove, add, speed, easing, callback) { 17411 return $.effects.animateClass.call(this, { 17412 add: add, 17413 remove: remove 17414 }, speed, easing, callback); 17415 } 17416 }); 17417 17418 })(); 17419 17420 /******************************************************************************/ 17421 /*********************************** EFFECTS **********************************/ 17422 /******************************************************************************/ 17423 17424 (function () { 17425 17426 if ($.expr && $.expr.pseudos && $.expr.pseudos.animated) { 17427 $.expr.pseudos.animated = (function (orig) { 17428 return function (elem) { 17429 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 17430 }; 17431 })($.expr.pseudos.animated); 17432 } 17433 17434 if ($.uiBackCompat !== false) { 17435 $.extend($.effects, { 17436 17437 // Saves a set of properties in a data storage 17438 save: function (element, set) { 17439 var i = 0, length = set.length; 17440 for (; i < length; i++) { 17441 if (set[i] !== null) { 17442 element.data(dataSpace + set[i], element[0].style[set[i]]); 17443 } 17444 } 17445 }, 17446 17447 // Restores a set of previously saved properties from a data storage 17448 restore: function (element, set) { 17449 var val, i = 0, length = set.length; 17450 for (; i < length; i++) { 17451 if (set[i] !== null) { 17452 val = element.data(dataSpace + set[i]); 17453 element.css(set[i], val); 17454 } 17455 } 17456 }, 17457 17458 setMode: function (el, mode) { 17459 if (mode === "toggle") { 17460 mode = el.is(":hidden") ? "show" : "hide"; 17461 } 17462 return mode; 17463 }, 17464
vendor: 9,628 bytes, lines 17465-17831
17465 // Wraps the element around a wrapper that copies position properties 17466 createWrapper: function (element) { 17467 17468 // If the element is already wrapped, return it 17469 if (element.parent().is(".ui-effects-wrapper")) { 17470 return element.parent(); 17471 } 17472 17473 // Wrap the element 17474 var props = { 17475 width: element.outerWidth(true), 17476 height: element.outerHeight(true), 17477 "float": element.css("float") 17478 }, 17479 wrapper = $("<div></div>") 17480 .addClass("ui-effects-wrapper") 17481 .css({ 17482 fontSize: "100%", 17483 background: "transparent", 17484 border: "none", 17485 margin: 0, 17486 padding: 0 17487 }), 17488 17489 // Store the size in case width/height are defined in % - Fixes #5245 17490 size = { 17491 width: element.width(), 17492 height: element.height() 17493 }, 17494 active = document.activeElement; 17495 17496 // Support: Firefox 17497 // Firefox incorrectly exposes anonymous content 17498 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 17499 try { 17500 // eslint-disable-next-line no-unused-expressions 17501 active.id; 17502 } catch (e) { 17503 active = document.body; 17504 } 17505 17506 element.wrap(wrapper); 17507 17508 // Fixes #7595 - Elements lose focus when wrapped. 17509 if (element[0] === active || $.contains(element[0], active)) { 17510 $(active).trigger("focus"); 17511 } 17512 17513 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 17514 // lose the reference to the wrapped element 17515 wrapper = element.parent(); 17516 17517 // Transfer positioning properties to the wrapper 17518 if (element.css("position") === "static") { 17519 wrapper.css({ position: "relative" }); 17520 element.css({ position: "relative" }); 17521 } else { 17522 $.extend(props, { 17523 position: element.css("position"), 17524 zIndex: element.css("z-index") 17525 }); 17526 $.each(["top", "left", "bottom", "right"], function (i, pos) { 17527 props[pos] = element.css(pos); 17528 if (isNaN(parseInt(props[pos], 10))) { 17529 props[pos] = "auto"; 17530 } 17531 }); 17532 element.css({ 17533 position: "relative", 17534 top: 0, 17535 left: 0, 17536 right: "auto", 17537 bottom: "auto" 17538 }); 17539 } 17540 element.css(size); 17541 17542 return wrapper.css(props).show(); 17543 }, 17544 17545 removeWrapper: function (element) { 17546 var active = document.activeElement; 17547 17548 if (element.parent().is(".ui-effects-wrapper")) { 17549 element.parent().replaceWith(element); 17550 17551 // Fixes #7595 - Elements lose focus when wrapped. 17552 if (element[0] === active || $.contains(element[0], active)) { 17553 $(active).trigger("focus"); 17554 } 17555 } 17556 17557 return element; 17558 } 17559 }); 17560 } 17561 17562 $.extend($.effects, { 17563 version: "1.13.2", 17564 17565 define: function (name, mode, effect) { 17566 if (!effect) { 17567 effect = mode; 17568 mode = "effect"; 17569 } 17570 17571 $.effects.effect[name] = effect; 17572 $.effects.effect[name].mode = mode; 17573 17574 return effect; 17575 }, 17576 17577 scaledDimensions: function (element, percent, direction) { 17578 if (percent === 0) { 17579 return { 17580 height: 0, 17581 width: 0, 17582 outerHeight: 0, 17583 outerWidth: 0 17584 }; 17585 } 17586 17587 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 17588 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 17589 17590 return { 17591 height: element.height() * y, 17592 width: element.width() * x, 17593 outerHeight: element.outerHeight() * y, 17594 outerWidth: element.outerWidth() * x 17595 }; 17596 17597 }, 17598 17599 clipToBox: function (animation) { 17600 return { 17601 width: animation.clip.right - animation.clip.left, 17602 height: animation.clip.bottom - animation.clip.top, 17603 left: animation.clip.left, 17604 top: animation.clip.top 17605 }; 17606 }, 17607 17608 // Injects recently queued functions to be first in line (after "inprogress") 17609 unshift: function (element, queueLength, count) { 17610 var queue = element.queue(); 17611 17612 if (queueLength > 1) { 17613 queue.splice.apply(queue, 17614 [1, 0].concat(queue.splice(queueLength, count))); 17615 } 17616 element.dequeue(); 17617 }, 17618 17619 saveStyle: function (element) { 17620 element.data(dataSpaceStyle, element[0].style.cssText); 17621 }, 17622 17623 restoreStyle: function (element) { 17624 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 17625 element.removeData(dataSpaceStyle); 17626 }, 17627 17628 mode: function (element, mode) { 17629 var hidden = element.is(":hidden"); 17630 17631 if (mode === "toggle") { 17632 mode = hidden ? "show" : "hide"; 17633 } 17634 if (hidden ? mode === "hide" : mode === "show") { 17635 mode = "none"; 17636 } 17637 return mode; 17638 }, 17639 17640 // Translates a [top,left] array into a baseline value 17641 getBaseline: function (origin, original) { 17642 var y, x; 17643 17644 switch (origin[0]) { 17645 case "top": 17646 y = 0; 17647 break; 17648 case "middle": 17649 y = 0.5; 17650 break; 17651 case "bottom": 17652 y = 1; 17653 break; 17654 default: 17655 y = origin[0] / original.height; 17656 } 17657 17658 switch (origin[1]) { 17659 case "left": 17660 x = 0; 17661 break; 17662 case "center": 17663 x = 0.5; 17664 break; 17665 case "right": 17666 x = 1; 17667 break; 17668 default: 17669 x = origin[1] / original.width; 17670 } 17671 17672 return { 17673 x: x, 17674 y: y 17675 }; 17676 }, 17677 17678 // Creates a placeholder element so that the original element can be made absolute 17679 createPlaceholder: function (element) { 17680 var placeholder, 17681 cssPosition = element.css("position"), 17682 position = element.position(); 17683 17684 // Lock in margins first to account for form elements, which 17685 // will change margin if you explicitly set height 17686 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 17687 // Support: Safari 17688 element.css({ 17689 marginTop: element.css("marginTop"), 17690 marginBottom: element.css("marginBottom"), 17691 marginLeft: element.css("marginLeft"), 17692 marginRight: element.css("marginRight") 17693 }) 17694 .outerWidth(element.outerWidth()) 17695 .outerHeight(element.outerHeight()); 17696 17697 if (/^(static|relative)/.test(cssPosition)) { 17698 cssPosition = "absolute"; 17699 17700 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 17701 17702 // Convert inline to inline block to account for inline elements 17703 // that turn to inline block based on content (like img) 17704 display: /^(inline|ruby)/.test(element.css("display")) ? 17705 "inline-block" : 17706 "block", 17707 visibility: "hidden", 17708 17709 // Margins need to be set to account for margin collapse 17710 marginTop: element.css("marginTop"), 17711 marginBottom: element.css("marginBottom"), 17712 marginLeft: element.css("marginLeft"), 17713 marginRight: element.css("marginRight"), 17714 "float": element.css("float") 17715 }) 17716 .outerWidth(element.outerWidth()) 17717 .outerHeight(element.outerHeight()) 17718 .addClass("ui-effects-placeholder"); 17719 17720 element.data(dataSpace + "placeholder", placeholder); 17721 } 17722 17723 element.css({ 17724 position: cssPosition, 17725 left: position.left, 17726 top: position.top 17727 }); 17728 17729 return placeholder; 17730 }, 17731 17732 removePlaceholder: function (element) { 17733 var dataKey = dataSpace + "placeholder", 17734 placeholder = element.data(dataKey); 17735 17736 if (placeholder) { 17737 placeholder.remove(); 17738 element.removeData(dataKey); 17739 } 17740 }, 17741 17742 // Removes a placeholder if it exists and restores 17743 // properties that were modified during placeholder creation 17744 cleanUp: function (element) { 17745 $.effects.restoreStyle(element); 17746 $.effects.removePlaceholder(element); 17747 }, 17748 17749 setTransition: function (element, list, factor, value) { 17750 value = value || {}; 17751 $.each(list, function (i, x) { 17752 var unit = element.cssUnit(x); 17753 if (unit[0] > 0) { 17754 value[x] = unit[0] * factor + unit[1]; 17755 } 17756 }); 17757 return value; 17758 } 17759 }); 17760 17761 // Return an effect options object for the given parameters: 17762 function _normalizeArguments(effect, options, speed, callback) { 17763 17764 // Allow passing all options as the first parameter 17765 if ($.isPlainObject(effect)) { 17766 options = effect; 17767 effect = effect.effect; 17768 } 17769 17770 // Convert to an object 17771 effect = { effect: effect }; 17772 17773 // Catch (effect, null, ...) 17774 if (options == null) { 17775 options = {}; 17776 } 17777 17778 // Catch (effect, callback) 17779 if (typeof options === "function") { 17780 callback = options; 17781 speed = null; 17782 options = {}; 17783 } 17784 17785 // Catch (effect, speed, ?) 17786 if (typeof options === "number" || $.fx.speeds[options]) { 17787 callback = speed; 17788 speed = options; 17789 options = {}; 17790 } 17791 17792 // Catch (effect, options, callback) 17793 if (typeof speed === "function") { 17794 callback = speed; 17795 speed = null; 17796 } 17797 17798 // Add options to effect 17799 if (options) { 17800 $.extend(effect, options); 17801 } 17802 17803 speed = speed || options.duration; 17804 effect.duration = $.fx.off ? 0 : 17805 typeof speed === "number" ? speed : 17806 speed in $.fx.speeds ? $.fx.speeds[speed] : 17807 $.fx.speeds._default; 17808 17809 effect.complete = callback || options.complete; 17810 17811 return effect; 17812 } 17813 17814 function standardAnimationOption(option) { 17815 17816 // Valid standard speeds (nothing, number, named speed) 17817 if (!option || typeof option === "number" || $.fx.speeds[option]) { 17818 return true; 17819 } 17820 17821 // Invalid strings - treat as "normal" speed 17822 if (typeof option === "string" && !$.effects.effect[option]) { 17823 return true; 17824 } 17825 17826 // Complete callback 17827 if (typeof option === "function") { 17828 return true; 17829 } 17830 17831 // Options hash (but not naming an effect)
vendor: 5,140 bytes, lines 17832-18015
17832 if (typeof option === "object" && !option.effect) { 17833 return true; 17834 } 17835 17836 // Didn't match any standard API 17837 return false; 17838 } 17839 17840 $.fn.extend({ 17841 effect: function ( /* effect, options, speed, callback */) { 17842 var args = _normalizeArguments.apply(this, arguments), 17843 effectMethod = $.effects.effect[args.effect], 17844 defaultMode = effectMethod.mode, 17845 queue = args.queue, 17846 queueName = queue || "fx", 17847 complete = args.complete, 17848 mode = args.mode, 17849 modes = [], 17850 prefilter = function (next) { 17851 var el = $(this), 17852 normalizedMode = $.effects.mode(el, mode) || defaultMode; 17853 17854 // Sentinel for duck-punching the :animated pseudo-selector 17855 el.data(dataSpaceAnimated, true); 17856 17857 // Save effect mode for later use, 17858 // we can't just call $.effects.mode again later, 17859 // as the .show() below destroys the initial state 17860 modes.push(normalizedMode); 17861 17862 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 17863 if (defaultMode && (normalizedMode === "show" || 17864 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 17865 el.show(); 17866 } 17867 17868 if (!defaultMode || normalizedMode !== "none") { 17869 $.effects.saveStyle(el); 17870 } 17871 17872 if (typeof next === "function") { 17873 next(); 17874 } 17875 }; 17876 17877 if ($.fx.off || !effectMethod) { 17878 17879 // Delegate to the original method (e.g., .show()) if possible 17880 if (mode) { 17881 return this[mode](args.duration, complete); 17882 } else { 17883 return this.each(function () { 17884 if (complete) { 17885 complete.call(this); 17886 } 17887 }); 17888 } 17889 } 17890 17891 function run(next) { 17892 var elem = $(this); 17893 17894 function cleanup() { 17895 elem.removeData(dataSpaceAnimated); 17896 17897 $.effects.cleanUp(elem); 17898 17899 if (args.mode === "hide") { 17900 elem.hide(); 17901 } 17902 17903 done(); 17904 } 17905 17906 function done() { 17907 if (typeof complete === "function") { 17908 complete.call(elem[0]); 17909 } 17910 17911 if (typeof next === "function") { 17912 next(); 17913 } 17914 } 17915 17916 // Override mode option on a per element basis, 17917 // as toggle can be either show or hide depending on element state 17918 args.mode = modes.shift(); 17919 17920 if ($.uiBackCompat !== false && !defaultMode) { 17921 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 17922 17923 // Call the core method to track "olddisplay" properly 17924 elem[mode](); 17925 done(); 17926 } else { 17927 effectMethod.call(elem[0], args, done); 17928 } 17929 } else { 17930 if (args.mode === "none") { 17931 17932 // Call the core method to track "olddisplay" properly 17933 elem[mode](); 17934 done(); 17935 } else { 17936 effectMethod.call(elem[0], args, cleanup); 17937 } 17938 } 17939 } 17940 17941 // Run prefilter on all elements first to ensure that 17942 // any showing or hiding happens before placeholder creation, 17943 // which ensures that any layout changes are correctly captured. 17944 return queue === false ? 17945 this.each(prefilter).each(run) : 17946 this.queue(queueName, prefilter).queue(queueName, run); 17947 }, 17948 17949 show: (function (orig) { 17950 return function (option) { 17951 if (standardAnimationOption(option)) { 17952 return orig.apply(this, arguments); 17953 } else { 17954 var args = _normalizeArguments.apply(this, arguments); 17955 args.mode = "show"; 17956 return this.effect.call(this, args); 17957 } 17958 }; 17959 })($.fn.show), 17960 17961 hide: (function (orig) { 17962 return function (option) { 17963 if (standardAnimationOption(option)) { 17964 return orig.apply(this, arguments); 17965 } else { 17966 var args = _normalizeArguments.apply(this, arguments); 17967 args.mode = "hide"; 17968 return this.effect.call(this, args); 17969 } 17970 }; 17971 })($.fn.hide), 17972 17973 toggle: (function (orig) { 17974 return function (option) { 17975 if (standardAnimationOption(option) || typeof option === "boolean") { 17976 return orig.apply(this, arguments); 17977 } else { 17978 var args = _normalizeArguments.apply(this, arguments); 17979 args.mode = "toggle"; 17980 return this.effect.call(this, args); 17981 } 17982 }; 17983 })($.fn.toggle), 17984 17985 cssUnit: function (key) { 17986 var style = this.css(key), 17987 val = []; 17988 17989 $.each(["em", "px", "%", "pt"], function (i, unit) { 17990 if (style.indexOf(unit) > 0) { 17991 val = [parseFloat(style), unit]; 17992 } 17993 }); 17994 return val; 17995 }, 17996 17997 cssClip: function (clipObj) { 17998 if (clipObj) { 17999 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 18000 clipObj.bottom + "px " + clipObj.left + "px)"); 18001 } 18002 return parseClip(this.css("clip"), this); 18003 }, 18004 18005 transfer: function (options, done) { 18006 var element = $(this), 18007 target = $(options.to), 18008 targetFixed = target.css("position") === "fixed", 18009 body = $("body"), 18010 fixTop = targetFixed ? body.scrollTop() : 0, 18011 fixLeft = targetFixed ? body.scrollLeft() : 0, 18012 endPosition = target.offset(), 18013 animation = { 18014 top: endPosition.top - fixTop, 18015 left: endPosition.left - fixLeft,
vendor: 26,620 bytes, lines 18016-18982
18016 height: target.innerHeight(), 18017 width: target.innerWidth() 18018 }, 18019 startPosition = element.offset(), 18020 transfer = $("<div class='ui-effects-transfer'></div>"); 18021 18022 transfer 18023 .appendTo("body") 18024 .addClass(options.className) 18025 .css({ 18026 top: startPosition.top - fixTop, 18027 left: startPosition.left - fixLeft, 18028 height: element.innerHeight(), 18029 width: element.innerWidth(), 18030 position: targetFixed ? "fixed" : "absolute" 18031 }) 18032 .animate(animation, options.duration, options.easing, function () { 18033 transfer.remove(); 18034 if (typeof done === "function") { 18035 done(); 18036 } 18037 }); 18038 } 18039 }); 18040 18041 function parseClip(str, element) { 18042 var outerWidth = element.outerWidth(), 18043 outerHeight = element.outerHeight(), 18044 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 18045 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 18046 18047 return { 18048 top: parseFloat(values[1]) || 0, 18049 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 18050 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 18051 left: parseFloat(values[4]) || 0 18052 }; 18053 } 18054 18055 $.fx.step.clip = function (fx) { 18056 if (!fx.clipInit) { 18057 fx.start = $(fx.elem).cssClip(); 18058 if (typeof fx.end === "string") { 18059 fx.end = parseClip(fx.end, fx.elem); 18060 } 18061 fx.clipInit = true; 18062 } 18063 18064 $(fx.elem).cssClip({ 18065 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 18066 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 18067 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 18068 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 18069 }); 18070 }; 18071 18072 })(); 18073 18074 /******************************************************************************/ 18075 /*********************************** EASING ***********************************/ 18076 /******************************************************************************/ 18077 18078 (function () { 18079 18080 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 18081 18082 var baseEasings = {}; 18083 18084 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 18085 baseEasings[name] = function (p) { 18086 return Math.pow(p, i + 2); 18087 }; 18088 }); 18089 18090 $.extend(baseEasings, { 18091 Sine: function (p) { 18092 return 1 - Math.cos(p * Math.PI / 2); 18093 }, 18094 Circ: function (p) { 18095 return 1 - Math.sqrt(1 - p * p); 18096 }, 18097 Elastic: function (p) { 18098 return p === 0 || p === 1 ? p : 18099 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 18100 }, 18101 Back: function (p) { 18102 return p * p * (3 * p - 2); 18103 }, 18104 Bounce: function (p) { 18105 var pow2, 18106 bounce = 4; 18107 18108 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 18109 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 18110 } 18111 }); 18112 18113 $.each(baseEasings, function (name, easeIn) { 18114 $.easing["easeIn" + name] = easeIn; 18115 $.easing["easeOut" + name] = function (p) { 18116 return 1 - easeIn(1 - p); 18117 }; 18118 $.easing["easeInOut" + name] = function (p) { 18119 return p < 0.5 ? 18120 easeIn(p * 2) / 2 : 18121 1 - easeIn(p * -2 + 2) / 2; 18122 }; 18123 }); 18124 18125 })(); 18126 18127 var effect = $.effects; 18128 18129 18130 /*! 18131 * jQuery UI Effects Blind 1.13.2 18132 * http://jqueryui.com 18133 * 18134 * Copyright jQuery Foundation and other contributors 18135 * Released under the MIT license. 18136 * http://jquery.org/license 18137 */ 18138 18139 //>>label: Blind Effect 18140 //>>group: Effects 18141 //>>description: Blinds the element. 18142 //>>docs: http://api.jqueryui.com/blind-effect/ 18143 //>>demos: http://jqueryui.com/effect/ 18144 18145 18146 var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) { 18147 var map = { 18148 up: ["bottom", "top"], 18149 vertical: ["bottom", "top"], 18150 down: ["top", "bottom"], 18151 left: ["right", "left"], 18152 horizontal: ["right", "left"], 18153 right: ["left", "right"] 18154 }, 18155 element = $(this), 18156 direction = options.direction || "up", 18157 start = element.cssClip(), 18158 animate = { clip: $.extend({}, start) }, 18159 placeholder = $.effects.createPlaceholder(element); 18160 18161 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 18162 18163 if (options.mode === "show") { 18164 element.cssClip(animate.clip); 18165 if (placeholder) { 18166 placeholder.css($.effects.clipToBox(animate)); 18167 } 18168 18169 animate.clip = start; 18170 } 18171 18172 if (placeholder) { 18173 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 18174 } 18175 18176 element.animate(animate, { 18177 queue: false, 18178 duration: options.duration, 18179 easing: options.easing, 18180 complete: done 18181 }); 18182 }); 18183 18184 18185 /*! 18186 * jQuery UI Effects Bounce 1.13.2 18187 * http://jqueryui.com 18188 * 18189 * Copyright jQuery Foundation and other contributors 18190 * Released under the MIT license. 18191 * http://jquery.org/license 18192 */ 18193 18194 //>>label: Bounce Effect 18195 //>>group: Effects 18196 //>>description: Bounces an element horizontally or vertically n times. 18197 //>>docs: http://api.jqueryui.com/bounce-effect/ 18198 //>>demos: http://jqueryui.com/effect/ 18199 18200 18201 var effectsEffectBounce = $.effects.define("bounce", function (options, done) { 18202 var upAnim, downAnim, refValue, 18203 element = $(this), 18204 18205 // Defaults: 18206 mode = options.mode, 18207 hide = mode === "hide", 18208 show = mode === "show", 18209 direction = options.direction || "up", 18210 distance = options.distance, 18211 times = options.times || 5, 18212 18213 // Number of internal animations 18214 anims = times * 2 + (show || hide ? 1 : 0), 18215 speed = options.duration / anims, 18216 easing = options.easing, 18217 18218 // Utility: 18219 ref = (direction === "up" || direction === "down") ? "top" : "left", 18220 motion = (direction === "up" || direction === "left"), 18221 i = 0, 18222 18223 queuelen = element.queue().length; 18224 18225 $.effects.createPlaceholder(element); 18226 18227 refValue = element.css(ref); 18228 18229 // Default distance for the BIGGEST bounce is the outer Distance / 3 18230 if (!distance) { 18231 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 18232 } 18233 18234 if (show) { 18235 downAnim = { opacity: 1 }; 18236 downAnim[ref] = refValue; 18237 18238 // If we are showing, force opacity 0 and set the initial position 18239 // then do the "first" animation 18240 element 18241 .css("opacity", 0) 18242 .css(ref, motion ? -distance * 2 : distance * 2) 18243 .animate(downAnim, speed, easing); 18244 } 18245 18246 // Start at the smallest distance if we are hiding 18247 if (hide) { 18248 distance = distance / Math.pow(2, times - 1); 18249 } 18250 18251 downAnim = {}; 18252 downAnim[ref] = refValue; 18253 18254 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 18255 for (; i < times; i++) { 18256 upAnim = {}; 18257 upAnim[ref] = (motion ? "-=" : "+=") + distance; 18258 18259 element 18260 .animate(upAnim, speed, easing) 18261 .animate(downAnim, speed, easing); 18262 18263 distance = hide ? distance * 2 : distance / 2; 18264 } 18265 18266 // Last Bounce when Hiding 18267 if (hide) { 18268 upAnim = { opacity: 0 }; 18269 upAnim[ref] = (motion ? "-=" : "+=") + distance; 18270 18271 element.animate(upAnim, speed, easing); 18272 } 18273 18274 element.queue(done); 18275 18276 $.effects.unshift(element, queuelen, anims + 1); 18277 }); 18278 18279 18280 /*! 18281 * jQuery UI Effects Clip 1.13.2 18282 * http://jqueryui.com 18283 * 18284 * Copyright jQuery Foundation and other contributors 18285 * Released under the MIT license. 18286 * http://jquery.org/license 18287 */ 18288 18289 //>>label: Clip Effect 18290 //>>group: Effects 18291 //>>description: Clips the element on and off like an old TV. 18292 //>>docs: http://api.jqueryui.com/clip-effect/ 18293 //>>demos: http://jqueryui.com/effect/ 18294 18295 18296 var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) { 18297 var start, 18298 animate = {}, 18299 element = $(this), 18300 direction = options.direction || "vertical", 18301 both = direction === "both", 18302 horizontal = both || direction === "horizontal", 18303 vertical = both || direction === "vertical"; 18304 18305 start = element.cssClip(); 18306 animate.clip = { 18307 top: vertical ? (start.bottom - start.top) / 2 : start.top, 18308 right: horizontal ? (start.right - start.left) / 2 : start.right, 18309 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 18310 left: horizontal ? (start.right - start.left) / 2 : start.left 18311 }; 18312 18313 $.effects.createPlaceholder(element); 18314 18315 if (options.mode === "show") { 18316 element.cssClip(animate.clip); 18317 animate.clip = start; 18318 } 18319 18320 element.animate(animate, { 18321 queue: false, 18322 duration: options.duration, 18323 easing: options.easing, 18324 complete: done 18325 }); 18326 18327 }); 18328 18329 18330 /*! 18331 * jQuery UI Effects Drop 1.13.2 18332 * http://jqueryui.com 18333 * 18334 * Copyright jQuery Foundation and other contributors 18335 * Released under the MIT license. 18336 * http://jquery.org/license 18337 */ 18338 18339 //>>label: Drop Effect 18340 //>>group: Effects 18341 //>>description: Moves an element in one direction and hides it at the same time. 18342 //>>docs: http://api.jqueryui.com/drop-effect/ 18343 //>>demos: http://jqueryui.com/effect/ 18344 18345 18346 var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) { 18347 18348 var distance, 18349 element = $(this), 18350 mode = options.mode, 18351 show = mode === "show", 18352 direction = options.direction || "left", 18353 ref = (direction === "up" || direction === "down") ? "top" : "left", 18354 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 18355 oppositeMotion = (motion === "+=") ? "-=" : "+=", 18356 animation = { 18357 opacity: 0 18358 }; 18359 18360 $.effects.createPlaceholder(element); 18361 18362 distance = options.distance || 18363 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 18364 18365 animation[ref] = motion + distance; 18366 18367 if (show) { 18368 element.css(animation); 18369 18370 animation[ref] = oppositeMotion + distance; 18371 animation.opacity = 1; 18372 } 18373 18374 // Animate 18375 element.animate(animation, { 18376 queue: false, 18377 duration: options.duration, 18378 easing: options.easing, 18379 complete: done 18380 }); 18381 }); 18382 18383 18384 /*! 18385 * jQuery UI Effects Explode 1.13.2 18386 * http://jqueryui.com 18387 * 18388 * Copyright jQuery Foundation and other contributors 18389 * Released under the MIT license. 18390 * http://jquery.org/license 18391 */ 18392 18393 //>>label: Explode Effect 18394 //>>group: Effects 18395 /* eslint-disable max-len */ 18396 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 18397 /* eslint-enable max-len */ 18398 //>>docs: http://api.jqueryui.com/explode-effect/ 18399 //>>demos: http://jqueryui.com/effect/ 18400 18401 18402 var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) { 18403 18404 var i, j, left, top, mx, my, 18405 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 18406 cells = rows, 18407 element = $(this), 18408 mode = options.mode, 18409 show = mode === "show", 18410 18411 // Show and then visibility:hidden the element before calculating offset 18412 offset = element.show().css("visibility", "hidden").offset(), 18413 18414 // Width and height of a piece 18415 width = Math.ceil(element.outerWidth() / cells), 18416 height = Math.ceil(element.outerHeight() / rows), 18417 pieces = []; 18418 18419 // Children animate complete: 18420 function childComplete() { 18421 pieces.push(this); 18422 if (pieces.length === rows * cells) { 18423 animComplete(); 18424 } 18425 } 18426 18427 // Clone the element for each row and cell. 18428 for (i = 0; i < rows; i++) { // ===> 18429 top = offset.top + i * height; 18430 my = i - (rows - 1) / 2; 18431 18432 for (j = 0; j < cells; j++) { // ||| 18433 left = offset.left + j * width; 18434 mx = j - (cells - 1) / 2; 18435 18436 // Create a clone of the now hidden main element that will be absolute positioned 18437 // within a wrapper div off the -left and -top equal to size of our pieces 18438 element 18439 .clone() 18440 .appendTo("body") 18441 .wrap("<div></div>") 18442 .css({ 18443 position: "absolute", 18444 visibility: "visible", 18445 left: -j * width, 18446 top: -i * height 18447 }) 18448 18449 // Select the wrapper - make it overflow: hidden and absolute positioned based on 18450 // where the original was located +left and +top equal to the size of pieces 18451 .parent() 18452 .addClass("ui-effects-explode") 18453 .css({ 18454 position: "absolute", 18455 overflow: "hidden", 18456 width: width, 18457 height: height, 18458 left: left + (show ? mx * width : 0), 18459 top: top + (show ? my * height : 0), 18460 opacity: show ? 0 : 1 18461 }) 18462 .animate({ 18463 left: left + (show ? 0 : mx * width), 18464 top: top + (show ? 0 : my * height), 18465 opacity: show ? 1 : 0 18466 }, options.duration || 500, options.easing, childComplete); 18467 } 18468 } 18469 18470 function animComplete() { 18471 element.css({ 18472 visibility: "visible" 18473 }); 18474 $(pieces).remove(); 18475 done(); 18476 } 18477 }); 18478 18479 18480 /*! 18481 * jQuery UI Effects Fade 1.13.2 18482 * http://jqueryui.com 18483 * 18484 * Copyright jQuery Foundation and other contributors 18485 * Released under the MIT license. 18486 * http://jquery.org/license 18487 */ 18488 18489 //>>label: Fade Effect 18490 //>>group: Effects 18491 //>>description: Fades the element. 18492 //>>docs: http://api.jqueryui.com/fade-effect/ 18493 //>>demos: http://jqueryui.com/effect/ 18494 18495 18496 var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) { 18497 var show = options.mode === "show"; 18498 18499 $(this) 18500 .css("opacity", show ? 0 : 1) 18501 .animate({ 18502 opacity: show ? 1 : 0 18503 }, { 18504 queue: false, 18505 duration: options.duration, 18506 easing: options.easing, 18507 complete: done 18508 }); 18509 }); 18510 18511 18512 /*! 18513 * jQuery UI Effects Fold 1.13.2 18514 * http://jqueryui.com 18515 * 18516 * Copyright jQuery Foundation and other contributors 18517 * Released under the MIT license. 18518 * http://jquery.org/license 18519 */ 18520 18521 //>>label: Fold Effect 18522 //>>group: Effects 18523 //>>description: Folds an element first horizontally and then vertically. 18524 //>>docs: http://api.jqueryui.com/fold-effect/ 18525 //>>demos: http://jqueryui.com/effect/ 18526 18527 18528 var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) { 18529 18530 // Create element 18531 var element = $(this), 18532 mode = options.mode, 18533 show = mode === "show", 18534 hide = mode === "hide", 18535 size = options.size || 15, 18536 percent = /([0-9]+)%/.exec(size), 18537 horizFirst = !!options.horizFirst, 18538 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 18539 duration = options.duration / 2, 18540 18541 placeholder = $.effects.createPlaceholder(element), 18542 18543 start = element.cssClip(), 18544 animation1 = { clip: $.extend({}, start) }, 18545 animation2 = { clip: $.extend({}, start) }, 18546 18547 distance = [start[ref[0]], start[ref[1]]], 18548 18549 queuelen = element.queue().length; 18550 18551 if (percent) { 18552 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 18553 } 18554 animation1.clip[ref[0]] = size; 18555 animation2.clip[ref[0]] = size; 18556 animation2.clip[ref[1]] = 0; 18557 18558 if (show) { 18559 element.cssClip(animation2.clip); 18560 if (placeholder) { 18561 placeholder.css($.effects.clipToBox(animation2)); 18562 } 18563 18564 animation2.clip = start; 18565 } 18566 18567 // Animate 18568 element 18569 .queue(function (next) { 18570 if (placeholder) { 18571 placeholder 18572 .animate($.effects.clipToBox(animation1), duration, options.easing) 18573 .animate($.effects.clipToBox(animation2), duration, options.easing); 18574 } 18575 18576 next(); 18577 }) 18578 .animate(animation1, duration, options.easing) 18579 .animate(animation2, duration, options.easing) 18580 .queue(done); 18581 18582 $.effects.unshift(element, queuelen, 4); 18583 }); 18584 18585 18586 /*! 18587 * jQuery UI Effects Highlight 1.13.2 18588 * http://jqueryui.com 18589 * 18590 * Copyright jQuery Foundation and other contributors 18591 * Released under the MIT license. 18592 * http://jquery.org/license 18593 */ 18594 18595 //>>label: Highlight Effect 18596 //>>group: Effects 18597 //>>description: Highlights the background of an element in a defined color for a custom duration. 18598 //>>docs: http://api.jqueryui.com/highlight-effect/ 18599 //>>demos: http://jqueryui.com/effect/ 18600 18601 18602 var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) { 18603 var element = $(this), 18604 animation = { 18605 backgroundColor: element.css("backgroundColor") 18606 }; 18607 18608 if (options.mode === "hide") { 18609 animation.opacity = 0; 18610 } 18611 18612 $.effects.saveStyle(element); 18613 18614 element 18615 .css({ 18616 backgroundImage: "none", 18617 backgroundColor: options.color || "#ffff99" 18618 }) 18619 .animate(animation, { 18620 queue: false, 18621 duration: options.duration, 18622 easing: options.easing, 18623 complete: done 18624 }); 18625 }); 18626 18627 18628 /*! 18629 * jQuery UI Effects Size 1.13.2 18630 * http://jqueryui.com 18631 * 18632 * Copyright jQuery Foundation and other contributors 18633 * Released under the MIT license. 18634 * http://jquery.org/license 18635 */ 18636 18637 //>>label: Size Effect 18638 //>>group: Effects 18639 //>>description: Resize an element to a specified width and height. 18640 //>>docs: http://api.jqueryui.com/size-effect/ 18641 //>>demos: http://jqueryui.com/effect/ 18642 18643 18644 var effectsEffectSize = $.effects.define("size", function (options, done) { 18645 18646 // Create element 18647 var baseline, factor, temp, 18648 element = $(this), 18649 18650 // Copy for children 18651 cProps = ["fontSize"], 18652 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 18653 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 18654 18655 // Set options 18656 mode = options.mode, 18657 restore = mode !== "effect", 18658 scale = options.scale || "both", 18659 origin = options.origin || ["middle", "center"], 18660 position = element.css("position"), 18661 pos = element.position(), 18662 original = $.effects.scaledDimensions(element), 18663 from = options.from || original, 18664 to = options.to || $.effects.scaledDimensions(element, 0); 18665 18666 $.effects.createPlaceholder(element); 18667 18668 if (mode === "show") { 18669 temp = from; 18670 from = to; 18671 to = temp; 18672 } 18673 18674 // Set scaling factor 18675 factor = { 18676 from: { 18677 y: from.height / original.height, 18678 x: from.width / original.width 18679 }, 18680 to: { 18681 y: to.height / original.height, 18682 x: to.width / original.width 18683 } 18684 }; 18685 18686 // Scale the css box 18687 if (scale === "box" || scale === "both") { 18688 18689 // Vertical props scaling 18690 if (factor.from.y !== factor.to.y) { 18691 from = $.effects.setTransition(element, vProps, factor.from.y, from); 18692 to = $.effects.setTransition(element, vProps, factor.to.y, to); 18693 } 18694 18695 // Horizontal props scaling 18696 if (factor.from.x !== factor.to.x) { 18697 from = $.effects.setTransition(element, hProps, factor.from.x, from); 18698 to = $.effects.setTransition(element, hProps, factor.to.x, to); 18699 } 18700 } 18701 18702 // Scale the content 18703 if (scale === "content" || scale === "both") { 18704 18705 // Vertical props scaling 18706 if (factor.from.y !== factor.to.y) { 18707 from = $.effects.setTransition(element, cProps, factor.from.y, from); 18708 to = $.effects.setTransition(element, cProps, factor.to.y, to); 18709 } 18710 } 18711 18712 // Adjust the position properties based on the provided origin points 18713 if (origin) { 18714 baseline = $.effects.getBaseline(origin, original); 18715 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 18716 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 18717 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 18718 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 18719 } 18720 delete from.outerHeight; 18721 delete from.outerWidth; 18722 element.css(from); 18723 18724 // Animate the children if desired 18725 if (scale === "content" || scale === "both") { 18726 18727 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 18728 hProps = hProps.concat(["marginLeft", "marginRight"]); 18729 18730 // Only animate children with width attributes specified 18731 // TODO: is this right? should we include anything with css width specified as well 18732 element.find("*[width]").each(function () { 18733 var child = $(this), 18734 childOriginal = $.effects.scaledDimensions(child), 18735 childFrom = { 18736 height: childOriginal.height * factor.from.y, 18737 width: childOriginal.width * factor.from.x, 18738 outerHeight: childOriginal.outerHeight * factor.from.y, 18739 outerWidth: childOriginal.outerWidth * factor.from.x 18740 }, 18741 childTo = { 18742 height: childOriginal.height * factor.to.y, 18743 width: childOriginal.width * factor.to.x, 18744 outerHeight: childOriginal.height * factor.to.y, 18745 outerWidth: childOriginal.width * factor.to.x 18746 }; 18747 18748 // Vertical props scaling 18749 if (factor.from.y !== factor.to.y) { 18750 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 18751 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 18752 } 18753 18754 // Horizontal props scaling 18755 if (factor.from.x !== factor.to.x) { 18756 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 18757 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 18758 } 18759 18760 if (restore) { 18761 $.effects.saveStyle(child); 18762 } 18763 18764 // Animate children 18765 child.css(childFrom); 18766 child.animate(childTo, options.duration, options.easing, function () { 18767 18768 // Restore children 18769 if (restore) { 18770 $.effects.restoreStyle(child); 18771 } 18772 }); 18773 }); 18774 } 18775 18776 // Animate 18777 element.animate(to, { 18778 queue: false, 18779 duration: options.duration, 18780 easing: options.easing, 18781 complete: function () { 18782 18783 var offset = element.offset(); 18784 18785 if (to.opacity === 0) { 18786 element.css("opacity", from.opacity); 18787 } 18788 18789 if (!restore) { 18790 element 18791 .css("position", position === "static" ? "relative" : position) 18792 .offset(offset); 18793 18794 // Need to save style here so that automatic style restoration 18795 // doesn't restore to the original styles from before the animation. 18796 $.effects.saveStyle(element); 18797 } 18798 18799 done(); 18800 } 18801 }); 18802 18803 }); 18804 18805 18806 /*! 18807 * jQuery UI Effects Scale 1.13.2 18808 * http://jqueryui.com 18809 * 18810 * Copyright jQuery Foundation and other contributors 18811 * Released under the MIT license. 18812 * http://jquery.org/license 18813 */ 18814 18815 //>>label: Scale Effect 18816 //>>group: Effects 18817 //>>description: Grows or shrinks an element and its content. 18818 //>>docs: http://api.jqueryui.com/scale-effect/ 18819 //>>demos: http://jqueryui.com/effect/ 18820 18821 18822 var effectsEffectScale = $.effects.define("scale", function (options, done) { 18823 18824 // Create element 18825 var el = $(this), 18826 mode = options.mode, 18827 percent = parseInt(options.percent, 10) || 18828 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 18829 18830 newOptions = $.extend(true, { 18831 from: $.effects.scaledDimensions(el), 18832 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 18833 origin: options.origin || ["middle", "center"] 18834 }, options); 18835 18836 // Fade option to support puff 18837 if (options.fade) { 18838 newOptions.from.opacity = 1; 18839 newOptions.to.opacity = 0; 18840 } 18841 18842 $.effects.effect.size.call(this, newOptions, done); 18843 }); 18844 18845 18846 /*! 18847 * jQuery UI Effects Puff 1.13.2 18848 * http://jqueryui.com 18849 * 18850 * Copyright jQuery Foundation and other contributors 18851 * Released under the MIT license. 18852 * http://jquery.org/license 18853 */ 18854 18855 //>>label: Puff Effect 18856 //>>group: Effects 18857 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 18858 //>>docs: http://api.jqueryui.com/puff-effect/ 18859 //>>demos: http://jqueryui.com/effect/ 18860 18861 18862 var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) { 18863 var newOptions = $.extend(true, {}, options, { 18864 fade: true, 18865 percent: parseInt(options.percent, 10) || 150 18866 }); 18867 18868 $.effects.effect.scale.call(this, newOptions, done); 18869 }); 18870 18871 18872 /*! 18873 * jQuery UI Effects Pulsate 1.13.2 18874 * http://jqueryui.com 18875 * 18876 * Copyright jQuery Foundation and other contributors 18877 * Released under the MIT license. 18878 * http://jquery.org/license 18879 */ 18880 18881 //>>label: Pulsate Effect 18882 //>>group: Effects 18883 //>>description: Pulsates an element n times by changing the opacity to zero and back. 18884 //>>docs: http://api.jqueryui.com/pulsate-effect/ 18885 //>>demos: http://jqueryui.com/effect/ 18886 18887 18888 var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) { 18889 var element = $(this), 18890 mode = options.mode, 18891 show = mode === "show", 18892 hide = mode === "hide", 18893 showhide = show || hide, 18894 18895 // Showing or hiding leaves off the "last" animation 18896 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 18897 duration = options.duration / anims, 18898 animateTo = 0, 18899 i = 1, 18900 queuelen = element.queue().length; 18901 18902 if (show || !element.is(":visible")) { 18903 element.css("opacity", 0).show(); 18904 animateTo = 1; 18905 } 18906 18907 // Anims - 1 opacity "toggles" 18908 for (; i < anims; i++) { 18909 element.animate({ opacity: animateTo }, duration, options.easing); 18910 animateTo = 1 - animateTo; 18911 } 18912 18913 element.animate({ opacity: animateTo }, duration, options.easing); 18914 18915 element.queue(done); 18916 18917 $.effects.unshift(element, queuelen, anims + 1); 18918 }); 18919 18920 18921 /*! 18922 * jQuery UI Effects Shake 1.13.2 18923 * http://jqueryui.com 18924 * 18925 * Copyright jQuery Foundation and other contributors 18926 * Released under the MIT license. 18927 * http://jquery.org/license 18928 */ 18929 18930 //>>label: Shake Effect 18931 //>>group: Effects 18932 //>>description: Shakes an element horizontally or vertically n times. 18933 //>>docs: http://api.jqueryui.com/shake-effect/ 18934 //>>demos: http://jqueryui.com/effect/ 18935 18936 18937 var effectsEffectShake = $.effects.define("shake", function (options, done) { 18938 18939 var i = 1, 18940 element = $(this), 18941 direction = options.direction || "left", 18942 distance = options.distance || 20, 18943 times = options.times || 3, 18944 anims = times * 2 + 1, 18945 speed = Math.round(options.duration / anims), 18946 ref = (direction === "up" || direction === "down") ? "top" : "left", 18947 positiveMotion = (direction === "up" || direction === "left"), 18948 animation = {}, 18949 animation1 = {}, 18950 animation2 = {}, 18951 18952 queuelen = element.queue().length; 18953 18954 $.effects.createPlaceholder(element); 18955 18956 // Animation 18957 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 18958 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 18959 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 18960 18961 // Animate 18962 element.animate(animation, speed, options.easing); 18963 18964 // Shakes 18965 for (; i < times; i++) { 18966 element 18967 .animate(animation1, speed, options.easing) 18968 .animate(animation2, speed, options.easing); 18969 } 18970 18971 element 18972 .animate(animation1, speed, options.easing) 18973 .animate(animation, speed / 2, options.easing) 18974 .queue(done); 18975 18976 $.effects.unshift(element, queuelen, anims + 1); 18977 }); 18978 18979 18980 /*! 18981 * jQuery UI Effects Slide 1.13.2 18982 * http://jqueryui.com
vendor: 2,311 bytes, lines 18983-19068
18983 * 18984 * Copyright jQuery Foundation and other contributors 18985 * Released under the MIT license. 18986 * http://jquery.org/license 18987 */ 18988 18989 //>>label: Slide Effect 18990 //>>group: Effects 18991 //>>description: Slides an element in and out of the viewport. 18992 //>>docs: http://api.jqueryui.com/slide-effect/ 18993 //>>demos: http://jqueryui.com/effect/ 18994 18995 18996 var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) { 18997 var startClip, startRef, 18998 element = $(this), 18999 map = { 19000 up: ["bottom", "top"], 19001 down: ["top", "bottom"], 19002 left: ["right", "left"], 19003 right: ["left", "right"] 19004 }, 19005 mode = options.mode, 19006 direction = options.direction || "left", 19007 ref = (direction === "up" || direction === "down") ? "top" : "left", 19008 positiveMotion = (direction === "up" || direction === "left"), 19009 distance = options.distance || 19010 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 19011 animation = {}; 19012 19013 $.effects.createPlaceholder(element); 19014 19015 startClip = element.cssClip(); 19016 startRef = element.position()[ref]; 19017 19018 // Define hide animation 19019 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 19020 animation.clip = element.cssClip(); 19021 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 19022 19023 // Reverse the animation if we're showing 19024 if (mode === "show") { 19025 element.cssClip(animation.clip); 19026 element.css(ref, animation[ref]); 19027 animation.clip = startClip; 19028 animation[ref] = startRef; 19029 } 19030 19031 // Actually animate 19032 element.animate(animation, { 19033 queue: false, 19034 duration: options.duration, 19035 easing: options.easing, 19036 complete: done 19037 }); 19038 }); 19039 19040 19041 /*! 19042 * jQuery UI Effects Transfer 1.13.2 19043 * http://jqueryui.com 19044 * 19045 * Copyright jQuery Foundation and other contributors 19046 * Released under the MIT license. 19047 * http://jquery.org/license 19048 */ 19049 19050 //>>label: Transfer Effect 19051 //>>group: Effects 19052 //>>description: Displays a transfer effect from one element to another. 19053 //>>docs: http://api.jqueryui.com/transfer-effect/ 19054 //>>demos: http://jqueryui.com/effect/ 19055 19056 19057 var effect; 19058 if ($.uiBackCompat !== false) { 19059 effect = $.effects.define("transfer", function (options, done) { 19060 $(this).transfer(options, done); 19061 }); 19062 } 19063 var effectsEffectTransfer = effect; 19064 19065 19066 19067 19068});
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.