vendor: 5,563 bytes, lines 1-142
1/*! jQuery UI - v1.13.2 - 2022-07-14 2* http://jqueryui.com 3* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 4* Copyright 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: 35,808 bytes, lines 143-1093
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
vendor: 45,972 bytes, lines 1094-2366
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 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 // Create a local jQuery because jQuery Color relies on it and the 1331 // global may not exist with AMD and a custom build (#10199). 1332 // This module is a noop if used as a regular AMD module. 1333 // eslint-disable-next-line no-unused-vars 1334 var jQuery = $; 1335 1336 1337 /*! 1338 * jQuery Color Animations v2.2.0 1339 * https://github.com/jquery/jquery-color 1340 * 1341 * Copyright OpenJS Foundation and other contributors 1342 * Released under the MIT license. 1343 * http://jquery.org/license 1344 * 1345 * Date: Sun May 10 09:02:36 2020 +0200 1346 */ 1347 1348 1349 1350 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1351 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1352 1353 class2type = {}, 1354 toString = class2type.toString, 1355 1356 // plusequals test for += 100 -= 100 1357 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1358 1359 // a set of RE's that can match strings and generate color tuples. 1360 stringParsers = [{ 1361 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1362 parse: function (execResult) { 1363 return [ 1364 execResult[1], 1365 execResult[2], 1366 execResult[3], 1367 execResult[4] 1368 ]; 1369 } 1370 }, { 1371 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1372 parse: function (execResult) { 1373 return [ 1374 execResult[1] * 2.55, 1375 execResult[2] * 2.55, 1376 execResult[3] * 2.55, 1377 execResult[4] 1378 ]; 1379 } 1380 }, { 1381 1382 // this regex ignores A-F because it's compared against an already lowercased string 1383 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 1384 parse: function (execResult) { 1385 return [ 1386 parseInt(execResult[1], 16), 1387 parseInt(execResult[2], 16), 1388 parseInt(execResult[3], 16), 1389 execResult[4] ? 1390 (parseInt(execResult[4], 16) / 255).toFixed(2) : 1391 1 1392 ]; 1393 } 1394 }, { 1395 1396 // this regex ignores A-F because it's compared against an already lowercased string 1397 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 1398 parse: function (execResult) { 1399 return [ 1400 parseInt(execResult[1] + execResult[1], 16), 1401 parseInt(execResult[2] + execResult[2], 16), 1402 parseInt(execResult[3] + execResult[3], 16), 1403 execResult[4] ? 1404 (parseInt(execResult[4] + execResult[4], 16) / 255) 1405 .toFixed(2) : 1406 1 1407 ]; 1408 } 1409 }, { 1410 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1411 space: "hsla", 1412 parse: function (execResult) { 1413 return [ 1414 execResult[1], 1415 execResult[2] / 100, 1416 execResult[3] / 100, 1417 execResult[4] 1418 ]; 1419 } 1420 }], 1421 1422 // jQuery.Color( ) 1423 color = jQuery.Color = function (color, green, blue, alpha) { 1424 return new jQuery.Color.fn.parse(color, green, blue, alpha); 1425 }, 1426 spaces = { 1427 rgba: { 1428 props: { 1429 red: { 1430 idx: 0, 1431 type: "byte" 1432 }, 1433 green: { 1434 idx: 1, 1435 type: "byte" 1436 }, 1437 blue: { 1438 idx: 2, 1439 type: "byte" 1440 } 1441 } 1442 }, 1443 1444 hsla: { 1445 props: { 1446 hue: { 1447 idx: 0, 1448 type: "degrees" 1449 }, 1450 saturation: { 1451 idx: 1, 1452 type: "percent" 1453 }, 1454 lightness: { 1455 idx: 2, 1456 type: "percent" 1457 } 1458 } 1459 } 1460 }, 1461 propTypes = { 1462 "byte": { 1463 floor: true, 1464 max: 255 1465 }, 1466 "percent": { 1467 max: 1 1468 }, 1469 "degrees": { 1470 mod: 360, 1471 floor: true 1472 } 1473 }, 1474 support = color.support = {}, 1475 1476 // element for support tests 1477 supportElem = jQuery("<p>")[0], 1478 1479 // colors = jQuery.Color.names 1480 colors, 1481 1482 // local aliases of functions called often 1483 each = jQuery.each; 1484 1485 // determine rgba support immediately 1486 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1487 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 1488 1489 // define cache name and alpha properties 1490 // for rgba and hsla spaces 1491 each(spaces, function (spaceName, space) { 1492 space.cache = "_" + spaceName; 1493 space.props.alpha = { 1494 idx: 3, 1495 type: "percent", 1496 def: 1 1497 }; 1498 }); 1499 1500 // Populate the class2type map 1501 jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 1502 function (_i, name) { 1503 class2type["[object " + name + "]"] = name.toLowerCase(); 1504 }); 1505 1506 function getType(obj) { 1507 if (obj == null) { 1508 return obj + ""; 1509 } 1510 1511 return typeof obj === "object" ? 1512 class2type[toString.call(obj)] || "object" : 1513 typeof obj; 1514 } 1515 1516 function clamp(value, prop, allowEmpty) { 1517 var type = propTypes[prop.type] || {}; 1518 1519 if (value == null) { 1520 return (allowEmpty || !prop.def) ? null : prop.def; 1521 } 1522 1523 // ~~ is an short way of doing floor for positive numbers 1524 value = type.floor ? ~~value : parseFloat(value); 1525 1526 // IE will pass in empty strings as value for alpha, 1527 // which will hit this case 1528 if (isNaN(value)) { 1529 return prop.def; 1530 } 1531 1532 if (type.mod) { 1533 1534 // we add mod before modding to make sure that negatives values 1535 // get converted properly: -10 -> 350 1536 return (value + type.mod) % type.mod; 1537 } 1538 1539 // for now all property types without mod have min and max 1540 return Math.min(type.max, Math.max(0, value)); 1541 } 1542 1543 function stringParse(string) { 1544 var inst = color(), 1545 rgba = inst._rgba = []; 1546 1547 string = string.toLowerCase(); 1548 1549 each(stringParsers, function (_i, parser) { 1550 var parsed, 1551 match = parser.re.exec(string), 1552 values = match && parser.parse(match), 1553 spaceName = parser.space || "rgba"; 1554 1555 if (values) { 1556 parsed = inst[spaceName](values); 1557 1558 // if this was an rgba parse the assignment might happen twice 1559 // oh well.... 1560 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 1561 rgba = inst._rgba = parsed._rgba; 1562 1563 // exit each( stringParsers ) here because we matched 1564 return false; 1565 } 1566 }); 1567 1568 // Found a stringParser that handled it 1569 if (rgba.length) { 1570 1571 // if this came from a parsed string, force "transparent" when alpha is 0 1572 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 1573 if (rgba.join() === "0,0,0,0") { 1574 jQuery.extend(rgba, colors.transparent); 1575 } 1576 return inst; 1577 } 1578 1579 // named colors 1580 return colors[string]; 1581 } 1582 1583 color.fn = jQuery.extend(color.prototype, { 1584 parse: function (red, green, blue, alpha) { 1585 if (red === undefined) { 1586 this._rgba = [null, null, null, null]; 1587 return this; 1588 } 1589 if (red.jquery || red.nodeType) { 1590 red = jQuery(red).css(green); 1591 green = undefined; 1592 } 1593 1594 var inst = this, 1595 type = getType(red), 1596 rgba = this._rgba = []; 1597 1598 // more than 1 argument specified - assume ( red, green, blue, alpha ) 1599 if (green !== undefined) { 1600 red = [red, green, blue, alpha]; 1601 type = "array"; 1602 } 1603 1604 if (type === "string") { 1605 return this.parse(stringParse(red) || colors._default); 1606 } 1607 1608 if (type === "array") { 1609 each(spaces.rgba.props, function (_key, prop) { 1610 rgba[prop.idx] = clamp(red[prop.idx], prop); 1611 }); 1612 return this; 1613 } 1614 1615 if (type === "object") { 1616 if (red instanceof color) { 1617 each(spaces, function (_spaceName, space) { 1618 if (red[space.cache]) { 1619 inst[space.cache] = red[space.cache].slice(); 1620 } 1621 }); 1622 } else { 1623 each(spaces, function (_spaceName, space) { 1624 var cache = space.cache; 1625 each(space.props, function (key, prop) { 1626 1627 // if the cache doesn't exist, and we know how to convert 1628 if (!inst[cache] && space.to) { 1629 1630 // if the value was null, we don't need to copy it 1631 // if the key was alpha, we don't need to copy it either 1632 if (key === "alpha" || red[key] == null) { 1633 return; 1634 } 1635 inst[cache] = space.to(inst._rgba); 1636 } 1637 1638 // this is the only case where we allow nulls for ALL properties. 1639 // call clamp with alwaysAllowEmpty 1640 inst[cache][prop.idx] = clamp(red[key], prop, true); 1641 }); 1642 1643 // everything defined but alpha? 1644 if (inst[cache] && jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 1645 1646 // use the default of 1 1647 if (inst[cache][3] == null) { 1648 inst[cache][3] = 1; 1649 } 1650 1651 if (space.from) { 1652 inst._rgba = space.from(inst[cache]); 1653 } 1654 } 1655 }); 1656 } 1657 return this; 1658 } 1659 }, 1660 is: function (compare) { 1661 var is = color(compare), 1662 same = true, 1663 inst = this; 1664 1665 each(spaces, function (_, space) { 1666 var localCache, 1667 isCache = is[space.cache]; 1668 if (isCache) { 1669 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 1670 each(space.props, function (_, prop) { 1671 if (isCache[prop.idx] != null) { 1672 same = (isCache[prop.idx] === localCache[prop.idx]); 1673 return same; 1674 } 1675 }); 1676 } 1677 return same; 1678 }); 1679 return same; 1680 }, 1681 _space: function () { 1682 var used = [], 1683 inst = this; 1684 each(spaces, function (spaceName, space) { 1685 if (inst[space.cache]) { 1686 used.push(spaceName); 1687 } 1688 }); 1689 return used.pop(); 1690 }, 1691 transition: function (other, distance) { 1692 var end = color(other), 1693 spaceName = end._space(), 1694 space = spaces[spaceName], 1695 startColor = this.alpha() === 0 ? color("transparent") : this, 1696 start = startColor[space.cache] || space.to(startColor._rgba), 1697 result = start.slice(); 1698 1699 end = end[space.cache]; 1700 each(space.props, function (_key, prop) { 1701 var index = prop.idx, 1702 startValue = start[index], 1703 endValue = end[index], 1704 type = propTypes[prop.type] || {}; 1705 1706 // if null, don't override start value 1707 if (endValue === null) { 1708 return; 1709 } 1710 1711 // if null - use end 1712 if (startValue === null) { 1713 result[index] = endValue; 1714 } else { 1715 if (type.mod) { 1716 if (endValue - startValue > type.mod / 2) { 1717 startValue += type.mod; 1718 } else if (startValue - endValue > type.mod / 2) { 1719 startValue -= type.mod; 1720 } 1721 } 1722 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 1723 } 1724 }); 1725 return this[spaceName](result); 1726 }, 1727 blend: function (opaque) { 1728 1729 // if we are already opaque - return ourself 1730 if (this._rgba[3] === 1) { 1731 return this; 1732 } 1733 1734 var rgb = this._rgba.slice(), 1735 a = rgb.pop(), 1736 blend = color(opaque)._rgba; 1737 1738 return color(jQuery.map(rgb, function (v, i) { 1739 return (1 - a) * blend[i] + a * v; 1740 })); 1741 }, 1742 toRgbaString: function () { 1743 var prefix = "rgba(", 1744 rgba = jQuery.map(this._rgba, function (v, i) { 1745 if (v != null) { 1746 return v; 1747 } 1748 return i > 2 ? 1 : 0; 1749 }); 1750 1751 if (rgba[3] === 1) { 1752 rgba.pop(); 1753 prefix = "rgb("; 1754 } 1755 1756 return prefix + rgba.join() + ")"; 1757 }, 1758 toHslaString: function () { 1759 var prefix = "hsla(", 1760 hsla = jQuery.map(this.hsla(), function (v, i) { 1761 if (v == null) { 1762 v = i > 2 ? 1 : 0; 1763 } 1764 1765 // catch 1 and 2 1766 if (i && i < 3) { 1767 v = Math.round(v * 100) + "%"; 1768 } 1769 return v; 1770 }); 1771 1772 if (hsla[3] === 1) { 1773 hsla.pop(); 1774 prefix = "hsl("; 1775 } 1776 return prefix + hsla.join() + ")"; 1777 }, 1778 toHexString: function (includeAlpha) { 1779 var rgba = this._rgba.slice(), 1780 alpha = rgba.pop(); 1781 1782 if (includeAlpha) { 1783 rgba.push(~~(alpha * 255)); 1784 } 1785 1786 return "#" + jQuery.map(rgba, function (v) { 1787 1788 // default to 0 when nulls exist 1789 v = (v || 0).toString(16); 1790 return v.length === 1 ? "0" + v : v; 1791 }).join(""); 1792 }, 1793 toString: function () { 1794 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 1795 } 1796 }); 1797 color.fn.parse.prototype = color.fn; 1798 1799 // hsla conversions adapted from: 1800 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 1801 1802 function hue2rgb(p, q, h) { 1803 h = (h + 1) % 1; 1804 if (h * 6 < 1) { 1805 return p + (q - p) * h * 6; 1806 } 1807 if (h * 2 < 1) { 1808 return q; 1809 } 1810 if (h * 3 < 2) { 1811 return p + (q - p) * ((2 / 3) - h) * 6; 1812 } 1813 return p; 1814 } 1815 1816 spaces.hsla.to = function (rgba) { 1817 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 1818 return [null, null, null, rgba[3]]; 1819 } 1820 var r = rgba[0] / 255, 1821 g = rgba[1] / 255, 1822 b = rgba[2] / 255, 1823 a = rgba[3], 1824 max = Math.max(r, g, b), 1825 min = Math.min(r, g, b), 1826 diff = max - min, 1827 add = max + min, 1828 l = add * 0.5, 1829 h, s; 1830 1831 if (min === max) { 1832 h = 0; 1833 } else if (r === max) { 1834 h = (60 * (g - b) / diff) + 360; 1835 } else if (g === max) { 1836 h = (60 * (b - r) / diff) + 120; 1837 } else { 1838 h = (60 * (r - g) / diff) + 240; 1839 } 1840 1841 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 1842 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 1843 if (diff === 0) { 1844 s = 0; 1845 } else if (l <= 0.5) { 1846 s = diff / add; 1847 } else { 1848 s = diff / (2 - add); 1849 } 1850 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 1851 }; 1852 1853 spaces.hsla.from = function (hsla) { 1854 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 1855 return [null, null, null, hsla[3]]; 1856 } 1857 var h = hsla[0] / 360, 1858 s = hsla[1], 1859 l = hsla[2], 1860 a = hsla[3], 1861 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 1862 p = 2 * l - q; 1863 1864 return [ 1865 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 1866 Math.round(hue2rgb(p, q, h) * 255), 1867 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 1868 a 1869 ]; 1870 }; 1871 1872 1873 each(spaces, function (spaceName, space) { 1874 var props = space.props, 1875 cache = space.cache, 1876 to = space.to, 1877 from = space.from; 1878 1879 // makes rgba() and hsla() 1880 color.fn[spaceName] = function (value) { 1881 1882 // generate a cache for this space if it doesn't exist 1883 if (to && !this[cache]) { 1884 this[cache] = to(this._rgba); 1885 } 1886 if (value === undefined) { 1887 return this[cache].slice(); 1888 } 1889 1890 var ret, 1891 type = getType(value), 1892 arr = (type === "array" || type === "object") ? value : arguments, 1893 local = this[cache].slice(); 1894 1895 each(props, function (key, prop) { 1896 var val = arr[type === "object" ? key : prop.idx]; 1897 if (val == null) { 1898 val = local[prop.idx]; 1899 } 1900 local[prop.idx] = clamp(val, prop); 1901 }); 1902 1903 if (from) { 1904 ret = color(from(local)); 1905 ret[cache] = local; 1906 return ret; 1907 } else { 1908 return color(local); 1909 } 1910 }; 1911 1912 // makes red() green() blue() alpha() hue() saturation() lightness() 1913 each(props, function (key, prop) { 1914 1915 // alpha is included in more than one space 1916 if (color.fn[key]) { 1917 return; 1918 } 1919 color.fn[key] = function (value) { 1920 var local, cur, match, fn, 1921 vtype = getType(value); 1922 1923 if (key === "alpha") { 1924 fn = this._hsla ? "hsla" : "rgba"; 1925 } else { 1926 fn = spaceName; 1927 } 1928 local = this[fn](); 1929 cur = local[prop.idx]; 1930 1931 if (vtype === "undefined") { 1932 return cur; 1933 } 1934 1935 if (vtype === "function") { 1936 value = value.call(this, cur); 1937 vtype = getType(value); 1938 } 1939 if (value == null && prop.empty) { 1940 return this; 1941 } 1942 if (vtype === "string") { 1943 match = rplusequals.exec(value); 1944 if (match) { 1945 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 1946 } 1947 } 1948 local[prop.idx] = value; 1949 return this[fn](local); 1950 }; 1951 }); 1952 }); 1953 1954 // add cssHook and .fx.step function for each named hook. 1955 // accept a space separated string of properties 1956 color.hook = function (hook) { 1957 var hooks = hook.split(" "); 1958 each(hooks, function (_i, hook) { 1959 jQuery.cssHooks[hook] = { 1960 set: function (elem, value) { 1961 var parsed, curElem, 1962 backgroundColor = ""; 1963 1964 if (value !== "transparent" && (getType(value) !== "string" || (parsed = stringParse(value)))) { 1965 value = color(parsed || value); 1966 if (!support.rgba && value._rgba[3] !== 1) { 1967 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 1968 while ( 1969 (backgroundColor === "" || backgroundColor === "transparent") && 1970 curElem && curElem.style 1971 ) { 1972 try { 1973 backgroundColor = jQuery.css(curElem, "backgroundColor"); 1974 curElem = curElem.parentNode; 1975 } catch (e) { 1976 } 1977 } 1978 1979 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 1980 backgroundColor : 1981 "_default"); 1982 } 1983 1984 value = value.toRgbaString(); 1985 } 1986 try { 1987 elem.style[hook] = value; 1988 } catch (e) { 1989 1990 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 1991 } 1992 } 1993 }; 1994 jQuery.fx.step[hook] = function (fx) { 1995 if (!fx.colorInit) { 1996 fx.start = color(fx.elem, hook); 1997 fx.end = color(fx.end); 1998 fx.colorInit = true; 1999 } 2000 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 2001 }; 2002 }); 2003 2004 }; 2005 2006 color.hook(stepHooks); 2007 2008 jQuery.cssHooks.borderColor = { 2009 expand: function (value) { 2010 var expanded = {}; 2011 2012 each(["Top", "Right", "Bottom", "Left"], function (_i, part) { 2013 expanded["border" + part + "Color"] = value; 2014 }); 2015 return expanded; 2016 } 2017 }; 2018 2019 // Basic color names only. 2020 // Usage of any of the other color names requires adding yourself or including 2021 // jquery.color.svg-names.js. 2022 colors = jQuery.Color.names = { 2023 2024 // 4.1. Basic color keywords 2025 aqua: "#00ffff", 2026 black: "#000000", 2027 blue: "#0000ff", 2028 fuchsia: "#ff00ff", 2029 gray: "#808080", 2030 green: "#008000", 2031 lime: "#00ff00", 2032 maroon: "#800000", 2033 navy: "#000080", 2034 olive: "#808000", 2035 purple: "#800080", 2036 red: "#ff0000", 2037 silver: "#c0c0c0", 2038 teal: "#008080", 2039 white: "#ffffff", 2040 yellow: "#ffff00", 2041 2042 // 4.2.3. "transparent" color keyword 2043 transparent: [null, null, null, 0], 2044 2045 _default: "#ffffff" 2046 }; 2047 2048 2049 /*! 2050 * jQuery UI Effects 1.13.2 2051 * http://jqueryui.com 2052 * 2053 * Copyright jQuery Foundation and other contributors 2054 * Released under the MIT license. 2055 * http://jquery.org/license 2056 */ 2057 2058 //>>label: Effects Core 2059 //>>group: Effects 2060 /* eslint-disable max-len */ 2061 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 2062 /* eslint-enable max-len */ 2063 //>>docs: http://api.jqueryui.com/category/effects-core/ 2064 //>>demos: http://jqueryui.com/effect/ 2065 2066 2067 var dataSpace = "ui-effects-", 2068 dataSpaceStyle = "ui-effects-style", 2069 dataSpaceAnimated = "ui-effects-animated"; 2070 2071 $.effects = { 2072 effect: {} 2073 }; 2074 2075 /******************************************************************************/ 2076 /****************************** CLASS ANIMATIONS ******************************/ 2077 /******************************************************************************/ 2078 (function () { 2079 2080 var classAnimationActions = ["add", "remove", "toggle"], 2081 shorthandStyles = { 2082 border: 1, 2083 borderBottom: 1, 2084 borderColor: 1, 2085 borderLeft: 1, 2086 borderRight: 1, 2087 borderTop: 1, 2088 borderWidth: 1, 2089 margin: 1, 2090 padding: 1 2091 }; 2092 2093 $.each( 2094 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 2095 function (_, prop) { 2096 $.fx.step[prop] = function (fx) { 2097 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 2098 jQuery.style(fx.elem, prop, fx.end); 2099 fx.setAttr = true; 2100 } 2101 }; 2102 } 2103 ); 2104 2105 function camelCase(string) { 2106 return string.replace(/-([\da-z])/gi, function (all, letter) { 2107 return letter.toUpperCase(); 2108 }); 2109 } 2110 2111 function getElementStyles(elem) { 2112 var key, len, 2113 style = elem.ownerDocument.defaultView ? 2114 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 2115 elem.currentStyle, 2116 styles = {}; 2117 2118 if (style && style.length && style[0] && style[style[0]]) { 2119 len = style.length; 2120 while (len--) { 2121 key = style[len]; 2122 if (typeof style[key] === "string") { 2123 styles[camelCase(key)] = style[key]; 2124 } 2125 } 2126 2127 // Support: Opera, IE <9 2128 } else { 2129 for (key in style) { 2130 if (typeof style[key] === "string") { 2131 styles[key] = style[key]; 2132 } 2133 } 2134 } 2135 2136 return styles; 2137 } 2138 2139 function styleDifference(oldStyle, newStyle) { 2140 var diff = {}, 2141 name, value; 2142 2143 for (name in newStyle) { 2144 value = newStyle[name]; 2145 if (oldStyle[name] !== value) { 2146 if (!shorthandStyles[name]) { 2147 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 2148 diff[name] = value; 2149 } 2150 } 2151 } 2152 } 2153 2154 return diff; 2155 } 2156 2157 // Support: jQuery <1.8 2158 if (!$.fn.addBack) { 2159 $.fn.addBack = function (selector) { 2160 return this.add(selector == null ? 2161 this.prevObject : this.prevObject.filter(selector) 2162 ); 2163 }; 2164 } 2165 2166 $.effects.animateClass = function (value, duration, easing, callback) { 2167 var o = $.speed(duration, easing, callback); 2168 2169 return this.queue(function () { 2170 var animated = $(this), 2171 baseClass = animated.attr("class") || "", 2172 applyClassChange, 2173 allAnimations = o.children ? animated.find("*").addBack() : animated; 2174 2175 // Map the animated objects to store the original styles. 2176 allAnimations = allAnimations.map(function () { 2177 var el = $(this); 2178 return { 2179 el: el, 2180 start: getElementStyles(this) 2181 }; 2182 }); 2183 2184 // Apply class change 2185 applyClassChange = function () { 2186 $.each(classAnimationActions, function (i, action) { 2187 if (value[action]) { 2188 animated[action + "Class"](value[action]); 2189 } 2190 }); 2191 }; 2192 applyClassChange(); 2193 2194 // Map all animated objects again - calculate new styles and diff 2195 allAnimations = allAnimations.map(function () { 2196 this.end = getElementStyles(this.el[0]); 2197 this.diff = styleDifference(this.start, this.end); 2198 return this; 2199 }); 2200 2201 // Apply original class 2202 animated.attr("class", baseClass); 2203 2204 // Map all animated objects again - this time collecting a promise 2205 allAnimations = allAnimations.map(function () { 2206 var styleInfo = this, 2207 dfd = $.Deferred(), 2208 opts = $.extend({}, o, { 2209 queue: false, 2210 complete: function () { 2211 dfd.resolve(styleInfo); 2212 } 2213 }); 2214 2215 this.el.animate(this.diff, opts); 2216 return dfd.promise(); 2217 }); 2218 2219 // Once all animations have completed: 2220 $.when.apply($, allAnimations.get()).done(function () { 2221 2222 // Set the final class 2223 applyClassChange(); 2224 2225 // For each animated element, 2226 // clear all css properties that were animated 2227 $.each(arguments, function () { 2228 var el = this.el; 2229 $.each(this.diff, function (key) { 2230 el.css(key, ""); 2231 }); 2232 }); 2233 2234 // This is guarnteed to be there if you use jQuery.speed() 2235 // it also handles dequeuing the next anim... 2236 o.complete.call(animated[0]); 2237 }); 2238 }); 2239 }; 2240 2241 $.fn.extend({ 2242 addClass: (function (orig) { 2243 return function (classNames, speed, easing, callback) { 2244 return speed ? 2245 $.effects.animateClass.call(this, 2246 { add: classNames }, speed, easing, callback) : 2247 orig.apply(this, arguments); 2248 }; 2249 })($.fn.addClass), 2250 2251 removeClass: (function (orig) { 2252 return function (classNames, speed, easing, callback) { 2253 return arguments.length > 1 ? 2254 $.effects.animateClass.call(this, 2255 { remove: classNames }, speed, easing, callback) : 2256 orig.apply(this, arguments); 2257 }; 2258 })($.fn.removeClass), 2259 2260 toggleClass: (function (orig) { 2261 return function (classNames, force, speed, easing, callback) { 2262 if (typeof force === "boolean" || force === undefined) { 2263 if (!speed) { 2264 2265 // Without speed parameter 2266 return orig.apply(this, arguments); 2267 } else { 2268 return $.effects.animateClass.call(this, 2269 (force ? { add: classNames } : { remove: classNames }), 2270 speed, easing, callback); 2271 } 2272 } else { 2273 2274 // Without force parameter 2275 return $.effects.animateClass.call(this, 2276 { toggle: classNames }, force, speed, easing); 2277 } 2278 }; 2279 })($.fn.toggleClass), 2280 2281 switchClass: function (remove, add, speed, easing, callback) { 2282 return $.effects.animateClass.call(this, { 2283 add: add, 2284 remove: remove 2285 }, speed, easing, callback); 2286 } 2287 }); 2288 2289 })(); 2290 2291 /******************************************************************************/ 2292 /*********************************** EFFECTS **********************************/ 2293 /******************************************************************************/ 2294 2295 (function () { 2296 2297 if ($.expr && $.expr.pseudos && $.expr.pseudos.animated) { 2298 $.expr.pseudos.animated = (function (orig) { 2299 return function (elem) { 2300 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 2301 }; 2302 })($.expr.pseudos.animated); 2303 } 2304 2305 if ($.uiBackCompat !== false) { 2306 $.extend($.effects, { 2307 2308 // Saves a set of properties in a data storage 2309 save: function (element, set) { 2310 var i = 0, length = set.length; 2311 for (; i < length; i++) { 2312 if (set[i] !== null) { 2313 element.data(dataSpace + set[i], element[0].style[set[i]]); 2314 } 2315 } 2316 }, 2317 2318 // Restores a set of previously saved properties from a data storage 2319 restore: function (element, set) { 2320 var val, i = 0, length = set.length; 2321 for (; i < length; i++) { 2322 if (set[i] !== null) { 2323 val = element.data(dataSpace + set[i]); 2324 element.css(set[i], val); 2325 } 2326 } 2327 }, 2328 2329 setMode: function (el, mode) { 2330 if (mode === "toggle") { 2331 mode = el.is(":hidden") ? "show" : "hide"; 2332 } 2333 return mode; 2334 }, 2335 2336 // Wraps the element around a wrapper that copies position properties 2337 createWrapper: function (element) { 2338 2339 // If the element is already wrapped, return it 2340 if (element.parent().is(".ui-effects-wrapper")) { 2341 return element.parent(); 2342 } 2343 2344 // Wrap the element 2345 var props = { 2346 width: element.outerWidth(true), 2347 height: element.outerHeight(true), 2348 "float": element.css("float") 2349 }, 2350 wrapper = $("<div></div>") 2351 .addClass("ui-effects-wrapper") 2352 .css({ 2353 fontSize: "100%", 2354 background: "transparent", 2355 border: "none", 2356 margin: 0, 2357 padding: 0 2358 }), 2359 2360 // Store the size in case width/height are defined in % - Fixes #5245 2361 size = { 2362 width: element.width(), 2363 height: element.height() 2364 }, 2365 active = document.activeElement; 2366
vendor: 12,160 bytes, lines 2367-2702
2367 // Support: Firefox 2368 // Firefox incorrectly exposes anonymous content 2369 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2370 try { 2371 // eslint-disable-next-line no-unused-expressions 2372 active.id; 2373 } catch (e) { 2374 active = document.body; 2375 } 2376 2377 element.wrap(wrapper); 2378 2379 // Fixes #7595 - Elements lose focus when wrapped. 2380 if (element[0] === active || $.contains(element[0], active)) { 2381 $(active).trigger("focus"); 2382 } 2383 2384 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2385 // lose the reference to the wrapped element 2386 wrapper = element.parent(); 2387 2388 // Transfer positioning properties to the wrapper 2389 if (element.css("position") === "static") { 2390 wrapper.css({ position: "relative" }); 2391 element.css({ position: "relative" }); 2392 } else { 2393 $.extend(props, { 2394 position: element.css("position"), 2395 zIndex: element.css("z-index") 2396 }); 2397 $.each(["top", "left", "bottom", "right"], function (i, pos) { 2398 props[pos] = element.css(pos); 2399 if (isNaN(parseInt(props[pos], 10))) { 2400 props[pos] = "auto"; 2401 } 2402 }); 2403 element.css({ 2404 position: "relative", 2405 top: 0, 2406 left: 0, 2407 right: "auto", 2408 bottom: "auto" 2409 }); 2410 } 2411 element.css(size); 2412 2413 return wrapper.css(props).show(); 2414 }, 2415 2416 removeWrapper: function (element) { 2417 var active = document.activeElement; 2418 2419 if (element.parent().is(".ui-effects-wrapper")) { 2420 element.parent().replaceWith(element); 2421 2422 // Fixes #7595 - Elements lose focus when wrapped. 2423 if (element[0] === active || $.contains(element[0], active)) { 2424 $(active).trigger("focus"); 2425 } 2426 } 2427 2428 return element; 2429 } 2430 }); 2431 } 2432 2433 $.extend($.effects, { 2434 version: "1.13.2", 2435 2436 define: function (name, mode, effect) { 2437 if (!effect) { 2438 effect = mode; 2439 mode = "effect"; 2440 } 2441 2442 $.effects.effect[name] = effect; 2443 $.effects.effect[name].mode = mode; 2444 2445 return effect; 2446 }, 2447 2448 scaledDimensions: function (element, percent, direction) { 2449 if (percent === 0) { 2450 return { 2451 height: 0, 2452 width: 0, 2453 outerHeight: 0, 2454 outerWidth: 0 2455 }; 2456 } 2457 2458 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 2459 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 2460 2461 return { 2462 height: element.height() * y, 2463 width: element.width() * x, 2464 outerHeight: element.outerHeight() * y, 2465 outerWidth: element.outerWidth() * x 2466 }; 2467 2468 }, 2469 2470 clipToBox: function (animation) { 2471 return { 2472 width: animation.clip.right - animation.clip.left, 2473 height: animation.clip.bottom - animation.clip.top, 2474 left: animation.clip.left, 2475 top: animation.clip.top 2476 }; 2477 }, 2478 2479 // Injects recently queued functions to be first in line (after "inprogress") 2480 unshift: function (element, queueLength, count) { 2481 var queue = element.queue(); 2482 2483 if (queueLength > 1) { 2484 queue.splice.apply(queue, 2485 [1, 0].concat(queue.splice(queueLength, count))); 2486 } 2487 element.dequeue(); 2488 }, 2489 2490 saveStyle: function (element) { 2491 element.data(dataSpaceStyle, element[0].style.cssText); 2492 }, 2493 2494 restoreStyle: function (element) { 2495 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 2496 element.removeData(dataSpaceStyle); 2497 }, 2498 2499 mode: function (element, mode) { 2500 var hidden = element.is(":hidden"); 2501 2502 if (mode === "toggle") { 2503 mode = hidden ? "show" : "hide"; 2504 } 2505 if (hidden ? mode === "hide" : mode === "show") { 2506 mode = "none"; 2507 } 2508 return mode; 2509 }, 2510 2511 // Translates a [top,left] array into a baseline value 2512 getBaseline: function (origin, original) { 2513 var y, x; 2514 2515 switch (origin[0]) { 2516 case "top": 2517 y = 0; 2518 break; 2519 case "middle": 2520 y = 0.5; 2521 break; 2522 case "bottom": 2523 y = 1; 2524 break; 2525 default: 2526 y = origin[0] / original.height; 2527 } 2528 2529 switch (origin[1]) { 2530 case "left": 2531 x = 0; 2532 break; 2533 case "center": 2534 x = 0.5; 2535 break; 2536 case "right": 2537 x = 1; 2538 break; 2539 default: 2540 x = origin[1] / original.width; 2541 } 2542 2543 return { 2544 x: x, 2545 y: y 2546 }; 2547 }, 2548 2549 // Creates a placeholder element so that the original element can be made absolute 2550 createPlaceholder: function (element) { 2551 var placeholder, 2552 cssPosition = element.css("position"), 2553 position = element.position(); 2554 2555 // Lock in margins first to account for form elements, which 2556 // will change margin if you explicitly set height 2557 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 2558 // Support: Safari 2559 element.css({ 2560 marginTop: element.css("marginTop"), 2561 marginBottom: element.css("marginBottom"), 2562 marginLeft: element.css("marginLeft"), 2563 marginRight: element.css("marginRight") 2564 }) 2565 .outerWidth(element.outerWidth()) 2566 .outerHeight(element.outerHeight()); 2567 2568 if (/^(static|relative)/.test(cssPosition)) { 2569 cssPosition = "absolute"; 2570 2571 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 2572 2573 // Convert inline to inline block to account for inline elements 2574 // that turn to inline block based on content (like img) 2575 display: /^(inline|ruby)/.test(element.css("display")) ? 2576 "inline-block" : 2577 "block", 2578 visibility: "hidden", 2579 2580 // Margins need to be set to account for margin collapse 2581 marginTop: element.css("marginTop"), 2582 marginBottom: element.css("marginBottom"), 2583 marginLeft: element.css("marginLeft"), 2584 marginRight: element.css("marginRight"), 2585 "float": element.css("float") 2586 }) 2587 .outerWidth(element.outerWidth()) 2588 .outerHeight(element.outerHeight()) 2589 .addClass("ui-effects-placeholder"); 2590 2591 element.data(dataSpace + "placeholder", placeholder); 2592 } 2593 2594 element.css({ 2595 position: cssPosition, 2596 left: position.left, 2597 top: position.top 2598 }); 2599 2600 return placeholder; 2601 }, 2602 2603 removePlaceholder: function (element) { 2604 var dataKey = dataSpace + "placeholder", 2605 placeholder = element.data(dataKey); 2606 2607 if (placeholder) { 2608 placeholder.remove(); 2609 element.removeData(dataKey); 2610 } 2611 }, 2612 2613 // Removes a placeholder if it exists and restores 2614 // properties that were modified during placeholder creation 2615 cleanUp: function (element) { 2616 $.effects.restoreStyle(element); 2617 $.effects.removePlaceholder(element); 2618 }, 2619 2620 setTransition: function (element, list, factor, value) { 2621 value = value || {}; 2622 $.each(list, function (i, x) { 2623 var unit = element.cssUnit(x); 2624 if (unit[0] > 0) { 2625 value[x] = unit[0] * factor + unit[1]; 2626 } 2627 }); 2628 return value; 2629 } 2630 }); 2631 2632 // Return an effect options object for the given parameters: 2633 function _normalizeArguments(effect, options, speed, callback) { 2634 2635 // Allow passing all options as the first parameter 2636 if ($.isPlainObject(effect)) { 2637 options = effect; 2638 effect = effect.effect; 2639 } 2640 2641 // Convert to an object 2642 effect = { effect: effect }; 2643 2644 // Catch (effect, null, ...) 2645 if (options == null) { 2646 options = {}; 2647 } 2648 2649 // Catch (effect, callback) 2650 if (typeof options === "function") { 2651 callback = options; 2652 speed = null; 2653 options = {}; 2654 } 2655 2656 // Catch (effect, speed, ?) 2657 if (typeof options === "number" || $.fx.speeds[options]) { 2658 callback = speed; 2659 speed = options; 2660 options = {}; 2661 } 2662 2663 // Catch (effect, options, callback) 2664 if (typeof speed === "function") { 2665 callback = speed; 2666 speed = null; 2667 } 2668 2669 // Add options to effect 2670 if (options) { 2671 $.extend(effect, options); 2672 } 2673 2674 speed = speed || options.duration; 2675 effect.duration = $.fx.off ? 0 : 2676 typeof speed === "number" ? speed : 2677 speed in $.fx.speeds ? $.fx.speeds[speed] : 2678 $.fx.speeds._default; 2679 2680 effect.complete = callback || options.complete; 2681 2682 return effect; 2683 } 2684 2685 function standardAnimationOption(option) { 2686 2687 // Valid standard speeds (nothing, number, named speed) 2688 if (!option || typeof option === "number" || $.fx.speeds[option]) { 2689 return true; 2690 } 2691 2692 // Invalid strings - treat as "normal" speed 2693 if (typeof option === "string" && !$.effects.effect[option]) { 2694 return true; 2695 } 2696 2697 // Complete callback 2698 if (typeof option === "function") { 2699 return true; 2700 } 2701 2702 // Options hash (but not naming an effect)
vendor: 7,365 bytes, lines 2703-2886
2703 if (typeof option === "object" && !option.effect) { 2704 return true; 2705 } 2706 2707 // Didn't match any standard API 2708 return false; 2709 } 2710 2711 $.fn.extend({ 2712 effect: function ( /* effect, options, speed, callback */) { 2713 var args = _normalizeArguments.apply(this, arguments), 2714 effectMethod = $.effects.effect[args.effect], 2715 defaultMode = effectMethod.mode, 2716 queue = args.queue, 2717 queueName = queue || "fx", 2718 complete = args.complete, 2719 mode = args.mode, 2720 modes = [], 2721 prefilter = function (next) { 2722 var el = $(this), 2723 normalizedMode = $.effects.mode(el, mode) || defaultMode; 2724 2725 // Sentinel for duck-punching the :animated pseudo-selector 2726 el.data(dataSpaceAnimated, true); 2727 2728 // Save effect mode for later use, 2729 // we can't just call $.effects.mode again later, 2730 // as the .show() below destroys the initial state 2731 modes.push(normalizedMode); 2732 2733 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 2734 if (defaultMode && (normalizedMode === "show" || 2735 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 2736 el.show(); 2737 } 2738 2739 if (!defaultMode || normalizedMode !== "none") { 2740 $.effects.saveStyle(el); 2741 } 2742 2743 if (typeof next === "function") { 2744 next(); 2745 } 2746 }; 2747 2748 if ($.fx.off || !effectMethod) { 2749 2750 // Delegate to the original method (e.g., .show()) if possible 2751 if (mode) { 2752 return this[mode](args.duration, complete); 2753 } else { 2754 return this.each(function () { 2755 if (complete) { 2756 complete.call(this); 2757 } 2758 }); 2759 } 2760 } 2761 2762 function run(next) { 2763 var elem = $(this); 2764 2765 function cleanup() { 2766 elem.removeData(dataSpaceAnimated); 2767 2768 $.effects.cleanUp(elem); 2769 2770 if (args.mode === "hide") { 2771 elem.hide(); 2772 } 2773 2774 done(); 2775 } 2776 2777 function done() { 2778 if (typeof complete === "function") { 2779 complete.call(elem[0]); 2780 } 2781 2782 if (typeof next === "function") { 2783 next(); 2784 } 2785 } 2786 2787 // Override mode option on a per element basis, 2788 // as toggle can be either show or hide depending on element state 2789 args.mode = modes.shift(); 2790 2791 if ($.uiBackCompat !== false && !defaultMode) { 2792 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 2793 2794 // Call the core method to track "olddisplay" properly 2795 elem[mode](); 2796 done(); 2797 } else { 2798 effectMethod.call(elem[0], args, done); 2799 } 2800 } else { 2801 if (args.mode === "none") { 2802 2803 // Call the core method to track "olddisplay" properly 2804 elem[mode](); 2805 done(); 2806 } else { 2807 effectMethod.call(elem[0], args, cleanup); 2808 } 2809 } 2810 } 2811 2812 // Run prefilter on all elements first to ensure that 2813 // any showing or hiding happens before placeholder creation, 2814 // which ensures that any layout changes are correctly captured. 2815 return queue === false ? 2816 this.each(prefilter).each(run) : 2817 this.queue(queueName, prefilter).queue(queueName, run); 2818 }, 2819 2820 show: (function (orig) { 2821 return function (option) { 2822 if (standardAnimationOption(option)) { 2823 return orig.apply(this, arguments); 2824 } else { 2825 var args = _normalizeArguments.apply(this, arguments); 2826 args.mode = "show"; 2827 return this.effect.call(this, args); 2828 } 2829 }; 2830 })($.fn.show), 2831 2832 hide: (function (orig) { 2833 return function (option) { 2834 if (standardAnimationOption(option)) { 2835 return orig.apply(this, arguments); 2836 } else { 2837 var args = _normalizeArguments.apply(this, arguments); 2838 args.mode = "hide"; 2839 return this.effect.call(this, args); 2840 } 2841 }; 2842 })($.fn.hide), 2843 2844 toggle: (function (orig) { 2845 return function (option) { 2846 if (standardAnimationOption(option) || typeof option === "boolean") { 2847 return orig.apply(this, arguments); 2848 } else { 2849 var args = _normalizeArguments.apply(this, arguments); 2850 args.mode = "toggle"; 2851 return this.effect.call(this, args); 2852 } 2853 }; 2854 })($.fn.toggle), 2855 2856 cssUnit: function (key) { 2857 var style = this.css(key), 2858 val = []; 2859 2860 $.each(["em", "px", "%", "pt"], function (i, unit) { 2861 if (style.indexOf(unit) > 0) { 2862 val = [parseFloat(style), unit]; 2863 } 2864 }); 2865 return val; 2866 }, 2867 2868 cssClip: function (clipObj) { 2869 if (clipObj) { 2870 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 2871 clipObj.bottom + "px " + clipObj.left + "px)"); 2872 } 2873 return parseClip(this.css("clip"), this); 2874 }, 2875 2876 transfer: function (options, done) { 2877 var element = $(this), 2878 target = $(options.to), 2879 targetFixed = target.css("position") === "fixed", 2880 body = $("body"), 2881 fixTop = targetFixed ? body.scrollTop() : 0, 2882 fixLeft = targetFixed ? body.scrollLeft() : 0, 2883 endPosition = target.offset(), 2884 animation = { 2885 top: endPosition.top - fixTop, 2886 left: endPosition.left - fixLeft,
vendor: 25,265 bytes, lines 2887-3636
2887 height: target.innerHeight(), 2888 width: target.innerWidth() 2889 }, 2890 startPosition = element.offset(), 2891 transfer = $("<div class='ui-effects-transfer'></div>"); 2892 2893 transfer 2894 .appendTo("body") 2895 .addClass(options.className) 2896 .css({ 2897 top: startPosition.top - fixTop, 2898 left: startPosition.left - fixLeft, 2899 height: element.innerHeight(), 2900 width: element.innerWidth(), 2901 position: targetFixed ? "fixed" : "absolute" 2902 }) 2903 .animate(animation, options.duration, options.easing, function () { 2904 transfer.remove(); 2905 if (typeof done === "function") { 2906 done(); 2907 } 2908 }); 2909 } 2910 }); 2911 2912 function parseClip(str, element) { 2913 var outerWidth = element.outerWidth(), 2914 outerHeight = element.outerHeight(), 2915 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)\)$/, 2916 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 2917 2918 return { 2919 top: parseFloat(values[1]) || 0, 2920 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 2921 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 2922 left: parseFloat(values[4]) || 0 2923 }; 2924 } 2925 2926 $.fx.step.clip = function (fx) { 2927 if (!fx.clipInit) { 2928 fx.start = $(fx.elem).cssClip(); 2929 if (typeof fx.end === "string") { 2930 fx.end = parseClip(fx.end, fx.elem); 2931 } 2932 fx.clipInit = true; 2933 } 2934 2935 $(fx.elem).cssClip({ 2936 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 2937 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 2938 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 2939 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 2940 }); 2941 }; 2942 2943 })(); 2944 2945 /******************************************************************************/ 2946 /*********************************** EASING ***********************************/ 2947 /******************************************************************************/ 2948 2949 (function () { 2950 2951 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 2952 2953 var baseEasings = {}; 2954 2955 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 2956 baseEasings[name] = function (p) { 2957 return Math.pow(p, i + 2); 2958 }; 2959 }); 2960 2961 $.extend(baseEasings, { 2962 Sine: function (p) { 2963 return 1 - Math.cos(p * Math.PI / 2); 2964 }, 2965 Circ: function (p) { 2966 return 1 - Math.sqrt(1 - p * p); 2967 }, 2968 Elastic: function (p) { 2969 return p === 0 || p === 1 ? p : 2970 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 2971 }, 2972 Back: function (p) { 2973 return p * p * (3 * p - 2); 2974 }, 2975 Bounce: function (p) { 2976 var pow2, 2977 bounce = 4; 2978 2979 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 2980 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 2981 } 2982 }); 2983 2984 $.each(baseEasings, function (name, easeIn) { 2985 $.easing["easeIn" + name] = easeIn; 2986 $.easing["easeOut" + name] = function (p) { 2987 return 1 - easeIn(1 - p); 2988 }; 2989 $.easing["easeInOut" + name] = function (p) { 2990 return p < 0.5 ? 2991 easeIn(p * 2) / 2 : 2992 1 - easeIn(p * -2 + 2) / 2; 2993 }; 2994 }); 2995 2996 })(); 2997 2998 var effect = $.effects; 2999 3000 3001 /*! 3002 * jQuery UI Effects Blind 1.13.2 3003 * http://jqueryui.com 3004 * 3005 * Copyright jQuery Foundation and other contributors 3006 * Released under the MIT license. 3007 * http://jquery.org/license 3008 */ 3009 3010 //>>label: Blind Effect 3011 //>>group: Effects 3012 //>>description: Blinds the element. 3013 //>>docs: http://api.jqueryui.com/blind-effect/ 3014 //>>demos: http://jqueryui.com/effect/ 3015 3016 3017 var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) { 3018 var map = { 3019 up: ["bottom", "top"], 3020 vertical: ["bottom", "top"], 3021 down: ["top", "bottom"], 3022 left: ["right", "left"], 3023 horizontal: ["right", "left"], 3024 right: ["left", "right"] 3025 }, 3026 element = $(this), 3027 direction = options.direction || "up", 3028 start = element.cssClip(), 3029 animate = { clip: $.extend({}, start) }, 3030 placeholder = $.effects.createPlaceholder(element); 3031 3032 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 3033 3034 if (options.mode === "show") { 3035 element.cssClip(animate.clip); 3036 if (placeholder) { 3037 placeholder.css($.effects.clipToBox(animate)); 3038 } 3039 3040 animate.clip = start; 3041 } 3042 3043 if (placeholder) { 3044 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 3045 } 3046 3047 element.animate(animate, { 3048 queue: false, 3049 duration: options.duration, 3050 easing: options.easing, 3051 complete: done 3052 }); 3053 }); 3054 3055 3056 /*! 3057 * jQuery UI Effects Bounce 1.13.2 3058 * http://jqueryui.com 3059 * 3060 * Copyright jQuery Foundation and other contributors 3061 * Released under the MIT license. 3062 * http://jquery.org/license 3063 */ 3064 3065 //>>label: Bounce Effect 3066 //>>group: Effects 3067 //>>description: Bounces an element horizontally or vertically n times. 3068 //>>docs: http://api.jqueryui.com/bounce-effect/ 3069 //>>demos: http://jqueryui.com/effect/ 3070 3071 3072 var effectsEffectBounce = $.effects.define("bounce", function (options, done) { 3073 var upAnim, downAnim, refValue, 3074 element = $(this), 3075 3076 // Defaults: 3077 mode = options.mode, 3078 hide = mode === "hide", 3079 show = mode === "show", 3080 direction = options.direction || "up", 3081 distance = options.distance, 3082 times = options.times || 5, 3083 3084 // Number of internal animations 3085 anims = times * 2 + (show || hide ? 1 : 0), 3086 speed = options.duration / anims, 3087 easing = options.easing, 3088 3089 // Utility: 3090 ref = (direction === "up" || direction === "down") ? "top" : "left", 3091 motion = (direction === "up" || direction === "left"), 3092 i = 0, 3093 3094 queuelen = element.queue().length; 3095 3096 $.effects.createPlaceholder(element); 3097 3098 refValue = element.css(ref); 3099 3100 // Default distance for the BIGGEST bounce is the outer Distance / 3 3101 if (!distance) { 3102 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 3103 } 3104 3105 if (show) { 3106 downAnim = { opacity: 1 }; 3107 downAnim[ref] = refValue; 3108 3109 // If we are showing, force opacity 0 and set the initial position 3110 // then do the "first" animation 3111 element 3112 .css("opacity", 0) 3113 .css(ref, motion ? -distance * 2 : distance * 2) 3114 .animate(downAnim, speed, easing); 3115 } 3116 3117 // Start at the smallest distance if we are hiding 3118 if (hide) { 3119 distance = distance / Math.pow(2, times - 1); 3120 } 3121 3122 downAnim = {}; 3123 downAnim[ref] = refValue; 3124 3125 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3126 for (; i < times; i++) { 3127 upAnim = {}; 3128 upAnim[ref] = (motion ? "-=" : "+=") + distance; 3129 3130 element 3131 .animate(upAnim, speed, easing) 3132 .animate(downAnim, speed, easing); 3133 3134 distance = hide ? distance * 2 : distance / 2; 3135 } 3136 3137 // Last Bounce when Hiding 3138 if (hide) { 3139 upAnim = { opacity: 0 }; 3140 upAnim[ref] = (motion ? "-=" : "+=") + distance; 3141 3142 element.animate(upAnim, speed, easing); 3143 } 3144 3145 element.queue(done); 3146 3147 $.effects.unshift(element, queuelen, anims + 1); 3148 }); 3149 3150 3151 /*! 3152 * jQuery UI Effects Clip 1.13.2 3153 * http://jqueryui.com 3154 * 3155 * Copyright jQuery Foundation and other contributors 3156 * Released under the MIT license. 3157 * http://jquery.org/license 3158 */ 3159 3160 //>>label: Clip Effect 3161 //>>group: Effects 3162 //>>description: Clips the element on and off like an old TV. 3163 //>>docs: http://api.jqueryui.com/clip-effect/ 3164 //>>demos: http://jqueryui.com/effect/ 3165 3166 3167 var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) { 3168 var start, 3169 animate = {}, 3170 element = $(this), 3171 direction = options.direction || "vertical", 3172 both = direction === "both", 3173 horizontal = both || direction === "horizontal", 3174 vertical = both || direction === "vertical"; 3175 3176 start = element.cssClip(); 3177 animate.clip = { 3178 top: vertical ? (start.bottom - start.top) / 2 : start.top, 3179 right: horizontal ? (start.right - start.left) / 2 : start.right, 3180 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 3181 left: horizontal ? (start.right - start.left) / 2 : start.left 3182 }; 3183 3184 $.effects.createPlaceholder(element); 3185 3186 if (options.mode === "show") { 3187 element.cssClip(animate.clip); 3188 animate.clip = start; 3189 } 3190 3191 element.animate(animate, { 3192 queue: false, 3193 duration: options.duration, 3194 easing: options.easing, 3195 complete: done 3196 }); 3197 3198 }); 3199 3200 3201 /*! 3202 * jQuery UI Effects Drop 1.13.2 3203 * http://jqueryui.com 3204 * 3205 * Copyright jQuery Foundation and other contributors 3206 * Released under the MIT license. 3207 * http://jquery.org/license 3208 */ 3209 3210 //>>label: Drop Effect 3211 //>>group: Effects 3212 //>>description: Moves an element in one direction and hides it at the same time. 3213 //>>docs: http://api.jqueryui.com/drop-effect/ 3214 //>>demos: http://jqueryui.com/effect/ 3215 3216 3217 var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) { 3218 3219 var distance, 3220 element = $(this), 3221 mode = options.mode, 3222 show = mode === "show", 3223 direction = options.direction || "left", 3224 ref = (direction === "up" || direction === "down") ? "top" : "left", 3225 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 3226 oppositeMotion = (motion === "+=") ? "-=" : "+=", 3227 animation = { 3228 opacity: 0 3229 }; 3230 3231 $.effects.createPlaceholder(element); 3232 3233 distance = options.distance || 3234 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 3235 3236 animation[ref] = motion + distance; 3237 3238 if (show) { 3239 element.css(animation); 3240 3241 animation[ref] = oppositeMotion + distance; 3242 animation.opacity = 1; 3243 } 3244 3245 // Animate 3246 element.animate(animation, { 3247 queue: false, 3248 duration: options.duration, 3249 easing: options.easing, 3250 complete: done 3251 }); 3252 }); 3253 3254 3255 /*! 3256 * jQuery UI Effects Explode 1.13.2 3257 * http://jqueryui.com 3258 * 3259 * Copyright jQuery Foundation and other contributors 3260 * Released under the MIT license. 3261 * http://jquery.org/license 3262 */ 3263 3264 //>>label: Explode Effect 3265 //>>group: Effects 3266 /* eslint-disable max-len */ 3267 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3268 /* eslint-enable max-len */ 3269 //>>docs: http://api.jqueryui.com/explode-effect/ 3270 //>>demos: http://jqueryui.com/effect/ 3271 3272 3273 var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) { 3274 3275 var i, j, left, top, mx, my, 3276 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 3277 cells = rows, 3278 element = $(this), 3279 mode = options.mode, 3280 show = mode === "show", 3281 3282 // Show and then visibility:hidden the element before calculating offset 3283 offset = element.show().css("visibility", "hidden").offset(), 3284 3285 // Width and height of a piece 3286 width = Math.ceil(element.outerWidth() / cells), 3287 height = Math.ceil(element.outerHeight() / rows), 3288 pieces = []; 3289 3290 // Children animate complete: 3291 function childComplete() { 3292 pieces.push(this); 3293 if (pieces.length === rows * cells) { 3294 animComplete(); 3295 } 3296 } 3297 3298 // Clone the element for each row and cell. 3299 for (i = 0; i < rows; i++) { // ===> 3300 top = offset.top + i * height; 3301 my = i - (rows - 1) / 2; 3302 3303 for (j = 0; j < cells; j++) { // ||| 3304 left = offset.left + j * width; 3305 mx = j - (cells - 1) / 2; 3306 3307 // Create a clone of the now hidden main element that will be absolute positioned 3308 // within a wrapper div off the -left and -top equal to size of our pieces 3309 element 3310 .clone() 3311 .appendTo("body") 3312 .wrap("<div></div>") 3313 .css({ 3314 position: "absolute", 3315 visibility: "visible", 3316 left: -j * width, 3317 top: -i * height 3318 }) 3319 3320 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3321 // where the original was located +left and +top equal to the size of pieces 3322 .parent() 3323 .addClass("ui-effects-explode") 3324 .css({ 3325 position: "absolute", 3326 overflow: "hidden", 3327 width: width, 3328 height: height, 3329 left: left + (show ? mx * width : 0), 3330 top: top + (show ? my * height : 0), 3331 opacity: show ? 0 : 1 3332 }) 3333 .animate({ 3334 left: left + (show ? 0 : mx * width), 3335 top: top + (show ? 0 : my * height), 3336 opacity: show ? 1 : 0 3337 }, options.duration || 500, options.easing, childComplete); 3338 } 3339 } 3340 3341 function animComplete() { 3342 element.css({ 3343 visibility: "visible" 3344 }); 3345 $(pieces).remove(); 3346 done(); 3347 } 3348 }); 3349 3350 3351 /*! 3352 * jQuery UI Effects Fade 1.13.2 3353 * http://jqueryui.com 3354 * 3355 * Copyright jQuery Foundation and other contributors 3356 * Released under the MIT license. 3357 * http://jquery.org/license 3358 */ 3359 3360 //>>label: Fade Effect 3361 //>>group: Effects 3362 //>>description: Fades the element. 3363 //>>docs: http://api.jqueryui.com/fade-effect/ 3364 //>>demos: http://jqueryui.com/effect/ 3365 3366 3367 var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) { 3368 var show = options.mode === "show"; 3369 3370 $(this) 3371 .css("opacity", show ? 0 : 1) 3372 .animate({ 3373 opacity: show ? 1 : 0 3374 }, { 3375 queue: false, 3376 duration: options.duration, 3377 easing: options.easing, 3378 complete: done 3379 }); 3380 }); 3381 3382 3383 /*! 3384 * jQuery UI Effects Fold 1.13.2 3385 * http://jqueryui.com 3386 * 3387 * Copyright jQuery Foundation and other contributors 3388 * Released under the MIT license. 3389 * http://jquery.org/license 3390 */ 3391 3392 //>>label: Fold Effect 3393 //>>group: Effects 3394 //>>description: Folds an element first horizontally and then vertically. 3395 //>>docs: http://api.jqueryui.com/fold-effect/ 3396 //>>demos: http://jqueryui.com/effect/ 3397 3398 3399 var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) { 3400 3401 // Create element 3402 var element = $(this), 3403 mode = options.mode, 3404 show = mode === "show", 3405 hide = mode === "hide", 3406 size = options.size || 15, 3407 percent = /([0-9]+)%/.exec(size), 3408 horizFirst = !!options.horizFirst, 3409 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 3410 duration = options.duration / 2, 3411 3412 placeholder = $.effects.createPlaceholder(element), 3413 3414 start = element.cssClip(), 3415 animation1 = { clip: $.extend({}, start) }, 3416 animation2 = { clip: $.extend({}, start) }, 3417 3418 distance = [start[ref[0]], start[ref[1]]], 3419 3420 queuelen = element.queue().length; 3421 3422 if (percent) { 3423 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 3424 } 3425 animation1.clip[ref[0]] = size; 3426 animation2.clip[ref[0]] = size; 3427 animation2.clip[ref[1]] = 0; 3428 3429 if (show) { 3430 element.cssClip(animation2.clip); 3431 if (placeholder) { 3432 placeholder.css($.effects.clipToBox(animation2)); 3433 } 3434 3435 animation2.clip = start; 3436 } 3437 3438 // Animate 3439 element 3440 .queue(function (next) { 3441 if (placeholder) { 3442 placeholder 3443 .animate($.effects.clipToBox(animation1), duration, options.easing) 3444 .animate($.effects.clipToBox(animation2), duration, options.easing); 3445 } 3446 3447 next(); 3448 }) 3449 .animate(animation1, duration, options.easing) 3450 .animate(animation2, duration, options.easing) 3451 .queue(done); 3452 3453 $.effects.unshift(element, queuelen, 4); 3454 }); 3455 3456 3457 /*! 3458 * jQuery UI Effects Highlight 1.13.2 3459 * http://jqueryui.com 3460 * 3461 * Copyright jQuery Foundation and other contributors 3462 * Released under the MIT license. 3463 * http://jquery.org/license 3464 */ 3465 3466 //>>label: Highlight Effect 3467 //>>group: Effects 3468 //>>description: Highlights the background of an element in a defined color for a custom duration. 3469 //>>docs: http://api.jqueryui.com/highlight-effect/ 3470 //>>demos: http://jqueryui.com/effect/ 3471 3472 3473 var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) { 3474 var element = $(this), 3475 animation = { 3476 backgroundColor: element.css("backgroundColor") 3477 }; 3478 3479 if (options.mode === "hide") { 3480 animation.opacity = 0; 3481 } 3482 3483 $.effects.saveStyle(element); 3484 3485 element 3486 .css({ 3487 backgroundImage: "none", 3488 backgroundColor: options.color || "#ffff99" 3489 }) 3490 .animate(animation, { 3491 queue: false, 3492 duration: options.duration, 3493 easing: options.easing, 3494 complete: done 3495 }); 3496 }); 3497 3498 3499 /*! 3500 * jQuery UI Effects Size 1.13.2 3501 * http://jqueryui.com 3502 * 3503 * Copyright jQuery Foundation and other contributors 3504 * Released under the MIT license. 3505 * http://jquery.org/license 3506 */ 3507 3508 //>>label: Size Effect 3509 //>>group: Effects 3510 //>>description: Resize an element to a specified width and height. 3511 //>>docs: http://api.jqueryui.com/size-effect/ 3512 //>>demos: http://jqueryui.com/effect/ 3513 3514 3515 var effectsEffectSize = $.effects.define("size", function (options, done) { 3516 3517 // Create element 3518 var baseline, factor, temp, 3519 element = $(this), 3520 3521 // Copy for children 3522 cProps = ["fontSize"], 3523 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 3524 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 3525 3526 // Set options 3527 mode = options.mode, 3528 restore = mode !== "effect", 3529 scale = options.scale || "both", 3530 origin = options.origin || ["middle", "center"], 3531 position = element.css("position"), 3532 pos = element.position(), 3533 original = $.effects.scaledDimensions(element), 3534 from = options.from || original, 3535 to = options.to || $.effects.scaledDimensions(element, 0); 3536 3537 $.effects.createPlaceholder(element); 3538 3539 if (mode === "show") { 3540 temp = from; 3541 from = to; 3542 to = temp; 3543 } 3544 3545 // Set scaling factor 3546 factor = { 3547 from: { 3548 y: from.height / original.height, 3549 x: from.width / original.width 3550 }, 3551 to: { 3552 y: to.height / original.height, 3553 x: to.width / original.width 3554 } 3555 }; 3556 3557 // Scale the css box 3558 if (scale === "box" || scale === "both") { 3559 3560 // Vertical props scaling 3561 if (factor.from.y !== factor.to.y) { 3562 from = $.effects.setTransition(element, vProps, factor.from.y, from); 3563 to = $.effects.setTransition(element, vProps, factor.to.y, to); 3564 } 3565 3566 // Horizontal props scaling 3567 if (factor.from.x !== factor.to.x) { 3568 from = $.effects.setTransition(element, hProps, factor.from.x, from); 3569 to = $.effects.setTransition(element, hProps, factor.to.x, to); 3570 } 3571 } 3572 3573 // Scale the content 3574 if (scale === "content" || scale === "both") { 3575 3576 // Vertical props scaling 3577 if (factor.from.y !== factor.to.y) { 3578 from = $.effects.setTransition(element, cProps, factor.from.y, from); 3579 to = $.effects.setTransition(element, cProps, factor.to.y, to); 3580 } 3581 } 3582 3583 // Adjust the position properties based on the provided origin points 3584 if (origin) { 3585 baseline = $.effects.getBaseline(origin, original); 3586 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 3587 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 3588 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 3589 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 3590 } 3591 delete from.outerHeight; 3592 delete from.outerWidth; 3593 element.css(from); 3594 3595 // Animate the children if desired 3596 if (scale === "content" || scale === "both") { 3597 3598 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 3599 hProps = hProps.concat(["marginLeft", "marginRight"]); 3600 3601 // Only animate children with width attributes specified 3602 // TODO: is this right? should we include anything with css width specified as well 3603 element.find("*[width]").each(function () { 3604 var child = $(this), 3605 childOriginal = $.effects.scaledDimensions(child), 3606 childFrom = { 3607 height: childOriginal.height * factor.from.y, 3608 width: childOriginal.width * factor.from.x, 3609 outerHeight: childOriginal.outerHeight * factor.from.y, 3610 outerWidth: childOriginal.outerWidth * factor.from.x 3611 }, 3612 childTo = { 3613 height: childOriginal.height * factor.to.y, 3614 width: childOriginal.width * factor.to.x, 3615 outerHeight: childOriginal.height * factor.to.y, 3616 outerWidth: childOriginal.width * factor.to.x 3617 }; 3618 3619 // Vertical props scaling 3620 if (factor.from.y !== factor.to.y) { 3621 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 3622 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 3623 } 3624 3625 // Horizontal props scaling 3626 if (factor.from.x !== factor.to.x) { 3627 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 3628 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 3629 } 3630 3631 if (restore) { 3632 $.effects.saveStyle(child); 3633 } 3634 3635 // Animate children 3636 child.css(childFrom);
vendor: 48,326 bytes, lines 3637-5096
3637 child.animate(childTo, options.duration, options.easing, function () { 3638 3639 // Restore children 3640 if (restore) { 3641 $.effects.restoreStyle(child); 3642 } 3643 }); 3644 }); 3645 } 3646 3647 // Animate 3648 element.animate(to, { 3649 queue: false, 3650 duration: options.duration, 3651 easing: options.easing, 3652 complete: function () { 3653 3654 var offset = element.offset(); 3655 3656 if (to.opacity === 0) { 3657 element.css("opacity", from.opacity); 3658 } 3659 3660 if (!restore) { 3661 element 3662 .css("position", position === "static" ? "relative" : position) 3663 .offset(offset); 3664 3665 // Need to save style here so that automatic style restoration 3666 // doesn't restore to the original styles from before the animation. 3667 $.effects.saveStyle(element); 3668 } 3669 3670 done(); 3671 } 3672 }); 3673 3674 }); 3675 3676 3677 /*! 3678 * jQuery UI Effects Scale 1.13.2 3679 * http://jqueryui.com 3680 * 3681 * Copyright jQuery Foundation and other contributors 3682 * Released under the MIT license. 3683 * http://jquery.org/license 3684 */ 3685 3686 //>>label: Scale Effect 3687 //>>group: Effects 3688 //>>description: Grows or shrinks an element and its content. 3689 //>>docs: http://api.jqueryui.com/scale-effect/ 3690 //>>demos: http://jqueryui.com/effect/ 3691 3692 3693 var effectsEffectScale = $.effects.define("scale", function (options, done) { 3694 3695 // Create element 3696 var el = $(this), 3697 mode = options.mode, 3698 percent = parseInt(options.percent, 10) || 3699 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 3700 3701 newOptions = $.extend(true, { 3702 from: $.effects.scaledDimensions(el), 3703 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 3704 origin: options.origin || ["middle", "center"] 3705 }, options); 3706 3707 // Fade option to support puff 3708 if (options.fade) { 3709 newOptions.from.opacity = 1; 3710 newOptions.to.opacity = 0; 3711 } 3712 3713 $.effects.effect.size.call(this, newOptions, done); 3714 }); 3715 3716 3717 /*! 3718 * jQuery UI Effects Puff 1.13.2 3719 * http://jqueryui.com 3720 * 3721 * Copyright jQuery Foundation and other contributors 3722 * Released under the MIT license. 3723 * http://jquery.org/license 3724 */ 3725 3726 //>>label: Puff Effect 3727 //>>group: Effects 3728 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 3729 //>>docs: http://api.jqueryui.com/puff-effect/ 3730 //>>demos: http://jqueryui.com/effect/ 3731 3732 3733 var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) { 3734 var newOptions = $.extend(true, {}, options, { 3735 fade: true, 3736 percent: parseInt(options.percent, 10) || 150 3737 }); 3738 3739 $.effects.effect.scale.call(this, newOptions, done); 3740 }); 3741 3742 3743 /*! 3744 * jQuery UI Effects Pulsate 1.13.2 3745 * http://jqueryui.com 3746 * 3747 * Copyright jQuery Foundation and other contributors 3748 * Released under the MIT license. 3749 * http://jquery.org/license 3750 */ 3751 3752 //>>label: Pulsate Effect 3753 //>>group: Effects 3754 //>>description: Pulsates an element n times by changing the opacity to zero and back. 3755 //>>docs: http://api.jqueryui.com/pulsate-effect/ 3756 //>>demos: http://jqueryui.com/effect/ 3757 3758 3759 var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) { 3760 var element = $(this), 3761 mode = options.mode, 3762 show = mode === "show", 3763 hide = mode === "hide", 3764 showhide = show || hide, 3765 3766 // Showing or hiding leaves off the "last" animation 3767 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 3768 duration = options.duration / anims, 3769 animateTo = 0, 3770 i = 1, 3771 queuelen = element.queue().length; 3772 3773 if (show || !element.is(":visible")) { 3774 element.css("opacity", 0).show(); 3775 animateTo = 1; 3776 } 3777 3778 // Anims - 1 opacity "toggles" 3779 for (; i < anims; i++) { 3780 element.animate({ opacity: animateTo }, duration, options.easing); 3781 animateTo = 1 - animateTo; 3782 } 3783 3784 element.animate({ opacity: animateTo }, duration, options.easing); 3785 3786 element.queue(done); 3787 3788 $.effects.unshift(element, queuelen, anims + 1); 3789 }); 3790 3791 3792 /*! 3793 * jQuery UI Effects Shake 1.13.2 3794 * http://jqueryui.com 3795 * 3796 * Copyright jQuery Foundation and other contributors 3797 * Released under the MIT license. 3798 * http://jquery.org/license 3799 */ 3800 3801 //>>label: Shake Effect 3802 //>>group: Effects 3803 //>>description: Shakes an element horizontally or vertically n times. 3804 //>>docs: http://api.jqueryui.com/shake-effect/ 3805 //>>demos: http://jqueryui.com/effect/ 3806 3807 3808 var effectsEffectShake = $.effects.define("shake", function (options, done) { 3809 3810 var i = 1, 3811 element = $(this), 3812 direction = options.direction || "left", 3813 distance = options.distance || 20, 3814 times = options.times || 3, 3815 anims = times * 2 + 1, 3816 speed = Math.round(options.duration / anims), 3817 ref = (direction === "up" || direction === "down") ? "top" : "left", 3818 positiveMotion = (direction === "up" || direction === "left"), 3819 animation = {}, 3820 animation1 = {}, 3821 animation2 = {}, 3822 3823 queuelen = element.queue().length; 3824 3825 $.effects.createPlaceholder(element); 3826 3827 // Animation 3828 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 3829 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 3830 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 3831 3832 // Animate 3833 element.animate(animation, speed, options.easing); 3834 3835 // Shakes 3836 for (; i < times; i++) { 3837 element 3838 .animate(animation1, speed, options.easing) 3839 .animate(animation2, speed, options.easing); 3840 } 3841 3842 element 3843 .animate(animation1, speed, options.easing) 3844 .animate(animation, speed / 2, options.easing) 3845 .queue(done); 3846 3847 $.effects.unshift(element, queuelen, anims + 1); 3848 }); 3849 3850 3851 /*! 3852 * jQuery UI Effects Slide 1.13.2 3853 * http://jqueryui.com 3854 * 3855 * Copyright jQuery Foundation and other contributors 3856 * Released under the MIT license. 3857 * http://jquery.org/license 3858 */ 3859 3860 //>>label: Slide Effect 3861 //>>group: Effects 3862 //>>description: Slides an element in and out of the viewport. 3863 //>>docs: http://api.jqueryui.com/slide-effect/ 3864 //>>demos: http://jqueryui.com/effect/ 3865 3866 3867 var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) { 3868 var startClip, startRef, 3869 element = $(this), 3870 map = { 3871 up: ["bottom", "top"], 3872 down: ["top", "bottom"], 3873 left: ["right", "left"], 3874 right: ["left", "right"] 3875 }, 3876 mode = options.mode, 3877 direction = options.direction || "left", 3878 ref = (direction === "up" || direction === "down") ? "top" : "left", 3879 positiveMotion = (direction === "up" || direction === "left"), 3880 distance = options.distance || 3881 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 3882 animation = {}; 3883 3884 $.effects.createPlaceholder(element); 3885 3886 startClip = element.cssClip(); 3887 startRef = element.position()[ref]; 3888 3889 // Define hide animation 3890 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 3891 animation.clip = element.cssClip(); 3892 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 3893 3894 // Reverse the animation if we're showing 3895 if (mode === "show") { 3896 element.cssClip(animation.clip); 3897 element.css(ref, animation[ref]); 3898 animation.clip = startClip; 3899 animation[ref] = startRef; 3900 } 3901 3902 // Actually animate 3903 element.animate(animation, { 3904 queue: false, 3905 duration: options.duration, 3906 easing: options.easing, 3907 complete: done 3908 }); 3909 }); 3910 3911 3912 /*! 3913 * jQuery UI Effects Transfer 1.13.2 3914 * http://jqueryui.com 3915 * 3916 * Copyright jQuery Foundation and other contributors 3917 * Released under the MIT license. 3918 * http://jquery.org/license 3919 */ 3920 3921 //>>label: Transfer Effect 3922 //>>group: Effects 3923 //>>description: Displays a transfer effect from one element to another. 3924 //>>docs: http://api.jqueryui.com/transfer-effect/ 3925 //>>demos: http://jqueryui.com/effect/ 3926 3927 3928 var effect; 3929 if ($.uiBackCompat !== false) { 3930 effect = $.effects.define("transfer", function (options, done) { 3931 $(this).transfer(options, done); 3932 }); 3933 } 3934 var effectsEffectTransfer = effect; 3935 3936 3937 /*! 3938 * jQuery UI Focusable 1.13.2 3939 * http://jqueryui.com 3940 * 3941 * Copyright jQuery Foundation and other contributors 3942 * Released under the MIT license. 3943 * http://jquery.org/license 3944 */ 3945 3946 //>>label: :focusable Selector 3947 //>>group: Core 3948 //>>description: Selects elements which can be focused. 3949 //>>docs: http://api.jqueryui.com/focusable-selector/ 3950 3951 3952 // Selectors 3953 $.ui.focusable = function (element, hasTabindex) { 3954 var map, mapName, img, focusableIfVisible, fieldset, 3955 nodeName = element.nodeName.toLowerCase(); 3956 3957 if ("area" === nodeName) { 3958 map = element.parentNode; 3959 mapName = map.name; 3960 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 3961 return false; 3962 } 3963 img = $("img[usemap='#" + mapName + "']"); 3964 return img.length > 0 && img.is(":visible"); 3965 } 3966 3967 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 3968 focusableIfVisible = !element.disabled; 3969 3970 if (focusableIfVisible) { 3971 3972 // Form controls within a disabled fieldset are disabled. 3973 // However, controls within the fieldset's legend do not get disabled. 3974 // Since controls generally aren't placed inside legends, we skip 3975 // this portion of the check. 3976 fieldset = $(element).closest("fieldset")[0]; 3977 if (fieldset) { 3978 focusableIfVisible = !fieldset.disabled; 3979 } 3980 } 3981 } else if ("a" === nodeName) { 3982 focusableIfVisible = element.href || hasTabindex; 3983 } else { 3984 focusableIfVisible = hasTabindex; 3985 } 3986 3987 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 3988 }; 3989 3990 // Support: IE 8 only 3991 // IE 8 doesn't resolve inherit to visible/hidden for computed values 3992 function visible(element) { 3993 var visibility = element.css("visibility"); 3994 while (visibility === "inherit") { 3995 element = element.parent(); 3996 visibility = element.css("visibility"); 3997 } 3998 return visibility === "visible"; 3999 } 4000 4001 $.extend($.expr.pseudos, { 4002 focusable: function (element) { 4003 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 4004 } 4005 }); 4006 4007 var focusable = $.ui.focusable; 4008 4009 4010 4011 // Support: IE8 Only 4012 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 4013 // with a string, so we need to find the proper form. 4014 var form = $.fn._form = function () { 4015 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 4016 }; 4017 4018 4019 /*! 4020 * jQuery UI Form Reset Mixin 1.13.2 4021 * http://jqueryui.com 4022 * 4023 * Copyright jQuery Foundation and other contributors 4024 * Released under the MIT license. 4025 * http://jquery.org/license 4026 */ 4027 4028 //>>label: Form Reset Mixin 4029 //>>group: Core 4030 //>>description: Refresh input widgets when their form is reset 4031 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 4032 4033 4034 var formResetMixin = $.ui.formResetMixin = { 4035 _formResetHandler: function () { 4036 var form = $(this); 4037 4038 // Wait for the form reset to actually happen before refreshing 4039 setTimeout(function () { 4040 var instances = form.data("ui-form-reset-instances"); 4041 $.each(instances, function () { 4042 this.refresh(); 4043 }); 4044 }); 4045 }, 4046 4047 _bindFormResetHandler: function () { 4048 this.form = this.element._form(); 4049 if (!this.form.length) { 4050 return; 4051 } 4052 4053 var instances = this.form.data("ui-form-reset-instances") || []; 4054 if (!instances.length) { 4055 4056 // We don't use _on() here because we use a single event handler per form 4057 this.form.on("reset.ui-form-reset", this._formResetHandler); 4058 } 4059 instances.push(this); 4060 this.form.data("ui-form-reset-instances", instances); 4061 }, 4062 4063 _unbindFormResetHandler: function () { 4064 if (!this.form.length) { 4065 return; 4066 } 4067 4068 var instances = this.form.data("ui-form-reset-instances"); 4069 instances.splice($.inArray(this, instances), 1); 4070 if (instances.length) { 4071 this.form.data("ui-form-reset-instances", instances); 4072 } else { 4073 this.form 4074 .removeData("ui-form-reset-instances") 4075 .off("reset.ui-form-reset"); 4076 } 4077 } 4078 }; 4079 4080 4081 /*! 4082 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2 4083 * http://jqueryui.com 4084 * 4085 * Copyright jQuery Foundation and other contributors 4086 * Released under the MIT license. 4087 * http://jquery.org/license 4088 * 4089 */ 4090 4091 //>>label: jQuery 1.8+ Support 4092 //>>group: Core 4093 //>>description: Support version 1.8.x and newer of jQuery core 4094 4095 4096 // Support: jQuery 1.9.x or older 4097 // $.expr[ ":" ] is deprecated. 4098 if (!$.expr.pseudos) { 4099 $.expr.pseudos = $.expr[":"]; 4100 } 4101 4102 // Support: jQuery 1.11.x or older 4103 // $.unique has been renamed to $.uniqueSort 4104 if (!$.uniqueSort) { 4105 $.uniqueSort = $.unique; 4106 } 4107 4108 // Support: jQuery 2.2.x or older. 4109 // This method has been defined in jQuery 3.0.0. 4110 // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 4111 if (!$.escapeSelector) { 4112 4113 // CSS string/identifier serialization 4114 // https://drafts.csswg.org/cssom/#common-serializing-idioms 4115 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 4116 4117 var fcssescape = function (ch, asCodePoint) { 4118 if (asCodePoint) { 4119 4120 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 4121 if (ch === "\0") { 4122 return "\uFFFD"; 4123 } 4124 4125 // Control characters and (dependent upon position) numbers get escaped as code points 4126 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 4127 } 4128 4129 // Other potentially-special ASCII characters get backslash-escaped 4130 return "\\" + ch; 4131 }; 4132 4133 $.escapeSelector = function (sel) { 4134 return (sel + "").replace(rcssescape, fcssescape); 4135 }; 4136 } 4137 4138 // Support: jQuery 3.4.x or older 4139 // These methods have been defined in jQuery 3.5.0. 4140 if (!$.fn.even || !$.fn.odd) { 4141 $.fn.extend({ 4142 even: function () { 4143 return this.filter(function (i) { 4144 return i % 2 === 0; 4145 }); 4146 }, 4147 odd: function () { 4148 return this.filter(function (i) { 4149 return i % 2 === 1; 4150 }); 4151 } 4152 }); 4153 } 4154 4155 ; 4156 /*! 4157 * jQuery UI Keycode 1.13.2 4158 * http://jqueryui.com 4159 * 4160 * Copyright jQuery Foundation and other contributors 4161 * Released under the MIT license. 4162 * http://jquery.org/license 4163 */ 4164 4165 //>>label: Keycode 4166 //>>group: Core 4167 //>>description: Provide keycodes as keynames 4168 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 4169 4170 4171 var keycode = $.ui.keyCode = { 4172 BACKSPACE: 8, 4173 COMMA: 188, 4174 DELETE: 46, 4175 DOWN: 40, 4176 END: 35, 4177 ENTER: 13, 4178 ESCAPE: 27, 4179 HOME: 36, 4180 LEFT: 37, 4181 PAGE_DOWN: 34, 4182 PAGE_UP: 33, 4183 PERIOD: 190, 4184 RIGHT: 39, 4185 SPACE: 32, 4186 TAB: 9, 4187 UP: 38 4188 }; 4189 4190 4191 /*! 4192 * jQuery UI Labels 1.13.2 4193 * http://jqueryui.com 4194 * 4195 * Copyright jQuery Foundation and other contributors 4196 * Released under the MIT license. 4197 * http://jquery.org/license 4198 */ 4199 4200 //>>label: labels 4201 //>>group: Core 4202 //>>description: Find all the labels associated with a given input 4203 //>>docs: http://api.jqueryui.com/labels/ 4204 4205 4206 var labels = $.fn.labels = function () { 4207 var ancestor, selector, id, labels, ancestors; 4208 4209 if (!this.length) { 4210 return this.pushStack([]); 4211 } 4212 4213 // Check control.labels first 4214 if (this[0].labels && this[0].labels.length) { 4215 return this.pushStack(this[0].labels); 4216 } 4217 4218 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4219 // Above browsers do not support control.labels. Everything below is to support them 4220 // as well as document fragments. control.labels does not work on document fragments 4221 labels = this.eq(0).parents("label"); 4222 4223 // Look for the label based on the id 4224 id = this.attr("id"); 4225 if (id) { 4226 4227 // We don't search against the document in case the element 4228 // is disconnected from the DOM 4229 ancestor = this.eq(0).parents().last(); 4230 4231 // Get a full set of top level ancestors 4232 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 4233 4234 // Create a selector for the label based on the id 4235 selector = "label[for='" + $.escapeSelector(id) + "']"; 4236 4237 labels = labels.add(ancestors.find(selector).addBack(selector)); 4238 4239 } 4240 4241 // Return whatever we have found for labels 4242 return this.pushStack(labels); 4243 }; 4244 4245 4246 /*! 4247 * jQuery UI Scroll Parent 1.13.2 4248 * http://jqueryui.com 4249 * 4250 * Copyright jQuery Foundation and other contributors 4251 * Released under the MIT license. 4252 * http://jquery.org/license 4253 */ 4254 4255 //>>label: scrollParent 4256 //>>group: Core 4257 //>>description: Get the closest ancestor element that is scrollable. 4258 //>>docs: http://api.jqueryui.com/scrollParent/ 4259 4260 4261 var scrollParent = $.fn.scrollParent = function (includeHidden) { 4262 var position = this.css("position"), 4263 excludeStaticParent = position === "absolute", 4264 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4265 scrollParent = this.parents().filter(function () { 4266 var parent = $(this); 4267 if (excludeStaticParent && parent.css("position") === "static") { 4268 return false; 4269 } 4270 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 4271 parent.css("overflow-x")); 4272 }).eq(0); 4273 4274 return position === "fixed" || !scrollParent.length ? 4275 $(this[0].ownerDocument || document) : 4276 scrollParent; 4277 }; 4278 4279 4280 /*! 4281 * jQuery UI Tabbable 1.13.2 4282 * http://jqueryui.com 4283 * 4284 * Copyright jQuery Foundation and other contributors 4285 * Released under the MIT license. 4286 * http://jquery.org/license 4287 */ 4288 4289 //>>label: :tabbable Selector 4290 //>>group: Core 4291 //>>description: Selects elements which can be tabbed to. 4292 //>>docs: http://api.jqueryui.com/tabbable-selector/ 4293 4294 4295 var tabbable = $.extend($.expr.pseudos, { 4296 tabbable: function (element) { 4297 var tabIndex = $.attr(element, "tabindex"), 4298 hasTabindex = tabIndex != null; 4299 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 4300 } 4301 }); 4302 4303 4304 /*! 4305 * jQuery UI Unique ID 1.13.2 4306 * http://jqueryui.com 4307 * 4308 * Copyright jQuery Foundation and other contributors 4309 * Released under the MIT license. 4310 * http://jquery.org/license 4311 */ 4312 4313 //>>label: uniqueId 4314 //>>group: Core 4315 //>>description: Functions to generate and remove uniqueId's 4316 //>>docs: http://api.jqueryui.com/uniqueId/ 4317 4318 4319 var uniqueId = $.fn.extend({ 4320 uniqueId: (function () { 4321 var uuid = 0; 4322 4323 return function () { 4324 return this.each(function () { 4325 if (!this.id) { 4326 this.id = "ui-id-" + (++uuid); 4327 } 4328 }); 4329 }; 4330 })(), 4331 4332 removeUniqueId: function () { 4333 return this.each(function () { 4334 if (/^ui-id-\d+$/.test(this.id)) { 4335 $(this).removeAttr("id"); 4336 } 4337 }); 4338 } 4339 }); 4340 4341 4342 /*! 4343 * jQuery UI Accordion 1.13.2 4344 * http://jqueryui.com 4345 * 4346 * Copyright jQuery Foundation and other contributors 4347 * Released under the MIT license. 4348 * http://jquery.org/license 4349 */ 4350 4351 //>>label: Accordion 4352 //>>group: Widgets 4353 /* eslint-disable max-len */ 4354 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4355 /* eslint-enable max-len */ 4356 //>>docs: http://api.jqueryui.com/accordion/ 4357 //>>demos: http://jqueryui.com/accordion/ 4358 //>>css.structure: ../../themes/base/core.css 4359 //>>css.structure: ../../themes/base/accordion.css 4360 //>>css.theme: ../../themes/base/theme.css 4361 4362 4363 var widgetsAccordion = $.widget("ui.accordion", { 4364 version: "1.13.2", 4365 options: { 4366 active: 0, 4367 animate: {}, 4368 classes: { 4369 "ui-accordion-header": "ui-corner-top", 4370 "ui-accordion-header-collapsed": "ui-corner-all", 4371 "ui-accordion-content": "ui-corner-bottom" 4372 }, 4373 collapsible: false, 4374 event: "click", 4375 header: function (elem) { 4376 return elem.find("> li > :first-child").add(elem.find("> :not(li)").even()); 4377 }, 4378 heightStyle: "auto", 4379 icons: { 4380 activeHeader: "ui-icon-triangle-1-s", 4381 header: "ui-icon-triangle-1-e" 4382 }, 4383 4384 // Callbacks 4385 activate: null, 4386 beforeActivate: null 4387 }, 4388 4389 hideProps: { 4390 borderTopWidth: "hide", 4391 borderBottomWidth: "hide", 4392 paddingTop: "hide", 4393 paddingBottom: "hide", 4394 height: "hide" 4395 }, 4396 4397 showProps: { 4398 borderTopWidth: "show", 4399 borderBottomWidth: "show", 4400 paddingTop: "show", 4401 paddingBottom: "show", 4402 height: "show" 4403 }, 4404 4405 _create: function () { 4406 var options = this.options; 4407 4408 this.prevShow = this.prevHide = $(); 4409 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 4410 this.element.attr("role", "tablist"); 4411 4412 // Don't allow collapsible: false and active: false / null 4413 if (!options.collapsible && (options.active === false || options.active == null)) { 4414 options.active = 0; 4415 } 4416 4417 this._processPanels(); 4418 4419 // handle negative values 4420 if (options.active < 0) { 4421 options.active += this.headers.length; 4422 } 4423 this._refresh(); 4424 }, 4425 4426 _getCreateEventData: function () { 4427 return { 4428 header: this.active, 4429 panel: !this.active.length ? $() : this.active.next() 4430 }; 4431 }, 4432 4433 _createIcons: function () { 4434 var icon, children, 4435 icons = this.options.icons; 4436 4437 if (icons) { 4438 icon = $("<span>"); 4439 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 4440 icon.prependTo(this.headers); 4441 children = this.active.children(".ui-accordion-header-icon"); 4442 this._removeClass(children, icons.header) 4443 ._addClass(children, null, icons.activeHeader) 4444 ._addClass(this.headers, "ui-accordion-icons"); 4445 } 4446 }, 4447 4448 _destroyIcons: function () { 4449 this._removeClass(this.headers, "ui-accordion-icons"); 4450 this.headers.children(".ui-accordion-header-icon").remove(); 4451 }, 4452 4453 _destroy: function () { 4454 var contents; 4455 4456 // Clean up main element 4457 this.element.removeAttr("role"); 4458 4459 // Clean up headers 4460 this.headers 4461 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 4462 .removeUniqueId(); 4463 4464 this._destroyIcons(); 4465 4466 // Clean up content panels 4467 contents = this.headers.next() 4468 .css("display", "") 4469 .removeAttr("role aria-hidden aria-labelledby") 4470 .removeUniqueId(); 4471 4472 if (this.options.heightStyle !== "content") { 4473 contents.css("height", ""); 4474 } 4475 }, 4476 4477 _setOption: function (key, value) { 4478 if (key === "active") { 4479 4480 // _activate() will handle invalid values and update this.options 4481 this._activate(value); 4482 return; 4483 } 4484 4485 if (key === "event") { 4486 if (this.options.event) { 4487 this._off(this.headers, this.options.event); 4488 } 4489 this._setupEvents(value); 4490 } 4491 4492 this._super(key, value); 4493 4494 // Setting collapsible: false while collapsed; open first panel 4495 if (key === "collapsible" && !value && this.options.active === false) { 4496 this._activate(0); 4497 } 4498 4499 if (key === "icons") { 4500 this._destroyIcons(); 4501 if (value) { 4502 this._createIcons(); 4503 } 4504 } 4505 }, 4506 4507 _setOptionDisabled: function (value) { 4508 this._super(value); 4509 4510 this.element.attr("aria-disabled", value); 4511 4512 // Support: IE8 Only 4513 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 4514 // so we need to add the disabled class to the headers and panels 4515 this._toggleClass(null, "ui-state-disabled", !!value); 4516 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", 4517 !!value); 4518 }, 4519 4520 _keydown: function (event) { 4521 if (event.altKey || event.ctrlKey) { 4522 return; 4523 } 4524 4525 var keyCode = $.ui.keyCode, 4526 length = this.headers.length, 4527 currentIndex = this.headers.index(event.target), 4528 toFocus = false; 4529 4530 switch (event.keyCode) { 4531 case keyCode.RIGHT: 4532 case keyCode.DOWN: 4533 toFocus = this.headers[(currentIndex + 1) % length]; 4534 break; 4535 case keyCode.LEFT: 4536 case keyCode.UP: 4537 toFocus = this.headers[(currentIndex - 1 + length) % length]; 4538 break; 4539 case keyCode.SPACE: 4540 case keyCode.ENTER: 4541 this._eventHandler(event); 4542 break; 4543 case keyCode.HOME: 4544 toFocus = this.headers[0]; 4545 break; 4546 case keyCode.END: 4547 toFocus = this.headers[length - 1]; 4548 break; 4549 } 4550 4551 if (toFocus) { 4552 $(event.target).attr("tabIndex", -1); 4553 $(toFocus).attr("tabIndex", 0); 4554 $(toFocus).trigger("focus"); 4555 event.preventDefault(); 4556 } 4557 }, 4558 4559 _panelKeyDown: function (event) { 4560 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 4561 $(event.currentTarget).prev().trigger("focus"); 4562 } 4563 }, 4564 4565 refresh: function () { 4566 var options = this.options; 4567 this._processPanels(); 4568 4569 // Was collapsed or no panel 4570 if ((options.active === false && options.collapsible === true) || 4571 !this.headers.length) { 4572 options.active = false; 4573 this.active = $(); 4574 4575 // active false only when collapsible is true 4576 } else if (options.active === false) { 4577 this._activate(0); 4578 4579 // was active, but active panel is gone 4580 } else if (this.active.length && !$.contains(this.element[0], this.active[0])) { 4581 4582 // all remaining panel are disabled 4583 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 4584 options.active = false; 4585 this.active = $(); 4586 4587 // activate previous panel 4588 } else { 4589 this._activate(Math.max(0, options.active - 1)); 4590 } 4591 4592 // was active, active panel still exists 4593 } else { 4594 4595 // make sure active index is correct 4596 options.active = this.headers.index(this.active); 4597 } 4598 4599 this._destroyIcons(); 4600 4601 this._refresh(); 4602 }, 4603 4604 _processPanels: function () { 4605 var prevHeaders = this.headers, 4606 prevPanels = this.panels; 4607 4608 if (typeof this.options.header === "function") { 4609 this.headers = this.options.header(this.element); 4610 } else { 4611 this.headers = this.element.find(this.options.header); 4612 } 4613 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 4614 "ui-state-default"); 4615 4616 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 4617 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 4618 4619 // Avoid memory leaks (#10056) 4620 if (prevPanels) { 4621 this._off(prevHeaders.not(this.headers)); 4622 this._off(prevPanels.not(this.panels)); 4623 } 4624 }, 4625 4626 _refresh: function () { 4627 var maxHeight, 4628 options = this.options, 4629 heightStyle = options.heightStyle, 4630 parent = this.element.parent(); 4631 4632 this.active = this._findActive(options.active); 4633 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 4634 ._removeClass(this.active, "ui-accordion-header-collapsed"); 4635 this._addClass(this.active.next(), "ui-accordion-content-active"); 4636 this.active.next().show(); 4637 4638 this.headers 4639 .attr("role", "tab") 4640 .each(function () { 4641 var header = $(this), 4642 headerId = header.uniqueId().attr("id"), 4643 panel = header.next(), 4644 panelId = panel.uniqueId().attr("id"); 4645 header.attr("aria-controls", panelId); 4646 panel.attr("aria-labelledby", headerId); 4647 }) 4648 .next() 4649 .attr("role", "tabpanel"); 4650 4651 this.headers 4652 .not(this.active) 4653 .attr({ 4654 "aria-selected": "false", 4655 "aria-expanded": "false", 4656 tabIndex: -1 4657 }) 4658 .next() 4659 .attr({ 4660 "aria-hidden": "true" 4661 }) 4662 .hide(); 4663 4664 // Make sure at least one header is in the tab order 4665 if (!this.active.length) { 4666 this.headers.eq(0).attr("tabIndex", 0); 4667 } else { 4668 this.active.attr({ 4669 "aria-selected": "true", 4670 "aria-expanded": "true", 4671 tabIndex: 0 4672 }) 4673 .next() 4674 .attr({ 4675 "aria-hidden": "false" 4676 }); 4677 } 4678 4679 this._createIcons(); 4680 4681 this._setupEvents(options.event); 4682 4683 if (heightStyle === "fill") { 4684 maxHeight = parent.height(); 4685 this.element.siblings(":visible").each(function () { 4686 var elem = $(this), 4687 position = elem.css("position"); 4688 4689 if (position === "absolute" || position === "fixed") { 4690 return; 4691 } 4692 maxHeight -= elem.outerHeight(true); 4693 }); 4694 4695 this.headers.each(function () { 4696 maxHeight -= $(this).outerHeight(true); 4697 }); 4698 4699 this.headers.next() 4700 .each(function () { 4701 $(this).height(Math.max(0, maxHeight - 4702 $(this).innerHeight() + $(this).height())); 4703 }) 4704 .css("overflow", "auto"); 4705 } else if (heightStyle === "auto") { 4706 maxHeight = 0; 4707 this.headers.next() 4708 .each(function () { 4709 var isVisible = $(this).is(":visible"); 4710 if (!isVisible) { 4711 $(this).show(); 4712 } 4713 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 4714 if (!isVisible) { 4715 $(this).hide(); 4716 } 4717 }) 4718 .height(maxHeight); 4719 } 4720 }, 4721 4722 _activate: function (index) { 4723 var active = this._findActive(index)[0]; 4724 4725 // Trying to activate the already active panel 4726 if (active === this.active[0]) { 4727 return; 4728 } 4729 4730 // Trying to collapse, simulate a click on the currently active header 4731 active = active || this.active[0]; 4732 4733 this._eventHandler({ 4734 target: active, 4735 currentTarget: active, 4736 preventDefault: $.noop 4737 }); 4738 }, 4739 4740 _findActive: function (selector) { 4741 return typeof selector === "number" ? this.headers.eq(selector) : $(); 4742 }, 4743 4744 _setupEvents: function (event) { 4745 var events = { 4746 keydown: "_keydown" 4747 }; 4748 if (event) { 4749 $.each(event.split(" "), function (index, eventName) { 4750 events[eventName] = "_eventHandler"; 4751 }); 4752 } 4753 4754 this._off(this.headers.add(this.headers.next())); 4755 this._on(this.headers, events); 4756 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 4757 this._hoverable(this.headers); 4758 this._focusable(this.headers); 4759 }, 4760 4761 _eventHandler: function (event) { 4762 var activeChildren, clickedChildren, 4763 options = this.options, 4764 active = this.active, 4765 clicked = $(event.currentTarget), 4766 clickedIsActive = clicked[0] === active[0], 4767 collapsing = clickedIsActive && options.collapsible, 4768 toShow = collapsing ? $() : clicked.next(), 4769 toHide = active.next(), 4770 eventData = { 4771 oldHeader: active, 4772 oldPanel: toHide, 4773 newHeader: collapsing ? $() : clicked, 4774 newPanel: toShow 4775 }; 4776 4777 event.preventDefault(); 4778 4779 if ( 4780 4781 // click on active header, but not collapsible 4782 (clickedIsActive && !options.collapsible) || 4783 4784 // allow canceling activation 4785 (this._trigger("beforeActivate", event, eventData) === false)) { 4786 return; 4787 } 4788 4789 options.active = collapsing ? false : this.headers.index(clicked); 4790 4791 // When the call to ._toggle() comes after the class changes 4792 // it causes a very odd bug in IE 8 (see #6720) 4793 this.active = clickedIsActive ? $() : clicked; 4794 this._toggle(eventData); 4795 4796 // Switch classes 4797 // corner classes on the previously active header stay after the animation 4798 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 4799 if (options.icons) { 4800 activeChildren = active.children(".ui-accordion-header-icon"); 4801 this._removeClass(activeChildren, null, options.icons.activeHeader) 4802 ._addClass(activeChildren, null, options.icons.header); 4803 } 4804 4805 if (!clickedIsActive) { 4806 this._removeClass(clicked, "ui-accordion-header-collapsed") 4807 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 4808 if (options.icons) { 4809 clickedChildren = clicked.children(".ui-accordion-header-icon"); 4810 this._removeClass(clickedChildren, null, options.icons.header) 4811 ._addClass(clickedChildren, null, options.icons.activeHeader); 4812 } 4813 4814 this._addClass(clicked.next(), "ui-accordion-content-active"); 4815 } 4816 }, 4817 4818 _toggle: function (data) { 4819 var toShow = data.newPanel, 4820 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 4821 4822 // Handle activating a panel during the animation for another activation 4823 this.prevShow.add(this.prevHide).stop(true, true); 4824 this.prevShow = toShow; 4825 this.prevHide = toHide; 4826 4827 if (this.options.animate) { 4828 this._animate(toShow, toHide, data); 4829 } else { 4830 toHide.hide(); 4831 toShow.show(); 4832 this._toggleComplete(data); 4833 } 4834 4835 toHide.attr({ 4836 "aria-hidden": "true" 4837 }); 4838 toHide.prev().attr({ 4839 "aria-selected": "false", 4840 "aria-expanded": "false" 4841 }); 4842 4843 // if we're switching panels, remove the old header from the tab order 4844 // if we're opening from collapsed state, remove the previous header from the tab order 4845 // if we're collapsing, then keep the collapsing header in the tab order 4846 if (toShow.length && toHide.length) { 4847 toHide.prev().attr({ 4848 "tabIndex": -1, 4849 "aria-expanded": "false" 4850 }); 4851 } else if (toShow.length) { 4852 this.headers.filter(function () { 4853 return parseInt($(this).attr("tabIndex"), 10) === 0; 4854 }) 4855 .attr("tabIndex", -1); 4856 } 4857 4858 toShow 4859 .attr("aria-hidden", "false") 4860 .prev() 4861 .attr({ 4862 "aria-selected": "true", 4863 "aria-expanded": "true", 4864 tabIndex: 0 4865 }); 4866 }, 4867 4868 _animate: function (toShow, toHide, data) { 4869 var total, easing, duration, 4870 that = this, 4871 adjust = 0, 4872 boxSizing = toShow.css("box-sizing"), 4873 down = toShow.length && 4874 (!toHide.length || (toShow.index() < toHide.index())), 4875 animate = this.options.animate || {}, 4876 options = down && animate.down || animate, 4877 complete = function () { 4878 that._toggleComplete(data); 4879 }; 4880 4881 if (typeof options === "number") { 4882 duration = options; 4883 } 4884 if (typeof options === "string") { 4885 easing = options; 4886 } 4887 4888 // fall back from options to animation in case of partial down settings 4889 easing = easing || options.easing || animate.easing; 4890 duration = duration || options.duration || animate.duration; 4891 4892 if (!toHide.length) { 4893 return toShow.animate(this.showProps, duration, easing, complete); 4894 } 4895 if (!toShow.length) { 4896 return toHide.animate(this.hideProps, duration, easing, complete); 4897 } 4898 4899 total = toShow.show().outerHeight(); 4900 toHide.animate(this.hideProps, { 4901 duration: duration, 4902 easing: easing, 4903 step: function (now, fx) { 4904 fx.now = Math.round(now); 4905 } 4906 }); 4907 toShow 4908 .hide() 4909 .animate(this.showProps, { 4910 duration: duration, 4911 easing: easing, 4912 complete: complete, 4913 step: function (now, fx) { 4914 fx.now = Math.round(now); 4915 if (fx.prop !== "height") { 4916 if (boxSizing === "content-box") { 4917 adjust += fx.now; 4918 } 4919 } else if (that.options.heightStyle !== "content") { 4920 fx.now = Math.round(total - toHide.outerHeight() - adjust); 4921 adjust = 0; 4922 } 4923 } 4924 }); 4925 }, 4926 4927 _toggleComplete: function (data) { 4928 var toHide = data.oldPanel, 4929 prev = toHide.prev(); 4930 4931 this._removeClass(toHide, "ui-accordion-content-active"); 4932 this._removeClass(prev, "ui-accordion-header-active") 4933 ._addClass(prev, "ui-accordion-header-collapsed"); 4934 4935 // Work around for rendering bug in IE (#5421) 4936 if (toHide.length) { 4937 toHide.parent()[0].className = toHide.parent()[0].className; 4938 } 4939 this._trigger("activate", null, data); 4940 } 4941 }); 4942 4943 4944 4945 var safeActiveElement = $.ui.safeActiveElement = function (document) { 4946 var activeElement; 4947 4948 // Support: IE 9 only 4949 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 4950 try { 4951 activeElement = document.activeElement; 4952 } catch (error) { 4953 activeElement = document.body; 4954 } 4955 4956 // Support: IE 9 - 11 only 4957 // IE may return null instead of an element 4958 // Interestingly, this only seems to occur when NOT in an iframe 4959 if (!activeElement) { 4960 activeElement = document.body; 4961 } 4962 4963 // Support: IE 11 only 4964 // IE11 returns a seemingly empty object in some cases when accessing 4965 // document.activeElement from an <iframe> 4966 if (!activeElement.nodeName) { 4967 activeElement = document.body; 4968 } 4969 4970 return activeElement; 4971 }; 4972 4973 4974 /*! 4975 * jQuery UI Menu 1.13.2 4976 * http://jqueryui.com 4977 * 4978 * Copyright jQuery Foundation and other contributors 4979 * Released under the MIT license. 4980 * http://jquery.org/license 4981 */ 4982 4983 //>>label: Menu 4984 //>>group: Widgets 4985 //>>description: Creates nestable menus. 4986 //>>docs: http://api.jqueryui.com/menu/ 4987 //>>demos: http://jqueryui.com/menu/ 4988 //>>css.structure: ../../themes/base/core.css 4989 //>>css.structure: ../../themes/base/menu.css 4990 //>>css.theme: ../../themes/base/theme.css 4991 4992 4993 var widgetsMenu = $.widget("ui.menu", { 4994 version: "1.13.2", 4995 defaultElement: "<ul>", 4996 delay: 300, 4997 options: { 4998 icons: { 4999 submenu: "ui-icon-caret-1-e" 5000 }, 5001 items: "> *", 5002 menus: "ul", 5003 position: { 5004 my: "left top", 5005 at: "right top" 5006 }, 5007 role: "menu", 5008 5009 // Callbacks 5010 blur: null, 5011 focus: null, 5012 select: null 5013 }, 5014 5015 _create: function () { 5016 this.activeMenu = this.element; 5017 5018 // Flag used to prevent firing of the click handler 5019 // as the event bubbles up through nested menus 5020 this.mouseHandled = false; 5021 this.lastMousePosition = { x: null, y: null }; 5022 this.element 5023 .uniqueId() 5024 .attr({ 5025 role: this.options.role, 5026 tabIndex: 0 5027 }); 5028 5029 this._addClass("ui-menu", "ui-widget ui-widget-content"); 5030 this._on({ 5031 5032 // Prevent focus from sticking to links inside menu after clicking 5033 // them (focus should always stay on UL during navigation). 5034 "mousedown .ui-menu-item": function (event) { 5035 event.preventDefault(); 5036 5037 this._activateItem(event); 5038 }, 5039 "click .ui-menu-item": function (event) { 5040 var target = $(event.target); 5041 var active = $($.ui.safeActiveElement(this.document[0])); 5042 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 5043 this.select(event); 5044 5045 // Only set the mouseHandled flag if the event will bubble, see #9469. 5046 if (!event.isPropagationStopped()) { 5047 this.mouseHandled = true; 5048 } 5049 5050 // Open submenu on click 5051 if (target.has(".ui-menu").length) { 5052 this.expand(event); 5053 } else if (!this.element.is(":focus") && 5054 active.closest(".ui-menu").length) { 5055 5056 // Redirect focus to the menu 5057 this.element.trigger("focus", [true]); 5058 5059 // If the active item is on the top level, let it stay active. 5060 // Otherwise, blur the active item since it is no longer visible. 5061 if (this.active && this.active.parents(".ui-menu").length === 1) { 5062 clearTimeout(this.timer); 5063 } 5064 } 5065 } 5066 }, 5067 "mouseenter .ui-menu-item": "_activateItem", 5068 "mousemove .ui-menu-item": "_activateItem", 5069 mouseleave: "collapseAll", 5070 "mouseleave .ui-menu": "collapseAll", 5071 focus: function (event, keepActiveItem) { 5072 5073 // If there's already an active item, keep it active 5074 // If not, activate the first item 5075 var item = this.active || this._menuItems().first(); 5076 5077 if (!keepActiveItem) { 5078 this.focus(event, item); 5079 } 5080 }, 5081 blur: function (event) { 5082 this._delay(function () { 5083 var notContained = !$.contains( 5084 this.element[0], 5085 $.ui.safeActiveElement(this.document[0]) 5086 ); 5087 if (notContained) { 5088 this.collapseAll(event); 5089 } 5090 }); 5091 }, 5092 keydown: "_keydown" 5093 }); 5094 5095 this.refresh(); 5096
vendor: 18,754 bytes, lines 5097-5615
5097 // Clicks outside of a menu collapse any open menus 5098 this._on(this.document, { 5099 click: function (event) { 5100 if (this._closeOnDocumentClick(event)) { 5101 this.collapseAll(event, true); 5102 } 5103 5104 // Reset the mouseHandled flag 5105 this.mouseHandled = false; 5106 } 5107 }); 5108 }, 5109 5110 _activateItem: function (event) { 5111 5112 // Ignore mouse events while typeahead is active, see #10458. 5113 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5114 // is over an item in the menu 5115 if (this.previousFilter) { 5116 return; 5117 } 5118 5119 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 5120 if (event.clientX === this.lastMousePosition.x && 5121 event.clientY === this.lastMousePosition.y) { 5122 return; 5123 } 5124 5125 this.lastMousePosition = { 5126 x: event.clientX, 5127 y: event.clientY 5128 }; 5129 5130 var actualTarget = $(event.target).closest(".ui-menu-item"), 5131 target = $(event.currentTarget); 5132 5133 // Ignore bubbled events on parent items, see #11641 5134 if (actualTarget[0] !== target[0]) { 5135 return; 5136 } 5137 5138 // If the item is already active, there's nothing to do 5139 if (target.is(".ui-state-active")) { 5140 return; 5141 } 5142 5143 // Remove ui-state-active class from siblings of the newly focused menu item 5144 // to avoid a jump caused by adjacent elements both having a class with a border 5145 this._removeClass(target.siblings().children(".ui-state-active"), 5146 null, "ui-state-active"); 5147 this.focus(event, target); 5148 }, 5149 5150 _destroy: function () { 5151 var items = this.element.find(".ui-menu-item") 5152 .removeAttr("role aria-disabled"), 5153 submenus = items.children(".ui-menu-item-wrapper") 5154 .removeUniqueId() 5155 .removeAttr("tabIndex role aria-haspopup"); 5156 5157 // Destroy (sub)menus 5158 this.element 5159 .removeAttr("aria-activedescendant") 5160 .find(".ui-menu").addBack() 5161 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5162 "tabIndex") 5163 .removeUniqueId() 5164 .show(); 5165 5166 submenus.children().each(function () { 5167 var elem = $(this); 5168 if (elem.data("ui-menu-submenu-caret")) { 5169 elem.remove(); 5170 } 5171 }); 5172 }, 5173 5174 _keydown: function (event) { 5175 var match, prev, character, skip, 5176 preventDefault = true; 5177 5178 switch (event.keyCode) { 5179 case $.ui.keyCode.PAGE_UP: 5180 this.previousPage(event); 5181 break; 5182 case $.ui.keyCode.PAGE_DOWN: 5183 this.nextPage(event); 5184 break; 5185 case $.ui.keyCode.HOME: 5186 this._move("first", "first", event); 5187 break; 5188 case $.ui.keyCode.END: 5189 this._move("last", "last", event); 5190 break; 5191 case $.ui.keyCode.UP: 5192 this.previous(event); 5193 break; 5194 case $.ui.keyCode.DOWN: 5195 this.next(event); 5196 break; 5197 case $.ui.keyCode.LEFT: 5198 this.collapse(event); 5199 break; 5200 case $.ui.keyCode.RIGHT: 5201 if (this.active && !this.active.is(".ui-state-disabled")) { 5202 this.expand(event); 5203 } 5204 break; 5205 case $.ui.keyCode.ENTER: 5206 case $.ui.keyCode.SPACE: 5207 this._activate(event); 5208 break; 5209 case $.ui.keyCode.ESCAPE: 5210 this.collapse(event); 5211 break; 5212 default: 5213 preventDefault = false; 5214 prev = this.previousFilter || ""; 5215 skip = false; 5216 5217 // Support number pad values 5218 character = event.keyCode >= 96 && event.keyCode <= 105 ? 5219 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 5220 5221 clearTimeout(this.filterTimer); 5222 5223 if (character === prev) { 5224 skip = true; 5225 } else { 5226 character = prev + character; 5227 } 5228 5229 match = this._filterMenuItems(character); 5230 match = skip && match.index(this.active.next()) !== -1 ? 5231 this.active.nextAll(".ui-menu-item") : 5232 match; 5233 5234 // If no matches on the current filter, reset to the last character pressed 5235 // to move down the menu to the first item that starts with that character 5236 if (!match.length) { 5237 character = String.fromCharCode(event.keyCode); 5238 match = this._filterMenuItems(character); 5239 } 5240 5241 if (match.length) { 5242 this.focus(event, match); 5243 this.previousFilter = character; 5244 this.filterTimer = this._delay(function () { 5245 delete this.previousFilter; 5246 }, 1000); 5247 } else { 5248 delete this.previousFilter; 5249 } 5250 } 5251 5252 if (preventDefault) { 5253 event.preventDefault(); 5254 } 5255 }, 5256 5257 _activate: function (event) { 5258 if (this.active && !this.active.is(".ui-state-disabled")) { 5259 if (this.active.children("[aria-haspopup='true']").length) { 5260 this.expand(event); 5261 } else { 5262 this.select(event); 5263 } 5264 } 5265 }, 5266 5267 refresh: function () { 5268 var menus, items, newSubmenus, newItems, newWrappers, 5269 that = this, 5270 icon = this.options.icons.submenu, 5271 submenus = this.element.find(this.options.menus); 5272 5273 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 5274 5275 // Initialize nested menus 5276 newSubmenus = submenus.filter(":not(.ui-menu)") 5277 .hide() 5278 .attr({ 5279 role: this.options.role, 5280 "aria-hidden": "true", 5281 "aria-expanded": "false" 5282 }) 5283 .each(function () { 5284 var menu = $(this), 5285 item = menu.prev(), 5286 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 5287 5288 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 5289 item 5290 .attr("aria-haspopup", "true") 5291 .prepend(submenuCaret); 5292 menu.attr("aria-labelledby", item.attr("id")); 5293 }); 5294 5295 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 5296 5297 menus = submenus.add(this.element); 5298 items = menus.find(this.options.items); 5299 5300 // Initialize menu-items containing spaces and/or dashes only as dividers 5301 items.not(".ui-menu-item").each(function () { 5302 var item = $(this); 5303 if (that._isDivider(item)) { 5304 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 5305 } 5306 }); 5307 5308 // Don't refresh list items that are already adapted 5309 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 5310 newWrappers = newItems.children() 5311 .not(".ui-menu") 5312 .uniqueId() 5313 .attr({ 5314 tabIndex: -1, 5315 role: this._itemRole() 5316 }); 5317 this._addClass(newItems, "ui-menu-item") 5318 ._addClass(newWrappers, "ui-menu-item-wrapper"); 5319 5320 // Add aria-disabled attribute to any disabled menu item 5321 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 5322 5323 // If the active item has been removed, blur the menu 5324 if (this.active && !$.contains(this.element[0], this.active[0])) { 5325 this.trigger("blur"); 5326 } 5327 }, 5328 5329 _itemRole: function () { 5330 return { 5331 menu: "menuitem", 5332 listbox: "option" 5333 }[this.options.role]; 5334 }, 5335 5336 _setOption: function (key, value) { 5337 if (key === "icons") { 5338 var icons = this.element.find(".ui-menu-icon"); 5339 this._removeClass(icons, null, this.options.icons.submenu) 5340 ._addClass(icons, null, value.submenu); 5341 } 5342 this._super(key, value); 5343 }, 5344 5345 _setOptionDisabled: function (value) { 5346 this._super(value); 5347 5348 this.element.attr("aria-disabled", String(value)); 5349 this._toggleClass(null, "ui-state-disabled", !!value); 5350 }, 5351 5352 focus: function (event, item) { 5353 var nested, focused, activeParent; 5354 this.blur(event, event && event.type === "focus"); 5355 5356 this._scrollIntoView(item); 5357 5358 this.active = item.first(); 5359 5360 focused = this.active.children(".ui-menu-item-wrapper"); 5361 this._addClass(focused, null, "ui-state-active"); 5362 5363 // Only update aria-activedescendant if there's a role 5364 // otherwise we assume focus is managed elsewhere 5365 if (this.options.role) { 5366 this.element.attr("aria-activedescendant", focused.attr("id")); 5367 } 5368 5369 // Highlight active parent menu item, if any 5370 activeParent = this.active 5371 .parent() 5372 .closest(".ui-menu-item") 5373 .children(".ui-menu-item-wrapper"); 5374 this._addClass(activeParent, null, "ui-state-active"); 5375 5376 if (event && event.type === "keydown") { 5377 this._close(); 5378 } else { 5379 this.timer = this._delay(function () { 5380 this._close(); 5381 }, this.delay); 5382 } 5383 5384 nested = item.children(".ui-menu"); 5385 if (nested.length && event && (/^mouse/.test(event.type))) { 5386 this._startOpening(nested); 5387 } 5388 this.activeMenu = item.parent(); 5389 5390 this._trigger("focus", event, { item: item }); 5391 }, 5392 5393 _scrollIntoView: function (item) { 5394 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5395 if (this._hasScroll()) { 5396 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 5397 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 5398 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5399 scroll = this.activeMenu.scrollTop(); 5400 elementHeight = this.activeMenu.height(); 5401 itemHeight = item.outerHeight(); 5402 5403 if (offset < 0) { 5404 this.activeMenu.scrollTop(scroll + offset); 5405 } else if (offset + itemHeight > elementHeight) { 5406 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 5407 } 5408 } 5409 }, 5410 5411 blur: function (event, fromFocus) { 5412 if (!fromFocus) { 5413 clearTimeout(this.timer); 5414 } 5415 5416 if (!this.active) { 5417 return; 5418 } 5419 5420 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 5421 null, "ui-state-active"); 5422 5423 this._trigger("blur", event, { item: this.active }); 5424 this.active = null; 5425 }, 5426 5427 _startOpening: function (submenu) { 5428 clearTimeout(this.timer); 5429 5430 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5431 // shift in the submenu position when mousing over the caret icon 5432 if (submenu.attr("aria-hidden") !== "true") { 5433 return; 5434 } 5435 5436 this.timer = this._delay(function () { 5437 this._close(); 5438 this._open(submenu); 5439 }, this.delay); 5440 }, 5441 5442 _open: function (submenu) { 5443 var position = $.extend({ 5444 of: this.active 5445 }, this.options.position); 5446 5447 clearTimeout(this.timer); 5448 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 5449 .hide() 5450 .attr("aria-hidden", "true"); 5451 5452 submenu 5453 .show() 5454 .removeAttr("aria-hidden") 5455 .attr("aria-expanded", "true") 5456 .position(position); 5457 }, 5458 5459 collapseAll: function (event, all) { 5460 clearTimeout(this.timer); 5461 this.timer = this._delay(function () { 5462 5463 // If we were passed an event, look for the submenu that contains the event 5464 var currentMenu = all ? this.element : 5465 $(event && event.target).closest(this.element.find(".ui-menu")); 5466 5467 // If we found no valid submenu ancestor, use the main menu to close all 5468 // sub menus anyway 5469 if (!currentMenu.length) { 5470 currentMenu = this.element; 5471 } 5472 5473 this._close(currentMenu); 5474 5475 this.blur(event); 5476 5477 // Work around active item staying active after menu is blurred 5478 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 5479 5480 this.activeMenu = currentMenu; 5481 }, all ? 0 : this.delay); 5482 }, 5483 5484 // With no arguments, closes the currently active menu - if nothing is active 5485 // it closes all menus. If passed an argument, it will search for menus BELOW 5486 _close: function (startMenu) { 5487 if (!startMenu) { 5488 startMenu = this.active ? this.active.parent() : this.element; 5489 } 5490 5491 startMenu.find(".ui-menu") 5492 .hide() 5493 .attr("aria-hidden", "true") 5494 .attr("aria-expanded", "false"); 5495 }, 5496 5497 _closeOnDocumentClick: function (event) { 5498 return !$(event.target).closest(".ui-menu").length; 5499 }, 5500 5501 _isDivider: function (item) { 5502 5503 // Match hyphen, em dash, en dash 5504 return !/[^\-\u2014\u2013\s]/.test(item.text()); 5505 }, 5506 5507 collapse: function (event) { 5508 var newItem = this.active && 5509 this.active.parent().closest(".ui-menu-item", this.element); 5510 if (newItem && newItem.length) { 5511 this._close(); 5512 this.focus(event, newItem); 5513 } 5514 }, 5515 5516 expand: function (event) { 5517 var newItem = this.active && this._menuItems(this.active.children(".ui-menu")).first(); 5518 5519 if (newItem && newItem.length) { 5520 this._open(newItem.parent()); 5521 5522 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 5523 this._delay(function () { 5524 this.focus(event, newItem); 5525 }); 5526 } 5527 }, 5528 5529 next: function (event) { 5530 this._move("next", "first", event); 5531 }, 5532 5533 previous: function (event) { 5534 this._move("prev", "last", event); 5535 }, 5536 5537 isFirstItem: function () { 5538 return this.active && !this.active.prevAll(".ui-menu-item").length; 5539 }, 5540 5541 isLastItem: function () { 5542 return this.active && !this.active.nextAll(".ui-menu-item").length; 5543 }, 5544 5545 _menuItems: function (menu) { 5546 return (menu || this.element) 5547 .find(this.options.items) 5548 .filter(".ui-menu-item"); 5549 }, 5550 5551 _move: function (direction, filter, event) { 5552 var next; 5553 if (this.active) { 5554 if (direction === "first" || direction === "last") { 5555 next = this.active 5556 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 5557 .last(); 5558 } else { 5559 next = this.active 5560 [direction + "All"](".ui-menu-item") 5561 .first(); 5562 } 5563 } 5564 if (!next || !next.length || !this.active) { 5565 next = this._menuItems(this.activeMenu)[filter](); 5566 } 5567 5568 this.focus(event, next); 5569 }, 5570 5571 nextPage: function (event) { 5572 var item, base, height; 5573 5574 if (!this.active) { 5575 this.next(event); 5576 return; 5577 } 5578 if (this.isLastItem()) { 5579 return; 5580 } 5581 if (this._hasScroll()) { 5582 base = this.active.offset().top; 5583 height = this.element.innerHeight(); 5584 5585 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 5586 if ($.fn.jquery.indexOf("3.2.") === 0) { 5587 height += this.element[0].offsetHeight - this.element.outerHeight(); 5588 } 5589 5590 this.active.nextAll(".ui-menu-item").each(function () { 5591 item = $(this); 5592 return item.offset().top - base - height < 0; 5593 }); 5594 5595 this.focus(event, item); 5596 } else { 5597 this.focus(event, this._menuItems(this.activeMenu) 5598 [!this.active ? "first" : "last"]()); 5599 } 5600 }, 5601 5602 previousPage: function (event) { 5603 var item, base, height; 5604 if (!this.active) { 5605 this.next(event); 5606 return; 5607 } 5608 if (this.isFirstItem()) { 5609 return; 5610 } 5611 if (this._hasScroll()) { 5612 base = this.active.offset().top; 5613 height = this.element.innerHeight(); 5614 5615 // jQuery 3.2 doesn't include scrollbars in innerHe
vendor: 4,864 bytes, lines 5615-5748
5615ight, add it back. 5616 if ($.fn.jquery.indexOf("3.2.") === 0) { 5617 height += this.element[0].offsetHeight - this.element.outerHeight(); 5618 } 5619 5620 this.active.prevAll(".ui-menu-item").each(function () { 5621 item = $(this); 5622 return item.offset().top - base + height > 0; 5623 }); 5624 5625 this.focus(event, item); 5626 } else { 5627 this.focus(event, this._menuItems(this.activeMenu).first()); 5628 } 5629 }, 5630 5631 _hasScroll: function () { 5632 return this.element.outerHeight() < this.element.prop("scrollHeight"); 5633 }, 5634 5635 select: function (event) { 5636 5637 // TODO: It should never be possible to not have an active item at this 5638 // point, but the tests don't trigger mouseenter before click. 5639 this.active = this.active || $(event.target).closest(".ui-menu-item"); 5640 var ui = { item: this.active }; 5641 if (!this.active.has(".ui-menu").length) { 5642 this.collapseAll(event, true); 5643 } 5644 this._trigger("select", event, ui); 5645 }, 5646 5647 _filterMenuItems: function (character) { 5648 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 5649 regex = new RegExp("^" + escapedCharacter, "i"); 5650 5651 return this.activeMenu 5652 .find(this.options.items) 5653 5654 // Only match on items, not dividers or other content (#10571) 5655 .filter(".ui-menu-item") 5656 .filter(function () { 5657 return regex.test( 5658 String.prototype.trim.call( 5659 $(this).children(".ui-menu-item-wrapper").text())); 5660 }); 5661 } 5662 }); 5663 5664 5665 /*! 5666 * jQuery UI Autocomplete 1.13.2 5667 * http://jqueryui.com 5668 * 5669 * Copyright jQuery Foundation and other contributors 5670 * Released under the MIT license. 5671 * http://jquery.org/license 5672 */ 5673 5674 //>>label: Autocomplete 5675 //>>group: Widgets 5676 //>>description: Lists suggested words as the user is typing. 5677 //>>docs: http://api.jqueryui.com/autocomplete/ 5678 //>>demos: http://jqueryui.com/autocomplete/ 5679 //>>css.structure: ../../themes/base/core.css 5680 //>>css.structure: ../../themes/base/autocomplete.css 5681 //>>css.theme: ../../themes/base/theme.css 5682 5683 5684 $.widget("ui.autocomplete", { 5685 version: "1.13.2", 5686 defaultElement: "<input>", 5687 options: { 5688 appendTo: null, 5689 autoFocus: false, 5690 delay: 300, 5691 minLength: 1, 5692 position: { 5693 my: "left top", 5694 at: "left bottom", 5695 collision: "none" 5696 }, 5697 source: null, 5698 5699 // Callbacks 5700 change: null, 5701 close: null, 5702 focus: null, 5703 open: null, 5704 response: null, 5705 search: null, 5706 select: null 5707 }, 5708 5709 requestIndex: 0, 5710 pending: 0, 5711 liveRegionTimer: null, 5712 5713 _create: function () { 5714 5715 // Some browsers only repeat keydown events, not keypress events, 5716 // so we use the suppressKeyPress flag to determine if we've already 5717 // handled the keydown event. #7269 5718 // Unfortunately the code for & in keypress is the same as the up arrow, 5719 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 5720 // events when we know the keydown event was used to modify the 5721 // search term. #7799 5722 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 5723 nodeName = this.element[0].nodeName.toLowerCase(), 5724 isTextarea = nodeName === "textarea", 5725 isInput = nodeName === "input"; 5726 5727 // Textareas are always multi-line 5728 // Inputs are always single-line, even if inside a contentEditable element 5729 // IE also treats inputs as contentEditable 5730 // All other element types are determined by whether or not they're contentEditable 5731 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 5732 5733 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 5734 this.isNewMenu = true; 5735 5736 this._addClass("ui-autocomplete-input"); 5737 this.element.attr("autocomplete", "off"); 5738 5739 this._on(this.element, { 5740 keydown: function (event) { 5741 if (this.element.prop("readOnly")) { 5742 suppressKeyPress = true; 5743 suppressInput = true; 5744 suppressKeyPressRepeat = true; 5745 return; 5746 } 5747 5748 suppressKeyPress = false;
vendor: 4,116 bytes, lines 5749-5838
5749 suppressInput = false; 5750 suppressKeyPressRepeat = false; 5751 var keyCode = $.ui.keyCode; 5752 switch (event.keyCode) { 5753 case keyCode.PAGE_UP: 5754 suppressKeyPress = true; 5755 this._move("previousPage", event); 5756 break; 5757 case keyCode.PAGE_DOWN: 5758 suppressKeyPress = true; 5759 this._move("nextPage", event); 5760 break; 5761 case keyCode.UP: 5762 suppressKeyPress = true; 5763 this._keyEvent("previous", event); 5764 break; 5765 case keyCode.DOWN: 5766 suppressKeyPress = true; 5767 this._keyEvent("next", event); 5768 break; 5769 case keyCode.ENTER: 5770 5771 // when menu is open and has focus 5772 if (this.menu.active) { 5773 5774 // #6055 - Opera still allows the keypress to occur 5775 // which causes forms to submit 5776 suppressKeyPress = true; 5777 event.preventDefault(); 5778 this.menu.select(event); 5779 } 5780 break; 5781 case keyCode.TAB: 5782 if (this.menu.active) { 5783 this.menu.select(event); 5784 } 5785 break; 5786 case keyCode.ESCAPE: 5787 if (this.menu.element.is(":visible")) { 5788 if (!this.isMultiLine) { 5789 this._value(this.term); 5790 } 5791 this.close(event); 5792 5793 // Different browsers have different default behavior for escape 5794 // Single press can mean undo or clear 5795 // Double press in IE means clear the whole form 5796 event.preventDefault(); 5797 } 5798 break; 5799 default: 5800 suppressKeyPressRepeat = true; 5801 5802 // search timeout should be triggered before the input value is changed 5803 this._searchTimeout(event); 5804 break; 5805 } 5806 }, 5807 keypress: function (event) { 5808 if (suppressKeyPress) { 5809 suppressKeyPress = false; 5810 if (!this.isMultiLine || this.menu.element.is(":visible")) { 5811 event.preventDefault(); 5812 } 5813 return; 5814 } 5815 if (suppressKeyPressRepeat) { 5816 return; 5817 } 5818 5819 // Replicate some key handlers to allow them to repeat in Firefox and Opera 5820 var keyCode = $.ui.keyCode; 5821 switch (event.keyCode) { 5822 case keyCode.PAGE_UP: 5823 this._move("previousPage", event); 5824 break; 5825 case keyCode.PAGE_DOWN: 5826 this._move("nextPage", event); 5827 break; 5828 case keyCode.UP: 5829 this._keyEvent("previous", event); 5830 break; 5831 case keyCode.DOWN: 5832 this._keyEvent("next", event); 5833 break; 5834 } 5835 }, 5836 input: function (event) { 5837 if (suppressInput) { 5838 suppressInput = false;
vendor: 8,429 bytes, lines 5839-6058
5839 event.preventDefault(); 5840 return; 5841 } 5842 this._searchTimeout(event); 5843 }, 5844 focus: function () { 5845 this.selectedItem = null; 5846 this.previous = this._value(); 5847 }, 5848 blur: function (event) { 5849 clearTimeout(this.searching); 5850 this.close(event); 5851 this._change(event); 5852 } 5853 }); 5854 5855 this._initSource(); 5856 this.menu = $("<ul>") 5857 .appendTo(this._appendTo()) 5858 .menu({ 5859 5860 // disable ARIA support, the live region takes care of that 5861 role: null 5862 }) 5863 .hide() 5864 5865 // Support: IE 11 only, Edge <= 14 5866 // For other browsers, we preventDefault() on the mousedown event 5867 // to keep the dropdown from taking focus from the input. This doesn't 5868 // work for IE/Edge, causing problems with selection and scrolling (#9638) 5869 // Happily, IE and Edge support an "unselectable" attribute that 5870 // prevents an element from receiving focus, exactly what we want here. 5871 .attr({ 5872 "unselectable": "on" 5873 }) 5874 .menu("instance"); 5875 5876 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 5877 this._on(this.menu.element, { 5878 mousedown: function (event) { 5879 5880 // Prevent moving focus out of the text field 5881 event.preventDefault(); 5882 }, 5883 menufocus: function (event, ui) { 5884 var label, item; 5885 5886 // support: Firefox 5887 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 5888 if (this.isNewMenu) { 5889 this.isNewMenu = false; 5890 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 5891 this.menu.trigger("blur"); 5892 5893 this.document.one("mousemove", function () { 5894 $(event.target).trigger(event.originalEvent); 5895 }); 5896 5897 return; 5898 } 5899 } 5900 5901 item = ui.item.data("ui-autocomplete-item"); 5902 if (false !== this._trigger("focus", event, { item: item })) { 5903 5904 // use value to match what will end up in the input, if it was a key event 5905 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 5906 this._value(item.value); 5907 } 5908 } 5909 5910 // Announce the value in the liveRegion 5911 label = ui.item.attr("aria-label") || item.value; 5912 if (label && String.prototype.trim.call(label).length) { 5913 clearTimeout(this.liveRegionTimer); 5914 this.liveRegionTimer = this._delay(function () { 5915 this.liveRegion.html($("<div>").text(label)); 5916 }, 100); 5917 } 5918 }, 5919 menuselect: function (event, ui) { 5920 var item = ui.item.data("ui-autocomplete-item"), 5921 previous = this.previous; 5922 5923 // Only trigger when focus was lost (click on menu) 5924 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 5925 this.element.trigger("focus"); 5926 this.previous = previous; 5927 5928 // #6109 - IE triggers two focus events and the second 5929 // is asynchronous, so we need to reset the previous 5930 // term synchronously and asynchronously :-( 5931 this._delay(function () { 5932 this.previous = previous; 5933 this.selectedItem = item; 5934 }); 5935 } 5936 5937 if (false !== this._trigger("select", event, { item: item })) { 5938 this._value(item.value); 5939 } 5940 5941 // reset the term after the select event 5942 // this allows custom select handling to work properly 5943 this.term = this._value(); 5944 5945 this.close(event); 5946 this.selectedItem = item; 5947 } 5948 }); 5949 5950 this.liveRegion = $("<div>", { 5951 role: "status", 5952 "aria-live": "assertive", 5953 "aria-relevant": "additions" 5954 }) 5955 .appendTo(this.document[0].body); 5956 5957 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 5958 5959 // Turning off autocomplete prevents the browser from remembering the 5960 // value when navigating through history, so we re-enable autocomplete 5961 // if the page is unloaded before the widget is destroyed. #7790 5962 this._on(this.window, { 5963 beforeunload: function () { 5964 this.element.removeAttr("autocomplete"); 5965 } 5966 }); 5967 }, 5968 5969 _destroy: function () { 5970 clearTimeout(this.searching); 5971 this.element.removeAttr("autocomplete"); 5972 this.menu.element.remove(); 5973 this.liveRegion.remove(); 5974 }, 5975 5976 _setOption: function (key, value) { 5977 this._super(key, value); 5978 if (key === "source") { 5979 this._initSource(); 5980 } 5981 if (key === "appendTo") { 5982 this.menu.element.appendTo(this._appendTo()); 5983 } 5984 if (key === "disabled" && value && this.xhr) { 5985 this.xhr.abort(); 5986 } 5987 }, 5988 5989 _isEventTargetInWidget: function (event) { 5990 var menuElement = this.menu.element[0]; 5991 5992 return event.target === this.element[0] || 5993 event.target === menuElement || 5994 $.contains(menuElement, event.target); 5995 }, 5996 5997 _closeOnClickOutside: function (event) { 5998 if (!this._isEventTargetInWidget(event)) { 5999 this.close(); 6000 } 6001 }, 6002 6003 _appendTo: function () { 6004 var element = this.options.appendTo; 6005 6006 if (element) { 6007 element = element.jquery || element.nodeType ? 6008 $(element) : 6009 this.document.find(element).eq(0); 6010 } 6011 6012 if (!element || !element[0]) { 6013 element = this.element.closest(".ui-front, dialog"); 6014 } 6015 6016 if (!element.length) { 6017 element = this.document[0].body; 6018 } 6019 6020 return element; 6021 }, 6022 6023 _initSource: function () { 6024 var array, url, 6025 that = this; 6026 if (Array.isArray(this.options.source)) { 6027 array = this.options.source; 6028 this.source = function (request, response) { 6029 response($.ui.autocomplete.filter(array, request.term)); 6030 }; 6031 } else if (typeof this.options.source === "string") { 6032 url = this.options.source; 6033 this.source = function (request, response) { 6034 if (that.xhr) { 6035 that.xhr.abort(); 6036 } 6037 that.xhr = $.ajax({ 6038 url: url, 6039 data: request, 6040 dataType: "json", 6041 success: function (data) { 6042 response(data); 6043 }, 6044 error: function () { 6045 response([]); 6046 } 6047 }); 6048 }; 6049 } else { 6050 this.source = this.options.source; 6051 } 6052 }, 6053 6054 _searchTimeout: function (event) { 6055 clearTimeout(this.searching); 6056 this.searching = this._delay(function () { 6057 6058 // Search if the value has changed, or if the user retypes the same value (see #7434)
vendor: 6,170 bytes, lines 6059-6254
6059 var equalValues = this.term === this._value(), 6060 menuVisible = this.menu.element.is(":visible"), 6061 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 6062 6063 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 6064 this.selectedItem = null; 6065 this.search(null, event); 6066 } 6067 }, this.options.delay); 6068 }, 6069 6070 search: function (value, event) { 6071 value = value != null ? value : this._value(); 6072 6073 // Always save the actual value, not the one passed as an argument 6074 this.term = this._value(); 6075 6076 if (value.length < this.options.minLength) { 6077 return this.close(event); 6078 } 6079 6080 if (this._trigger("search", event) === false) { 6081 return; 6082 } 6083 6084 return this._search(value); 6085 }, 6086 6087 _search: function (value) { 6088 this.pending++; 6089 this._addClass("ui-autocomplete-loading"); 6090 this.cancelSearch = false; 6091 6092 this.source({ term: value }, this._response()); 6093 }, 6094 6095 _response: function () { 6096 var index = ++this.requestIndex; 6097 6098 return function (content) { 6099 if (index === this.requestIndex) { 6100 this.__response(content); 6101 } 6102 6103 this.pending--; 6104 if (!this.pending) { 6105 this._removeClass("ui-autocomplete-loading"); 6106 } 6107 }.bind(this); 6108 }, 6109 6110 __response: function (content) { 6111 if (content) { 6112 content = this._normalize(content); 6113 } 6114 this._trigger("response", null, { content: content }); 6115 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 6116 this._suggest(content); 6117 this._trigger("open"); 6118 } else { 6119 6120 // use ._close() instead of .close() so we don't cancel future searches 6121 this._close(); 6122 } 6123 }, 6124 6125 close: function (event) { 6126 this.cancelSearch = true; 6127 this._close(event); 6128 }, 6129 6130 _close: function (event) { 6131 6132 // Remove the handler that closes the menu on outside clicks 6133 this._off(this.document, "mousedown"); 6134 6135 if (this.menu.element.is(":visible")) { 6136 this.menu.element.hide(); 6137 this.menu.trigger("blur"); 6138 this.isNewMenu = true; 6139 this._trigger("close", event); 6140 } 6141 }, 6142 6143 _change: function (event) { 6144 if (this.previous !== this._value()) { 6145 this._trigger("change", event, { item: this.selectedItem }); 6146 } 6147 }, 6148 6149 _normalize: function (items) { 6150 6151 // assume all items have the right format when the first item is complete 6152 if (items.length && items[0].label && items[0].value) { 6153 return items; 6154 } 6155 return $.map(items, function (item) { 6156 if (typeof item === "string") { 6157 return { 6158 label: item, 6159 value: item 6160 }; 6161 } 6162 return $.extend({}, item, { 6163 label: item.label || item.value, 6164 value: item.value || item.label 6165 }); 6166 }); 6167 }, 6168 6169 _suggest: function (items) { 6170 var ul = this.menu.element.empty(); 6171 this._renderMenu(ul, items); 6172 this.isNewMenu = true; 6173 this.menu.refresh(); 6174 6175 // Size and position menu 6176 ul.show(); 6177 this._resizeMenu(); 6178 ul.position($.extend({ 6179 of: this.element 6180 }, this.options.position)); 6181 6182 if (this.options.autoFocus) { 6183 this.menu.next(); 6184 } 6185 6186 // Listen for interactions outside of the widget (#6642) 6187 this._on(this.document, { 6188 mousedown: "_closeOnClickOutside" 6189 }); 6190 }, 6191 6192 _resizeMenu: function () { 6193 var ul = this.menu.element; 6194 ul.outerWidth(Math.max( 6195 6196 // Firefox wraps long text (possibly a rounding bug) 6197 // so we add 1px to avoid the wrapping (#7513) 6198 ul.width("").outerWidth() + 1, 6199 this.element.outerWidth() 6200 )); 6201 }, 6202 6203 _renderMenu: function (ul, items) { 6204 var that = this; 6205 $.each(items, function (index, item) { 6206 that._renderItemData(ul, item); 6207 }); 6208 }, 6209 6210 _renderItemData: function (ul, item) { 6211 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 6212 }, 6213 6214 _renderItem: function (ul, item) { 6215 return $("<li>") 6216 .append($("<div>").text(item.label)) 6217 .appendTo(ul); 6218 }, 6219 6220 _move: function (direction, event) { 6221 if (!this.menu.element.is(":visible")) { 6222 this.search(null, event); 6223 return; 6224 } 6225 if (this.menu.isFirstItem() && /^previous/.test(direction) || 6226 this.menu.isLastItem() && /^next/.test(direction)) { 6227 6228 if (!this.isMultiLine) { 6229 this._value(this.term); 6230 } 6231 6232 this.menu.trigger("blur"); 6233 return; 6234 } 6235 this.menu[direction](event); 6236 }, 6237 6238 widget: function () { 6239 return this.menu.element; 6240 }, 6241 6242 _value: function () { 6243 return this.valueMethod.apply(this.element, arguments); 6244 }, 6245 6246 _keyEvent: function (keyEvent, event) { 6247 if (!this.isMultiLine || this.menu.element.is(":visible")) { 6248 this._move(keyEvent, event); 6249 6250 // Prevents moving cursor to beginning/end of the text field in some browsers 6251 event.preventDefault(); 6252 } 6253 }, 6254
vendor: 5,719 bytes, lines 6255-6415
6255 // Support: Chrome <=50 6256 // We should be able to just use this.element.prop( "isContentEditable" ) 6257 // but hidden elements always report false in Chrome. 6258 // https://code.google.com/p/chromium/issues/detail?id=313082 6259 _isContentEditable: function (element) { 6260 if (!element.length) { 6261 return false; 6262 } 6263 6264 var editable = element.prop("contentEditable"); 6265 6266 if (editable === "inherit") { 6267 return this._isContentEditable(element.parent()); 6268 } 6269 6270 return editable === "true"; 6271 } 6272 }); 6273 6274 $.extend($.ui.autocomplete, { 6275 escapeRegex: function (value) { 6276 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 6277 }, 6278 filter: function (array, term) { 6279 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 6280 return $.grep(array, function (value) { 6281 return matcher.test(value.label || value.value || value); 6282 }); 6283 } 6284 }); 6285 6286 // Live region extension, adding a `messages` option 6287 // NOTE: This is an experimental API. We are still investigating 6288 // a full solution for string manipulation and internationalization. 6289 $.widget("ui.autocomplete", $.ui.autocomplete, { 6290 options: { 6291 messages: { 6292 noResults: "No search results.", 6293 results: function (amount) { 6294 return amount + (amount > 1 ? " results are" : " result is") + 6295 " available, use up and down arrow keys to navigate."; 6296 } 6297 } 6298 }, 6299 6300 __response: function (content) { 6301 var message; 6302 this._superApply(arguments); 6303 if (this.options.disabled || this.cancelSearch) { 6304 return; 6305 } 6306 if (content && content.length) { 6307 message = this.options.messages.results(content.length); 6308 } else { 6309 message = this.options.messages.noResults; 6310 } 6311 clearTimeout(this.liveRegionTimer); 6312 this.liveRegionTimer = this._delay(function () { 6313 this.liveRegion.html($("<div>").text(message)); 6314 }, 100); 6315 } 6316 }); 6317 6318 var widgetsAutocomplete = $.ui.autocomplete; 6319 6320 6321 /*! 6322 * jQuery UI Controlgroup 1.13.2 6323 * http://jqueryui.com 6324 * 6325 * Copyright jQuery Foundation and other contributors 6326 * Released under the MIT license. 6327 * http://jquery.org/license 6328 */ 6329 6330 //>>label: Controlgroup 6331 //>>group: Widgets 6332 //>>description: Visually groups form control widgets 6333 //>>docs: http://api.jqueryui.com/controlgroup/ 6334 //>>demos: http://jqueryui.com/controlgroup/ 6335 //>>css.structure: ../../themes/base/core.css 6336 //>>css.structure: ../../themes/base/controlgroup.css 6337 //>>css.theme: ../../themes/base/theme.css 6338 6339 6340 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6341 6342 var widgetsControlgroup = $.widget("ui.controlgroup", { 6343 version: "1.13.2", 6344 defaultElement: "<div>", 6345 options: { 6346 direction: "horizontal", 6347 disabled: null, 6348 onlyVisible: true, 6349 items: { 6350 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6351 "controlgroupLabel": ".ui-controlgroup-label", 6352 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6353 "selectmenu": "select", 6354 "spinner": ".ui-spinner-input" 6355 } 6356 }, 6357 6358 _create: function () { 6359 this._enhance(); 6360 }, 6361 6362 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6363 _enhance: function () { 6364 this.element.attr("role", "toolbar"); 6365 this.refresh(); 6366 }, 6367 6368 _destroy: function () { 6369 this._callChildMethod("destroy"); 6370 this.childWidgets.removeData("ui-controlgroup-data"); 6371 this.element.removeAttr("role"); 6372 if (this.options.items.controlgroupLabel) { 6373 this.element 6374 .find(this.options.items.controlgroupLabel) 6375 .find(".ui-controlgroup-label-contents") 6376 .contents().unwrap(); 6377 } 6378 }, 6379 6380 _initWidgets: function () { 6381 var that = this, 6382 childWidgets = []; 6383 6384 // First we iterate over each of the items options 6385 $.each(this.options.items, function (widget, selector) { 6386 var labels; 6387 var options = {}; 6388 6389 // Make sure the widget has a selector set 6390 if (!selector) { 6391 return; 6392 } 6393 6394 if (widget === "controlgroupLabel") { 6395 labels = that.element.find(selector); 6396 labels.each(function () { 6397 var element = $(this); 6398 6399 if (element.children(".ui-controlgroup-label-contents").length) { 6400 return; 6401 } 6402 element.contents() 6403 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 6404 }); 6405 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 6406 childWidgets = childWidgets.concat(labels.get()); 6407 return; 6408 } 6409 6410 // Make sure the widget actually exists 6411 if (!$.fn[widget]) { 6412 return; 6413 } 6414 6415 // We assume everything is in the middle to start be
vendor: 10,965 bytes, lines 6415-6696
6415cause we can't determine 6416 // first / last elements until all enhancments are done. 6417 if (that["_" + widget + "Options"]) { 6418 options = that["_" + widget + "Options"]("middle"); 6419 } else { 6420 options = { classes: {} }; 6421 } 6422 6423 // Find instances of this widget inside controlgroup and init them 6424 that.element 6425 .find(selector) 6426 .each(function () { 6427 var element = $(this); 6428 var instance = element[widget]("instance"); 6429 6430 // We need to clone the default options for this type of widget to avoid 6431 // polluting the variable options which has a wider scope than a single widget. 6432 var instanceOptions = $.widget.extend({}, options); 6433 6434 // If the button is the child of a spinner ignore it 6435 // TODO: Find a more generic solution 6436 if (widget === "button" && element.parent(".ui-spinner").length) { 6437 return; 6438 } 6439 6440 // Create the widget if it doesn't exist 6441 if (!instance) { 6442 instance = element[widget]()[widget]("instance"); 6443 } 6444 if (instance) { 6445 instanceOptions.classes = 6446 that._resolveClassesValues(instanceOptions.classes, instance); 6447 } 6448 element[widget](instanceOptions); 6449 6450 // Store an instance of the controlgroup to be able to reference 6451 // from the outermost element for changing options and refresh 6452 var widgetElement = element[widget]("widget"); 6453 $.data(widgetElement[0], "ui-controlgroup-data", 6454 instance ? instance : element[widget]("instance")); 6455 6456 childWidgets.push(widgetElement[0]); 6457 }); 6458 }); 6459 6460 this.childWidgets = $($.uniqueSort(childWidgets)); 6461 this._addClass(this.childWidgets, "ui-controlgroup-item"); 6462 }, 6463 6464 _callChildMethod: function (method) { 6465 this.childWidgets.each(function () { 6466 var element = $(this), 6467 data = element.data("ui-controlgroup-data"); 6468 if (data && data[method]) { 6469 data[method](); 6470 } 6471 }); 6472 }, 6473 6474 _updateCornerClass: function (element, position) { 6475 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6476 var add = this._buildSimpleOptions(position, "label").classes.label; 6477 6478 this._removeClass(element, null, remove); 6479 this._addClass(element, null, add); 6480 }, 6481 6482 _buildSimpleOptions: function (position, key) { 6483 var direction = this.options.direction === "vertical"; 6484 var result = { 6485 classes: {} 6486 }; 6487 result.classes[key] = { 6488 "middle": "", 6489 "first": "ui-corner-" + (direction ? "top" : "left"), 6490 "last": "ui-corner-" + (direction ? "bottom" : "right"), 6491 "only": "ui-corner-all" 6492 }[position]; 6493 6494 return result; 6495 }, 6496 6497 _spinnerOptions: function (position) { 6498 var options = this._buildSimpleOptions(position, "ui-spinner"); 6499 6500 options.classes["ui-spinner-up"] = ""; 6501 options.classes["ui-spinner-down"] = ""; 6502 6503 return options; 6504 }, 6505 6506 _buttonOptions: function (position) { 6507 return this._buildSimpleOptions(position, "ui-button"); 6508 }, 6509 6510 _checkboxradioOptions: function (position) { 6511 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 6512 }, 6513 6514 _selectmenuOptions: function (position) { 6515 var direction = this.options.direction === "vertical"; 6516 return { 6517 width: direction ? "auto" : false, 6518 classes: { 6519 middle: { 6520 "ui-selectmenu-button-open": "", 6521 "ui-selectmenu-button-closed": "" 6522 }, 6523 first: { 6524 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 6525 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 6526 }, 6527 last: { 6528 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 6529 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 6530 }, 6531 only: { 6532 "ui-selectmenu-button-open": "ui-corner-top", 6533 "ui-selectmenu-button-closed": "ui-corner-all" 6534 } 6535 6536 }[position] 6537 }; 6538 }, 6539 6540 _resolveClassesValues: function (classes, instance) { 6541 var result = {}; 6542 $.each(classes, function (key) { 6543 var current = instance.options.classes[key] || ""; 6544 current = String.prototype.trim.call(current.replace(controlgroupCornerRegex, "")); 6545 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 6546 }); 6547 return result; 6548 }, 6549 6550 _setOption: function (key, value) { 6551 if (key === "direction") { 6552 this._removeClass("ui-controlgroup-" + this.options.direction); 6553 } 6554 6555 this._super(key, value); 6556 if (key === "disabled") { 6557 this._callChildMethod(value ? "disable" : "enable"); 6558 return; 6559 } 6560 6561 this.refresh(); 6562 }, 6563 6564 refresh: function () { 6565 var children, 6566 that = this; 6567 6568 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 6569 6570 if (this.options.direction === "horizontal") { 6571 this._addClass(null, "ui-helper-clearfix"); 6572 } 6573 this._initWidgets(); 6574 6575 children = this.childWidgets; 6576 6577 // We filter here because we need to track all childWidgets not just the visible ones 6578 if (this.options.onlyVisible) { 6579 children = children.filter(":visible"); 6580 } 6581 6582 if (children.length) { 6583 6584 // We do this last because we need to make sure all enhancment is done 6585 // before determining first and last 6586 $.each(["first", "last"], function (index, value) { 6587 var instance = children[value]().data("ui-controlgroup-data"); 6588 6589 if (instance && that["_" + instance.widgetName + "Options"]) { 6590 var options = that["_" + instance.widgetName + "Options"]( 6591 children.length === 1 ? "only" : value 6592 ); 6593 options.classes = that._resolveClassesValues(options.classes, instance); 6594 instance.element[instance.widgetName](options); 6595 } else { 6596 that._updateCornerClass(children[value](), value); 6597 } 6598 }); 6599 6600 // Finally call the refresh method on each of the child widgets. 6601 this._callChildMethod("refresh"); 6602 } 6603 } 6604 }); 6605 6606 /*! 6607 * jQuery UI Checkboxradio 1.13.2 6608 * http://jqueryui.com 6609 * 6610 * Copyright jQuery Foundation and other contributors 6611 * Released under the MIT license. 6612 * http://jquery.org/license 6613 */ 6614 6615 //>>label: Checkboxradio 6616 //>>group: Widgets 6617 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 6618 //>>docs: http://api.jqueryui.com/checkboxradio/ 6619 //>>demos: http://jqueryui.com/checkboxradio/ 6620 //>>css.structure: ../../themes/base/core.css 6621 //>>css.structure: ../../themes/base/button.css 6622 //>>css.structure: ../../themes/base/checkboxradio.css 6623 //>>css.theme: ../../themes/base/theme.css 6624 6625 6626 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 6627 version: "1.13.2", 6628 options: { 6629 disabled: null, 6630 label: null, 6631 icon: true, 6632 classes: { 6633 "ui-checkboxradio-label": "ui-corner-all", 6634 "ui-checkboxradio-icon": "ui-corner-all" 6635 } 6636 }, 6637 6638 _getCreateOptions: function () { 6639 var disabled, labels, labelContents; 6640 var options = this._super() || {}; 6641 6642 // We read the type here, because it makes more sense to throw a element type error first, 6643 // rather then the error for lack of a label. Often if its the wrong type, it 6644 // won't have a label (e.g. calling on a div, btn, etc) 6645 this._readType(); 6646 6647 labels = this.element.labels(); 6648 6649 // If there are multiple labels, use the last one 6650 this.label = $(labels[labels.length - 1]); 6651 if (!this.label.length) { 6652 $.error("No label found for checkboxradio widget"); 6653 } 6654 6655 this.originalLabel = ""; 6656 6657 // We need to get the label text but this may also need to make sure it does not contain the 6658 // input itself. 6659 // The label contents could be text, html, or a mix. We wrap all elements 6660 // and read the wrapper's `innerHTML` to get a string representation of 6661 // the label, without the input as part of it. 6662 labelContents = this.label.contents().not(this.element[0]); 6663 6664 if (labelContents.length) { 6665 this.originalLabel += labelContents 6666 .clone() 6667 .wrapAll("<div></div>") 6668 .parent() 6669 .html(); 6670 } 6671 6672 // Set the label option if we found label text 6673 if (this.originalLabel) { 6674 options.label = this.originalLabel; 6675 } 6676 6677 disabled = this.element[0].disabled; 6678 if (disabled != null) { 6679 options.disabled = disabled; 6680 } 6681 return options; 6682 }, 6683 6684 _create: function () { 6685 var checked = this.element[0].checked; 6686 6687 this._bindFormResetHandler(); 6688 6689 if (this.options.disabled == null) { 6690 this.options.disabled = this.element[0].disabled; 6691 } 6692 6693 this._setOption("disabled", this.options.disabled); 6694 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 6695 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 6696
vendor: 4,117 bytes, lines 6697-6820
6697 if (this.type === "radio") { 6698 this._addClass(this.label, "ui-checkboxradio-radio-label"); 6699 } 6700 6701 if (this.options.label && this.options.label !== this.originalLabel) { 6702 this._updateLabel(); 6703 } else if (this.originalLabel) { 6704 this.options.label = this.originalLabel; 6705 } 6706 6707 this._enhance(); 6708 6709 if (checked) { 6710 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 6711 } 6712 6713 this._on({ 6714 change: "_toggleClasses", 6715 focus: function () { 6716 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 6717 }, 6718 blur: function () { 6719 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 6720 } 6721 }); 6722 }, 6723 6724 _readType: function () { 6725 var nodeName = this.element[0].nodeName.toLowerCase(); 6726 this.type = this.element[0].type; 6727 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 6728 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 6729 " and element.type=" + this.type); 6730 } 6731 }, 6732 6733 // Support jQuery Mobile enhanced option 6734 _enhance: function () { 6735 this._updateIcon(this.element[0].checked); 6736 }, 6737 6738 widget: function () { 6739 return this.label; 6740 }, 6741 6742 _getRadioGroup: function () { 6743 var group; 6744 var name = this.element[0].name; 6745 var nameSelector = "input[name='" + $.escapeSelector(name) + "']"; 6746 6747 if (!name) { 6748 return $([]); 6749 } 6750 6751 if (this.form.length) { 6752 group = $(this.form[0].elements).filter(nameSelector); 6753 } else { 6754 6755 // Not inside a form, check all inputs that also are not inside a form 6756 group = $(nameSelector).filter(function () { 6757 return $(this)._form().length === 0; 6758 }); 6759 } 6760 6761 return group.not(this.element); 6762 }, 6763 6764 _toggleClasses: function () { 6765 var checked = this.element[0].checked; 6766 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 6767 6768 if (this.options.icon && this.type === "checkbox") { 6769 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 6770 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 6771 } 6772 6773 if (this.type === "radio") { 6774 this._getRadioGroup() 6775 .each(function () { 6776 var instance = $(this).checkboxradio("instance"); 6777 6778 if (instance) { 6779 instance._removeClass(instance.label, 6780 "ui-checkboxradio-checked", "ui-state-active"); 6781 } 6782 }); 6783 } 6784 }, 6785 6786 _destroy: function () { 6787 this._unbindFormResetHandler(); 6788 6789 if (this.icon) { 6790 this.icon.remove(); 6791 this.iconSpace.remove(); 6792 } 6793 }, 6794 6795 _setOption: function (key, value) { 6796 6797 // We don't allow the value to be set to nothing 6798 if (key === "label" && !value) { 6799 return; 6800 } 6801 6802 this._super(key, value); 6803 6804 if (key === "disabled") { 6805 this._toggleClass(this.label, null, "ui-state-disabled", value); 6806 this.element[0].disabled = value; 6807 6808 // Don't refresh when setting disabled 6809 return; 6810 } 6811 this.refresh(); 6812 }, 6813 6814 _updateIcon: function (checked) { 6815 var toAdd = "ui-icon ui-icon-background "; 6816 6817 if (this.options.icon) { 6818 if (!this.icon) { 6819 this.icon = $("<span>"); 6820 this.iconSpace = $("<span> </span>");
vendor: 7,612 bytes, lines 6821-7036
6821 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 6822 } 6823 6824 if (this.type === "checkbox") { 6825 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 6826 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 6827 } else { 6828 toAdd += "ui-icon-blank"; 6829 } 6830 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 6831 if (!checked) { 6832 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 6833 } 6834 this.icon.prependTo(this.label).after(this.iconSpace); 6835 } else if (this.icon !== undefined) { 6836 this.icon.remove(); 6837 this.iconSpace.remove(); 6838 delete this.icon; 6839 } 6840 }, 6841 6842 _updateLabel: function () { 6843 6844 // Remove the contents of the label ( minus the icon, icon space, and input ) 6845 var contents = this.label.contents().not(this.element[0]); 6846 if (this.icon) { 6847 contents = contents.not(this.icon[0]); 6848 } 6849 if (this.iconSpace) { 6850 contents = contents.not(this.iconSpace[0]); 6851 } 6852 contents.remove(); 6853 6854 this.label.append(this.options.label); 6855 }, 6856 6857 refresh: function () { 6858 var checked = this.element[0].checked, 6859 isDisabled = this.element[0].disabled; 6860 6861 this._updateIcon(checked); 6862 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 6863 if (this.options.label !== null) { 6864 this._updateLabel(); 6865 } 6866 6867 if (isDisabled !== this.options.disabled) { 6868 this._setOptions({ "disabled": isDisabled }); 6869 } 6870 } 6871 6872 }]); 6873 6874 var widgetsCheckboxradio = $.ui.checkboxradio; 6875 6876 6877 /*! 6878 * jQuery UI Button 1.13.2 6879 * http://jqueryui.com 6880 * 6881 * Copyright jQuery Foundation and other contributors 6882 * Released under the MIT license. 6883 * http://jquery.org/license 6884 */ 6885 6886 //>>label: Button 6887 //>>group: Widgets 6888 //>>description: Enhances a form with themeable buttons. 6889 //>>docs: http://api.jqueryui.com/button/ 6890 //>>demos: http://jqueryui.com/button/ 6891 //>>css.structure: ../../themes/base/core.css 6892 //>>css.structure: ../../themes/base/button.css 6893 //>>css.theme: ../../themes/base/theme.css 6894 6895 6896 $.widget("ui.button", { 6897 version: "1.13.2", 6898 defaultElement: "<button>", 6899 options: { 6900 classes: { 6901 "ui-button": "ui-corner-all" 6902 }, 6903 disabled: null, 6904 icon: null, 6905 iconPosition: "beginning", 6906 label: null, 6907 showLabel: true 6908 }, 6909 6910 _getCreateOptions: function () { 6911 var disabled, 6912 6913 // This is to support cases like in jQuery Mobile where the base widget does have 6914 // an implementation of _getCreateOptions 6915 options = this._super() || {}; 6916 6917 this.isInput = this.element.is("input"); 6918 6919 disabled = this.element[0].disabled; 6920 if (disabled != null) { 6921 options.disabled = disabled; 6922 } 6923 6924 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 6925 if (this.originalLabel) { 6926 options.label = this.originalLabel; 6927 } 6928 6929 return options; 6930 }, 6931 6932 _create: function () { 6933 if (!this.option.showLabel & !this.options.icon) { 6934 this.options.showLabel = true; 6935 } 6936 6937 // We have to check the option again here even though we did in _getCreateOptions, 6938 // because null may have been passed on init which would override what was set in 6939 // _getCreateOptions 6940 if (this.options.disabled == null) { 6941 this.options.disabled = this.element[0].disabled || false; 6942 } 6943 6944 this.hasTitle = !!this.element.attr("title"); 6945 6946 // Check to see if the label needs to be set or if its already correct 6947 if (this.options.label && this.options.label !== this.originalLabel) { 6948 if (this.isInput) { 6949 this.element.val(this.options.label); 6950 } else { 6951 this.element.html(this.options.label); 6952 } 6953 } 6954 this._addClass("ui-button", "ui-widget"); 6955 this._setOption("disabled", this.options.disabled); 6956 this._enhance(); 6957 6958 if (this.element.is("a")) { 6959 this._on({ 6960 "keyup": function (event) { 6961 if (event.keyCode === $.ui.keyCode.SPACE) { 6962 event.preventDefault(); 6963 6964 // Support: PhantomJS <= 1.9, IE 8 Only 6965 // If a native click is available use it so we actually cause navigation 6966 // otherwise just trigger a click event 6967 if (this.element[0].click) { 6968 this.element[0].click(); 6969 } else { 6970 this.element.trigger("click"); 6971 } 6972 } 6973 } 6974 }); 6975 } 6976 }, 6977 6978 _enhance: function () { 6979 if (!this.element.is("button")) { 6980 this.element.attr("role", "button"); 6981 } 6982 6983 if (this.options.icon) { 6984 this._updateIcon("icon", this.options.icon); 6985 this._updateTooltip(); 6986 } 6987 }, 6988 6989 _updateTooltip: function () { 6990 this.title = this.element.attr("title"); 6991 6992 if (!this.options.showLabel && !this.title) { 6993 this.element.attr("title", this.options.label); 6994 } 6995 }, 6996 6997 _updateIcon: function (option, value) { 6998 var icon = option !== "iconPosition", 6999 position = icon ? this.options.iconPosition : value, 7000 displayBlock = position === "top" || position === "bottom"; 7001 7002 // Create icon 7003 if (!this.icon) { 7004 this.icon = $("<span>"); 7005 7006 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 7007 7008 if (!this.options.showLabel) { 7009 this._addClass("ui-button-icon-only"); 7010 } 7011 } else if (icon) { 7012 7013 // If we are updating the icon remove the old icon class 7014 this._removeClass(this.icon, null, this.options.icon); 7015 } 7016 7017 // If we are updating the icon add the new icon class 7018 if (icon) { 7019 this._addClass(this.icon, null, value); 7020 } 7021 7022 this._attachIcon(position); 7023 7024 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 7025 // the iconSpace if there is one. 7026 if (displayBlock) { 7027 this._addClass(this.icon, null, "ui-widget-icon-block"); 7028 if (this.iconSpace) { 7029 this.iconSpace.remove(); 7030 } 7031 } else { 7032 7033 // Position is beginning or end so remove the ui-widget-icon-block class and add the 7034 // space if it does not exist 7035 if (!this.iconSpace) { 7036 this.iconSpace = $("<span> </span>");
vendor: 6,833 bytes, lines 7037-7222
7037 this._addClass(this.iconSpace, "ui-button-icon-space"); 7038 } 7039 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 7040 this._attachIconSpace(position); 7041 } 7042 }, 7043 7044 _destroy: function () { 7045 this.element.removeAttr("role"); 7046 7047 if (this.icon) { 7048 this.icon.remove(); 7049 } 7050 if (this.iconSpace) { 7051 this.iconSpace.remove(); 7052 } 7053 if (!this.hasTitle) { 7054 this.element.removeAttr("title"); 7055 } 7056 }, 7057 7058 _attachIconSpace: function (iconPosition) { 7059 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 7060 }, 7061 7062 _attachIcon: function (iconPosition) { 7063 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 7064 }, 7065 7066 _setOptions: function (options) { 7067 var newShowLabel = options.showLabel === undefined ? 7068 this.options.showLabel : 7069 options.showLabel, 7070 newIcon = options.icon === undefined ? this.options.icon : options.icon; 7071 7072 if (!newShowLabel && !newIcon) { 7073 options.showLabel = true; 7074 } 7075 this._super(options); 7076 }, 7077 7078 _setOption: function (key, value) { 7079 if (key === "icon") { 7080 if (value) { 7081 this._updateIcon(key, value); 7082 } else if (this.icon) { 7083 this.icon.remove(); 7084 if (this.iconSpace) { 7085 this.iconSpace.remove(); 7086 } 7087 } 7088 } 7089 7090 if (key === "iconPosition") { 7091 this._updateIcon(key, value); 7092 } 7093 7094 // Make sure we can't end up with a button that has neither text nor icon 7095 if (key === "showLabel") { 7096 this._toggleClass("ui-button-icon-only", null, !value); 7097 this._updateTooltip(); 7098 } 7099 7100 if (key === "label") { 7101 if (this.isInput) { 7102 this.element.val(value); 7103 } else { 7104 7105 // If there is an icon, append it, else nothing then append the value 7106 // this avoids removal of the icon when setting label text 7107 this.element.html(value); 7108 if (this.icon) { 7109 this._attachIcon(this.options.iconPosition); 7110 this._attachIconSpace(this.options.iconPosition); 7111 } 7112 } 7113 } 7114 7115 this._super(key, value); 7116 7117 if (key === "disabled") { 7118 this._toggleClass(null, "ui-state-disabled", value); 7119 this.element[0].disabled = value; 7120 if (value) { 7121 this.element.trigger("blur"); 7122 } 7123 } 7124 }, 7125 7126 refresh: function () { 7127 7128 // Make sure to only check disabled if its an element that supports this otherwise 7129 // check for the disabled class to determine state 7130 var isDisabled = this.element.is("input, button") ? 7131 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 7132 7133 if (isDisabled !== this.options.disabled) { 7134 this._setOptions({ disabled: isDisabled }); 7135 } 7136 7137 this._updateTooltip(); 7138 } 7139 }); 7140 7141 // DEPRECATED 7142 if ($.uiBackCompat !== false) { 7143 7144 // Text and Icons options 7145 $.widget("ui.button", $.ui.button, { 7146 options: { 7147 text: true, 7148 icons: { 7149 primary: null, 7150 secondary: null 7151 } 7152 }, 7153 7154 _create: function () { 7155 if (this.options.showLabel && !this.options.text) { 7156 this.options.showLabel = this.options.text; 7157 } 7158 if (!this.options.showLabel && this.options.text) { 7159 this.options.text = this.options.showLabel; 7160 } 7161 if (!this.options.icon && (this.options.icons.primary || 7162 this.options.icons.secondary)) { 7163 if (this.options.icons.primary) { 7164 this.options.icon = this.options.icons.primary; 7165 } else { 7166 this.options.icon = this.options.icons.secondary; 7167 this.options.iconPosition = "end"; 7168 } 7169 } else if (this.options.icon) { 7170 this.options.icons.primary = this.options.icon; 7171 } 7172 this._super(); 7173 }, 7174 7175 _setOption: function (key, value) { 7176 if (key === "text") { 7177 this._super("showLabel", value); 7178 return; 7179 } 7180 if (key === "showLabel") { 7181 this.options.text = value; 7182 } 7183 if (key === "icon") { 7184 this.options.icons.primary = value; 7185 } 7186 if (key === "icons") { 7187 if (value.primary) { 7188 this._super("icon", value.primary); 7189 this._super("iconPosition", "beginning"); 7190 } else if (value.secondary) { 7191 this._super("icon", value.secondary); 7192 this._super("iconPosition", "end"); 7193 } 7194 } 7195 this._superApply(arguments); 7196 } 7197 }); 7198 7199 $.fn.button = (function (orig) { 7200 return function (options) { 7201 var isMethodCall = typeof options === "string"; 7202 var args = Array.prototype.slice.call(arguments, 1); 7203 var returnValue = this; 7204 7205 if (isMethodCall) { 7206 7207 // If this is an empty collection, we need to have the instance method 7208 // return undefined instead of the jQuery instance 7209 if (!this.length && options === "instance") { 7210 returnValue = undefined; 7211 } else { 7212 this.each(function () { 7213 var methodValue; 7214 var type = $(this).attr("type"); 7215 var name = type !== "checkbox" && type !== "radio" ? 7216 "button" : 7217 "checkboxradio"; 7218 var instance = $.data(this, "ui-" + name); 7219 7220 if (options === "instance") { 7221 returnValue = instance; 7222 return false;
vendor: 24,506 bytes, lines 7223-7711
7223 } 7224 7225 if (!instance) { 7226 return $.error("cannot call methods on button" + 7227 " prior to initialization; " + 7228 "attempted to call method '" + options + "'"); 7229 } 7230 7231 if (typeof instance[options] !== "function" || 7232 options.charAt(0) === "_") { 7233 return $.error("no such method '" + options + "' for button" + 7234 " widget instance"); 7235 } 7236 7237 methodValue = instance[options].apply(instance, args); 7238 7239 if (methodValue !== instance && methodValue !== undefined) { 7240 returnValue = methodValue && methodValue.jquery ? 7241 returnValue.pushStack(methodValue.get()) : 7242 methodValue; 7243 return false; 7244 } 7245 }); 7246 } 7247 } else { 7248 7249 // Allow multiple hashes to be passed on init 7250 if (args.length) { 7251 options = $.widget.extend.apply(null, [options].concat(args)); 7252 } 7253 7254 this.each(function () { 7255 var type = $(this).attr("type"); 7256 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 7257 var instance = $.data(this, "ui-" + name); 7258 7259 if (instance) { 7260 instance.option(options || {}); 7261 if (instance._init) { 7262 instance._init(); 7263 } 7264 } else { 7265 if (name === "button") { 7266 orig.call($(this), options); 7267 return; 7268 } 7269 7270 $(this).checkboxradio($.extend({ icon: false }, options)); 7271 } 7272 }); 7273 } 7274 7275 return returnValue; 7276 }; 7277 })($.fn.button); 7278 7279 $.fn.buttonset = function () { 7280 if (!$.ui.controlgroup) { 7281 $.error("Controlgroup widget missing"); 7282 } 7283 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 7284 return this.controlgroup.apply(this, 7285 [arguments[0], "items.button", arguments[2]]); 7286 } 7287 if (arguments[0] === "option" && arguments[1] === "items") { 7288 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 7289 } 7290 if (typeof arguments[0] === "object" && arguments[0].items) { 7291 arguments[0].items = { 7292 button: arguments[0].items 7293 }; 7294 } 7295 return this.controlgroup.apply(this, arguments); 7296 }; 7297 } 7298 7299 var widgetsButton = $.ui.button; 7300 7301 7302 /* eslint-disable max-len, camelcase */ 7303 /*! 7304 * jQuery UI Datepicker 1.13.2 7305 * http://jqueryui.com 7306 * 7307 * Copyright jQuery Foundation and other contributors 7308 * Released under the MIT license. 7309 * http://jquery.org/license 7310 */ 7311 7312 //>>label: Datepicker 7313 //>>group: Widgets 7314 //>>description: Displays a calendar from an input or inline for selecting dates. 7315 //>>docs: http://api.jqueryui.com/datepicker/ 7316 //>>demos: http://jqueryui.com/datepicker/ 7317 //>>css.structure: ../../themes/base/core.css 7318 //>>css.structure: ../../themes/base/datepicker.css 7319 //>>css.theme: ../../themes/base/theme.css 7320 7321 7322 $.extend($.ui, { datepicker: { version: "1.13.2" } }); 7323 7324 var datepicker_instActive; 7325 7326 function datepicker_getZindex(elem) { 7327 var position, value; 7328 while (elem.length && elem[0] !== document) { 7329 7330 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7331 // This makes behavior of this function consistent across browsers 7332 // WebKit always returns auto if the element is positioned 7333 position = elem.css("position"); 7334 if (position === "absolute" || position === "relative" || position === "fixed") { 7335 7336 // IE returns 0 when zIndex is not specified 7337 // other browsers return a string 7338 // we ignore the case of nested elements with an explicit value of 0 7339 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7340 value = parseInt(elem.css("zIndex"), 10); 7341 if (!isNaN(value) && value !== 0) { 7342 return value; 7343 } 7344 } 7345 elem = elem.parent(); 7346 } 7347 7348 return 0; 7349 } 7350 7351 /* Date picker manager. 7352 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7353 Settings for (groups of) date pickers are maintained in an instance object, 7354 allowing multiple different settings on the same page. */ 7355 7356 function Datepicker() { 7357 this._curInst = null; // The current instance in use 7358 this._keyEvent = false; // If the last event was a key event 7359 this._disabledInputs = []; // List of date picker inputs that have been disabled 7360 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7361 this._inDialog = false; // True if showing within a "dialog", false if not 7362 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7363 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7364 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7365 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7366 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7367 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7368 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7369 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7370 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7371 this.regional = []; // Available regional settings, indexed by language code 7372 this.regional[""] = { // Default regional settings 7373 closeText: "Done", // Display text for close link 7374 prevText: "Prev", // Display text for previous month link 7375 nextText: "Next", // Display text for next month link 7376 currentText: "Today", // Display text for current month link 7377 monthNames: ["January", "February", "March", "April", "May", "June", 7378 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 7379 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 7380 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 7381 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 7382 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 7383 weekHeader: "Wk", // Column header for week of the year 7384 dateFormat: "mm/dd/yy", // See format options on parseDate 7385 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7386 isRTL: false, // True if right-to-left language, false if left-to-right 7387 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7388 yearSuffix: "", // Additional text to append to the year in the month headers, 7389 selectMonthLabel: "Select month", // Invisible label for month selector 7390 selectYearLabel: "Select year" // Invisible label for year selector 7391 }; 7392 this._defaults = { // Global defaults for all the date picker instances 7393 showOn: "focus", // "focus" for popup on focus, 7394 // "button" for trigger button, or "both" for either 7395 showAnim: "fadeIn", // Name of jQuery animation for popup 7396 showOptions: {}, // Options for enhanced animations 7397 defaultDate: null, // Used when field is blank: actual date, 7398 // +/-number for offset from today, null for today 7399 appendText: "", // Display text following the input box, e.g. showing the format 7400 buttonText: "...", // Text for trigger button 7401 buttonImage: "", // URL for trigger button image 7402 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7403 hideIfNoPrevNext: false, // True to hide next/previous month links 7404 // if not applicable, false to just disable them 7405 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7406 gotoCurrent: false, // True if today link goes back to current selection instead 7407 changeMonth: false, // True if month can be selected directly, false if only prev/next 7408 changeYear: false, // True if year can be selected directly, false if only prev/next 7409 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7410 // either relative to today's year (-nn:+nn), relative to currently displayed year 7411 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7412 showOtherMonths: false, // True to show dates in other months, false to leave blank 7413 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7414 showWeek: false, // True to show week of the year, false to not show it 7415 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7416 // takes a Date and returns the number of the week for it 7417 shortYearCutoff: "+10", // Short year values < this are in the current century, 7418 // > this are in the previous century, 7419 // string value starting with "+" for current year + value 7420 minDate: null, // The earliest selectable date, or null for no limit 7421 maxDate: null, // The latest selectable date, or null for no limit 7422 duration: "fast", // Duration of display/closure 7423 beforeShowDay: null, // Function that takes a date and returns an array with 7424 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7425 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7426 beforeShow: null, // Function that takes an input field and 7427 // returns a set of custom settings for the date picker 7428 onSelect: null, // Define a callback function when a date is selected 7429 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7430 onClose: null, // Define a callback function when the datepicker is closed 7431 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 7432 numberOfMonths: 1, // Number of months to show at a time 7433 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7434 stepMonths: 1, // Number of months to step back/forward 7435 stepBigMonths: 12, // Number of months to step back/forward for the big links 7436 altField: "", // Selector for an alternate field to store selected dates into 7437 altFormat: "", // The date format to use for the alternate field 7438 constrainInput: true, // The input is constrained by the current date format 7439 showButtonPanel: false, // True to show button panel, false to not show it 7440 autoSize: false, // True to size the input for the date format, false to leave as is 7441 disabled: false // The initial disabled state 7442 }; 7443 $.extend(this._defaults, this.regional[""]); 7444 this.regional.en = $.extend(true, {}, this.regional[""]); 7445 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 7446 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 7447 } 7448 7449 $.extend(Datepicker.prototype, { 7450 7451 /* Class name added to elements to indicate already configured with a date picker. */ 7452 markerClassName: "hasDatepicker", 7453 7454 //Keep track of the maximum number of rows displayed (see #7043) 7455 maxRows: 4, 7456 7457 // TODO rename to "widget" when switching to widget factory 7458 _widgetDatepicker: function () { 7459 return this.dpDiv; 7460 }, 7461 7462 /* Override the default settings for all instances of the date picker. 7463 * @param settings object - the new settings to use as defaults (anonymous object) 7464 * @return the manager object 7465 */ 7466 setDefaults: function (settings) { 7467 datepicker_extendRemove(this._defaults, settings || {}); 7468 return this; 7469 }, 7470 7471 /* Attach the date picker to a jQuery selection. 7472 * @param target element - the target input field or division or span 7473 * @param settings object - the new settings to use for this date picker instance (anonymous) 7474 */ 7475 _attachDatepicker: function (target, settings) { 7476 var nodeName, inline, inst; 7477 nodeName = target.nodeName.toLowerCase(); 7478 inline = (nodeName === "div" || nodeName === "span"); 7479 if (!target.id) { 7480 this.uuid += 1; 7481 target.id = "dp" + this.uuid; 7482 } 7483 inst = this._newInst($(target), inline); 7484 inst.settings = $.extend({}, settings || {}); 7485 if (nodeName === "input") { 7486 this._connectDatepicker(target, inst); 7487 } else if (inline) { 7488 this._inlineDatepicker(target, inst); 7489 } 7490 }, 7491 7492 /* Create a new instance object. */ 7493 _newInst: function (target, inline) { 7494 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 7495 return { 7496 id: id, input: target, // associated target 7497 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 7498 drawMonth: 0, drawYear: 0, // month being drawn 7499 inline: inline, // is datepicker inline or not 7500 dpDiv: (!inline ? this.dpDiv : // presentation div 7501 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 7502 }; 7503 }, 7504 7505 /* Attach the date picker to an input field. */ 7506 _connectDatepicker: function (target, inst) { 7507 var input = $(target); 7508 inst.append = $([]); 7509 inst.trigger = $([]); 7510 if (input.hasClass(this.markerClassName)) { 7511 return; 7512 } 7513 this._attachments(input, inst); 7514 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 7515 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 7516 this._autoSize(inst); 7517 $.data(target, "datepicker", inst); 7518 7519 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 7520 if (inst.settings.disabled) { 7521 this._disableDatepicker(target); 7522 } 7523 }, 7524 7525 /* Make attachments based on settings. */ 7526 _attachments: function (input, inst) { 7527 var showOn, buttonText, buttonImage, 7528 appendText = this._get(inst, "appendText"), 7529 isRTL = this._get(inst, "isRTL"); 7530 7531 if (inst.append) { 7532 inst.append.remove(); 7533 } 7534 if (appendText) { 7535 inst.append = $("<span>") 7536 .addClass(this._appendClass) 7537 .text(appendText); 7538 input[isRTL ? "before" : "after"](inst.append); 7539 } 7540 7541 input.off("focus", this._showDatepicker); 7542 7543 if (inst.trigger) { 7544 inst.trigger.remove(); 7545 } 7546 7547 showOn = this._get(inst, "showOn"); 7548 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 7549 input.on("focus", this._showDatepicker); 7550 } 7551 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 7552 buttonText = this._get(inst, "buttonText"); 7553 buttonImage = this._get(inst, "buttonImage"); 7554 7555 if (this._get(inst, "buttonImageOnly")) { 7556 inst.trigger = $("<img>") 7557 .addClass(this._triggerClass) 7558 .attr({ 7559 src: buttonImage, 7560 alt: buttonText, 7561 title: buttonText 7562 }); 7563 } else { 7564 inst.trigger = $("<button type='button'>") 7565 .addClass(this._triggerClass); 7566 if (buttonImage) { 7567 inst.trigger.html( 7568 $("<img>") 7569 .attr({ 7570 src: buttonImage, 7571 alt: buttonText, 7572 title: buttonText 7573 }) 7574 ); 7575 } else { 7576 inst.trigger.text(buttonText); 7577 } 7578 } 7579 7580 input[isRTL ? "before" : "after"](inst.trigger); 7581 inst.trigger.on("click", function () { 7582 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 7583 $.datepicker._hideDatepicker(); 7584 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 7585 $.datepicker._hideDatepicker(); 7586 $.datepicker._showDatepicker(input[0]); 7587 } else { 7588 $.datepicker._showDatepicker(input[0]); 7589 } 7590 return false; 7591 }); 7592 } 7593 }, 7594 7595 /* Apply the maximum length for the date format. */ 7596 _autoSize: function (inst) { 7597 if (this._get(inst, "autoSize") && !inst.inline) { 7598 var findMax, max, maxI, i, 7599 date = new Date(2009, 12 - 1, 20), // Ensure double digits 7600 dateFormat = this._get(inst, "dateFormat"); 7601 7602 if (dateFormat.match(/[DM]/)) { 7603 findMax = function (names) { 7604 max = 0; 7605 maxI = 0; 7606 for (i = 0; i < names.length; i++) { 7607 if (names[i].length > max) { 7608 max = names[i].length; 7609 maxI = i; 7610 } 7611 } 7612 return maxI; 7613 }; 7614 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 7615 "monthNames" : "monthNamesShort")))); 7616 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 7617 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 7618 } 7619 inst.input.attr("size", this._formatDate(inst, date).length); 7620 } 7621 }, 7622 7623 /* Attach an inline date picker to a div. */ 7624 _inlineDatepicker: function (target, inst) { 7625 var divSpan = $(target); 7626 if (divSpan.hasClass(this.markerClassName)) { 7627 return; 7628 } 7629 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 7630 $.data(target, "datepicker", inst); 7631 this._setDate(inst, this._getDefaultDate(inst), true); 7632 this._updateDatepicker(inst); 7633 this._updateAlternate(inst); 7634 7635 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 7636 if (inst.settings.disabled) { 7637 this._disableDatepicker(target); 7638 } 7639 7640 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 7641 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 7642 inst.dpDiv.css("display", "block"); 7643 }, 7644 7645 /* Pop-up the date picker in a "dialog" box. 7646 * @param input element - ignored 7647 * @param date string or Date - the initial date to display 7648 * @param onSelect function - the function to call when a date is selected 7649 * @param settings object - update the dialog date picker instance's settings (anonymous object) 7650 * @param pos int[2] - coordinates for the dialog's position within the screen or 7651 * event - with x/y coordinates or 7652 * leave empty for default (screen centre) 7653 * @return the manager object 7654 */ 7655 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 7656 var id, browserWidth, browserHeight, scrollX, scrollY, 7657 inst = this._dialogInst; // internal instance 7658 7659 if (!inst) { 7660 this.uuid += 1; 7661 id = "dp" + this.uuid; 7662 this._dialogInput = $("<input type='text' id='" + id + 7663 "' style='position: absolute; top: -100px; width: 0px;'/>"); 7664 this._dialogInput.on("keydown", this._doKeyDown); 7665 $("body").append(this._dialogInput); 7666 inst = this._dialogInst = this._newInst(this._dialogInput, false); 7667 inst.settings = {}; 7668 $.data(this._dialogInput[0], "datepicker", inst); 7669 } 7670 datepicker_extendRemove(inst.settings, settings || {}); 7671 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 7672 this._dialogInput.val(date); 7673 7674 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 7675 if (!this._pos) { 7676 browserWidth = document.documentElement.clientWidth; 7677 browserHeight = document.documentElement.clientHeight; 7678 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 7679 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 7680 this._pos = // should use actual width/height below 7681 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 7682 } 7683 7684 // Move input on screen for focus, but hidden behind dialog 7685 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 7686 inst.settings.onSelect = onSelect; 7687 this._inDialog = true; 7688 this.dpDiv.addClass(this._dialogClass); 7689 this._showDatepicker(this._dialogInput[0]); 7690 if ($.blockUI) { 7691 $.blockUI(this.dpDiv); 7692 } 7693 $.data(this._dialogInput[0], "datepicker", inst); 7694 return this; 7695 }, 7696 7697 /* Detach a datepicker from its control. 7698 * @param target element - the target input field or division or span 7699 */ 7700 _destroyDatepicker: function (target) { 7701 var nodeName, 7702 $target = $(target), 7703 inst = $.data(target, "datepicker"); 7704 7705 if (!$target.hasClass(this.markerClassName)) { 7706 return; 7707 } 7708 7709 nodeName = target.nodeName.toLowerCase(); 7710 $.removeData(target, "datepicker"); 7711 if (nodeName === "input") {
vendor: 4,542 bytes, lines 7712-7826
7712 inst.append.remove(); 7713 inst.trigger.remove(); 7714 $target.removeClass(this.markerClassName). 7715 off("focus", this._showDatepicker). 7716 off("keydown", this._doKeyDown). 7717 off("keypress", this._doKeyPress). 7718 off("keyup", this._doKeyUp); 7719 } else if (nodeName === "div" || nodeName === "span") { 7720 $target.removeClass(this.markerClassName).empty(); 7721 } 7722 7723 if (datepicker_instActive === inst) { 7724 datepicker_instActive = null; 7725 this._curInst = null; 7726 } 7727 }, 7728 7729 /* Enable the date picker to a jQuery selection. 7730 * @param target element - the target input field or division or span 7731 */ 7732 _enableDatepicker: function (target) { 7733 var nodeName, inline, 7734 $target = $(target), 7735 inst = $.data(target, "datepicker"); 7736 7737 if (!$target.hasClass(this.markerClassName)) { 7738 return; 7739 } 7740 7741 nodeName = target.nodeName.toLowerCase(); 7742 if (nodeName === "input") { 7743 target.disabled = false; 7744 inst.trigger.filter("button"). 7745 each(function () { 7746 this.disabled = false; 7747 }).end(). 7748 filter("img").css({ opacity: "1.0", cursor: "" }); 7749 } else if (nodeName === "div" || nodeName === "span") { 7750 inline = $target.children("." + this._inlineClass); 7751 inline.children().removeClass("ui-state-disabled"); 7752 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 7753 prop("disabled", false); 7754 } 7755 this._disabledInputs = $.map(this._disabledInputs, 7756 7757 // Delete entry 7758 function (value) { 7759 return (value === target ? null : value); 7760 }); 7761 }, 7762 7763 /* Disable the date picker to a jQuery selection. 7764 * @param target element - the target input field or division or span 7765 */ 7766 _disableDatepicker: function (target) { 7767 var nodeName, inline, 7768 $target = $(target), 7769 inst = $.data(target, "datepicker"); 7770 7771 if (!$target.hasClass(this.markerClassName)) { 7772 return; 7773 } 7774 7775 nodeName = target.nodeName.toLowerCase(); 7776 if (nodeName === "input") { 7777 target.disabled = true; 7778 inst.trigger.filter("button"). 7779 each(function () { 7780 this.disabled = true; 7781 }).end(). 7782 filter("img").css({ opacity: "0.5", cursor: "default" }); 7783 } else if (nodeName === "div" || nodeName === "span") { 7784 inline = $target.children("." + this._inlineClass); 7785 inline.children().addClass("ui-state-disabled"); 7786 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 7787 prop("disabled", true); 7788 } 7789 this._disabledInputs = $.map(this._disabledInputs, 7790 7791 // Delete entry 7792 function (value) { 7793 return (value === target ? null : value); 7794 }); 7795 this._disabledInputs[this._disabledInputs.length] = target; 7796 }, 7797 7798 /* Is the first field in a jQuery collection disabled as a datepicker? 7799 * @param target element - the target input field or division or span 7800 * @return boolean - true if disabled, false if enabled 7801 */ 7802 _isDisabledDatepicker: function (target) { 7803 if (!target) { 7804 return false; 7805 } 7806 for (var i = 0; i < this._disabledInputs.length; i++) { 7807 if (this._disabledInputs[i] === target) { 7808 return true; 7809 } 7810 } 7811 return false; 7812 }, 7813 7814 /* Retrieve the instance data for the target control. 7815 * @param target element - the target input field or division or span 7816 * @return object - the associated instance data 7817 * @throws error if a jQuery problem getting data 7818 */ 7819 _getInst: function (target) { 7820 try { 7821 return $.data(target, "datepicker"); 7822 } catch (err) { 7823 throw "Missing instance data for this datepicker"; 7824 } 7825 }, 7826
vendor: 14,940 bytes, lines 7827-8161
7827 /* Update or retrieve the settings for a date picker attached to an input field or division. 7828 * @param target element - the target input field or division or span 7829 * @param name object - the new settings to update or 7830 * string - the name of the setting to change or retrieve, 7831 * when retrieving also "all" for all instance settings or 7832 * "defaults" for all global defaults 7833 * @param value any - the new value for the setting 7834 * (omit if above is an object or to retrieve a value) 7835 */ 7836 _optionDatepicker: function (target, name, value) { 7837 var settings, date, minDate, maxDate, 7838 inst = this._getInst(target); 7839 7840 if (arguments.length === 2 && typeof name === "string") { 7841 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 7842 (inst ? (name === "all" ? $.extend({}, inst.settings) : 7843 this._get(inst, name)) : null)); 7844 } 7845 7846 settings = name || {}; 7847 if (typeof name === "string") { 7848 settings = {}; 7849 settings[name] = value; 7850 } 7851 7852 if (inst) { 7853 if (this._curInst === inst) { 7854 this._hideDatepicker(); 7855 } 7856 7857 date = this._getDateDatepicker(target, true); 7858 minDate = this._getMinMaxDate(inst, "min"); 7859 maxDate = this._getMinMaxDate(inst, "max"); 7860 datepicker_extendRemove(inst.settings, settings); 7861 7862 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 7863 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 7864 inst.settings.minDate = this._formatDate(inst, minDate); 7865 } 7866 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 7867 inst.settings.maxDate = this._formatDate(inst, maxDate); 7868 } 7869 if ("disabled" in settings) { 7870 if (settings.disabled) { 7871 this._disableDatepicker(target); 7872 } else { 7873 this._enableDatepicker(target); 7874 } 7875 } 7876 this._attachments($(target), inst); 7877 this._autoSize(inst); 7878 this._setDate(inst, date); 7879 this._updateAlternate(inst); 7880 this._updateDatepicker(inst); 7881 } 7882 }, 7883 7884 // Change method deprecated 7885 _changeDatepicker: function (target, name, value) { 7886 this._optionDatepicker(target, name, value); 7887 }, 7888 7889 /* Redraw the date picker attached to an input field or division. 7890 * @param target element - the target input field or division or span 7891 */ 7892 _refreshDatepicker: function (target) { 7893 var inst = this._getInst(target); 7894 if (inst) { 7895 this._updateDatepicker(inst); 7896 } 7897 }, 7898 7899 /* Set the dates for a jQuery selection. 7900 * @param target element - the target input field or division or span 7901 * @param date Date - the new date 7902 */ 7903 _setDateDatepicker: function (target, date) { 7904 var inst = this._getInst(target); 7905 if (inst) { 7906 this._setDate(inst, date); 7907 this._updateDatepicker(inst); 7908 this._updateAlternate(inst); 7909 } 7910 }, 7911 7912 /* Get the date(s) for the first entry in a jQuery selection. 7913 * @param target element - the target input field or division or span 7914 * @param noDefault boolean - true if no default date is to be used 7915 * @return Date - the current date 7916 */ 7917 _getDateDatepicker: function (target, noDefault) { 7918 var inst = this._getInst(target); 7919 if (inst && !inst.inline) { 7920 this._setDateFromField(inst, noDefault); 7921 } 7922 return (inst ? this._getDate(inst) : null); 7923 }, 7924 7925 /* Handle keystrokes. */ 7926 _doKeyDown: function (event) { 7927 var onSelect, dateStr, sel, 7928 inst = $.datepicker._getInst(event.target), 7929 handled = true, 7930 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 7931 7932 inst._keyEvent = true; 7933 if ($.datepicker._datepickerShowing) { 7934 switch (event.keyCode) { 7935 case 9: $.datepicker._hideDatepicker(); 7936 handled = false; 7937 break; // hide on tab out 7938 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 7939 $.datepicker._currentClass + ")", inst.dpDiv); 7940 if (sel[0]) { 7941 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 7942 } 7943 7944 onSelect = $.datepicker._get(inst, "onSelect"); 7945 if (onSelect) { 7946 dateStr = $.datepicker._formatDate(inst); 7947 7948 // Trigger custom callback 7949 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 7950 } else { 7951 $.datepicker._hideDatepicker(); 7952 } 7953 7954 return false; // don't submit the form 7955 case 27: $.datepicker._hideDatepicker(); 7956 break; // hide on escape 7957 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7958 -$.datepicker._get(inst, "stepBigMonths") : 7959 -$.datepicker._get(inst, "stepMonths")), "M"); 7960 break; // previous month/year on page up/+ ctrl 7961 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7962 +$.datepicker._get(inst, "stepBigMonths") : 7963 +$.datepicker._get(inst, "stepMonths")), "M"); 7964 break; // next month/year on page down/+ ctrl 7965 case 35: if (event.ctrlKey || event.metaKey) { 7966 $.datepicker._clearDate(event.target); 7967 } 7968 handled = event.ctrlKey || event.metaKey; 7969 break; // clear on ctrl or command +end 7970 case 36: if (event.ctrlKey || event.metaKey) { 7971 $.datepicker._gotoToday(event.target); 7972 } 7973 handled = event.ctrlKey || event.metaKey; 7974 break; // current on ctrl or command +home 7975 case 37: if (event.ctrlKey || event.metaKey) { 7976 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 7977 } 7978 handled = event.ctrlKey || event.metaKey; 7979 7980 // -1 day on ctrl or command +left 7981 if (event.originalEvent.altKey) { 7982 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7983 -$.datepicker._get(inst, "stepBigMonths") : 7984 -$.datepicker._get(inst, "stepMonths")), "M"); 7985 } 7986 7987 // next month/year on alt +left on Mac 7988 break; 7989 case 38: if (event.ctrlKey || event.metaKey) { 7990 $.datepicker._adjustDate(event.target, -7, "D"); 7991 } 7992 handled = event.ctrlKey || event.metaKey; 7993 break; // -1 week on ctrl or command +up 7994 case 39: if (event.ctrlKey || event.metaKey) { 7995 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 7996 } 7997 handled = event.ctrlKey || event.metaKey; 7998 7999 // +1 day on ctrl or command +right 8000 if (event.originalEvent.altKey) { 8001 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 8002 +$.datepicker._get(inst, "stepBigMonths") : 8003 +$.datepicker._get(inst, "stepMonths")), "M"); 8004 } 8005 8006 // next month/year on alt +right 8007 break; 8008 case 40: if (event.ctrlKey || event.metaKey) { 8009 $.datepicker._adjustDate(event.target, +7, "D"); 8010 } 8011 handled = event.ctrlKey || event.metaKey; 8012 break; // +1 week on ctrl or command +down 8013 default: handled = false; 8014 } 8015 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 8016 $.datepicker._showDatepicker(this); 8017 } else { 8018 handled = false; 8019 } 8020 8021 if (handled) { 8022 event.preventDefault(); 8023 event.stopPropagation(); 8024 } 8025 }, 8026 8027 /* Filter entered characters - based on date format. */ 8028 _doKeyPress: function (event) { 8029 var chars, chr, 8030 inst = $.datepicker._getInst(event.target); 8031 8032 if ($.datepicker._get(inst, "constrainInput")) { 8033 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 8034 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 8035 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 8036 } 8037 }, 8038 8039 /* Synchronise manual entry and field/alternate field. */ 8040 _doKeyUp: function (event) { 8041 var date, 8042 inst = $.datepicker._getInst(event.target); 8043 8044 if (inst.input.val() !== inst.lastVal) { 8045 try { 8046 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 8047 (inst.input ? inst.input.val() : null), 8048 $.datepicker._getFormatConfig(inst)); 8049 8050 if (date) { // only if valid 8051 $.datepicker._setDateFromField(inst); 8052 $.datepicker._updateAlternate(inst); 8053 $.datepicker._updateDatepicker(inst); 8054 } 8055 } catch (err) { 8056 } 8057 } 8058 return true; 8059 }, 8060 8061 /* Pop-up the date picker for a given input field. 8062 * If false returned from beforeShow event handler do not show. 8063 * @param input element - the input field attached to the date picker or 8064 * event - if triggered by focus 8065 */ 8066 _showDatepicker: function (input) { 8067 input = input.target || input; 8068 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 8069 input = $("input", input.parentNode)[0]; 8070 } 8071 8072 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 8073 return; 8074 } 8075 8076 var inst, beforeShow, beforeShowSettings, isFixed, 8077 offset, showAnim, duration; 8078 8079 inst = $.datepicker._getInst(input); 8080 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 8081 $.datepicker._curInst.dpDiv.stop(true, true); 8082 if (inst && $.datepicker._datepickerShowing) { 8083 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 8084 } 8085 } 8086 8087 beforeShow = $.datepicker._get(inst, "beforeShow"); 8088 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 8089 if (beforeShowSettings === false) { 8090 return; 8091 } 8092 datepicker_extendRemove(inst.settings, beforeShowSettings); 8093 8094 inst.lastVal = null; 8095 $.datepicker._lastInput = input; 8096 $.datepicker._setDateFromField(inst); 8097 8098 if ($.datepicker._inDialog) { // hide cursor 8099 input.value = ""; 8100 } 8101 if (!$.datepicker._pos) { // position below input 8102 $.datepicker._pos = $.datepicker._findPos(input); 8103 $.datepicker._pos[1] += input.offsetHeight; // add the height 8104 } 8105 8106 isFixed = false; 8107 $(input).parents().each(function () { 8108 isFixed |= $(this).css("position") === "fixed"; 8109 return !isFixed; 8110 }); 8111 8112 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 8113 $.datepicker._pos = null; 8114 8115 //to avoid flashes on Firefox 8116 inst.dpDiv.empty(); 8117 8118 // determine sizing offscreen 8119 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 8120 $.datepicker._updateDatepicker(inst); 8121 8122 // fix width for dynamic number of date pickers 8123 // and adjust position before showing 8124 offset = $.datepicker._checkOffset(inst, offset, isFixed); 8125 inst.dpDiv.css({ 8126 position: ($.datepicker._inDialog && $.blockUI ? 8127 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 8128 left: offset.left + "px", top: offset.top + "px" 8129 }); 8130 8131 if (!inst.inline) { 8132 showAnim = $.datepicker._get(inst, "showAnim"); 8133 duration = $.datepicker._get(inst, "duration"); 8134 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 8135 $.datepicker._datepickerShowing = true; 8136 8137 if ($.effects && $.effects.effect[showAnim]) { 8138 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 8139 } else { 8140 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 8141 } 8142 8143 if ($.datepicker._shouldFocusInput(inst)) { 8144 inst.input.trigger("focus"); 8145 } 8146 8147 $.datepicker._curInst = inst; 8148 } 8149 }, 8150 8151 /* Generate the date picker content. */ 8152 _updateDatepicker: function (inst) { 8153 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 8154 datepicker_instActive = inst; // for delegate hover events 8155 inst.dpDiv.empty().append(this._generateHTML(inst)); 8156 this._attachHandlers(inst); 8157 8158 var origyearshtml, 8159 numMonths = this._getNumberOfMonths(inst), 8160 cols = numMonths[1], 8161 width = 17,
vendor: 5,241 bytes, lines 8162-8272
8162 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"), 8163 onUpdateDatepicker = $.datepicker._get(inst, "onUpdateDatepicker"); 8164 8165 if (activeCell.length > 0) { 8166 datepicker_handleMouseover.apply(activeCell.get(0)); 8167 } 8168 8169 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 8170 if (cols > 1) { 8171 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 8172 } 8173 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 8174 "Class"]("ui-datepicker-multi"); 8175 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 8176 "Class"]("ui-datepicker-rtl"); 8177 8178 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 8179 inst.input.trigger("focus"); 8180 } 8181 8182 // Deffered render of the years select (to avoid flashes on Firefox) 8183 if (inst.yearshtml) { 8184 origyearshtml = inst.yearshtml; 8185 setTimeout(function () { 8186 8187 //assure that inst.yearshtml didn't change. 8188 if (origyearshtml === inst.yearshtml && inst.yearshtml) { 8189 inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml); 8190 } 8191 origyearshtml = inst.yearshtml = null; 8192 }, 0); 8193 } 8194 8195 if (onUpdateDatepicker) { 8196 onUpdateDatepicker.apply((inst.input ? inst.input[0] : null), [inst]); 8197 } 8198 }, 8199 8200 // #6694 - don't focus the input if it's already focused 8201 // this breaks the change event in IE 8202 // Support: IE and jQuery <1.9 8203 _shouldFocusInput: function (inst) { 8204 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 8205 }, 8206 8207 /* Check positioning to remain on screen. */ 8208 _checkOffset: function (inst, offset, isFixed) { 8209 var dpWidth = inst.dpDiv.outerWidth(), 8210 dpHeight = inst.dpDiv.outerHeight(), 8211 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8212 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8213 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 8214 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 8215 8216 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 8217 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 8218 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 8219 8220 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8221 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 8222 Math.abs(offset.left + dpWidth - viewWidth) : 0); 8223 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 8224 Math.abs(dpHeight + inputHeight) : 0); 8225 8226 return offset; 8227 }, 8228 8229 /* Find an object's position on the screen. */ 8230 _findPos: function (obj) { 8231 var position, 8232 inst = this._getInst(obj), 8233 isRTL = this._get(inst, "isRTL"); 8234 8235 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden(obj))) { 8236 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 8237 } 8238 8239 position = $(obj).offset(); 8240 return [position.left, position.top]; 8241 }, 8242 8243 /* Hide the date picker from view. 8244 * @param input element - the input field attached to the date picker 8245 */ 8246 _hideDatepicker: function (input) { 8247 var showAnim, duration, postProcess, onClose, 8248 inst = this._curInst; 8249 8250 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 8251 return; 8252 } 8253 8254 if (this._datepickerShowing) { 8255 showAnim = this._get(inst, "showAnim"); 8256 duration = this._get(inst, "duration"); 8257 postProcess = function () { 8258 $.datepicker._tidyDialog(inst); 8259 }; 8260 8261 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 8262 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 8263 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 8264 } else { 8265 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 8266 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 8267 } 8268 8269 if (!showAnim) { 8270 postProcess(); 8271 } 8272 this._datepickerShowing = false;
vendor: 59,187 bytes, lines 8273-9523
8273 8274 onClose = this._get(inst, "onClose"); 8275 if (onClose) { 8276 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 8277 } 8278 8279 this._lastInput = null; 8280 if (this._inDialog) { 8281 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 8282 if ($.blockUI) { 8283 $.unblockUI(); 8284 $("body").append(this.dpDiv); 8285 } 8286 } 8287 this._inDialog = false; 8288 } 8289 }, 8290 8291 /* Tidy up after a dialog display. */ 8292 _tidyDialog: function (inst) { 8293 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 8294 }, 8295 8296 /* Close date picker if clicked elsewhere. */ 8297 _checkExternalClick: function (event) { 8298 if (!$.datepicker._curInst) { 8299 return; 8300 } 8301 8302 var $target = $(event.target), 8303 inst = $.datepicker._getInst($target[0]); 8304 8305 if ((($target[0].id !== $.datepicker._mainDivId && 8306 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 8307 !$target.hasClass($.datepicker.markerClassName) && 8308 !$target.closest("." + $.datepicker._triggerClass).length && 8309 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 8310 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 8311 $.datepicker._hideDatepicker(); 8312 } 8313 }, 8314 8315 /* Adjust one of the date sub-fields. */ 8316 _adjustDate: function (id, offset, period) { 8317 var target = $(id), 8318 inst = this._getInst(target[0]); 8319 8320 if (this._isDisabledDatepicker(target[0])) { 8321 return; 8322 } 8323 this._adjustInstDate(inst, offset, period); 8324 this._updateDatepicker(inst); 8325 }, 8326 8327 /* Action for current link. */ 8328 _gotoToday: function (id) { 8329 var date, 8330 target = $(id), 8331 inst = this._getInst(target[0]); 8332 8333 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 8334 inst.selectedDay = inst.currentDay; 8335 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8336 inst.drawYear = inst.selectedYear = inst.currentYear; 8337 } else { 8338 date = new Date(); 8339 inst.selectedDay = date.getDate(); 8340 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8341 inst.drawYear = inst.selectedYear = date.getFullYear(); 8342 } 8343 this._notifyChange(inst); 8344 this._adjustDate(target); 8345 }, 8346 8347 /* Action for selecting a new month/year. */ 8348 _selectMonthYear: function (id, select, period) { 8349 var target = $(id), 8350 inst = this._getInst(target[0]); 8351 8352 inst["selected" + (period === "M" ? "Month" : "Year")] = 8353 inst["draw" + (period === "M" ? "Month" : "Year")] = 8354 parseInt(select.options[select.selectedIndex].value, 10); 8355 8356 this._notifyChange(inst); 8357 this._adjustDate(target); 8358 }, 8359 8360 /* Action for selecting a day. */ 8361 _selectDay: function (id, month, year, td) { 8362 var inst, 8363 target = $(id); 8364 8365 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 8366 return; 8367 } 8368 8369 inst = this._getInst(target[0]); 8370 inst.selectedDay = inst.currentDay = parseInt($("a", td).attr("data-date")); 8371 inst.selectedMonth = inst.currentMonth = month; 8372 inst.selectedYear = inst.currentYear = year; 8373 this._selectDate(id, this._formatDate(inst, 8374 inst.currentDay, inst.currentMonth, inst.currentYear)); 8375 }, 8376 8377 /* Erase the input field and hide the date picker. */ 8378 _clearDate: function (id) { 8379 var target = $(id); 8380 this._selectDate(target, ""); 8381 }, 8382 8383 /* Update the input field with the selected date. */ 8384 _selectDate: function (id, dateStr) { 8385 var onSelect, 8386 target = $(id), 8387 inst = this._getInst(target[0]); 8388 8389 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 8390 if (inst.input) { 8391 inst.input.val(dateStr); 8392 } 8393 this._updateAlternate(inst); 8394 8395 onSelect = this._get(inst, "onSelect"); 8396 if (onSelect) { 8397 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 8398 } else if (inst.input) { 8399 inst.input.trigger("change"); // fire the change event 8400 } 8401 8402 if (inst.inline) { 8403 this._updateDatepicker(inst); 8404 } else { 8405 this._hideDatepicker(); 8406 this._lastInput = inst.input[0]; 8407 if (typeof (inst.input[0]) !== "object") { 8408 inst.input.trigger("focus"); // restore focus 8409 } 8410 this._lastInput = null; 8411 } 8412 }, 8413 8414 /* Update any alternate field to synchronise with the main field. */ 8415 _updateAlternate: function (inst) { 8416 var altFormat, date, dateStr, 8417 altField = this._get(inst, "altField"); 8418 8419 if (altField) { // update alternate field too 8420 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 8421 date = this._getDate(inst); 8422 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 8423 $(document).find(altField).val(dateStr); 8424 } 8425 }, 8426 8427 /* Set as beforeShowDay function to prevent selection of weekends. 8428 * @param date Date - the date to customise 8429 * @return [boolean, string] - is this date selectable?, what is its CSS class? 8430 */ 8431 noWeekends: function (date) { 8432 var day = date.getDay(); 8433 return [(day > 0 && day < 6), ""]; 8434 }, 8435 8436 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 8437 * @param date Date - the date to get the week for 8438 * @return number - the number of the week within the year that contains this date 8439 */ 8440 iso8601Week: function (date) { 8441 var time, 8442 checkDate = new Date(date.getTime()); 8443 8444 // Find Thursday of this week starting on Monday 8445 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 8446 8447 time = checkDate.getTime(); 8448 checkDate.setMonth(0); // Compare with Jan 1 8449 checkDate.setDate(1); 8450 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 8451 }, 8452 8453 /* Parse a string value into a date object. 8454 * See formatDate below for the possible formats. 8455 * 8456 * @param format string - the expected format of the date 8457 * @param value string - the date in the above format 8458 * @param settings Object - attributes include: 8459 * shortYearCutoff number - the cutoff year for determining the century (optional) 8460 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8461 * dayNames string[7] - names of the days from Sunday (optional) 8462 * monthNamesShort string[12] - abbreviated names of the months (optional) 8463 * monthNames string[12] - names of the months (optional) 8464 * @return Date - the extracted date value or null if value is blank 8465 */ 8466 parseDate: function (format, value, settings) { 8467 if (format == null || value == null) { 8468 throw "Invalid arguments"; 8469 } 8470 8471 value = (typeof value === "object" ? value.toString() : value + ""); 8472 if (value === "") { 8473 return null; 8474 } 8475 8476 var iFormat, dim, extra, 8477 iValue = 0, 8478 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 8479 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 8480 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 8481 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 8482 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 8483 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 8484 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 8485 year = -1, 8486 month = -1, 8487 day = -1, 8488 doy = -1, 8489 literal = false, 8490 date, 8491 8492 // Check whether a format character is doubled 8493 lookAhead = function (match) { 8494 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8495 if (matches) { 8496 iFormat++; 8497 } 8498 return matches; 8499 }, 8500 8501 // Extract a number from the string value 8502 getNumber = function (match) { 8503 var isDoubled = lookAhead(match), 8504 size = (match === "@" ? 14 : (match === "!" ? 20 : 8505 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 8506 minSize = (match === "y" ? size : 1), 8507 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 8508 num = value.substring(iValue).match(digits); 8509 if (!num) { 8510 throw "Missing number at position " + iValue; 8511 } 8512 iValue += num[0].length; 8513 return parseInt(num[0], 10); 8514 }, 8515 8516 // Extract a name from the string value and convert to an index 8517 getName = function (match, shortNames, longNames) { 8518 var index = -1, 8519 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 8520 return [[k, v]]; 8521 }).sort(function (a, b) { 8522 return -(a[1].length - b[1].length); 8523 }); 8524 8525 $.each(names, function (i, pair) { 8526 var name = pair[1]; 8527 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 8528 index = pair[0]; 8529 iValue += name.length; 8530 return false; 8531 } 8532 }); 8533 if (index !== -1) { 8534 return index + 1; 8535 } else { 8536 throw "Unknown name at position " + iValue; 8537 } 8538 }, 8539 8540 // Confirm that a literal character matches the string value 8541 checkLiteral = function () { 8542 if (value.charAt(iValue) !== format.charAt(iFormat)) { 8543 throw "Unexpected literal at position " + iValue; 8544 } 8545 iValue++; 8546 }; 8547 8548 for (iFormat = 0; iFormat < format.length; iFormat++) { 8549 if (literal) { 8550 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8551 literal = false; 8552 } else { 8553 checkLiteral(); 8554 } 8555 } else { 8556 switch (format.charAt(iFormat)) { 8557 case "d": 8558 day = getNumber("d"); 8559 break; 8560 case "D": 8561 getName("D", dayNamesShort, dayNames); 8562 break; 8563 case "o": 8564 doy = getNumber("o"); 8565 break; 8566 case "m": 8567 month = getNumber("m"); 8568 break; 8569 case "M": 8570 month = getName("M", monthNamesShort, monthNames); 8571 break; 8572 case "y": 8573 year = getNumber("y"); 8574 break; 8575 case "@": 8576 date = new Date(getNumber("@")); 8577 year = date.getFullYear(); 8578 month = date.getMonth() + 1; 8579 day = date.getDate(); 8580 break; 8581 case "!": 8582 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 8583 year = date.getFullYear(); 8584 month = date.getMonth() + 1; 8585 day = date.getDate(); 8586 break; 8587 case "'": 8588 if (lookAhead("'")) { 8589 checkLiteral(); 8590 } else { 8591 literal = true; 8592 } 8593 break; 8594 default: 8595 checkLiteral(); 8596 } 8597 } 8598 } 8599 8600 if (iValue < value.length) { 8601 extra = value.substr(iValue); 8602 if (!/^\s+/.test(extra)) { 8603 throw "Extra/unparsed characters found in date: " + extra; 8604 } 8605 } 8606 8607 if (year === -1) { 8608 year = new Date().getFullYear(); 8609 } else if (year < 100) { 8610 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 8611 (year <= shortYearCutoff ? 0 : -100); 8612 } 8613 8614 if (doy > -1) { 8615 month = 1; 8616 day = doy; 8617 do { 8618 dim = this._getDaysInMonth(year, month - 1); 8619 if (day <= dim) { 8620 break; 8621 } 8622 month++; 8623 day -= dim; 8624 } while (true); 8625 } 8626 8627 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 8628 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 8629 throw "Invalid date"; // E.g. 31/02/00 8630 } 8631 return date; 8632 }, 8633 8634 /* Standard date formats. */ 8635 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 8636 COOKIE: "D, dd M yy", 8637 ISO_8601: "yy-mm-dd", 8638 RFC_822: "D, d M y", 8639 RFC_850: "DD, dd-M-y", 8640 RFC_1036: "D, d M y", 8641 RFC_1123: "D, d M yy", 8642 RFC_2822: "D, d M yy", 8643 RSS: "D, d M y", // RFC 822 8644 TICKS: "!", 8645 TIMESTAMP: "@", 8646 W3C: "yy-mm-dd", // ISO 8601 8647 8648 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 8649 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 8650 8651 /* Format a date object into a string value. 8652 * The format can be combinations of the following: 8653 * d - day of month (no leading zero) 8654 * dd - day of month (two digit) 8655 * o - day of year (no leading zeros) 8656 * oo - day of year (three digit) 8657 * D - day name short 8658 * DD - day name long 8659 * m - month of year (no leading zero) 8660 * mm - month of year (two digit) 8661 * M - month name short 8662 * MM - month name long 8663 * y - year (two digit) 8664 * yy - year (four digit) 8665 * @ - Unix timestamp (ms since 01/01/1970) 8666 * ! - Windows ticks (100ns since 01/01/0001) 8667 * "..." - literal text 8668 * '' - single quote 8669 * 8670 * @param format string - the desired format of the date 8671 * @param date Date - the date value to format 8672 * @param settings Object - attributes include: 8673 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8674 * dayNames string[7] - names of the days from Sunday (optional) 8675 * monthNamesShort string[12] - abbreviated names of the months (optional) 8676 * monthNames string[12] - names of the months (optional) 8677 * @return string - the date in the above format 8678 */ 8679 formatDate: function (format, date, settings) { 8680 if (!date) { 8681 return ""; 8682 } 8683 8684 var iFormat, 8685 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 8686 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 8687 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 8688 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 8689 8690 // Check whether a format character is doubled 8691 lookAhead = function (match) { 8692 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8693 if (matches) { 8694 iFormat++; 8695 } 8696 return matches; 8697 }, 8698 8699 // Format a number, with leading zero if necessary 8700 formatNumber = function (match, value, len) { 8701 var num = "" + value; 8702 if (lookAhead(match)) { 8703 while (num.length < len) { 8704 num = "0" + num; 8705 } 8706 } 8707 return num; 8708 }, 8709 8710 // Format a name, short or long as requested 8711 formatName = function (match, value, shortNames, longNames) { 8712 return (lookAhead(match) ? longNames[value] : shortNames[value]); 8713 }, 8714 output = "", 8715 literal = false; 8716 8717 if (date) { 8718 for (iFormat = 0; iFormat < format.length; iFormat++) { 8719 if (literal) { 8720 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8721 literal = false; 8722 } else { 8723 output += format.charAt(iFormat); 8724 } 8725 } else { 8726 switch (format.charAt(iFormat)) { 8727 case "d": 8728 output += formatNumber("d", date.getDate(), 2); 8729 break; 8730 case "D": 8731 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 8732 break; 8733 case "o": 8734 output += formatNumber("o", 8735 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 8736 break; 8737 case "m": 8738 output += formatNumber("m", date.getMonth() + 1, 2); 8739 break; 8740 case "M": 8741 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 8742 break; 8743 case "y": 8744 output += (lookAhead("y") ? date.getFullYear() : 8745 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 8746 break; 8747 case "@": 8748 output += date.getTime(); 8749 break; 8750 case "!": 8751 output += date.getTime() * 10000 + this._ticksTo1970; 8752 break; 8753 case "'": 8754 if (lookAhead("'")) { 8755 output += "'"; 8756 } else { 8757 literal = true; 8758 } 8759 break; 8760 default: 8761 output += format.charAt(iFormat); 8762 } 8763 } 8764 } 8765 } 8766 return output; 8767 }, 8768 8769 /* Extract all possible characters from the date format. */ 8770 _possibleChars: function (format) { 8771 var iFormat, 8772 chars = "", 8773 literal = false, 8774 8775 // Check whether a format character is doubled 8776 lookAhead = function (match) { 8777 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8778 if (matches) { 8779 iFormat++; 8780 } 8781 return matches; 8782 }; 8783 8784 for (iFormat = 0; iFormat < format.length; iFormat++) { 8785 if (literal) { 8786 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8787 literal = false; 8788 } else { 8789 chars += format.charAt(iFormat); 8790 } 8791 } else { 8792 switch (format.charAt(iFormat)) { 8793 case "d": case "m": case "y": case "@": 8794 chars += "0123456789"; 8795 break; 8796 case "D": case "M": 8797 return null; // Accept anything 8798 case "'": 8799 if (lookAhead("'")) { 8800 chars += "'"; 8801 } else { 8802 literal = true; 8803 } 8804 break; 8805 default: 8806 chars += format.charAt(iFormat); 8807 } 8808 } 8809 } 8810 return chars; 8811 }, 8812 8813 /* Get a setting value, defaulting if necessary. */ 8814 _get: function (inst, name) { 8815 return inst.settings[name] !== undefined ? 8816 inst.settings[name] : this._defaults[name]; 8817 }, 8818 8819 /* Parse existing date and initialise date picker. */ 8820 _setDateFromField: function (inst, noDefault) { 8821 if (inst.input.val() === inst.lastVal) { 8822 return; 8823 } 8824 8825 var dateFormat = this._get(inst, "dateFormat"), 8826 dates = inst.lastVal = inst.input ? inst.input.val() : null, 8827 defaultDate = this._getDefaultDate(inst), 8828 date = defaultDate, 8829 settings = this._getFormatConfig(inst); 8830 8831 try { 8832 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 8833 } catch (event) { 8834 dates = (noDefault ? "" : dates); 8835 } 8836 inst.selectedDay = date.getDate(); 8837 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8838 inst.drawYear = inst.selectedYear = date.getFullYear(); 8839 inst.currentDay = (dates ? date.getDate() : 0); 8840 inst.currentMonth = (dates ? date.getMonth() : 0); 8841 inst.currentYear = (dates ? date.getFullYear() : 0); 8842 this._adjustInstDate(inst); 8843 }, 8844 8845 /* Retrieve the default date shown on opening. */ 8846 _getDefaultDate: function (inst) { 8847 return this._restrictMinMax(inst, 8848 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 8849 }, 8850 8851 /* A date may be specified as an exact value or a relative one. */ 8852 _determineDate: function (inst, date, defaultDate) { 8853 var offsetNumeric = function (offset) { 8854 var date = new Date(); 8855 date.setDate(date.getDate() + offset); 8856 return date; 8857 }, 8858 offsetString = function (offset) { 8859 try { 8860 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 8861 offset, $.datepicker._getFormatConfig(inst)); 8862 } catch (e) { 8863 8864 // Ignore 8865 } 8866 8867 var date = (offset.toLowerCase().match(/^c/) ? 8868 $.datepicker._getDate(inst) : null) || new Date(), 8869 year = date.getFullYear(), 8870 month = date.getMonth(), 8871 day = date.getDate(), 8872 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 8873 matches = pattern.exec(offset); 8874 8875 while (matches) { 8876 switch (matches[2] || "d") { 8877 case "d": case "D": 8878 day += parseInt(matches[1], 10); break; 8879 case "w": case "W": 8880 day += parseInt(matches[1], 10) * 7; break; 8881 case "m": case "M": 8882 month += parseInt(matches[1], 10); 8883 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 8884 break; 8885 case "y": case "Y": 8886 year += parseInt(matches[1], 10); 8887 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 8888 break; 8889 } 8890 matches = pattern.exec(offset); 8891 } 8892 return new Date(year, month, day); 8893 }, 8894 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 8895 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 8896 8897 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 8898 if (newDate) { 8899 newDate.setHours(0); 8900 newDate.setMinutes(0); 8901 newDate.setSeconds(0); 8902 newDate.setMilliseconds(0); 8903 } 8904 return this._daylightSavingAdjust(newDate); 8905 }, 8906 8907 /* Handle switch to/from daylight saving. 8908 * Hours may be non-zero on daylight saving cut-over: 8909 * > 12 when midnight changeover, but then cannot generate 8910 * midnight datetime, so jump to 1AM, otherwise reset. 8911 * @param date (Date) the date to check 8912 * @return (Date) the corrected date 8913 */ 8914 _daylightSavingAdjust: function (date) { 8915 if (!date) { 8916 return null; 8917 } 8918 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 8919 return date; 8920 }, 8921 8922 /* Set the date(s) directly. */ 8923 _setDate: function (inst, date, noChange) { 8924 var clear = !date, 8925 origMonth = inst.selectedMonth, 8926 origYear = inst.selectedYear, 8927 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 8928 8929 inst.selectedDay = inst.currentDay = newDate.getDate(); 8930 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 8931 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 8932 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 8933 this._notifyChange(inst); 8934 } 8935 this._adjustInstDate(inst); 8936 if (inst.input) { 8937 inst.input.val(clear ? "" : this._formatDate(inst)); 8938 } 8939 }, 8940 8941 /* Retrieve the date(s) directly. */ 8942 _getDate: function (inst) { 8943 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 8944 this._daylightSavingAdjust(new Date( 8945 inst.currentYear, inst.currentMonth, inst.currentDay))); 8946 return startDate; 8947 }, 8948 8949 /* Attach the onxxx handlers. These are declared statically so 8950 * they work with static code transformers like Caja. 8951 */ 8952 _attachHandlers: function (inst) { 8953 var stepMonths = this._get(inst, "stepMonths"), 8954 id = "#" + inst.id.replace(/\\\\/g, "\\"); 8955 inst.dpDiv.find("[data-handler]").map(function () { 8956 var handler = { 8957 prev: function () { 8958 $.datepicker._adjustDate(id, -stepMonths, "M"); 8959 }, 8960 next: function () { 8961 $.datepicker._adjustDate(id, +stepMonths, "M"); 8962 }, 8963 hide: function () { 8964 $.datepicker._hideDatepicker(); 8965 }, 8966 today: function () { 8967 $.datepicker._gotoToday(id); 8968 }, 8969 selectDay: function () { 8970 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 8971 return false; 8972 }, 8973 selectMonth: function () { 8974 $.datepicker._selectMonthYear(id, this, "M"); 8975 return false; 8976 }, 8977 selectYear: function () { 8978 $.datepicker._selectMonthYear(id, this, "Y"); 8979 return false; 8980 } 8981 }; 8982 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 8983 }); 8984 }, 8985 8986 /* Generate the HTML for the current state of the date picker. */ 8987 _generateHTML: function (inst) { 8988 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 8989 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 8990 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 8991 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 8992 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 8993 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 8994 tempDate = new Date(), 8995 today = this._daylightSavingAdjust( 8996 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 8997 isRTL = this._get(inst, "isRTL"), 8998 showButtonPanel = this._get(inst, "showButtonPanel"), 8999 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 9000 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 9001 numMonths = this._getNumberOfMonths(inst), 9002 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 9003 stepMonths = this._get(inst, "stepMonths"), 9004 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 9005 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 9006 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 9007 minDate = this._getMinMaxDate(inst, "min"), 9008 maxDate = this._getMinMaxDate(inst, "max"), 9009 drawMonth = inst.drawMonth - showCurrentAtPos, 9010 drawYear = inst.drawYear; 9011 9012 if (drawMonth < 0) { 9013 drawMonth += 12; 9014 drawYear--; 9015 } 9016 if (maxDate) { 9017 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 9018 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 9019 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 9020 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 9021 drawMonth--; 9022 if (drawMonth < 0) { 9023 drawMonth = 11; 9024 drawYear--; 9025 } 9026 } 9027 } 9028 inst.drawMonth = drawMonth; 9029 inst.drawYear = drawYear; 9030 9031 prevText = this._get(inst, "prevText"); 9032 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 9033 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 9034 this._getFormatConfig(inst))); 9035 9036 if (this._canAdjustMonth(inst, -1, drawYear, drawMonth)) { 9037 prev = $("<a>") 9038 .attr({ 9039 "class": "ui-datepicker-prev ui-corner-all", 9040 "data-handler": "prev", 9041 "data-event": "click", 9042 title: prevText 9043 }) 9044 .append( 9045 $("<span>") 9046 .addClass("ui-icon ui-icon-circle-triangle-" + 9047 (isRTL ? "e" : "w")) 9048 .text(prevText) 9049 )[0].outerHTML; 9050 } else if (hideIfNoPrevNext) { 9051 prev = ""; 9052 } else { 9053 prev = $("<a>") 9054 .attr({ 9055 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 9056 title: prevText 9057 }) 9058 .append( 9059 $("<span>") 9060 .addClass("ui-icon ui-icon-circle-triangle-" + 9061 (isRTL ? "e" : "w")) 9062 .text(prevText) 9063 )[0].outerHTML; 9064 } 9065 9066 nextText = this._get(inst, "nextText"); 9067 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 9068 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 9069 this._getFormatConfig(inst))); 9070 9071 if (this._canAdjustMonth(inst, +1, drawYear, drawMonth)) { 9072 next = $("<a>") 9073 .attr({ 9074 "class": "ui-datepicker-next ui-corner-all", 9075 "data-handler": "next", 9076 "data-event": "click", 9077 title: nextText 9078 }) 9079 .append( 9080 $("<span>") 9081 .addClass("ui-icon ui-icon-circle-triangle-" + 9082 (isRTL ? "w" : "e")) 9083 .text(nextText) 9084 )[0].outerHTML; 9085 } else if (hideIfNoPrevNext) { 9086 next = ""; 9087 } else { 9088 next = $("<a>") 9089 .attr({ 9090 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 9091 title: nextText 9092 }) 9093 .append( 9094 $("<span>") 9095 .attr("class", "ui-icon ui-icon-circle-triangle-" + 9096 (isRTL ? "w" : "e")) 9097 .text(nextText) 9098 )[0].outerHTML; 9099 } 9100 9101 currentText = this._get(inst, "currentText"); 9102 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 9103 currentText = (!navigationAsDateFormat ? currentText : 9104 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 9105 9106 controls = ""; 9107 if (!inst.inline) { 9108 controls = $("<button>") 9109 .attr({ 9110 type: "button", 9111 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 9112 "data-handler": "hide", 9113 "data-event": "click" 9114 }) 9115 .text(this._get(inst, "closeText"))[0].outerHTML; 9116 } 9117 9118 buttonPanel = ""; 9119 if (showButtonPanel) { 9120 buttonPanel = $("<div class='ui-datepicker-buttonpane ui-widget-content'>") 9121 .append(isRTL ? controls : "") 9122 .append(this._isInRange(inst, gotoDate) ? 9123 $("<button>") 9124 .attr({ 9125 type: "button", 9126 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 9127 "data-handler": "today", 9128 "data-event": "click" 9129 }) 9130 .text(currentText) : 9131 "") 9132 .append(isRTL ? "" : controls)[0].outerHTML; 9133 } 9134 9135 firstDay = parseInt(this._get(inst, "firstDay"), 10); 9136 firstDay = (isNaN(firstDay) ? 0 : firstDay); 9137 9138 showWeek = this._get(inst, "showWeek"); 9139 dayNames = this._get(inst, "dayNames"); 9140 dayNamesMin = this._get(inst, "dayNamesMin"); 9141 monthNames = this._get(inst, "monthNames"); 9142 monthNamesShort = this._get(inst, "monthNamesShort"); 9143 beforeShowDay = this._get(inst, "beforeShowDay"); 9144 showOtherMonths = this._get(inst, "showOtherMonths"); 9145 selectOtherMonths = this._get(inst, "selectOtherMonths"); 9146 defaultDate = this._getDefaultDate(inst); 9147 html = ""; 9148 9149 for (row = 0; row < numMonths[0]; row++) { 9150 group = ""; 9151 this.maxRows = 4; 9152 for (col = 0; col < numMonths[1]; col++) { 9153 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 9154 cornerClass = " ui-corner-all"; 9155 calender = ""; 9156 if (isMultiMonth) { 9157 calender += "<div class='ui-datepicker-group"; 9158 if (numMonths[1] > 1) { 9159 switch (col) { 9160 case 0: calender += " ui-datepicker-group-first"; 9161 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 9162 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 9163 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 9164 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 9165 } 9166 } 9167 calender += "'>"; 9168 } 9169 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 9170 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 9171 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 9172 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 9173 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 9174 "</div><table class='ui-datepicker-calendar'><thead>" + 9175 "<tr>"; 9176 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 9177 for (dow = 0; dow < 7; dow++) { // days of the week 9178 day = (dow + firstDay) % 7; 9179 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 9180 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 9181 } 9182 calender += thead + "</tr></thead><tbody>"; 9183 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 9184 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 9185 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 9186 } 9187 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 9188 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 9189 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 9190 this.maxRows = numRows; 9191 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 9192 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 9193 calender += "<tr>"; 9194 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 9195 this._get(inst, "calculateWeek")(printDate) + "</td>"); 9196 for (dow = 0; dow < 7; dow++) { // create date picker days 9197 daySettings = (beforeShowDay ? 9198 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 9199 otherMonth = (printDate.getMonth() !== drawMonth); 9200 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 9201 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 9202 tbody += "<td class='" + 9203 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 9204 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 9205 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 9206 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 9207 9208 // or defaultDate is current printedDate and defaultDate is selectedDate 9209 " " + this._dayOverClass : "") + // highlight selected day 9210 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 9211 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 9212 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 9213 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 9214 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 9215 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 9216 (otherMonth && !showOtherMonths ? " " : // display for other months 9217 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 9218 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 9219 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 9220 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 9221 "' href='#' aria-current='" + (printDate.getTime() === currentDate.getTime() ? "true" : "false") + // mark date as selected for screen reader 9222 "' data-date='" + printDate.getDate() + // store date as data 9223 "'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 9224 printDate.setDate(printDate.getDate() + 1); 9225 printDate = this._daylightSavingAdjust(printDate); 9226 } 9227 calender += tbody + "</tr>"; 9228 } 9229 drawMonth++; 9230 if (drawMonth > 11) { 9231 drawMonth = 0; 9232 drawYear++; 9233 } 9234 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 9235 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 9236 group += calender; 9237 } 9238 html += group; 9239 } 9240 html += buttonPanel; 9241 inst._keyEvent = false; 9242 return html; 9243 }, 9244 9245 /* Generate the month and year header. */ 9246 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 9247 secondary, monthNames, monthNamesShort) { 9248 9249 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 9250 changeMonth = this._get(inst, "changeMonth"), 9251 changeYear = this._get(inst, "changeYear"), 9252 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 9253 selectMonthLabel = this._get(inst, "selectMonthLabel"), 9254 selectYearLabel = this._get(inst, "selectYearLabel"), 9255 html = "<div class='ui-datepicker-title'>", 9256 monthHtml = ""; 9257 9258 // Month selection 9259 if (secondary || !changeMonth) { 9260 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 9261 } else { 9262 inMinYear = (minDate && minDate.getFullYear() === drawYear); 9263 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 9264 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 9265 for (month = 0; month < 12; month++) { 9266 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 9267 monthHtml += "<option value='" + month + "'" + 9268 (month === drawMonth ? " selected='selected'" : "") + 9269 ">" + monthNamesShort[month] + "</option>"; 9270 } 9271 } 9272 monthHtml += "</select>"; 9273 } 9274 9275 if (!showMonthAfterYear) { 9276 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 9277 } 9278 9279 // Year selection 9280 if (!inst.yearshtml) { 9281 inst.yearshtml = ""; 9282 if (secondary || !changeYear) { 9283 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 9284 } else { 9285 9286 // determine range of years to display 9287 years = this._get(inst, "yearRange").split(":"); 9288 thisYear = new Date().getFullYear(); 9289 determineYear = function (value) { 9290 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 9291 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 9292 parseInt(value, 10))); 9293 return (isNaN(year) ? thisYear : year); 9294 }; 9295 year = determineYear(years[0]); 9296 endYear = Math.max(year, determineYear(years[1] || "")); 9297 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 9298 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 9299 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 9300 for (; year <= endYear; year++) { 9301 inst.yearshtml += "<option value='" + year + "'" + 9302 (year === drawYear ? " selected='selected'" : "") + 9303 ">" + year + "</option>"; 9304 } 9305 inst.yearshtml += "</select>"; 9306 9307 html += inst.yearshtml; 9308 inst.yearshtml = null; 9309 } 9310 } 9311 9312 html += this._get(inst, "yearSuffix"); 9313 if (showMonthAfterYear) { 9314 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 9315 } 9316 html += "</div>"; // Close datepicker_header 9317 return html; 9318 }, 9319 9320 /* Adjust one of the date sub-fields. */ 9321 _adjustInstDate: function (inst, offset, period) { 9322 var year = inst.selectedYear + (period === "Y" ? offset : 0), 9323 month = inst.selectedMonth + (period === "M" ? offset : 0), 9324 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 9325 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 9326 9327 inst.selectedDay = date.getDate(); 9328 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9329 inst.drawYear = inst.selectedYear = date.getFullYear(); 9330 if (period === "M" || period === "Y") { 9331 this._notifyChange(inst); 9332 } 9333 }, 9334 9335 /* Ensure a date is within any min/max bounds. */ 9336 _restrictMinMax: function (inst, date) { 9337 var minDate = this._getMinMaxDate(inst, "min"), 9338 maxDate = this._getMinMaxDate(inst, "max"), 9339 newDate = (minDate && date < minDate ? minDate : date); 9340 return (maxDate && newDate > maxDate ? maxDate : newDate); 9341 }, 9342 9343 /* Notify change of month/year. */ 9344 _notifyChange: function (inst) { 9345 var onChange = this._get(inst, "onChangeMonthYear"); 9346 if (onChange) { 9347 onChange.apply((inst.input ? inst.input[0] : null), 9348 [inst.selectedYear, inst.selectedMonth + 1, inst]); 9349 } 9350 }, 9351 9352 /* Determine the number of months to show. */ 9353 _getNumberOfMonths: function (inst) { 9354 var numMonths = this._get(inst, "numberOfMonths"); 9355 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 9356 }, 9357 9358 /* Determine the current maximum date - ensure no time components are set. */ 9359 _getMinMaxDate: function (inst, minMax) { 9360 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 9361 }, 9362 9363 /* Find the number of days in a given month. */ 9364 _getDaysInMonth: function (year, month) { 9365 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 9366 }, 9367 9368 /* Find the day of the week of the first of a month. */ 9369 _getFirstDayOfMonth: function (year, month) { 9370 return new Date(year, month, 1).getDay(); 9371 }, 9372 9373 /* Determines if we should allow a "next/prev" month display change. */ 9374 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 9375 var numMonths = this._getNumberOfMonths(inst), 9376 date = this._daylightSavingAdjust(new Date(curYear, 9377 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 9378 9379 if (offset < 0) { 9380 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 9381 } 9382 return this._isInRange(inst, date); 9383 }, 9384 9385 /* Is the given date in the accepted range? */ 9386 _isInRange: function (inst, date) { 9387 var yearSplit, currentYear, 9388 minDate = this._getMinMaxDate(inst, "min"), 9389 maxDate = this._getMinMaxDate(inst, "max"), 9390 minYear = null, 9391 maxYear = null, 9392 years = this._get(inst, "yearRange"); 9393 if (years) { 9394 yearSplit = years.split(":"); 9395 currentYear = new Date().getFullYear(); 9396 minYear = parseInt(yearSplit[0], 10); 9397 maxYear = parseInt(yearSplit[1], 10); 9398 if (yearSplit[0].match(/[+\-].*/)) { 9399 minYear += currentYear; 9400 } 9401 if (yearSplit[1].match(/[+\-].*/)) { 9402 maxYear += currentYear; 9403 } 9404 } 9405 9406 return ((!minDate || date.getTime() >= minDate.getTime()) && 9407 (!maxDate || date.getTime() <= maxDate.getTime()) && 9408 (!minYear || date.getFullYear() >= minYear) && 9409 (!maxYear || date.getFullYear() <= maxYear)); 9410 }, 9411 9412 /* Provide the configuration settings for formatting/parsing. */ 9413 _getFormatConfig: function (inst) { 9414 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 9415 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 9416 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 9417 return { 9418 shortYearCutoff: shortYearCutoff, 9419 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 9420 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 9421 }; 9422 }, 9423 9424 /* Format the given date for display. */ 9425 _formatDate: function (inst, day, month, year) { 9426 if (!day) { 9427 inst.currentDay = inst.selectedDay; 9428 inst.currentMonth = inst.selectedMonth; 9429 inst.currentYear = inst.selectedYear; 9430 } 9431 var date = (day ? (typeof day === "object" ? day : 9432 this._daylightSavingAdjust(new Date(year, month, day))) : 9433 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 9434 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 9435 } 9436 }); 9437 9438 /* 9439 * Bind hover events for datepicker elements. 9440 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 9441 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 9442 */ 9443 function datepicker_bindHover(dpDiv) { 9444 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 9445 return dpDiv.on("mouseout", selector, function () { 9446 $(this).removeClass("ui-state-hover"); 9447 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 9448 $(this).removeClass("ui-datepicker-prev-hover"); 9449 } 9450 if (this.className.indexOf("ui-datepicker-next") !== -1) { 9451 $(this).removeClass("ui-datepicker-next-hover"); 9452 } 9453 }) 9454 .on("mouseover", selector, datepicker_handleMouseover); 9455 } 9456 9457 function datepicker_handleMouseover() { 9458 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 9459 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 9460 $(this).addClass("ui-state-hover"); 9461 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 9462 $(this).addClass("ui-datepicker-prev-hover"); 9463 } 9464 if (this.className.indexOf("ui-datepicker-next") !== -1) { 9465 $(this).addClass("ui-datepicker-next-hover"); 9466 } 9467 } 9468 } 9469 9470 /* jQuery extend now ignores nulls! */ 9471 function datepicker_extendRemove(target, props) { 9472 $.extend(target, props); 9473 for (var name in props) { 9474 if (props[name] == null) { 9475 target[name] = props[name]; 9476 } 9477 } 9478 return target; 9479 } 9480 9481 /* Invoke the datepicker functionality. 9482 @param options string - a command, optionally followed by additional parameters or 9483 Object - settings for attaching new datepicker functionality 9484 @return jQuery object */ 9485 $.fn.datepicker = function (options) { 9486 9487 /* Verify an empty collection wasn't passed - Fixes #6976 */ 9488 if (!this.length) { 9489 return this; 9490 } 9491 9492 /* Initialise the date picker. */ 9493 if (!$.datepicker.initialized) { 9494 $(document).on("mousedown", $.datepicker._checkExternalClick); 9495 $.datepicker.initialized = true; 9496 } 9497 9498 /* Append datepicker main container to body if not exist. */ 9499 if ($("#" + $.datepicker._mainDivId).length === 0) { 9500 $("body").append($.datepicker.dpDiv); 9501 } 9502 9503 var otherArgs = Array.prototype.slice.call(arguments, 1); 9504 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 9505 return $.datepicker["_" + options + "Datepicker"]. 9506 apply($.datepicker, [this[0]].concat(otherArgs)); 9507 } 9508 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 9509 return $.datepicker["_" + options + "Datepicker"]. 9510 apply($.datepicker, [this[0]].concat(otherArgs)); 9511 } 9512 return this.each(function () { 9513 if (typeof options === "string") { 9514 $.datepicker["_" + options + "Datepicker"] 9515 .apply($.datepicker, [this].concat(otherArgs)); 9516 } else { 9517 $.datepicker._attachDatepicker(this, options); 9518 } 9519 }); 9520 }; 9521 9522 $.datepicker = new Datepicker(); // singleton instance 9523 $.datepicker.initialized = false;
vendor: 15,317 bytes, lines 9524-9988
9524 $.datepicker.uuid = new Date().getTime(); 9525 $.datepicker.version = "1.13.2"; 9526 9527 var widgetsDatepicker = $.datepicker; 9528 9529 9530 9531 // This file is deprecated 9532 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 9533 9534 /*! 9535 * jQuery UI Mouse 1.13.2 9536 * http://jqueryui.com 9537 * 9538 * Copyright jQuery Foundation and other contributors 9539 * Released under the MIT license. 9540 * http://jquery.org/license 9541 */ 9542 9543 //>>label: Mouse 9544 //>>group: Widgets 9545 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 9546 //>>docs: http://api.jqueryui.com/mouse/ 9547 9548 9549 var mouseHandled = false; 9550 $(document).on("mouseup", function () { 9551 mouseHandled = false; 9552 }); 9553 9554 var widgetsMouse = $.widget("ui.mouse", { 9555 version: "1.13.2", 9556 options: { 9557 cancel: "input, textarea, button, select, option", 9558 distance: 1, 9559 delay: 0 9560 }, 9561 _mouseInit: function () { 9562 var that = this; 9563 9564 this.element 9565 .on("mousedown." + this.widgetName, function (event) { 9566 return that._mouseDown(event); 9567 }) 9568 .on("click." + this.widgetName, function (event) { 9569 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 9570 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 9571 event.stopImmediatePropagation(); 9572 return false; 9573 } 9574 }); 9575 9576 this.started = false; 9577 }, 9578 9579 // TODO: make sure destroying one instance of mouse doesn't mess with 9580 // other instances of mouse 9581 _mouseDestroy: function () { 9582 this.element.off("." + this.widgetName); 9583 if (this._mouseMoveDelegate) { 9584 this.document 9585 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 9586 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 9587 } 9588 }, 9589 9590 _mouseDown: function (event) { 9591 9592 // don't let more than one widget handle mouseStart 9593 if (mouseHandled) { 9594 return; 9595 } 9596 9597 this._mouseMoved = false; 9598 9599 // We may have missed mouseup (out of window) 9600 if (this._mouseStarted) { 9601 this._mouseUp(event); 9602 } 9603 9604 this._mouseDownEvent = event; 9605 9606 var that = this, 9607 btnIsLeft = (event.which === 1), 9608 9609 // event.target.nodeName works around a bug in IE 8 with 9610 // disabled inputs (#7620) 9611 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 9612 $(event.target).closest(this.options.cancel).length : false); 9613 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 9614 return true; 9615 } 9616 9617 this.mouseDelayMet = !this.options.delay; 9618 if (!this.mouseDelayMet) { 9619 this._mouseDelayTimer = setTimeout(function () { 9620 that.mouseDelayMet = true; 9621 }, this.options.delay); 9622 } 9623 9624 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 9625 this._mouseStarted = (this._mouseStart(event) !== false); 9626 if (!this._mouseStarted) { 9627 event.preventDefault(); 9628 return true; 9629 } 9630 } 9631 9632 // Click event may never have fired (Gecko & Opera) 9633 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 9634 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 9635 } 9636 9637 // These delegates are required to keep context 9638 this._mouseMoveDelegate = function (event) { 9639 return that._mouseMove(event); 9640 }; 9641 this._mouseUpDelegate = function (event) { 9642 return that._mouseUp(event); 9643 }; 9644 9645 this.document 9646 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 9647 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 9648 9649 event.preventDefault(); 9650 9651 mouseHandled = true; 9652 return true; 9653 }, 9654 9655 _mouseMove: function (event) { 9656 9657 // Only check for mouseups outside the document if you've moved inside the document 9658 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 9659 // fire a mousemove event if content is placed under the cursor. See #7778 9660 // Support: IE <9 9661 if (this._mouseMoved) { 9662 9663 // IE mouseup check - mouseup happened when mouse was out of window 9664 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 9665 !event.button) { 9666 return this._mouseUp(event); 9667 9668 // Iframe mouseup check - mouseup occurred in another document 9669 } else if (!event.which) { 9670 9671 // Support: Safari <=8 - 9 9672 // Safari sets which to 0 if you press any of the following keys 9673 // during a drag (#14461) 9674 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 9675 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 9676 this.ignoreMissingWhich = true; 9677 } else if (!this.ignoreMissingWhich) { 9678 return this._mouseUp(event); 9679 } 9680 } 9681 } 9682 9683 if (event.which || event.button) { 9684 this._mouseMoved = true; 9685 } 9686 9687 if (this._mouseStarted) { 9688 this._mouseDrag(event); 9689 return event.preventDefault(); 9690 } 9691 9692 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 9693 this._mouseStarted = 9694 (this._mouseStart(this._mouseDownEvent, event) !== false); 9695 if (this._mouseStarted) { 9696 this._mouseDrag(event); 9697 } else { 9698 this._mouseUp(event); 9699 } 9700 } 9701 9702 return !this._mouseStarted; 9703 }, 9704 9705 _mouseUp: function (event) { 9706 this.document 9707 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 9708 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 9709 9710 if (this._mouseStarted) { 9711 this._mouseStarted = false; 9712 9713 if (event.target === this._mouseDownEvent.target) { 9714 $.data(event.target, this.widgetName + ".preventClickEvent", true); 9715 } 9716 9717 this._mouseStop(event); 9718 } 9719 9720 if (this._mouseDelayTimer) { 9721 clearTimeout(this._mouseDelayTimer); 9722 delete this._mouseDelayTimer; 9723 } 9724 9725 this.ignoreMissingWhich = false; 9726 mouseHandled = false; 9727 event.preventDefault(); 9728 }, 9729 9730 _mouseDistanceMet: function (event) { 9731 return (Math.max( 9732 Math.abs(this._mouseDownEvent.pageX - event.pageX), 9733 Math.abs(this._mouseDownEvent.pageY - event.pageY) 9734 ) >= this.options.distance 9735 ); 9736 }, 9737 9738 _mouseDelayMet: function ( /* event */) { 9739 return this.mouseDelayMet; 9740 }, 9741 9742 // These are placeholder methods, to be overriden by extending plugin 9743 _mouseStart: function ( /* event */) { }, 9744 _mouseDrag: function ( /* event */) { }, 9745 _mouseStop: function ( /* event */) { }, 9746 _mouseCapture: function ( /* event */) { 9747 return true; 9748 } 9749 }); 9750 9751 9752 9753 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 9754 var plugin = $.ui.plugin = { 9755 add: function (module, option, set) { 9756 var i, 9757 proto = $.ui[module].prototype; 9758 for (i in set) { 9759 proto.plugins[i] = proto.plugins[i] || []; 9760 proto.plugins[i].push([option, set[i]]); 9761 } 9762 }, 9763 call: function (instance, name, args, allowDisconnected) { 9764 var i, 9765 set = instance.plugins[name]; 9766 9767 if (!set) { 9768 return; 9769 } 9770 9771 if (!allowDisconnected && (!instance.element[0].parentNode || 9772 instance.element[0].parentNode.nodeType === 11)) { 9773 return; 9774 } 9775 9776 for (i = 0; i < set.length; i++) { 9777 if (instance.options[set[i][0]]) { 9778 set[i][1].apply(instance.element, args); 9779 } 9780 } 9781 } 9782 }; 9783 9784 9785 9786 var safeBlur = $.ui.safeBlur = function (element) { 9787 9788 // Support: IE9 - 10 only 9789 // If the <body> is blurred, IE will switch windows, see #9420 9790 if (element && element.nodeName.toLowerCase() !== "body") { 9791 $(element).trigger("blur"); 9792 } 9793 }; 9794 9795 9796 /*! 9797 * jQuery UI Draggable 1.13.2 9798 * http://jqueryui.com 9799 * 9800 * Copyright jQuery Foundation and other contributors 9801 * Released under the MIT license. 9802 * http://jquery.org/license 9803 */ 9804 9805 //>>label: Draggable 9806 //>>group: Interactions 9807 //>>description: Enables dragging functionality for any element. 9808 //>>docs: http://api.jqueryui.com/draggable/ 9809 //>>demos: http://jqueryui.com/draggable/ 9810 //>>css.structure: ../../themes/base/draggable.css 9811 9812 9813 $.widget("ui.draggable", $.ui.mouse, { 9814 version: "1.13.2", 9815 widgetEventPrefix: "drag", 9816 options: { 9817 addClasses: true, 9818 appendTo: "parent", 9819 axis: false, 9820 connectToSortable: false, 9821 containment: false, 9822 cursor: "auto", 9823 cursorAt: false, 9824 grid: false, 9825 handle: false, 9826 helper: "original", 9827 iframeFix: false, 9828 opacity: false, 9829 refreshPositions: false, 9830 revert: false, 9831 revertDuration: 500, 9832 scope: "default", 9833 scroll: true, 9834 scrollSensitivity: 20, 9835 scrollSpeed: 20, 9836 snap: false, 9837 snapMode: "both", 9838 snapTolerance: 20, 9839 stack: false, 9840 zIndex: false, 9841 9842 // Callbacks 9843 drag: null, 9844 start: null, 9845 stop: null 9846 }, 9847 _create: function () { 9848 9849 if (this.options.helper === "original") { 9850 this._setPositionRelative(); 9851 } 9852 if (this.options.addClasses) { 9853 this._addClass("ui-draggable"); 9854 } 9855 this._setHandleClassName(); 9856 9857 this._mouseInit(); 9858 }, 9859 9860 _setOption: function (key, value) { 9861 this._super(key, value); 9862 if (key === "handle") { 9863 this._removeHandleClassName(); 9864 this._setHandleClassName(); 9865 } 9866 }, 9867 9868 _destroy: function () { 9869 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 9870 this.destroyOnClear = true; 9871 return; 9872 } 9873 this._removeHandleClassName(); 9874 this._mouseDestroy(); 9875 }, 9876 9877 _mouseCapture: function (event) { 9878 var o = this.options; 9879 9880 // Among others, prevent a drag on a resizable-handle 9881 if (this.helper || o.disabled || 9882 $(event.target).closest(".ui-resizable-handle").length > 0) { 9883 return false; 9884 } 9885 9886 //Quit if we're not on a valid handle 9887 this.handle = this._getHandle(event); 9888 if (!this.handle) { 9889 return false; 9890 } 9891 9892 this._blurActiveElement(event); 9893 9894 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 9895 9896 return true; 9897 9898 }, 9899 9900 _blockFrames: function (selector) { 9901 this.iframeBlocks = this.document.find(selector).map(function () { 9902 var iframe = $(this); 9903 9904 return $("<div>") 9905 .css("position", "absolute") 9906 .appendTo(iframe.parent()) 9907 .outerWidth(iframe.outerWidth()) 9908 .outerHeight(iframe.outerHeight()) 9909 .offset(iframe.offset())[0]; 9910 }); 9911 }, 9912 9913 _unblockFrames: function () { 9914 if (this.iframeBlocks) { 9915 this.iframeBlocks.remove(); 9916 delete this.iframeBlocks; 9917 } 9918 }, 9919 9920 _blurActiveElement: function (event) { 9921 var activeElement = $.ui.safeActiveElement(this.document[0]), 9922 target = $(event.target); 9923 9924 // Don't blur if the event occurred on an element that is within 9925 // the currently focused element 9926 // See #10527, #12472 9927 if (target.closest(activeElement).length) { 9928 return; 9929 } 9930 9931 // Blur any element that currently has focus, see #4261 9932 $.ui.safeBlur(activeElement); 9933 }, 9934 9935 _mouseStart: function (event) { 9936 9937 var o = this.options; 9938 9939 //Create and append the visible helper 9940 this.helper = this._createHelper(event); 9941 9942 this._addClass(this.helper, "ui-draggable-dragging"); 9943 9944 //Cache the helper size 9945 this._cacheHelperProportions(); 9946 9947 //If ddmanager is used for droppables, set the global draggable 9948 if ($.ui.ddmanager) { 9949 $.ui.ddmanager.current = this; 9950 } 9951 9952 /* 9953 * - Position generation - 9954 * This block generates everything position related - it's the core of draggables. 9955 */ 9956 9957 //Cache the margins of the original element 9958 this._cacheMargins(); 9959 9960 //Store the helper's css position 9961 this.cssPosition = this.helper.css("position"); 9962 this.scrollParent = this.helper.scrollParent(true); 9963 this.offsetParent = this.helper.offsetParent(); 9964 this.hasFixedAncestor = this.helper.parents().filter(function () { 9965 return $(this).css("position") === "fixed"; 9966 }).length > 0; 9967 9968 //The element's absolute position on the page minus margins 9969 this.positionAbs = this.element.offset(); 9970 this._refreshOffsets(event); 9971 9972 //Generate the original position 9973 this.originalPosition = this.position = this._generatePosition(event, false); 9974 this.originalPageX = event.pageX; 9975 this.originalPageY = event.pageY; 9976 9977 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 9978 if (o.cursorAt) { 9979 this._adjustOffsetFromHelper(o.cursorAt); 9980 } 9981 9982 //Set a containment if given in the options 9983 this._setContainment(); 9984 9985 //Trigger event + callbacks 9986 if (this._trigger("start", event) === false) { 9987 this._clear(); 9988 return false;
vendor: 34,799 bytes, lines 9989-10861
9989 } 9990 9991 //Recache the helper size 9992 this._cacheHelperProportions(); 9993 9994 //Prepare the droppable offsets 9995 if ($.ui.ddmanager && !o.dropBehaviour) { 9996 $.ui.ddmanager.prepareOffsets(this, event); 9997 } 9998 9999 // Execute the drag once - this causes the helper not to be visible before getting its 10000 // correct position 10001 this._mouseDrag(event, true); 10002 10003 // If the ddmanager is used for droppables, inform the manager that dragging has started 10004 // (see #5003) 10005 if ($.ui.ddmanager) { 10006 $.ui.ddmanager.dragStart(this, event); 10007 } 10008 10009 return true; 10010 }, 10011 10012 _refreshOffsets: function (event) { 10013 this.offset = { 10014 top: this.positionAbs.top - this.margins.top, 10015 left: this.positionAbs.left - this.margins.left, 10016 scroll: false, 10017 parent: this._getParentOffset(), 10018 relative: this._getRelativeOffset() 10019 }; 10020 10021 this.offset.click = { 10022 left: event.pageX - this.offset.left, 10023 top: event.pageY - this.offset.top 10024 }; 10025 }, 10026 10027 _mouseDrag: function (event, noPropagation) { 10028 10029 // reset any necessary cached properties (see #5009) 10030 if (this.hasFixedAncestor) { 10031 this.offset.parent = this._getParentOffset(); 10032 } 10033 10034 //Compute the helpers position 10035 this.position = this._generatePosition(event, true); 10036 this.positionAbs = this._convertPositionTo("absolute"); 10037 10038 //Call plugins and callbacks and use the resulting position if something is returned 10039 if (!noPropagation) { 10040 var ui = this._uiHash(); 10041 if (this._trigger("drag", event, ui) === false) { 10042 this._mouseUp(new $.Event("mouseup", event)); 10043 return false; 10044 } 10045 this.position = ui.position; 10046 } 10047 10048 this.helper[0].style.left = this.position.left + "px"; 10049 this.helper[0].style.top = this.position.top + "px"; 10050 10051 if ($.ui.ddmanager) { 10052 $.ui.ddmanager.drag(this, event); 10053 } 10054 10055 return false; 10056 }, 10057 10058 _mouseStop: function (event) { 10059 10060 //If we are using droppables, inform the manager about the drop 10061 var that = this, 10062 dropped = false; 10063 if ($.ui.ddmanager && !this.options.dropBehaviour) { 10064 dropped = $.ui.ddmanager.drop(this, event); 10065 } 10066 10067 //if a drop comes from outside (a sortable) 10068 if (this.dropped) { 10069 dropped = this.dropped; 10070 this.dropped = false; 10071 } 10072 10073 if ((this.options.revert === "invalid" && !dropped) || 10074 (this.options.revert === "valid" && dropped) || 10075 this.options.revert === true || (typeof this.options.revert === "function" && 10076 this.options.revert.call(this.element, dropped)) 10077 ) { 10078 $(this.helper).animate( 10079 this.originalPosition, 10080 parseInt(this.options.revertDuration, 10), 10081 function () { 10082 if (that._trigger("stop", event) !== false) { 10083 that._clear(); 10084 } 10085 } 10086 ); 10087 } else { 10088 if (this._trigger("stop", event) !== false) { 10089 this._clear(); 10090 } 10091 } 10092 10093 return false; 10094 }, 10095 10096 _mouseUp: function (event) { 10097 this._unblockFrames(); 10098 10099 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 10100 // (see #5003) 10101 if ($.ui.ddmanager) { 10102 $.ui.ddmanager.dragStop(this, event); 10103 } 10104 10105 // Only need to focus if the event occurred on the draggable itself, see #10527 10106 if (this.handleElement.is(event.target)) { 10107 10108 // The interaction is over; whether or not the click resulted in a drag, 10109 // focus the element 10110 this.element.trigger("focus"); 10111 } 10112 10113 return $.ui.mouse.prototype._mouseUp.call(this, event); 10114 }, 10115 10116 cancel: function () { 10117 10118 if (this.helper.is(".ui-draggable-dragging")) { 10119 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 10120 } else { 10121 this._clear(); 10122 } 10123 10124 return this; 10125 10126 }, 10127 10128 _getHandle: function (event) { 10129 return this.options.handle ? 10130 !!$(event.target).closest(this.element.find(this.options.handle)).length : 10131 true; 10132 }, 10133 10134 _setHandleClassName: function () { 10135 this.handleElement = this.options.handle ? 10136 this.element.find(this.options.handle) : this.element; 10137 this._addClass(this.handleElement, "ui-draggable-handle"); 10138 }, 10139 10140 _removeHandleClassName: function () { 10141 this._removeClass(this.handleElement, "ui-draggable-handle"); 10142 }, 10143 10144 _createHelper: function (event) { 10145 10146 var o = this.options, 10147 helperIsFunction = typeof o.helper === "function", 10148 helper = helperIsFunction ? 10149 $(o.helper.apply(this.element[0], [event])) : 10150 (o.helper === "clone" ? 10151 this.element.clone().removeAttr("id") : 10152 this.element); 10153 10154 if (!helper.parents("body").length) { 10155 helper.appendTo((o.appendTo === "parent" ? 10156 this.element[0].parentNode : 10157 o.appendTo)); 10158 } 10159 10160 // Http://bugs.jqueryui.com/ticket/9446 10161 // a helper function can return the original element 10162 // which wouldn't have been set to relative in _create 10163 if (helperIsFunction && helper[0] === this.element[0]) { 10164 this._setPositionRelative(); 10165 } 10166 10167 if (helper[0] !== this.element[0] && 10168 !(/(fixed|absolute)/).test(helper.css("position"))) { 10169 helper.css("position", "absolute"); 10170 } 10171 10172 return helper; 10173 10174 }, 10175 10176 _setPositionRelative: function () { 10177 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 10178 this.element[0].style.position = "relative"; 10179 } 10180 }, 10181 10182 _adjustOffsetFromHelper: function (obj) { 10183 if (typeof obj === "string") { 10184 obj = obj.split(" "); 10185 } 10186 if (Array.isArray(obj)) { 10187 obj = { left: +obj[0], top: +obj[1] || 0 }; 10188 } 10189 if ("left" in obj) { 10190 this.offset.click.left = obj.left + this.margins.left; 10191 } 10192 if ("right" in obj) { 10193 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 10194 } 10195 if ("top" in obj) { 10196 this.offset.click.top = obj.top + this.margins.top; 10197 } 10198 if ("bottom" in obj) { 10199 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 10200 } 10201 }, 10202 10203 _isRootNode: function (element) { 10204 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 10205 }, 10206 10207 _getParentOffset: function () { 10208 10209 //Get the offsetParent and cache its position 10210 var po = this.offsetParent.offset(), 10211 document = this.document[0]; 10212 10213 // This is a special case where we need to modify a offset calculated on start, since the 10214 // following happened: 10215 // 1. The position of the helper is absolute, so it's position is calculated based on the 10216 // next positioned parent 10217 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 10218 // the document, which means that the scroll is included in the initial calculation of the 10219 // offset of the parent, and never recalculated upon drag 10220 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 10221 $.contains(this.scrollParent[0], this.offsetParent[0])) { 10222 po.left += this.scrollParent.scrollLeft(); 10223 po.top += this.scrollParent.scrollTop(); 10224 } 10225 10226 if (this._isRootNode(this.offsetParent[0])) { 10227 po = { top: 0, left: 0 }; 10228 } 10229 10230 return { 10231 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 10232 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 10233 }; 10234 10235 }, 10236 10237 _getRelativeOffset: function () { 10238 if (this.cssPosition !== "relative") { 10239 return { top: 0, left: 0 }; 10240 } 10241 10242 var p = this.element.position(), 10243 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 10244 10245 return { 10246 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 10247 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 10248 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 10249 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 10250 }; 10251 10252 }, 10253 10254 _cacheMargins: function () { 10255 this.margins = { 10256 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 10257 top: (parseInt(this.element.css("marginTop"), 10) || 0), 10258 right: (parseInt(this.element.css("marginRight"), 10) || 0), 10259 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 10260 }; 10261 }, 10262 10263 _cacheHelperProportions: function () { 10264 this.helperProportions = { 10265 width: this.helper.outerWidth(), 10266 height: this.helper.outerHeight() 10267 }; 10268 }, 10269 10270 _setContainment: function () { 10271 10272 var isUserScrollable, c, ce, 10273 o = this.options, 10274 document = this.document[0]; 10275 10276 this.relativeContainer = null; 10277 10278 if (!o.containment) { 10279 this.containment = null; 10280 return; 10281 } 10282 10283 if (o.containment === "window") { 10284 this.containment = [ 10285 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 10286 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 10287 $(window).scrollLeft() + $(window).width() - 10288 this.helperProportions.width - this.margins.left, 10289 $(window).scrollTop() + 10290 ($(window).height() || document.body.parentNode.scrollHeight) - 10291 this.helperProportions.height - this.margins.top 10292 ]; 10293 return; 10294 } 10295 10296 if (o.containment === "document") { 10297 this.containment = [ 10298 0, 10299 0, 10300 $(document).width() - this.helperProportions.width - this.margins.left, 10301 ($(document).height() || document.body.parentNode.scrollHeight) - 10302 this.helperProportions.height - this.margins.top 10303 ]; 10304 return; 10305 } 10306 10307 if (o.containment.constructor === Array) { 10308 this.containment = o.containment; 10309 return; 10310 } 10311 10312 if (o.containment === "parent") { 10313 o.containment = this.helper[0].parentNode; 10314 } 10315 10316 c = $(o.containment); 10317 ce = c[0]; 10318 10319 if (!ce) { 10320 return; 10321 } 10322 10323 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 10324 10325 this.containment = [ 10326 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 10327 (parseInt(c.css("paddingLeft"), 10) || 0), 10328 (parseInt(c.css("borderTopWidth"), 10) || 0) + 10329 (parseInt(c.css("paddingTop"), 10) || 0), 10330 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 10331 (parseInt(c.css("borderRightWidth"), 10) || 0) - 10332 (parseInt(c.css("paddingRight"), 10) || 0) - 10333 this.helperProportions.width - 10334 this.margins.left - 10335 this.margins.right, 10336 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 10337 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 10338 (parseInt(c.css("paddingBottom"), 10) || 0) - 10339 this.helperProportions.height - 10340 this.margins.top - 10341 this.margins.bottom 10342 ]; 10343 this.relativeContainer = c; 10344 }, 10345 10346 _convertPositionTo: function (d, pos) { 10347 10348 if (!pos) { 10349 pos = this.position; 10350 } 10351 10352 var mod = d === "absolute" ? 1 : -1, 10353 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 10354 10355 return { 10356 top: ( 10357 10358 // The absolute mouse position 10359 pos.top + 10360 10361 // Only for relative positioned nodes: Relative offset from element to offset parent 10362 this.offset.relative.top * mod + 10363 10364 // The offsetParent's offset without borders (offset + border) 10365 this.offset.parent.top * mod - 10366 ((this.cssPosition === "fixed" ? 10367 -this.offset.scroll.top : 10368 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 10369 ), 10370 left: ( 10371 10372 // The absolute mouse position 10373 pos.left + 10374 10375 // Only for relative positioned nodes: Relative offset from element to offset parent 10376 this.offset.relative.left * mod + 10377 10378 // The offsetParent's offset without borders (offset + border) 10379 this.offset.parent.left * mod - 10380 ((this.cssPosition === "fixed" ? 10381 -this.offset.scroll.left : 10382 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 10383 ) 10384 }; 10385 10386 }, 10387 10388 _generatePosition: function (event, constrainPosition) { 10389 10390 var containment, co, top, left, 10391 o = this.options, 10392 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 10393 pageX = event.pageX, 10394 pageY = event.pageY; 10395 10396 // Cache the scroll 10397 if (!scrollIsRootNode || !this.offset.scroll) { 10398 this.offset.scroll = { 10399 top: this.scrollParent.scrollTop(), 10400 left: this.scrollParent.scrollLeft() 10401 }; 10402 } 10403 10404 /* 10405 * - Position constraining - 10406 * Constrain the position to a mix of grid, containment. 10407 */ 10408 10409 // If we are not dragging yet, we won't check for options 10410 if (constrainPosition) { 10411 if (this.containment) { 10412 if (this.relativeContainer) { 10413 co = this.relativeContainer.offset(); 10414 containment = [ 10415 this.containment[0] + co.left, 10416 this.containment[1] + co.top, 10417 this.containment[2] + co.left, 10418 this.containment[3] + co.top 10419 ]; 10420 } else { 10421 containment = this.containment; 10422 } 10423 10424 if (event.pageX - this.offset.click.left < containment[0]) { 10425 pageX = containment[0] + this.offset.click.left; 10426 } 10427 if (event.pageY - this.offset.click.top < containment[1]) { 10428 pageY = containment[1] + this.offset.click.top; 10429 } 10430 if (event.pageX - this.offset.click.left > containment[2]) { 10431 pageX = containment[2] + this.offset.click.left; 10432 } 10433 if (event.pageY - this.offset.click.top > containment[3]) { 10434 pageY = containment[3] + this.offset.click.top; 10435 } 10436 } 10437 10438 if (o.grid) { 10439 10440 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 10441 // argument errors in IE (see ticket #6950) 10442 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 10443 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 10444 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 10445 top - this.offset.click.top > containment[3]) ? 10446 top : 10447 ((top - this.offset.click.top >= containment[1]) ? 10448 top - o.grid[1] : top + o.grid[1])) : top; 10449 10450 left = o.grid[0] ? this.originalPageX + 10451 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 10452 this.originalPageX; 10453 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 10454 left - this.offset.click.left > containment[2]) ? 10455 left : 10456 ((left - this.offset.click.left >= containment[0]) ? 10457 left - o.grid[0] : left + o.grid[0])) : left; 10458 } 10459 10460 if (o.axis === "y") { 10461 pageX = this.originalPageX; 10462 } 10463 10464 if (o.axis === "x") { 10465 pageY = this.originalPageY; 10466 } 10467 } 10468 10469 return { 10470 top: ( 10471 10472 // The absolute mouse position 10473 pageY - 10474 10475 // Click offset (relative to the element) 10476 this.offset.click.top - 10477 10478 // Only for relative positioned nodes: Relative offset from element to offset parent 10479 this.offset.relative.top - 10480 10481 // The offsetParent's offset without borders (offset + border) 10482 this.offset.parent.top + 10483 (this.cssPosition === "fixed" ? 10484 -this.offset.scroll.top : 10485 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 10486 ), 10487 left: ( 10488 10489 // The absolute mouse position 10490 pageX - 10491 10492 // Click offset (relative to the element) 10493 this.offset.click.left - 10494 10495 // Only for relative positioned nodes: Relative offset from element to offset parent 10496 this.offset.relative.left - 10497 10498 // The offsetParent's offset without borders (offset + border) 10499 this.offset.parent.left + 10500 (this.cssPosition === "fixed" ? 10501 -this.offset.scroll.left : 10502 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 10503 ) 10504 }; 10505 10506 }, 10507 10508 _clear: function () { 10509 this._removeClass(this.helper, "ui-draggable-dragging"); 10510 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 10511 this.helper.remove(); 10512 } 10513 this.helper = null; 10514 this.cancelHelperRemoval = false; 10515 if (this.destroyOnClear) { 10516 this.destroy(); 10517 } 10518 }, 10519 10520 // From now on bulk stuff - mainly helpers 10521 10522 _trigger: function (type, event, ui) { 10523 ui = ui || this._uiHash(); 10524 $.ui.plugin.call(this, type, [event, ui, this], true); 10525 10526 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 10527 if (/^(drag|start|stop)/.test(type)) { 10528 this.positionAbs = this._convertPositionTo("absolute"); 10529 ui.offset = this.positionAbs; 10530 } 10531 return $.Widget.prototype._trigger.call(this, type, event, ui); 10532 }, 10533 10534 plugins: {}, 10535 10536 _uiHash: function () { 10537 return { 10538 helper: this.helper, 10539 position: this.position, 10540 originalPosition: this.originalPosition, 10541 offset: this.positionAbs 10542 }; 10543 } 10544 10545 }); 10546 10547 $.ui.plugin.add("draggable", "connectToSortable", { 10548 start: function (event, ui, draggable) { 10549 var uiSortable = $.extend({}, ui, { 10550 item: draggable.element 10551 }); 10552 10553 draggable.sortables = []; 10554 $(draggable.options.connectToSortable).each(function () { 10555 var sortable = $(this).sortable("instance"); 10556 10557 if (sortable && !sortable.options.disabled) { 10558 draggable.sortables.push(sortable); 10559 10560 // RefreshPositions is called at drag start to refresh the containerCache 10561 // which is used in drag. This ensures it's initialized and synchronized 10562 // with any changes that might have happened on the page since initialization. 10563 sortable.refreshPositions(); 10564 sortable._trigger("activate", event, uiSortable); 10565 } 10566 }); 10567 }, 10568 stop: function (event, ui, draggable) { 10569 var uiSortable = $.extend({}, ui, { 10570 item: draggable.element 10571 }); 10572 10573 draggable.cancelHelperRemoval = false; 10574 10575 $.each(draggable.sortables, function () { 10576 var sortable = this; 10577 10578 if (sortable.isOver) { 10579 sortable.isOver = 0; 10580 10581 // Allow this sortable to handle removing the helper 10582 draggable.cancelHelperRemoval = true; 10583 sortable.cancelHelperRemoval = false; 10584 10585 // Use _storedCSS To restore properties in the sortable, 10586 // as this also handles revert (#9675) since the draggable 10587 // may have modified them in unexpected ways (#8809) 10588 sortable._storedCSS = { 10589 position: sortable.placeholder.css("position"), 10590 top: sortable.placeholder.css("top"), 10591 left: sortable.placeholder.css("left") 10592 }; 10593 10594 sortable._mouseStop(event); 10595 10596 // Once drag has ended, the sortable should return to using 10597 // its original helper, not the shared helper from draggable 10598 sortable.options.helper = sortable.options._helper; 10599 } else { 10600 10601 // Prevent this Sortable from removing the helper. 10602 // However, don't set the draggable to remove the helper 10603 // either as another connected Sortable may yet handle the removal. 10604 sortable.cancelHelperRemoval = true; 10605 10606 sortable._trigger("deactivate", event, uiSortable); 10607 } 10608 }); 10609 }, 10610 drag: function (event, ui, draggable) { 10611 $.each(draggable.sortables, function () { 10612 var innermostIntersecting = false, 10613 sortable = this; 10614 10615 // Copy over variables that sortable's _intersectsWith uses 10616 sortable.positionAbs = draggable.positionAbs; 10617 sortable.helperProportions = draggable.helperProportions; 10618 sortable.offset.click = draggable.offset.click; 10619 10620 if (sortable._intersectsWith(sortable.containerCache)) { 10621 innermostIntersecting = true; 10622 10623 $.each(draggable.sortables, function () { 10624 10625 // Copy over variables that sortable's _intersectsWith uses 10626 this.positionAbs = draggable.positionAbs; 10627 this.helperProportions = draggable.helperProportions; 10628 this.offset.click = draggable.offset.click; 10629 10630 if (this !== sortable && 10631 this._intersectsWith(this.containerCache) && 10632 $.contains(sortable.element[0], this.element[0])) { 10633 innermostIntersecting = false; 10634 } 10635 10636 return innermostIntersecting; 10637 }); 10638 } 10639 10640 if (innermostIntersecting) { 10641 10642 // If it intersects, we use a little isOver variable and set it once, 10643 // so that the move-in stuff gets fired only once. 10644 if (!sortable.isOver) { 10645 sortable.isOver = 1; 10646 10647 // Store draggable's parent in case we need to reappend to it later. 10648 draggable._parent = ui.helper.parent(); 10649 10650 sortable.currentItem = ui.helper 10651 .appendTo(sortable.element) 10652 .data("ui-sortable-item", true); 10653 10654 // Store helper option to later restore it 10655 sortable.options._helper = sortable.options.helper; 10656 10657 sortable.options.helper = function () { 10658 return ui.helper[0]; 10659 }; 10660 10661 // Fire the start events of the sortable with our passed browser event, 10662 // and our own helper (so it doesn't create a new one) 10663 event.target = sortable.currentItem[0]; 10664 sortable._mouseCapture(event, true); 10665 sortable._mouseStart(event, true, true); 10666 10667 // Because the browser event is way off the new appended portlet, 10668 // modify necessary variables to reflect the changes 10669 sortable.offset.click.top = draggable.offset.click.top; 10670 sortable.offset.click.left = draggable.offset.click.left; 10671 sortable.offset.parent.left -= draggable.offset.parent.left - 10672 sortable.offset.parent.left; 10673 sortable.offset.parent.top -= draggable.offset.parent.top - 10674 sortable.offset.parent.top; 10675 10676 draggable._trigger("toSortable", event); 10677 10678 // Inform draggable that the helper is in a valid drop zone, 10679 // used solely in the revert option to handle "valid/invalid". 10680 draggable.dropped = sortable.element; 10681 10682 // Need to refreshPositions of all sortables in the case that 10683 // adding to one sortable changes the location of the other sortables (#9675) 10684 $.each(draggable.sortables, function () { 10685 this.refreshPositions(); 10686 }); 10687 10688 // Hack so receive/update callbacks work (mostly) 10689 draggable.currentItem = draggable.element; 10690 sortable.fromOutside = draggable; 10691 } 10692 10693 if (sortable.currentItem) { 10694 sortable._mouseDrag(event); 10695 10696 // Copy the sortable's position because the draggable's can potentially reflect 10697 // a relative position, while sortable is always absolute, which the dragged 10698 // element has now become. (#8809) 10699 ui.position = sortable.position; 10700 } 10701 } else { 10702 10703 // If it doesn't intersect with the sortable, and it intersected before, 10704 // we fake the drag stop of the sortable, but make sure it doesn't remove 10705 // the helper by using cancelHelperRemoval. 10706 if (sortable.isOver) { 10707 10708 sortable.isOver = 0; 10709 sortable.cancelHelperRemoval = true; 10710 10711 // Calling sortable's mouseStop would trigger a revert, 10712 // so revert must be temporarily false until after mouseStop is called. 10713 sortable.options._revert = sortable.options.revert; 10714 sortable.options.revert = false; 10715 10716 sortable._trigger("out", event, sortable._uiHash(sortable)); 10717 sortable._mouseStop(event, true); 10718 10719 // Restore sortable behaviors that were modfied 10720 // when the draggable entered the sortable area (#9481) 10721 sortable.options.revert = sortable.options._revert; 10722 sortable.options.helper = sortable.options._helper; 10723 10724 if (sortable.placeholder) { 10725 sortable.placeholder.remove(); 10726 } 10727 10728 // Restore and recalculate the draggable's offset considering the sortable 10729 // may have modified them in unexpected ways. (#8809, #10669) 10730 ui.helper.appendTo(draggable._parent); 10731 draggable._refreshOffsets(event); 10732 ui.position = draggable._generatePosition(event, true); 10733 10734 draggable._trigger("fromSortable", event); 10735 10736 // Inform draggable that the helper is no longer in a valid drop zone 10737 draggable.dropped = false; 10738 10739 // Need to refreshPositions of all sortables just in case removing 10740 // from one sortable changes the location of other sortables (#9675) 10741 $.each(draggable.sortables, function () { 10742 this.refreshPositions(); 10743 }); 10744 } 10745 } 10746 }); 10747 } 10748 }); 10749 10750 $.ui.plugin.add("draggable", "cursor", { 10751 start: function (event, ui, instance) { 10752 var t = $("body"), 10753 o = instance.options; 10754 10755 if (t.css("cursor")) { 10756 o._cursor = t.css("cursor"); 10757 } 10758 t.css("cursor", o.cursor); 10759 }, 10760 stop: function (event, ui, instance) { 10761 var o = instance.options; 10762 if (o._cursor) { 10763 $("body").css("cursor", o._cursor); 10764 } 10765 } 10766 }); 10767 10768 $.ui.plugin.add("draggable", "opacity", { 10769 start: function (event, ui, instance) { 10770 var t = $(ui.helper), 10771 o = instance.options; 10772 if (t.css("opacity")) { 10773 o._opacity = t.css("opacity"); 10774 } 10775 t.css("opacity", o.opacity); 10776 }, 10777 stop: function (event, ui, instance) { 10778 var o = instance.options; 10779 if (o._opacity) { 10780 $(ui.helper).css("opacity", o._opacity); 10781 } 10782 } 10783 }); 10784 10785 $.ui.plugin.add("draggable", "scroll", { 10786 start: function (event, ui, i) { 10787 if (!i.scrollParentNotHidden) { 10788 i.scrollParentNotHidden = i.helper.scrollParent(false); 10789 } 10790 10791 if (i.scrollParentNotHidden[0] !== i.document[0] && 10792 i.scrollParentNotHidden[0].tagName !== "HTML") { 10793 i.overflowOffset = i.scrollParentNotHidden.offset(); 10794 } 10795 }, 10796 drag: function (event, ui, i) { 10797 10798 var o = i.options, 10799 scrolled = false, 10800 scrollParent = i.scrollParentNotHidden[0], 10801 document = i.document[0]; 10802 10803 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 10804 if (!o.axis || o.axis !== "x") { 10805 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 10806 o.scrollSensitivity) { 10807 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 10808 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 10809 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 10810 } 10811 } 10812 10813 if (!o.axis || o.axis !== "y") { 10814 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 10815 o.scrollSensitivity) { 10816 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 10817 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 10818 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 10819 } 10820 } 10821 10822 } else { 10823 10824 if (!o.axis || o.axis !== "x") { 10825 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 10826 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 10827 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 10828 o.scrollSensitivity) { 10829 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 10830 } 10831 } 10832 10833 if (!o.axis || o.axis !== "y") { 10834 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 10835 scrolled = $(document).scrollLeft( 10836 $(document).scrollLeft() - o.scrollSpeed 10837 ); 10838 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 10839 o.scrollSensitivity) { 10840 scrolled = $(document).scrollLeft( 10841 $(document).scrollLeft() + o.scrollSpeed 10842 ); 10843 } 10844 } 10845 10846 } 10847 10848 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 10849 $.ui.ddmanager.prepareOffsets(i, event); 10850 } 10851 10852 } 10853 }); 10854 10855 $.ui.plugin.add("draggable", "snap", { 10856 start: function (event, ui, i) { 10857 10858 var o = i.options; 10859 10860 i.snapElements = []; 10861
vendor: 36,262 bytes, lines 10862-11912
10862 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 10863 .each(function () { 10864 var $t = $(this), 10865 $o = $t.offset(); 10866 if (this !== i.element[0]) { 10867 i.snapElements.push({ 10868 item: this, 10869 width: $t.outerWidth(), height: $t.outerHeight(), 10870 top: $o.top, left: $o.left 10871 }); 10872 } 10873 }); 10874 10875 }, 10876 drag: function (event, ui, inst) { 10877 10878 var ts, bs, ls, rs, l, r, t, b, i, first, 10879 o = inst.options, 10880 d = o.snapTolerance, 10881 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 10882 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 10883 10884 for (i = inst.snapElements.length - 1; i >= 0; i--) { 10885 10886 l = inst.snapElements[i].left - inst.margins.left; 10887 r = l + inst.snapElements[i].width; 10888 t = inst.snapElements[i].top - inst.margins.top; 10889 b = t + inst.snapElements[i].height; 10890 10891 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 10892 !$.contains(inst.snapElements[i].item.ownerDocument, 10893 inst.snapElements[i].item)) { 10894 if (inst.snapElements[i].snapping) { 10895 if (inst.options.snap.release) { 10896 inst.options.snap.release.call( 10897 inst.element, 10898 event, 10899 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 10900 ); 10901 } 10902 } 10903 inst.snapElements[i].snapping = false; 10904 continue; 10905 } 10906 10907 if (o.snapMode !== "inner") { 10908 ts = Math.abs(t - y2) <= d; 10909 bs = Math.abs(b - y1) <= d; 10910 ls = Math.abs(l - x2) <= d; 10911 rs = Math.abs(r - x1) <= d; 10912 if (ts) { 10913 ui.position.top = inst._convertPositionTo("relative", { 10914 top: t - inst.helperProportions.height, 10915 left: 0 10916 }).top; 10917 } 10918 if (bs) { 10919 ui.position.top = inst._convertPositionTo("relative", { 10920 top: b, 10921 left: 0 10922 }).top; 10923 } 10924 if (ls) { 10925 ui.position.left = inst._convertPositionTo("relative", { 10926 top: 0, 10927 left: l - inst.helperProportions.width 10928 }).left; 10929 } 10930 if (rs) { 10931 ui.position.left = inst._convertPositionTo("relative", { 10932 top: 0, 10933 left: r 10934 }).left; 10935 } 10936 } 10937 10938 first = (ts || bs || ls || rs); 10939 10940 if (o.snapMode !== "outer") { 10941 ts = Math.abs(t - y1) <= d; 10942 bs = Math.abs(b - y2) <= d; 10943 ls = Math.abs(l - x1) <= d; 10944 rs = Math.abs(r - x2) <= d; 10945 if (ts) { 10946 ui.position.top = inst._convertPositionTo("relative", { 10947 top: t, 10948 left: 0 10949 }).top; 10950 } 10951 if (bs) { 10952 ui.position.top = inst._convertPositionTo("relative", { 10953 top: b - inst.helperProportions.height, 10954 left: 0 10955 }).top; 10956 } 10957 if (ls) { 10958 ui.position.left = inst._convertPositionTo("relative", { 10959 top: 0, 10960 left: l 10961 }).left; 10962 } 10963 if (rs) { 10964 ui.position.left = inst._convertPositionTo("relative", { 10965 top: 0, 10966 left: r - inst.helperProportions.width 10967 }).left; 10968 } 10969 } 10970 10971 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 10972 if (inst.options.snap.snap) { 10973 inst.options.snap.snap.call( 10974 inst.element, 10975 event, 10976 $.extend(inst._uiHash(), { 10977 snapItem: inst.snapElements[i].item 10978 })); 10979 } 10980 } 10981 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 10982 10983 } 10984 10985 } 10986 }); 10987 10988 $.ui.plugin.add("draggable", "stack", { 10989 start: function (event, ui, instance) { 10990 var min, 10991 o = instance.options, 10992 group = $.makeArray($(o.stack)).sort(function (a, b) { 10993 return (parseInt($(a).css("zIndex"), 10) || 0) - 10994 (parseInt($(b).css("zIndex"), 10) || 0); 10995 }); 10996 10997 if (!group.length) { 10998 return; 10999 } 11000 11001 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 11002 $(group).each(function (i) { 11003 $(this).css("zIndex", min + i); 11004 }); 11005 this.css("zIndex", (min + group.length)); 11006 } 11007 }); 11008 11009 $.ui.plugin.add("draggable", "zIndex", { 11010 start: function (event, ui, instance) { 11011 var t = $(ui.helper), 11012 o = instance.options; 11013 11014 if (t.css("zIndex")) { 11015 o._zIndex = t.css("zIndex"); 11016 } 11017 t.css("zIndex", o.zIndex); 11018 }, 11019 stop: function (event, ui, instance) { 11020 var o = instance.options; 11021 11022 if (o._zIndex) { 11023 $(ui.helper).css("zIndex", o._zIndex); 11024 } 11025 } 11026 }); 11027 11028 var widgetsDraggable = $.ui.draggable; 11029 11030 11031 /*! 11032 * jQuery UI Resizable 1.13.2 11033 * http://jqueryui.com 11034 * 11035 * Copyright jQuery Foundation and other contributors 11036 * Released under the MIT license. 11037 * http://jquery.org/license 11038 */ 11039 11040 //>>label: Resizable 11041 //>>group: Interactions 11042 //>>description: Enables resize functionality for any element. 11043 //>>docs: http://api.jqueryui.com/resizable/ 11044 //>>demos: http://jqueryui.com/resizable/ 11045 //>>css.structure: ../../themes/base/core.css 11046 //>>css.structure: ../../themes/base/resizable.css 11047 //>>css.theme: ../../themes/base/theme.css 11048 11049 11050 $.widget("ui.resizable", $.ui.mouse, { 11051 version: "1.13.2", 11052 widgetEventPrefix: "resize", 11053 options: { 11054 alsoResize: false, 11055 animate: false, 11056 animateDuration: "slow", 11057 animateEasing: "swing", 11058 aspectRatio: false, 11059 autoHide: false, 11060 classes: { 11061 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 11062 }, 11063 containment: false, 11064 ghost: false, 11065 grid: false, 11066 handles: "e,s,se", 11067 helper: false, 11068 maxHeight: null, 11069 maxWidth: null, 11070 minHeight: 10, 11071 minWidth: 10, 11072 11073 // See #7960 11074 zIndex: 90, 11075 11076 // Callbacks 11077 resize: null, 11078 start: null, 11079 stop: null 11080 }, 11081 11082 _num: function (value) { 11083 return parseFloat(value) || 0; 11084 }, 11085 11086 _isNumber: function (value) { 11087 return !isNaN(parseFloat(value)); 11088 }, 11089 11090 _hasScroll: function (el, a) { 11091 11092 if ($(el).css("overflow") === "hidden") { 11093 return false; 11094 } 11095 11096 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 11097 has = false; 11098 11099 if (el[scroll] > 0) { 11100 return true; 11101 } 11102 11103 // TODO: determine which cases actually cause this to happen 11104 // if the element doesn't have the scroll set, see if it's possible to 11105 // set the scroll 11106 try { 11107 el[scroll] = 1; 11108 has = (el[scroll] > 0); 11109 el[scroll] = 0; 11110 } catch (e) { 11111 11112 // `el` might be a string, then setting `scroll` will throw 11113 // an error in strict mode; ignore it. 11114 } 11115 return has; 11116 }, 11117 11118 _create: function () { 11119 11120 var margins, 11121 o = this.options, 11122 that = this; 11123 this._addClass("ui-resizable"); 11124 11125 $.extend(this, { 11126 _aspectRatio: !!(o.aspectRatio), 11127 aspectRatio: o.aspectRatio, 11128 originalElement: this.element, 11129 _proportionallyResizeElements: [], 11130 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 11131 }); 11132 11133 // Wrap the element if it cannot hold child nodes 11134 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 11135 11136 this.element.wrap( 11137 $("<div class='ui-wrapper'></div>").css({ 11138 overflow: "hidden", 11139 position: this.element.css("position"), 11140 width: this.element.outerWidth(), 11141 height: this.element.outerHeight(), 11142 top: this.element.css("top"), 11143 left: this.element.css("left") 11144 }) 11145 ); 11146 11147 this.element = this.element.parent().data( 11148 "ui-resizable", this.element.resizable("instance") 11149 ); 11150 11151 this.elementIsWrapper = true; 11152 11153 margins = { 11154 marginTop: this.originalElement.css("marginTop"), 11155 marginRight: this.originalElement.css("marginRight"), 11156 marginBottom: this.originalElement.css("marginBottom"), 11157 marginLeft: this.originalElement.css("marginLeft") 11158 }; 11159 11160 this.element.css(margins); 11161 this.originalElement.css("margin", 0); 11162 11163 // support: Safari 11164 // Prevent Safari textarea resize 11165 this.originalResizeStyle = this.originalElement.css("resize"); 11166 this.originalElement.css("resize", "none"); 11167 11168 this._proportionallyResizeElements.push(this.originalElement.css({ 11169 position: "static", 11170 zoom: 1, 11171 display: "block" 11172 })); 11173 11174 // Support: IE9 11175 // avoid IE jump (hard set the margin) 11176 this.originalElement.css(margins); 11177 11178 this._proportionallyResize(); 11179 } 11180 11181 this._setupHandles(); 11182 11183 if (o.autoHide) { 11184 $(this.element) 11185 .on("mouseenter", function () { 11186 if (o.disabled) { 11187 return; 11188 } 11189 that._removeClass("ui-resizable-autohide"); 11190 that._handles.show(); 11191 }) 11192 .on("mouseleave", function () { 11193 if (o.disabled) { 11194 return; 11195 } 11196 if (!that.resizing) { 11197 that._addClass("ui-resizable-autohide"); 11198 that._handles.hide(); 11199 } 11200 }); 11201 } 11202 11203 this._mouseInit(); 11204 }, 11205 11206 _destroy: function () { 11207 11208 this._mouseDestroy(); 11209 this._addedHandles.remove(); 11210 11211 var wrapper, 11212 _destroy = function (exp) { 11213 $(exp) 11214 .removeData("resizable") 11215 .removeData("ui-resizable") 11216 .off(".resizable"); 11217 }; 11218 11219 // TODO: Unwrap at same DOM position 11220 if (this.elementIsWrapper) { 11221 _destroy(this.element); 11222 wrapper = this.element; 11223 this.originalElement.css({ 11224 position: wrapper.css("position"), 11225 width: wrapper.outerWidth(), 11226 height: wrapper.outerHeight(), 11227 top: wrapper.css("top"), 11228 left: wrapper.css("left") 11229 }).insertAfter(wrapper); 11230 wrapper.remove(); 11231 } 11232 11233 this.originalElement.css("resize", this.originalResizeStyle); 11234 _destroy(this.originalElement); 11235 11236 return this; 11237 }, 11238 11239 _setOption: function (key, value) { 11240 this._super(key, value); 11241 11242 switch (key) { 11243 case "handles": 11244 this._removeHandles(); 11245 this._setupHandles(); 11246 break; 11247 case "aspectRatio": 11248 this._aspectRatio = !!value; 11249 break; 11250 default: 11251 break; 11252 } 11253 }, 11254 11255 _setupHandles: function () { 11256 var o = this.options, handle, i, n, hname, axis, that = this; 11257 this.handles = o.handles || 11258 (!$(".ui-resizable-handle", this.element).length ? 11259 "e,s,se" : { 11260 n: ".ui-resizable-n", 11261 e: ".ui-resizable-e", 11262 s: ".ui-resizable-s", 11263 w: ".ui-resizable-w", 11264 se: ".ui-resizable-se", 11265 sw: ".ui-resizable-sw", 11266 ne: ".ui-resizable-ne", 11267 nw: ".ui-resizable-nw" 11268 }); 11269 11270 this._handles = $(); 11271 this._addedHandles = $(); 11272 if (this.handles.constructor === String) { 11273 11274 if (this.handles === "all") { 11275 this.handles = "n,e,s,w,se,sw,ne,nw"; 11276 } 11277 11278 n = this.handles.split(","); 11279 this.handles = {}; 11280 11281 for (i = 0; i < n.length; i++) { 11282 11283 handle = String.prototype.trim.call(n[i]); 11284 hname = "ui-resizable-" + handle; 11285 axis = $("<div>"); 11286 this._addClass(axis, "ui-resizable-handle " + hname); 11287 11288 axis.css({ zIndex: o.zIndex }); 11289 11290 this.handles[handle] = ".ui-resizable-" + handle; 11291 if (!this.element.children(this.handles[handle]).length) { 11292 this.element.append(axis); 11293 this._addedHandles = this._addedHandles.add(axis); 11294 } 11295 } 11296 11297 } 11298 11299 this._renderAxis = function (target) { 11300 11301 var i, axis, padPos, padWrapper; 11302 11303 target = target || this.element; 11304 11305 for (i in this.handles) { 11306 11307 if (this.handles[i].constructor === String) { 11308 this.handles[i] = this.element.children(this.handles[i]).first().show(); 11309 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 11310 this.handles[i] = $(this.handles[i]); 11311 this._on(this.handles[i], { "mousedown": that._mouseDown }); 11312 } 11313 11314 if (this.elementIsWrapper && 11315 this.originalElement[0] 11316 .nodeName 11317 .match(/^(textarea|input|select|button)$/i)) { 11318 axis = $(this.handles[i], this.element); 11319 11320 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 11321 axis.outerHeight() : 11322 axis.outerWidth(); 11323 11324 padPos = ["padding", 11325 /ne|nw|n/.test(i) ? "Top" : 11326 /se|sw|s/.test(i) ? "Bottom" : 11327 /^e$/.test(i) ? "Right" : "Left"].join(""); 11328 11329 target.css(padPos, padWrapper); 11330 11331 this._proportionallyResize(); 11332 } 11333 11334 this._handles = this._handles.add(this.handles[i]); 11335 } 11336 }; 11337 11338 // TODO: make renderAxis a prototype function 11339 this._renderAxis(this.element); 11340 11341 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 11342 this._handles.disableSelection(); 11343 11344 this._handles.on("mouseover", function () { 11345 if (!that.resizing) { 11346 if (this.className) { 11347 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 11348 } 11349 that.axis = axis && axis[1] ? axis[1] : "se"; 11350 } 11351 }); 11352 11353 if (o.autoHide) { 11354 this._handles.hide(); 11355 this._addClass("ui-resizable-autohide"); 11356 } 11357 }, 11358 11359 _removeHandles: function () { 11360 this._addedHandles.remove(); 11361 }, 11362 11363 _mouseCapture: function (event) { 11364 var i, handle, 11365 capture = false; 11366 11367 for (i in this.handles) { 11368 handle = $(this.handles[i])[0]; 11369 if (handle === event.target || $.contains(handle, event.target)) { 11370 capture = true; 11371 } 11372 } 11373 11374 return !this.options.disabled && capture; 11375 }, 11376 11377 _mouseStart: function (event) { 11378 11379 var curleft, curtop, cursor, 11380 o = this.options, 11381 el = this.element; 11382 11383 this.resizing = true; 11384 11385 this._renderProxy(); 11386 11387 curleft = this._num(this.helper.css("left")); 11388 curtop = this._num(this.helper.css("top")); 11389 11390 if (o.containment) { 11391 curleft += $(o.containment).scrollLeft() || 0; 11392 curtop += $(o.containment).scrollTop() || 0; 11393 } 11394 11395 this.offset = this.helper.offset(); 11396 this.position = { left: curleft, top: curtop }; 11397 11398 this.size = this._helper ? { 11399 width: this.helper.width(), 11400 height: this.helper.height() 11401 } : { 11402 width: el.width(), 11403 height: el.height() 11404 }; 11405 11406 this.originalSize = this._helper ? { 11407 width: el.outerWidth(), 11408 height: el.outerHeight() 11409 } : { 11410 width: el.width(), 11411 height: el.height() 11412 }; 11413 11414 this.sizeDiff = { 11415 width: el.outerWidth() - el.width(), 11416 height: el.outerHeight() - el.height() 11417 }; 11418 11419 this.originalPosition = { left: curleft, top: curtop }; 11420 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 11421 11422 this.aspectRatio = (typeof o.aspectRatio === "number") ? 11423 o.aspectRatio : 11424 ((this.originalSize.width / this.originalSize.height) || 1); 11425 11426 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 11427 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 11428 11429 this._addClass("ui-resizable-resizing"); 11430 this._propagate("start", event); 11431 return true; 11432 }, 11433 11434 _mouseDrag: function (event) { 11435 11436 var data, props, 11437 smp = this.originalMousePosition, 11438 a = this.axis, 11439 dx = (event.pageX - smp.left) || 0, 11440 dy = (event.pageY - smp.top) || 0, 11441 trigger = this._change[a]; 11442 11443 this._updatePrevProperties(); 11444 11445 if (!trigger) { 11446 return false; 11447 } 11448 11449 data = trigger.apply(this, [event, dx, dy]); 11450 11451 this._updateVirtualBoundaries(event.shiftKey); 11452 if (this._aspectRatio || event.shiftKey) { 11453 data = this._updateRatio(data, event); 11454 } 11455 11456 data = this._respectSize(data, event); 11457 11458 this._updateCache(data); 11459 11460 this._propagate("resize", event); 11461 11462 props = this._applyChanges(); 11463 11464 if (!this._helper && this._proportionallyResizeElements.length) { 11465 this._proportionallyResize(); 11466 } 11467 11468 if (!$.isEmptyObject(props)) { 11469 this._updatePrevProperties(); 11470 this._trigger("resize", event, this.ui()); 11471 this._applyChanges(); 11472 } 11473 11474 return false; 11475 }, 11476 11477 _mouseStop: function (event) { 11478 11479 this.resizing = false; 11480 var pr, ista, soffseth, soffsetw, s, left, top, 11481 o = this.options, that = this; 11482 11483 if (this._helper) { 11484 11485 pr = this._proportionallyResizeElements; 11486 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 11487 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 11488 soffsetw = ista ? 0 : that.sizeDiff.width; 11489 11490 s = { 11491 width: (that.helper.width() - soffsetw), 11492 height: (that.helper.height() - soffseth) 11493 }; 11494 left = (parseFloat(that.element.css("left")) + 11495 (that.position.left - that.originalPosition.left)) || null; 11496 top = (parseFloat(that.element.css("top")) + 11497 (that.position.top - that.originalPosition.top)) || null; 11498 11499 if (!o.animate) { 11500 this.element.css($.extend(s, { top: top, left: left })); 11501 } 11502 11503 that.helper.height(that.size.height); 11504 that.helper.width(that.size.width); 11505 11506 if (this._helper && !o.animate) { 11507 this._proportionallyResize(); 11508 } 11509 } 11510 11511 $("body").css("cursor", "auto"); 11512 11513 this._removeClass("ui-resizable-resizing"); 11514 11515 this._propagate("stop", event); 11516 11517 if (this._helper) { 11518 this.helper.remove(); 11519 } 11520 11521 return false; 11522 11523 }, 11524 11525 _updatePrevProperties: function () { 11526 this.prevPosition = { 11527 top: this.position.top, 11528 left: this.position.left 11529 }; 11530 this.prevSize = { 11531 width: this.size.width, 11532 height: this.size.height 11533 }; 11534 }, 11535 11536 _applyChanges: function () { 11537 var props = {}; 11538 11539 if (this.position.top !== this.prevPosition.top) { 11540 props.top = this.position.top + "px"; 11541 } 11542 if (this.position.left !== this.prevPosition.left) { 11543 props.left = this.position.left + "px"; 11544 } 11545 if (this.size.width !== this.prevSize.width) { 11546 props.width = this.size.width + "px"; 11547 } 11548 if (this.size.height !== this.prevSize.height) { 11549 props.height = this.size.height + "px"; 11550 } 11551 11552 this.helper.css(props); 11553 11554 return props; 11555 }, 11556 11557 _updateVirtualBoundaries: function (forceAspectRatio) { 11558 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 11559 o = this.options; 11560 11561 b = { 11562 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 11563 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 11564 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 11565 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 11566 }; 11567 11568 if (this._aspectRatio || forceAspectRatio) { 11569 pMinWidth = b.minHeight * this.aspectRatio; 11570 pMinHeight = b.minWidth / this.aspectRatio; 11571 pMaxWidth = b.maxHeight * this.aspectRatio; 11572 pMaxHeight = b.maxWidth / this.aspectRatio; 11573 11574 if (pMinWidth > b.minWidth) { 11575 b.minWidth = pMinWidth; 11576 } 11577 if (pMinHeight > b.minHeight) { 11578 b.minHeight = pMinHeight; 11579 } 11580 if (pMaxWidth < b.maxWidth) { 11581 b.maxWidth = pMaxWidth; 11582 } 11583 if (pMaxHeight < b.maxHeight) { 11584 b.maxHeight = pMaxHeight; 11585 } 11586 } 11587 this._vBoundaries = b; 11588 }, 11589 11590 _updateCache: function (data) { 11591 this.offset = this.helper.offset(); 11592 if (this._isNumber(data.left)) { 11593 this.position.left = data.left; 11594 } 11595 if (this._isNumber(data.top)) { 11596 this.position.top = data.top; 11597 } 11598 if (this._isNumber(data.height)) { 11599 this.size.height = data.height; 11600 } 11601 if (this._isNumber(data.width)) { 11602 this.size.width = data.width; 11603 } 11604 }, 11605 11606 _updateRatio: function (data) { 11607 11608 var cpos = this.position, 11609 csize = this.size, 11610 a = this.axis; 11611 11612 if (this._isNumber(data.height)) { 11613 data.width = (data.height * this.aspectRatio); 11614 } else if (this._isNumber(data.width)) { 11615 data.height = (data.width / this.aspectRatio); 11616 } 11617 11618 if (a === "sw") { 11619 data.left = cpos.left + (csize.width - data.width); 11620 data.top = null; 11621 } 11622 if (a === "nw") { 11623 data.top = cpos.top + (csize.height - data.height); 11624 data.left = cpos.left + (csize.width - data.width); 11625 } 11626 11627 return data; 11628 }, 11629 11630 _respectSize: function (data) { 11631 11632 var o = this._vBoundaries, 11633 a = this.axis, 11634 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 11635 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 11636 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 11637 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 11638 dw = this.originalPosition.left + this.originalSize.width, 11639 dh = this.originalPosition.top + this.originalSize.height, 11640 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 11641 if (isminw) { 11642 data.width = o.minWidth; 11643 } 11644 if (isminh) { 11645 data.height = o.minHeight; 11646 } 11647 if (ismaxw) { 11648 data.width = o.maxWidth; 11649 } 11650 if (ismaxh) { 11651 data.height = o.maxHeight; 11652 } 11653 11654 if (isminw && cw) { 11655 data.left = dw - o.minWidth; 11656 } 11657 if (ismaxw && cw) { 11658 data.left = dw - o.maxWidth; 11659 } 11660 if (isminh && ch) { 11661 data.top = dh - o.minHeight; 11662 } 11663 if (ismaxh && ch) { 11664 data.top = dh - o.maxHeight; 11665 } 11666 11667 // Fixing jump error on top/left - bug #2330 11668 if (!data.width && !data.height && !data.left && data.top) { 11669 data.top = null; 11670 } else if (!data.width && !data.height && !data.top && data.left) { 11671 data.left = null; 11672 } 11673 11674 return data; 11675 }, 11676 11677 _getPaddingPlusBorderDimensions: function (element) { 11678 var i = 0, 11679 widths = [], 11680 borders = [ 11681 element.css("borderTopWidth"), 11682 element.css("borderRightWidth"), 11683 element.css("borderBottomWidth"), 11684 element.css("borderLeftWidth") 11685 ], 11686 paddings = [ 11687 element.css("paddingTop"), 11688 element.css("paddingRight"), 11689 element.css("paddingBottom"), 11690 element.css("paddingLeft") 11691 ]; 11692 11693 for (; i < 4; i++) { 11694 widths[i] = (parseFloat(borders[i]) || 0); 11695 widths[i] += (parseFloat(paddings[i]) || 0); 11696 } 11697 11698 return { 11699 height: widths[0] + widths[2], 11700 width: widths[1] + widths[3] 11701 }; 11702 }, 11703 11704 _proportionallyResize: function () { 11705 11706 if (!this._proportionallyResizeElements.length) { 11707 return; 11708 } 11709 11710 var prel, 11711 i = 0, 11712 element = this.helper || this.element; 11713 11714 for (; i < this._proportionallyResizeElements.length; i++) { 11715 11716 prel = this._proportionallyResizeElements[i]; 11717 11718 // TODO: Seems like a bug to cache this.outerDimensions 11719 // considering that we are in a loop. 11720 if (!this.outerDimensions) { 11721 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 11722 } 11723 11724 prel.css({ 11725 height: (element.height() - this.outerDimensions.height) || 0, 11726 width: (element.width() - this.outerDimensions.width) || 0 11727 }); 11728 11729 } 11730 11731 }, 11732 11733 _renderProxy: function () { 11734 11735 var el = this.element, o = this.options; 11736 this.elementOffset = el.offset(); 11737 11738 if (this._helper) { 11739 11740 this.helper = this.helper || $("<div></div>").css({ overflow: "hidden" }); 11741 11742 this._addClass(this.helper, this._helper); 11743 this.helper.css({ 11744 width: this.element.outerWidth(), 11745 height: this.element.outerHeight(), 11746 position: "absolute", 11747 left: this.elementOffset.left + "px", 11748 top: this.elementOffset.top + "px", 11749 zIndex: ++o.zIndex //TODO: Don't modify option 11750 }); 11751 11752 this.helper 11753 .appendTo("body") 11754 .disableSelection(); 11755 11756 } else { 11757 this.helper = this.element; 11758 } 11759 11760 }, 11761 11762 _change: { 11763 e: function (event, dx) { 11764 return { width: this.originalSize.width + dx }; 11765 }, 11766 w: function (event, dx) { 11767 var cs = this.originalSize, sp = this.originalPosition; 11768 return { left: sp.left + dx, width: cs.width - dx }; 11769 }, 11770 n: function (event, dx, dy) { 11771 var cs = this.originalSize, sp = this.originalPosition; 11772 return { top: sp.top + dy, height: cs.height - dy }; 11773 }, 11774 s: function (event, dx, dy) { 11775 return { height: this.originalSize.height + dy }; 11776 }, 11777 se: function (event, dx, dy) { 11778 return $.extend(this._change.s.apply(this, arguments), 11779 this._change.e.apply(this, [event, dx, dy])); 11780 }, 11781 sw: function (event, dx, dy) { 11782 return $.extend(this._change.s.apply(this, arguments), 11783 this._change.w.apply(this, [event, dx, dy])); 11784 }, 11785 ne: function (event, dx, dy) { 11786 return $.extend(this._change.n.apply(this, arguments), 11787 this._change.e.apply(this, [event, dx, dy])); 11788 }, 11789 nw: function (event, dx, dy) { 11790 return $.extend(this._change.n.apply(this, arguments), 11791 this._change.w.apply(this, [event, dx, dy])); 11792 } 11793 }, 11794 11795 _propagate: function (n, event) { 11796 $.ui.plugin.call(this, n, [event, this.ui()]); 11797 if (n !== "resize") { 11798 this._trigger(n, event, this.ui()); 11799 } 11800 }, 11801 11802 plugins: {}, 11803 11804 ui: function () { 11805 return { 11806 originalElement: this.originalElement, 11807 element: this.element, 11808 helper: this.helper, 11809 position: this.position, 11810 size: this.size, 11811 originalSize: this.originalSize, 11812 originalPosition: this.originalPosition 11813 }; 11814 } 11815 11816 }); 11817 11818 /* 11819 * Resizable Extensions 11820 */ 11821 11822 $.ui.plugin.add("resizable", "animate", { 11823 11824 stop: function (event) { 11825 var that = $(this).resizable("instance"), 11826 o = that.options, 11827 pr = that._proportionallyResizeElements, 11828 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 11829 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 11830 soffsetw = ista ? 0 : that.sizeDiff.width, 11831 style = { 11832 width: (that.size.width - soffsetw), 11833 height: (that.size.height - soffseth) 11834 }, 11835 left = (parseFloat(that.element.css("left")) + 11836 (that.position.left - that.originalPosition.left)) || null, 11837 top = (parseFloat(that.element.css("top")) + 11838 (that.position.top - that.originalPosition.top)) || null; 11839 11840 that.element.animate( 11841 $.extend(style, top && left ? { top: top, left: left } : {}), { 11842 duration: o.animateDuration, 11843 easing: o.animateEasing, 11844 step: function () { 11845 11846 var data = { 11847 width: parseFloat(that.element.css("width")), 11848 height: parseFloat(that.element.css("height")), 11849 top: parseFloat(that.element.css("top")), 11850 left: parseFloat(that.element.css("left")) 11851 }; 11852 11853 if (pr && pr.length) { 11854 $(pr[0]).css({ width: data.width, height: data.height }); 11855 } 11856 11857 // Propagating resize, and updating values for each animation step 11858 that._updateCache(data); 11859 that._propagate("resize", event); 11860 11861 } 11862 } 11863 ); 11864 } 11865 11866 }); 11867 11868 $.ui.plugin.add("resizable", "containment", { 11869 11870 start: function () { 11871 var element, p, co, ch, cw, width, height, 11872 that = $(this).resizable("instance"), 11873 o = that.options, 11874 el = that.element, 11875 oc = o.containment, 11876 ce = (oc instanceof $) ? 11877 oc.get(0) : 11878 (/parent/.test(oc)) ? el.parent().get(0) : oc; 11879 11880 if (!ce) { 11881 return; 11882 } 11883 11884 that.containerElement = $(ce); 11885 11886 if (/document/.test(oc) || oc === document) { 11887 that.containerOffset = { 11888 left: 0, 11889 top: 0 11890 }; 11891 that.containerPosition = { 11892 left: 0, 11893 top: 0 11894 }; 11895 11896 that.parentData = { 11897 element: $(document), 11898 left: 0, 11899 top: 0, 11900 width: $(document).width(), 11901 height: $(document).height() || document.body.parentNode.scrollHeight 11902 }; 11903 } else { 11904 element = $(ce); 11905 p = []; 11906 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 11907 p[i] = that._num(element.css("padding" + name)); 11908 }); 11909 11910 that.containerOffset = element.offset(); 11911 that.containerPosition = element.position(); 11912 that.containerSize = {
vendor: 4,591 bytes, lines 11913-12032
11913 height: (element.innerHeight() - p[3]), 11914 width: (element.innerWidth() - p[1]) 11915 }; 11916 11917 co = that.containerOffset; 11918 ch = that.containerSize.height; 11919 cw = that.containerSize.width; 11920 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 11921 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 11922 11923 that.parentData = { 11924 element: ce, 11925 left: co.left, 11926 top: co.top, 11927 width: width, 11928 height: height 11929 }; 11930 } 11931 }, 11932 11933 resize: function (event) { 11934 var woset, hoset, isParent, isOffsetRelative, 11935 that = $(this).resizable("instance"), 11936 o = that.options, 11937 co = that.containerOffset, 11938 cp = that.position, 11939 pRatio = that._aspectRatio || event.shiftKey, 11940 cop = { 11941 top: 0, 11942 left: 0 11943 }, 11944 ce = that.containerElement, 11945 continueResize = true; 11946 11947 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 11948 cop = co; 11949 } 11950 11951 if (cp.left < (that._helper ? co.left : 0)) { 11952 that.size.width = that.size.width + 11953 (that._helper ? 11954 (that.position.left - co.left) : 11955 (that.position.left - cop.left)); 11956 11957 if (pRatio) { 11958 that.size.height = that.size.width / that.aspectRatio; 11959 continueResize = false; 11960 } 11961 that.position.left = o.helper ? co.left : 0; 11962 } 11963 11964 if (cp.top < (that._helper ? co.top : 0)) { 11965 that.size.height = that.size.height + 11966 (that._helper ? 11967 (that.position.top - co.top) : 11968 that.position.top); 11969 11970 if (pRatio) { 11971 that.size.width = that.size.height * that.aspectRatio; 11972 continueResize = false; 11973 } 11974 that.position.top = that._helper ? co.top : 0; 11975 } 11976 11977 isParent = that.containerElement.get(0) === that.element.parent().get(0); 11978 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 11979 11980 if (isParent && isOffsetRelative) { 11981 that.offset.left = that.parentData.left + that.position.left; 11982 that.offset.top = that.parentData.top + that.position.top; 11983 } else { 11984 that.offset.left = that.element.offset().left; 11985 that.offset.top = that.element.offset().top; 11986 } 11987 11988 woset = Math.abs(that.sizeDiff.width + 11989 (that._helper ? 11990 that.offset.left - cop.left : 11991 (that.offset.left - co.left))); 11992 11993 hoset = Math.abs(that.sizeDiff.height + 11994 (that._helper ? 11995 that.offset.top - cop.top : 11996 (that.offset.top - co.top))); 11997 11998 if (woset + that.size.width >= that.parentData.width) { 11999 that.size.width = that.parentData.width - woset; 12000 if (pRatio) { 12001 that.size.height = that.size.width / that.aspectRatio; 12002 continueResize = false; 12003 } 12004 } 12005 12006 if (hoset + that.size.height >= that.parentData.height) { 12007 that.size.height = that.parentData.height - hoset; 12008 if (pRatio) { 12009 that.size.width = that.size.height * that.aspectRatio; 12010 continueResize = false; 12011 } 12012 } 12013 12014 if (!continueResize) { 12015 that.position.left = that.prevPosition.left; 12016 that.position.top = that.prevPosition.top; 12017 that.size.width = that.prevSize.width; 12018 that.size.height = that.prevSize.height; 12019 } 12020 }, 12021 12022 stop: function () { 12023 var that = $(this).resizable("instance"), 12024 o = that.options, 12025 co = that.containerOffset, 12026 cop = that.containerPosition, 12027 ce = that.containerElement, 12028 helper = $(that.helper), 12029 ho = helper.offset(), 12030 w = helper.outerWidth() - that.sizeDiff.width, 12031 h = helper.outerHeight() - that.sizeDiff.height; 12032
vendor: 4,161 bytes, lines 12033-12162
12033 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 12034 $(this).css({ 12035 left: ho.left - cop.left - co.left, 12036 width: w, 12037 height: h 12038 }); 12039 } 12040 12041 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 12042 $(this).css({ 12043 left: ho.left - cop.left - co.left, 12044 width: w, 12045 height: h 12046 }); 12047 } 12048 } 12049 }); 12050 12051 $.ui.plugin.add("resizable", "alsoResize", { 12052 12053 start: function () { 12054 var that = $(this).resizable("instance"), 12055 o = that.options; 12056 12057 $(o.alsoResize).each(function () { 12058 var el = $(this); 12059 el.data("ui-resizable-alsoresize", { 12060 width: parseFloat(el.width()), height: parseFloat(el.height()), 12061 left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) 12062 }); 12063 }); 12064 }, 12065 12066 resize: function (event, ui) { 12067 var that = $(this).resizable("instance"), 12068 o = that.options, 12069 os = that.originalSize, 12070 op = that.originalPosition, 12071 delta = { 12072 height: (that.size.height - os.height) || 0, 12073 width: (that.size.width - os.width) || 0, 12074 top: (that.position.top - op.top) || 0, 12075 left: (that.position.left - op.left) || 0 12076 }; 12077 12078 $(o.alsoResize).each(function () { 12079 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 12080 css = el.parents(ui.originalElement[0]).length ? 12081 ["width", "height"] : 12082 ["width", "height", "top", "left"]; 12083 12084 $.each(css, function (i, prop) { 12085 var sum = (start[prop] || 0) + (delta[prop] || 0); 12086 if (sum && sum >= 0) { 12087 style[prop] = sum || null; 12088 } 12089 }); 12090 12091 el.css(style); 12092 }); 12093 }, 12094 12095 stop: function () { 12096 $(this).removeData("ui-resizable-alsoresize"); 12097 } 12098 }); 12099 12100 $.ui.plugin.add("resizable", "ghost", { 12101 12102 start: function () { 12103 12104 var that = $(this).resizable("instance"), cs = that.size; 12105 12106 that.ghost = that.originalElement.clone(); 12107 that.ghost.css({ 12108 opacity: 0.25, 12109 display: "block", 12110 position: "relative", 12111 height: cs.height, 12112 width: cs.width, 12113 margin: 0, 12114 left: 0, 12115 top: 0 12116 }); 12117 12118 that._addClass(that.ghost, "ui-resizable-ghost"); 12119 12120 // DEPRECATED 12121 // TODO: remove after 1.12 12122 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 12123 12124 // Ghost option 12125 that.ghost.addClass(this.options.ghost); 12126 } 12127 12128 that.ghost.appendTo(that.helper); 12129 12130 }, 12131 12132 resize: function () { 12133 var that = $(this).resizable("instance"); 12134 if (that.ghost) { 12135 that.ghost.css({ 12136 position: "relative", 12137 height: that.size.height, 12138 width: that.size.width 12139 }); 12140 } 12141 }, 12142 12143 stop: function () { 12144 var that = $(this).resizable("instance"); 12145 if (that.ghost && that.helper) { 12146 that.helper.get(0).removeChild(that.ghost.get(0)); 12147 } 12148 } 12149 12150 }); 12151 12152 $.ui.plugin.add("resizable", "grid", { 12153 12154 resize: function () { 12155 var outerDimensions, 12156 that = $(this).resizable("instance"), 12157 o = that.options, 12158 cs = that.size, 12159 os = that.originalSize, 12160 op = that.originalPosition, 12161 a = that.axis, 12162 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
vendor: 7,062 bytes, lines 12163-12387
12163 gridX = (grid[0] || 1), 12164 gridY = (grid[1] || 1), 12165 ox = Math.round((cs.width - os.width) / gridX) * gridX, 12166 oy = Math.round((cs.height - os.height) / gridY) * gridY, 12167 newWidth = os.width + ox, 12168 newHeight = os.height + oy, 12169 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 12170 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 12171 isMinWidth = o.minWidth && (o.minWidth > newWidth), 12172 isMinHeight = o.minHeight && (o.minHeight > newHeight); 12173 12174 o.grid = grid; 12175 12176 if (isMinWidth) { 12177 newWidth += gridX; 12178 } 12179 if (isMinHeight) { 12180 newHeight += gridY; 12181 } 12182 if (isMaxWidth) { 12183 newWidth -= gridX; 12184 } 12185 if (isMaxHeight) { 12186 newHeight -= gridY; 12187 } 12188 12189 if (/^(se|s|e)$/.test(a)) { 12190 that.size.width = newWidth; 12191 that.size.height = newHeight; 12192 } else if (/^(ne)$/.test(a)) { 12193 that.size.width = newWidth; 12194 that.size.height = newHeight; 12195 that.position.top = op.top - oy; 12196 } else if (/^(sw)$/.test(a)) { 12197 that.size.width = newWidth; 12198 that.size.height = newHeight; 12199 that.position.left = op.left - ox; 12200 } else { 12201 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 12202 outerDimensions = that._getPaddingPlusBorderDimensions(this); 12203 } 12204 12205 if (newHeight - gridY > 0) { 12206 that.size.height = newHeight; 12207 that.position.top = op.top - oy; 12208 } else { 12209 newHeight = gridY - outerDimensions.height; 12210 that.size.height = newHeight; 12211 that.position.top = op.top + os.height - newHeight; 12212 } 12213 if (newWidth - gridX > 0) { 12214 that.size.width = newWidth; 12215 that.position.left = op.left - ox; 12216 } else { 12217 newWidth = gridX - outerDimensions.width; 12218 that.size.width = newWidth; 12219 that.position.left = op.left + os.width - newWidth; 12220 } 12221 } 12222 } 12223 12224 }); 12225 12226 var widgetsResizable = $.ui.resizable; 12227 12228 12229 /*! 12230 * jQuery UI Dialog 1.13.2 12231 * http://jqueryui.com 12232 * 12233 * Copyright jQuery Foundation and other contributors 12234 * Released under the MIT license. 12235 * http://jquery.org/license 12236 */ 12237 12238 //>>label: Dialog 12239 //>>group: Widgets 12240 //>>description: Displays customizable dialog windows. 12241 //>>docs: http://api.jqueryui.com/dialog/ 12242 //>>demos: http://jqueryui.com/dialog/ 12243 //>>css.structure: ../../themes/base/core.css 12244 //>>css.structure: ../../themes/base/dialog.css 12245 //>>css.theme: ../../themes/base/theme.css 12246 12247 12248 $.widget("ui.dialog", { 12249 version: "1.13.2", 12250 options: { 12251 appendTo: "body", 12252 autoOpen: true, 12253 buttons: [], 12254 classes: { 12255 "ui-dialog": "ui-corner-all", 12256 "ui-dialog-titlebar": "ui-corner-all" 12257 }, 12258 closeOnEscape: true, 12259 closeText: "Close", 12260 draggable: true, 12261 hide: null, 12262 height: "auto", 12263 maxHeight: null, 12264 maxWidth: null, 12265 minHeight: 150, 12266 minWidth: 150, 12267 modal: false, 12268 position: { 12269 my: "center", 12270 at: "center", 12271 of: window, 12272 collision: "fit", 12273 12274 // Ensure the titlebar is always visible 12275 using: function (pos) { 12276 var topOffset = $(this).css(pos).offset().top; 12277 if (topOffset < 0) { 12278 $(this).css("top", pos.top - topOffset); 12279 } 12280 } 12281 }, 12282 resizable: true, 12283 show: null, 12284 title: null, 12285 width: 300, 12286 12287 // Callbacks 12288 beforeClose: null, 12289 close: null, 12290 drag: null, 12291 dragStart: null, 12292 dragStop: null, 12293 focus: null, 12294 open: null, 12295 resize: null, 12296 resizeStart: null, 12297 resizeStop: null 12298 }, 12299 12300 sizeRelatedOptions: { 12301 buttons: true, 12302 height: true, 12303 maxHeight: true, 12304 maxWidth: true, 12305 minHeight: true, 12306 minWidth: true, 12307 width: true 12308 }, 12309 12310 resizableRelatedOptions: { 12311 maxHeight: true, 12312 maxWidth: true, 12313 minHeight: true, 12314 minWidth: true 12315 }, 12316 12317 _create: function () { 12318 this.originalCss = { 12319 display: this.element[0].style.display, 12320 width: this.element[0].style.width, 12321 minHeight: this.element[0].style.minHeight, 12322 maxHeight: this.element[0].style.maxHeight, 12323 height: this.element[0].style.height 12324 }; 12325 this.originalPosition = { 12326 parent: this.element.parent(), 12327 index: this.element.parent().children().index(this.element) 12328 }; 12329 this.originalTitle = this.element.attr("title"); 12330 if (this.options.title == null && this.originalTitle != null) { 12331 this.options.title = this.originalTitle; 12332 } 12333 12334 // Dialogs can't be disabled 12335 if (this.options.disabled) { 12336 this.options.disabled = false; 12337 } 12338 12339 this._createWrapper(); 12340 12341 this.element 12342 .show() 12343 .removeAttr("title") 12344 .appendTo(this.uiDialog); 12345 12346 this._addClass("ui-dialog-content", "ui-widget-content"); 12347 12348 this._createTitlebar(); 12349 this._createButtonPane(); 12350 12351 if (this.options.draggable && $.fn.draggable) { 12352 this._makeDraggable(); 12353 } 12354 if (this.options.resizable && $.fn.resizable) { 12355 this._makeResizable(); 12356 } 12357 12358 this._isOpen = false; 12359 12360 this._trackFocus(); 12361 }, 12362 12363 _init: function () { 12364 if (this.options.autoOpen) { 12365 this.open(); 12366 } 12367 }, 12368 12369 _appendTo: function () { 12370 var element = this.options.appendTo; 12371 if (element && (element.jquery || element.nodeType)) { 12372 return $(element); 12373 } 12374 return this.document.find(element || "body").eq(0); 12375 }, 12376 12377 _destroy: function () { 12378 var next, 12379 originalPosition = this.originalPosition; 12380 12381 this._untrackInstance(); 12382 this._destroyOverlay(); 12383 12384 this.element 12385 .removeUniqueId() 12386 .css(this.originalCss) 12387
vendor: 27,795 bytes, lines 12388-13175
12388 // Without detaching first, the following becomes really slow 12389 .detach(); 12390 12391 this.uiDialog.remove(); 12392 12393 if (this.originalTitle) { 12394 this.element.attr("title", this.originalTitle); 12395 } 12396 12397 next = originalPosition.parent.children().eq(originalPosition.index); 12398 12399 // Don't try to place the dialog next to itself (#8613) 12400 if (next.length && next[0] !== this.element[0]) { 12401 next.before(this.element); 12402 } else { 12403 originalPosition.parent.append(this.element); 12404 } 12405 }, 12406 12407 widget: function () { 12408 return this.uiDialog; 12409 }, 12410 12411 disable: $.noop, 12412 enable: $.noop, 12413 12414 close: function (event) { 12415 var that = this; 12416 12417 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 12418 return; 12419 } 12420 12421 this._isOpen = false; 12422 this._focusedElement = null; 12423 this._destroyOverlay(); 12424 this._untrackInstance(); 12425 12426 if (!this.opener.filter(":focusable").trigger("focus").length) { 12427 12428 // Hiding a focused element doesn't trigger blur in WebKit 12429 // so in case we have nothing to focus on, explicitly blur the active element 12430 // https://bugs.webkit.org/show_bug.cgi?id=47182 12431 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 12432 } 12433 12434 this._hide(this.uiDialog, this.options.hide, function () { 12435 that._trigger("close", event); 12436 }); 12437 }, 12438 12439 isOpen: function () { 12440 return this._isOpen; 12441 }, 12442 12443 moveToTop: function () { 12444 this._moveToTop(); 12445 }, 12446 12447 _moveToTop: function (event, silent) { 12448 var moved = false, 12449 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 12450 return +$(this).css("z-index"); 12451 }).get(), 12452 zIndexMax = Math.max.apply(null, zIndices); 12453 12454 if (zIndexMax >= +this.uiDialog.css("z-index")) { 12455 this.uiDialog.css("z-index", zIndexMax + 1); 12456 moved = true; 12457 } 12458 12459 if (moved && !silent) { 12460 this._trigger("focus", event); 12461 } 12462 return moved; 12463 }, 12464 12465 open: function () { 12466 var that = this; 12467 if (this._isOpen) { 12468 if (this._moveToTop()) { 12469 this._focusTabbable(); 12470 } 12471 return; 12472 } 12473 12474 this._isOpen = true; 12475 this.opener = $($.ui.safeActiveElement(this.document[0])); 12476 12477 this._size(); 12478 this._position(); 12479 this._createOverlay(); 12480 this._moveToTop(null, true); 12481 12482 // Ensure the overlay is moved to the top with the dialog, but only when 12483 // opening. The overlay shouldn't move after the dialog is open so that 12484 // modeless dialogs opened after the modal dialog stack properly. 12485 if (this.overlay) { 12486 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 12487 } 12488 12489 this._show(this.uiDialog, this.options.show, function () { 12490 that._focusTabbable(); 12491 that._trigger("focus"); 12492 }); 12493 12494 // Track the dialog immediately upon opening in case a focus event 12495 // somehow occurs outside of the dialog before an element inside the 12496 // dialog is focused (#10152) 12497 this._makeFocusTarget(); 12498 12499 this._trigger("open"); 12500 }, 12501 12502 _focusTabbable: function () { 12503 12504 // Set focus to the first match: 12505 // 1. An element that was focused previously 12506 // 2. First element inside the dialog matching [autofocus] 12507 // 3. Tabbable element inside the content element 12508 // 4. Tabbable element inside the buttonpane 12509 // 5. The close button 12510 // 6. The dialog itself 12511 var hasFocus = this._focusedElement; 12512 if (!hasFocus) { 12513 hasFocus = this.element.find("[autofocus]"); 12514 } 12515 if (!hasFocus.length) { 12516 hasFocus = this.element.find(":tabbable"); 12517 } 12518 if (!hasFocus.length) { 12519 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 12520 } 12521 if (!hasFocus.length) { 12522 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 12523 } 12524 if (!hasFocus.length) { 12525 hasFocus = this.uiDialog; 12526 } 12527 hasFocus.eq(0).trigger("focus"); 12528 }, 12529 12530 _restoreTabbableFocus: function () { 12531 var activeElement = $.ui.safeActiveElement(this.document[0]), 12532 isActive = this.uiDialog[0] === activeElement || 12533 $.contains(this.uiDialog[0], activeElement); 12534 if (!isActive) { 12535 this._focusTabbable(); 12536 } 12537 }, 12538 12539 _keepFocus: function (event) { 12540 event.preventDefault(); 12541 this._restoreTabbableFocus(); 12542 12543 // support: IE 12544 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12545 // so we check again later 12546 this._delay(this._restoreTabbableFocus); 12547 }, 12548 12549 _createWrapper: function () { 12550 this.uiDialog = $("<div>") 12551 .hide() 12552 .attr({ 12553 12554 // Setting tabIndex makes the div focusable 12555 tabIndex: -1, 12556 role: "dialog" 12557 }) 12558 .appendTo(this._appendTo()); 12559 12560 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 12561 this._on(this.uiDialog, { 12562 keydown: function (event) { 12563 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12564 event.keyCode === $.ui.keyCode.ESCAPE) { 12565 event.preventDefault(); 12566 this.close(event); 12567 return; 12568 } 12569 12570 // Prevent tabbing out of dialogs 12571 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 12572 return; 12573 } 12574 var tabbables = this.uiDialog.find(":tabbable"), 12575 first = tabbables.first(), 12576 last = tabbables.last(); 12577 12578 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 12579 !event.shiftKey) { 12580 this._delay(function () { 12581 first.trigger("focus"); 12582 }); 12583 event.preventDefault(); 12584 } else if ((event.target === first[0] || 12585 event.target === this.uiDialog[0]) && event.shiftKey) { 12586 this._delay(function () { 12587 last.trigger("focus"); 12588 }); 12589 event.preventDefault(); 12590 } 12591 }, 12592 mousedown: function (event) { 12593 if (this._moveToTop(event)) { 12594 this._focusTabbable(); 12595 } 12596 } 12597 }); 12598 12599 // We assume that any existing aria-describedby attribute means 12600 // that the dialog content is marked up properly 12601 // otherwise we brute force the content as the description 12602 if (!this.element.find("[aria-describedby]").length) { 12603 this.uiDialog.attr({ 12604 "aria-describedby": this.element.uniqueId().attr("id") 12605 }); 12606 } 12607 }, 12608 12609 _createTitlebar: function () { 12610 var uiDialogTitle; 12611 12612 this.uiDialogTitlebar = $("<div>"); 12613 this._addClass(this.uiDialogTitlebar, 12614 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 12615 this._on(this.uiDialogTitlebar, { 12616 mousedown: function (event) { 12617 12618 // Don't prevent click on close button (#8838) 12619 // Focusing a dialog that is partially scrolled out of view 12620 // causes the browser to scroll it into view, preventing the click event 12621 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 12622 12623 // Dialog isn't getting focus when dragging (#8063) 12624 this.uiDialog.trigger("focus"); 12625 } 12626 } 12627 }); 12628 12629 // Support: IE 12630 // Use type="button" to prevent enter keypresses in textboxes from closing the 12631 // dialog in IE (#9312) 12632 this.uiDialogTitlebarClose = $("<button type='button'></button>") 12633 .button({ 12634 label: $("<a>").text(this.options.closeText).html(), 12635 icon: "ui-icon-closethick", 12636 showLabel: false 12637 }) 12638 .appendTo(this.uiDialogTitlebar); 12639 12640 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 12641 this._on(this.uiDialogTitlebarClose, { 12642 click: function (event) { 12643 event.preventDefault(); 12644 this.close(event); 12645 } 12646 }); 12647 12648 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 12649 this._addClass(uiDialogTitle, "ui-dialog-title"); 12650 this._title(uiDialogTitle); 12651 12652 this.uiDialogTitlebar.prependTo(this.uiDialog); 12653 12654 this.uiDialog.attr({ 12655 "aria-labelledby": uiDialogTitle.attr("id") 12656 }); 12657 }, 12658 12659 _title: function (title) { 12660 if (this.options.title) { 12661 title.text(this.options.title); 12662 } else { 12663 title.html(" "); 12664 } 12665 }, 12666 12667 _createButtonPane: function () { 12668 this.uiDialogButtonPane = $("<div>"); 12669 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 12670 "ui-widget-content ui-helper-clearfix"); 12671 12672 this.uiButtonSet = $("<div>") 12673 .appendTo(this.uiDialogButtonPane); 12674 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 12675 12676 this._createButtons(); 12677 }, 12678 12679 _createButtons: function () { 12680 var that = this, 12681 buttons = this.options.buttons; 12682 12683 // If we already have a button pane, remove it 12684 this.uiDialogButtonPane.remove(); 12685 this.uiButtonSet.empty(); 12686 12687 if ($.isEmptyObject(buttons) || (Array.isArray(buttons) && !buttons.length)) { 12688 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 12689 return; 12690 } 12691 12692 $.each(buttons, function (name, props) { 12693 var click, buttonOptions; 12694 props = typeof props === "function" ? 12695 { click: props, text: name } : 12696 props; 12697 12698 // Default to a non-submitting button 12699 props = $.extend({ type: "button" }, props); 12700 12701 // Change the context for the click callback to be the main element 12702 click = props.click; 12703 buttonOptions = { 12704 icon: props.icon, 12705 iconPosition: props.iconPosition, 12706 showLabel: props.showLabel, 12707 12708 // Deprecated options 12709 icons: props.icons, 12710 text: props.text 12711 }; 12712 12713 delete props.click; 12714 delete props.icon; 12715 delete props.iconPosition; 12716 delete props.showLabel; 12717 12718 // Deprecated options 12719 delete props.icons; 12720 if (typeof props.text === "boolean") { 12721 delete props.text; 12722 } 12723 12724 $("<button></button>", props) 12725 .button(buttonOptions) 12726 .appendTo(that.uiButtonSet) 12727 .on("click", function () { 12728 click.apply(that.element[0], arguments); 12729 }); 12730 }); 12731 this._addClass(this.uiDialog, "ui-dialog-buttons"); 12732 this.uiDialogButtonPane.appendTo(this.uiDialog); 12733 }, 12734 12735 _makeDraggable: function () { 12736 var that = this, 12737 options = this.options; 12738 12739 function filteredUi(ui) { 12740 return { 12741 position: ui.position, 12742 offset: ui.offset 12743 }; 12744 } 12745 12746 this.uiDialog.draggable({ 12747 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12748 handle: ".ui-dialog-titlebar", 12749 containment: "document", 12750 start: function (event, ui) { 12751 that._addClass($(this), "ui-dialog-dragging"); 12752 that._blockFrames(); 12753 that._trigger("dragStart", event, filteredUi(ui)); 12754 }, 12755 drag: function (event, ui) { 12756 that._trigger("drag", event, filteredUi(ui)); 12757 }, 12758 stop: function (event, ui) { 12759 var left = ui.offset.left - that.document.scrollLeft(), 12760 top = ui.offset.top - that.document.scrollTop(); 12761 12762 options.position = { 12763 my: "left top", 12764 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12765 "top" + (top >= 0 ? "+" : "") + top, 12766 of: that.window 12767 }; 12768 that._removeClass($(this), "ui-dialog-dragging"); 12769 that._unblockFrames(); 12770 that._trigger("dragStop", event, filteredUi(ui)); 12771 } 12772 }); 12773 }, 12774 12775 _makeResizable: function () { 12776 var that = this, 12777 options = this.options, 12778 handles = options.resizable, 12779 12780 // .ui-resizable has position: relative defined in the stylesheet 12781 // but dialogs have to use absolute or fixed positioning 12782 position = this.uiDialog.css("position"), 12783 resizeHandles = typeof handles === "string" ? 12784 handles : 12785 "n,e,s,w,se,sw,ne,nw"; 12786 12787 function filteredUi(ui) { 12788 return { 12789 originalPosition: ui.originalPosition, 12790 originalSize: ui.originalSize, 12791 position: ui.position, 12792 size: ui.size 12793 }; 12794 } 12795 12796 this.uiDialog.resizable({ 12797 cancel: ".ui-dialog-content", 12798 containment: "document", 12799 alsoResize: this.element, 12800 maxWidth: options.maxWidth, 12801 maxHeight: options.maxHeight, 12802 minWidth: options.minWidth, 12803 minHeight: this._minHeight(), 12804 handles: resizeHandles, 12805 start: function (event, ui) { 12806 that._addClass($(this), "ui-dialog-resizing"); 12807 that._blockFrames(); 12808 that._trigger("resizeStart", event, filteredUi(ui)); 12809 }, 12810 resize: function (event, ui) { 12811 that._trigger("resize", event, filteredUi(ui)); 12812 }, 12813 stop: function (event, ui) { 12814 var offset = that.uiDialog.offset(), 12815 left = offset.left - that.document.scrollLeft(), 12816 top = offset.top - that.document.scrollTop(); 12817 12818 options.height = that.uiDialog.height(); 12819 options.width = that.uiDialog.width(); 12820 options.position = { 12821 my: "left top", 12822 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12823 "top" + (top >= 0 ? "+" : "") + top, 12824 of: that.window 12825 }; 12826 that._removeClass($(this), "ui-dialog-resizing"); 12827 that._unblockFrames(); 12828 that._trigger("resizeStop", event, filteredUi(ui)); 12829 } 12830 }) 12831 .css("position", position); 12832 }, 12833 12834 _trackFocus: function () { 12835 this._on(this.widget(), { 12836 focusin: function (event) { 12837 this._makeFocusTarget(); 12838 this._focusedElement = $(event.target); 12839 } 12840 }); 12841 }, 12842 12843 _makeFocusTarget: function () { 12844 this._untrackInstance(); 12845 this._trackingInstances().unshift(this); 12846 }, 12847 12848 _untrackInstance: function () { 12849 var instances = this._trackingInstances(), 12850 exists = $.inArray(this, instances); 12851 if (exists !== -1) { 12852 instances.splice(exists, 1); 12853 } 12854 }, 12855 12856 _trackingInstances: function () { 12857 var instances = this.document.data("ui-dialog-instances"); 12858 if (!instances) { 12859 instances = []; 12860 this.document.data("ui-dialog-instances", instances); 12861 } 12862 return instances; 12863 }, 12864 12865 _minHeight: function () { 12866 var options = this.options; 12867 12868 return options.height === "auto" ? 12869 options.minHeight : 12870 Math.min(options.minHeight, options.height); 12871 }, 12872 12873 _position: function () { 12874 12875 // Need to show the dialog to get the actual offset in the position plugin 12876 var isVisible = this.uiDialog.is(":visible"); 12877 if (!isVisible) { 12878 this.uiDialog.show(); 12879 } 12880 this.uiDialog.position(this.options.position); 12881 if (!isVisible) { 12882 this.uiDialog.hide(); 12883 } 12884 }, 12885 12886 _setOptions: function (options) { 12887 var that = this, 12888 resize = false, 12889 resizableOptions = {}; 12890 12891 $.each(options, function (key, value) { 12892 that._setOption(key, value); 12893 12894 if (key in that.sizeRelatedOptions) { 12895 resize = true; 12896 } 12897 if (key in that.resizableRelatedOptions) { 12898 resizableOptions[key] = value; 12899 } 12900 }); 12901 12902 if (resize) { 12903 this._size(); 12904 this._position(); 12905 } 12906 if (this.uiDialog.is(":data(ui-resizable)")) { 12907 this.uiDialog.resizable("option", resizableOptions); 12908 } 12909 }, 12910 12911 _setOption: function (key, value) { 12912 var isDraggable, isResizable, 12913 uiDialog = this.uiDialog; 12914 12915 if (key === "disabled") { 12916 return; 12917 } 12918 12919 this._super(key, value); 12920 12921 if (key === "appendTo") { 12922 this.uiDialog.appendTo(this._appendTo()); 12923 } 12924 12925 if (key === "buttons") { 12926 this._createButtons(); 12927 } 12928 12929 if (key === "closeText") { 12930 this.uiDialogTitlebarClose.button({ 12931 12932 // Ensure that we always pass a string 12933 label: $("<a>").text("" + this.options.closeText).html() 12934 }); 12935 } 12936 12937 if (key === "draggable") { 12938 isDraggable = uiDialog.is(":data(ui-draggable)"); 12939 if (isDraggable && !value) { 12940 uiDialog.draggable("destroy"); 12941 } 12942 12943 if (!isDraggable && value) { 12944 this._makeDraggable(); 12945 } 12946 } 12947 12948 if (key === "position") { 12949 this._position(); 12950 } 12951 12952 if (key === "resizable") { 12953 12954 // currently resizable, becoming non-resizable 12955 isResizable = uiDialog.is(":data(ui-resizable)"); 12956 if (isResizable && !value) { 12957 uiDialog.resizable("destroy"); 12958 } 12959 12960 // Currently resizable, changing handles 12961 if (isResizable && typeof value === "string") { 12962 uiDialog.resizable("option", "handles", value); 12963 } 12964 12965 // Currently non-resizable, becoming resizable 12966 if (!isResizable && value !== false) { 12967 this._makeResizable(); 12968 } 12969 } 12970 12971 if (key === "title") { 12972 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 12973 } 12974 }, 12975 12976 _size: function () { 12977 12978 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12979 // divs will both have width and height set, so we need to reset them 12980 var nonContentHeight, minContentHeight, maxContentHeight, 12981 options = this.options; 12982 12983 // Reset content sizing 12984 this.element.show().css({ 12985 width: "auto", 12986 minHeight: 0, 12987 maxHeight: "none", 12988 height: 0 12989 }); 12990 12991 if (options.minWidth > options.width) { 12992 options.width = options.minWidth; 12993 } 12994 12995 // Reset wrapper sizing 12996 // determine the height of all the non-content elements 12997 nonContentHeight = this.uiDialog.css({ 12998 height: "auto", 12999 width: options.width 13000 }) 13001 .outerHeight(); 13002 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 13003 maxContentHeight = typeof options.maxHeight === "number" ? 13004 Math.max(0, options.maxHeight - nonContentHeight) : 13005 "none"; 13006 13007 if (options.height === "auto") { 13008 this.element.css({ 13009 minHeight: minContentHeight, 13010 maxHeight: maxContentHeight, 13011 height: "auto" 13012 }); 13013 } else { 13014 this.element.height(Math.max(0, options.height - nonContentHeight)); 13015 } 13016 13017 if (this.uiDialog.is(":data(ui-resizable)")) { 13018 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 13019 } 13020 }, 13021 13022 _blockFrames: function () { 13023 this.iframeBlocks = this.document.find("iframe").map(function () { 13024 var iframe = $(this); 13025 13026 return $("<div>") 13027 .css({ 13028 position: "absolute", 13029 width: iframe.outerWidth(), 13030 height: iframe.outerHeight() 13031 }) 13032 .appendTo(iframe.parent()) 13033 .offset(iframe.offset())[0]; 13034 }); 13035 }, 13036 13037 _unblockFrames: function () { 13038 if (this.iframeBlocks) { 13039 this.iframeBlocks.remove(); 13040 delete this.iframeBlocks; 13041 } 13042 }, 13043 13044 _allowInteraction: function (event) { 13045 if ($(event.target).closest(".ui-dialog").length) { 13046 return true; 13047 } 13048 13049 // TODO: Remove hack when datepicker implements 13050 // the .ui-front logic (#8989) 13051 return !!$(event.target).closest(".ui-datepicker").length; 13052 }, 13053 13054 _createOverlay: function () { 13055 if (!this.options.modal) { 13056 return; 13057 } 13058 13059 var jqMinor = $.fn.jquery.substring(0, 4); 13060 13061 // We use a delay in case the overlay is created from an 13062 // event that we're going to be cancelling (#2804) 13063 var isOpening = true; 13064 this._delay(function () { 13065 isOpening = false; 13066 }); 13067 13068 if (!this.document.data("ui-dialog-overlays")) { 13069 13070 // Prevent use of anchors and inputs 13071 // This doesn't use `_on()` because it is a shared event handler 13072 // across all open modal dialogs. 13073 this.document.on("focusin.ui-dialog", function (event) { 13074 if (isOpening) { 13075 return; 13076 } 13077 13078 var instance = this._trackingInstances()[0]; 13079 if (!instance._allowInteraction(event)) { 13080 event.preventDefault(); 13081 instance._focusTabbable(); 13082 13083 // Support: jQuery >=3.4 <3.6 only 13084 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 13085 // have its focus event propagated last, breaking the re-targeting. 13086 // Trigger focus in a delay in addition if needed to avoid the issue 13087 // See https://github.com/jquery/jquery/issues/4382 13088 if (jqMinor === "3.4." || jqMinor === "3.5.") { 13089 instance._delay(instance._restoreTabbableFocus); 13090 } 13091 } 13092 }.bind(this)); 13093 } 13094 13095 this.overlay = $("<div>") 13096 .appendTo(this._appendTo()); 13097 13098 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 13099 this._on(this.overlay, { 13100 mousedown: "_keepFocus" 13101 }); 13102 this.document.data("ui-dialog-overlays", 13103 (this.document.data("ui-dialog-overlays") || 0) + 1); 13104 }, 13105 13106 _destroyOverlay: function () { 13107 if (!this.options.modal) { 13108 return; 13109 } 13110 13111 if (this.overlay) { 13112 var overlays = this.document.data("ui-dialog-overlays") - 1; 13113 13114 if (!overlays) { 13115 this.document.off("focusin.ui-dialog"); 13116 this.document.removeData("ui-dialog-overlays"); 13117 } else { 13118 this.document.data("ui-dialog-overlays", overlays); 13119 } 13120 13121 this.overlay.remove(); 13122 this.overlay = null; 13123 } 13124 } 13125 }); 13126 13127 // DEPRECATED 13128 // TODO: switch return back to widget declaration at top of file when this is removed 13129 if ($.uiBackCompat !== false) { 13130 13131 // Backcompat for dialogClass option 13132 $.widget("ui.dialog", $.ui.dialog, { 13133 options: { 13134 dialogClass: "" 13135 }, 13136 _createWrapper: function () { 13137 this._super(); 13138 this.uiDialog.addClass(this.options.dialogClass); 13139 }, 13140 _setOption: function (key, value) { 13141 if (key === "dialogClass") { 13142 this.uiDialog 13143 .removeClass(this.options.dialogClass) 13144 .addClass(value); 13145 } 13146 this._superApply(arguments); 13147 } 13148 }); 13149 } 13150 13151 var widgetsDialog = $.ui.dialog; 13152 13153 13154 /*! 13155 * jQuery UI Droppable 1.13.2 13156 * http://jqueryui.com 13157 * 13158 * Copyright jQuery Foundation and other contributors 13159 * Released under the MIT license. 13160 * http://jquery.org/license 13161 */ 13162 13163 //>>label: Droppable 13164 //>>group: Interactions 13165 //>>description: Enables drop targets for draggable elements. 13166 //>>docs: http://api.jqueryui.com/droppable/ 13167 //>>demos: http://jqueryui.com/droppable/ 13168 13169 13170 $.widget("ui.droppable", { 13171 version: "1.13.2", 13172 widgetEventPrefix: "drop", 13173 options: { 13174 accept: "*", 13175 addClasses: true,
vendor: 13,581 bytes, lines 13176-13561
13176 greedy: false, 13177 scope: "default", 13178 tolerance: "intersect", 13179 13180 // Callbacks 13181 activate: null, 13182 deactivate: null, 13183 drop: null, 13184 out: null, 13185 over: null 13186 }, 13187 _create: function () { 13188 13189 var proportions, 13190 o = this.options, 13191 accept = o.accept; 13192 13193 this.isover = false; 13194 this.isout = true; 13195 13196 this.accept = typeof accept === "function" ? accept : function (d) { 13197 return d.is(accept); 13198 }; 13199 13200 this.proportions = function ( /* valueToWrite */) { 13201 if (arguments.length) { 13202 13203 // Store the droppable's proportions 13204 proportions = arguments[0]; 13205 } else { 13206 13207 // Retrieve or derive the droppable's proportions 13208 return proportions ? 13209 proportions : 13210 proportions = { 13211 width: this.element[0].offsetWidth, 13212 height: this.element[0].offsetHeight 13213 }; 13214 } 13215 }; 13216 13217 this._addToManager(o.scope); 13218 13219 if (o.addClasses) { 13220 this._addClass("ui-droppable"); 13221 } 13222 13223 }, 13224 13225 _addToManager: function (scope) { 13226 13227 // Add the reference and positions to the manager 13228 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 13229 $.ui.ddmanager.droppables[scope].push(this); 13230 }, 13231 13232 _splice: function (drop) { 13233 var i = 0; 13234 for (; i < drop.length; i++) { 13235 if (drop[i] === this) { 13236 drop.splice(i, 1); 13237 } 13238 } 13239 }, 13240 13241 _destroy: function () { 13242 var drop = $.ui.ddmanager.droppables[this.options.scope]; 13243 13244 this._splice(drop); 13245 }, 13246 13247 _setOption: function (key, value) { 13248 13249 if (key === "accept") { 13250 this.accept = typeof value === "function" ? value : function (d) { 13251 return d.is(value); 13252 }; 13253 } else if (key === "scope") { 13254 var drop = $.ui.ddmanager.droppables[this.options.scope]; 13255 13256 this._splice(drop); 13257 this._addToManager(value); 13258 } 13259 13260 this._super(key, value); 13261 }, 13262 13263 _activate: function (event) { 13264 var draggable = $.ui.ddmanager.current; 13265 13266 this._addActiveClass(); 13267 if (draggable) { 13268 this._trigger("activate", event, this.ui(draggable)); 13269 } 13270 }, 13271 13272 _deactivate: function (event) { 13273 var draggable = $.ui.ddmanager.current; 13274 13275 this._removeActiveClass(); 13276 if (draggable) { 13277 this._trigger("deactivate", event, this.ui(draggable)); 13278 } 13279 }, 13280 13281 _over: function (event) { 13282 13283 var draggable = $.ui.ddmanager.current; 13284 13285 // Bail if draggable and droppable are same element 13286 if (!draggable || (draggable.currentItem || 13287 draggable.element)[0] === this.element[0]) { 13288 return; 13289 } 13290 13291 if (this.accept.call(this.element[0], (draggable.currentItem || 13292 draggable.element))) { 13293 this._addHoverClass(); 13294 this._trigger("over", event, this.ui(draggable)); 13295 } 13296 13297 }, 13298 13299 _out: function (event) { 13300 13301 var draggable = $.ui.ddmanager.current; 13302 13303 // Bail if draggable and droppable are same element 13304 if (!draggable || (draggable.currentItem || 13305 draggable.element)[0] === this.element[0]) { 13306 return; 13307 } 13308 13309 if (this.accept.call(this.element[0], (draggable.currentItem || 13310 draggable.element))) { 13311 this._removeHoverClass(); 13312 this._trigger("out", event, this.ui(draggable)); 13313 } 13314 13315 }, 13316 13317 _drop: function (event, custom) { 13318 13319 var draggable = custom || $.ui.ddmanager.current, 13320 childrenIntersection = false; 13321 13322 // Bail if draggable and droppable are same element 13323 if (!draggable || (draggable.currentItem || 13324 draggable.element)[0] === this.element[0]) { 13325 return false; 13326 } 13327 13328 this.element 13329 .find(":data(ui-droppable)") 13330 .not(".ui-draggable-dragging") 13331 .each(function () { 13332 var inst = $(this).droppable("instance"); 13333 if ( 13334 inst.options.greedy && 13335 !inst.options.disabled && 13336 inst.options.scope === draggable.options.scope && 13337 inst.accept.call( 13338 inst.element[0], (draggable.currentItem || draggable.element) 13339 ) && 13340 $.ui.intersect( 13341 draggable, 13342 $.extend(inst, { offset: inst.element.offset() }), 13343 inst.options.tolerance, event 13344 ) 13345 ) { 13346 childrenIntersection = true; 13347 return false; 13348 } 13349 }); 13350 if (childrenIntersection) { 13351 return false; 13352 } 13353 13354 if (this.accept.call(this.element[0], 13355 (draggable.currentItem || draggable.element))) { 13356 this._removeActiveClass(); 13357 this._removeHoverClass(); 13358 13359 this._trigger("drop", event, this.ui(draggable)); 13360 return this.element; 13361 } 13362 13363 return false; 13364 13365 }, 13366 13367 ui: function (c) { 13368 return { 13369 draggable: (c.currentItem || c.element), 13370 helper: c.helper, 13371 position: c.position, 13372 offset: c.positionAbs 13373 }; 13374 }, 13375 13376 // Extension points just to make backcompat sane and avoid duplicating logic 13377 // TODO: Remove in 1.14 along with call to it below 13378 _addHoverClass: function () { 13379 this._addClass("ui-droppable-hover"); 13380 }, 13381 13382 _removeHoverClass: function () { 13383 this._removeClass("ui-droppable-hover"); 13384 }, 13385 13386 _addActiveClass: function () { 13387 this._addClass("ui-droppable-active"); 13388 }, 13389 13390 _removeActiveClass: function () { 13391 this._removeClass("ui-droppable-active"); 13392 } 13393 }); 13394 13395 $.ui.intersect = (function () { 13396 function isOverAxis(x, reference, size) { 13397 return (x >= reference) && (x < (reference + size)); 13398 } 13399 13400 return function (draggable, droppable, toleranceMode, event) { 13401 13402 if (!droppable.offset) { 13403 return false; 13404 } 13405 13406 var x1 = (draggable.positionAbs || 13407 draggable.position.absolute).left + draggable.margins.left, 13408 y1 = (draggable.positionAbs || 13409 draggable.position.absolute).top + draggable.margins.top, 13410 x2 = x1 + draggable.helperProportions.width, 13411 y2 = y1 + draggable.helperProportions.height, 13412 l = droppable.offset.left, 13413 t = droppable.offset.top, 13414 r = l + droppable.proportions().width, 13415 b = t + droppable.proportions().height; 13416 13417 switch (toleranceMode) { 13418 case "fit": 13419 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 13420 case "intersect": 13421 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 13422 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 13423 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 13424 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 13425 case "pointer": 13426 return isOverAxis(event.pageY, t, droppable.proportions().height) && 13427 isOverAxis(event.pageX, l, droppable.proportions().width); 13428 case "touch": 13429 return ( 13430 (y1 >= t && y1 <= b) || // Top edge touching 13431 (y2 >= t && y2 <= b) || // Bottom edge touching 13432 (y1 < t && y2 > b) // Surrounded vertically 13433 ) && ( 13434 (x1 >= l && x1 <= r) || // Left edge touching 13435 (x2 >= l && x2 <= r) || // Right edge touching 13436 (x1 < l && x2 > r) // Surrounded horizontally 13437 ); 13438 default: 13439 return false; 13440 } 13441 }; 13442 })(); 13443 13444 /* 13445 This manager tracks offsets of draggables and droppables 13446 */ 13447 $.ui.ddmanager = { 13448 current: null, 13449 droppables: { "default": [] }, 13450 prepareOffsets: function (t, event) { 13451 13452 var i, j, 13453 m = $.ui.ddmanager.droppables[t.options.scope] || [], 13454 type = event ? event.type : null, // workaround for #2317 13455 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 13456 13457 droppablesLoop: for (i = 0; i < m.length; i++) { 13458 13459 // No disabled and non-accepted 13460 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 13461 (t.currentItem || t.element)))) { 13462 continue; 13463 } 13464 13465 // Filter out elements in the current dragged item 13466 for (j = 0; j < list.length; j++) { 13467 if (list[j] === m[i].element[0]) { 13468 m[i].proportions().height = 0; 13469 continue droppablesLoop; 13470 } 13471 } 13472 13473 m[i].visible = m[i].element.css("display") !== "none"; 13474 if (!m[i].visible) { 13475 continue; 13476 } 13477 13478 // Activate the droppable if used directly from draggables 13479 if (type === "mousedown") { 13480 m[i]._activate.call(m[i], event); 13481 } 13482 13483 m[i].offset = m[i].element.offset(); 13484 m[i].proportions({ 13485 width: m[i].element[0].offsetWidth, 13486 height: m[i].element[0].offsetHeight 13487 }); 13488 13489 } 13490 13491 }, 13492 drop: function (draggable, event) { 13493 13494 var dropped = false; 13495 13496 // Create a copy of the droppables in case the list changes during the drop (#9116) 13497 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 13498 13499 if (!this.options) { 13500 return; 13501 } 13502 if (!this.options.disabled && this.visible && 13503 $.ui.intersect(draggable, this, this.options.tolerance, event)) { 13504 dropped = this._drop.call(this, event) || dropped; 13505 } 13506 13507 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 13508 (draggable.currentItem || draggable.element))) { 13509 this.isout = true; 13510 this.isover = false; 13511 this._deactivate.call(this, event); 13512 } 13513 13514 }); 13515 return dropped; 13516 13517 }, 13518 dragStart: function (draggable, event) { 13519 13520 // Listen for scrolling so that if the dragging causes scrolling the position of the 13521 // droppables can be recalculated (see #5003) 13522 draggable.element.parentsUntil("body").on("scroll.droppable", function () { 13523 if (!draggable.options.refreshPositions) { 13524 $.ui.ddmanager.prepareOffsets(draggable, event); 13525 } 13526 }); 13527 }, 13528 drag: function (draggable, event) { 13529 13530 // If you have a highly dynamic page, you might try this option. It renders positions 13531 // every time you move the mouse. 13532 if (draggable.options.refreshPositions) { 13533 $.ui.ddmanager.prepareOffsets(draggable, event); 13534 } 13535 13536 // Run through all droppables and check their positions based on specific tolerance options 13537 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 13538 13539 if (this.options.disabled || this.greedyChild || !this.visible) { 13540 return; 13541 } 13542 13543 var parentInstance, scope, parent, 13544 intersects = $.ui.intersect(draggable, this, this.options.tolerance, event), 13545 c = !intersects && this.isover ? 13546 "isout" : 13547 (intersects && !this.isover ? "isover" : null); 13548 if (!c) { 13549 return; 13550 } 13551 13552 if (this.options.greedy) { 13553 13554 // find droppable parents with same scope 13555 scope = this.options.scope; 13556 parent = this.element.parents(":data(ui-droppable)").filter(function () { 13557 return $(this).droppable("instance").options.scope === scope; 13558 }); 13559 13560 if (parent.length) { 13561 parentInstance = $(parent[0]).droppable("instance");
vendor: 5,145 bytes, lines 13562-13716
13562 parentInstance.greedyChild = (c === "isover"); 13563 } 13564 } 13565 13566 // We just moved into a greedy child 13567 if (parentInstance && c === "isover") { 13568 parentInstance.isover = false; 13569 parentInstance.isout = true; 13570 parentInstance._out.call(parentInstance, event); 13571 } 13572 13573 this[c] = true; 13574 this[c === "isout" ? "isover" : "isout"] = false; 13575 this[c === "isover" ? "_over" : "_out"].call(this, event); 13576 13577 // We just moved out of a greedy child 13578 if (parentInstance && c === "isout") { 13579 parentInstance.isout = false; 13580 parentInstance.isover = true; 13581 parentInstance._over.call(parentInstance, event); 13582 } 13583 }); 13584 13585 }, 13586 dragStop: function (draggable, event) { 13587 draggable.element.parentsUntil("body").off("scroll.droppable"); 13588 13589 // Call prepareOffsets one final time since IE does not fire return scroll events when 13590 // overflow was caused by drag (see #5003) 13591 if (!draggable.options.refreshPositions) { 13592 $.ui.ddmanager.prepareOffsets(draggable, event); 13593 } 13594 } 13595 }; 13596 13597 // DEPRECATED 13598 // TODO: switch return back to widget declaration at top of file when this is removed 13599 if ($.uiBackCompat !== false) { 13600 13601 // Backcompat for activeClass and hoverClass options 13602 $.widget("ui.droppable", $.ui.droppable, { 13603 options: { 13604 hoverClass: false, 13605 activeClass: false 13606 }, 13607 _addActiveClass: function () { 13608 this._super(); 13609 if (this.options.activeClass) { 13610 this.element.addClass(this.options.activeClass); 13611 } 13612 }, 13613 _removeActiveClass: function () { 13614 this._super(); 13615 if (this.options.activeClass) { 13616 this.element.removeClass(this.options.activeClass); 13617 } 13618 }, 13619 _addHoverClass: function () { 13620 this._super(); 13621 if (this.options.hoverClass) { 13622 this.element.addClass(this.options.hoverClass); 13623 } 13624 }, 13625 _removeHoverClass: function () { 13626 this._super(); 13627 if (this.options.hoverClass) { 13628 this.element.removeClass(this.options.hoverClass); 13629 } 13630 } 13631 }); 13632 } 13633 13634 var widgetsDroppable = $.ui.droppable; 13635 13636 13637 /*! 13638 * jQuery UI Progressbar 1.13.2 13639 * http://jqueryui.com 13640 * 13641 * Copyright jQuery Foundation and other contributors 13642 * Released under the MIT license. 13643 * http://jquery.org/license 13644 */ 13645 13646 //>>label: Progressbar 13647 //>>group: Widgets 13648 /* eslint-disable max-len */ 13649 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 13650 /* eslint-enable max-len */ 13651 //>>docs: http://api.jqueryui.com/progressbar/ 13652 //>>demos: http://jqueryui.com/progressbar/ 13653 //>>css.structure: ../../themes/base/core.css 13654 //>>css.structure: ../../themes/base/progressbar.css 13655 //>>css.theme: ../../themes/base/theme.css 13656 13657 13658 var widgetsProgressbar = $.widget("ui.progressbar", { 13659 version: "1.13.2", 13660 options: { 13661 classes: { 13662 "ui-progressbar": "ui-corner-all", 13663 "ui-progressbar-value": "ui-corner-left", 13664 "ui-progressbar-complete": "ui-corner-right" 13665 }, 13666 max: 100, 13667 value: 0, 13668 13669 change: null, 13670 complete: null 13671 }, 13672 13673 min: 0, 13674 13675 _create: function () { 13676 13677 // Constrain initial value 13678 this.oldValue = this.options.value = this._constrainedValue(); 13679 13680 this.element.attr({ 13681 13682 // Only set static values; aria-valuenow and aria-valuemax are 13683 // set inside _refreshValue() 13684 role: "progressbar", 13685 "aria-valuemin": this.min 13686 }); 13687 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 13688 13689 this.valueDiv = $("<div>").appendTo(this.element); 13690 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 13691 this._refreshValue(); 13692 }, 13693 13694 _destroy: function () { 13695 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 13696 13697 this.valueDiv.remove(); 13698 }, 13699 13700 value: function (newValue) { 13701 if (newValue === undefined) { 13702 return this.options.value; 13703 } 13704 13705 this.options.value = this._constrainedValue(newValue); 13706 this._refreshValue(); 13707 }, 13708 13709 _constrainedValue: function (newValue) { 13710 if (newValue === undefined) { 13711 newValue = this.options.value; 13712 } 13713 13714 this.indeterminate = newValue === false; 13715 13716 // Sanitize value
vendor: 15,676 bytes, lines 13717-14159
13717 if (typeof newValue !== "number") { 13718 newValue = 0; 13719 } 13720 13721 return this.indeterminate ? false : 13722 Math.min(this.options.max, Math.max(this.min, newValue)); 13723 }, 13724 13725 _setOptions: function (options) { 13726 13727 // Ensure "value" option is set after other values (like max) 13728 var value = options.value; 13729 delete options.value; 13730 13731 this._super(options); 13732 13733 this.options.value = this._constrainedValue(value); 13734 this._refreshValue(); 13735 }, 13736 13737 _setOption: function (key, value) { 13738 if (key === "max") { 13739 13740 // Don't allow a max less than min 13741 value = Math.max(this.min, value); 13742 } 13743 this._super(key, value); 13744 }, 13745 13746 _setOptionDisabled: function (value) { 13747 this._super(value); 13748 13749 this.element.attr("aria-disabled", value); 13750 this._toggleClass(null, "ui-state-disabled", !!value); 13751 }, 13752 13753 _percentage: function () { 13754 return this.indeterminate ? 13755 100 : 13756 100 * (this.options.value - this.min) / (this.options.max - this.min); 13757 }, 13758 13759 _refreshValue: function () { 13760 var value = this.options.value, 13761 percentage = this._percentage(); 13762 13763 this.valueDiv 13764 .toggle(this.indeterminate || value > this.min) 13765 .width(percentage.toFixed(0) + "%"); 13766 13767 this 13768 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 13769 value === this.options.max) 13770 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 13771 13772 if (this.indeterminate) { 13773 this.element.removeAttr("aria-valuenow"); 13774 if (!this.overlayDiv) { 13775 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 13776 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 13777 } 13778 } else { 13779 this.element.attr({ 13780 "aria-valuemax": this.options.max, 13781 "aria-valuenow": value 13782 }); 13783 if (this.overlayDiv) { 13784 this.overlayDiv.remove(); 13785 this.overlayDiv = null; 13786 } 13787 } 13788 13789 if (this.oldValue !== value) { 13790 this.oldValue = value; 13791 this._trigger("change"); 13792 } 13793 if (value === this.options.max) { 13794 this._trigger("complete"); 13795 } 13796 } 13797 }); 13798 13799 13800 /*! 13801 * jQuery UI Selectable 1.13.2 13802 * http://jqueryui.com 13803 * 13804 * Copyright jQuery Foundation and other contributors 13805 * Released under the MIT license. 13806 * http://jquery.org/license 13807 */ 13808 13809 //>>label: Selectable 13810 //>>group: Interactions 13811 //>>description: Allows groups of elements to be selected with the mouse. 13812 //>>docs: http://api.jqueryui.com/selectable/ 13813 //>>demos: http://jqueryui.com/selectable/ 13814 //>>css.structure: ../../themes/base/selectable.css 13815 13816 13817 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 13818 version: "1.13.2", 13819 options: { 13820 appendTo: "body", 13821 autoRefresh: true, 13822 distance: 0, 13823 filter: "*", 13824 tolerance: "touch", 13825 13826 // Callbacks 13827 selected: null, 13828 selecting: null, 13829 start: null, 13830 stop: null, 13831 unselected: null, 13832 unselecting: null 13833 }, 13834 _create: function () { 13835 var that = this; 13836 13837 this._addClass("ui-selectable"); 13838 13839 this.dragged = false; 13840 13841 // Cache selectee children based on filter 13842 this.refresh = function () { 13843 that.elementPos = $(that.element[0]).offset(); 13844 that.selectees = $(that.options.filter, that.element[0]); 13845 that._addClass(that.selectees, "ui-selectee"); 13846 that.selectees.each(function () { 13847 var $this = $(this), 13848 selecteeOffset = $this.offset(), 13849 pos = { 13850 left: selecteeOffset.left - that.elementPos.left, 13851 top: selecteeOffset.top - that.elementPos.top 13852 }; 13853 $.data(this, "selectable-item", { 13854 element: this, 13855 $element: $this, 13856 left: pos.left, 13857 top: pos.top, 13858 right: pos.left + $this.outerWidth(), 13859 bottom: pos.top + $this.outerHeight(), 13860 startselected: false, 13861 selected: $this.hasClass("ui-selected"), 13862 selecting: $this.hasClass("ui-selecting"), 13863 unselecting: $this.hasClass("ui-unselecting") 13864 }); 13865 }); 13866 }; 13867 this.refresh(); 13868 13869 this._mouseInit(); 13870 13871 this.helper = $("<div>"); 13872 this._addClass(this.helper, "ui-selectable-helper"); 13873 }, 13874 13875 _destroy: function () { 13876 this.selectees.removeData("selectable-item"); 13877 this._mouseDestroy(); 13878 }, 13879 13880 _mouseStart: function (event) { 13881 var that = this, 13882 options = this.options; 13883 13884 this.opos = [event.pageX, event.pageY]; 13885 this.elementPos = $(this.element[0]).offset(); 13886 13887 if (this.options.disabled) { 13888 return; 13889 } 13890 13891 this.selectees = $(options.filter, this.element[0]); 13892 13893 this._trigger("start", event); 13894 13895 $(options.appendTo).append(this.helper); 13896 13897 // position helper (lasso) 13898 this.helper.css({ 13899 "left": event.pageX, 13900 "top": event.pageY, 13901 "width": 0, 13902 "height": 0 13903 }); 13904 13905 if (options.autoRefresh) { 13906 this.refresh(); 13907 } 13908 13909 this.selectees.filter(".ui-selected").each(function () { 13910 var selectee = $.data(this, "selectable-item"); 13911 selectee.startselected = true; 13912 if (!event.metaKey && !event.ctrlKey) { 13913 that._removeClass(selectee.$element, "ui-selected"); 13914 selectee.selected = false; 13915 that._addClass(selectee.$element, "ui-unselecting"); 13916 selectee.unselecting = true; 13917 13918 // selectable UNSELECTING callback 13919 that._trigger("unselecting", event, { 13920 unselecting: selectee.element 13921 }); 13922 } 13923 }); 13924 13925 $(event.target).parents().addBack().each(function () { 13926 var doSelect, 13927 selectee = $.data(this, "selectable-item"); 13928 if (selectee) { 13929 doSelect = (!event.metaKey && !event.ctrlKey) || 13930 !selectee.$element.hasClass("ui-selected"); 13931 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 13932 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 13933 selectee.unselecting = !doSelect; 13934 selectee.selecting = doSelect; 13935 selectee.selected = doSelect; 13936 13937 // selectable (UN)SELECTING callback 13938 if (doSelect) { 13939 that._trigger("selecting", event, { 13940 selecting: selectee.element 13941 }); 13942 } else { 13943 that._trigger("unselecting", event, { 13944 unselecting: selectee.element 13945 }); 13946 } 13947 return false; 13948 } 13949 }); 13950 13951 }, 13952 13953 _mouseDrag: function (event) { 13954 13955 this.dragged = true; 13956 13957 if (this.options.disabled) { 13958 return; 13959 } 13960 13961 var tmp, 13962 that = this, 13963 options = this.options, 13964 x1 = this.opos[0], 13965 y1 = this.opos[1], 13966 x2 = event.pageX, 13967 y2 = event.pageY; 13968 13969 if (x1 > x2) { 13970 tmp = x2; x2 = x1; x1 = tmp; 13971 } 13972 if (y1 > y2) { 13973 tmp = y2; y2 = y1; y1 = tmp; 13974 } 13975 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 13976 13977 this.selectees.each(function () { 13978 var selectee = $.data(this, "selectable-item"), 13979 hit = false, 13980 offset = {}; 13981 13982 //prevent helper from being selected if appendTo: selectable 13983 if (!selectee || selectee.element === that.element[0]) { 13984 return; 13985 } 13986 13987 offset.left = selectee.left + that.elementPos.left; 13988 offset.right = selectee.right + that.elementPos.left; 13989 offset.top = selectee.top + that.elementPos.top; 13990 offset.bottom = selectee.bottom + that.elementPos.top; 13991 13992 if (options.tolerance === "touch") { 13993 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 13994 offset.bottom < y1)); 13995 } else if (options.tolerance === "fit") { 13996 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 13997 offset.bottom < y2); 13998 } 13999 14000 if (hit) { 14001 14002 // SELECT 14003 if (selectee.selected) { 14004 that._removeClass(selectee.$element, "ui-selected"); 14005 selectee.selected = false; 14006 } 14007 if (selectee.unselecting) { 14008 that._removeClass(selectee.$element, "ui-unselecting"); 14009 selectee.unselecting = false; 14010 } 14011 if (!selectee.selecting) { 14012 that._addClass(selectee.$element, "ui-selecting"); 14013 selectee.selecting = true; 14014 14015 // selectable SELECTING callback 14016 that._trigger("selecting", event, { 14017 selecting: selectee.element 14018 }); 14019 } 14020 } else { 14021 14022 // UNSELECT 14023 if (selectee.selecting) { 14024 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 14025 that._removeClass(selectee.$element, "ui-selecting"); 14026 selectee.selecting = false; 14027 that._addClass(selectee.$element, "ui-selected"); 14028 selectee.selected = true; 14029 } else { 14030 that._removeClass(selectee.$element, "ui-selecting"); 14031 selectee.selecting = false; 14032 if (selectee.startselected) { 14033 that._addClass(selectee.$element, "ui-unselecting"); 14034 selectee.unselecting = true; 14035 } 14036 14037 // selectable UNSELECTING callback 14038 that._trigger("unselecting", event, { 14039 unselecting: selectee.element 14040 }); 14041 } 14042 } 14043 if (selectee.selected) { 14044 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 14045 that._removeClass(selectee.$element, "ui-selected"); 14046 selectee.selected = false; 14047 14048 that._addClass(selectee.$element, "ui-unselecting"); 14049 selectee.unselecting = true; 14050 14051 // selectable UNSELECTING callback 14052 that._trigger("unselecting", event, { 14053 unselecting: selectee.element 14054 }); 14055 } 14056 } 14057 } 14058 }); 14059 14060 return false; 14061 }, 14062 14063 _mouseStop: function (event) { 14064 var that = this; 14065 14066 this.dragged = false; 14067 14068 $(".ui-unselecting", this.element[0]).each(function () { 14069 var selectee = $.data(this, "selectable-item"); 14070 that._removeClass(selectee.$element, "ui-unselecting"); 14071 selectee.unselecting = false; 14072 selectee.startselected = false; 14073 that._trigger("unselected", event, { 14074 unselected: selectee.element 14075 }); 14076 }); 14077 $(".ui-selecting", this.element[0]).each(function () { 14078 var selectee = $.data(this, "selectable-item"); 14079 that._removeClass(selectee.$element, "ui-selecting") 14080 ._addClass(selectee.$element, "ui-selected"); 14081 selectee.selecting = false; 14082 selectee.selected = true; 14083 selectee.startselected = true; 14084 that._trigger("selected", event, { 14085 selected: selectee.element 14086 }); 14087 }); 14088 this._trigger("stop", event); 14089 14090 this.helper.remove(); 14091 14092 return false; 14093 } 14094 14095 }); 14096 14097 14098 /*! 14099 * jQuery UI Selectmenu 1.13.2 14100 * http://jqueryui.com 14101 * 14102 * Copyright jQuery Foundation and other contributors 14103 * Released under the MIT license. 14104 * http://jquery.org/license 14105 */ 14106 14107 //>>label: Selectmenu 14108 //>>group: Widgets 14109 /* eslint-disable max-len */ 14110 //>>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. 14111 /* eslint-enable max-len */ 14112 //>>docs: http://api.jqueryui.com/selectmenu/ 14113 //>>demos: http://jqueryui.com/selectmenu/ 14114 //>>css.structure: ../../themes/base/core.css 14115 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 14116 //>>css.theme: ../../themes/base/theme.css 14117 14118 14119 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 14120 version: "1.13.2", 14121 defaultElement: "<select>", 14122 options: { 14123 appendTo: null, 14124 classes: { 14125 "ui-selectmenu-button-open": "ui-corner-top", 14126 "ui-selectmenu-button-closed": "ui-corner-all" 14127 }, 14128 disabled: null, 14129 icons: { 14130 button: "ui-icon-triangle-1-s" 14131 }, 14132 position: { 14133 my: "left top", 14134 at: "left bottom", 14135 collision: "none" 14136 }, 14137 width: false, 14138 14139 // Callbacks 14140 change: null, 14141 close: null, 14142 focus: null, 14143 open: null, 14144 select: null 14145 }, 14146 14147 _create: function () { 14148 var selectmenuId = this.element.uniqueId().attr("id"); 14149 this.ids = { 14150 element: selectmenuId, 14151 button: selectmenuId + "-button", 14152 menu: selectmenuId + "-menu" 14153 }; 14154 14155 this._drawButton(); 14156 this._drawMenu(); 14157 this._bindFormResetHandler(); 14158 14159 this._rendered = false;
vendor: 4,338 bytes, lines 14160-14274
14160 this.menuItems = $(); 14161 }, 14162 14163 _drawButton: function () { 14164 var icon, 14165 that = this, 14166 item = this._parseOption( 14167 this.element.find("option:selected"), 14168 this.element[0].selectedIndex 14169 ); 14170 14171 // Associate existing label with the new button 14172 this.labels = this.element.labels().attr("for", this.ids.button); 14173 this._on(this.labels, { 14174 click: function (event) { 14175 this.button.trigger("focus"); 14176 event.preventDefault(); 14177 } 14178 }); 14179 14180 // Hide original select element 14181 this.element.hide(); 14182 14183 // Create button 14184 this.button = $("<span>", { 14185 tabindex: this.options.disabled ? -1 : 0, 14186 id: this.ids.button, 14187 role: "combobox", 14188 "aria-expanded": "false", 14189 "aria-autocomplete": "list", 14190 "aria-owns": this.ids.menu, 14191 "aria-haspopup": "true", 14192 title: this.element.attr("title") 14193 }) 14194 .insertAfter(this.element); 14195 14196 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 14197 "ui-button ui-widget"); 14198 14199 icon = $("<span>").appendTo(this.button); 14200 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 14201 this.buttonItem = this._renderButtonItem(item) 14202 .appendTo(this.button); 14203 14204 if (this.options.width !== false) { 14205 this._resizeButton(); 14206 } 14207 14208 this._on(this.button, this._buttonEvents); 14209 this.button.one("focusin", function () { 14210 14211 // Delay rendering the menu items until the button receives focus. 14212 // The menu may have already been rendered via a programmatic open. 14213 if (!that._rendered) { 14214 that._refreshMenu(); 14215 } 14216 }); 14217 }, 14218 14219 _drawMenu: function () { 14220 var that = this; 14221 14222 // Create menu 14223 this.menu = $("<ul>", { 14224 "aria-hidden": "true", 14225 "aria-labelledby": this.ids.button, 14226 id: this.ids.menu 14227 }); 14228 14229 // Wrap menu 14230 this.menuWrap = $("<div>").append(this.menu); 14231 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 14232 this.menuWrap.appendTo(this._appendTo()); 14233 14234 // Initialize menu widget 14235 this.menuInstance = this.menu 14236 .menu({ 14237 classes: { 14238 "ui-menu": "ui-corner-bottom" 14239 }, 14240 role: "listbox", 14241 select: function (event, ui) { 14242 event.preventDefault(); 14243 14244 // Support: IE8 14245 // If the item was selected via a click, the text selection 14246 // will be destroyed in IE 14247 that._setSelection(); 14248 14249 that._select(ui.item.data("ui-selectmenu-item"), event); 14250 }, 14251 focus: function (event, ui) { 14252 var item = ui.item.data("ui-selectmenu-item"); 14253 14254 // Prevent inital focus from firing and check if its a newly focused item 14255 if (that.focusIndex != null && item.index !== that.focusIndex) { 14256 that._trigger("focus", event, { item: item }); 14257 if (!that.isOpen) { 14258 that._select(item, event); 14259 } 14260 } 14261 that.focusIndex = item.index; 14262 14263 that.button.attr("aria-activedescendant", 14264 that.menuItems.eq(item.index).attr("id")); 14265 } 14266 }) 14267 .menu("instance"); 14268 14269 // Don't close the menu on mouseleave 14270 this.menuInstance._off(this.menu, "mouseleave"); 14271 14272 // Cancel the menu's collapseAll on document click 14273 this.menuInstance._closeOnDocumentClick = function () { 14274 return false;
vendor: 6,153 bytes, lines 14275-14484
14275 }; 14276 14277 // Selects often contain empty items, but never contain dividers 14278 this.menuInstance._isDivider = function () { 14279 return false; 14280 }; 14281 }, 14282 14283 refresh: function () { 14284 this._refreshMenu(); 14285 this.buttonItem.replaceWith( 14286 this.buttonItem = this._renderButtonItem( 14287 14288 // Fall back to an empty object in case there are no options 14289 this._getSelectedItem().data("ui-selectmenu-item") || {} 14290 ) 14291 ); 14292 if (this.options.width === null) { 14293 this._resizeButton(); 14294 } 14295 }, 14296 14297 _refreshMenu: function () { 14298 var item, 14299 options = this.element.find("option"); 14300 14301 this.menu.empty(); 14302 14303 this._parseOptions(options); 14304 this._renderMenu(this.menu, this.items); 14305 14306 this.menuInstance.refresh(); 14307 this.menuItems = this.menu.find("li") 14308 .not(".ui-selectmenu-optgroup") 14309 .find(".ui-menu-item-wrapper"); 14310 14311 this._rendered = true; 14312 14313 if (!options.length) { 14314 return; 14315 } 14316 14317 item = this._getSelectedItem(); 14318 14319 // Update the menu to have the correct item focused 14320 this.menuInstance.focus(null, item); 14321 this._setAria(item.data("ui-selectmenu-item")); 14322 14323 // Set disabled state 14324 this._setOption("disabled", this.element.prop("disabled")); 14325 }, 14326 14327 open: function (event) { 14328 if (this.options.disabled) { 14329 return; 14330 } 14331 14332 // If this is the first time the menu is being opened, render the items 14333 if (!this._rendered) { 14334 this._refreshMenu(); 14335 } else { 14336 14337 // Menu clears focus on close, reset focus to selected item 14338 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 14339 this.menuInstance.focus(null, this._getSelectedItem()); 14340 } 14341 14342 // If there are no options, don't open the menu 14343 if (!this.menuItems.length) { 14344 return; 14345 } 14346 14347 this.isOpen = true; 14348 this._toggleAttr(); 14349 this._resizeMenu(); 14350 this._position(); 14351 14352 this._on(this.document, this._documentClick); 14353 14354 this._trigger("open", event); 14355 }, 14356 14357 _position: function () { 14358 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 14359 }, 14360 14361 close: function (event) { 14362 if (!this.isOpen) { 14363 return; 14364 } 14365 14366 this.isOpen = false; 14367 this._toggleAttr(); 14368 14369 this.range = null; 14370 this._off(this.document); 14371 14372 this._trigger("close", event); 14373 }, 14374 14375 widget: function () { 14376 return this.button; 14377 }, 14378 14379 menuWidget: function () { 14380 return this.menu; 14381 }, 14382 14383 _renderButtonItem: function (item) { 14384 var buttonItem = $("<span>"); 14385 14386 this._setText(buttonItem, item.label); 14387 this._addClass(buttonItem, "ui-selectmenu-text"); 14388 14389 return buttonItem; 14390 }, 14391 14392 _renderMenu: function (ul, items) { 14393 var that = this, 14394 currentOptgroup = ""; 14395 14396 $.each(items, function (index, item) { 14397 var li; 14398 14399 if (item.optgroup !== currentOptgroup) { 14400 li = $("<li>", { 14401 text: item.optgroup 14402 }); 14403 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 14404 (item.element.parent("optgroup").prop("disabled") ? 14405 " ui-state-disabled" : 14406 "")); 14407 14408 li.appendTo(ul); 14409 14410 currentOptgroup = item.optgroup; 14411 } 14412 14413 that._renderItemData(ul, item); 14414 }); 14415 }, 14416 14417 _renderItemData: function (ul, item) { 14418 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 14419 }, 14420 14421 _renderItem: function (ul, item) { 14422 var li = $("<li>"), 14423 wrapper = $("<div>", { 14424 title: item.element.attr("title") 14425 }); 14426 14427 if (item.disabled) { 14428 this._addClass(li, null, "ui-state-disabled"); 14429 } 14430 this._setText(wrapper, item.label); 14431 14432 return li.append(wrapper).appendTo(ul); 14433 }, 14434 14435 _setText: function (element, value) { 14436 if (value) { 14437 element.text(value); 14438 } else { 14439 element.html(" "); 14440 } 14441 }, 14442 14443 _move: function (direction, event) { 14444 var item, next, 14445 filter = ".ui-menu-item"; 14446 14447 if (this.isOpen) { 14448 item = this.menuItems.eq(this.focusIndex).parent("li"); 14449 } else { 14450 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 14451 filter += ":not(.ui-state-disabled)"; 14452 } 14453 14454 if (direction === "first" || direction === "last") { 14455 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 14456 } else { 14457 next = item[direction + "All"](filter).eq(0); 14458 } 14459 14460 if (next.length) { 14461 this.menuInstance.focus(event, next); 14462 } 14463 }, 14464 14465 _getSelectedItem: function () { 14466 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 14467 }, 14468 14469 _toggle: function (event) { 14470 this[this.isOpen ? "close" : "open"](event); 14471 }, 14472 14473 _setSelection: function () { 14474 var selection; 14475 14476 if (!this.range) { 14477 return; 14478 } 14479 14480 if (window.getSelection) { 14481 selection = window.getSelection(); 14482 selection.removeAllRanges(); 14483 selection.addRange(this.range); 14484
vendor: 1,718 bytes, lines 14485-14538
14485 // Support: IE8 14486 } else { 14487 this.range.select(); 14488 } 14489 14490 // Support: IE 14491 // Setting the text selection kills the button focus in IE, but 14492 // restoring the focus doesn't kill the selection. 14493 this.button.trigger("focus"); 14494 }, 14495 14496 _documentClick: { 14497 mousedown: function (event) { 14498 if (!this.isOpen) { 14499 return; 14500 } 14501 14502 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 14503 $.escapeSelector(this.ids.button)).length) { 14504 this.close(event); 14505 } 14506 } 14507 }, 14508 14509 _buttonEvents: { 14510 14511 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 14512 mousedown: function () { 14513 var selection; 14514 14515 if (window.getSelection) { 14516 selection = window.getSelection(); 14517 if (selection.rangeCount) { 14518 this.range = selection.getRangeAt(0); 14519 } 14520 14521 // Support: IE8 14522 } else { 14523 this.range = document.selection.createRange(); 14524 } 14525 }, 14526 14527 click: function (event) { 14528 this._setSelection(); 14529 this._toggle(event); 14530 }, 14531 14532 keydown: function (event) { 14533 var preventDefault = true; 14534 switch (event.keyCode) { 14535 case $.ui.keyCode.TAB: 14536 case $.ui.keyCode.ESCAPE: 14537 this.close(event); 14538 preventDefault = false;
vendor: 6,091 bytes, lines 14539-14714
14539 break; 14540 case $.ui.keyCode.ENTER: 14541 if (this.isOpen) { 14542 this._selectFocusedItem(event); 14543 } 14544 break; 14545 case $.ui.keyCode.UP: 14546 if (event.altKey) { 14547 this._toggle(event); 14548 } else { 14549 this._move("prev", event); 14550 } 14551 break; 14552 case $.ui.keyCode.DOWN: 14553 if (event.altKey) { 14554 this._toggle(event); 14555 } else { 14556 this._move("next", event); 14557 } 14558 break; 14559 case $.ui.keyCode.SPACE: 14560 if (this.isOpen) { 14561 this._selectFocusedItem(event); 14562 } else { 14563 this._toggle(event); 14564 } 14565 break; 14566 case $.ui.keyCode.LEFT: 14567 this._move("prev", event); 14568 break; 14569 case $.ui.keyCode.RIGHT: 14570 this._move("next", event); 14571 break; 14572 case $.ui.keyCode.HOME: 14573 case $.ui.keyCode.PAGE_UP: 14574 this._move("first", event); 14575 break; 14576 case $.ui.keyCode.END: 14577 case $.ui.keyCode.PAGE_DOWN: 14578 this._move("last", event); 14579 break; 14580 default: 14581 this.menu.trigger(event); 14582 preventDefault = false; 14583 } 14584 14585 if (preventDefault) { 14586 event.preventDefault(); 14587 } 14588 } 14589 }, 14590 14591 _selectFocusedItem: function (event) { 14592 var item = this.menuItems.eq(this.focusIndex).parent("li"); 14593 if (!item.hasClass("ui-state-disabled")) { 14594 this._select(item.data("ui-selectmenu-item"), event); 14595 } 14596 }, 14597 14598 _select: function (item, event) { 14599 var oldIndex = this.element[0].selectedIndex; 14600 14601 // Change native select element 14602 this.element[0].selectedIndex = item.index; 14603 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 14604 this._setAria(item); 14605 this._trigger("select", event, { item: item }); 14606 14607 if (item.index !== oldIndex) { 14608 this._trigger("change", event, { item: item }); 14609 } 14610 14611 this.close(event); 14612 }, 14613 14614 _setAria: function (item) { 14615 var id = this.menuItems.eq(item.index).attr("id"); 14616 14617 this.button.attr({ 14618 "aria-labelledby": id, 14619 "aria-activedescendant": id 14620 }); 14621 this.menu.attr("aria-activedescendant", id); 14622 }, 14623 14624 _setOption: function (key, value) { 14625 if (key === "icons") { 14626 var icon = this.button.find("span.ui-icon"); 14627 this._removeClass(icon, null, this.options.icons.button) 14628 ._addClass(icon, null, value.button); 14629 } 14630 14631 this._super(key, value); 14632 14633 if (key === "appendTo") { 14634 this.menuWrap.appendTo(this._appendTo()); 14635 } 14636 14637 if (key === "width") { 14638 this._resizeButton(); 14639 } 14640 }, 14641 14642 _setOptionDisabled: function (value) { 14643 this._super(value); 14644 14645 this.menuInstance.option("disabled", value); 14646 this.button.attr("aria-disabled", value); 14647 this._toggleClass(this.button, null, "ui-state-disabled", value); 14648 14649 this.element.prop("disabled", value); 14650 if (value) { 14651 this.button.attr("tabindex", -1); 14652 this.close(); 14653 } else { 14654 this.button.attr("tabindex", 0); 14655 } 14656 }, 14657 14658 _appendTo: function () { 14659 var element = this.options.appendTo; 14660 14661 if (element) { 14662 element = element.jquery || element.nodeType ? 14663 $(element) : 14664 this.document.find(element).eq(0); 14665 } 14666 14667 if (!element || !element[0]) { 14668 element = this.element.closest(".ui-front, dialog"); 14669 } 14670 14671 if (!element.length) { 14672 element = this.document[0].body; 14673 } 14674 14675 return element; 14676 }, 14677 14678 _toggleAttr: function () { 14679 this.button.attr("aria-expanded", this.isOpen); 14680 14681 // We can't use two _toggleClass() calls here, because we need to make sure 14682 // we always remove classes first and add them second, otherwise if both classes have the 14683 // same theme class, it will be removed after we add it. 14684 this._removeClass(this.button, "ui-selectmenu-button-" + 14685 (this.isOpen ? "closed" : "open")) 14686 ._addClass(this.button, "ui-selectmenu-button-" + 14687 (this.isOpen ? "open" : "closed")) 14688 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 14689 14690 this.menu.attr("aria-hidden", !this.isOpen); 14691 }, 14692 14693 _resizeButton: function () { 14694 var width = this.options.width; 14695 14696 // For `width: false`, just remove inline style and stop 14697 if (width === false) { 14698 this.button.css("width", ""); 14699 return; 14700 } 14701 14702 // For `width: null`, match the width of the original element 14703 if (width === null) { 14704 width = this.element.show().outerWidth(); 14705 this.element.hide(); 14706 } 14707 14708 this.button.outerWidth(width); 14709 }, 14710 14711 _resizeMenu: function () { 14712 this.menu.outerWidth(Math.max( 14713 this.button.outerWidth(), 14714
vendor: 6,957 bytes, lines 14715-14931
14715 // Support: IE10 14716 // IE10 wraps long text (possibly a rounding bug) 14717 // so we add 1px to avoid the wrapping 14718 this.menu.width("").outerWidth() + 1 14719 )); 14720 }, 14721 14722 _getCreateOptions: function () { 14723 var options = this._super(); 14724 14725 options.disabled = this.element.prop("disabled"); 14726 14727 return options; 14728 }, 14729 14730 _parseOptions: function (options) { 14731 var that = this, 14732 data = []; 14733 options.each(function (index, item) { 14734 if (item.hidden) { 14735 return; 14736 } 14737 14738 data.push(that._parseOption($(item), index)); 14739 }); 14740 this.items = data; 14741 }, 14742 14743 _parseOption: function (option, index) { 14744 var optgroup = option.parent("optgroup"); 14745 14746 return { 14747 element: option, 14748 index: index, 14749 value: option.val(), 14750 label: option.text(), 14751 optgroup: optgroup.attr("label") || "", 14752 disabled: optgroup.prop("disabled") || option.prop("disabled") 14753 }; 14754 }, 14755 14756 _destroy: function () { 14757 this._unbindFormResetHandler(); 14758 this.menuWrap.remove(); 14759 this.button.remove(); 14760 this.element.show(); 14761 this.element.removeUniqueId(); 14762 this.labels.attr("for", this.ids.element); 14763 } 14764 }]); 14765 14766 14767 /*! 14768 * jQuery UI Slider 1.13.2 14769 * http://jqueryui.com 14770 * 14771 * Copyright jQuery Foundation and other contributors 14772 * Released under the MIT license. 14773 * http://jquery.org/license 14774 */ 14775 14776 //>>label: Slider 14777 //>>group: Widgets 14778 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 14779 //>>docs: http://api.jqueryui.com/slider/ 14780 //>>demos: http://jqueryui.com/slider/ 14781 //>>css.structure: ../../themes/base/core.css 14782 //>>css.structure: ../../themes/base/slider.css 14783 //>>css.theme: ../../themes/base/theme.css 14784 14785 14786 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 14787 version: "1.13.2", 14788 widgetEventPrefix: "slide", 14789 14790 options: { 14791 animate: false, 14792 classes: { 14793 "ui-slider": "ui-corner-all", 14794 "ui-slider-handle": "ui-corner-all", 14795 14796 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 14797 // element, but worked best visually with a variety of themes 14798 "ui-slider-range": "ui-corner-all ui-widget-header" 14799 }, 14800 distance: 0, 14801 max: 100, 14802 min: 0, 14803 orientation: "horizontal", 14804 range: false, 14805 step: 1, 14806 value: 0, 14807 values: null, 14808 14809 // Callbacks 14810 change: null, 14811 slide: null, 14812 start: null, 14813 stop: null 14814 }, 14815 14816 // Number of pages in a slider 14817 // (how many times can you page up/down to go through the whole range) 14818 numPages: 5, 14819 14820 _create: function () { 14821 this._keySliding = false; 14822 this._mouseSliding = false; 14823 this._animateOff = true; 14824 this._handleIndex = null; 14825 this._detectOrientation(); 14826 this._mouseInit(); 14827 this._calculateNewMax(); 14828 14829 this._addClass("ui-slider ui-slider-" + this.orientation, 14830 "ui-widget ui-widget-content"); 14831 14832 this._refresh(); 14833 14834 this._animateOff = false; 14835 }, 14836 14837 _refresh: function () { 14838 this._createRange(); 14839 this._createHandles(); 14840 this._setupEvents(); 14841 this._refreshValue(); 14842 }, 14843 14844 _createHandles: function () { 14845 var i, handleCount, 14846 options = this.options, 14847 existingHandles = this.element.find(".ui-slider-handle"), 14848 handle = "<span tabindex='0'></span>", 14849 handles = []; 14850 14851 handleCount = (options.values && options.values.length) || 1; 14852 14853 if (existingHandles.length > handleCount) { 14854 existingHandles.slice(handleCount).remove(); 14855 existingHandles = existingHandles.slice(0, handleCount); 14856 } 14857 14858 for (i = existingHandles.length; i < handleCount; i++) { 14859 handles.push(handle); 14860 } 14861 14862 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 14863 14864 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 14865 14866 this.handle = this.handles.eq(0); 14867 14868 this.handles.each(function (i) { 14869 $(this) 14870 .data("ui-slider-handle-index", i) 14871 .attr("tabIndex", 0); 14872 }); 14873 }, 14874 14875 _createRange: function () { 14876 var options = this.options; 14877 14878 if (options.range) { 14879 if (options.range === true) { 14880 if (!options.values) { 14881 options.values = [this._valueMin(), this._valueMin()]; 14882 } else if (options.values.length && options.values.length !== 2) { 14883 options.values = [options.values[0], options.values[0]]; 14884 } else if (Array.isArray(options.values)) { 14885 options.values = options.values.slice(0); 14886 } 14887 } 14888 14889 if (!this.range || !this.range.length) { 14890 this.range = $("<div>") 14891 .appendTo(this.element); 14892 14893 this._addClass(this.range, "ui-slider-range"); 14894 } else { 14895 this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"); 14896 14897 // Handle range switching from true to min/max 14898 this.range.css({ 14899 "left": "", 14900 "bottom": "" 14901 }); 14902 } 14903 if (options.range === "min" || options.range === "max") { 14904 this._addClass(this.range, "ui-slider-range-" + options.range); 14905 } 14906 } else { 14907 if (this.range) { 14908 this.range.remove(); 14909 } 14910 this.range = null; 14911 } 14912 }, 14913 14914 _setupEvents: function () { 14915 this._off(this.handles); 14916 this._on(this.handles, this._handleEvents); 14917 this._hoverable(this.handles); 14918 this._focusable(this.handles); 14919 }, 14920 14921 _destroy: function () { 14922 this.handles.remove(); 14923 if (this.range) { 14924 this.range.remove(); 14925 } 14926 14927 this._mouseDestroy(); 14928 }, 14929 14930 _mouseCapture: function (event) { 14931 var position, normValue, distance, closestHandle, index, allowed, offset, mou
vendor: 29,397 bytes, lines 14931-15757
14931seOverHandle, 14932 that = this, 14933 o = this.options; 14934 14935 if (o.disabled) { 14936 return false; 14937 } 14938 14939 this.elementSize = { 14940 width: this.element.outerWidth(), 14941 height: this.element.outerHeight() 14942 }; 14943 this.elementOffset = this.element.offset(); 14944 14945 position = { x: event.pageX, y: event.pageY }; 14946 normValue = this._normValueFromMouse(position); 14947 distance = this._valueMax() - this._valueMin() + 1; 14948 this.handles.each(function (i) { 14949 var thisDistance = Math.abs(normValue - that.values(i)); 14950 if ((distance > thisDistance) || 14951 (distance === thisDistance && 14952 (i === that._lastChangedValue || that.values(i) === o.min))) { 14953 distance = thisDistance; 14954 closestHandle = $(this); 14955 index = i; 14956 } 14957 }); 14958 14959 allowed = this._start(event, index); 14960 if (allowed === false) { 14961 return false; 14962 } 14963 this._mouseSliding = true; 14964 14965 this._handleIndex = index; 14966 14967 this._addClass(closestHandle, null, "ui-state-active"); 14968 closestHandle.trigger("focus"); 14969 14970 offset = closestHandle.offset(); 14971 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 14972 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 14973 left: event.pageX - offset.left - (closestHandle.width() / 2), 14974 top: event.pageY - offset.top - 14975 (closestHandle.height() / 2) - 14976 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 14977 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 14978 (parseInt(closestHandle.css("marginTop"), 10) || 0) 14979 }; 14980 14981 if (!this.handles.hasClass("ui-state-hover")) { 14982 this._slide(event, index, normValue); 14983 } 14984 this._animateOff = true; 14985 return true; 14986 }, 14987 14988 _mouseStart: function () { 14989 return true; 14990 }, 14991 14992 _mouseDrag: function (event) { 14993 var position = { x: event.pageX, y: event.pageY }, 14994 normValue = this._normValueFromMouse(position); 14995 14996 this._slide(event, this._handleIndex, normValue); 14997 14998 return false; 14999 }, 15000 15001 _mouseStop: function (event) { 15002 this._removeClass(this.handles, null, "ui-state-active"); 15003 this._mouseSliding = false; 15004 15005 this._stop(event, this._handleIndex); 15006 this._change(event, this._handleIndex); 15007 15008 this._handleIndex = null; 15009 this._clickOffset = null; 15010 this._animateOff = false; 15011 15012 return false; 15013 }, 15014 15015 _detectOrientation: function () { 15016 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 15017 }, 15018 15019 _normValueFromMouse: function (position) { 15020 var pixelTotal, 15021 pixelMouse, 15022 percentMouse, 15023 valueTotal, 15024 valueMouse; 15025 15026 if (this.orientation === "horizontal") { 15027 pixelTotal = this.elementSize.width; 15028 pixelMouse = position.x - this.elementOffset.left - 15029 (this._clickOffset ? this._clickOffset.left : 0); 15030 } else { 15031 pixelTotal = this.elementSize.height; 15032 pixelMouse = position.y - this.elementOffset.top - 15033 (this._clickOffset ? this._clickOffset.top : 0); 15034 } 15035 15036 percentMouse = (pixelMouse / pixelTotal); 15037 if (percentMouse > 1) { 15038 percentMouse = 1; 15039 } 15040 if (percentMouse < 0) { 15041 percentMouse = 0; 15042 } 15043 if (this.orientation === "vertical") { 15044 percentMouse = 1 - percentMouse; 15045 } 15046 15047 valueTotal = this._valueMax() - this._valueMin(); 15048 valueMouse = this._valueMin() + percentMouse * valueTotal; 15049 15050 return this._trimAlignValue(valueMouse); 15051 }, 15052 15053 _uiHash: function (index, value, values) { 15054 var uiHash = { 15055 handle: this.handles[index], 15056 handleIndex: index, 15057 value: value !== undefined ? value : this.value() 15058 }; 15059 15060 if (this._hasMultipleValues()) { 15061 uiHash.value = value !== undefined ? value : this.values(index); 15062 uiHash.values = values || this.values(); 15063 } 15064 15065 return uiHash; 15066 }, 15067 15068 _hasMultipleValues: function () { 15069 return this.options.values && this.options.values.length; 15070 }, 15071 15072 _start: function (event, index) { 15073 return this._trigger("start", event, this._uiHash(index)); 15074 }, 15075 15076 _slide: function (event, index, newVal) { 15077 var allowed, otherVal, 15078 currentValue = this.value(), 15079 newValues = this.values(); 15080 15081 if (this._hasMultipleValues()) { 15082 otherVal = this.values(index ? 0 : 1); 15083 currentValue = this.values(index); 15084 15085 if (this.options.values.length === 2 && this.options.range === true) { 15086 newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal); 15087 } 15088 15089 newValues[index] = newVal; 15090 } 15091 15092 if (newVal === currentValue) { 15093 return; 15094 } 15095 15096 allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); 15097 15098 // A slide can be canceled by returning false from the slide callback 15099 if (allowed === false) { 15100 return; 15101 } 15102 15103 if (this._hasMultipleValues()) { 15104 this.values(index, newVal); 15105 } else { 15106 this.value(newVal); 15107 } 15108 }, 15109 15110 _stop: function (event, index) { 15111 this._trigger("stop", event, this._uiHash(index)); 15112 }, 15113 15114 _change: function (event, index) { 15115 if (!this._keySliding && !this._mouseSliding) { 15116 15117 //store the last changed value index for reference when handles overlap 15118 this._lastChangedValue = index; 15119 this._trigger("change", event, this._uiHash(index)); 15120 } 15121 }, 15122 15123 value: function (newValue) { 15124 if (arguments.length) { 15125 this.options.value = this._trimAlignValue(newValue); 15126 this._refreshValue(); 15127 this._change(null, 0); 15128 return; 15129 } 15130 15131 return this._value(); 15132 }, 15133 15134 values: function (index, newValue) { 15135 var vals, 15136 newValues, 15137 i; 15138 15139 if (arguments.length > 1) { 15140 this.options.values[index] = this._trimAlignValue(newValue); 15141 this._refreshValue(); 15142 this._change(null, index); 15143 return; 15144 } 15145 15146 if (arguments.length) { 15147 if (Array.isArray(arguments[0])) { 15148 vals = this.options.values; 15149 newValues = arguments[0]; 15150 for (i = 0; i < vals.length; i += 1) { 15151 vals[i] = this._trimAlignValue(newValues[i]); 15152 this._change(null, i); 15153 } 15154 this._refreshValue(); 15155 } else { 15156 if (this._hasMultipleValues()) { 15157 return this._values(index); 15158 } else { 15159 return this.value(); 15160 } 15161 } 15162 } else { 15163 return this._values(); 15164 } 15165 }, 15166 15167 _setOption: function (key, value) { 15168 var i, 15169 valsLength = 0; 15170 15171 if (key === "range" && this.options.range === true) { 15172 if (value === "min") { 15173 this.options.value = this._values(0); 15174 this.options.values = null; 15175 } else if (value === "max") { 15176 this.options.value = this._values(this.options.values.length - 1); 15177 this.options.values = null; 15178 } 15179 } 15180 15181 if (Array.isArray(this.options.values)) { 15182 valsLength = this.options.values.length; 15183 } 15184 15185 this._super(key, value); 15186 15187 switch (key) { 15188 case "orientation": 15189 this._detectOrientation(); 15190 this._removeClass("ui-slider-horizontal ui-slider-vertical") 15191 ._addClass("ui-slider-" + this.orientation); 15192 this._refreshValue(); 15193 if (this.options.range) { 15194 this._refreshRange(value); 15195 } 15196 15197 // Reset positioning from previous orientation 15198 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 15199 break; 15200 case "value": 15201 this._animateOff = true; 15202 this._refreshValue(); 15203 this._change(null, 0); 15204 this._animateOff = false; 15205 break; 15206 case "values": 15207 this._animateOff = true; 15208 this._refreshValue(); 15209 15210 // Start from the last handle to prevent unreachable handles (#9046) 15211 for (i = valsLength - 1; i >= 0; i--) { 15212 this._change(null, i); 15213 } 15214 this._animateOff = false; 15215 break; 15216 case "step": 15217 case "min": 15218 case "max": 15219 this._animateOff = true; 15220 this._calculateNewMax(); 15221 this._refreshValue(); 15222 this._animateOff = false; 15223 break; 15224 case "range": 15225 this._animateOff = true; 15226 this._refresh(); 15227 this._animateOff = false; 15228 break; 15229 } 15230 }, 15231 15232 _setOptionDisabled: function (value) { 15233 this._super(value); 15234 15235 this._toggleClass(null, "ui-state-disabled", !!value); 15236 }, 15237 15238 //internal value getter 15239 // _value() returns value trimmed by min and max, aligned by step 15240 _value: function () { 15241 var val = this.options.value; 15242 val = this._trimAlignValue(val); 15243 15244 return val; 15245 }, 15246 15247 //internal values getter 15248 // _values() returns array of values trimmed by min and max, aligned by step 15249 // _values( index ) returns single value trimmed by min and max, aligned by step 15250 _values: function (index) { 15251 var val, 15252 vals, 15253 i; 15254 15255 if (arguments.length) { 15256 val = this.options.values[index]; 15257 val = this._trimAlignValue(val); 15258 15259 return val; 15260 } else if (this._hasMultipleValues()) { 15261 15262 // .slice() creates a copy of the array 15263 // this copy gets trimmed by min and max and then returned 15264 vals = this.options.values.slice(); 15265 for (i = 0; i < vals.length; i += 1) { 15266 vals[i] = this._trimAlignValue(vals[i]); 15267 } 15268 15269 return vals; 15270 } else { 15271 return []; 15272 } 15273 }, 15274 15275 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 15276 _trimAlignValue: function (val) { 15277 if (val <= this._valueMin()) { 15278 return this._valueMin(); 15279 } 15280 if (val >= this._valueMax()) { 15281 return this._valueMax(); 15282 } 15283 var step = (this.options.step > 0) ? this.options.step : 1, 15284 valModStep = (val - this._valueMin()) % step, 15285 alignValue = val - valModStep; 15286 15287 if (Math.abs(valModStep) * 2 >= step) { 15288 alignValue += (valModStep > 0) ? step : (-step); 15289 } 15290 15291 // Since JavaScript has problems with large floats, round 15292 // the final value to 5 digits after the decimal point (see #4124) 15293 return parseFloat(alignValue.toFixed(5)); 15294 }, 15295 15296 _calculateNewMax: function () { 15297 var max = this.options.max, 15298 min = this._valueMin(), 15299 step = this.options.step, 15300 aboveMin = Math.round((max - min) / step) * step; 15301 max = aboveMin + min; 15302 if (max > this.options.max) { 15303 15304 //If max is not divisible by step, rounding off may increase its value 15305 max -= step; 15306 } 15307 this.max = parseFloat(max.toFixed(this._precision())); 15308 }, 15309 15310 _precision: function () { 15311 var precision = this._precisionOf(this.options.step); 15312 if (this.options.min !== null) { 15313 precision = Math.max(precision, this._precisionOf(this.options.min)); 15314 } 15315 return precision; 15316 }, 15317 15318 _precisionOf: function (num) { 15319 var str = num.toString(), 15320 decimal = str.indexOf("."); 15321 return decimal === -1 ? 0 : str.length - decimal - 1; 15322 }, 15323 15324 _valueMin: function () { 15325 return this.options.min; 15326 }, 15327 15328 _valueMax: function () { 15329 return this.max; 15330 }, 15331 15332 _refreshRange: function (orientation) { 15333 if (orientation === "vertical") { 15334 this.range.css({ "width": "", "left": "" }); 15335 } 15336 if (orientation === "horizontal") { 15337 this.range.css({ "height": "", "bottom": "" }); 15338 } 15339 }, 15340 15341 _refreshValue: function () { 15342 var lastValPercent, valPercent, value, valueMin, valueMax, 15343 oRange = this.options.range, 15344 o = this.options, 15345 that = this, 15346 animate = (!this._animateOff) ? o.animate : false, 15347 _set = {}; 15348 15349 if (this._hasMultipleValues()) { 15350 this.handles.each(function (i) { 15351 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - 15352 that._valueMin()) * 100; 15353 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 15354 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 15355 if (that.options.range === true) { 15356 if (that.orientation === "horizontal") { 15357 if (i === 0) { 15358 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 15359 left: valPercent + "%" 15360 }, o.animate); 15361 } 15362 if (i === 1) { 15363 that.range[animate ? "animate" : "css"]({ 15364 width: (valPercent - lastValPercent) + "%" 15365 }, { 15366 queue: false, 15367 duration: o.animate 15368 }); 15369 } 15370 } else { 15371 if (i === 0) { 15372 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 15373 bottom: (valPercent) + "%" 15374 }, o.animate); 15375 } 15376 if (i === 1) { 15377 that.range[animate ? "animate" : "css"]({ 15378 height: (valPercent - lastValPercent) + "%" 15379 }, { 15380 queue: false, 15381 duration: o.animate 15382 }); 15383 } 15384 } 15385 } 15386 lastValPercent = valPercent; 15387 }); 15388 } else { 15389 value = this.value(); 15390 valueMin = this._valueMin(); 15391 valueMax = this._valueMax(); 15392 valPercent = (valueMax !== valueMin) ? 15393 (value - valueMin) / (valueMax - valueMin) * 100 : 15394 0; 15395 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 15396 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 15397 15398 if (oRange === "min" && this.orientation === "horizontal") { 15399 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 15400 width: valPercent + "%" 15401 }, o.animate); 15402 } 15403 if (oRange === "max" && this.orientation === "horizontal") { 15404 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 15405 width: (100 - valPercent) + "%" 15406 }, o.animate); 15407 } 15408 if (oRange === "min" && this.orientation === "vertical") { 15409 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 15410 height: valPercent + "%" 15411 }, o.animate); 15412 } 15413 if (oRange === "max" && this.orientation === "vertical") { 15414 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 15415 height: (100 - valPercent) + "%" 15416 }, o.animate); 15417 } 15418 } 15419 }, 15420 15421 _handleEvents: { 15422 keydown: function (event) { 15423 var allowed, curVal, newVal, step, 15424 index = $(event.target).data("ui-slider-handle-index"); 15425 15426 switch (event.keyCode) { 15427 case $.ui.keyCode.HOME: 15428 case $.ui.keyCode.END: 15429 case $.ui.keyCode.PAGE_UP: 15430 case $.ui.keyCode.PAGE_DOWN: 15431 case $.ui.keyCode.UP: 15432 case $.ui.keyCode.RIGHT: 15433 case $.ui.keyCode.DOWN: 15434 case $.ui.keyCode.LEFT: 15435 event.preventDefault(); 15436 if (!this._keySliding) { 15437 this._keySliding = true; 15438 this._addClass($(event.target), null, "ui-state-active"); 15439 allowed = this._start(event, index); 15440 if (allowed === false) { 15441 return; 15442 } 15443 } 15444 break; 15445 } 15446 15447 step = this.options.step; 15448 if (this._hasMultipleValues()) { 15449 curVal = newVal = this.values(index); 15450 } else { 15451 curVal = newVal = this.value(); 15452 } 15453 15454 switch (event.keyCode) { 15455 case $.ui.keyCode.HOME: 15456 newVal = this._valueMin(); 15457 break; 15458 case $.ui.keyCode.END: 15459 newVal = this._valueMax(); 15460 break; 15461 case $.ui.keyCode.PAGE_UP: 15462 newVal = this._trimAlignValue( 15463 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 15464 ); 15465 break; 15466 case $.ui.keyCode.PAGE_DOWN: 15467 newVal = this._trimAlignValue( 15468 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 15469 break; 15470 case $.ui.keyCode.UP: 15471 case $.ui.keyCode.RIGHT: 15472 if (curVal === this._valueMax()) { 15473 return; 15474 } 15475 newVal = this._trimAlignValue(curVal + step); 15476 break; 15477 case $.ui.keyCode.DOWN: 15478 case $.ui.keyCode.LEFT: 15479 if (curVal === this._valueMin()) { 15480 return; 15481 } 15482 newVal = this._trimAlignValue(curVal - step); 15483 break; 15484 } 15485 15486 this._slide(event, index, newVal); 15487 }, 15488 keyup: function (event) { 15489 var index = $(event.target).data("ui-slider-handle-index"); 15490 15491 if (this._keySliding) { 15492 this._keySliding = false; 15493 this._stop(event, index); 15494 this._change(event, index); 15495 this._removeClass($(event.target), null, "ui-state-active"); 15496 } 15497 } 15498 } 15499 }); 15500 15501 15502 /*! 15503 * jQuery UI Sortable 1.13.2 15504 * http://jqueryui.com 15505 * 15506 * Copyright jQuery Foundation and other contributors 15507 * Released under the MIT license. 15508 * http://jquery.org/license 15509 */ 15510 15511 //>>label: Sortable 15512 //>>group: Interactions 15513 //>>description: Enables items in a list to be sorted using the mouse. 15514 //>>docs: http://api.jqueryui.com/sortable/ 15515 //>>demos: http://jqueryui.com/sortable/ 15516 //>>css.structure: ../../themes/base/sortable.css 15517 15518 15519 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 15520 version: "1.13.2", 15521 widgetEventPrefix: "sort", 15522 ready: false, 15523 options: { 15524 appendTo: "parent", 15525 axis: false, 15526 connectWith: false, 15527 containment: false, 15528 cursor: "auto", 15529 cursorAt: false, 15530 dropOnEmpty: true, 15531 forcePlaceholderSize: false, 15532 forceHelperSize: false, 15533 grid: false, 15534 handle: false, 15535 helper: "original", 15536 items: "> *", 15537 opacity: false, 15538 placeholder: false, 15539 revert: false, 15540 scroll: true, 15541 scrollSensitivity: 20, 15542 scrollSpeed: 20, 15543 scope: "default", 15544 tolerance: "intersect", 15545 zIndex: 1000, 15546 15547 // Callbacks 15548 activate: null, 15549 beforeStop: null, 15550 change: null, 15551 deactivate: null, 15552 out: null, 15553 over: null, 15554 receive: null, 15555 remove: null, 15556 sort: null, 15557 start: null, 15558 stop: null, 15559 update: null 15560 }, 15561 15562 _isOverAxis: function (x, reference, size) { 15563 return (x >= reference) && (x < (reference + size)); 15564 }, 15565 15566 _isFloating: function (item) { 15567 return (/left|right/).test(item.css("float")) || 15568 (/inline|table-cell/).test(item.css("display")); 15569 }, 15570 15571 _create: function () { 15572 this.containerCache = {}; 15573 this._addClass("ui-sortable"); 15574 15575 //Get the items 15576 this.refresh(); 15577 15578 //Let's determine the parent's offset 15579 this.offset = this.element.offset(); 15580 15581 //Initialize mouse events for interaction 15582 this._mouseInit(); 15583 15584 this._setHandleClassName(); 15585 15586 //We're ready to go 15587 this.ready = true; 15588 15589 }, 15590 15591 _setOption: function (key, value) { 15592 this._super(key, value); 15593 15594 if (key === "handle") { 15595 this._setHandleClassName(); 15596 } 15597 }, 15598 15599 _setHandleClassName: function () { 15600 var that = this; 15601 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 15602 $.each(this.items, function () { 15603 that._addClass( 15604 this.instance.options.handle ? 15605 this.item.find(this.instance.options.handle) : 15606 this.item, 15607 "ui-sortable-handle" 15608 ); 15609 }); 15610 }, 15611 15612 _destroy: function () { 15613 this._mouseDestroy(); 15614 15615 for (var i = this.items.length - 1; i >= 0; i--) { 15616 this.items[i].item.removeData(this.widgetName + "-item"); 15617 } 15618 15619 return this; 15620 }, 15621 15622 _mouseCapture: function (event, overrideHandle) { 15623 var currentItem = null, 15624 validHandle = false, 15625 that = this; 15626 15627 if (this.reverting) { 15628 return false; 15629 } 15630 15631 if (this.options.disabled || this.options.type === "static") { 15632 return false; 15633 } 15634 15635 //We have to refresh the items data once first 15636 this._refreshItems(event); 15637 15638 //Find out if the clicked node (or one of its parents) is a actual item in this.items 15639 $(event.target).parents().each(function () { 15640 if ($.data(this, that.widgetName + "-item") === that) { 15641 currentItem = $(this); 15642 return false; 15643 } 15644 }); 15645 if ($.data(event.target, that.widgetName + "-item") === that) { 15646 currentItem = $(event.target); 15647 } 15648 15649 if (!currentItem) { 15650 return false; 15651 } 15652 if (this.options.handle && !overrideHandle) { 15653 $(this.options.handle, currentItem).find("*").addBack().each(function () { 15654 if (this === event.target) { 15655 validHandle = true; 15656 } 15657 }); 15658 if (!validHandle) { 15659 return false; 15660 } 15661 } 15662 15663 this.currentItem = currentItem; 15664 this._removeCurrentsFromItems(); 15665 return true; 15666 15667 }, 15668 15669 _mouseStart: function (event, overrideHandle, noActivation) { 15670 15671 var i, body, 15672 o = this.options; 15673 15674 this.currentContainer = this; 15675 15676 //We only need to call refreshPositions, because the refreshItems call has been moved to 15677 // mouseCapture 15678 this.refreshPositions(); 15679 15680 //Prepare the dragged items parent 15681 this.appendTo = $(o.appendTo !== "parent" ? 15682 o.appendTo : 15683 this.currentItem.parent()); 15684 15685 //Create and append the visible helper 15686 this.helper = this._createHelper(event); 15687 15688 //Cache the helper size 15689 this._cacheHelperProportions(); 15690 15691 /* 15692 * - Position generation - 15693 * This block generates everything position related - it's the core of draggables. 15694 */ 15695 15696 //Cache the margins of the original element 15697 this._cacheMargins(); 15698 15699 //The element's absolute position on the page minus margins 15700 this.offset = this.currentItem.offset(); 15701 this.offset = { 15702 top: this.offset.top - this.margins.top, 15703 left: this.offset.left - this.margins.left 15704 }; 15705 15706 $.extend(this.offset, { 15707 click: { //Where the click happened, relative to the element 15708 left: event.pageX - this.offset.left, 15709 top: event.pageY - this.offset.top 15710 }, 15711 15712 // This is a relative to absolute position minus the actual position calculation - 15713 // only used for relative positioned helper 15714 relative: this._getRelativeOffset() 15715 }); 15716 15717 // After we get the helper offset, but before we get the parent offset we can 15718 // change the helper's position to absolute 15719 // TODO: Still need to figure out a way to make relative sorting possible 15720 this.helper.css("position", "absolute"); 15721 this.cssPosition = this.helper.css("position"); 15722 15723 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 15724 if (o.cursorAt) { 15725 this._adjustOffsetFromHelper(o.cursorAt); 15726 } 15727 15728 //Cache the former DOM position 15729 this.domPosition = { 15730 prev: this.currentItem.prev()[0], 15731 parent: this.currentItem.parent()[0] 15732 }; 15733 15734 // If the helper is not the original, hide the original so it's not playing any role during 15735 // the drag, won't cause anything bad this way 15736 if (this.helper[0] !== this.currentItem[0]) { 15737 this.currentItem.hide(); 15738 } 15739 15740 //Create the placeholder 15741 this._createPlaceholder(); 15742 15743 //Get the next scrolling parent 15744 this.scrollParent = this.placeholder.scrollParent(); 15745 15746 $.extend(this.offset, { 15747 parent: this._getParentOffset() 15748 }); 15749 15750 //Set a containment if given in the options 15751 if (o.containment) { 15752 this._setContainment(); 15753 } 15754 15755 if (o.cursor && o.cursor !== "auto") { // cursor option 15756 body = this.document.find("body"); 15757
vendor: 7,064 bytes, lines 15758-15936
15758 // Support: IE 15759 this.storedCursor = body.css("cursor"); 15760 body.css("cursor", o.cursor); 15761 15762 this.storedStylesheet = 15763 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 15764 } 15765 15766 // We need to make sure to grab the zIndex before setting the 15767 // opacity, because setting the opacity to anything lower than 1 15768 // causes the zIndex to change from "auto" to 0. 15769 if (o.zIndex) { // zIndex option 15770 if (this.helper.css("zIndex")) { 15771 this._storedZIndex = this.helper.css("zIndex"); 15772 } 15773 this.helper.css("zIndex", o.zIndex); 15774 } 15775 15776 if (o.opacity) { // opacity option 15777 if (this.helper.css("opacity")) { 15778 this._storedOpacity = this.helper.css("opacity"); 15779 } 15780 this.helper.css("opacity", o.opacity); 15781 } 15782 15783 //Prepare scrolling 15784 if (this.scrollParent[0] !== this.document[0] && 15785 this.scrollParent[0].tagName !== "HTML") { 15786 this.overflowOffset = this.scrollParent.offset(); 15787 } 15788 15789 //Call callbacks 15790 this._trigger("start", event, this._uiHash()); 15791 15792 //Recache the helper size 15793 if (!this._preserveHelperProportions) { 15794 this._cacheHelperProportions(); 15795 } 15796 15797 //Post "activate" events to possible containers 15798 if (!noActivation) { 15799 for (i = this.containers.length - 1; i >= 0; i--) { 15800 this.containers[i]._trigger("activate", event, this._uiHash(this)); 15801 } 15802 } 15803 15804 //Prepare possible droppables 15805 if ($.ui.ddmanager) { 15806 $.ui.ddmanager.current = this; 15807 } 15808 15809 if ($.ui.ddmanager && !o.dropBehaviour) { 15810 $.ui.ddmanager.prepareOffsets(this, event); 15811 } 15812 15813 this.dragging = true; 15814 15815 this._addClass(this.helper, "ui-sortable-helper"); 15816 15817 //Move the helper, if needed 15818 if (!this.helper.parent().is(this.appendTo)) { 15819 this.helper.detach().appendTo(this.appendTo); 15820 15821 //Update position 15822 this.offset.parent = this._getParentOffset(); 15823 } 15824 15825 //Generate the original position 15826 this.position = this.originalPosition = this._generatePosition(event); 15827 this.originalPageX = event.pageX; 15828 this.originalPageY = event.pageY; 15829 this.lastPositionAbs = this.positionAbs = this._convertPositionTo("absolute"); 15830 15831 this._mouseDrag(event); 15832 15833 return true; 15834 15835 }, 15836 15837 _scroll: function (event) { 15838 var o = this.options, 15839 scrolled = false; 15840 15841 if (this.scrollParent[0] !== this.document[0] && 15842 this.scrollParent[0].tagName !== "HTML") { 15843 15844 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 15845 event.pageY < o.scrollSensitivity) { 15846 this.scrollParent[0].scrollTop = 15847 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 15848 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 15849 this.scrollParent[0].scrollTop = 15850 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 15851 } 15852 15853 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 15854 event.pageX < o.scrollSensitivity) { 15855 this.scrollParent[0].scrollLeft = scrolled = 15856 this.scrollParent[0].scrollLeft + o.scrollSpeed; 15857 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 15858 this.scrollParent[0].scrollLeft = scrolled = 15859 this.scrollParent[0].scrollLeft - o.scrollSpeed; 15860 } 15861 15862 } else { 15863 15864 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 15865 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 15866 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 15867 o.scrollSensitivity) { 15868 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 15869 } 15870 15871 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 15872 scrolled = this.document.scrollLeft( 15873 this.document.scrollLeft() - o.scrollSpeed 15874 ); 15875 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 15876 o.scrollSensitivity) { 15877 scrolled = this.document.scrollLeft( 15878 this.document.scrollLeft() + o.scrollSpeed 15879 ); 15880 } 15881 15882 } 15883 15884 return scrolled; 15885 }, 15886 15887 _mouseDrag: function (event) { 15888 var i, item, itemElement, intersection, 15889 o = this.options; 15890 15891 //Compute the helpers position 15892 this.position = this._generatePosition(event); 15893 this.positionAbs = this._convertPositionTo("absolute"); 15894 15895 //Set the helper position 15896 if (!this.options.axis || this.options.axis !== "y") { 15897 this.helper[0].style.left = this.position.left + "px"; 15898 } 15899 if (!this.options.axis || this.options.axis !== "x") { 15900 this.helper[0].style.top = this.position.top + "px"; 15901 } 15902 15903 //Do scrolling 15904 if (o.scroll) { 15905 if (this._scroll(event) !== false) { 15906 15907 //Update item positions used in position checks 15908 this._refreshItemPositions(true); 15909 15910 if ($.ui.ddmanager && !o.dropBehaviour) { 15911 $.ui.ddmanager.prepareOffsets(this, event); 15912 } 15913 } 15914 } 15915 15916 this.dragDirection = { 15917 vertical: this._getDragVerticalDirection(), 15918 horizontal: this._getDragHorizontalDirection() 15919 }; 15920 15921 //Rearrange 15922 for (i = this.items.length - 1; i >= 0; i--) { 15923 15924 //Cache variables and intersection, continue if no intersection 15925 item = this.items[i]; 15926 itemElement = item.item[0]; 15927 intersection = this._intersectsWithPointer(item); 15928 if (!intersection) { 15929 continue; 15930 } 15931 15932 // Only put the placeholder inside the current Container, skip all 15933 // items from other containers. This works because when moving 15934 // an item from one container to another the 15935 // currentContainer is switched before the placeholder is moved. 15936 //
vendor: 24,549 bytes, lines 15937-16554
15937 // Without this, moving items in "sub-sortables" can cause 15938 // the placeholder to jitter between the outer and inner container. 15939 if (item.instance !== this.currentContainer) { 15940 continue; 15941 } 15942 15943 // Cannot intersect with itself 15944 // no useless actions that have been done before 15945 // no action if the item moved is the parent of the item checked 15946 if (itemElement !== this.currentItem[0] && 15947 this.placeholder[intersection === 1 ? 15948 "next" : "prev"]()[0] !== itemElement && 15949 !$.contains(this.placeholder[0], itemElement) && 15950 (this.options.type === "semi-dynamic" ? 15951 !$.contains(this.element[0], itemElement) : 15952 true 15953 ) 15954 ) { 15955 15956 this.direction = intersection === 1 ? "down" : "up"; 15957 15958 if (this.options.tolerance === "pointer" || 15959 this._intersectsWithSides(item)) { 15960 this._rearrange(event, item); 15961 } else { 15962 break; 15963 } 15964 15965 this._trigger("change", event, this._uiHash()); 15966 break; 15967 } 15968 } 15969 15970 //Post events to containers 15971 this._contactContainers(event); 15972 15973 //Interconnect with droppables 15974 if ($.ui.ddmanager) { 15975 $.ui.ddmanager.drag(this, event); 15976 } 15977 15978 //Call callbacks 15979 this._trigger("sort", event, this._uiHash()); 15980 15981 this.lastPositionAbs = this.positionAbs; 15982 return false; 15983 15984 }, 15985 15986 _mouseStop: function (event, noPropagation) { 15987 15988 if (!event) { 15989 return; 15990 } 15991 15992 //If we are using droppables, inform the manager about the drop 15993 if ($.ui.ddmanager && !this.options.dropBehaviour) { 15994 $.ui.ddmanager.drop(this, event); 15995 } 15996 15997 if (this.options.revert) { 15998 var that = this, 15999 cur = this.placeholder.offset(), 16000 axis = this.options.axis, 16001 animation = {}; 16002 16003 if (!axis || axis === "x") { 16004 animation.left = cur.left - this.offset.parent.left - this.margins.left + 16005 (this.offsetParent[0] === this.document[0].body ? 16006 0 : 16007 this.offsetParent[0].scrollLeft 16008 ); 16009 } 16010 if (!axis || axis === "y") { 16011 animation.top = cur.top - this.offset.parent.top - this.margins.top + 16012 (this.offsetParent[0] === this.document[0].body ? 16013 0 : 16014 this.offsetParent[0].scrollTop 16015 ); 16016 } 16017 this.reverting = true; 16018 $(this.helper).animate( 16019 animation, 16020 parseInt(this.options.revert, 10) || 500, 16021 function () { 16022 that._clear(event); 16023 } 16024 ); 16025 } else { 16026 this._clear(event, noPropagation); 16027 } 16028 16029 return false; 16030 16031 }, 16032 16033 cancel: function () { 16034 16035 if (this.dragging) { 16036 16037 this._mouseUp(new $.Event("mouseup", { target: null })); 16038 16039 if (this.options.helper === "original") { 16040 this.currentItem.css(this._storedCSS); 16041 this._removeClass(this.currentItem, "ui-sortable-helper"); 16042 } else { 16043 this.currentItem.show(); 16044 } 16045 16046 //Post deactivating events to containers 16047 for (var i = this.containers.length - 1; i >= 0; i--) { 16048 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 16049 if (this.containers[i].containerCache.over) { 16050 this.containers[i]._trigger("out", null, this._uiHash(this)); 16051 this.containers[i].containerCache.over = 0; 16052 } 16053 } 16054 16055 } 16056 16057 if (this.placeholder) { 16058 16059 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16060 // it unbinds ALL events from the original node! 16061 if (this.placeholder[0].parentNode) { 16062 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 16063 } 16064 if (this.options.helper !== "original" && this.helper && 16065 this.helper[0].parentNode) { 16066 this.helper.remove(); 16067 } 16068 16069 $.extend(this, { 16070 helper: null, 16071 dragging: false, 16072 reverting: false, 16073 _noFinalSort: null 16074 }); 16075 16076 if (this.domPosition.prev) { 16077 $(this.domPosition.prev).after(this.currentItem); 16078 } else { 16079 $(this.domPosition.parent).prepend(this.currentItem); 16080 } 16081 } 16082 16083 return this; 16084 16085 }, 16086 16087 serialize: function (o) { 16088 16089 var items = this._getItemsAsjQuery(o && o.connected), 16090 str = []; 16091 o = o || {}; 16092 16093 $(items).each(function () { 16094 var res = ($(o.item || this).attr(o.attribute || "id") || "") 16095 .match(o.expression || (/(.+)[\-=_](.+)/)); 16096 if (res) { 16097 str.push( 16098 (o.key || res[1] + "[]") + 16099 "=" + (o.key && o.expression ? res[1] : res[2])); 16100 } 16101 }); 16102 16103 if (!str.length && o.key) { 16104 str.push(o.key + "="); 16105 } 16106 16107 return str.join("&"); 16108 16109 }, 16110 16111 toArray: function (o) { 16112 16113 var items = this._getItemsAsjQuery(o && o.connected), 16114 ret = []; 16115 16116 o = o || {}; 16117 16118 items.each(function () { 16119 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 16120 }); 16121 return ret; 16122 16123 }, 16124 16125 /* Be careful with the following core functions */ 16126 _intersectsWith: function (item) { 16127 16128 var x1 = this.positionAbs.left, 16129 x2 = x1 + this.helperProportions.width, 16130 y1 = this.positionAbs.top, 16131 y2 = y1 + this.helperProportions.height, 16132 l = item.left, 16133 r = l + item.width, 16134 t = item.top, 16135 b = t + item.height, 16136 dyClick = this.offset.click.top, 16137 dxClick = this.offset.click.left, 16138 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 16139 (y1 + dyClick) < b), 16140 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 16141 (x1 + dxClick) < r), 16142 isOverElement = isOverElementHeight && isOverElementWidth; 16143 16144 if (this.options.tolerance === "pointer" || 16145 this.options.forcePointerForContainers || 16146 (this.options.tolerance !== "pointer" && 16147 this.helperProportions[this.floating ? "width" : "height"] > 16148 item[this.floating ? "width" : "height"]) 16149 ) { 16150 return isOverElement; 16151 } else { 16152 16153 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 16154 x2 - (this.helperProportions.width / 2) < r && // Left Half 16155 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 16156 y2 - (this.helperProportions.height / 2) < b); // Top Half 16157 16158 } 16159 }, 16160 16161 _intersectsWithPointer: function (item) { 16162 var verticalDirection, horizontalDirection, 16163 isOverElementHeight = (this.options.axis === "x") || 16164 this._isOverAxis( 16165 this.positionAbs.top + this.offset.click.top, item.top, item.height), 16166 isOverElementWidth = (this.options.axis === "y") || 16167 this._isOverAxis( 16168 this.positionAbs.left + this.offset.click.left, item.left, item.width), 16169 isOverElement = isOverElementHeight && isOverElementWidth; 16170 16171 if (!isOverElement) { 16172 return false; 16173 } 16174 16175 verticalDirection = this.dragDirection.vertical; 16176 horizontalDirection = this.dragDirection.horizontal; 16177 16178 return this.floating ? 16179 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) : 16180 (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 16181 16182 }, 16183 16184 _intersectsWithSides: function (item) { 16185 16186 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 16187 this.offset.click.top, item.top + (item.height / 2), item.height), 16188 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 16189 this.offset.click.left, item.left + (item.width / 2), item.width), 16190 verticalDirection = this.dragDirection.vertical, 16191 horizontalDirection = this.dragDirection.horizontal; 16192 16193 if (this.floating && horizontalDirection) { 16194 return ((horizontalDirection === "right" && isOverRightHalf) || 16195 (horizontalDirection === "left" && !isOverRightHalf)); 16196 } else { 16197 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 16198 (verticalDirection === "up" && !isOverBottomHalf)); 16199 } 16200 16201 }, 16202 16203 _getDragVerticalDirection: function () { 16204 var delta = this.positionAbs.top - this.lastPositionAbs.top; 16205 return delta !== 0 && (delta > 0 ? "down" : "up"); 16206 }, 16207 16208 _getDragHorizontalDirection: function () { 16209 var delta = this.positionAbs.left - this.lastPositionAbs.left; 16210 return delta !== 0 && (delta > 0 ? "right" : "left"); 16211 }, 16212 16213 refresh: function (event) { 16214 this._refreshItems(event); 16215 this._setHandleClassName(); 16216 this.refreshPositions(); 16217 return this; 16218 }, 16219 16220 _connectWith: function () { 16221 var options = this.options; 16222 return options.connectWith.constructor === String ? 16223 [options.connectWith] : 16224 options.connectWith; 16225 }, 16226 16227 _getItemsAsjQuery: function (connected) { 16228 16229 var i, j, cur, inst, 16230 items = [], 16231 queries = [], 16232 connectWith = this._connectWith(); 16233 16234 if (connectWith && connected) { 16235 for (i = connectWith.length - 1; i >= 0; i--) { 16236 cur = $(connectWith[i], this.document[0]); 16237 for (j = cur.length - 1; j >= 0; j--) { 16238 inst = $.data(cur[j], this.widgetFullName); 16239 if (inst && inst !== this && !inst.options.disabled) { 16240 queries.push([typeof inst.options.items === "function" ? 16241 inst.options.items.call(inst.element) : 16242 $(inst.options.items, inst.element) 16243 .not(".ui-sortable-helper") 16244 .not(".ui-sortable-placeholder"), inst]); 16245 } 16246 } 16247 } 16248 } 16249 16250 queries.push([typeof this.options.items === "function" ? 16251 this.options.items 16252 .call(this.element, null, { options: this.options, item: this.currentItem }) : 16253 $(this.options.items, this.element) 16254 .not(".ui-sortable-helper") 16255 .not(".ui-sortable-placeholder"), this]); 16256 16257 function addItems() { 16258 items.push(this); 16259 } 16260 for (i = queries.length - 1; i >= 0; i--) { 16261 queries[i][0].each(addItems); 16262 } 16263 16264 return $(items); 16265 16266 }, 16267 16268 _removeCurrentsFromItems: function () { 16269 16270 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 16271 16272 this.items = $.grep(this.items, function (item) { 16273 for (var j = 0; j < list.length; j++) { 16274 if (list[j] === item.item[0]) { 16275 return false; 16276 } 16277 } 16278 return true; 16279 }); 16280 16281 }, 16282 16283 _refreshItems: function (event) { 16284 16285 this.items = []; 16286 this.containers = [this]; 16287 16288 var i, j, cur, inst, targetData, _queries, item, queriesLength, 16289 items = this.items, 16290 queries = [[typeof this.options.items === "function" ? 16291 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 16292 $(this.options.items, this.element), this]], 16293 connectWith = this._connectWith(); 16294 16295 //Shouldn't be run the first time through due to massive slow-down 16296 if (connectWith && this.ready) { 16297 for (i = connectWith.length - 1; i >= 0; i--) { 16298 cur = $(connectWith[i], this.document[0]); 16299 for (j = cur.length - 1; j >= 0; j--) { 16300 inst = $.data(cur[j], this.widgetFullName); 16301 if (inst && inst !== this && !inst.options.disabled) { 16302 queries.push([typeof inst.options.items === "function" ? 16303 inst.options.items 16304 .call(inst.element[0], event, { item: this.currentItem }) : 16305 $(inst.options.items, inst.element), inst]); 16306 this.containers.push(inst); 16307 } 16308 } 16309 } 16310 } 16311 16312 for (i = queries.length - 1; i >= 0; i--) { 16313 targetData = queries[i][1]; 16314 _queries = queries[i][0]; 16315 16316 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 16317 item = $(_queries[j]); 16318 16319 // Data for target checking (mouse manager) 16320 item.data(this.widgetName + "-item", targetData); 16321 16322 items.push({ 16323 item: item, 16324 instance: targetData, 16325 width: 0, height: 0, 16326 left: 0, top: 0 16327 }); 16328 } 16329 } 16330 16331 }, 16332 16333 _refreshItemPositions: function (fast) { 16334 var i, item, t, p; 16335 16336 for (i = this.items.length - 1; i >= 0; i--) { 16337 item = this.items[i]; 16338 16339 //We ignore calculating positions of all connected containers when we're not over them 16340 if (this.currentContainer && item.instance !== this.currentContainer && 16341 item.item[0] !== this.currentItem[0]) { 16342 continue; 16343 } 16344 16345 t = this.options.toleranceElement ? 16346 $(this.options.toleranceElement, item.item) : 16347 item.item; 16348 16349 if (!fast) { 16350 item.width = t.outerWidth(); 16351 item.height = t.outerHeight(); 16352 } 16353 16354 p = t.offset(); 16355 item.left = p.left; 16356 item.top = p.top; 16357 } 16358 }, 16359 16360 refreshPositions: function (fast) { 16361 16362 // Determine whether items are being displayed horizontally 16363 this.floating = this.items.length ? 16364 this.options.axis === "x" || this._isFloating(this.items[0].item) : 16365 false; 16366 16367 // This has to be redone because due to the item being moved out/into the offsetParent, 16368 // the offsetParent's position will change 16369 if (this.offsetParent && this.helper) { 16370 this.offset.parent = this._getParentOffset(); 16371 } 16372 16373 this._refreshItemPositions(fast); 16374 16375 var i, p; 16376 16377 if (this.options.custom && this.options.custom.refreshContainers) { 16378 this.options.custom.refreshContainers.call(this); 16379 } else { 16380 for (i = this.containers.length - 1; i >= 0; i--) { 16381 p = this.containers[i].element.offset(); 16382 this.containers[i].containerCache.left = p.left; 16383 this.containers[i].containerCache.top = p.top; 16384 this.containers[i].containerCache.width = 16385 this.containers[i].element.outerWidth(); 16386 this.containers[i].containerCache.height = 16387 this.containers[i].element.outerHeight(); 16388 } 16389 } 16390 16391 return this; 16392 }, 16393 16394 _createPlaceholder: function (that) { 16395 that = that || this; 16396 var className, nodeName, 16397 o = that.options; 16398 16399 if (!o.placeholder || o.placeholder.constructor === String) { 16400 className = o.placeholder; 16401 nodeName = that.currentItem[0].nodeName.toLowerCase(); 16402 o.placeholder = { 16403 element: function () { 16404 16405 var element = $("<" + nodeName + ">", that.document[0]); 16406 16407 that._addClass(element, "ui-sortable-placeholder", 16408 className || that.currentItem[0].className) 16409 ._removeClass(element, "ui-sortable-helper"); 16410 16411 if (nodeName === "tbody") { 16412 that._createTrPlaceholder( 16413 that.currentItem.find("tr").eq(0), 16414 $("<tr>", that.document[0]).appendTo(element) 16415 ); 16416 } else if (nodeName === "tr") { 16417 that._createTrPlaceholder(that.currentItem, element); 16418 } else if (nodeName === "img") { 16419 element.attr("src", that.currentItem.attr("src")); 16420 } 16421 16422 if (!className) { 16423 element.css("visibility", "hidden"); 16424 } 16425 16426 return element; 16427 }, 16428 update: function (container, p) { 16429 16430 // 1. If a className is set as 'placeholder option, we don't force sizes - 16431 // the class is responsible for that 16432 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 16433 // class name is specified 16434 if (className && !o.forcePlaceholderSize) { 16435 return; 16436 } 16437 16438 // If the element doesn't have a actual height or width by itself (without 16439 // styles coming from a stylesheet), it receives the inline height and width 16440 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 16441 // anyway since we're populating them with <td>s above, but they're unlikely to 16442 // be the correct height on their own if the row heights are dynamic, so we'll 16443 // always assign the height of the dragged item given forcePlaceholderSize 16444 // is true. 16445 if (!p.height() || (o.forcePlaceholderSize && 16446 (nodeName === "tbody" || nodeName === "tr"))) { 16447 p.height( 16448 that.currentItem.innerHeight() - 16449 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 16450 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 16451 } 16452 if (!p.width()) { 16453 p.width( 16454 that.currentItem.innerWidth() - 16455 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 16456 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 16457 } 16458 } 16459 }; 16460 } 16461 16462 //Create the placeholder 16463 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 16464 16465 //Append it after the actual current item 16466 that.currentItem.after(that.placeholder); 16467 16468 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 16469 o.placeholder.update(that, that.placeholder); 16470 16471 }, 16472 16473 _createTrPlaceholder: function (sourceTr, targetTr) { 16474 var that = this; 16475 16476 sourceTr.children().each(function () { 16477 $("<td> </td>", that.document[0]) 16478 .attr("colspan", $(this).attr("colspan") || 1) 16479 .appendTo(targetTr); 16480 }); 16481 }, 16482 16483 _contactContainers: function (event) { 16484 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 16485 floating, axis, 16486 innermostContainer = null, 16487 innermostIndex = null; 16488 16489 // Get innermost container that intersects with item 16490 for (i = this.containers.length - 1; i >= 0; i--) { 16491 16492 // Never consider a container that's located within the item itself 16493 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 16494 continue; 16495 } 16496 16497 if (this._intersectsWith(this.containers[i].containerCache)) { 16498 16499 // If we've already found a container and it's more "inner" than this, then continue 16500 if (innermostContainer && 16501 $.contains( 16502 this.containers[i].element[0], 16503 innermostContainer.element[0])) { 16504 continue; 16505 } 16506 16507 innermostContainer = this.containers[i]; 16508 innermostIndex = i; 16509 16510 } else { 16511 16512 // container doesn't intersect. trigger "out" event if necessary 16513 if (this.containers[i].containerCache.over) { 16514 this.containers[i]._trigger("out", event, this._uiHash(this)); 16515 this.containers[i].containerCache.over = 0; 16516 } 16517 } 16518 16519 } 16520 16521 // If no intersecting containers found, return 16522 if (!innermostContainer) { 16523 return; 16524 } 16525 16526 // Move the item into the container if it's not there already 16527 if (this.containers.length === 1) { 16528 if (!this.containers[innermostIndex].containerCache.over) { 16529 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 16530 this.containers[innermostIndex].containerCache.over = 1; 16531 } 16532 } else { 16533 16534 // When entering a new container, we will find the item with the least distance and 16535 // append our item near it 16536 dist = 10000; 16537 itemWithLeastDistance = null; 16538 floating = innermostContainer.floating || this._isFloating(this.currentItem); 16539 posProperty = floating ? "left" : "top"; 16540 sizeProperty = floating ? "width" : "height"; 16541 axis = floating ? "pageX" : "pageY"; 16542 16543 for (j = this.items.length - 1; j >= 0; j--) { 16544 if (!$.contains( 16545 this.containers[innermostIndex].element[0], this.items[j].item[0]) 16546 ) { 16547 continue; 16548 } 16549 if (this.items[j].item[0] === this.currentItem[0]) { 16550 continue; 16551 } 16552 16553 cur = this.items[j].item.offset()[posProperty]; 16554 nearBottom = false;
vendor: 10,930 bytes, lines 16555-16807
16555 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 16556 nearBottom = true; 16557 } 16558 16559 if (Math.abs(event[axis] - cur) < dist) { 16560 dist = Math.abs(event[axis] - cur); 16561 itemWithLeastDistance = this.items[j]; 16562 this.direction = nearBottom ? "up" : "down"; 16563 } 16564 } 16565 16566 //Check if dropOnEmpty is enabled 16567 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 16568 return; 16569 } 16570 16571 if (this.currentContainer === this.containers[innermostIndex]) { 16572 if (!this.currentContainer.containerCache.over) { 16573 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 16574 this.currentContainer.containerCache.over = 1; 16575 } 16576 return; 16577 } 16578 16579 if (itemWithLeastDistance) { 16580 this._rearrange(event, itemWithLeastDistance, null, true); 16581 } else { 16582 this._rearrange(event, null, this.containers[innermostIndex].element, true); 16583 } 16584 this._trigger("change", event, this._uiHash()); 16585 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 16586 this.currentContainer = this.containers[innermostIndex]; 16587 16588 //Update the placeholder 16589 this.options.placeholder.update(this.currentContainer, this.placeholder); 16590 16591 //Update scrollParent 16592 this.scrollParent = this.placeholder.scrollParent(); 16593 16594 //Update overflowOffset 16595 if (this.scrollParent[0] !== this.document[0] && 16596 this.scrollParent[0].tagName !== "HTML") { 16597 this.overflowOffset = this.scrollParent.offset(); 16598 } 16599 16600 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 16601 this.containers[innermostIndex].containerCache.over = 1; 16602 } 16603 16604 }, 16605 16606 _createHelper: function (event) { 16607 16608 var o = this.options, 16609 helper = typeof o.helper === "function" ? 16610 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 16611 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 16612 16613 //Add the helper to the DOM if that didn't happen already 16614 if (!helper.parents("body").length) { 16615 this.appendTo[0].appendChild(helper[0]); 16616 } 16617 16618 if (helper[0] === this.currentItem[0]) { 16619 this._storedCSS = { 16620 width: this.currentItem[0].style.width, 16621 height: this.currentItem[0].style.height, 16622 position: this.currentItem.css("position"), 16623 top: this.currentItem.css("top"), 16624 left: this.currentItem.css("left") 16625 }; 16626 } 16627 16628 if (!helper[0].style.width || o.forceHelperSize) { 16629 helper.width(this.currentItem.width()); 16630 } 16631 if (!helper[0].style.height || o.forceHelperSize) { 16632 helper.height(this.currentItem.height()); 16633 } 16634 16635 return helper; 16636 16637 }, 16638 16639 _adjustOffsetFromHelper: function (obj) { 16640 if (typeof obj === "string") { 16641 obj = obj.split(" "); 16642 } 16643 if (Array.isArray(obj)) { 16644 obj = { left: +obj[0], top: +obj[1] || 0 }; 16645 } 16646 if ("left" in obj) { 16647 this.offset.click.left = obj.left + this.margins.left; 16648 } 16649 if ("right" in obj) { 16650 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 16651 } 16652 if ("top" in obj) { 16653 this.offset.click.top = obj.top + this.margins.top; 16654 } 16655 if ("bottom" in obj) { 16656 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 16657 } 16658 }, 16659 16660 _getParentOffset: function () { 16661 16662 //Get the offsetParent and cache its position 16663 this.offsetParent = this.helper.offsetParent(); 16664 var po = this.offsetParent.offset(); 16665 16666 // This is a special case where we need to modify a offset calculated on start, since the 16667 // following happened: 16668 // 1. The position of the helper is absolute, so it's position is calculated based on the 16669 // next positioned parent 16670 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 16671 // the document, which means that the scroll is included in the initial calculation of the 16672 // offset of the parent, and never recalculated upon drag 16673 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 16674 $.contains(this.scrollParent[0], this.offsetParent[0])) { 16675 po.left += this.scrollParent.scrollLeft(); 16676 po.top += this.scrollParent.scrollTop(); 16677 } 16678 16679 // This needs to be actually done for all browsers, since pageX/pageY includes this 16680 // information with an ugly IE fix 16681 if (this.offsetParent[0] === this.document[0].body || 16682 (this.offsetParent[0].tagName && 16683 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 16684 po = { top: 0, left: 0 }; 16685 } 16686 16687 return { 16688 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 16689 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 16690 }; 16691 16692 }, 16693 16694 _getRelativeOffset: function () { 16695 16696 if (this.cssPosition === "relative") { 16697 var p = this.currentItem.position(); 16698 return { 16699 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 16700 this.scrollParent.scrollTop(), 16701 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 16702 this.scrollParent.scrollLeft() 16703 }; 16704 } else { 16705 return { top: 0, left: 0 }; 16706 } 16707 16708 }, 16709 16710 _cacheMargins: function () { 16711 this.margins = { 16712 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 16713 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 16714 }; 16715 }, 16716 16717 _cacheHelperProportions: function () { 16718 this.helperProportions = { 16719 width: this.helper.outerWidth(), 16720 height: this.helper.outerHeight() 16721 }; 16722 }, 16723 16724 _setContainment: function () { 16725 16726 var ce, co, over, 16727 o = this.options; 16728 if (o.containment === "parent") { 16729 o.containment = this.helper[0].parentNode; 16730 } 16731 if (o.containment === "document" || o.containment === "window") { 16732 this.containment = [ 16733 0 - this.offset.relative.left - this.offset.parent.left, 16734 0 - this.offset.relative.top - this.offset.parent.top, 16735 o.containment === "document" ? 16736 this.document.width() : 16737 this.window.width() - this.helperProportions.width - this.margins.left, 16738 (o.containment === "document" ? 16739 (this.document.height() || document.body.parentNode.scrollHeight) : 16740 this.window.height() || this.document[0].body.parentNode.scrollHeight 16741 ) - this.helperProportions.height - this.margins.top 16742 ]; 16743 } 16744 16745 if (!(/^(document|window|parent)$/).test(o.containment)) { 16746 ce = $(o.containment)[0]; 16747 co = $(o.containment).offset(); 16748 over = ($(ce).css("overflow") !== "hidden"); 16749 16750 this.containment = [ 16751 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 16752 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 16753 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 16754 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 16755 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 16756 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 16757 (parseInt($(ce).css("paddingRight"), 10) || 0) - 16758 this.helperProportions.width - this.margins.left, 16759 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 16760 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 16761 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 16762 this.helperProportions.height - this.margins.top 16763 ]; 16764 } 16765 16766 }, 16767 16768 _convertPositionTo: function (d, pos) { 16769 16770 if (!pos) { 16771 pos = this.position; 16772 } 16773 var mod = d === "absolute" ? 1 : -1, 16774 scroll = this.cssPosition === "absolute" && 16775 !(this.scrollParent[0] !== this.document[0] && 16776 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 16777 this.offsetParent : 16778 this.scrollParent, 16779 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 16780 16781 return { 16782 top: ( 16783 16784 // The absolute mouse position 16785 pos.top + 16786 16787 // Only for relative positioned nodes: Relative offset from element to offset parent 16788 this.offset.relative.top * mod + 16789 16790 // The offsetParent's offset without borders (offset + border) 16791 this.offset.parent.top * mod - 16792 ((this.cssPosition === "fixed" ? 16793 -this.scrollParent.scrollTop() : 16794 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 16795 ), 16796 left: ( 16797 16798 // The absolute mouse position 16799 pos.left + 16800 16801 // Only for relative positioned nodes: Relative offset from element to offset parent 16802 this.offset.relative.left * mod + 16803 16804 // The offsetParent's offset without borders (offset + border) 16805 this.offset.parent.left * mod - 16806 ((this.cssPosition === "fixed" ? 16807 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 5,942 bytes, lines 16808-16942
16808 scroll.scrollLeft()) * mod) 16809 ) 16810 }; 16811 16812 }, 16813 16814 _generatePosition: function (event) { 16815 16816 var top, left, 16817 o = this.options, 16818 pageX = event.pageX, 16819 pageY = event.pageY, 16820 scroll = this.cssPosition === "absolute" && 16821 !(this.scrollParent[0] !== this.document[0] && 16822 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 16823 this.offsetParent : 16824 this.scrollParent, 16825 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 16826 16827 // This is another very weird special case that only happens for relative elements: 16828 // 1. If the css position is relative 16829 // 2. and the scroll parent is the document or similar to the offset parent 16830 // we have to refresh the relative offset during the scroll so there are no jumps 16831 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 16832 this.scrollParent[0] !== this.offsetParent[0])) { 16833 this.offset.relative = this._getRelativeOffset(); 16834 } 16835 16836 /* 16837 * - Position constraining - 16838 * Constrain the position to a mix of grid, containment. 16839 */ 16840 16841 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 16842 16843 if (this.containment) { 16844 if (event.pageX - this.offset.click.left < this.containment[0]) { 16845 pageX = this.containment[0] + this.offset.click.left; 16846 } 16847 if (event.pageY - this.offset.click.top < this.containment[1]) { 16848 pageY = this.containment[1] + this.offset.click.top; 16849 } 16850 if (event.pageX - this.offset.click.left > this.containment[2]) { 16851 pageX = this.containment[2] + this.offset.click.left; 16852 } 16853 if (event.pageY - this.offset.click.top > this.containment[3]) { 16854 pageY = this.containment[3] + this.offset.click.top; 16855 } 16856 } 16857 16858 if (o.grid) { 16859 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 16860 o.grid[1]) * o.grid[1]; 16861 pageY = this.containment ? 16862 ((top - this.offset.click.top >= this.containment[1] && 16863 top - this.offset.click.top <= this.containment[3]) ? 16864 top : 16865 ((top - this.offset.click.top >= this.containment[1]) ? 16866 top - o.grid[1] : top + o.grid[1])) : 16867 top; 16868 16869 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 16870 o.grid[0]) * o.grid[0]; 16871 pageX = this.containment ? 16872 ((left - this.offset.click.left >= this.containment[0] && 16873 left - this.offset.click.left <= this.containment[2]) ? 16874 left : 16875 ((left - this.offset.click.left >= this.containment[0]) ? 16876 left - o.grid[0] : left + o.grid[0])) : 16877 left; 16878 } 16879 16880 } 16881 16882 return { 16883 top: ( 16884 16885 // The absolute mouse position 16886 pageY - 16887 16888 // Click offset (relative to the element) 16889 this.offset.click.top - 16890 16891 // Only for relative positioned nodes: Relative offset from element to offset parent 16892 this.offset.relative.top - 16893 16894 // The offsetParent's offset without borders (offset + border) 16895 this.offset.parent.top + 16896 ((this.cssPosition === "fixed" ? 16897 -this.scrollParent.scrollTop() : 16898 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 16899 ), 16900 left: ( 16901 16902 // The absolute mouse position 16903 pageX - 16904 16905 // Click offset (relative to the element) 16906 this.offset.click.left - 16907 16908 // Only for relative positioned nodes: Relative offset from element to offset parent 16909 this.offset.relative.left - 16910 16911 // The offsetParent's offset without borders (offset + border) 16912 this.offset.parent.left + 16913 ((this.cssPosition === "fixed" ? 16914 -this.scrollParent.scrollLeft() : 16915 scrollIsRootNode ? 0 : scroll.scrollLeft())) 16916 ) 16917 }; 16918 16919 }, 16920 16921 _rearrange: function (event, i, a, hardRefresh) { 16922 16923 if (a) { 16924 a[0].appendChild(this.placeholder[0]); 16925 } else { 16926 i.item[0].parentNode.insertBefore(this.placeholder[0], 16927 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 16928 } 16929 16930 //Various things done here to improve the performance: 16931 // 1. we create a setTimeout, that calls refreshPositions 16932 // 2. on the instance, we have a counter variable, that get's higher after every append 16933 // 3. on the local scope, we copy the counter variable, and check in the timeout, 16934 // if it's still the same 16935 // 4. this lets only the last addition to the timeout stack through 16936 this.counter = this.counter ? ++this.counter : 1; 16937 var counter = this.counter; 16938 16939 this._delay(function () { 16940 if (counter === this.counter) { 16941 16942 //Precompute after each DOM insertion, NOT on mousemove
vendor: 4,193 bytes, lines 16943-17042
16943 this.refreshPositions(!hardRefresh); 16944 } 16945 }); 16946 16947 }, 16948 16949 _clear: function (event, noPropagation) { 16950 16951 this.reverting = false; 16952 16953 // We delay all events that have to be triggered to after the point where the placeholder 16954 // has been removed and everything else normalized again 16955 var i, 16956 delayedTriggers = []; 16957 16958 // We first have to update the dom position of the actual currentItem 16959 // Note: don't do it if the current item is already removed (by a user), or it gets 16960 // reappended (see #4088) 16961 if (!this._noFinalSort && this.currentItem.parent().length) { 16962 this.placeholder.before(this.currentItem); 16963 } 16964 this._noFinalSort = null; 16965 16966 if (this.helper[0] === this.currentItem[0]) { 16967 for (i in this._storedCSS) { 16968 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 16969 this._storedCSS[i] = ""; 16970 } 16971 } 16972 this.currentItem.css(this._storedCSS); 16973 this._removeClass(this.currentItem, "ui-sortable-helper"); 16974 } else { 16975 this.currentItem.show(); 16976 } 16977 16978 if (this.fromOutside && !noPropagation) { 16979 delayedTriggers.push(function (event) { 16980 this._trigger("receive", event, this._uiHash(this.fromOutside)); 16981 }); 16982 } 16983 if ((this.fromOutside || 16984 this.domPosition.prev !== 16985 this.currentItem.prev().not(".ui-sortable-helper")[0] || 16986 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 16987 16988 // Trigger update callback if the DOM position has changed 16989 delayedTriggers.push(function (event) { 16990 this._trigger("update", event, this._uiHash()); 16991 }); 16992 } 16993 16994 // Check if the items Container has Changed and trigger appropriate 16995 // events. 16996 if (this !== this.currentContainer) { 16997 if (!noPropagation) { 16998 delayedTriggers.push(function (event) { 16999 this._trigger("remove", event, this._uiHash()); 17000 }); 17001 delayedTriggers.push((function (c) { 17002 return function (event) { 17003 c._trigger("receive", event, this._uiHash(this)); 17004 }; 17005 }).call(this, this.currentContainer)); 17006 delayedTriggers.push((function (c) { 17007 return function (event) { 17008 c._trigger("update", event, this._uiHash(this)); 17009 }; 17010 }).call(this, this.currentContainer)); 17011 } 17012 } 17013 17014 //Post events to containers 17015 function delayEvent(type, instance, container) { 17016 return function (event) { 17017 container._trigger(type, event, instance._uiHash(instance)); 17018 }; 17019 } 17020 for (i = this.containers.length - 1; i >= 0; i--) { 17021 if (!noPropagation) { 17022 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 17023 } 17024 if (this.containers[i].containerCache.over) { 17025 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 17026 this.containers[i].containerCache.over = 0; 17027 } 17028 } 17029 17030 //Do what was originally in plugins 17031 if (this.storedCursor) { 17032 this.document.find("body").css("cursor", this.storedCursor); 17033 this.storedStylesheet.remove(); 17034 } 17035 if (this._storedOpacity) { 17036 this.helper.css("opacity", this._storedOpacity); 17037 } 17038 if (this._storedZIndex) { 17039 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 17040 } 17041 17042 this.dragging = false;
vendor: 4,782 bytes, lines 17043-17197
17043 17044 if (!noPropagation) { 17045 this._trigger("beforeStop", event, this._uiHash()); 17046 } 17047 17048 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 17049 // it unbinds ALL events from the original node! 17050 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 17051 17052 if (!this.cancelHelperRemoval) { 17053 if (this.helper[0] !== this.currentItem[0]) { 17054 this.helper.remove(); 17055 } 17056 this.helper = null; 17057 } 17058 17059 if (!noPropagation) { 17060 for (i = 0; i < delayedTriggers.length; i++) { 17061 17062 // Trigger all delayed events 17063 delayedTriggers[i].call(this, event); 17064 } 17065 this._trigger("stop", event, this._uiHash()); 17066 } 17067 17068 this.fromOutside = false; 17069 return !this.cancelHelperRemoval; 17070 17071 }, 17072 17073 _trigger: function () { 17074 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 17075 this.cancel(); 17076 } 17077 }, 17078 17079 _uiHash: function (_inst) { 17080 var inst = _inst || this; 17081 return { 17082 helper: inst.helper, 17083 placeholder: inst.placeholder || $([]), 17084 position: inst.position, 17085 originalPosition: inst.originalPosition, 17086 offset: inst.positionAbs, 17087 item: inst.currentItem, 17088 sender: _inst ? _inst.element : null 17089 }; 17090 } 17091 17092 }); 17093 17094 17095 /*! 17096 * jQuery UI Spinner 1.13.2 17097 * http://jqueryui.com 17098 * 17099 * Copyright jQuery Foundation and other contributors 17100 * Released under the MIT license. 17101 * http://jquery.org/license 17102 */ 17103 17104 //>>label: Spinner 17105 //>>group: Widgets 17106 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 17107 //>>docs: http://api.jqueryui.com/spinner/ 17108 //>>demos: http://jqueryui.com/spinner/ 17109 //>>css.structure: ../../themes/base/core.css 17110 //>>css.structure: ../../themes/base/spinner.css 17111 //>>css.theme: ../../themes/base/theme.css 17112 17113 17114 function spinnerModifier(fn) { 17115 return function () { 17116 var previous = this.element.val(); 17117 fn.apply(this, arguments); 17118 this._refresh(); 17119 if (previous !== this.element.val()) { 17120 this._trigger("change"); 17121 } 17122 }; 17123 } 17124 17125 $.widget("ui.spinner", { 17126 version: "1.13.2", 17127 defaultElement: "<input>", 17128 widgetEventPrefix: "spin", 17129 options: { 17130 classes: { 17131 "ui-spinner": "ui-corner-all", 17132 "ui-spinner-down": "ui-corner-br", 17133 "ui-spinner-up": "ui-corner-tr" 17134 }, 17135 culture: null, 17136 icons: { 17137 down: "ui-icon-triangle-1-s", 17138 up: "ui-icon-triangle-1-n" 17139 }, 17140 incremental: true, 17141 max: null, 17142 min: null, 17143 numberFormat: null, 17144 page: 10, 17145 step: 1, 17146 17147 change: null, 17148 spin: null, 17149 start: null, 17150 stop: null 17151 }, 17152 17153 _create: function () { 17154 17155 // handle string values that need to be parsed 17156 this._setOption("max", this.options.max); 17157 this._setOption("min", this.options.min); 17158 this._setOption("step", this.options.step); 17159 17160 // Only format if there is a value, prevents the field from being marked 17161 // as invalid in Firefox, see #9573. 17162 if (this.value() !== "") { 17163 17164 // Format the value, but don't constrain. 17165 this._value(this.element.val(), true); 17166 } 17167 17168 this._draw(); 17169 this._on(this._events); 17170 this._refresh(); 17171 17172 // Turning off autocomplete prevents the browser from remembering the 17173 // value when navigating through history, so we re-enable autocomplete 17174 // if the page is unloaded before the widget is destroyed. #7790 17175 this._on(this.window, { 17176 beforeunload: function () { 17177 this.element.removeAttr("autocomplete"); 17178 } 17179 }); 17180 }, 17181 17182 _getCreateOptions: function () { 17183 var options = this._super(); 17184 var element = this.element; 17185 17186 $.each(["min", "max", "step"], function (i, option) { 17187 var value = element.attr(option); 17188 if (value != null && value.length) { 17189 options[option] = value; 17190 } 17191 }); 17192 17193 return options; 17194 }, 17195 17196 _events: { 17197 keydown: function (event) {
vendor: 4,426 bytes, lines 17198-17305
17198 if (this._start(event) && this._keydown(event)) { 17199 event.preventDefault(); 17200 } 17201 }, 17202 keyup: "_stop", 17203 focus: function () { 17204 this.previous = this.element.val(); 17205 }, 17206 blur: function (event) { 17207 if (this.cancelBlur) { 17208 delete this.cancelBlur; 17209 return; 17210 } 17211 17212 this._stop(); 17213 this._refresh(); 17214 if (this.previous !== this.element.val()) { 17215 this._trigger("change", event); 17216 } 17217 }, 17218 mousewheel: function (event, delta) { 17219 var activeElement = $.ui.safeActiveElement(this.document[0]); 17220 var isActive = this.element[0] === activeElement; 17221 17222 if (!isActive || !delta) { 17223 return; 17224 } 17225 17226 if (!this.spinning && !this._start(event)) { 17227 return false; 17228 } 17229 17230 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 17231 clearTimeout(this.mousewheelTimer); 17232 this.mousewheelTimer = this._delay(function () { 17233 if (this.spinning) { 17234 this._stop(event); 17235 } 17236 }, 100); 17237 event.preventDefault(); 17238 }, 17239 "mousedown .ui-spinner-button": function (event) { 17240 var previous; 17241 17242 // We never want the buttons to have focus; whenever the user is 17243 // interacting with the spinner, the focus should be on the input. 17244 // If the input is focused then this.previous is properly set from 17245 // when the input first received focus. If the input is not focused 17246 // then we need to set this.previous based on the value before spinning. 17247 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 17248 this.previous : this.element.val(); 17249 function checkFocus() { 17250 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 17251 if (!isActive) { 17252 this.element.trigger("focus"); 17253 this.previous = previous; 17254 17255 // support: IE 17256 // IE sets focus asynchronously, so we need to check if focus 17257 // moved off of the input because the user clicked on the button. 17258 this._delay(function () { 17259 this.previous = previous; 17260 }); 17261 } 17262 } 17263 17264 // Ensure focus is on (or stays on) the text field 17265 event.preventDefault(); 17266 checkFocus.call(this); 17267 17268 // Support: IE 17269 // IE doesn't prevent moving focus even with event.preventDefault() 17270 // so we set a flag to know when we should ignore the blur event 17271 // and check (again) if focus moved off of the input. 17272 this.cancelBlur = true; 17273 this._delay(function () { 17274 delete this.cancelBlur; 17275 checkFocus.call(this); 17276 }); 17277 17278 if (this._start(event) === false) { 17279 return; 17280 } 17281 17282 this._repeat(null, $(event.currentTarget) 17283 .hasClass("ui-spinner-up") ? 1 : -1, event); 17284 }, 17285 "mouseup .ui-spinner-button": "_stop", 17286 "mouseenter .ui-spinner-button": function (event) { 17287 17288 // button will add ui-state-active if mouse was down while mouseleave and kept down 17289 if (!$(event.currentTarget).hasClass("ui-state-active")) { 17290 return; 17291 } 17292 17293 if (this._start(event) === false) { 17294 return false; 17295 } 17296 this._repeat(null, $(event.currentTarget) 17297 .hasClass("ui-spinner-up") ? 1 : -1, event); 17298 }, 17299 17300 // TODO: do we really want to consider this a stop? 17301 // shouldn't we just stop the repeater and wait until mouseup before 17302 // we trigger the stop event? 17303 "mouseleave .ui-spinner-button": "_stop" 17304 }, 17305
vendor: 5,727 bytes, lines 17306-17482
17306 // Support mobile enhanced option and make backcompat more sane 17307 _enhance: function () { 17308 this.uiSpinner = this.element 17309 .attr("autocomplete", "off") 17310 .wrap("<span>") 17311 .parent() 17312 17313 // Add buttons 17314 .append( 17315 "<a></a><a></a>" 17316 ); 17317 }, 17318 17319 _draw: function () { 17320 this._enhance(); 17321 17322 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 17323 this._addClass("ui-spinner-input"); 17324 17325 this.element.attr("role", "spinbutton"); 17326 17327 // Button bindings 17328 this.buttons = this.uiSpinner.children("a") 17329 .attr("tabIndex", -1) 17330 .attr("aria-hidden", true) 17331 .button({ 17332 classes: { 17333 "ui-button": "" 17334 } 17335 }); 17336 17337 // TODO: Right now button does not support classes this is already updated in button PR 17338 this._removeClass(this.buttons, "ui-corner-all"); 17339 17340 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 17341 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 17342 this.buttons.first().button({ 17343 "icon": this.options.icons.up, 17344 "showLabel": false 17345 }); 17346 this.buttons.last().button({ 17347 "icon": this.options.icons.down, 17348 "showLabel": false 17349 }); 17350 17351 // IE 6 doesn't understand height: 50% for the buttons 17352 // unless the wrapper has an explicit height 17353 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 17354 this.uiSpinner.height() > 0) { 17355 this.uiSpinner.height(this.uiSpinner.height()); 17356 } 17357 }, 17358 17359 _keydown: function (event) { 17360 var options = this.options, 17361 keyCode = $.ui.keyCode; 17362 17363 switch (event.keyCode) { 17364 case keyCode.UP: 17365 this._repeat(null, 1, event); 17366 return true; 17367 case keyCode.DOWN: 17368 this._repeat(null, -1, event); 17369 return true; 17370 case keyCode.PAGE_UP: 17371 this._repeat(null, options.page, event); 17372 return true; 17373 case keyCode.PAGE_DOWN: 17374 this._repeat(null, -options.page, event); 17375 return true; 17376 } 17377 17378 return false; 17379 }, 17380 17381 _start: function (event) { 17382 if (!this.spinning && this._trigger("start", event) === false) { 17383 return false; 17384 } 17385 17386 if (!this.counter) { 17387 this.counter = 1; 17388 } 17389 this.spinning = true; 17390 return true; 17391 }, 17392 17393 _repeat: function (i, steps, event) { 17394 i = i || 500; 17395 17396 clearTimeout(this.timer); 17397 this.timer = this._delay(function () { 17398 this._repeat(40, steps, event); 17399 }, i); 17400 17401 this._spin(steps * this.options.step, event); 17402 }, 17403 17404 _spin: function (step, event) { 17405 var value = this.value() || 0; 17406 17407 if (!this.counter) { 17408 this.counter = 1; 17409 } 17410 17411 value = this._adjustValue(value + step * this._increment(this.counter)); 17412 17413 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 17414 this._value(value); 17415 this.counter++; 17416 } 17417 }, 17418 17419 _increment: function (i) { 17420 var incremental = this.options.incremental; 17421 17422 if (incremental) { 17423 return typeof incremental === "function" ? 17424 incremental(i) : 17425 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 17426 } 17427 17428 return 1; 17429 }, 17430 17431 _precision: function () { 17432 var precision = this._precisionOf(this.options.step); 17433 if (this.options.min !== null) { 17434 precision = Math.max(precision, this._precisionOf(this.options.min)); 17435 } 17436 return precision; 17437 }, 17438 17439 _precisionOf: function (num) { 17440 var str = num.toString(), 17441 decimal = str.indexOf("."); 17442 return decimal === -1 ? 0 : str.length - decimal - 1; 17443 }, 17444 17445 _adjustValue: function (value) { 17446 var base, aboveMin, 17447 options = this.options; 17448 17449 // Make sure we're at a valid step 17450 // - find out where we are relative to the base (min or 0) 17451 base = options.min !== null ? options.min : 0; 17452 aboveMin = value - base; 17453 17454 // - round to the nearest step 17455 aboveMin = Math.round(aboveMin / options.step) * options.step; 17456 17457 // - rounding is based on 0, so adjust back to our base 17458 value = base + aboveMin; 17459 17460 // Fix precision from bad JS floating point math 17461 value = parseFloat(value.toFixed(this._precision())); 17462 17463 // Clamp the value 17464 if (options.max !== null && value > options.max) { 17465 return options.max; 17466 } 17467 if (options.min !== null && value < options.min) { 17468 return options.min; 17469 } 17470 17471 return value; 17472 }, 17473 17474 _stop: function (event) { 17475 if (!this.spinning) { 17476 return; 17477 } 17478 17479 clearTimeout(this.timer); 17480 clearTimeout(this.mousewheelTimer); 17481 this.counter = 0; 17482 this.spinning = false;
vendor: 27,822 bytes, lines 17483-18286
17483 this._trigger("stop", event); 17484 }, 17485 17486 _setOption: function (key, value) { 17487 var prevValue, first, last; 17488 17489 if (key === "culture" || key === "numberFormat") { 17490 prevValue = this._parse(this.element.val()); 17491 this.options[key] = value; 17492 this.element.val(this._format(prevValue)); 17493 return; 17494 } 17495 17496 if (key === "max" || key === "min" || key === "step") { 17497 if (typeof value === "string") { 17498 value = this._parse(value); 17499 } 17500 } 17501 if (key === "icons") { 17502 first = this.buttons.first().find(".ui-icon"); 17503 this._removeClass(first, null, this.options.icons.up); 17504 this._addClass(first, null, value.up); 17505 last = this.buttons.last().find(".ui-icon"); 17506 this._removeClass(last, null, this.options.icons.down); 17507 this._addClass(last, null, value.down); 17508 } 17509 17510 this._super(key, value); 17511 }, 17512 17513 _setOptionDisabled: function (value) { 17514 this._super(value); 17515 17516 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 17517 this.element.prop("disabled", !!value); 17518 this.buttons.button(value ? "disable" : "enable"); 17519 }, 17520 17521 _setOptions: spinnerModifier(function (options) { 17522 this._super(options); 17523 }), 17524 17525 _parse: function (val) { 17526 if (typeof val === "string" && val !== "") { 17527 val = window.Globalize && this.options.numberFormat ? 17528 Globalize.parseFloat(val, 10, this.options.culture) : +val; 17529 } 17530 return val === "" || isNaN(val) ? null : val; 17531 }, 17532 17533 _format: function (value) { 17534 if (value === "") { 17535 return ""; 17536 } 17537 return window.Globalize && this.options.numberFormat ? 17538 Globalize.format(value, this.options.numberFormat, this.options.culture) : 17539 value; 17540 }, 17541 17542 _refresh: function () { 17543 this.element.attr({ 17544 "aria-valuemin": this.options.min, 17545 "aria-valuemax": this.options.max, 17546 17547 // TODO: what should we do with values that can't be parsed? 17548 "aria-valuenow": this._parse(this.element.val()) 17549 }); 17550 }, 17551 17552 isValid: function () { 17553 var value = this.value(); 17554 17555 // Null is invalid 17556 if (value === null) { 17557 return false; 17558 } 17559 17560 // If value gets adjusted, it's invalid 17561 return value === this._adjustValue(value); 17562 }, 17563 17564 // Update the value without triggering change 17565 _value: function (value, allowAny) { 17566 var parsed; 17567 if (value !== "") { 17568 parsed = this._parse(value); 17569 if (parsed !== null) { 17570 if (!allowAny) { 17571 parsed = this._adjustValue(parsed); 17572 } 17573 value = this._format(parsed); 17574 } 17575 } 17576 this.element.val(value); 17577 this._refresh(); 17578 }, 17579 17580 _destroy: function () { 17581 this.element 17582 .prop("disabled", false) 17583 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 17584 17585 this.uiSpinner.replaceWith(this.element); 17586 }, 17587 17588 stepUp: spinnerModifier(function (steps) { 17589 this._stepUp(steps); 17590 }), 17591 _stepUp: function (steps) { 17592 if (this._start()) { 17593 this._spin((steps || 1) * this.options.step); 17594 this._stop(); 17595 } 17596 }, 17597 17598 stepDown: spinnerModifier(function (steps) { 17599 this._stepDown(steps); 17600 }), 17601 _stepDown: function (steps) { 17602 if (this._start()) { 17603 this._spin((steps || 1) * -this.options.step); 17604 this._stop(); 17605 } 17606 }, 17607 17608 pageUp: spinnerModifier(function (pages) { 17609 this._stepUp((pages || 1) * this.options.page); 17610 }), 17611 17612 pageDown: spinnerModifier(function (pages) { 17613 this._stepDown((pages || 1) * this.options.page); 17614 }), 17615 17616 value: function (newVal) { 17617 if (!arguments.length) { 17618 return this._parse(this.element.val()); 17619 } 17620 spinnerModifier(this._value).call(this, newVal); 17621 }, 17622 17623 widget: function () { 17624 return this.uiSpinner; 17625 } 17626 }); 17627 17628 // DEPRECATED 17629 // TODO: switch return back to widget declaration at top of file when this is removed 17630 if ($.uiBackCompat !== false) { 17631 17632 // Backcompat for spinner html extension points 17633 $.widget("ui.spinner", $.ui.spinner, { 17634 _enhance: function () { 17635 this.uiSpinner = this.element 17636 .attr("autocomplete", "off") 17637 .wrap(this._uiSpinnerHtml()) 17638 .parent() 17639 17640 // Add buttons 17641 .append(this._buttonHtml()); 17642 }, 17643 _uiSpinnerHtml: function () { 17644 return "<span>"; 17645 }, 17646 17647 _buttonHtml: function () { 17648 return "<a></a><a></a>"; 17649 } 17650 }); 17651 } 17652 17653 var widgetsSpinner = $.ui.spinner; 17654 17655 17656 /*! 17657 * jQuery UI Tabs 1.13.2 17658 * http://jqueryui.com 17659 * 17660 * Copyright jQuery Foundation and other contributors 17661 * Released under the MIT license. 17662 * http://jquery.org/license 17663 */ 17664 17665 //>>label: Tabs 17666 //>>group: Widgets 17667 //>>description: Transforms a set of container elements into a tab structure. 17668 //>>docs: http://api.jqueryui.com/tabs/ 17669 //>>demos: http://jqueryui.com/tabs/ 17670 //>>css.structure: ../../themes/base/core.css 17671 //>>css.structure: ../../themes/base/tabs.css 17672 //>>css.theme: ../../themes/base/theme.css 17673 17674 17675 $.widget("ui.tabs", { 17676 version: "1.13.2", 17677 delay: 300, 17678 options: { 17679 active: null, 17680 classes: { 17681 "ui-tabs": "ui-corner-all", 17682 "ui-tabs-nav": "ui-corner-all", 17683 "ui-tabs-panel": "ui-corner-bottom", 17684 "ui-tabs-tab": "ui-corner-top" 17685 }, 17686 collapsible: false, 17687 event: "click", 17688 heightStyle: "content", 17689 hide: null, 17690 show: null, 17691 17692 // Callbacks 17693 activate: null, 17694 beforeActivate: null, 17695 beforeLoad: null, 17696 load: null 17697 }, 17698 17699 _isLocal: (function () { 17700 var rhash = /#.*$/; 17701 17702 return function (anchor) { 17703 var anchorUrl, locationUrl; 17704 17705 anchorUrl = anchor.href.replace(rhash, ""); 17706 locationUrl = location.href.replace(rhash, ""); 17707 17708 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 17709 try { 17710 anchorUrl = decodeURIComponent(anchorUrl); 17711 } catch (error) { } 17712 try { 17713 locationUrl = decodeURIComponent(locationUrl); 17714 } catch (error) { } 17715 17716 return anchor.hash.length > 1 && anchorUrl === locationUrl; 17717 }; 17718 })(), 17719 17720 _create: function () { 17721 var that = this, 17722 options = this.options; 17723 17724 this.running = false; 17725 17726 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 17727 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 17728 17729 this._processTabs(); 17730 options.active = this._initialActive(); 17731 17732 // Take disabling tabs via class attribute from HTML 17733 // into account and update option properly. 17734 if (Array.isArray(options.disabled)) { 17735 options.disabled = $.uniqueSort(options.disabled.concat( 17736 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 17737 return that.tabs.index(li); 17738 }) 17739 )).sort(); 17740 } 17741 17742 // Check for length avoids error when initializing empty list 17743 if (this.options.active !== false && this.anchors.length) { 17744 this.active = this._findActive(options.active); 17745 } else { 17746 this.active = $(); 17747 } 17748 17749 this._refresh(); 17750 17751 if (this.active.length) { 17752 this.load(options.active); 17753 } 17754 }, 17755 17756 _initialActive: function () { 17757 var active = this.options.active, 17758 collapsible = this.options.collapsible, 17759 locationHash = location.hash.substring(1); 17760 17761 if (active === null) { 17762 17763 // check the fragment identifier in the URL 17764 if (locationHash) { 17765 this.tabs.each(function (i, tab) { 17766 if ($(tab).attr("aria-controls") === locationHash) { 17767 active = i; 17768 return false; 17769 } 17770 }); 17771 } 17772 17773 // Check for a tab marked active via a class 17774 if (active === null) { 17775 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 17776 } 17777 17778 // No active tab, set to false 17779 if (active === null || active === -1) { 17780 active = this.tabs.length ? 0 : false; 17781 } 17782 } 17783 17784 // Handle numbers: negative, out of range 17785 if (active !== false) { 17786 active = this.tabs.index(this.tabs.eq(active)); 17787 if (active === -1) { 17788 active = collapsible ? false : 0; 17789 } 17790 } 17791 17792 // Don't allow collapsible: false and active: false 17793 if (!collapsible && active === false && this.anchors.length) { 17794 active = 0; 17795 } 17796 17797 return active; 17798 }, 17799 17800 _getCreateEventData: function () { 17801 return { 17802 tab: this.active, 17803 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 17804 }; 17805 }, 17806 17807 _tabKeydown: function (event) { 17808 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 17809 selectedIndex = this.tabs.index(focusedTab), 17810 goingForward = true; 17811 17812 if (this._handlePageNav(event)) { 17813 return; 17814 } 17815 17816 switch (event.keyCode) { 17817 case $.ui.keyCode.RIGHT: 17818 case $.ui.keyCode.DOWN: 17819 selectedIndex++; 17820 break; 17821 case $.ui.keyCode.UP: 17822 case $.ui.keyCode.LEFT: 17823 goingForward = false; 17824 selectedIndex--; 17825 break; 17826 case $.ui.keyCode.END: 17827 selectedIndex = this.anchors.length - 1; 17828 break; 17829 case $.ui.keyCode.HOME: 17830 selectedIndex = 0; 17831 break; 17832 case $.ui.keyCode.SPACE: 17833 17834 // Activate only, no collapsing 17835 event.preventDefault(); 17836 clearTimeout(this.activating); 17837 this._activate(selectedIndex); 17838 return; 17839 case $.ui.keyCode.ENTER: 17840 17841 // Toggle (cancel delayed activation, allow collapsing) 17842 event.preventDefault(); 17843 clearTimeout(this.activating); 17844 17845 // Determine if we should collapse or activate 17846 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 17847 return; 17848 default: 17849 return; 17850 } 17851 17852 // Focus the appropriate tab, based on which key was pressed 17853 event.preventDefault(); 17854 clearTimeout(this.activating); 17855 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 17856 17857 // Navigating with control/command key will prevent automatic activation 17858 if (!event.ctrlKey && !event.metaKey) { 17859 17860 // Update aria-selected immediately so that AT think the tab is already selected. 17861 // Otherwise AT may confuse the user by stating that they need to activate the tab, 17862 // but the tab will already be activated by the time the announcement finishes. 17863 focusedTab.attr("aria-selected", "false"); 17864 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 17865 17866 this.activating = this._delay(function () { 17867 this.option("active", selectedIndex); 17868 }, this.delay); 17869 } 17870 }, 17871 17872 _panelKeydown: function (event) { 17873 if (this._handlePageNav(event)) { 17874 return; 17875 } 17876 17877 // Ctrl+up moves focus to the current tab 17878 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 17879 event.preventDefault(); 17880 this.active.trigger("focus"); 17881 } 17882 }, 17883 17884 // Alt+page up/down moves focus to the previous/next tab (and activates) 17885 _handlePageNav: function (event) { 17886 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 17887 this._activate(this._focusNextTab(this.options.active - 1, false)); 17888 return true; 17889 } 17890 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 17891 this._activate(this._focusNextTab(this.options.active + 1, true)); 17892 return true; 17893 } 17894 }, 17895 17896 _findNextTab: function (index, goingForward) { 17897 var lastTabIndex = this.tabs.length - 1; 17898 17899 function constrain() { 17900 if (index > lastTabIndex) { 17901 index = 0; 17902 } 17903 if (index < 0) { 17904 index = lastTabIndex; 17905 } 17906 return index; 17907 } 17908 17909 while ($.inArray(constrain(), this.options.disabled) !== -1) { 17910 index = goingForward ? index + 1 : index - 1; 17911 } 17912 17913 return index; 17914 }, 17915 17916 _focusNextTab: function (index, goingForward) { 17917 index = this._findNextTab(index, goingForward); 17918 this.tabs.eq(index).trigger("focus"); 17919 return index; 17920 }, 17921 17922 _setOption: function (key, value) { 17923 if (key === "active") { 17924 17925 // _activate() will handle invalid values and update this.options 17926 this._activate(value); 17927 return; 17928 } 17929 17930 this._super(key, value); 17931 17932 if (key === "collapsible") { 17933 this._toggleClass("ui-tabs-collapsible", null, value); 17934 17935 // Setting collapsible: false while collapsed; open first panel 17936 if (!value && this.options.active === false) { 17937 this._activate(0); 17938 } 17939 } 17940 17941 if (key === "event") { 17942 this._setupEvents(value); 17943 } 17944 17945 if (key === "heightStyle") { 17946 this._setupHeightStyle(value); 17947 } 17948 }, 17949 17950 _sanitizeSelector: function (hash) { 17951 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 17952 }, 17953 17954 refresh: function () { 17955 var options = this.options, 17956 lis = this.tablist.children(":has(a[href])"); 17957 17958 // Get disabled tabs from class attribute from HTML 17959 // this will get converted to a boolean if needed in _refresh() 17960 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 17961 return lis.index(tab); 17962 }); 17963 17964 this._processTabs(); 17965 17966 // Was collapsed or no tabs 17967 if (options.active === false || !this.anchors.length) { 17968 options.active = false; 17969 this.active = $(); 17970 17971 // was active, but active tab is gone 17972 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 17973 17974 // all remaining tabs are disabled 17975 if (this.tabs.length === options.disabled.length) { 17976 options.active = false; 17977 this.active = $(); 17978 17979 // activate previous tab 17980 } else { 17981 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 17982 } 17983 17984 // was active, active tab still exists 17985 } else { 17986 17987 // make sure active index is correct 17988 options.active = this.tabs.index(this.active); 17989 } 17990 17991 this._refresh(); 17992 }, 17993 17994 _refresh: function () { 17995 this._setOptionDisabled(this.options.disabled); 17996 this._setupEvents(this.options.event); 17997 this._setupHeightStyle(this.options.heightStyle); 17998 17999 this.tabs.not(this.active).attr({ 18000 "aria-selected": "false", 18001 "aria-expanded": "false", 18002 tabIndex: -1 18003 }); 18004 this.panels.not(this._getPanelForTab(this.active)) 18005 .hide() 18006 .attr({ 18007 "aria-hidden": "true" 18008 }); 18009 18010 // Make sure one tab is in the tab order 18011 if (!this.active.length) { 18012 this.tabs.eq(0).attr("tabIndex", 0); 18013 } else { 18014 this.active 18015 .attr({ 18016 "aria-selected": "true", 18017 "aria-expanded": "true", 18018 tabIndex: 0 18019 }); 18020 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 18021 this._getPanelForTab(this.active) 18022 .show() 18023 .attr({ 18024 "aria-hidden": "false" 18025 }); 18026 } 18027 }, 18028 18029 _processTabs: function () { 18030 var that = this, 18031 prevTabs = this.tabs, 18032 prevAnchors = this.anchors, 18033 prevPanels = this.panels; 18034 18035 this.tablist = this._getList().attr("role", "tablist"); 18036 this._addClass(this.tablist, "ui-tabs-nav", 18037 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 18038 18039 // Prevent users from focusing disabled tabs via click 18040 this.tablist 18041 .on("mousedown" + this.eventNamespace, "> li", function (event) { 18042 if ($(this).is(".ui-state-disabled")) { 18043 event.preventDefault(); 18044 } 18045 }) 18046 18047 // Support: IE <9 18048 // Preventing the default action in mousedown doesn't prevent IE 18049 // from focusing the element, so if the anchor gets focused, blur. 18050 // We don't have to worry about focusing the previously focused 18051 // element since clicking on a non-focusable element should focus 18052 // the body anyway. 18053 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 18054 if ($(this).closest("li").is(".ui-state-disabled")) { 18055 this.trigger("blur"); 18056 } 18057 }); 18058 18059 this.tabs = this.tablist.find("> li:has(a[href])") 18060 .attr({ 18061 role: "tab", 18062 tabIndex: -1 18063 }); 18064 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 18065 18066 this.anchors = this.tabs.map(function () { 18067 return $("a", this)[0]; 18068 }) 18069 .attr({ 18070 tabIndex: -1 18071 }); 18072 this._addClass(this.anchors, "ui-tabs-anchor"); 18073 18074 this.panels = $(); 18075 18076 this.anchors.each(function (i, anchor) { 18077 var selector, panel, panelId, 18078 anchorId = $(anchor).uniqueId().attr("id"), 18079 tab = $(anchor).closest("li"), 18080 originalAriaControls = tab.attr("aria-controls"); 18081 18082 // Inline tab 18083 if (that._isLocal(anchor)) { 18084 selector = anchor.hash; 18085 panelId = selector.substring(1); 18086 panel = that.element.find(that._sanitizeSelector(selector)); 18087 18088 // remote tab 18089 } else { 18090 18091 // If the tab doesn't already have aria-controls, 18092 // generate an id by using a throw-away element 18093 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 18094 selector = "#" + panelId; 18095 panel = that.element.find(selector); 18096 if (!panel.length) { 18097 panel = that._createPanel(panelId); 18098 panel.insertAfter(that.panels[i - 1] || that.tablist); 18099 } 18100 panel.attr("aria-live", "polite"); 18101 } 18102 18103 if (panel.length) { 18104 that.panels = that.panels.add(panel); 18105 } 18106 if (originalAriaControls) { 18107 tab.data("ui-tabs-aria-controls", originalAriaControls); 18108 } 18109 tab.attr({ 18110 "aria-controls": panelId, 18111 "aria-labelledby": anchorId 18112 }); 18113 panel.attr("aria-labelledby", anchorId); 18114 }); 18115 18116 this.panels.attr("role", "tabpanel"); 18117 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 18118 18119 // Avoid memory leaks (#10056) 18120 if (prevTabs) { 18121 this._off(prevTabs.not(this.tabs)); 18122 this._off(prevAnchors.not(this.anchors)); 18123 this._off(prevPanels.not(this.panels)); 18124 } 18125 }, 18126 18127 // Allow overriding how to find the list for rare usage scenarios (#7715) 18128 _getList: function () { 18129 return this.tablist || this.element.find("ol, ul").eq(0); 18130 }, 18131 18132 _createPanel: function (id) { 18133 return $("<div>") 18134 .attr("id", id) 18135 .data("ui-tabs-destroy", true); 18136 }, 18137 18138 _setOptionDisabled: function (disabled) { 18139 var currentItem, li, i; 18140 18141 if (Array.isArray(disabled)) { 18142 if (!disabled.length) { 18143 disabled = false; 18144 } else if (disabled.length === this.anchors.length) { 18145 disabled = true; 18146 } 18147 } 18148 18149 // Disable tabs 18150 for (i = 0; (li = this.tabs[i]); i++) { 18151 currentItem = $(li); 18152 if (disabled === true || $.inArray(i, disabled) !== -1) { 18153 currentItem.attr("aria-disabled", "true"); 18154 this._addClass(currentItem, null, "ui-state-disabled"); 18155 } else { 18156 currentItem.removeAttr("aria-disabled"); 18157 this._removeClass(currentItem, null, "ui-state-disabled"); 18158 } 18159 } 18160 18161 this.options.disabled = disabled; 18162 18163 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 18164 disabled === true); 18165 }, 18166 18167 _setupEvents: function (event) { 18168 var events = {}; 18169 if (event) { 18170 $.each(event.split(" "), function (index, eventName) { 18171 events[eventName] = "_eventHandler"; 18172 }); 18173 } 18174 18175 this._off(this.anchors.add(this.tabs).add(this.panels)); 18176 18177 // Always prevent the default action, even when disabled 18178 this._on(true, this.anchors, { 18179 click: function (event) { 18180 event.preventDefault(); 18181 } 18182 }); 18183 this._on(this.anchors, events); 18184 this._on(this.tabs, { keydown: "_tabKeydown" }); 18185 this._on(this.panels, { keydown: "_panelKeydown" }); 18186 18187 this._focusable(this.tabs); 18188 this._hoverable(this.tabs); 18189 }, 18190 18191 _setupHeightStyle: function (heightStyle) { 18192 var maxHeight, 18193 parent = this.element.parent(); 18194 18195 if (heightStyle === "fill") { 18196 maxHeight = parent.height(); 18197 maxHeight -= this.element.outerHeight() - this.element.height(); 18198 18199 this.element.siblings(":visible").each(function () { 18200 var elem = $(this), 18201 position = elem.css("position"); 18202 18203 if (position === "absolute" || position === "fixed") { 18204 return; 18205 } 18206 maxHeight -= elem.outerHeight(true); 18207 }); 18208 18209 this.element.children().not(this.panels).each(function () { 18210 maxHeight -= $(this).outerHeight(true); 18211 }); 18212 18213 this.panels.each(function () { 18214 $(this).height(Math.max(0, maxHeight - 18215 $(this).innerHeight() + $(this).height())); 18216 }) 18217 .css("overflow", "auto"); 18218 } else if (heightStyle === "auto") { 18219 maxHeight = 0; 18220 this.panels.each(function () { 18221 maxHeight = Math.max(maxHeight, $(this).height("").height()); 18222 }).height(maxHeight); 18223 } 18224 }, 18225 18226 _eventHandler: function (event) { 18227 var options = this.options, 18228 active = this.active, 18229 anchor = $(event.currentTarget), 18230 tab = anchor.closest("li"), 18231 clickedIsActive = tab[0] === active[0], 18232 collapsing = clickedIsActive && options.collapsible, 18233 toShow = collapsing ? $() : this._getPanelForTab(tab), 18234 toHide = !active.length ? $() : this._getPanelForTab(active), 18235 eventData = { 18236 oldTab: active, 18237 oldPanel: toHide, 18238 newTab: collapsing ? $() : tab, 18239 newPanel: toShow 18240 }; 18241 18242 event.preventDefault(); 18243 18244 if (tab.hasClass("ui-state-disabled") || 18245 18246 // tab is already loading 18247 tab.hasClass("ui-tabs-loading") || 18248 18249 // can't switch durning an animation 18250 this.running || 18251 18252 // click on active header, but not collapsible 18253 (clickedIsActive && !options.collapsible) || 18254 18255 // allow canceling activation 18256 (this._trigger("beforeActivate", event, eventData) === false)) { 18257 return; 18258 } 18259 18260 options.active = collapsing ? false : this.tabs.index(tab); 18261 18262 this.active = clickedIsActive ? $() : tab; 18263 if (this.xhr) { 18264 this.xhr.abort(); 18265 } 18266 18267 if (!toHide.length && !toShow.length) { 18268 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 18269 } 18270 18271 if (toShow.length) { 18272 this.load(this.tabs.index(tab), event); 18273 } 18274 this._toggle(event, eventData); 18275 }, 18276 18277 // Handles show/hide for selecting tabs 18278 _toggle: function (event, eventData) { 18279 var that = this, 18280 toShow = eventData.newPanel, 18281 toHide = eventData.oldPanel; 18282 18283 this.running = true; 18284 18285 function complete() { 18286 that.running = false;
vendor: 4,686 bytes, lines 18287-18426
18287 that._trigger("activate", event, eventData); 18288 } 18289 18290 function show() { 18291 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 18292 18293 if (toShow.length && that.options.show) { 18294 that._show(toShow, that.options.show, complete); 18295 } else { 18296 toShow.show(); 18297 complete(); 18298 } 18299 } 18300 18301 // Start out by hiding, then showing, then completing 18302 if (toHide.length && this.options.hide) { 18303 this._hide(toHide, this.options.hide, function () { 18304 that._removeClass(eventData.oldTab.closest("li"), 18305 "ui-tabs-active", "ui-state-active"); 18306 show(); 18307 }); 18308 } else { 18309 this._removeClass(eventData.oldTab.closest("li"), 18310 "ui-tabs-active", "ui-state-active"); 18311 toHide.hide(); 18312 show(); 18313 } 18314 18315 toHide.attr("aria-hidden", "true"); 18316 eventData.oldTab.attr({ 18317 "aria-selected": "false", 18318 "aria-expanded": "false" 18319 }); 18320 18321 // If we're switching tabs, remove the old tab from the tab order. 18322 // If we're opening from collapsed state, remove the previous tab from the tab order. 18323 // If we're collapsing, then keep the collapsing tab in the tab order. 18324 if (toShow.length && toHide.length) { 18325 eventData.oldTab.attr("tabIndex", -1); 18326 } else if (toShow.length) { 18327 this.tabs.filter(function () { 18328 return $(this).attr("tabIndex") === 0; 18329 }) 18330 .attr("tabIndex", -1); 18331 } 18332 18333 toShow.attr("aria-hidden", "false"); 18334 eventData.newTab.attr({ 18335 "aria-selected": "true", 18336 "aria-expanded": "true", 18337 tabIndex: 0 18338 }); 18339 }, 18340 18341 _activate: function (index) { 18342 var anchor, 18343 active = this._findActive(index); 18344 18345 // Trying to activate the already active panel 18346 if (active[0] === this.active[0]) { 18347 return; 18348 } 18349 18350 // Trying to collapse, simulate a click on the current active header 18351 if (!active.length) { 18352 active = this.active; 18353 } 18354 18355 anchor = active.find(".ui-tabs-anchor")[0]; 18356 this._eventHandler({ 18357 target: anchor, 18358 currentTarget: anchor, 18359 preventDefault: $.noop 18360 }); 18361 }, 18362 18363 _findActive: function (index) { 18364 return index === false ? $() : this.tabs.eq(index); 18365 }, 18366 18367 _getIndex: function (index) { 18368 18369 // meta-function to give users option to provide a href string instead of a numerical index. 18370 if (typeof index === "string") { 18371 index = this.anchors.index(this.anchors.filter("[href$='" + 18372 $.escapeSelector(index) + "']")); 18373 } 18374 18375 return index; 18376 }, 18377 18378 _destroy: function () { 18379 if (this.xhr) { 18380 this.xhr.abort(); 18381 } 18382 18383 this.tablist 18384 .removeAttr("role") 18385 .off(this.eventNamespace); 18386 18387 this.anchors 18388 .removeAttr("role tabIndex") 18389 .removeUniqueId(); 18390 18391 this.tabs.add(this.panels).each(function () { 18392 if ($.data(this, "ui-tabs-destroy")) { 18393 $(this).remove(); 18394 } else { 18395 $(this).removeAttr("role tabIndex " + 18396 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 18397 } 18398 }); 18399 18400 this.tabs.each(function () { 18401 var li = $(this), 18402 prev = li.data("ui-tabs-aria-controls"); 18403 if (prev) { 18404 li 18405 .attr("aria-controls", prev) 18406 .removeData("ui-tabs-aria-controls"); 18407 } else { 18408 li.removeAttr("aria-controls"); 18409 } 18410 }); 18411 18412 this.panels.show(); 18413 18414 if (this.options.heightStyle !== "content") { 18415 this.panels.css("height", ""); 18416 } 18417 }, 18418 18419 enable: function (index) { 18420 var disabled = this.options.disabled; 18421 if (disabled === false) { 18422 return; 18423 } 18424 18425 if (index === undefined) { 18426 disabled = false;
vendor: 14,344 bytes, lines 18427-18828
18427 } else { 18428 index = this._getIndex(index); 18429 if (Array.isArray(disabled)) { 18430 disabled = $.map(disabled, function (num) { 18431 return num !== index ? num : null; 18432 }); 18433 } else { 18434 disabled = $.map(this.tabs, function (li, num) { 18435 return num !== index ? num : null; 18436 }); 18437 } 18438 } 18439 this._setOptionDisabled(disabled); 18440 }, 18441 18442 disable: function (index) { 18443 var disabled = this.options.disabled; 18444 if (disabled === true) { 18445 return; 18446 } 18447 18448 if (index === undefined) { 18449 disabled = true; 18450 } else { 18451 index = this._getIndex(index); 18452 if ($.inArray(index, disabled) !== -1) { 18453 return; 18454 } 18455 if (Array.isArray(disabled)) { 18456 disabled = $.merge([index], disabled).sort(); 18457 } else { 18458 disabled = [index]; 18459 } 18460 } 18461 this._setOptionDisabled(disabled); 18462 }, 18463 18464 load: function (index, event) { 18465 index = this._getIndex(index); 18466 var that = this, 18467 tab = this.tabs.eq(index), 18468 anchor = tab.find(".ui-tabs-anchor"), 18469 panel = this._getPanelForTab(tab), 18470 eventData = { 18471 tab: tab, 18472 panel: panel 18473 }, 18474 complete = function (jqXHR, status) { 18475 if (status === "abort") { 18476 that.panels.stop(false, true); 18477 } 18478 18479 that._removeClass(tab, "ui-tabs-loading"); 18480 panel.removeAttr("aria-busy"); 18481 18482 if (jqXHR === that.xhr) { 18483 delete that.xhr; 18484 } 18485 }; 18486 18487 // Not remote 18488 if (this._isLocal(anchor[0])) { 18489 return; 18490 } 18491 18492 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 18493 18494 // Support: jQuery <1.8 18495 // jQuery <1.8 returns false if the request is canceled in beforeSend, 18496 // but as of 1.8, $.ajax() always returns a jqXHR object. 18497 if (this.xhr && this.xhr.statusText !== "canceled") { 18498 this._addClass(tab, "ui-tabs-loading"); 18499 panel.attr("aria-busy", "true"); 18500 18501 this.xhr 18502 .done(function (response, status, jqXHR) { 18503 18504 // support: jQuery <1.8 18505 // http://bugs.jquery.com/ticket/11778 18506 setTimeout(function () { 18507 panel.html(response); 18508 that._trigger("load", event, eventData); 18509 18510 complete(jqXHR, status); 18511 }, 1); 18512 }) 18513 .fail(function (jqXHR, status) { 18514 18515 // support: jQuery <1.8 18516 // http://bugs.jquery.com/ticket/11778 18517 setTimeout(function () { 18518 complete(jqXHR, status); 18519 }, 1); 18520 }); 18521 } 18522 }, 18523 18524 _ajaxSettings: function (anchor, event, eventData) { 18525 var that = this; 18526 return { 18527 18528 // Support: IE <11 only 18529 // Strip any hash that exists to prevent errors with the Ajax request 18530 url: anchor.attr("href").replace(/#.*$/, ""), 18531 beforeSend: function (jqXHR, settings) { 18532 return that._trigger("beforeLoad", event, 18533 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 18534 } 18535 }; 18536 }, 18537 18538 _getPanelForTab: function (tab) { 18539 var id = $(tab).attr("aria-controls"); 18540 return this.element.find(this._sanitizeSelector("#" + id)); 18541 } 18542 }); 18543 18544 // DEPRECATED 18545 // TODO: Switch return back to widget declaration at top of file when this is removed 18546 if ($.uiBackCompat !== false) { 18547 18548 // Backcompat for ui-tab class (now ui-tabs-tab) 18549 $.widget("ui.tabs", $.ui.tabs, { 18550 _processTabs: function () { 18551 this._superApply(arguments); 18552 this._addClass(this.tabs, "ui-tab"); 18553 } 18554 }); 18555 } 18556 18557 var widgetsTabs = $.ui.tabs; 18558 18559 18560 /*! 18561 * jQuery UI Tooltip 1.13.2 18562 * http://jqueryui.com 18563 * 18564 * Copyright jQuery Foundation and other contributors 18565 * Released under the MIT license. 18566 * http://jquery.org/license 18567 */ 18568 18569 //>>label: Tooltip 18570 //>>group: Widgets 18571 //>>description: Shows additional information for any element on hover or focus. 18572 //>>docs: http://api.jqueryui.com/tooltip/ 18573 //>>demos: http://jqueryui.com/tooltip/ 18574 //>>css.structure: ../../themes/base/core.css 18575 //>>css.structure: ../../themes/base/tooltip.css 18576 //>>css.theme: ../../themes/base/theme.css 18577 18578 18579 $.widget("ui.tooltip", { 18580 version: "1.13.2", 18581 options: { 18582 classes: { 18583 "ui-tooltip": "ui-corner-all ui-widget-shadow" 18584 }, 18585 content: function () { 18586 var title = $(this).attr("title"); 18587 18588 // Escape title, since we're going from an attribute to raw HTML 18589 return $("<a>").text(title).html(); 18590 }, 18591 hide: true, 18592 18593 // Disabled elements have inconsistent behavior across browsers (#8661) 18594 items: "[title]:not([disabled])", 18595 position: { 18596 my: "left top+15", 18597 at: "left bottom", 18598 collision: "flipfit flip" 18599 }, 18600 show: true, 18601 track: false, 18602 18603 // Callbacks 18604 close: null, 18605 open: null 18606 }, 18607 18608 _addDescribedBy: function (elem, id) { 18609 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 18610 describedby.push(id); 18611 elem 18612 .data("ui-tooltip-id", id) 18613 .attr("aria-describedby", String.prototype.trim.call(describedby.join(" "))); 18614 }, 18615 18616 _removeDescribedBy: function (elem) { 18617 var id = elem.data("ui-tooltip-id"), 18618 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 18619 index = $.inArray(id, describedby); 18620 18621 if (index !== -1) { 18622 describedby.splice(index, 1); 18623 } 18624 18625 elem.removeData("ui-tooltip-id"); 18626 describedby = String.prototype.trim.call(describedby.join(" ")); 18627 if (describedby) { 18628 elem.attr("aria-describedby", describedby); 18629 } else { 18630 elem.removeAttr("aria-describedby"); 18631 } 18632 }, 18633 18634 _create: function () { 18635 this._on({ 18636 mouseover: "open", 18637 focusin: "open" 18638 }); 18639 18640 // IDs of generated tooltips, needed for destroy 18641 this.tooltips = {}; 18642 18643 // IDs of parent tooltips where we removed the title attribute 18644 this.parents = {}; 18645 18646 // Append the aria-live region so tooltips announce correctly 18647 this.liveRegion = $("<div>") 18648 .attr({ 18649 role: "log", 18650 "aria-live": "assertive", 18651 "aria-relevant": "additions" 18652 }) 18653 .appendTo(this.document[0].body); 18654 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 18655 18656 this.disabledTitles = $([]); 18657 }, 18658 18659 _setOption: function (key, value) { 18660 var that = this; 18661 18662 this._super(key, value); 18663 18664 if (key === "content") { 18665 $.each(this.tooltips, function (id, tooltipData) { 18666 that._updateContent(tooltipData.element); 18667 }); 18668 } 18669 }, 18670 18671 _setOptionDisabled: function (value) { 18672 this[value ? "_disable" : "_enable"](); 18673 }, 18674 18675 _disable: function () { 18676 var that = this; 18677 18678 // Close open tooltips 18679 $.each(this.tooltips, function (id, tooltipData) { 18680 var event = $.Event("blur"); 18681 event.target = event.currentTarget = tooltipData.element[0]; 18682 that.close(event, true); 18683 }); 18684 18685 // Remove title attributes to prevent native tooltips 18686 this.disabledTitles = this.disabledTitles.add( 18687 this.element.find(this.options.items).addBack() 18688 .filter(function () { 18689 var element = $(this); 18690 if (element.is("[title]")) { 18691 return element 18692 .data("ui-tooltip-title", element.attr("title")) 18693 .removeAttr("title"); 18694 } 18695 }) 18696 ); 18697 }, 18698 18699 _enable: function () { 18700 18701 // restore title attributes 18702 this.disabledTitles.each(function () { 18703 var element = $(this); 18704 if (element.data("ui-tooltip-title")) { 18705 element.attr("title", element.data("ui-tooltip-title")); 18706 } 18707 }); 18708 this.disabledTitles = $([]); 18709 }, 18710 18711 open: function (event) { 18712 var that = this, 18713 target = $(event ? event.target : this.element) 18714 18715 // we need closest here due to mouseover bubbling, 18716 // but always pointing at the same event target 18717 .closest(this.options.items); 18718 18719 // No element to show a tooltip for or the tooltip is already open 18720 if (!target.length || target.data("ui-tooltip-id")) { 18721 return; 18722 } 18723 18724 if (target.attr("title")) { 18725 target.data("ui-tooltip-title", target.attr("title")); 18726 } 18727 18728 target.data("ui-tooltip-open", true); 18729 18730 // Kill parent tooltips, custom or native, for hover 18731 if (event && event.type === "mouseover") { 18732 target.parents().each(function () { 18733 var parent = $(this), 18734 blurEvent; 18735 if (parent.data("ui-tooltip-open")) { 18736 blurEvent = $.Event("blur"); 18737 blurEvent.target = blurEvent.currentTarget = this; 18738 that.close(blurEvent, true); 18739 } 18740 if (parent.attr("title")) { 18741 parent.uniqueId(); 18742 that.parents[this.id] = { 18743 element: this, 18744 title: parent.attr("title") 18745 }; 18746 parent.attr("title", ""); 18747 } 18748 }); 18749 } 18750 18751 this._registerCloseHandlers(event, target); 18752 this._updateContent(target, event); 18753 }, 18754 18755 _updateContent: function (target, event) { 18756 var content, 18757 contentOption = this.options.content, 18758 that = this, 18759 eventType = event ? event.type : null; 18760 18761 if (typeof contentOption === "string" || contentOption.nodeType || 18762 contentOption.jquery) { 18763 return this._open(event, target, contentOption); 18764 } 18765 18766 content = contentOption.call(target[0], function (response) { 18767 18768 // IE may instantly serve a cached response for ajax requests 18769 // delay this call to _open so the other call to _open runs first 18770 that._delay(function () { 18771 18772 // Ignore async response if tooltip was closed already 18773 if (!target.data("ui-tooltip-open")) { 18774 return; 18775 } 18776 18777 // JQuery creates a special event for focusin when it doesn't 18778 // exist natively. To improve performance, the native event 18779 // object is reused and the type is changed. Therefore, we can't 18780 // rely on the type being correct after the event finished 18781 // bubbling, so we set it back to the previous value. (#8740) 18782 if (event) { 18783 event.type = eventType; 18784 } 18785 this._open(event, target, response); 18786 }); 18787 }); 18788 if (content) { 18789 this._open(event, target, content); 18790 } 18791 }, 18792 18793 _open: function (event, target, content) { 18794 var tooltipData, tooltip, delayedShow, a11yContent, 18795 positionOption = $.extend({}, this.options.position); 18796 18797 if (!content) { 18798 return; 18799 } 18800 18801 // Content can be updated multiple times. If the tooltip already 18802 // exists, then just update the content and bail. 18803 tooltipData = this._find(target); 18804 if (tooltipData) { 18805 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 18806 return; 18807 } 18808 18809 // If we have a title, clear it to prevent the native tooltip 18810 // we have to check first to avoid defining a title if none exists 18811 // (we don't want to cause an element to start matching [title]) 18812 // 18813 // We use removeAttr only for key events, to allow IE to export the correct 18814 // accessible attributes. For mouse events, set to empty string to avoid 18815 // native tooltip showing up (happens only when removing inside mouseover). 18816 if (target.is("[title]")) { 18817 if (event && event.type === "mouseover") { 18818 target.attr("title", ""); 18819 } else { 18820 target.removeAttr("title"); 18821 } 18822 } 18823 18824 tooltipData = this._tooltip(target); 18825 tooltip = tooltipData.tooltip; 18826 this._addDescribedBy(target, tooltip.attr("id")); 18827 tooltip.find(".ui-tooltip-content").html(content); 18828
vendor: 4,374 bytes, lines 18829-18936
18829 // Support: Voiceover on OS X, JAWS on IE <= 9 18830 // JAWS announces deletions even when aria-relevant="additions" 18831 // Voiceover will sometimes re-read the entire log region's contents from the beginning 18832 this.liveRegion.children().hide(); 18833 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 18834 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 18835 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 18836 a11yContent.appendTo(this.liveRegion); 18837 18838 function position(event) { 18839 positionOption.of = event; 18840 if (tooltip.is(":hidden")) { 18841 return; 18842 } 18843 tooltip.position(positionOption); 18844 } 18845 if (this.options.track && event && /^mouse/.test(event.type)) { 18846 this._on(this.document, { 18847 mousemove: position 18848 }); 18849 18850 // trigger once to override element-relative positioning 18851 position(event); 18852 } else { 18853 tooltip.position($.extend({ 18854 of: target 18855 }, this.options.position)); 18856 } 18857 18858 tooltip.hide(); 18859 18860 this._show(tooltip, this.options.show); 18861 18862 // Handle tracking tooltips that are shown with a delay (#8644). As soon 18863 // as the tooltip is visible, position the tooltip using the most recent 18864 // event. 18865 // Adds the check to add the timers only when both delay and track options are set (#14682) 18866 if (this.options.track && this.options.show && this.options.show.delay) { 18867 delayedShow = this.delayedShow = setInterval(function () { 18868 if (tooltip.is(":visible")) { 18869 position(positionOption.of); 18870 clearInterval(delayedShow); 18871 } 18872 }, 13); 18873 } 18874 18875 this._trigger("open", event, { tooltip: tooltip }); 18876 }, 18877 18878 _registerCloseHandlers: function (event, target) { 18879 var events = { 18880 keyup: function (event) { 18881 if (event.keyCode === $.ui.keyCode.ESCAPE) { 18882 var fakeEvent = $.Event(event); 18883 fakeEvent.currentTarget = target[0]; 18884 this.close(fakeEvent, true); 18885 } 18886 } 18887 }; 18888 18889 // Only bind remove handler for delegated targets. Non-delegated 18890 // tooltips will handle this in destroy. 18891 if (target[0] !== this.element[0]) { 18892 events.remove = function () { 18893 var targetElement = this._find(target); 18894 if (targetElement) { 18895 this._removeTooltip(targetElement.tooltip); 18896 } 18897 }; 18898 } 18899 18900 if (!event || event.type === "mouseover") { 18901 events.mouseleave = "close"; 18902 } 18903 if (!event || event.type === "focusin") { 18904 events.focusout = "close"; 18905 } 18906 this._on(true, target, events); 18907 }, 18908 18909 close: function (event) { 18910 var tooltip, 18911 that = this, 18912 target = $(event ? event.currentTarget : this.element), 18913 tooltipData = this._find(target); 18914 18915 // The tooltip may already be closed 18916 if (!tooltipData) { 18917 18918 // We set ui-tooltip-open immediately upon open (in open()), but only set the 18919 // additional data once there's actually content to show (in _open()). So even if the 18920 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 18921 // the period between open() and _open(). 18922 target.removeData("ui-tooltip-open"); 18923 return; 18924 } 18925 18926 tooltip = tooltipData.tooltip; 18927 18928 // Disabling closes the tooltip, so we need to track when we're closing 18929 // to avoid an infinite loop in case the tooltip becomes disabled on close 18930 if (tooltipData.closing) { 18931 return; 18932 } 18933 18934 // Clear the interval for delayed tracking tooltips 18935 clearInterval(this.delayedShow); 18936
vendor: 4,302 bytes, lines 18937-19068
18937 // Only set title if we had one before (see comment in _open()) 18938 // If the title attribute has changed since open(), don't restore 18939 if (target.data("ui-tooltip-title") && !target.attr("title")) { 18940 target.attr("title", target.data("ui-tooltip-title")); 18941 } 18942 18943 this._removeDescribedBy(target); 18944 18945 tooltipData.hiding = true; 18946 tooltip.stop(true); 18947 this._hide(tooltip, this.options.hide, function () { 18948 that._removeTooltip($(this)); 18949 }); 18950 18951 target.removeData("ui-tooltip-open"); 18952 this._off(target, "mouseleave focusout keyup"); 18953 18954 // Remove 'remove' binding only on delegated targets 18955 if (target[0] !== this.element[0]) { 18956 this._off(target, "remove"); 18957 } 18958 this._off(this.document, "mousemove"); 18959 18960 if (event && event.type === "mouseleave") { 18961 $.each(this.parents, function (id, parent) { 18962 $(parent.element).attr("title", parent.title); 18963 delete that.parents[id]; 18964 }); 18965 } 18966 18967 tooltipData.closing = true; 18968 this._trigger("close", event, { tooltip: tooltip }); 18969 if (!tooltipData.hiding) { 18970 tooltipData.closing = false; 18971 } 18972 }, 18973 18974 _tooltip: function (element) { 18975 var tooltip = $("<div>").attr("role", "tooltip"), 18976 content = $("<div>").appendTo(tooltip), 18977 id = tooltip.uniqueId().attr("id"); 18978 18979 this._addClass(content, "ui-tooltip-content"); 18980 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 18981 18982 tooltip.appendTo(this._appendTo(element)); 18983 18984 return this.tooltips[id] = { 18985 element: element, 18986 tooltip: tooltip 18987 }; 18988 }, 18989 18990 _find: function (target) { 18991 var id = target.data("ui-tooltip-id"); 18992 return id ? this.tooltips[id] : null; 18993 }, 18994 18995 _removeTooltip: function (tooltip) { 18996 18997 // Clear the interval for delayed tracking tooltips 18998 clearInterval(this.delayedShow); 18999 19000 tooltip.remove(); 19001 delete this.tooltips[tooltip.attr("id")]; 19002 }, 19003 19004 _appendTo: function (target) { 19005 var element = target.closest(".ui-front, dialog"); 19006 19007 if (!element.length) { 19008 element = this.document[0].body; 19009 } 19010 19011 return element; 19012 }, 19013 19014 _destroy: function () { 19015 var that = this; 19016 19017 // Close open tooltips 19018 $.each(this.tooltips, function (id, tooltipData) { 19019 19020 // Delegate to close method to handle common cleanup 19021 var event = $.Event("blur"), 19022 element = tooltipData.element; 19023 event.target = event.currentTarget = element[0]; 19024 that.close(event, true); 19025 19026 // Remove immediately; destroying an open tooltip doesn't use the 19027 // hide animation 19028 $("#" + id).remove(); 19029 19030 // Restore the title 19031 if (element.data("ui-tooltip-title")) { 19032 19033 // If the title attribute has changed since open(), don't restore 19034 if (!element.attr("title")) { 19035 element.attr("title", element.data("ui-tooltip-title")); 19036 } 19037 element.removeData("ui-tooltip-title"); 19038 } 19039 }); 19040 this.liveRegion.remove(); 19041 } 19042 }); 19043 19044 // DEPRECATED 19045 // TODO: Switch return back to widget declaration at top of file when this is removed 19046 if ($.uiBackCompat !== false) { 19047 19048 // Backcompat for tooltipClass option 19049 $.widget("ui.tooltip", $.ui.tooltip, { 19050 options: { 19051 tooltipClass: null 19052 }, 19053 _tooltip: function () { 19054 var tooltipData = this._superApply(arguments); 19055 if (this.options.tooltipClass) { 19056 tooltipData.tooltip.addClass(this.options.tooltipClass); 19057 } 19058 return tooltipData; 19059 } 19060 }); 19061 } 19062 19063 var widgetsTooltip = $.ui.tooltip; 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.