vendor: 10,203 bytes, lines 1-318
1/*! jQuery UI - v1.12.1 - 2016-09-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-1-7.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 if (typeof define === "function" && define.amd) { 8 // AMD. Register as an anonymous module. 9 define(["jquery"], factory); 10 } else { 11 // Browser globals 12 factory(jQuery); 13 } 14}(function ($) { 15 $.ui = $.ui || {}; 16 17 var version = $.ui.version = "1.12.1"; 18 19 /*! 20 * jQuery UI Widget 1.12.1 21 * http://jqueryui.com 22 * 23 * Copyright jQuery Foundation and other contributors 24 * Released under the MIT license. 25 * http://jquery.org/license 26 */ 27 28 //>>label: Widget 29 //>>group: Core 30 //>>description: Provides a factory for creating stateful widgets with a common API. 31 //>>docs: http://api.jqueryui.com/jQuery.widget/ 32 //>>demos: http://jqueryui.com/widget/ 33 34 var widgetUuid = 0; 35 var widgetSlice = Array.prototype.slice; 36 37 $.cleanData = (function (orig) { 38 return function (elems) { 39 var events, elem, i; 40 for (i = 0; (elem = elems[i]) != null; i++) { 41 try { 42 // Only trigger remove when necessary to save time 43 events = $._data(elem, "events"); 44 if (events && events.remove) { 45 $(elem).triggerHandler("remove"); 46 } 47 48 // Http://bugs.jquery.com/ticket/8235 49 } catch (e) { } 50 } 51 orig(elems); 52 }; 53 })($.cleanData); 54 55 $.widget = function (name, base, prototype) { 56 var existingConstructor, constructor, basePrototype; 57 58 // ProxiedPrototype allows the provided prototype to remain unmodified 59 // so that it can be used as a mixin for multiple widgets (#8876) 60 var proxiedPrototype = {}; 61 62 var namespace = name.split(".")[0]; 63 name = name.split(".")[1]; 64 var fullName = namespace + "-" + name; 65 66 if (!prototype) { 67 prototype = base; 68 base = $.Widget; 69 } 70 71 if ($.isArray(prototype)) { 72 prototype = $.extend.apply(null, [{}].concat(prototype)); 73 } 74 75 // Create selector for plugin 76 $.expr[":"][fullName.toLowerCase()] = function (elem) { 77 return !!$.data(elem, fullName); 78 }; 79 80 $[namespace] = $[namespace] || {}; 81 existingConstructor = $[namespace][name]; 82 constructor = $[namespace][name] = function (options, element) { 83 // Allow instantiation without "new" keyword 84 if (!this._createWidget) { 85 return new constructor(options, element); 86 } 87 88 // Allow instantiation without initializing for simple inheritance 89 // must use "new" keyword (the code above always passes args) 90 if (arguments.length) { 91 this._createWidget(options, element); 92 } 93 }; 94 95 // Extend with the existing constructor to carry over any static properties 96 $.extend(constructor, existingConstructor, { 97 version: prototype.version, 98 99 // Copy the object used to create the prototype in case we need to 100 // redefine the widget later 101 _proto: $.extend({}, prototype), 102 103 // Track widgets that inherit from this widget in case this widget is 104 // redefined after a widget inherits from it 105 _childConstructors: [] 106 }); 107 108 basePrototype = new base(); 109 110 // We need to make the options hash a property directly on the new instance 111 // otherwise we'll modify the options hash on the prototype that we're 112 // inheriting from 113 basePrototype.options = $.widget.extend({}, basePrototype.options); 114 $.each(prototype, function (prop, value) { 115 if (!$.isFunction(value)) { 116 proxiedPrototype[prop] = value; 117 return; 118 } 119 proxiedPrototype[prop] = (function () { 120 function _super() { 121 return base.prototype[prop].apply(this, arguments); 122 } 123 124 function _superApply(args) { 125 return base.prototype[prop].apply(this, args); 126 } 127 128 return function () { 129 var __super = this._super; 130 var __superApply = this._superApply; 131 var returnValue; 132 133 this._super = _super; 134 this._superApply = _superApply; 135 136 returnValue = value.apply(this, arguments); 137 138 this._super = __super; 139 this._superApply = __superApply; 140 141 return returnValue; 142 }; 143 })(); 144 }); 145 constructor.prototype = $.widget.extend(basePrototype, { 146 // TODO: remove support for widgetEventPrefix 147 // always use the name + a colon as the prefix, e.g., draggable:start 148 // don't prefix for widgets that aren't DOM-based 149 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 150 }, proxiedPrototype, { 151 constructor: constructor, 152 namespace: namespace, 153 widgetName: name, 154 widgetFullName: fullName 155 }); 156 157 // If this widget is being redefined then we need to find all widgets that 158 // are inheriting from it and redefine all of them so that they inherit from 159 // the new version of this widget. We're essentially trying to replace one 160 // level in the prototype chain. 161 if (existingConstructor) { 162 $.each(existingConstructor._childConstructors, function (i, child) { 163 var childPrototype = child.prototype; 164 165 // Redefine the child widget using the same prototype that was 166 // originally used, but inherit from the new version of the base 167 $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, 168 child._proto); 169 }); 170 171 // Remove the list of existing child constructors from the old constructor 172 // so the old child constructors can be garbage collected 173 delete existingConstructor._childConstructors; 174 } else { 175 base._childConstructors.push(constructor); 176 } 177 178 $.widget.bridge(name, constructor); 179 180 return constructor; 181 }; 182 183 $.widget.extend = function (target) { 184 var input = widgetSlice.call(arguments, 1); 185 var inputIndex = 0; 186 var inputLength = input.length; 187 var key; 188 var value; 189 190 for (; inputIndex < inputLength; inputIndex++) { 191 for (key in input[inputIndex]) { 192 value = input[inputIndex][key]; 193 if (input[inputIndex].hasOwnProperty(key) && value !== undefined) { 194 // Clone objects 195 if ($.isPlainObject(value)) { 196 target[key] = $.isPlainObject(target[key]) ? 197 $.widget.extend({}, target[key], value) : 198 199 // Don't extend strings, arrays, etc. with objects 200 $.widget.extend({}, value); 201 202 // Copy everything else by reference 203 } else { 204 target[key] = value; 205 } 206 } 207 } 208 } 209 return target; 210 }; 211 212 $.widget.bridge = function (name, object) { 213 var fullName = object.prototype.widgetFullName || name; 214 $.fn[name] = function (options) { 215 var isMethodCall = typeof options === "string"; 216 var args = widgetSlice.call(arguments, 1); 217 var returnValue = this; 218 219 if (isMethodCall) { 220 // If this is an empty collection, we need to have the instance method 221 // return undefined instead of the jQuery instance 222 if (!this.length && options === "instance") { 223 returnValue = undefined; 224 } else { 225 this.each(function () { 226 var methodValue; 227 var instance = $.data(this, fullName); 228 229 if (options === "instance") { 230 returnValue = instance; 231 return false; 232 } 233 234 if (!instance) { 235 return $.error("cannot call methods on " + name + 236 " prior to initialization; " + 237 "attempted to call method '" + options + "'"); 238 } 239 240 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 241 return $.error("no such method '" + options + "' for " + name + 242 " widget instance"); 243 } 244 245 methodValue = instance[options].apply(instance, args); 246 247 if (methodValue !== instance && methodValue !== undefined) { 248 returnValue = methodValue && methodValue.jquery ? 249 returnValue.pushStack(methodValue.get()) : 250 methodValue; 251 return false; 252 } 253 }); 254 } 255 } else { 256 // Allow multiple hashes to be passed on init 257 if (args.length) { 258 options = $.widget.extend.apply(null, [options].concat(args)); 259 } 260 261 this.each(function () { 262 var instance = $.data(this, fullName); 263 if (instance) { 264 instance.option(options || {}); 265 if (instance._init) { 266 instance._init(); 267 } 268 } else { 269 $.data(this, fullName, new object(options, this)); 270 } 271 }); 272 } 273 274 return returnValue; 275 }; 276 }; 277 278 $.Widget = function ( /* options, element */) { }; 279 $.Widget._childConstructors = []; 280 281 $.Widget.prototype = { 282 widgetName: "widget", 283 widgetEventPrefix: "", 284 defaultElement: "<div>", 285 286 options: { 287 classes: {}, 288 disabled: false, 289 290 // Callbacks 291 create: null 292 }, 293 294 _createWidget: function (options, element) { 295 element = $(element || this.defaultElement || this)[0]; 296 this.element = $(element); 297 this.uuid = widgetUuid++; 298 this.eventNamespace = "." + this.widgetName + this.uuid; 299 300 this.bindings = $(); 301 this.hoverable = $(); 302 this.focusable = $(); 303 this.classesElementLookup = {}; 304 305 if (element !== this) { 306 $.data(element, this.widgetFullName, this); 307 this._on(true, this.element, { 308 remove: function (event) { 309 if (event.target === element) { 310 this.destroy(); 311 } 312 } 313 }); 314 this.document = $(element.style ? 315 316 // Element within the document 317 element.ownerDocument : 318
vendor: 4,403 bytes, lines 319-486
319 // Element is window or document 320 element.document || element); 321 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 322 } 323 324 this.options = $.widget.extend({}, 325 this.options, 326 this._getCreateOptions(), 327 options); 328 329 this._create(); 330 331 if (this.options.disabled) { 332 this._setOptionDisabled(this.options.disabled); 333 } 334 335 this._trigger("create", null, this._getCreateEventData()); 336 this._init(); 337 }, 338 339 _getCreateOptions: function () { 340 return {}; 341 }, 342 343 _getCreateEventData: $.noop, 344 345 _create: $.noop, 346 347 _init: $.noop, 348 349 destroy: function () { 350 var that = this; 351 352 this._destroy(); 353 $.each(this.classesElementLookup, function (key, value) { 354 that._removeClass(value, key); 355 }); 356 357 // We can probably remove the unbind calls in 2.0 358 // all event bindings should go through this._on() 359 this.element 360 .off(this.eventNamespace) 361 .removeData(this.widgetFullName); 362 this.widget() 363 .off(this.eventNamespace) 364 .removeAttr("aria-disabled"); 365 366 // Clean up events and states 367 this.bindings.off(this.eventNamespace); 368 }, 369 370 _destroy: $.noop, 371 372 widget: function () { 373 return this.element; 374 }, 375 376 option: function (key, value) { 377 var options = key; 378 var parts; 379 var curOption; 380 var i; 381 382 if (arguments.length === 0) { 383 // Don't return a reference to the internal hash 384 return $.widget.extend({}, this.options); 385 } 386 387 if (typeof key === "string") { 388 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 389 options = {}; 390 parts = key.split("."); 391 key = parts.shift(); 392 if (parts.length) { 393 curOption = options[key] = $.widget.extend({}, this.options[key]); 394 for (i = 0; i < parts.length - 1; i++) { 395 curOption[parts[i]] = curOption[parts[i]] || {}; 396 curOption = curOption[parts[i]]; 397 } 398 key = parts.pop(); 399 if (arguments.length === 1) { 400 return curOption[key] === undefined ? null : curOption[key]; 401 } 402 curOption[key] = value; 403 } else { 404 if (arguments.length === 1) { 405 return this.options[key] === undefined ? null : this.options[key]; 406 } 407 options[key] = value; 408 } 409 } 410 411 this._setOptions(options); 412 413 return this; 414 }, 415 416 _setOptions: function (options) { 417 var key; 418 419 for (key in options) { 420 this._setOption(key, options[key]); 421 } 422 423 return this; 424 }, 425 426 _setOption: function (key, value) { 427 if (key === "classes") { 428 this._setOptionClasses(value); 429 } 430 431 this.options[key] = value; 432 433 if (key === "disabled") { 434 this._setOptionDisabled(value); 435 } 436 437 return this; 438 }, 439 440 _setOptionClasses: function (value) { 441 var classKey, elements, currentElements; 442 443 for (classKey in value) { 444 currentElements = this.classesElementLookup[classKey]; 445 if (value[classKey] === this.options.classes[classKey] || 446 !currentElements || 447 !currentElements.length) { 448 continue; 449 } 450 451 // We are doing this to create a new jQuery object because the _removeClass() call 452 // on the next line is going to destroy the reference to the current elements being 453 // tracked. We need to save a copy of this collection so that we can add the new classes 454 // below. 455 elements = $(currentElements.get()); 456 this._removeClass(currentElements, classKey); 457 458 // We don't use _addClass() here, because that uses this.options.classes 459 // for generating the string of classes. We want to use the value passed in from 460 // _setOption(), this is the new value of the classes option which was passed to 461 // _setOption(). We pass this value directly to _classes(). 462 elements.addClass(this._classes({ 463 element: elements, 464 keys: classKey, 465 classes: value, 466 add: true 467 })); 468 } 469 }, 470 471 _setOptionDisabled: function (value) { 472 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value); 473 474 // If the widget is becoming disabled, then nothing is interactive 475 if (value) { 476 this._removeClass(this.hoverable, null, "ui-state-hover"); 477 this._removeClass(this.focusable, null, "ui-state-focus"); 478 } 479 }, 480 481 enable: function () { 482 return this._setOptions({ disabled: false }); 483 }, 484 485 disable: function () { 486 return this._setOptions({ disabled: true });
vendor: 7,063 bytes, lines 487-732
487 }, 488 489 _classes: function (options) { 490 var full = []; 491 var that = this; 492 493 options = $.extend({ 494 element: this.element, 495 classes: this.options.classes || {} 496 }, options); 497 498 function processClassString(classes, checkOption) { 499 var current, i; 500 for (i = 0; i < classes.length; i++) { 501 current = that.classesElementLookup[classes[i]] || $(); 502 if (options.add) { 503 current = $($.unique(current.get().concat(options.element.get()))); 504 } else { 505 current = $(current.not(options.element).get()); 506 } 507 that.classesElementLookup[classes[i]] = current; 508 full.push(classes[i]); 509 if (checkOption && options.classes[classes[i]]) { 510 full.push(options.classes[classes[i]]); 511 } 512 } 513 } 514 515 this._on(options.element, { 516 "remove": "_untrackClassesElement" 517 }); 518 519 if (options.keys) { 520 processClassString(options.keys.match(/\S+/g) || [], true); 521 } 522 if (options.extra) { 523 processClassString(options.extra.match(/\S+/g) || []); 524 } 525 526 return full.join(" "); 527 }, 528 529 _untrackClassesElement: function (event) { 530 var that = this; 531 $.each(that.classesElementLookup, function (key, value) { 532 if ($.inArray(event.target, value) !== -1) { 533 that.classesElementLookup[key] = $(value.not(event.target).get()); 534 } 535 }); 536 }, 537 538 _removeClass: function (element, keys, extra) { 539 return this._toggleClass(element, keys, extra, false); 540 }, 541 542 _addClass: function (element, keys, extra) { 543 return this._toggleClass(element, keys, extra, true); 544 }, 545 546 _toggleClass: function (element, keys, extra, add) { 547 add = (typeof add === "boolean") ? add : extra; 548 var shift = (typeof element === "string" || element === null), 549 options = { 550 extra: shift ? keys : extra, 551 keys: shift ? element : keys, 552 element: shift ? this.element : element, 553 add: add 554 }; 555 options.element.toggleClass(this._classes(options), add); 556 return this; 557 }, 558 559 _on: function (suppressDisabledCheck, element, handlers) { 560 var delegateElement; 561 var instance = this; 562 563 // No suppressDisabledCheck flag, shuffle arguments 564 if (typeof suppressDisabledCheck !== "boolean") { 565 handlers = element; 566 element = suppressDisabledCheck; 567 suppressDisabledCheck = false; 568 } 569 570 // No element argument, shuffle and use this.element 571 if (!handlers) { 572 handlers = element; 573 element = this.element; 574 delegateElement = this.widget(); 575 } else { 576 element = delegateElement = $(element); 577 this.bindings = this.bindings.add(element); 578 } 579 580 $.each(handlers, function (event, handler) { 581 function handlerProxy() { 582 // Allow widgets to customize the disabled handling 583 // - disabled as an array instead of boolean 584 // - disabled class as method for disabling individual parts 585 if (!suppressDisabledCheck && 586 (instance.options.disabled === true || 587 $(this).hasClass("ui-state-disabled"))) { 588 return; 589 } 590 return (typeof handler === "string" ? instance[handler] : handler) 591 .apply(instance, arguments); 592 } 593 594 // Copy the guid so direct unbinding works 595 if (typeof handler !== "string") { 596 handlerProxy.guid = handler.guid = 597 handler.guid || handlerProxy.guid || $.guid++; 598 } 599 600 var match = event.match(/^([\w:-]*)\s*(.*)$/); 601 var eventName = match[1] + instance.eventNamespace; 602 var selector = match[2]; 603 604 if (selector) { 605 delegateElement.on(eventName, selector, handlerProxy); 606 } else { 607 element.on(eventName, handlerProxy); 608 } 609 }); 610 }, 611 612 _off: function (element, eventName) { 613 eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + 614 this.eventNamespace; 615 element.off(eventName).off(eventName); 616 617 // Clear the stack to avoid memory leaks (#10056) 618 this.bindings = $(this.bindings.not(element).get()); 619 this.focusable = $(this.focusable.not(element).get()); 620 this.hoverable = $(this.hoverable.not(element).get()); 621 }, 622 623 _delay: function (handler, delay) { 624 function handlerProxy() { 625 return (typeof handler === "string" ? instance[handler] : handler) 626 .apply(instance, arguments); 627 } 628 var instance = this; 629 return setTimeout(handlerProxy, delay || 0); 630 }, 631 632 _hoverable: function (element) { 633 this.hoverable = this.hoverable.add(element); 634 this._on(element, { 635 mouseenter: function (event) { 636 this._addClass($(event.currentTarget), null, "ui-state-hover"); 637 }, 638 mouseleave: function (event) { 639 this._removeClass($(event.currentTarget), null, "ui-state-hover"); 640 } 641 }); 642 }, 643 644 _focusable: function (element) { 645 this.focusable = this.focusable.add(element); 646 this._on(element, { 647 focusin: function (event) { 648 this._addClass($(event.currentTarget), null, "ui-state-focus"); 649 }, 650 focusout: function (event) { 651 this._removeClass($(event.currentTarget), null, "ui-state-focus"); 652 } 653 }); 654 }, 655 656 _trigger: function (type, event, data) { 657 var prop, orig; 658 var callback = this.options[type]; 659 660 data = data || {}; 661 event = $.Event(event); 662 event.type = (type === this.widgetEventPrefix ? 663 type : 664 this.widgetEventPrefix + type).toLowerCase(); 665 666 // The original event may come from any element 667 // so we need to reset the target on the new event 668 event.target = this.element[0]; 669 670 // Copy original event properties over to the new event 671 orig = event.originalEvent; 672 if (orig) { 673 for (prop in orig) { 674 if (!(prop in event)) { 675 event[prop] = orig[prop]; 676 } 677 } 678 } 679 680 this.element.trigger(event, data); 681 return !($.isFunction(callback) && 682 callback.apply(this.element[0], [event].concat(data)) === false || 683 event.isDefaultPrevented()); 684 } 685 }; 686 687 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 688 $.Widget.prototype["_" + method] = function (element, options, callback) { 689 if (typeof options === "string") { 690 options = { effect: options }; 691 } 692 693 var hasOptions; 694 var effectName = !options ? 695 method : 696 options === true || typeof options === "number" ? 697 defaultEffect : 698 options.effect || defaultEffect; 699 700 options = options || {}; 701 if (typeof options === "number") { 702 options = { duration: options }; 703 } 704 705 hasOptions = !$.isEmptyObject(options); 706 options.complete = callback; 707 708 if (options.delay) { 709 element.delay(options.delay); 710 } 711 712 if (hasOptions && $.effects && $.effects.effect[effectName]) { 713 element[method](options); 714 } else if (effectName !== method && element[effectName]) { 715 element[effectName](options.duration, options.easing, callback); 716 } else { 717 element.queue(function (next) { 718 $(this)[method](); 719 if (callback) { 720 callback.call(element[0]); 721 } 722 next(); 723 }); 724 } 725 }; 726 }); 727 728 var widget = $.widget; 729 730 /*! 731 * jQuery UI Position 1.12.1 732 * http://jqueryui.com
vendor: 5,440 bytes, lines 733-914
733 * 734 * Copyright jQuery Foundation and other contributors 735 * Released under the MIT license. 736 * http://jquery.org/license 737 * 738 * http://api.jqueryui.com/position/ 739 */ 740 741 //>>label: Position 742 //>>group: Core 743 //>>description: Positions elements relative to other elements. 744 //>>docs: http://api.jqueryui.com/position/ 745 //>>demos: http://jqueryui.com/position/ 746 747 (function () { 748 var cachedScrollbarWidth, 749 max = Math.max, 750 abs = Math.abs, 751 rhorizontal = /left|center|right/, 752 rvertical = /top|center|bottom/, 753 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 754 rposition = /^\w+/, 755 rpercent = /%$/, 756 _position = $.fn.position; 757 758 function getOffsets(offsets, width, height) { 759 return [ 760 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 761 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1) 762 ]; 763 } 764 765 function parseCss(element, property) { 766 return parseInt($.css(element, property), 10) || 0; 767 } 768 769 function getDimensions(elem) { 770 var raw = elem[0]; 771 if (raw.nodeType === 9) { 772 return { 773 width: elem.width(), 774 height: elem.height(), 775 offset: { top: 0, left: 0 } 776 }; 777 } 778 if ($.isWindow(raw)) { 779 return { 780 width: elem.width(), 781 height: elem.height(), 782 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 783 }; 784 } 785 if (raw.preventDefault) { 786 return { 787 width: 0, 788 height: 0, 789 offset: { top: raw.pageY, left: raw.pageX } 790 }; 791 } 792 return { 793 width: elem.outerWidth(), 794 height: elem.outerHeight(), 795 offset: elem.offset() 796 }; 797 } 798 799 $.position = { 800 scrollbarWidth: function () { 801 if (cachedScrollbarWidth !== undefined) { 802 return cachedScrollbarWidth; 803 } 804 var w1, w2, 805 div = $("<div " + 806 "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" + 807 "<div style='height:100px;width:auto;'></div></div>"), 808 innerDiv = div.children()[0]; 809 810 $("body").append(div); 811 w1 = innerDiv.offsetWidth; 812 div.css("overflow", "scroll"); 813 814 w2 = innerDiv.offsetWidth; 815 816 if (w1 === w2) { 817 w2 = div[0].clientWidth; 818 } 819 820 div.remove(); 821 822 return (cachedScrollbarWidth = w1 - w2); 823 }, 824 getScrollInfo: function (within) { 825 var overflowX = within.isWindow || within.isDocument ? "" : 826 within.element.css("overflow-x"), 827 overflowY = within.isWindow || within.isDocument ? "" : 828 within.element.css("overflow-y"), 829 hasOverflowX = overflowX === "scroll" || 830 (overflowX === "auto" && within.width < within.element[0].scrollWidth), 831 hasOverflowY = overflowY === "scroll" || 832 (overflowY === "auto" && within.height < within.element[0].scrollHeight); 833 return { 834 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 835 height: hasOverflowX ? $.position.scrollbarWidth() : 0 836 }; 837 }, 838 getWithinInfo: function (element) { 839 var withinElement = $(element || window), 840 isWindow = $.isWindow(withinElement[0]), 841 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9, 842 hasOffset = !isWindow && !isDocument; 843 return { 844 element: withinElement, 845 isWindow: isWindow, 846 isDocument: isDocument, 847 offset: hasOffset ? $(element).offset() : { left: 0, top: 0 }, 848 scrollLeft: withinElement.scrollLeft(), 849 scrollTop: withinElement.scrollTop(), 850 width: withinElement.outerWidth(), 851 height: withinElement.outerHeight() 852 }; 853 } 854 }; 855 856 $.fn.position = function (options) { 857 if (!options || !options.of) { 858 return _position.apply(this, arguments); 859 } 860 861 // Make a copy, we don't want to modify arguments 862 options = $.extend({}, options); 863 864 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 865 target = $(options.of), 866 within = $.position.getWithinInfo(options.within), 867 scrollInfo = $.position.getScrollInfo(within), 868 collision = (options.collision || "flip").split(" "), 869 offsets = {}; 870 871 dimensions = getDimensions(target); 872 if (target[0].preventDefault) { 873 // Force left top to allow flipping 874 options.at = "left top"; 875 } 876 targetWidth = dimensions.width; 877 targetHeight = dimensions.height; 878 targetOffset = dimensions.offset; 879 880 // Clone to reuse original targetOffset later 881 basePosition = $.extend({}, targetOffset); 882 883 // Force my and at to have valid horizontal and vertical positions 884 // if a value is missing or invalid, it will be converted to center 885 $.each(["my", "at"], function () { 886 var pos = (options[this] || "").split(" "), 887 horizontalOffset, 888 verticalOffset; 889 890 if (pos.length === 1) { 891 pos = rhorizontal.test(pos[0]) ? 892 pos.concat(["center"]) : 893 rvertical.test(pos[0]) ? 894 ["center"].concat(pos) : 895 ["center", "center"]; 896 } 897 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 898 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 899 900 // Calculate offsets 901 horizontalOffset = roffset.exec(pos[0]); 902 verticalOffset = roffset.exec(pos[1]); 903 offsets[this] = [ 904 horizontalOffset ? horizontalOffset[0] : 0, 905 verticalOffset ? verticalOffset[0] : 0 906 ]; 907 908 // Reduce to just the positions without the offsets 909 options[this] = [ 910 rposition.exec(pos[0])[0], 911 rposition.exec(pos[1])[0] 912 ]; 913 }); 914
vendor: 10,135 bytes, lines 915-1213
915 // Normalize collision option 916 if (collision.length === 1) { 917 collision[1] = collision[0]; 918 } 919 920 if (options.at[0] === "right") { 921 basePosition.left += targetWidth; 922 } else if (options.at[0] === "center") { 923 basePosition.left += targetWidth / 2; 924 } 925 926 if (options.at[1] === "bottom") { 927 basePosition.top += targetHeight; 928 } else if (options.at[1] === "center") { 929 basePosition.top += targetHeight / 2; 930 } 931 932 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 933 basePosition.left += atOffset[0]; 934 basePosition.top += atOffset[1]; 935 936 return this.each(function () { 937 var collisionPosition, using, 938 elem = $(this), 939 elemWidth = elem.outerWidth(), 940 elemHeight = elem.outerHeight(), 941 marginLeft = parseCss(this, "marginLeft"), 942 marginTop = parseCss(this, "marginTop"), 943 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + 944 scrollInfo.width, 945 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + 946 scrollInfo.height, 947 position = $.extend({}, basePosition), 948 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 949 950 if (options.my[0] === "right") { 951 position.left -= elemWidth; 952 } else if (options.my[0] === "center") { 953 position.left -= elemWidth / 2; 954 } 955 956 if (options.my[1] === "bottom") { 957 position.top -= elemHeight; 958 } else if (options.my[1] === "center") { 959 position.top -= elemHeight / 2; 960 } 961 962 position.left += myOffset[0]; 963 position.top += myOffset[1]; 964 965 collisionPosition = { 966 marginLeft: marginLeft, 967 marginTop: marginTop 968 }; 969 970 $.each(["left", "top"], function (i, dir) { 971 if ($.ui.position[collision[i]]) { 972 $.ui.position[collision[i]][dir](position, { 973 targetWidth: targetWidth, 974 targetHeight: targetHeight, 975 elemWidth: elemWidth, 976 elemHeight: elemHeight, 977 collisionPosition: collisionPosition, 978 collisionWidth: collisionWidth, 979 collisionHeight: collisionHeight, 980 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 981 my: options.my, 982 at: options.at, 983 within: within, 984 elem: elem 985 }); 986 } 987 }); 988 989 if (options.using) { 990 // Adds feedback as second argument to using callback, if present 991 using = function (props) { 992 var left = targetOffset.left - position.left, 993 right = left + targetWidth - elemWidth, 994 top = targetOffset.top - position.top, 995 bottom = top + targetHeight - elemHeight, 996 feedback = { 997 target: { 998 element: target, 999 left: targetOffset.left, 1000 top: targetOffset.top, 1001 width: targetWidth, 1002 height: targetHeight 1003 }, 1004 element: { 1005 element: elem, 1006 left: position.left, 1007 top: position.top, 1008 width: elemWidth, 1009 height: elemHeight 1010 }, 1011 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1012 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1013 }; 1014 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 1015 feedback.horizontal = "center"; 1016 } 1017 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 1018 feedback.vertical = "middle"; 1019 } 1020 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 1021 feedback.important = "horizontal"; 1022 } else { 1023 feedback.important = "vertical"; 1024 } 1025 options.using.call(this, props, feedback); 1026 }; 1027 } 1028 1029 elem.offset($.extend(position, { using: using })); 1030 }); 1031 }; 1032 1033 $.ui.position = { 1034 fit: { 1035 left: function (position, data) { 1036 var within = data.within, 1037 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1038 outerWidth = within.width, 1039 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1040 overLeft = withinOffset - collisionPosLeft, 1041 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1042 newOverRight; 1043 1044 // Element is wider than within 1045 if (data.collisionWidth > outerWidth) { 1046 // Element is initially over the left side of within 1047 if (overLeft > 0 && overRight <= 0) { 1048 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1049 withinOffset; 1050 position.left += overLeft - newOverRight; 1051 1052 // Element is initially over right side of within 1053 } else if (overRight > 0 && overLeft <= 0) { 1054 position.left = withinOffset; 1055 1056 // Element is initially over both left and right sides of within 1057 } else { 1058 if (overLeft > overRight) { 1059 position.left = withinOffset + outerWidth - data.collisionWidth; 1060 } else { 1061 position.left = withinOffset; 1062 } 1063 } 1064 1065 // Too far left -> align with left edge 1066 } else if (overLeft > 0) { 1067 position.left += overLeft; 1068 1069 // Too far right -> align with right edge 1070 } else if (overRight > 0) { 1071 position.left -= overRight; 1072 1073 // Adjust based on position and margin 1074 } else { 1075 position.left = max(position.left - collisionPosLeft, position.left); 1076 } 1077 }, 1078 top: function (position, data) { 1079 var within = data.within, 1080 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1081 outerHeight = data.within.height, 1082 collisionPosTop = position.top - data.collisionPosition.marginTop, 1083 overTop = withinOffset - collisionPosTop, 1084 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1085 newOverBottom; 1086 1087 // Element is taller than within 1088 if (data.collisionHeight > outerHeight) { 1089 // Element is initially over the top of within 1090 if (overTop > 0 && overBottom <= 0) { 1091 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1092 withinOffset; 1093 position.top += overTop - newOverBottom; 1094 1095 // Element is initially over bottom of within 1096 } else if (overBottom > 0 && overTop <= 0) { 1097 position.top = withinOffset; 1098 1099 // Element is initially over both top and bottom of within 1100 } else { 1101 if (overTop > overBottom) { 1102 position.top = withinOffset + outerHeight - data.collisionHeight; 1103 } else { 1104 position.top = withinOffset; 1105 } 1106 } 1107 1108 // Too far up -> align with top 1109 } else if (overTop > 0) { 1110 position.top += overTop; 1111 1112 // Too far down -> align with bottom edge 1113 } else if (overBottom > 0) { 1114 position.top -= overBottom; 1115 1116 // Adjust based on position and margin 1117 } else { 1118 position.top = max(position.top - collisionPosTop, position.top); 1119 } 1120 } 1121 }, 1122 flip: { 1123 left: function (position, data) { 1124 var within = data.within, 1125 withinOffset = within.offset.left + within.scrollLeft, 1126 outerWidth = within.width, 1127 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1128 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1129 overLeft = collisionPosLeft - offsetLeft, 1130 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1131 myOffset = data.my[0] === "left" ? 1132 -data.elemWidth : 1133 data.my[0] === "right" ? 1134 data.elemWidth : 1135 0, 1136 atOffset = data.at[0] === "left" ? 1137 data.targetWidth : 1138 data.at[0] === "right" ? 1139 -data.targetWidth : 1140 0, 1141 offset = -2 * data.offset[0], 1142 newOverRight, 1143 newOverLeft; 1144 1145 if (overLeft < 0) { 1146 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1147 outerWidth - withinOffset; 1148 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 1149 position.left += myOffset + atOffset + offset; 1150 } 1151 } else if (overRight > 0) { 1152 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1153 atOffset + offset - offsetLeft; 1154 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 1155 position.left += myOffset + atOffset + offset; 1156 } 1157 } 1158 }, 1159 top: function (position, data) { 1160 var within = data.within, 1161 withinOffset = within.offset.top + within.scrollTop, 1162 outerHeight = within.height, 1163 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1164 collisionPosTop = position.top - data.collisionPosition.marginTop, 1165 overTop = collisionPosTop - offsetTop, 1166 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1167 top = data.my[1] === "top", 1168 myOffset = top ? 1169 -data.elemHeight : 1170 data.my[1] === "bottom" ? 1171 data.elemHeight : 1172 0, 1173 atOffset = data.at[1] === "top" ? 1174 data.targetHeight : 1175 data.at[1] === "bottom" ? 1176 -data.targetHeight : 1177 0, 1178 offset = -2 * data.offset[1], 1179 newOverTop, 1180 newOverBottom; 1181 if (overTop < 0) { 1182 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1183 outerHeight - withinOffset; 1184 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 1185 position.top += myOffset + atOffset + offset; 1186 } 1187 } else if (overBottom > 0) { 1188 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1189 offset - offsetTop; 1190 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 1191 position.top += myOffset + atOffset + offset; 1192 } 1193 } 1194 } 1195 }, 1196 flipfit: { 1197 left: function () { 1198 $.ui.position.flip.left.apply(this, arguments); 1199 $.ui.position.fit.left.apply(this, arguments); 1200 }, 1201 top: function () { 1202 $.ui.position.flip.top.apply(this, arguments); 1203 $.ui.position.fit.top.apply(this, arguments); 1204 } 1205 } 1206 }; 1207 })(); 1208 1209 var position = $.ui.position; 1210 1211 /*! 1212 * jQuery UI :data 1.12.1 1213 * http://jqueryui.com
vendor: 5,662 bytes, lines 1214-1435
1214 * 1215 * Copyright jQuery Foundation and other contributors 1216 * Released under the MIT license. 1217 * http://jquery.org/license 1218 */ 1219 1220 //>>label: :data Selector 1221 //>>group: Core 1222 //>>description: Selects elements which have data stored under the specified key. 1223 //>>docs: http://api.jqueryui.com/data-selector/ 1224 1225 var data = $.extend($.expr[":"], { 1226 data: $.expr.createPseudo ? 1227 $.expr.createPseudo(function (dataName) { 1228 return function (elem) { 1229 return !!$.data(elem, dataName); 1230 }; 1231 }) : 1232 1233 // Support: jQuery <1.8 1234 function (elem, i, match) { 1235 return !!$.data(elem, match[3]); 1236 } 1237 }); 1238 1239 /*! 1240 * jQuery UI Disable Selection 1.12.1 1241 * http://jqueryui.com 1242 * 1243 * Copyright jQuery Foundation and other contributors 1244 * Released under the MIT license. 1245 * http://jquery.org/license 1246 */ 1247 1248 //>>label: disableSelection 1249 //>>group: Core 1250 //>>description: Disable selection of text content within the set of matched elements. 1251 //>>docs: http://api.jqueryui.com/disableSelection/ 1252 1253 // This file is deprecated 1254 1255 var disableSelection = $.fn.extend({ 1256 disableSelection: (function () { 1257 var eventType = "onselectstart" in document.createElement("div") ? 1258 "selectstart" : 1259 "mousedown"; 1260 1261 return function () { 1262 return this.on(eventType + ".ui-disableSelection", function (event) { 1263 event.preventDefault(); 1264 }); 1265 }; 1266 })(), 1267 1268 enableSelection: function () { 1269 return this.off(".ui-disableSelection"); 1270 } 1271 }); 1272 1273 /*! 1274 * jQuery UI Effects 1.12.1 1275 * http://jqueryui.com 1276 * 1277 * Copyright jQuery Foundation and other contributors 1278 * Released under the MIT license. 1279 * http://jquery.org/license 1280 */ 1281 1282 //>>label: Effects Core 1283 //>>group: Effects 1284 // jscs:disable maximumLineLength 1285 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 1286 // jscs:enable maximumLineLength 1287 //>>docs: http://api.jqueryui.com/category/effects-core/ 1288 //>>demos: http://jqueryui.com/effect/ 1289 1290 var dataSpace = "ui-effects-", 1291 dataSpaceStyle = "ui-effects-style", 1292 dataSpaceAnimated = "ui-effects-animated", 1293 1294 // Create a local jQuery because jQuery Color relies on it and the 1295 // global may not exist with AMD and a custom build (#10199) 1296 jQuery = $; 1297 1298 $.effects = { 1299 effect: {} 1300 }; 1301 1302 /*! 1303 * jQuery Color Animations v2.1.2 1304 * https://github.com/jquery/jquery-color 1305 * 1306 * Copyright 2014 jQuery Foundation and other contributors 1307 * Released under the MIT license. 1308 * http://jquery.org/license 1309 * 1310 * Date: Wed Jan 16 08:47:09 2013 -0600 1311 */ 1312 (function (jQuery, undefined) { 1313 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1314 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1315 1316 // Plusequals test for += 100 -= 100 1317 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1318 1319 // A set of RE's that can match strings and generate color tuples. 1320 stringParsers = [{ 1321 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1322 parse: function (execResult) { 1323 return [ 1324 execResult[1], 1325 execResult[2], 1326 execResult[3], 1327 execResult[4] 1328 ]; 1329 } 1330 }, { 1331 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1332 parse: function (execResult) { 1333 return [ 1334 execResult[1] * 2.55, 1335 execResult[2] * 2.55, 1336 execResult[3] * 2.55, 1337 execResult[4] 1338 ]; 1339 } 1340 }, { 1341 // This regex ignores A-F because it's compared against an already lowercased string 1342 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 1343 parse: function (execResult) { 1344 return [ 1345 parseInt(execResult[1], 16), 1346 parseInt(execResult[2], 16), 1347 parseInt(execResult[3], 16) 1348 ]; 1349 } 1350 }, { 1351 // This regex ignores A-F because it's compared against an already lowercased string 1352 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 1353 parse: function (execResult) { 1354 return [ 1355 parseInt(execResult[1] + execResult[1], 16), 1356 parseInt(execResult[2] + execResult[2], 16), 1357 parseInt(execResult[3] + execResult[3], 16) 1358 ]; 1359 } 1360 }, { 1361 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1362 space: "hsla", 1363 parse: function (execResult) { 1364 return [ 1365 execResult[1], 1366 execResult[2] / 100, 1367 execResult[3] / 100, 1368 execResult[4] 1369 ]; 1370 } 1371 }], 1372 1373 // JQuery.Color( ) 1374 color = jQuery.Color = function (color, green, blue, alpha) { 1375 return new jQuery.Color.fn.parse(color, green, blue, alpha); 1376 }, 1377 spaces = { 1378 rgba: { 1379 props: { 1380 red: { 1381 idx: 0, 1382 type: "byte" 1383 }, 1384 green: { 1385 idx: 1, 1386 type: "byte" 1387 }, 1388 blue: { 1389 idx: 2, 1390 type: "byte" 1391 } 1392 } 1393 }, 1394 1395 hsla: { 1396 props: { 1397 hue: { 1398 idx: 0, 1399 type: "degrees" 1400 }, 1401 saturation: { 1402 idx: 1, 1403 type: "percent" 1404 }, 1405 lightness: { 1406 idx: 2, 1407 type: "percent" 1408 } 1409 } 1410 } 1411 }, 1412 propTypes = { 1413 "byte": { 1414 floor: true, 1415 max: 255 1416 }, 1417 "percent": { 1418 max: 1 1419 }, 1420 "degrees": { 1421 mod: 360, 1422 floor: true 1423 } 1424 }, 1425 support = color.support = {}, 1426 1427 // Element for support tests 1428 supportElem = jQuery("<p>")[0], 1429 1430 // Colors = jQuery.Color.names 1431 colors, 1432 1433 // Local aliases of functions called often 1434 each = jQuery.each; 1435
vendor: 15,504 bytes, lines 1436-2007
1436 // Determine rgba support immediately 1437 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1438 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 1439 1440 // Define cache name and alpha properties 1441 // for rgba and hsla spaces 1442 each(spaces, function (spaceName, space) { 1443 space.cache = "_" + spaceName; 1444 space.props.alpha = { 1445 idx: 3, 1446 type: "percent", 1447 def: 1 1448 }; 1449 }); 1450 1451 function clamp(value, prop, allowEmpty) { 1452 var type = propTypes[prop.type] || {}; 1453 1454 if (value == null) { 1455 return (allowEmpty || !prop.def) ? null : prop.def; 1456 } 1457 1458 // ~~ is an short way of doing floor for positive numbers 1459 value = type.floor ? ~~value : parseFloat(value); 1460 1461 // IE will pass in empty strings as value for alpha, 1462 // which will hit this case 1463 if (isNaN(value)) { 1464 return prop.def; 1465 } 1466 1467 if (type.mod) { 1468 // We add mod before modding to make sure that negatives values 1469 // get converted properly: -10 -> 350 1470 return (value + type.mod) % type.mod; 1471 } 1472 1473 // For now all property types without mod have min and max 1474 return 0 > value ? 0 : type.max < value ? type.max : value; 1475 } 1476 1477 function stringParse(string) { 1478 var inst = color(), 1479 rgba = inst._rgba = []; 1480 1481 string = string.toLowerCase(); 1482 1483 each(stringParsers, function (i, parser) { 1484 var parsed, 1485 match = parser.re.exec(string), 1486 values = match && parser.parse(match), 1487 spaceName = parser.space || "rgba"; 1488 1489 if (values) { 1490 parsed = inst[spaceName](values); 1491 1492 // If this was an rgba parse the assignment might happen twice 1493 // oh well.... 1494 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 1495 rgba = inst._rgba = parsed._rgba; 1496 1497 // Exit each( stringParsers ) here because we matched 1498 return false; 1499 } 1500 }); 1501 1502 // Found a stringParser that handled it 1503 if (rgba.length) { 1504 // If this came from a parsed string, force "transparent" when alpha is 0 1505 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 1506 if (rgba.join() === "0,0,0,0") { 1507 jQuery.extend(rgba, colors.transparent); 1508 } 1509 return inst; 1510 } 1511 1512 // Named colors 1513 return colors[string]; 1514 } 1515 1516 color.fn = jQuery.extend(color.prototype, { 1517 parse: function (red, green, blue, alpha) { 1518 if (red === undefined) { 1519 this._rgba = [null, null, null, null]; 1520 return this; 1521 } 1522 if (red.jquery || red.nodeType) { 1523 red = jQuery(red).css(green); 1524 green = undefined; 1525 } 1526 1527 var inst = this, 1528 type = jQuery.type(red), 1529 rgba = this._rgba = []; 1530 1531 // More than 1 argument specified - assume ( red, green, blue, alpha ) 1532 if (green !== undefined) { 1533 red = [red, green, blue, alpha]; 1534 type = "array"; 1535 } 1536 1537 if (type === "string") { 1538 return this.parse(stringParse(red) || colors._default); 1539 } 1540 1541 if (type === "array") { 1542 each(spaces.rgba.props, function (key, prop) { 1543 rgba[prop.idx] = clamp(red[prop.idx], prop); 1544 }); 1545 return this; 1546 } 1547 1548 if (type === "object") { 1549 if (red instanceof color) { 1550 each(spaces, function (spaceName, space) { 1551 if (red[space.cache]) { 1552 inst[space.cache] = red[space.cache].slice(); 1553 } 1554 }); 1555 } else { 1556 each(spaces, function (spaceName, space) { 1557 var cache = space.cache; 1558 each(space.props, function (key, prop) { 1559 // If the cache doesn't exist, and we know how to convert 1560 if (!inst[cache] && space.to) { 1561 // If the value was null, we don't need to copy it 1562 // if the key was alpha, we don't need to copy it either 1563 if (key === "alpha" || red[key] == null) { 1564 return; 1565 } 1566 inst[cache] = space.to(inst._rgba); 1567 } 1568 1569 // This is the only case where we allow nulls for ALL properties. 1570 // call clamp with alwaysAllowEmpty 1571 inst[cache][prop.idx] = clamp(red[key], prop, true); 1572 }); 1573 1574 // Everything defined but alpha? 1575 if (inst[cache] && 1576 jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 1577 // Use the default of 1 1578 inst[cache][3] = 1; 1579 if (space.from) { 1580 inst._rgba = space.from(inst[cache]); 1581 } 1582 } 1583 }); 1584 } 1585 return this; 1586 } 1587 }, 1588 is: function (compare) { 1589 var is = color(compare), 1590 same = true, 1591 inst = this; 1592 1593 each(spaces, function (_, space) { 1594 var localCache, 1595 isCache = is[space.cache]; 1596 if (isCache) { 1597 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 1598 each(space.props, function (_, prop) { 1599 if (isCache[prop.idx] != null) { 1600 same = (isCache[prop.idx] === localCache[prop.idx]); 1601 return same; 1602 } 1603 }); 1604 } 1605 return same; 1606 }); 1607 return same; 1608 }, 1609 _space: function () { 1610 var used = [], 1611 inst = this; 1612 each(spaces, function (spaceName, space) { 1613 if (inst[space.cache]) { 1614 used.push(spaceName); 1615 } 1616 }); 1617 return used.pop(); 1618 }, 1619 transition: function (other, distance) { 1620 var end = color(other), 1621 spaceName = end._space(), 1622 space = spaces[spaceName], 1623 startColor = this.alpha() === 0 ? color("transparent") : this, 1624 start = startColor[space.cache] || space.to(startColor._rgba), 1625 result = start.slice(); 1626 1627 end = end[space.cache]; 1628 each(space.props, function (key, prop) { 1629 var index = prop.idx, 1630 startValue = start[index], 1631 endValue = end[index], 1632 type = propTypes[prop.type] || {}; 1633 1634 // If null, don't override start value 1635 if (endValue === null) { 1636 return; 1637 } 1638 1639 // If null - use end 1640 if (startValue === null) { 1641 result[index] = endValue; 1642 } else { 1643 if (type.mod) { 1644 if (endValue - startValue > type.mod / 2) { 1645 startValue += type.mod; 1646 } else if (startValue - endValue > type.mod / 2) { 1647 startValue -= type.mod; 1648 } 1649 } 1650 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 1651 } 1652 }); 1653 return this[spaceName](result); 1654 }, 1655 blend: function (opaque) { 1656 // If we are already opaque - return ourself 1657 if (this._rgba[3] === 1) { 1658 return this; 1659 } 1660 1661 var rgb = this._rgba.slice(), 1662 a = rgb.pop(), 1663 blend = color(opaque)._rgba; 1664 1665 return color(jQuery.map(rgb, function (v, i) { 1666 return (1 - a) * blend[i] + a * v; 1667 })); 1668 }, 1669 toRgbaString: function () { 1670 var prefix = "rgba(", 1671 rgba = jQuery.map(this._rgba, function (v, i) { 1672 return v == null ? (i > 2 ? 1 : 0) : v; 1673 }); 1674 1675 if (rgba[3] === 1) { 1676 rgba.pop(); 1677 prefix = "rgb("; 1678 } 1679 1680 return prefix + rgba.join() + ")"; 1681 }, 1682 toHslaString: function () { 1683 var prefix = "hsla(", 1684 hsla = jQuery.map(this.hsla(), function (v, i) { 1685 if (v == null) { 1686 v = i > 2 ? 1 : 0; 1687 } 1688 1689 // Catch 1 and 2 1690 if (i && i < 3) { 1691 v = Math.round(v * 100) + "%"; 1692 } 1693 return v; 1694 }); 1695 1696 if (hsla[3] === 1) { 1697 hsla.pop(); 1698 prefix = "hsl("; 1699 } 1700 return prefix + hsla.join() + ")"; 1701 }, 1702 toHexString: function (includeAlpha) { 1703 var rgba = this._rgba.slice(), 1704 alpha = rgba.pop(); 1705 1706 if (includeAlpha) { 1707 rgba.push(~~(alpha * 255)); 1708 } 1709 1710 return "#" + jQuery.map(rgba, function (v) { 1711 // Default to 0 when nulls exist 1712 v = (v || 0).toString(16); 1713 return v.length === 1 ? "0" + v : v; 1714 }).join(""); 1715 }, 1716 toString: function () { 1717 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 1718 } 1719 }); 1720 color.fn.parse.prototype = color.fn; 1721 1722 // Hsla conversions adapted from: 1723 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 1724 1725 function hue2rgb(p, q, h) { 1726 h = (h + 1) % 1; 1727 if (h * 6 < 1) { 1728 return p + (q - p) * h * 6; 1729 } 1730 if (h * 2 < 1) { 1731 return q; 1732 } 1733 if (h * 3 < 2) { 1734 return p + (q - p) * ((2 / 3) - h) * 6; 1735 } 1736 return p; 1737 } 1738 1739 spaces.hsla.to = function (rgba) { 1740 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 1741 return [null, null, null, rgba[3]]; 1742 } 1743 var r = rgba[0] / 255, 1744 g = rgba[1] / 255, 1745 b = rgba[2] / 255, 1746 a = rgba[3], 1747 max = Math.max(r, g, b), 1748 min = Math.min(r, g, b), 1749 diff = max - min, 1750 add = max + min, 1751 l = add * 0.5, 1752 h, s; 1753 1754 if (min === max) { 1755 h = 0; 1756 } else if (r === max) { 1757 h = (60 * (g - b) / diff) + 360; 1758 } else if (g === max) { 1759 h = (60 * (b - r) / diff) + 120; 1760 } else { 1761 h = (60 * (r - g) / diff) + 240; 1762 } 1763 1764 // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 1765 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 1766 if (diff === 0) { 1767 s = 0; 1768 } else if (l <= 0.5) { 1769 s = diff / add; 1770 } else { 1771 s = diff / (2 - add); 1772 } 1773 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 1774 }; 1775 1776 spaces.hsla.from = function (hsla) { 1777 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 1778 return [null, null, null, hsla[3]]; 1779 } 1780 var h = hsla[0] / 360, 1781 s = hsla[1], 1782 l = hsla[2], 1783 a = hsla[3], 1784 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 1785 p = 2 * l - q; 1786 1787 return [ 1788 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 1789 Math.round(hue2rgb(p, q, h) * 255), 1790 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 1791 a 1792 ]; 1793 }; 1794 1795 each(spaces, function (spaceName, space) { 1796 var props = space.props, 1797 cache = space.cache, 1798 to = space.to, 1799 from = space.from; 1800 1801 // Makes rgba() and hsla() 1802 color.fn[spaceName] = function (value) { 1803 // Generate a cache for this space if it doesn't exist 1804 if (to && !this[cache]) { 1805 this[cache] = to(this._rgba); 1806 } 1807 if (value === undefined) { 1808 return this[cache].slice(); 1809 } 1810 1811 var ret, 1812 type = jQuery.type(value), 1813 arr = (type === "array" || type === "object") ? value : arguments, 1814 local = this[cache].slice(); 1815 1816 each(props, function (key, prop) { 1817 var val = arr[type === "object" ? key : prop.idx]; 1818 if (val == null) { 1819 val = local[prop.idx]; 1820 } 1821 local[prop.idx] = clamp(val, prop); 1822 }); 1823 1824 if (from) { 1825 ret = color(from(local)); 1826 ret[cache] = local; 1827 return ret; 1828 } else { 1829 return color(local); 1830 } 1831 }; 1832 1833 // Makes red() green() blue() alpha() hue() saturation() lightness() 1834 each(props, function (key, prop) { 1835 // Alpha is included in more than one space 1836 if (color.fn[key]) { 1837 return; 1838 } 1839 color.fn[key] = function (value) { 1840 var vtype = jQuery.type(value), 1841 fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName), 1842 local = this[fn](), 1843 cur = local[prop.idx], 1844 match; 1845 1846 if (vtype === "undefined") { 1847 return cur; 1848 } 1849 1850 if (vtype === "function") { 1851 value = value.call(this, cur); 1852 vtype = jQuery.type(value); 1853 } 1854 if (value == null && prop.empty) { 1855 return this; 1856 } 1857 if (vtype === "string") { 1858 match = rplusequals.exec(value); 1859 if (match) { 1860 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 1861 } 1862 } 1863 local[prop.idx] = value; 1864 return this[fn](local); 1865 }; 1866 }); 1867 }); 1868 1869 // Add cssHook and .fx.step function for each named hook. 1870 // accept a space separated string of properties 1871 color.hook = function (hook) { 1872 var hooks = hook.split(" "); 1873 each(hooks, function (i, hook) { 1874 jQuery.cssHooks[hook] = { 1875 set: function (elem, value) { 1876 var parsed, curElem, 1877 backgroundColor = ""; 1878 1879 if (value !== "transparent" && (jQuery.type(value) !== "string" || 1880 (parsed = stringParse(value)))) { 1881 value = color(parsed || value); 1882 if (!support.rgba && value._rgba[3] !== 1) { 1883 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 1884 while ( 1885 (backgroundColor === "" || backgroundColor === "transparent") && 1886 curElem && curElem.style 1887 ) { 1888 try { 1889 backgroundColor = jQuery.css(curElem, "backgroundColor"); 1890 curElem = curElem.parentNode; 1891 } catch (e) { 1892 } 1893 } 1894 1895 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 1896 backgroundColor : 1897 "_default"); 1898 } 1899 1900 value = value.toRgbaString(); 1901 } 1902 try { 1903 elem.style[hook] = value; 1904 } catch (e) { 1905 // Wrapped to prevent IE from throwing errors on "invalid" values like 1906 // 'auto' or 'inherit' 1907 } 1908 } 1909 }; 1910 jQuery.fx.step[hook] = function (fx) { 1911 if (!fx.colorInit) { 1912 fx.start = color(fx.elem, hook); 1913 fx.end = color(fx.end); 1914 fx.colorInit = true; 1915 } 1916 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 1917 }; 1918 }); 1919 }; 1920 1921 color.hook(stepHooks); 1922 1923 jQuery.cssHooks.borderColor = { 1924 expand: function (value) { 1925 var expanded = {}; 1926 1927 each(["Top", "Right", "Bottom", "Left"], function (i, part) { 1928 expanded["border" + part + "Color"] = value; 1929 }); 1930 return expanded; 1931 } 1932 }; 1933 1934 // Basic color names only. 1935 // Usage of any of the other color names requires adding yourself or including 1936 // jquery.color.svg-names.js. 1937 colors = jQuery.Color.names = { 1938 // 4.1. Basic color keywords 1939 aqua: "#00ffff", 1940 black: "#000000", 1941 blue: "#0000ff", 1942 fuchsia: "#ff00ff", 1943 gray: "#808080", 1944 green: "#008000", 1945 lime: "#00ff00", 1946 maroon: "#800000", 1947 navy: "#000080", 1948 olive: "#808000", 1949 purple: "#800080", 1950 red: "#ff0000", 1951 silver: "#c0c0c0", 1952 teal: "#008080", 1953 white: "#ffffff", 1954 yellow: "#ffff00", 1955 1956 // 4.2.3. "transparent" color keyword 1957 transparent: [null, null, null, 0], 1958 1959 _default: "#ffffff" 1960 }; 1961 })(jQuery); 1962 1963 /******************************************************************************/ 1964 /****************************** CLASS ANIMATIONS ******************************/ 1965 /******************************************************************************/ 1966 (function () { 1967 var classAnimationActions = ["add", "remove", "toggle"], 1968 shorthandStyles = { 1969 border: 1, 1970 borderBottom: 1, 1971 borderColor: 1, 1972 borderLeft: 1, 1973 borderRight: 1, 1974 borderTop: 1, 1975 borderWidth: 1, 1976 margin: 1, 1977 padding: 1 1978 }; 1979 1980 $.each( 1981 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 1982 function (_, prop) { 1983 $.fx.step[prop] = function (fx) { 1984 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 1985 jQuery.style(fx.elem, prop, fx.end); 1986 fx.setAttr = true; 1987 } 1988 }; 1989 } 1990 ); 1991 1992 function getElementStyles(elem) { 1993 var key, len, 1994 style = elem.ownerDocument.defaultView ? 1995 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 1996 elem.currentStyle, 1997 styles = {}; 1998 1999 if (style && style.length && style[0] && style[style[0]]) { 2000 len = style.length; 2001 while (len--) { 2002 key = style[len]; 2003 if (typeof style[key] === "string") { 2004 styles[$.camelCase(key)] = style[key]; 2005 } 2006 } 2007
vendor: 5,701 bytes, lines 2008-2210
2008 // Support: Opera, IE <9 2009 } else { 2010 for (key in style) { 2011 if (typeof style[key] === "string") { 2012 styles[key] = style[key]; 2013 } 2014 } 2015 } 2016 2017 return styles; 2018 } 2019 2020 function styleDifference(oldStyle, newStyle) { 2021 var diff = {}, 2022 name, value; 2023 2024 for (name in newStyle) { 2025 value = newStyle[name]; 2026 if (oldStyle[name] !== value) { 2027 if (!shorthandStyles[name]) { 2028 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 2029 diff[name] = value; 2030 } 2031 } 2032 } 2033 } 2034 2035 return diff; 2036 } 2037 2038 // Support: jQuery <1.8 2039 if (!$.fn.addBack) { 2040 $.fn.addBack = function (selector) { 2041 return this.add(selector == null ? 2042 this.prevObject : this.prevObject.filter(selector) 2043 ); 2044 }; 2045 } 2046 2047 $.effects.animateClass = function (value, duration, easing, callback) { 2048 var o = $.speed(duration, easing, callback); 2049 2050 return this.queue(function () { 2051 var animated = $(this), 2052 baseClass = animated.attr("class") || "", 2053 applyClassChange, 2054 allAnimations = o.children ? animated.find("*").addBack() : animated; 2055 2056 // Map the animated objects to store the original styles. 2057 allAnimations = allAnimations.map(function () { 2058 var el = $(this); 2059 return { 2060 el: el, 2061 start: getElementStyles(this) 2062 }; 2063 }); 2064 2065 // Apply class change 2066 applyClassChange = function () { 2067 $.each(classAnimationActions, function (i, action) { 2068 if (value[action]) { 2069 animated[action + "Class"](value[action]); 2070 } 2071 }); 2072 }; 2073 applyClassChange(); 2074 2075 // Map all animated objects again - calculate new styles and diff 2076 allAnimations = allAnimations.map(function () { 2077 this.end = getElementStyles(this.el[0]); 2078 this.diff = styleDifference(this.start, this.end); 2079 return this; 2080 }); 2081 2082 // Apply original class 2083 animated.attr("class", baseClass); 2084 2085 // Map all animated objects again - this time collecting a promise 2086 allAnimations = allAnimations.map(function () { 2087 var styleInfo = this, 2088 dfd = $.Deferred(), 2089 opts = $.extend({}, o, { 2090 queue: false, 2091 complete: function () { 2092 dfd.resolve(styleInfo); 2093 } 2094 }); 2095 2096 this.el.animate(this.diff, opts); 2097 return dfd.promise(); 2098 }); 2099 2100 // Once all animations have completed: 2101 $.when.apply($, allAnimations.get()).done(function () { 2102 // Set the final class 2103 applyClassChange(); 2104 2105 // For each animated element, 2106 // clear all css properties that were animated 2107 $.each(arguments, function () { 2108 var el = this.el; 2109 $.each(this.diff, function (key) { 2110 el.css(key, ""); 2111 }); 2112 }); 2113 2114 // This is guarnteed to be there if you use jQuery.speed() 2115 // it also handles dequeuing the next anim... 2116 o.complete.call(animated[0]); 2117 }); 2118 }); 2119 }; 2120 2121 $.fn.extend({ 2122 addClass: (function (orig) { 2123 return function (classNames, speed, easing, callback) { 2124 return speed ? 2125 $.effects.animateClass.call(this, 2126 { add: classNames }, speed, easing, callback) : 2127 orig.apply(this, arguments); 2128 }; 2129 })($.fn.addClass), 2130 2131 removeClass: (function (orig) { 2132 return function (classNames, speed, easing, callback) { 2133 return arguments.length > 1 ? 2134 $.effects.animateClass.call(this, 2135 { remove: classNames }, speed, easing, callback) : 2136 orig.apply(this, arguments); 2137 }; 2138 })($.fn.removeClass), 2139 2140 toggleClass: (function (orig) { 2141 return function (classNames, force, speed, easing, callback) { 2142 if (typeof force === "boolean" || force === undefined) { 2143 if (!speed) { 2144 // Without speed parameter 2145 return orig.apply(this, arguments); 2146 } else { 2147 return $.effects.animateClass.call(this, 2148 (force ? { add: classNames } : { remove: classNames }), 2149 speed, easing, callback); 2150 } 2151 } else { 2152 // Without force parameter 2153 return $.effects.animateClass.call(this, 2154 { toggle: classNames }, force, speed, easing); 2155 } 2156 }; 2157 })($.fn.toggleClass), 2158 2159 switchClass: function (remove, add, speed, easing, callback) { 2160 return $.effects.animateClass.call(this, { 2161 add: add, 2162 remove: remove 2163 }, speed, easing, callback); 2164 } 2165 }); 2166 })(); 2167 2168 /******************************************************************************/ 2169 /*********************************** EFFECTS **********************************/ 2170 /******************************************************************************/ 2171 2172 (function () { 2173 if ($.expr && $.expr.filters && $.expr.filters.animated) { 2174 $.expr.filters.animated = (function (orig) { 2175 return function (elem) { 2176 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 2177 }; 2178 })($.expr.filters.animated); 2179 } 2180 2181 if ($.uiBackCompat !== false) { 2182 $.extend($.effects, { 2183 // Saves a set of properties in a data storage 2184 save: function (element, set) { 2185 var i = 0, length = set.length; 2186 for (; i < length; i++) { 2187 if (set[i] !== null) { 2188 element.data(dataSpace + set[i], element[0].style[set[i]]); 2189 } 2190 } 2191 }, 2192 2193 // Restores a set of previously saved properties from a data storage 2194 restore: function (element, set) { 2195 var val, i = 0, length = set.length; 2196 for (; i < length; i++) { 2197 if (set[i] !== null) { 2198 val = element.data(dataSpace + set[i]); 2199 element.css(set[i], val); 2200 } 2201 } 2202 }, 2203 2204 setMode: function (el, mode) { 2205 if (mode === "toggle") { 2206 mode = el.is(":hidden") ? "show" : "hide"; 2207 } 2208 return mode; 2209 }, 2210
vendor: 4,962 bytes, lines 2211-2401
2211 // Wraps the element around a wrapper that copies position properties 2212 createWrapper: function (element) { 2213 // If the element is already wrapped, return it 2214 if (element.parent().is(".ui-effects-wrapper")) { 2215 return element.parent(); 2216 } 2217 2218 // Wrap the element 2219 var props = { 2220 width: element.outerWidth(true), 2221 height: element.outerHeight(true), 2222 "float": element.css("float") 2223 }, 2224 wrapper = $("<div></div>") 2225 .addClass("ui-effects-wrapper") 2226 .css({ 2227 fontSize: "100%", 2228 background: "transparent", 2229 border: "none", 2230 margin: 0, 2231 padding: 0 2232 }), 2233 2234 // Store the size in case width/height are defined in % - Fixes #5245 2235 size = { 2236 width: element.width(), 2237 height: element.height() 2238 }, 2239 active = document.activeElement; 2240 2241 // Support: Firefox 2242 // Firefox incorrectly exposes anonymous content 2243 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2244 try { 2245 active.id; 2246 } catch (e) { 2247 active = document.body; 2248 } 2249 2250 element.wrap(wrapper); 2251 2252 // Fixes #7595 - Elements lose focus when wrapped. 2253 if (element[0] === active || $.contains(element[0], active)) { 2254 $(active).trigger("focus"); 2255 } 2256 2257 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2258 // lose the reference to the wrapped element 2259 wrapper = element.parent(); 2260 2261 // Transfer positioning properties to the wrapper 2262 if (element.css("position") === "static") { 2263 wrapper.css({ position: "relative" }); 2264 element.css({ position: "relative" }); 2265 } else { 2266 $.extend(props, { 2267 position: element.css("position"), 2268 zIndex: element.css("z-index") 2269 }); 2270 $.each(["top", "left", "bottom", "right"], function (i, pos) { 2271 props[pos] = element.css(pos); 2272 if (isNaN(parseInt(props[pos], 10))) { 2273 props[pos] = "auto"; 2274 } 2275 }); 2276 element.css({ 2277 position: "relative", 2278 top: 0, 2279 left: 0, 2280 right: "auto", 2281 bottom: "auto" 2282 }); 2283 } 2284 element.css(size); 2285 2286 return wrapper.css(props).show(); 2287 }, 2288 2289 removeWrapper: function (element) { 2290 var active = document.activeElement; 2291 2292 if (element.parent().is(".ui-effects-wrapper")) { 2293 element.parent().replaceWith(element); 2294 2295 // Fixes #7595 - Elements lose focus when wrapped. 2296 if (element[0] === active || $.contains(element[0], active)) { 2297 $(active).trigger("focus"); 2298 } 2299 } 2300 2301 return element; 2302 } 2303 }); 2304 } 2305 2306 $.extend($.effects, { 2307 version: "1.12.1", 2308 2309 define: function (name, mode, effect) { 2310 if (!effect) { 2311 effect = mode; 2312 mode = "effect"; 2313 } 2314 2315 $.effects.effect[name] = effect; 2316 $.effects.effect[name].mode = mode; 2317 2318 return effect; 2319 }, 2320 2321 scaledDimensions: function (element, percent, direction) { 2322 if (percent === 0) { 2323 return { 2324 height: 0, 2325 width: 0, 2326 outerHeight: 0, 2327 outerWidth: 0 2328 }; 2329 } 2330 2331 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 2332 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 2333 2334 return { 2335 height: element.height() * y, 2336 width: element.width() * x, 2337 outerHeight: element.outerHeight() * y, 2338 outerWidth: element.outerWidth() * x 2339 }; 2340 }, 2341 2342 clipToBox: function (animation) { 2343 return { 2344 width: animation.clip.right - animation.clip.left, 2345 height: animation.clip.bottom - animation.clip.top, 2346 left: animation.clip.left, 2347 top: animation.clip.top 2348 }; 2349 }, 2350 2351 // Injects recently queued functions to be first in line (after "inprogress") 2352 unshift: function (element, queueLength, count) { 2353 var queue = element.queue(); 2354 2355 if (queueLength > 1) { 2356 queue.splice.apply(queue, 2357 [1, 0].concat(queue.splice(queueLength, count))); 2358 } 2359 element.dequeue(); 2360 }, 2361 2362 saveStyle: function (element) { 2363 element.data(dataSpaceStyle, element[0].style.cssText); 2364 }, 2365 2366 restoreStyle: function (element) { 2367 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 2368 element.removeData(dataSpaceStyle); 2369 }, 2370 2371 mode: function (element, mode) { 2372 var hidden = element.is(":hidden"); 2373 2374 if (mode === "toggle") { 2375 mode = hidden ? "show" : "hide"; 2376 } 2377 if (hidden ? mode === "hide" : mode === "show") { 2378 mode = "none"; 2379 } 2380 return mode; 2381 }, 2382 2383 // Translates a [top,left] array into a baseline value 2384 getBaseline: function (origin, original) { 2385 var y, x; 2386 2387 switch (origin[0]) { 2388 case "top": 2389 y = 0; 2390 break; 2391 case "middle": 2392 y = 0.5; 2393 break; 2394 case "bottom": 2395 y = 1; 2396 break; 2397 default: 2398 y = origin[0] / original.height; 2399 } 2400 2401 switch (origin[1]) {
vendor: 14,382 bytes, lines 2402-2909
2402 case "left": 2403 x = 0; 2404 break; 2405 case "center": 2406 x = 0.5; 2407 break; 2408 case "right": 2409 x = 1; 2410 break; 2411 default: 2412 x = origin[1] / original.width; 2413 } 2414 2415 return { 2416 x: x, 2417 y: y 2418 }; 2419 }, 2420 2421 // Creates a placeholder element so that the original element can be made absolute 2422 createPlaceholder: function (element) { 2423 var placeholder, 2424 cssPosition = element.css("position"), 2425 position = element.position(); 2426 2427 // Lock in margins first to account for form elements, which 2428 // will change margin if you explicitly set height 2429 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 2430 // Support: Safari 2431 element.css({ 2432 marginTop: element.css("marginTop"), 2433 marginBottom: element.css("marginBottom"), 2434 marginLeft: element.css("marginLeft"), 2435 marginRight: element.css("marginRight") 2436 }) 2437 .outerWidth(element.outerWidth()) 2438 .outerHeight(element.outerHeight()); 2439 2440 if (/^(static|relative)/.test(cssPosition)) { 2441 cssPosition = "absolute"; 2442 2443 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 2444 // Convert inline to inline block to account for inline elements 2445 // that turn to inline block based on content (like img) 2446 display: /^(inline|ruby)/.test(element.css("display")) ? 2447 "inline-block" : 2448 "block", 2449 visibility: "hidden", 2450 2451 // Margins need to be set to account for margin collapse 2452 marginTop: element.css("marginTop"), 2453 marginBottom: element.css("marginBottom"), 2454 marginLeft: element.css("marginLeft"), 2455 marginRight: element.css("marginRight"), 2456 "float": element.css("float") 2457 }) 2458 .outerWidth(element.outerWidth()) 2459 .outerHeight(element.outerHeight()) 2460 .addClass("ui-effects-placeholder"); 2461 2462 element.data(dataSpace + "placeholder", placeholder); 2463 } 2464 2465 element.css({ 2466 position: cssPosition, 2467 left: position.left, 2468 top: position.top 2469 }); 2470 2471 return placeholder; 2472 }, 2473 2474 removePlaceholder: function (element) { 2475 var dataKey = dataSpace + "placeholder", 2476 placeholder = element.data(dataKey); 2477 2478 if (placeholder) { 2479 placeholder.remove(); 2480 element.removeData(dataKey); 2481 } 2482 }, 2483 2484 // Removes a placeholder if it exists and restores 2485 // properties that were modified during placeholder creation 2486 cleanUp: function (element) { 2487 $.effects.restoreStyle(element); 2488 $.effects.removePlaceholder(element); 2489 }, 2490 2491 setTransition: function (element, list, factor, value) { 2492 value = value || {}; 2493 $.each(list, function (i, x) { 2494 var unit = element.cssUnit(x); 2495 if (unit[0] > 0) { 2496 value[x] = unit[0] * factor + unit[1]; 2497 } 2498 }); 2499 return value; 2500 } 2501 }); 2502 2503 // Return an effect options object for the given parameters: 2504 function _normalizeArguments(effect, options, speed, callback) { 2505 // Allow passing all options as the first parameter 2506 if ($.isPlainObject(effect)) { 2507 options = effect; 2508 effect = effect.effect; 2509 } 2510 2511 // Convert to an object 2512 effect = { effect: effect }; 2513 2514 // Catch (effect, null, ...) 2515 if (options == null) { 2516 options = {}; 2517 } 2518 2519 // Catch (effect, callback) 2520 if ($.isFunction(options)) { 2521 callback = options; 2522 speed = null; 2523 options = {}; 2524 } 2525 2526 // Catch (effect, speed, ?) 2527 if (typeof options === "number" || $.fx.speeds[options]) { 2528 callback = speed; 2529 speed = options; 2530 options = {}; 2531 } 2532 2533 // Catch (effect, options, callback) 2534 if ($.isFunction(speed)) { 2535 callback = speed; 2536 speed = null; 2537 } 2538 2539 // Add options to effect 2540 if (options) { 2541 $.extend(effect, options); 2542 } 2543 2544 speed = speed || options.duration; 2545 effect.duration = $.fx.off ? 0 : 2546 typeof speed === "number" ? speed : 2547 speed in $.fx.speeds ? $.fx.speeds[speed] : 2548 $.fx.speeds._default; 2549 2550 effect.complete = callback || options.complete; 2551 2552 return effect; 2553 } 2554 2555 function standardAnimationOption(option) { 2556 // Valid standard speeds (nothing, number, named speed) 2557 if (!option || typeof option === "number" || $.fx.speeds[option]) { 2558 return true; 2559 } 2560 2561 // Invalid strings - treat as "normal" speed 2562 if (typeof option === "string" && !$.effects.effect[option]) { 2563 return true; 2564 } 2565 2566 // Complete callback 2567 if ($.isFunction(option)) { 2568 return true; 2569 } 2570 2571 // Options hash (but not naming an effect) 2572 if (typeof option === "object" && !option.effect) { 2573 return true; 2574 } 2575 2576 // Didn't match any standard API 2577 return false; 2578 } 2579 2580 $.fn.extend({ 2581 effect: function ( /* effect, options, speed, callback */) { 2582 var args = _normalizeArguments.apply(this, arguments), 2583 effectMethod = $.effects.effect[args.effect], 2584 defaultMode = effectMethod.mode, 2585 queue = args.queue, 2586 queueName = queue || "fx", 2587 complete = args.complete, 2588 mode = args.mode, 2589 modes = [], 2590 prefilter = function (next) { 2591 var el = $(this), 2592 normalizedMode = $.effects.mode(el, mode) || defaultMode; 2593 2594 // Sentinel for duck-punching the :animated psuedo-selector 2595 el.data(dataSpaceAnimated, true); 2596 2597 // Save effect mode for later use, 2598 // we can't just call $.effects.mode again later, 2599 // as the .show() below destroys the initial state 2600 modes.push(normalizedMode); 2601 2602 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 2603 if (defaultMode && (normalizedMode === "show" || 2604 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 2605 el.show(); 2606 } 2607 2608 if (!defaultMode || normalizedMode !== "none") { 2609 $.effects.saveStyle(el); 2610 } 2611 2612 if ($.isFunction(next)) { 2613 next(); 2614 } 2615 }; 2616 2617 if ($.fx.off || !effectMethod) { 2618 // Delegate to the original method (e.g., .show()) if possible 2619 if (mode) { 2620 return this[mode](args.duration, complete); 2621 } else { 2622 return this.each(function () { 2623 if (complete) { 2624 complete.call(this); 2625 } 2626 }); 2627 } 2628 } 2629 2630 function run(next) { 2631 var elem = $(this); 2632 2633 function cleanup() { 2634 elem.removeData(dataSpaceAnimated); 2635 2636 $.effects.cleanUp(elem); 2637 2638 if (args.mode === "hide") { 2639 elem.hide(); 2640 } 2641 2642 done(); 2643 } 2644 2645 function done() { 2646 if ($.isFunction(complete)) { 2647 complete.call(elem[0]); 2648 } 2649 2650 if ($.isFunction(next)) { 2651 next(); 2652 } 2653 } 2654 2655 // Override mode option on a per element basis, 2656 // as toggle can be either show or hide depending on element state 2657 args.mode = modes.shift(); 2658 2659 if ($.uiBackCompat !== false && !defaultMode) { 2660 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 2661 // Call the core method to track "olddisplay" properly 2662 elem[mode](); 2663 done(); 2664 } else { 2665 effectMethod.call(elem[0], args, done); 2666 } 2667 } else { 2668 if (args.mode === "none") { 2669 // Call the core method to track "olddisplay" properly 2670 elem[mode](); 2671 done(); 2672 } else { 2673 effectMethod.call(elem[0], args, cleanup); 2674 } 2675 } 2676 } 2677 2678 // Run prefilter on all elements first to ensure that 2679 // any showing or hiding happens before placeholder creation, 2680 // which ensures that any layout changes are correctly captured. 2681 return queue === false ? 2682 this.each(prefilter).each(run) : 2683 this.queue(queueName, prefilter).queue(queueName, run); 2684 }, 2685 2686 show: (function (orig) { 2687 return function (option) { 2688 if (standardAnimationOption(option)) { 2689 return orig.apply(this, arguments); 2690 } else { 2691 var args = _normalizeArguments.apply(this, arguments); 2692 args.mode = "show"; 2693 return this.effect.call(this, args); 2694 } 2695 }; 2696 })($.fn.show), 2697 2698 hide: (function (orig) { 2699 return function (option) { 2700 if (standardAnimationOption(option)) { 2701 return orig.apply(this, arguments); 2702 } else { 2703 var args = _normalizeArguments.apply(this, arguments); 2704 args.mode = "hide"; 2705 return this.effect.call(this, args); 2706 } 2707 }; 2708 })($.fn.hide), 2709 2710 toggle: (function (orig) { 2711 return function (option) { 2712 if (standardAnimationOption(option) || typeof option === "boolean") { 2713 return orig.apply(this, arguments); 2714 } else { 2715 var args = _normalizeArguments.apply(this, arguments); 2716 args.mode = "toggle"; 2717 return this.effect.call(this, args); 2718 } 2719 }; 2720 })($.fn.toggle), 2721 2722 cssUnit: function (key) { 2723 var style = this.css(key), 2724 val = []; 2725 2726 $.each(["em", "px", "%", "pt"], function (i, unit) { 2727 if (style.indexOf(unit) > 0) { 2728 val = [parseFloat(style), unit]; 2729 } 2730 }); 2731 return val; 2732 }, 2733 2734 cssClip: function (clipObj) { 2735 if (clipObj) { 2736 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 2737 clipObj.bottom + "px " + clipObj.left + "px)"); 2738 } 2739 return parseClip(this.css("clip"), this); 2740 }, 2741 2742 transfer: function (options, done) { 2743 var element = $(this), 2744 target = $(options.to), 2745 targetFixed = target.css("position") === "fixed", 2746 body = $("body"), 2747 fixTop = targetFixed ? body.scrollTop() : 0, 2748 fixLeft = targetFixed ? body.scrollLeft() : 0, 2749 endPosition = target.offset(), 2750 animation = { 2751 top: endPosition.top - fixTop, 2752 left: endPosition.left - fixLeft, 2753 height: target.innerHeight(), 2754 width: target.innerWidth() 2755 }, 2756 startPosition = element.offset(), 2757 transfer = $("<div class='ui-effects-transfer'></div>") 2758 .appendTo("body") 2759 .addClass(options.className) 2760 .css({ 2761 top: startPosition.top - fixTop, 2762 left: startPosition.left - fixLeft, 2763 height: element.innerHeight(), 2764 width: element.innerWidth(), 2765 position: targetFixed ? "fixed" : "absolute" 2766 }) 2767 .animate(animation, options.duration, options.easing, function () { 2768 transfer.remove(); 2769 if ($.isFunction(done)) { 2770 done(); 2771 } 2772 }); 2773 } 2774 }); 2775 2776 function parseClip(str, element) { 2777 var outerWidth = element.outerWidth(), 2778 outerHeight = element.outerHeight(), 2779 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)\)$/, 2780 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 2781 2782 return { 2783 top: parseFloat(values[1]) || 0, 2784 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 2785 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 2786 left: parseFloat(values[4]) || 0 2787 }; 2788 } 2789 2790 $.fx.step.clip = function (fx) { 2791 if (!fx.clipInit) { 2792 fx.start = $(fx.elem).cssClip(); 2793 if (typeof fx.end === "string") { 2794 fx.end = parseClip(fx.end, fx.elem); 2795 } 2796 fx.clipInit = true; 2797 } 2798 2799 $(fx.elem).cssClip({ 2800 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 2801 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 2802 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 2803 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 2804 }); 2805 }; 2806 })(); 2807 2808 /******************************************************************************/ 2809 /*********************************** EASING ***********************************/ 2810 /******************************************************************************/ 2811 2812 (function () { 2813 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 2814 2815 var baseEasings = {}; 2816 2817 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 2818 baseEasings[name] = function (p) { 2819 return Math.pow(p, i + 2); 2820 }; 2821 }); 2822 2823 $.extend(baseEasings, { 2824 Sine: function (p) { 2825 return 1 - Math.cos(p * Math.PI / 2); 2826 }, 2827 Circ: function (p) { 2828 return 1 - Math.sqrt(1 - p * p); 2829 }, 2830 Elastic: function (p) { 2831 return p === 0 || p === 1 ? p : 2832 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 2833 }, 2834 Back: function (p) { 2835 return p * p * (3 * p - 2); 2836 }, 2837 Bounce: function (p) { 2838 var pow2, 2839 bounce = 4; 2840 2841 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 2842 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 2843 } 2844 }); 2845 2846 $.each(baseEasings, function (name, easeIn) { 2847 $.easing["easeIn" + name] = easeIn; 2848 $.easing["easeOut" + name] = function (p) { 2849 return 1 - easeIn(1 - p); 2850 }; 2851 $.easing["easeInOut" + name] = function (p) { 2852 return p < 0.5 ? 2853 easeIn(p * 2) / 2 : 2854 1 - easeIn(p * -2 + 2) / 2; 2855 }; 2856 }); 2857 })(); 2858 2859 var effect = $.effects; 2860 2861 /*! 2862 * jQuery UI Effects Blind 1.12.1 2863 * http://jqueryui.com 2864 * 2865 * Copyright jQuery Foundation and other contributors 2866 * Released under the MIT license. 2867 * http://jquery.org/license 2868 */ 2869 2870 //>>label: Blind Effect 2871 //>>group: Effects 2872 //>>description: Blinds the element. 2873 //>>docs: http://api.jqueryui.com/blind-effect/ 2874 //>>demos: http://jqueryui.com/effect/ 2875 2876 var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) { 2877 var map = { 2878 up: ["bottom", "top"], 2879 vertical: ["bottom", "top"], 2880 down: ["top", "bottom"], 2881 left: ["right", "left"], 2882 horizontal: ["right", "left"], 2883 right: ["left", "right"] 2884 }, 2885 element = $(this), 2886 direction = options.direction || "up", 2887 start = element.cssClip(), 2888 animate = { clip: $.extend({}, start) }, 2889 placeholder = $.effects.createPlaceholder(element); 2890 2891 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 2892 2893 if (options.mode === "show") { 2894 element.cssClip(animate.clip); 2895 if (placeholder) { 2896 placeholder.css($.effects.clipToBox(animate)); 2897 } 2898 2899 animate.clip = start; 2900 } 2901 2902 if (placeholder) { 2903 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 2904 } 2905 2906 element.animate(animate, { 2907 queue: false, 2908 duration: options.duration, 2909 easing: options.easing,
vendor: 10,708 bytes, lines 2910-3301
2910 complete: done 2911 }); 2912 }); 2913 2914 /*! 2915 * jQuery UI Effects Bounce 1.12.1 2916 * http://jqueryui.com 2917 * 2918 * Copyright jQuery Foundation and other contributors 2919 * Released under the MIT license. 2920 * http://jquery.org/license 2921 */ 2922 2923 //>>label: Bounce Effect 2924 //>>group: Effects 2925 //>>description: Bounces an element horizontally or vertically n times. 2926 //>>docs: http://api.jqueryui.com/bounce-effect/ 2927 //>>demos: http://jqueryui.com/effect/ 2928 2929 var effectsEffectBounce = $.effects.define("bounce", function (options, done) { 2930 var upAnim, downAnim, refValue, 2931 element = $(this), 2932 2933 // Defaults: 2934 mode = options.mode, 2935 hide = mode === "hide", 2936 show = mode === "show", 2937 direction = options.direction || "up", 2938 distance = options.distance, 2939 times = options.times || 5, 2940 2941 // Number of internal animations 2942 anims = times * 2 + (show || hide ? 1 : 0), 2943 speed = options.duration / anims, 2944 easing = options.easing, 2945 2946 // Utility: 2947 ref = (direction === "up" || direction === "down") ? "top" : "left", 2948 motion = (direction === "up" || direction === "left"), 2949 i = 0, 2950 2951 queuelen = element.queue().length; 2952 2953 $.effects.createPlaceholder(element); 2954 2955 refValue = element.css(ref); 2956 2957 // Default distance for the BIGGEST bounce is the outer Distance / 3 2958 if (!distance) { 2959 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 2960 } 2961 2962 if (show) { 2963 downAnim = { opacity: 1 }; 2964 downAnim[ref] = refValue; 2965 2966 // If we are showing, force opacity 0 and set the initial position 2967 // then do the "first" animation 2968 element 2969 .css("opacity", 0) 2970 .css(ref, motion ? -distance * 2 : distance * 2) 2971 .animate(downAnim, speed, easing); 2972 } 2973 2974 // Start at the smallest distance if we are hiding 2975 if (hide) { 2976 distance = distance / Math.pow(2, times - 1); 2977 } 2978 2979 downAnim = {}; 2980 downAnim[ref] = refValue; 2981 2982 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 2983 for (; i < times; i++) { 2984 upAnim = {}; 2985 upAnim[ref] = (motion ? "-=" : "+=") + distance; 2986 2987 element 2988 .animate(upAnim, speed, easing) 2989 .animate(downAnim, speed, easing); 2990 2991 distance = hide ? distance * 2 : distance / 2; 2992 } 2993 2994 // Last Bounce when Hiding 2995 if (hide) { 2996 upAnim = { opacity: 0 }; 2997 upAnim[ref] = (motion ? "-=" : "+=") + distance; 2998 2999 element.animate(upAnim, speed, easing); 3000 } 3001 3002 element.queue(done); 3003 3004 $.effects.unshift(element, queuelen, anims + 1); 3005 }); 3006 3007 /*! 3008 * jQuery UI Effects Clip 1.12.1 3009 * http://jqueryui.com 3010 * 3011 * Copyright jQuery Foundation and other contributors 3012 * Released under the MIT license. 3013 * http://jquery.org/license 3014 */ 3015 3016 //>>label: Clip Effect 3017 //>>group: Effects 3018 //>>description: Clips the element on and off like an old TV. 3019 //>>docs: http://api.jqueryui.com/clip-effect/ 3020 //>>demos: http://jqueryui.com/effect/ 3021 3022 var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) { 3023 var start, 3024 animate = {}, 3025 element = $(this), 3026 direction = options.direction || "vertical", 3027 both = direction === "both", 3028 horizontal = both || direction === "horizontal", 3029 vertical = both || direction === "vertical"; 3030 3031 start = element.cssClip(); 3032 animate.clip = { 3033 top: vertical ? (start.bottom - start.top) / 2 : start.top, 3034 right: horizontal ? (start.right - start.left) / 2 : start.right, 3035 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 3036 left: horizontal ? (start.right - start.left) / 2 : start.left 3037 }; 3038 3039 $.effects.createPlaceholder(element); 3040 3041 if (options.mode === "show") { 3042 element.cssClip(animate.clip); 3043 animate.clip = start; 3044 } 3045 3046 element.animate(animate, { 3047 queue: false, 3048 duration: options.duration, 3049 easing: options.easing, 3050 complete: done 3051 }); 3052 }); 3053 3054 /*! 3055 * jQuery UI Effects Drop 1.12.1 3056 * http://jqueryui.com 3057 * 3058 * Copyright jQuery Foundation and other contributors 3059 * Released under the MIT license. 3060 * http://jquery.org/license 3061 */ 3062 3063 //>>label: Drop Effect 3064 //>>group: Effects 3065 //>>description: Moves an element in one direction and hides it at the same time. 3066 //>>docs: http://api.jqueryui.com/drop-effect/ 3067 //>>demos: http://jqueryui.com/effect/ 3068 3069 var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) { 3070 var distance, 3071 element = $(this), 3072 mode = options.mode, 3073 show = mode === "show", 3074 direction = options.direction || "left", 3075 ref = (direction === "up" || direction === "down") ? "top" : "left", 3076 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 3077 oppositeMotion = (motion === "+=") ? "-=" : "+=", 3078 animation = { 3079 opacity: 0 3080 }; 3081 3082 $.effects.createPlaceholder(element); 3083 3084 distance = options.distance || 3085 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 3086 3087 animation[ref] = motion + distance; 3088 3089 if (show) { 3090 element.css(animation); 3091 3092 animation[ref] = oppositeMotion + distance; 3093 animation.opacity = 1; 3094 } 3095 3096 // Animate 3097 element.animate(animation, { 3098 queue: false, 3099 duration: options.duration, 3100 easing: options.easing, 3101 complete: done 3102 }); 3103 }); 3104 3105 /*! 3106 * jQuery UI Effects Explode 1.12.1 3107 * http://jqueryui.com 3108 * 3109 * Copyright jQuery Foundation and other contributors 3110 * Released under the MIT license. 3111 * http://jquery.org/license 3112 */ 3113 3114 //>>label: Explode Effect 3115 //>>group: Effects 3116 // jscs:disable maximumLineLength 3117 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3118 // jscs:enable maximumLineLength 3119 //>>docs: http://api.jqueryui.com/explode-effect/ 3120 //>>demos: http://jqueryui.com/effect/ 3121 3122 var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) { 3123 var i, j, left, top, mx, my, 3124 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 3125 cells = rows, 3126 element = $(this), 3127 mode = options.mode, 3128 show = mode === "show", 3129 3130 // Show and then visibility:hidden the element before calculating offset 3131 offset = element.show().css("visibility", "hidden").offset(), 3132 3133 // Width and height of a piece 3134 width = Math.ceil(element.outerWidth() / cells), 3135 height = Math.ceil(element.outerHeight() / rows), 3136 pieces = []; 3137 3138 // Children animate complete: 3139 function childComplete() { 3140 pieces.push(this); 3141 if (pieces.length === rows * cells) { 3142 animComplete(); 3143 } 3144 } 3145 3146 // Clone the element for each row and cell. 3147 for (i = 0; i < rows; i++) { // ===> 3148 top = offset.top + i * height; 3149 my = i - (rows - 1) / 2; 3150 3151 for (j = 0; j < cells; j++) { // ||| 3152 left = offset.left + j * width; 3153 mx = j - (cells - 1) / 2; 3154 3155 // Create a clone of the now hidden main element that will be absolute positioned 3156 // within a wrapper div off the -left and -top equal to size of our pieces 3157 element 3158 .clone() 3159 .appendTo("body") 3160 .wrap("<div></div>") 3161 .css({ 3162 position: "absolute", 3163 visibility: "visible", 3164 left: -j * width, 3165 top: -i * height 3166 }) 3167 3168 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3169 // where the original was located +left and +top equal to the size of pieces 3170 .parent() 3171 .addClass("ui-effects-explode") 3172 .css({ 3173 position: "absolute", 3174 overflow: "hidden", 3175 width: width, 3176 height: height, 3177 left: left + (show ? mx * width : 0), 3178 top: top + (show ? my * height : 0), 3179 opacity: show ? 0 : 1 3180 }) 3181 .animate({ 3182 left: left + (show ? 0 : mx * width), 3183 top: top + (show ? 0 : my * height), 3184 opacity: show ? 1 : 0 3185 }, options.duration || 500, options.easing, childComplete); 3186 } 3187 } 3188 3189 function animComplete() { 3190 element.css({ 3191 visibility: "visible" 3192 }); 3193 $(pieces).remove(); 3194 done(); 3195 } 3196 }); 3197 3198 /*! 3199 * jQuery UI Effects Fade 1.12.1 3200 * http://jqueryui.com 3201 * 3202 * Copyright jQuery Foundation and other contributors 3203 * Released under the MIT license. 3204 * http://jquery.org/license 3205 */ 3206 3207 //>>label: Fade Effect 3208 //>>group: Effects 3209 //>>description: Fades the element. 3210 //>>docs: http://api.jqueryui.com/fade-effect/ 3211 //>>demos: http://jqueryui.com/effect/ 3212 3213 var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) { 3214 var show = options.mode === "show"; 3215 3216 $(this) 3217 .css("opacity", show ? 0 : 1) 3218 .animate({ 3219 opacity: show ? 1 : 0 3220 }, { 3221 queue: false, 3222 duration: options.duration, 3223 easing: options.easing, 3224 complete: done 3225 }); 3226 }); 3227 3228 /*! 3229 * jQuery UI Effects Fold 1.12.1 3230 * http://jqueryui.com 3231 * 3232 * Copyright jQuery Foundation and other contributors 3233 * Released under the MIT license. 3234 * http://jquery.org/license 3235 */ 3236 3237 //>>label: Fold Effect 3238 //>>group: Effects 3239 //>>description: Folds an element first horizontally and then vertically. 3240 //>>docs: http://api.jqueryui.com/fold-effect/ 3241 //>>demos: http://jqueryui.com/effect/ 3242 3243 var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) { 3244 // Create element 3245 var element = $(this), 3246 mode = options.mode, 3247 show = mode === "show", 3248 hide = mode === "hide", 3249 size = options.size || 15, 3250 percent = /([0-9]+)%/.exec(size), 3251 horizFirst = !!options.horizFirst, 3252 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 3253 duration = options.duration / 2, 3254 3255 placeholder = $.effects.createPlaceholder(element), 3256 3257 start = element.cssClip(), 3258 animation1 = { clip: $.extend({}, start) }, 3259 animation2 = { clip: $.extend({}, start) }, 3260 3261 distance = [start[ref[0]], start[ref[1]]], 3262 3263 queuelen = element.queue().length; 3264 3265 if (percent) { 3266 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 3267 } 3268 animation1.clip[ref[0]] = size; 3269 animation2.clip[ref[0]] = size; 3270 animation2.clip[ref[1]] = 0; 3271 3272 if (show) { 3273 element.cssClip(animation2.clip); 3274 if (placeholder) { 3275 placeholder.css($.effects.clipToBox(animation2)); 3276 } 3277 3278 animation2.clip = start; 3279 } 3280 3281 // Animate 3282 element 3283 .queue(function (next) { 3284 if (placeholder) { 3285 placeholder 3286 .animate($.effects.clipToBox(animation1), duration, options.easing) 3287 .animate($.effects.clipToBox(animation2), duration, options.easing); 3288 } 3289 3290 next(); 3291 }) 3292 .animate(animation1, duration, options.easing) 3293 .animate(animation2, duration, options.easing) 3294 .queue(done); 3295 3296 $.effects.unshift(element, queuelen, 4); 3297 }); 3298 3299 /*! 3300 * jQuery UI Effects Highlight 1.12.1 3301 * http://jqueryui.com
vendor: 5,392 bytes, lines 3302-3469
3302 * 3303 * Copyright jQuery Foundation and other contributors 3304 * Released under the MIT license. 3305 * http://jquery.org/license 3306 */ 3307 3308 //>>label: Highlight Effect 3309 //>>group: Effects 3310 //>>description: Highlights the background of an element in a defined color for a custom duration. 3311 //>>docs: http://api.jqueryui.com/highlight-effect/ 3312 //>>demos: http://jqueryui.com/effect/ 3313 3314 var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) { 3315 var element = $(this), 3316 animation = { 3317 backgroundColor: element.css("backgroundColor") 3318 }; 3319 3320 if (options.mode === "hide") { 3321 animation.opacity = 0; 3322 } 3323 3324 $.effects.saveStyle(element); 3325 3326 element 3327 .css({ 3328 backgroundImage: "none", 3329 backgroundColor: options.color || "#ffff99" 3330 }) 3331 .animate(animation, { 3332 queue: false, 3333 duration: options.duration, 3334 easing: options.easing, 3335 complete: done 3336 }); 3337 }); 3338 3339 /*! 3340 * jQuery UI Effects Size 1.12.1 3341 * http://jqueryui.com 3342 * 3343 * Copyright jQuery Foundation and other contributors 3344 * Released under the MIT license. 3345 * http://jquery.org/license 3346 */ 3347 3348 //>>label: Size Effect 3349 //>>group: Effects 3350 //>>description: Resize an element to a specified width and height. 3351 //>>docs: http://api.jqueryui.com/size-effect/ 3352 //>>demos: http://jqueryui.com/effect/ 3353 3354 var effectsEffectSize = $.effects.define("size", function (options, done) { 3355 // Create element 3356 var baseline, factor, temp, 3357 element = $(this), 3358 3359 // Copy for children 3360 cProps = ["fontSize"], 3361 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 3362 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 3363 3364 // Set options 3365 mode = options.mode, 3366 restore = mode !== "effect", 3367 scale = options.scale || "both", 3368 origin = options.origin || ["middle", "center"], 3369 position = element.css("position"), 3370 pos = element.position(), 3371 original = $.effects.scaledDimensions(element), 3372 from = options.from || original, 3373 to = options.to || $.effects.scaledDimensions(element, 0); 3374 3375 $.effects.createPlaceholder(element); 3376 3377 if (mode === "show") { 3378 temp = from; 3379 from = to; 3380 to = temp; 3381 } 3382 3383 // Set scaling factor 3384 factor = { 3385 from: { 3386 y: from.height / original.height, 3387 x: from.width / original.width 3388 }, 3389 to: { 3390 y: to.height / original.height, 3391 x: to.width / original.width 3392 } 3393 }; 3394 3395 // Scale the css box 3396 if (scale === "box" || scale === "both") { 3397 // Vertical props scaling 3398 if (factor.from.y !== factor.to.y) { 3399 from = $.effects.setTransition(element, vProps, factor.from.y, from); 3400 to = $.effects.setTransition(element, vProps, factor.to.y, to); 3401 } 3402 3403 // Horizontal props scaling 3404 if (factor.from.x !== factor.to.x) { 3405 from = $.effects.setTransition(element, hProps, factor.from.x, from); 3406 to = $.effects.setTransition(element, hProps, factor.to.x, to); 3407 } 3408 } 3409 3410 // Scale the content 3411 if (scale === "content" || scale === "both") { 3412 // Vertical props scaling 3413 if (factor.from.y !== factor.to.y) { 3414 from = $.effects.setTransition(element, cProps, factor.from.y, from); 3415 to = $.effects.setTransition(element, cProps, factor.to.y, to); 3416 } 3417 } 3418 3419 // Adjust the position properties based on the provided origin points 3420 if (origin) { 3421 baseline = $.effects.getBaseline(origin, original); 3422 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 3423 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 3424 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 3425 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 3426 } 3427 element.css(from); 3428 3429 // Animate the children if desired 3430 if (scale === "content" || scale === "both") { 3431 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 3432 hProps = hProps.concat(["marginLeft", "marginRight"]); 3433 3434 // Only animate children with width attributes specified 3435 // TODO: is this right? should we include anything with css width specified as well 3436 element.find("*[width]").each(function () { 3437 var child = $(this), 3438 childOriginal = $.effects.scaledDimensions(child), 3439 childFrom = { 3440 height: childOriginal.height * factor.from.y, 3441 width: childOriginal.width * factor.from.x, 3442 outerHeight: childOriginal.outerHeight * factor.from.y, 3443 outerWidth: childOriginal.outerWidth * factor.from.x 3444 }, 3445 childTo = { 3446 height: childOriginal.height * factor.to.y, 3447 width: childOriginal.width * factor.to.x, 3448 outerHeight: childOriginal.height * factor.to.y, 3449 outerWidth: childOriginal.width * factor.to.x 3450 }; 3451 3452 // Vertical props scaling 3453 if (factor.from.y !== factor.to.y) { 3454 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 3455 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 3456 } 3457 3458 // Horizontal props scaling 3459 if (factor.from.x !== factor.to.x) { 3460 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 3461 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 3462 } 3463 3464 if (restore) { 3465 $.effects.saveStyle(child); 3466 } 3467 3468 // Animate children 3469 child.css(childFrom);
vendor: 5,682 bytes, lines 3470-3672
3470 child.animate(childTo, options.duration, options.easing, function () { 3471 // Restore children 3472 if (restore) { 3473 $.effects.restoreStyle(child); 3474 } 3475 }); 3476 }); 3477 } 3478 3479 // Animate 3480 element.animate(to, { 3481 queue: false, 3482 duration: options.duration, 3483 easing: options.easing, 3484 complete: function () { 3485 var offset = element.offset(); 3486 3487 if (to.opacity === 0) { 3488 element.css("opacity", from.opacity); 3489 } 3490 3491 if (!restore) { 3492 element 3493 .css("position", position === "static" ? "relative" : position) 3494 .offset(offset); 3495 3496 // Need to save style here so that automatic style restoration 3497 // doesn't restore to the original styles from before the animation. 3498 $.effects.saveStyle(element); 3499 } 3500 3501 done(); 3502 } 3503 }); 3504 }); 3505 3506 /*! 3507 * jQuery UI Effects Scale 1.12.1 3508 * http://jqueryui.com 3509 * 3510 * Copyright jQuery Foundation and other contributors 3511 * Released under the MIT license. 3512 * http://jquery.org/license 3513 */ 3514 3515 //>>label: Scale Effect 3516 //>>group: Effects 3517 //>>description: Grows or shrinks an element and its content. 3518 //>>docs: http://api.jqueryui.com/scale-effect/ 3519 //>>demos: http://jqueryui.com/effect/ 3520 3521 var effectsEffectScale = $.effects.define("scale", function (options, done) { 3522 // Create element 3523 var el = $(this), 3524 mode = options.mode, 3525 percent = parseInt(options.percent, 10) || 3526 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 3527 3528 newOptions = $.extend(true, { 3529 from: $.effects.scaledDimensions(el), 3530 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 3531 origin: options.origin || ["middle", "center"] 3532 }, options); 3533 3534 // Fade option to support puff 3535 if (options.fade) { 3536 newOptions.from.opacity = 1; 3537 newOptions.to.opacity = 0; 3538 } 3539 3540 $.effects.effect.size.call(this, newOptions, done); 3541 }); 3542 3543 /*! 3544 * jQuery UI Effects Puff 1.12.1 3545 * http://jqueryui.com 3546 * 3547 * Copyright jQuery Foundation and other contributors 3548 * Released under the MIT license. 3549 * http://jquery.org/license 3550 */ 3551 3552 //>>label: Puff Effect 3553 //>>group: Effects 3554 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 3555 //>>docs: http://api.jqueryui.com/puff-effect/ 3556 //>>demos: http://jqueryui.com/effect/ 3557 3558 var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) { 3559 var newOptions = $.extend(true, {}, options, { 3560 fade: true, 3561 percent: parseInt(options.percent, 10) || 150 3562 }); 3563 3564 $.effects.effect.scale.call(this, newOptions, done); 3565 }); 3566 3567 /*! 3568 * jQuery UI Effects Pulsate 1.12.1 3569 * http://jqueryui.com 3570 * 3571 * Copyright jQuery Foundation and other contributors 3572 * Released under the MIT license. 3573 * http://jquery.org/license 3574 */ 3575 3576 //>>label: Pulsate Effect 3577 //>>group: Effects 3578 //>>description: Pulsates an element n times by changing the opacity to zero and back. 3579 //>>docs: http://api.jqueryui.com/pulsate-effect/ 3580 //>>demos: http://jqueryui.com/effect/ 3581 3582 var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) { 3583 var element = $(this), 3584 mode = options.mode, 3585 show = mode === "show", 3586 hide = mode === "hide", 3587 showhide = show || hide, 3588 3589 // Showing or hiding leaves off the "last" animation 3590 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 3591 duration = options.duration / anims, 3592 animateTo = 0, 3593 i = 1, 3594 queuelen = element.queue().length; 3595 3596 if (show || !element.is(":visible")) { 3597 element.css("opacity", 0).show(); 3598 animateTo = 1; 3599 } 3600 3601 // Anims - 1 opacity "toggles" 3602 for (; i < anims; i++) { 3603 element.animate({ opacity: animateTo }, duration, options.easing); 3604 animateTo = 1 - animateTo; 3605 } 3606 3607 element.animate({ opacity: animateTo }, duration, options.easing); 3608 3609 element.queue(done); 3610 3611 $.effects.unshift(element, queuelen, anims + 1); 3612 }); 3613 3614 /*! 3615 * jQuery UI Effects Shake 1.12.1 3616 * http://jqueryui.com 3617 * 3618 * Copyright jQuery Foundation and other contributors 3619 * Released under the MIT license. 3620 * http://jquery.org/license 3621 */ 3622 3623 //>>label: Shake Effect 3624 //>>group: Effects 3625 //>>description: Shakes an element horizontally or vertically n times. 3626 //>>docs: http://api.jqueryui.com/shake-effect/ 3627 //>>demos: http://jqueryui.com/effect/ 3628 3629 var effectsEffectShake = $.effects.define("shake", function (options, done) { 3630 var i = 1, 3631 element = $(this), 3632 direction = options.direction || "left", 3633 distance = options.distance || 20, 3634 times = options.times || 3, 3635 anims = times * 2 + 1, 3636 speed = Math.round(options.duration / anims), 3637 ref = (direction === "up" || direction === "down") ? "top" : "left", 3638 positiveMotion = (direction === "up" || direction === "left"), 3639 animation = {}, 3640 animation1 = {}, 3641 animation2 = {}, 3642 3643 queuelen = element.queue().length; 3644 3645 $.effects.createPlaceholder(element); 3646 3647 // Animation 3648 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 3649 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 3650 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 3651 3652 // Animate 3653 element.animate(animation, speed, options.easing); 3654 3655 // Shakes 3656 for (; i < times; i++) { 3657 element 3658 .animate(animation1, speed, options.easing) 3659 .animate(animation2, speed, options.easing); 3660 } 3661 3662 element 3663 .animate(animation1, speed, options.easing) 3664 .animate(animation, speed / 2, options.easing) 3665 .queue(done); 3666 3667 $.effects.unshift(element, queuelen, anims + 1); 3668 }); 3669 3670 /*! 3671 * jQuery UI Effects Slide 1.12.1 3672 * http://jqueryui.com
vendor: 4,773 bytes, lines 3673-3831
3673 * 3674 * Copyright jQuery Foundation and other contributors 3675 * Released under the MIT license. 3676 * http://jquery.org/license 3677 */ 3678 3679 //>>label: Slide Effect 3680 //>>group: Effects 3681 //>>description: Slides an element in and out of the viewport. 3682 //>>docs: http://api.jqueryui.com/slide-effect/ 3683 //>>demos: http://jqueryui.com/effect/ 3684 3685 var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) { 3686 var startClip, startRef, 3687 element = $(this), 3688 map = { 3689 up: ["bottom", "top"], 3690 down: ["top", "bottom"], 3691 left: ["right", "left"], 3692 right: ["left", "right"] 3693 }, 3694 mode = options.mode, 3695 direction = options.direction || "left", 3696 ref = (direction === "up" || direction === "down") ? "top" : "left", 3697 positiveMotion = (direction === "up" || direction === "left"), 3698 distance = options.distance || 3699 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 3700 animation = {}; 3701 3702 $.effects.createPlaceholder(element); 3703 3704 startClip = element.cssClip(); 3705 startRef = element.position()[ref]; 3706 3707 // Define hide animation 3708 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 3709 animation.clip = element.cssClip(); 3710 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 3711 3712 // Reverse the animation if we're showing 3713 if (mode === "show") { 3714 element.cssClip(animation.clip); 3715 element.css(ref, animation[ref]); 3716 animation.clip = startClip; 3717 animation[ref] = startRef; 3718 } 3719 3720 // Actually animate 3721 element.animate(animation, { 3722 queue: false, 3723 duration: options.duration, 3724 easing: options.easing, 3725 complete: done 3726 }); 3727 }); 3728 3729 /*! 3730 * jQuery UI Effects Transfer 1.12.1 3731 * http://jqueryui.com 3732 * 3733 * Copyright jQuery Foundation and other contributors 3734 * Released under the MIT license. 3735 * http://jquery.org/license 3736 */ 3737 3738 //>>label: Transfer Effect 3739 //>>group: Effects 3740 //>>description: Displays a transfer effect from one element to another. 3741 //>>docs: http://api.jqueryui.com/transfer-effect/ 3742 //>>demos: http://jqueryui.com/effect/ 3743 3744 var effect; 3745 if ($.uiBackCompat !== false) { 3746 effect = $.effects.define("transfer", function (options, done) { 3747 $(this).transfer(options, done); 3748 }); 3749 } 3750 var effectsEffectTransfer = effect; 3751 3752 /*! 3753 * jQuery UI Focusable 1.12.1 3754 * http://jqueryui.com 3755 * 3756 * Copyright jQuery Foundation and other contributors 3757 * Released under the MIT license. 3758 * http://jquery.org/license 3759 */ 3760 3761 //>>label: :focusable Selector 3762 //>>group: Core 3763 //>>description: Selects elements which can be focused. 3764 //>>docs: http://api.jqueryui.com/focusable-selector/ 3765 3766 // Selectors 3767 $.ui.focusable = function (element, hasTabindex) { 3768 var map, mapName, img, focusableIfVisible, fieldset, 3769 nodeName = element.nodeName.toLowerCase(); 3770 3771 if ("area" === nodeName) { 3772 map = element.parentNode; 3773 mapName = map.name; 3774 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 3775 return false; 3776 } 3777 img = $("img[usemap='#" + mapName + "']"); 3778 return img.length > 0 && img.is(":visible"); 3779 } 3780 3781 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 3782 focusableIfVisible = !element.disabled; 3783 3784 if (focusableIfVisible) { 3785 // Form controls within a disabled fieldset are disabled. 3786 // However, controls within the fieldset's legend do not get disabled. 3787 // Since controls generally aren't placed inside legends, we skip 3788 // this portion of the check. 3789 fieldset = $(element).closest("fieldset")[0]; 3790 if (fieldset) { 3791 focusableIfVisible = !fieldset.disabled; 3792 } 3793 } 3794 } else if ("a" === nodeName) { 3795 focusableIfVisible = element.href || hasTabindex; 3796 } else { 3797 focusableIfVisible = hasTabindex; 3798 } 3799 3800 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 3801 }; 3802 3803 // Support: IE 8 only 3804 // IE 8 doesn't resolve inherit to visible/hidden for computed values 3805 function visible(element) { 3806 var visibility = element.css("visibility"); 3807 while (visibility === "inherit") { 3808 element = element.parent(); 3809 visibility = element.css("visibility"); 3810 } 3811 return visibility !== "hidden"; 3812 } 3813 3814 $.extend($.expr[":"], { 3815 focusable: function (element) { 3816 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 3817 } 3818 }); 3819 3820 var focusable = $.ui.focusable; 3821 3822 // Support: IE8 Only 3823 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 3824 // with a string, so we need to find the proper form. 3825 var form = $.fn.form = function () { 3826 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 3827 }; 3828 3829 /*! 3830 * jQuery UI Form Reset Mixin 1.12.1 3831 * http://jqueryui.com
vendor: 4,807 bytes, lines 3832-4007
3832 * 3833 * Copyright jQuery Foundation and other contributors 3834 * Released under the MIT license. 3835 * http://jquery.org/license 3836 */ 3837 3838 //>>label: Form Reset Mixin 3839 //>>group: Core 3840 //>>description: Refresh input widgets when their form is reset 3841 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 3842 3843 var formResetMixin = $.ui.formResetMixin = { 3844 _formResetHandler: function () { 3845 var form = $(this); 3846 3847 // Wait for the form reset to actually happen before refreshing 3848 setTimeout(function () { 3849 var instances = form.data("ui-form-reset-instances"); 3850 $.each(instances, function () { 3851 this.refresh(); 3852 }); 3853 }); 3854 }, 3855 3856 _bindFormResetHandler: function () { 3857 this.form = this.element.form(); 3858 if (!this.form.length) { 3859 return; 3860 } 3861 3862 var instances = this.form.data("ui-form-reset-instances") || []; 3863 if (!instances.length) { 3864 // We don't use _on() here because we use a single event handler per form 3865 this.form.on("reset.ui-form-reset", this._formResetHandler); 3866 } 3867 instances.push(this); 3868 this.form.data("ui-form-reset-instances", instances); 3869 }, 3870 3871 _unbindFormResetHandler: function () { 3872 if (!this.form.length) { 3873 return; 3874 } 3875 3876 var instances = this.form.data("ui-form-reset-instances"); 3877 instances.splice($.inArray(this, instances), 1); 3878 if (instances.length) { 3879 this.form.data("ui-form-reset-instances", instances); 3880 } else { 3881 this.form 3882 .removeData("ui-form-reset-instances") 3883 .off("reset.ui-form-reset"); 3884 } 3885 } 3886 }; 3887 3888 /*! 3889 * jQuery UI Support for jQuery core 1.7.x 1.12.1 3890 * http://jqueryui.com 3891 * 3892 * Copyright jQuery Foundation and other contributors 3893 * Released under the MIT license. 3894 * http://jquery.org/license 3895 * 3896 */ 3897 3898 //>>label: jQuery 1.7 Support 3899 //>>group: Core 3900 //>>description: Support version 1.7.x of jQuery core 3901 3902 // Support: jQuery 1.7 only 3903 // Not a great way to check versions, but since we only support 1.7+ and only 3904 // need to detect <1.8, this is a simple check that should suffice. Checking 3905 // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 3906 // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting 3907 // 1.7 anymore). See #11197 for why we're not using feature detection. 3908 if ($.fn.jquery.substring(0, 3) === "1.7") { 3909 // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() 3910 // Unlike jQuery Core 1.8+, these only support numeric values to set the 3911 // dimensions in pixels 3912 $.each(["Width", "Height"], function (i, name) { 3913 var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], 3914 type = name.toLowerCase(), 3915 orig = { 3916 innerWidth: $.fn.innerWidth, 3917 innerHeight: $.fn.innerHeight, 3918 outerWidth: $.fn.outerWidth, 3919 outerHeight: $.fn.outerHeight 3920 }; 3921 3922 function reduce(elem, size, border, margin) { 3923 $.each(side, function () { 3924 size -= parseFloat($.css(elem, "padding" + this)) || 0; 3925 if (border) { 3926 size -= parseFloat($.css(elem, "border" + this + "Width")) || 0; 3927 } 3928 if (margin) { 3929 size -= parseFloat($.css(elem, "margin" + this)) || 0; 3930 } 3931 }); 3932 return size; 3933 } 3934 3935 $.fn["inner" + name] = function (size) { 3936 if (size === undefined) { 3937 return orig["inner" + name].call(this); 3938 } 3939 3940 return this.each(function () { 3941 $(this).css(type, reduce(this, size) + "px"); 3942 }); 3943 }; 3944 3945 $.fn["outer" + name] = function (size, margin) { 3946 if (typeof size !== "number") { 3947 return orig["outer" + name].call(this, size); 3948 } 3949 3950 return this.each(function () { 3951 $(this).css(type, reduce(this, size, true, margin) + "px"); 3952 }); 3953 }; 3954 }); 3955 3956 $.fn.addBack = function (selector) { 3957 return this.add(selector == null ? 3958 this.prevObject : this.prevObject.filter(selector) 3959 ); 3960 }; 3961 } 3962 3963 ; 3964 /*! 3965 * jQuery UI Keycode 1.12.1 3966 * http://jqueryui.com 3967 * 3968 * Copyright jQuery Foundation and other contributors 3969 * Released under the MIT license. 3970 * http://jquery.org/license 3971 */ 3972 3973 //>>label: Keycode 3974 //>>group: Core 3975 //>>description: Provide keycodes as keynames 3976 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 3977 3978 var keycode = $.ui.keyCode = { 3979 BACKSPACE: 8, 3980 COMMA: 188, 3981 DELETE: 46, 3982 DOWN: 40, 3983 END: 35, 3984 ENTER: 13, 3985 ESCAPE: 27, 3986 HOME: 36, 3987 LEFT: 37, 3988 PAGE_DOWN: 34, 3989 PAGE_UP: 33, 3990 PERIOD: 190, 3991 RIGHT: 39, 3992 SPACE: 32, 3993 TAB: 9, 3994 UP: 38 3995 }; 3996 3997 // Internal use only 3998 var escapeSelector = $.ui.escapeSelector = (function () { 3999 var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; 4000 return function (selector) { 4001 return selector.replace(selectorEscape, "\\$1"); 4002 }; 4003 })(); 4004 4005 /*! 4006 * jQuery UI Labels 1.12.1 4007 * http://jqueryui.com
vendor: 5,303 bytes, lines 4008-4195
4008 * 4009 * Copyright jQuery Foundation and other contributors 4010 * Released under the MIT license. 4011 * http://jquery.org/license 4012 */ 4013 4014 //>>label: labels 4015 //>>group: Core 4016 //>>description: Find all the labels associated with a given input 4017 //>>docs: http://api.jqueryui.com/labels/ 4018 4019 var labels = $.fn.labels = function () { 4020 var ancestor, selector, id, labels, ancestors; 4021 4022 // Check control.labels first 4023 if (this[0].labels && this[0].labels.length) { 4024 return this.pushStack(this[0].labels); 4025 } 4026 4027 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4028 // Above browsers do not support control.labels. Everything below is to support them 4029 // as well as document fragments. control.labels does not work on document fragments 4030 labels = this.eq(0).parents("label"); 4031 4032 // Look for the label based on the id 4033 id = this.attr("id"); 4034 if (id) { 4035 // We don't search against the document in case the element 4036 // is disconnected from the DOM 4037 ancestor = this.eq(0).parents().last(); 4038 4039 // Get a full set of top level ancestors 4040 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 4041 4042 // Create a selector for the label based on the id 4043 selector = "label[for='" + $.ui.escapeSelector(id) + "']"; 4044 4045 labels = labels.add(ancestors.find(selector).addBack(selector)); 4046 } 4047 4048 // Return whatever we have found for labels 4049 return this.pushStack(labels); 4050 }; 4051 4052 /*! 4053 * jQuery UI Scroll Parent 1.12.1 4054 * http://jqueryui.com 4055 * 4056 * Copyright jQuery Foundation and other contributors 4057 * Released under the MIT license. 4058 * http://jquery.org/license 4059 */ 4060 4061 //>>label: scrollParent 4062 //>>group: Core 4063 //>>description: Get the closest ancestor element that is scrollable. 4064 //>>docs: http://api.jqueryui.com/scrollParent/ 4065 4066 var scrollParent = $.fn.scrollParent = function (includeHidden) { 4067 var position = this.css("position"), 4068 excludeStaticParent = position === "absolute", 4069 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4070 scrollParent = this.parents().filter(function () { 4071 var parent = $(this); 4072 if (excludeStaticParent && parent.css("position") === "static") { 4073 return false; 4074 } 4075 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 4076 parent.css("overflow-x")); 4077 }).eq(0); 4078 4079 return position === "fixed" || !scrollParent.length ? 4080 $(this[0].ownerDocument || document) : 4081 scrollParent; 4082 }; 4083 4084 /*! 4085 * jQuery UI Tabbable 1.12.1 4086 * http://jqueryui.com 4087 * 4088 * Copyright jQuery Foundation and other contributors 4089 * Released under the MIT license. 4090 * http://jquery.org/license 4091 */ 4092 4093 //>>label: :tabbable Selector 4094 //>>group: Core 4095 //>>description: Selects elements which can be tabbed to. 4096 //>>docs: http://api.jqueryui.com/tabbable-selector/ 4097 4098 var tabbable = $.extend($.expr[":"], { 4099 tabbable: function (element) { 4100 var tabIndex = $.attr(element, "tabindex"), 4101 hasTabindex = tabIndex != null; 4102 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 4103 } 4104 }); 4105 4106 /*! 4107 * jQuery UI Unique ID 1.12.1 4108 * http://jqueryui.com 4109 * 4110 * Copyright jQuery Foundation and other contributors 4111 * Released under the MIT license. 4112 * http://jquery.org/license 4113 */ 4114 4115 //>>label: uniqueId 4116 //>>group: Core 4117 //>>description: Functions to generate and remove uniqueId's 4118 //>>docs: http://api.jqueryui.com/uniqueId/ 4119 4120 var uniqueId = $.fn.extend({ 4121 uniqueId: (function () { 4122 var uuid = 0; 4123 4124 return function () { 4125 return this.each(function () { 4126 if (!this.id) { 4127 this.id = "ui-id-" + (++uuid); 4128 } 4129 }); 4130 }; 4131 })(), 4132 4133 removeUniqueId: function () { 4134 return this.each(function () { 4135 if (/^ui-id-\d+$/.test(this.id)) { 4136 $(this).removeAttr("id"); 4137 } 4138 }); 4139 } 4140 }); 4141 4142 /*! 4143 * jQuery UI Accordion 1.12.1 4144 * http://jqueryui.com 4145 * 4146 * Copyright jQuery Foundation and other contributors 4147 * Released under the MIT license. 4148 * http://jquery.org/license 4149 */ 4150 4151 //>>label: Accordion 4152 //>>group: Widgets 4153 // jscs:disable maximumLineLength 4154 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4155 // jscs:enable maximumLineLength 4156 //>>docs: http://api.jqueryui.com/accordion/ 4157 //>>demos: http://jqueryui.com/accordion/ 4158 //>>css.structure: ../../themes/base/core.css 4159 //>>css.structure: ../../themes/base/accordion.css 4160 //>>css.theme: ../../themes/base/theme.css 4161 4162 var widgetsAccordion = $.widget("ui.accordion", { 4163 version: "1.12.1", 4164 options: { 4165 active: 0, 4166 animate: {}, 4167 classes: { 4168 "ui-accordion-header": "ui-corner-top", 4169 "ui-accordion-header-collapsed": "ui-corner-all", 4170 "ui-accordion-content": "ui-corner-bottom" 4171 }, 4172 collapsible: false, 4173 event: "click", 4174 header: "> li > :first-child, > :not(li):even", 4175 heightStyle: "auto", 4176 icons: { 4177 activeHeader: "ui-icon-triangle-1-s", 4178 header: "ui-icon-triangle-1-e" 4179 }, 4180 4181 // Callbacks 4182 activate: null, 4183 beforeActivate: null 4184 }, 4185 4186 hideProps: { 4187 borderTopWidth: "hide", 4188 borderBottomWidth: "hide", 4189 paddingTop: "hide", 4190 paddingBottom: "hide", 4191 height: "hide" 4192 }, 4193 4194 showProps: { 4195 borderTopWidth: "show",
vendor: 4,779 bytes, lines 4196-4376
4196 borderBottomWidth: "show", 4197 paddingTop: "show", 4198 paddingBottom: "show", 4199 height: "show" 4200 }, 4201 4202 _create: function () { 4203 var options = this.options; 4204 4205 this.prevShow = this.prevHide = $(); 4206 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 4207 this.element.attr("role", "tablist"); 4208 4209 // Don't allow collapsible: false and active: false / null 4210 if (!options.collapsible && (options.active === false || options.active == null)) { 4211 options.active = 0; 4212 } 4213 4214 this._processPanels(); 4215 4216 // handle negative values 4217 if (options.active < 0) { 4218 options.active += this.headers.length; 4219 } 4220 this._refresh(); 4221 }, 4222 4223 _getCreateEventData: function () { 4224 return { 4225 header: this.active, 4226 panel: !this.active.length ? $() : this.active.next() 4227 }; 4228 }, 4229 4230 _createIcons: function () { 4231 var icon, children, 4232 icons = this.options.icons; 4233 4234 if (icons) { 4235 icon = $("<span>"); 4236 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 4237 icon.prependTo(this.headers); 4238 children = this.active.children(".ui-accordion-header-icon"); 4239 this._removeClass(children, icons.header) 4240 ._addClass(children, null, icons.activeHeader) 4241 ._addClass(this.headers, "ui-accordion-icons"); 4242 } 4243 }, 4244 4245 _destroyIcons: function () { 4246 this._removeClass(this.headers, "ui-accordion-icons"); 4247 this.headers.children(".ui-accordion-header-icon").remove(); 4248 }, 4249 4250 _destroy: function () { 4251 var contents; 4252 4253 // Clean up main element 4254 this.element.removeAttr("role"); 4255 4256 // Clean up headers 4257 this.headers 4258 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 4259 .removeUniqueId(); 4260 4261 this._destroyIcons(); 4262 4263 // Clean up content panels 4264 contents = this.headers.next() 4265 .css("display", "") 4266 .removeAttr("role aria-hidden aria-labelledby") 4267 .removeUniqueId(); 4268 4269 if (this.options.heightStyle !== "content") { 4270 contents.css("height", ""); 4271 } 4272 }, 4273 4274 _setOption: function (key, value) { 4275 if (key === "active") { 4276 // _activate() will handle invalid values and update this.options 4277 this._activate(value); 4278 return; 4279 } 4280 4281 if (key === "event") { 4282 if (this.options.event) { 4283 this._off(this.headers, this.options.event); 4284 } 4285 this._setupEvents(value); 4286 } 4287 4288 this._super(key, value); 4289 4290 // Setting collapsible: false while collapsed; open first panel 4291 if (key === "collapsible" && !value && this.options.active === false) { 4292 this._activate(0); 4293 } 4294 4295 if (key === "icons") { 4296 this._destroyIcons(); 4297 if (value) { 4298 this._createIcons(); 4299 } 4300 } 4301 }, 4302 4303 _setOptionDisabled: function (value) { 4304 this._super(value); 4305 4306 this.element.attr("aria-disabled", value); 4307 4308 // Support: IE8 Only 4309 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 4310 // so we need to add the disabled class to the headers and panels 4311 this._toggleClass(null, "ui-state-disabled", !!value); 4312 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", 4313 !!value); 4314 }, 4315 4316 _keydown: function (event) { 4317 if (event.altKey || event.ctrlKey) { 4318 return; 4319 } 4320 4321 var keyCode = $.ui.keyCode, 4322 length = this.headers.length, 4323 currentIndex = this.headers.index(event.target), 4324 toFocus = false; 4325 4326 switch (event.keyCode) { 4327 case keyCode.RIGHT: 4328 case keyCode.DOWN: 4329 toFocus = this.headers[(currentIndex + 1) % length]; 4330 break; 4331 case keyCode.LEFT: 4332 case keyCode.UP: 4333 toFocus = this.headers[(currentIndex - 1 + length) % length]; 4334 break; 4335 case keyCode.SPACE: 4336 case keyCode.ENTER: 4337 this._eventHandler(event); 4338 break; 4339 case keyCode.HOME: 4340 toFocus = this.headers[0]; 4341 break; 4342 case keyCode.END: 4343 toFocus = this.headers[length - 1]; 4344 break; 4345 } 4346 4347 if (toFocus) { 4348 $(event.target).attr("tabIndex", -1); 4349 $(toFocus).attr("tabIndex", 0); 4350 $(toFocus).trigger("focus"); 4351 event.preventDefault(); 4352 } 4353 }, 4354 4355 _panelKeyDown: function (event) { 4356 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 4357 $(event.currentTarget).prev().trigger("focus"); 4358 } 4359 }, 4360 4361 refresh: function () { 4362 var options = this.options; 4363 this._processPanels(); 4364 4365 // Was collapsed or no panel 4366 if ((options.active === false && options.collapsible === true) || 4367 !this.headers.length) { 4368 options.active = false; 4369 this.active = $(); 4370 4371 // active false only when collapsible is true 4372 } else if (options.active === false) { 4373 this._activate(0); 4374 4375 // was active, but active panel is gone 4376 } else if (this.active.length && !$.contains(this.element[0], this.active[0])
vendor: 7,281 bytes, lines 4376-4633
4376) { 4377 // all remaining panel are disabled 4378 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 4379 options.active = false; 4380 this.active = $(); 4381 4382 // activate previous panel 4383 } else { 4384 this._activate(Math.max(0, options.active - 1)); 4385 } 4386 4387 // was active, active panel still exists 4388 } else { 4389 // make sure active index is correct 4390 options.active = this.headers.index(this.active); 4391 } 4392 4393 this._destroyIcons(); 4394 4395 this._refresh(); 4396 }, 4397 4398 _processPanels: function () { 4399 var prevHeaders = this.headers, 4400 prevPanels = this.panels; 4401 4402 this.headers = this.element.find(this.options.header); 4403 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 4404 "ui-state-default"); 4405 4406 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 4407 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 4408 4409 // Avoid memory leaks (#10056) 4410 if (prevPanels) { 4411 this._off(prevHeaders.not(this.headers)); 4412 this._off(prevPanels.not(this.panels)); 4413 } 4414 }, 4415 4416 _refresh: function () { 4417 var maxHeight, 4418 options = this.options, 4419 heightStyle = options.heightStyle, 4420 parent = this.element.parent(); 4421 4422 this.active = this._findActive(options.active); 4423 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 4424 ._removeClass(this.active, "ui-accordion-header-collapsed"); 4425 this._addClass(this.active.next(), "ui-accordion-content-active"); 4426 this.active.next().show(); 4427 4428 this.headers 4429 .attr("role", "tab") 4430 .each(function () { 4431 var header = $(this), 4432 headerId = header.uniqueId().attr("id"), 4433 panel = header.next(), 4434 panelId = panel.uniqueId().attr("id"); 4435 header.attr("aria-controls", panelId); 4436 panel.attr("aria-labelledby", headerId); 4437 }) 4438 .next() 4439 .attr("role", "tabpanel"); 4440 4441 this.headers 4442 .not(this.active) 4443 .attr({ 4444 "aria-selected": "false", 4445 "aria-expanded": "false", 4446 tabIndex: -1 4447 }) 4448 .next() 4449 .attr({ 4450 "aria-hidden": "true" 4451 }) 4452 .hide(); 4453 4454 // Make sure at least one header is in the tab order 4455 if (!this.active.length) { 4456 this.headers.eq(0).attr("tabIndex", 0); 4457 } else { 4458 this.active.attr({ 4459 "aria-selected": "true", 4460 "aria-expanded": "true", 4461 tabIndex: 0 4462 }) 4463 .next() 4464 .attr({ 4465 "aria-hidden": "false" 4466 }); 4467 } 4468 4469 this._createIcons(); 4470 4471 this._setupEvents(options.event); 4472 4473 if (heightStyle === "fill") { 4474 maxHeight = parent.height(); 4475 this.element.siblings(":visible").each(function () { 4476 var elem = $(this), 4477 position = elem.css("position"); 4478 4479 if (position === "absolute" || position === "fixed") { 4480 return; 4481 } 4482 maxHeight -= elem.outerHeight(true); 4483 }); 4484 4485 this.headers.each(function () { 4486 maxHeight -= $(this).outerHeight(true); 4487 }); 4488 4489 this.headers.next() 4490 .each(function () { 4491 $(this).height(Math.max(0, maxHeight - 4492 $(this).innerHeight() + $(this).height())); 4493 }) 4494 .css("overflow", "auto"); 4495 } else if (heightStyle === "auto") { 4496 maxHeight = 0; 4497 this.headers.next() 4498 .each(function () { 4499 var isVisible = $(this).is(":visible"); 4500 if (!isVisible) { 4501 $(this).show(); 4502 } 4503 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 4504 if (!isVisible) { 4505 $(this).hide(); 4506 } 4507 }) 4508 .height(maxHeight); 4509 } 4510 }, 4511 4512 _activate: function (index) { 4513 var active = this._findActive(index)[0]; 4514 4515 // Trying to activate the already active panel 4516 if (active === this.active[0]) { 4517 return; 4518 } 4519 4520 // Trying to collapse, simulate a click on the currently active header 4521 active = active || this.active[0]; 4522 4523 this._eventHandler({ 4524 target: active, 4525 currentTarget: active, 4526 preventDefault: $.noop 4527 }); 4528 }, 4529 4530 _findActive: function (selector) { 4531 return typeof selector === "number" ? this.headers.eq(selector) : $(); 4532 }, 4533 4534 _setupEvents: function (event) { 4535 var events = { 4536 keydown: "_keydown" 4537 }; 4538 if (event) { 4539 $.each(event.split(" "), function (index, eventName) { 4540 events[eventName] = "_eventHandler"; 4541 }); 4542 } 4543 4544 this._off(this.headers.add(this.headers.next())); 4545 this._on(this.headers, events); 4546 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 4547 this._hoverable(this.headers); 4548 this._focusable(this.headers); 4549 }, 4550 4551 _eventHandler: function (event) { 4552 var activeChildren, clickedChildren, 4553 options = this.options, 4554 active = this.active, 4555 clicked = $(event.currentTarget), 4556 clickedIsActive = clicked[0] === active[0], 4557 collapsing = clickedIsActive && options.collapsible, 4558 toShow = collapsing ? $() : clicked.next(), 4559 toHide = active.next(), 4560 eventData = { 4561 oldHeader: active, 4562 oldPanel: toHide, 4563 newHeader: collapsing ? $() : clicked, 4564 newPanel: toShow 4565 }; 4566 4567 event.preventDefault(); 4568 4569 if ( 4570 4571 // click on active header, but not collapsible 4572 (clickedIsActive && !options.collapsible) || 4573 4574 // allow canceling activation 4575 (this._trigger("beforeActivate", event, eventData) === false)) { 4576 return; 4577 } 4578 4579 options.active = collapsing ? false : this.headers.index(clicked); 4580 4581 // When the call to ._toggle() comes after the class changes 4582 // it causes a very odd bug in IE 8 (see #6720) 4583 this.active = clickedIsActive ? $() : clicked; 4584 this._toggle(eventData); 4585 4586 // Switch classes 4587 // corner classes on the previously active header stay after the animation 4588 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 4589 if (options.icons) { 4590 activeChildren = active.children(".ui-accordion-header-icon"); 4591 this._removeClass(activeChildren, null, options.icons.activeHeader) 4592 ._addClass(activeChildren, null, options.icons.header); 4593 } 4594 4595 if (!clickedIsActive) { 4596 this._removeClass(clicked, "ui-accordion-header-collapsed") 4597 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 4598 if (options.icons) { 4599 clickedChildren = clicked.children(".ui-accordion-header-icon"); 4600 this._removeClass(clickedChildren, null, options.icons.header) 4601 ._addClass(clickedChildren, null, options.icons.activeHeader); 4602 } 4603 4604 this._addClass(clicked.next(), "ui-accordion-content-active"); 4605 } 4606 }, 4607 4608 _toggle: function (data) { 4609 var toShow = data.newPanel, 4610 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 4611 4612 // Handle activating a panel during the animation for another activation 4613 this.prevShow.add(this.prevHide).stop(true, true); 4614 this.prevShow = toShow; 4615 this.prevHide = toHide; 4616 4617 if (this.options.animate) { 4618 this._animate(toShow, toHide, data); 4619 } else { 4620 toHide.hide(); 4621 toShow.show(); 4622 this._toggleComplete(data); 4623 } 4624 4625 toHide.attr({ 4626 "aria-hidden": "true" 4627 }); 4628 toHide.prev().attr({ 4629 "aria-selected": "false", 4630 "aria-expanded": "false" 4631 }); 4632 4633 // if we're switching panels, remove the old header from the tab order
vendor: 7,549 bytes, lines 4634-4890
4634 // if we're opening from collapsed state, remove the previous header from the tab order 4635 // if we're collapsing, then keep the collapsing header in the tab order 4636 if (toShow.length && toHide.length) { 4637 toHide.prev().attr({ 4638 "tabIndex": -1, 4639 "aria-expanded": "false" 4640 }); 4641 } else if (toShow.length) { 4642 this.headers.filter(function () { 4643 return parseInt($(this).attr("tabIndex"), 10) === 0; 4644 }) 4645 .attr("tabIndex", -1); 4646 } 4647 4648 toShow 4649 .attr("aria-hidden", "false") 4650 .prev() 4651 .attr({ 4652 "aria-selected": "true", 4653 "aria-expanded": "true", 4654 tabIndex: 0 4655 }); 4656 }, 4657 4658 _animate: function (toShow, toHide, data) { 4659 var total, easing, duration, 4660 that = this, 4661 adjust = 0, 4662 boxSizing = toShow.css("box-sizing"), 4663 down = toShow.length && 4664 (!toHide.length || (toShow.index() < toHide.index())), 4665 animate = this.options.animate || {}, 4666 options = down && animate.down || animate, 4667 complete = function () { 4668 that._toggleComplete(data); 4669 }; 4670 4671 if (typeof options === "number") { 4672 duration = options; 4673 } 4674 if (typeof options === "string") { 4675 easing = options; 4676 } 4677 4678 // fall back from options to animation in case of partial down settings 4679 easing = easing || options.easing || animate.easing; 4680 duration = duration || options.duration || animate.duration; 4681 4682 if (!toHide.length) { 4683 return toShow.animate(this.showProps, duration, easing, complete); 4684 } 4685 if (!toShow.length) { 4686 return toHide.animate(this.hideProps, duration, easing, complete); 4687 } 4688 4689 total = toShow.show().outerHeight(); 4690 toHide.animate(this.hideProps, { 4691 duration: duration, 4692 easing: easing, 4693 step: function (now, fx) { 4694 fx.now = Math.round(now); 4695 } 4696 }); 4697 toShow 4698 .hide() 4699 .animate(this.showProps, { 4700 duration: duration, 4701 easing: easing, 4702 complete: complete, 4703 step: function (now, fx) { 4704 fx.now = Math.round(now); 4705 if (fx.prop !== "height") { 4706 if (boxSizing === "content-box") { 4707 adjust += fx.now; 4708 } 4709 } else if (that.options.heightStyle !== "content") { 4710 fx.now = Math.round(total - toHide.outerHeight() - adjust); 4711 adjust = 0; 4712 } 4713 } 4714 }); 4715 }, 4716 4717 _toggleComplete: function (data) { 4718 var toHide = data.oldPanel, 4719 prev = toHide.prev(); 4720 4721 this._removeClass(toHide, "ui-accordion-content-active"); 4722 this._removeClass(prev, "ui-accordion-header-active") 4723 ._addClass(prev, "ui-accordion-header-collapsed"); 4724 4725 // Work around for rendering bug in IE (#5421) 4726 if (toHide.length) { 4727 toHide.parent()[0].className = toHide.parent()[0].className; 4728 } 4729 this._trigger("activate", null, data); 4730 } 4731 }); 4732 4733 var safeActiveElement = $.ui.safeActiveElement = function (document) { 4734 var activeElement; 4735 4736 // Support: IE 9 only 4737 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 4738 try { 4739 activeElement = document.activeElement; 4740 } catch (error) { 4741 activeElement = document.body; 4742 } 4743 4744 // Support: IE 9 - 11 only 4745 // IE may return null instead of an element 4746 // Interestingly, this only seems to occur when NOT in an iframe 4747 if (!activeElement) { 4748 activeElement = document.body; 4749 } 4750 4751 // Support: IE 11 only 4752 // IE11 returns a seemingly empty object in some cases when accessing 4753 // document.activeElement from an <iframe> 4754 if (!activeElement.nodeName) { 4755 activeElement = document.body; 4756 } 4757 4758 return activeElement; 4759 }; 4760 4761 /*! 4762 * jQuery UI Menu 1.12.1 4763 * http://jqueryui.com 4764 * 4765 * Copyright jQuery Foundation and other contributors 4766 * Released under the MIT license. 4767 * http://jquery.org/license 4768 */ 4769 4770 //>>label: Menu 4771 //>>group: Widgets 4772 //>>description: Creates nestable menus. 4773 //>>docs: http://api.jqueryui.com/menu/ 4774 //>>demos: http://jqueryui.com/menu/ 4775 //>>css.structure: ../../themes/base/core.css 4776 //>>css.structure: ../../themes/base/menu.css 4777 //>>css.theme: ../../themes/base/theme.css 4778 4779 var widgetsMenu = $.widget("ui.menu", { 4780 version: "1.12.1", 4781 defaultElement: "<ul>", 4782 delay: 300, 4783 options: { 4784 icons: { 4785 submenu: "ui-icon-caret-1-e" 4786 }, 4787 items: "> *", 4788 menus: "ul", 4789 position: { 4790 my: "left top", 4791 at: "right top" 4792 }, 4793 role: "menu", 4794 4795 // Callbacks 4796 blur: null, 4797 focus: null, 4798 select: null 4799 }, 4800 4801 _create: function () { 4802 this.activeMenu = this.element; 4803 4804 // Flag used to prevent firing of the click handler 4805 // as the event bubbles up through nested menus 4806 this.mouseHandled = false; 4807 this.element 4808 .uniqueId() 4809 .attr({ 4810 role: this.options.role, 4811 tabIndex: 0 4812 }); 4813 4814 this._addClass("ui-menu", "ui-widget ui-widget-content"); 4815 this._on({ 4816 // Prevent focus from sticking to links inside menu after clicking 4817 // them (focus should always stay on UL during navigation). 4818 "mousedown .ui-menu-item": function (event) { 4819 event.preventDefault(); 4820 }, 4821 "click .ui-menu-item": function (event) { 4822 var target = $(event.target); 4823 var active = $($.ui.safeActiveElement(this.document[0])); 4824 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 4825 this.select(event); 4826 4827 // Only set the mouseHandled flag if the event will bubble, see #9469. 4828 if (!event.isPropagationStopped()) { 4829 this.mouseHandled = true; 4830 } 4831 4832 // Open submenu on click 4833 if (target.has(".ui-menu").length) { 4834 this.expand(event); 4835 } else if (!this.element.is(":focus") && 4836 active.closest(".ui-menu").length) { 4837 // Redirect focus to the menu 4838 this.element.trigger("focus", [true]); 4839 4840 // If the active item is on the top level, let it stay active. 4841 // Otherwise, blur the active item since it is no longer visible. 4842 if (this.active && this.active.parents(".ui-menu").length === 1) { 4843 clearTimeout(this.timer); 4844 } 4845 } 4846 } 4847 }, 4848 "mouseenter .ui-menu-item": function (event) { 4849 // Ignore mouse events while typeahead is active, see #10458. 4850 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 4851 // is over an item in the menu 4852 if (this.previousFilter) { 4853 return; 4854 } 4855 4856 var actualTarget = $(event.target).closest(".ui-menu-item"), 4857 target = $(event.currentTarget); 4858 4859 // Ignore bubbled events on parent items, see #11641 4860 if (actualTarget[0] !== target[0]) { 4861 return; 4862 } 4863 4864 // Remove ui-state-active class from siblings of the newly focused menu item 4865 // to avoid a jump caused by adjacent elements both having a class with a border 4866 this._removeClass(target.siblings().children(".ui-state-active"), 4867 null, "ui-state-active"); 4868 this.focus(event, target); 4869 }, 4870 mouseleave: "collapseAll", 4871 "mouseleave .ui-menu": "collapseAll", 4872 focus: function (event, keepActiveItem) { 4873 // If there's already an active item, keep it active 4874 // If not, activate the first item 4875 var item = this.active || this.element.find(this.options.items).eq(0); 4876 4877 if (!keepActiveItem) { 4878 this.focus(event, item); 4879 } 4880 }, 4881 blur: function (event) { 4882 this._delay(function () { 4883 var notContained = !$.contains( 4884 this.element[0], 4885 $.ui.safeActiveElement(this.document[0]) 4886 ); 4887 if (notContained) { 4888 this.collapseAll(event); 4889 } 4890 });
vendor: 4,538 bytes, lines 4891-5059
4891 }, 4892 keydown: "_keydown" 4893 }); 4894 4895 this.refresh(); 4896 4897 // Clicks outside of a menu collapse any open menus 4898 this._on(this.document, { 4899 click: function (event) { 4900 if (this._closeOnDocumentClick(event)) { 4901 this.collapseAll(event); 4902 } 4903 4904 // Reset the mouseHandled flag 4905 this.mouseHandled = false; 4906 } 4907 }); 4908 }, 4909 4910 _destroy: function () { 4911 var items = this.element.find(".ui-menu-item") 4912 .removeAttr("role aria-disabled"), 4913 submenus = items.children(".ui-menu-item-wrapper") 4914 .removeUniqueId() 4915 .removeAttr("tabIndex role aria-haspopup"); 4916 4917 // Destroy (sub)menus 4918 this.element 4919 .removeAttr("aria-activedescendant") 4920 .find(".ui-menu").addBack() 4921 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 4922 "tabIndex") 4923 .removeUniqueId() 4924 .show(); 4925 4926 submenus.children().each(function () { 4927 var elem = $(this); 4928 if (elem.data("ui-menu-submenu-caret")) { 4929 elem.remove(); 4930 } 4931 }); 4932 }, 4933 4934 _keydown: function (event) { 4935 var match, prev, character, skip, 4936 preventDefault = true; 4937 4938 switch (event.keyCode) { 4939 case $.ui.keyCode.PAGE_UP: 4940 this.previousPage(event); 4941 break; 4942 case $.ui.keyCode.PAGE_DOWN: 4943 this.nextPage(event); 4944 break; 4945 case $.ui.keyCode.HOME: 4946 this._move("first", "first", event); 4947 break; 4948 case $.ui.keyCode.END: 4949 this._move("last", "last", event); 4950 break; 4951 case $.ui.keyCode.UP: 4952 this.previous(event); 4953 break; 4954 case $.ui.keyCode.DOWN: 4955 this.next(event); 4956 break; 4957 case $.ui.keyCode.LEFT: 4958 this.collapse(event); 4959 break; 4960 case $.ui.keyCode.RIGHT: 4961 if (this.active && !this.active.is(".ui-state-disabled")) { 4962 this.expand(event); 4963 } 4964 break; 4965 case $.ui.keyCode.ENTER: 4966 case $.ui.keyCode.SPACE: 4967 this._activate(event); 4968 break; 4969 case $.ui.keyCode.ESCAPE: 4970 this.collapse(event); 4971 break; 4972 default: 4973 preventDefault = false; 4974 prev = this.previousFilter || ""; 4975 skip = false; 4976 4977 // Support number pad values 4978 character = event.keyCode >= 96 && event.keyCode <= 105 ? 4979 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 4980 4981 clearTimeout(this.filterTimer); 4982 4983 if (character === prev) { 4984 skip = true; 4985 } else { 4986 character = prev + character; 4987 } 4988 4989 match = this._filterMenuItems(character); 4990 match = skip && match.index(this.active.next()) !== -1 ? 4991 this.active.nextAll(".ui-menu-item") : 4992 match; 4993 4994 // If no matches on the current filter, reset to the last character pressed 4995 // to move down the menu to the first item that starts with that character 4996 if (!match.length) { 4997 character = String.fromCharCode(event.keyCode); 4998 match = this._filterMenuItems(character); 4999 } 5000 5001 if (match.length) { 5002 this.focus(event, match); 5003 this.previousFilter = character; 5004 this.filterTimer = this._delay(function () { 5005 delete this.previousFilter; 5006 }, 1000); 5007 } else { 5008 delete this.previousFilter; 5009 } 5010 } 5011 5012 if (preventDefault) { 5013 event.preventDefault(); 5014 } 5015 }, 5016 5017 _activate: function (event) { 5018 if (this.active && !this.active.is(".ui-state-disabled")) { 5019 if (this.active.children("[aria-haspopup='true']").length) { 5020 this.expand(event); 5021 } else { 5022 this.select(event); 5023 } 5024 } 5025 }, 5026 5027 refresh: function () { 5028 var menus, items, newSubmenus, newItems, newWrappers, 5029 that = this, 5030 icon = this.options.icons.submenu, 5031 submenus = this.element.find(this.options.menus); 5032 5033 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 5034 5035 // Initialize nested menus 5036 newSubmenus = submenus.filter(":not(.ui-menu)") 5037 .hide() 5038 .attr({ 5039 role: this.options.role, 5040 "aria-hidden": "true", 5041 "aria-expanded": "false" 5042 }) 5043 .each(function () { 5044 var menu = $(this), 5045 item = menu.prev(), 5046 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 5047 5048 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 5049 item 5050 .attr("aria-haspopup", "true") 5051 .prepend(submenuCaret); 5052 menu.attr("aria-labelledby", item.attr("id")); 5053 }); 5054 5055 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 5056 5057 menus = submenus.add(this.element); 5058 items = menus.find(this.options.items); 5059
vendor: 4,680 bytes, lines 5060-5221
5060 // Initialize menu-items containing spaces and/or dashes only as dividers 5061 items.not(".ui-menu-item").each(function () { 5062 var item = $(this); 5063 if (that._isDivider(item)) { 5064 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 5065 } 5066 }); 5067 5068 // Don't refresh list items that are already adapted 5069 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 5070 newWrappers = newItems.children() 5071 .not(".ui-menu") 5072 .uniqueId() 5073 .attr({ 5074 tabIndex: -1, 5075 role: this._itemRole() 5076 }); 5077 this._addClass(newItems, "ui-menu-item") 5078 ._addClass(newWrappers, "ui-menu-item-wrapper"); 5079 5080 // Add aria-disabled attribute to any disabled menu item 5081 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 5082 5083 // If the active item has been removed, blur the menu 5084 if (this.active && !$.contains(this.element[0], this.active[0])) { 5085 this.blur(); 5086 } 5087 }, 5088 5089 _itemRole: function () { 5090 return { 5091 menu: "menuitem", 5092 listbox: "option" 5093 }[this.options.role]; 5094 }, 5095 5096 _setOption: function (key, value) { 5097 if (key === "icons") { 5098 var icons = this.element.find(".ui-menu-icon"); 5099 this._removeClass(icons, null, this.options.icons.submenu) 5100 ._addClass(icons, null, value.submenu); 5101 } 5102 this._super(key, value); 5103 }, 5104 5105 _setOptionDisabled: function (value) { 5106 this._super(value); 5107 5108 this.element.attr("aria-disabled", String(value)); 5109 this._toggleClass(null, "ui-state-disabled", !!value); 5110 }, 5111 5112 focus: function (event, item) { 5113 var nested, focused, activeParent; 5114 this.blur(event, event && event.type === "focus"); 5115 5116 this._scrollIntoView(item); 5117 5118 this.active = item.first(); 5119 5120 focused = this.active.children(".ui-menu-item-wrapper"); 5121 this._addClass(focused, null, "ui-state-active"); 5122 5123 // Only update aria-activedescendant if there's a role 5124 // otherwise we assume focus is managed elsewhere 5125 if (this.options.role) { 5126 this.element.attr("aria-activedescendant", focused.attr("id")); 5127 } 5128 5129 // Highlight active parent menu item, if any 5130 activeParent = this.active 5131 .parent() 5132 .closest(".ui-menu-item") 5133 .children(".ui-menu-item-wrapper"); 5134 this._addClass(activeParent, null, "ui-state-active"); 5135 5136 if (event && event.type === "keydown") { 5137 this._close(); 5138 } else { 5139 this.timer = this._delay(function () { 5140 this._close(); 5141 }, this.delay); 5142 } 5143 5144 nested = item.children(".ui-menu"); 5145 if (nested.length && event && (/^mouse/.test(event.type))) { 5146 this._startOpening(nested); 5147 } 5148 this.activeMenu = item.parent(); 5149 5150 this._trigger("focus", event, { item: item }); 5151 }, 5152 5153 _scrollIntoView: function (item) { 5154 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5155 if (this._hasScroll()) { 5156 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 5157 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 5158 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5159 scroll = this.activeMenu.scrollTop(); 5160 elementHeight = this.activeMenu.height(); 5161 itemHeight = item.outerHeight(); 5162 5163 if (offset < 0) { 5164 this.activeMenu.scrollTop(scroll + offset); 5165 } else if (offset + itemHeight > elementHeight) { 5166 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 5167 } 5168 } 5169 }, 5170 5171 blur: function (event, fromFocus) { 5172 if (!fromFocus) { 5173 clearTimeout(this.timer); 5174 } 5175 5176 if (!this.active) { 5177 return; 5178 } 5179 5180 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 5181 null, "ui-state-active"); 5182 5183 this._trigger("blur", event, { item: this.active }); 5184 this.active = null; 5185 }, 5186 5187 _startOpening: function (submenu) { 5188 clearTimeout(this.timer); 5189 5190 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5191 // shift in the submenu position when mousing over the caret icon 5192 if (submenu.attr("aria-hidden") !== "true") { 5193 return; 5194 } 5195 5196 this.timer = this._delay(function () { 5197 this._close(); 5198 this._open(submenu); 5199 }, this.delay); 5200 }, 5201 5202 _open: function (submenu) { 5203 var position = $.extend({ 5204 of: this.active 5205 }, this.options.position); 5206 5207 clearTimeout(this.timer); 5208 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 5209 .hide() 5210 .attr("aria-hidden", "true"); 5211 5212 submenu 5213 .show() 5214 .removeAttr("aria-hidden") 5215 .attr("aria-expanded", "true") 5216 .position(position); 5217 }, 5218 5219 collapseAll: function (event, all) { 5220 clearTimeout(this.timer); 5221 this.timer = this._delay(function () {
vendor: 37,844 bytes, lines 5222-6547
5222 // If we were passed an event, look for the submenu that contains the event 5223 var currentMenu = all ? this.element : 5224 $(event && event.target).closest(this.element.find(".ui-menu")); 5225 5226 // If we found no valid submenu ancestor, use the main menu to close all 5227 // sub menus anyway 5228 if (!currentMenu.length) { 5229 currentMenu = this.element; 5230 } 5231 5232 this._close(currentMenu); 5233 5234 this.blur(event); 5235 5236 // Work around active item staying active after menu is blurred 5237 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 5238 5239 this.activeMenu = currentMenu; 5240 }, this.delay); 5241 }, 5242 5243 // With no arguments, closes the currently active menu - if nothing is active 5244 // it closes all menus. If passed an argument, it will search for menus BELOW 5245 _close: function (startMenu) { 5246 if (!startMenu) { 5247 startMenu = this.active ? this.active.parent() : this.element; 5248 } 5249 5250 startMenu.find(".ui-menu") 5251 .hide() 5252 .attr("aria-hidden", "true") 5253 .attr("aria-expanded", "false"); 5254 }, 5255 5256 _closeOnDocumentClick: function (event) { 5257 return !$(event.target).closest(".ui-menu").length; 5258 }, 5259 5260 _isDivider: function (item) { 5261 // Match hyphen, em dash, en dash 5262 return !/[^\-\u2014\u2013\s]/.test(item.text()); 5263 }, 5264 5265 collapse: function (event) { 5266 var newItem = this.active && 5267 this.active.parent().closest(".ui-menu-item", this.element); 5268 if (newItem && newItem.length) { 5269 this._close(); 5270 this.focus(event, newItem); 5271 } 5272 }, 5273 5274 expand: function (event) { 5275 var newItem = this.active && 5276 this.active 5277 .children(".ui-menu ") 5278 .find(this.options.items) 5279 .first(); 5280 5281 if (newItem && newItem.length) { 5282 this._open(newItem.parent()); 5283 5284 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 5285 this._delay(function () { 5286 this.focus(event, newItem); 5287 }); 5288 } 5289 }, 5290 5291 next: function (event) { 5292 this._move("next", "first", event); 5293 }, 5294 5295 previous: function (event) { 5296 this._move("prev", "last", event); 5297 }, 5298 5299 isFirstItem: function () { 5300 return this.active && !this.active.prevAll(".ui-menu-item").length; 5301 }, 5302 5303 isLastItem: function () { 5304 return this.active && !this.active.nextAll(".ui-menu-item").length; 5305 }, 5306 5307 _move: function (direction, filter, event) { 5308 var next; 5309 if (this.active) { 5310 if (direction === "first" || direction === "last") { 5311 next = this.active 5312 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 5313 .eq(-1); 5314 } else { 5315 next = this.active 5316 [direction + "All"](".ui-menu-item") 5317 .eq(0); 5318 } 5319 } 5320 if (!next || !next.length || !this.active) { 5321 next = this.activeMenu.find(this.options.items)[filter](); 5322 } 5323 5324 this.focus(event, next); 5325 }, 5326 5327 nextPage: function (event) { 5328 var item, base, height; 5329 5330 if (!this.active) { 5331 this.next(event); 5332 return; 5333 } 5334 if (this.isLastItem()) { 5335 return; 5336 } 5337 if (this._hasScroll()) { 5338 base = this.active.offset().top; 5339 height = this.element.height(); 5340 this.active.nextAll(".ui-menu-item").each(function () { 5341 item = $(this); 5342 return item.offset().top - base - height < 0; 5343 }); 5344 5345 this.focus(event, item); 5346 } else { 5347 this.focus(event, this.activeMenu.find(this.options.items) 5348 [!this.active ? "first" : "last"]()); 5349 } 5350 }, 5351 5352 previousPage: function (event) { 5353 var item, base, height; 5354 if (!this.active) { 5355 this.next(event); 5356 return; 5357 } 5358 if (this.isFirstItem()) { 5359 return; 5360 } 5361 if (this._hasScroll()) { 5362 base = this.active.offset().top; 5363 height = this.element.height(); 5364 this.active.prevAll(".ui-menu-item").each(function () { 5365 item = $(this); 5366 return item.offset().top - base + height > 0; 5367 }); 5368 5369 this.focus(event, item); 5370 } else { 5371 this.focus(event, this.activeMenu.find(this.options.items).first()); 5372 } 5373 }, 5374 5375 _hasScroll: function () { 5376 return this.element.outerHeight() < this.element.prop("scrollHeight"); 5377 }, 5378 5379 select: function (event) { 5380 // TODO: It should never be possible to not have an active item at this 5381 // point, but the tests don't trigger mouseenter before click. 5382 this.active = this.active || $(event.target).closest(".ui-menu-item"); 5383 var ui = { item: this.active }; 5384 if (!this.active.has(".ui-menu").length) { 5385 this.collapseAll(event, true); 5386 } 5387 this._trigger("select", event, ui); 5388 }, 5389 5390 _filterMenuItems: function (character) { 5391 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 5392 regex = new RegExp("^" + escapedCharacter, "i"); 5393 5394 return this.activeMenu 5395 .find(this.options.items) 5396 5397 // Only match on items, not dividers or other content (#10571) 5398 .filter(".ui-menu-item") 5399 .filter(function () { 5400 return regex.test( 5401 $.trim($(this).children(".ui-menu-item-wrapper").text())); 5402 }); 5403 } 5404 }); 5405 5406 /*! 5407 * jQuery UI Autocomplete 1.12.1 5408 * http://jqueryui.com 5409 * 5410 * Copyright jQuery Foundation and other contributors 5411 * Released under the MIT license. 5412 * http://jquery.org/license 5413 */ 5414 5415 //>>label: Autocomplete 5416 //>>group: Widgets 5417 //>>description: Lists suggested words as the user is typing. 5418 //>>docs: http://api.jqueryui.com/autocomplete/ 5419 //>>demos: http://jqueryui.com/autocomplete/ 5420 //>>css.structure: ../../themes/base/core.css 5421 //>>css.structure: ../../themes/base/autocomplete.css 5422 //>>css.theme: ../../themes/base/theme.css 5423 5424 $.widget("ui.autocomplete", { 5425 version: "1.12.1", 5426 defaultElement: "<input>", 5427 options: { 5428 appendTo: null, 5429 autoFocus: false, 5430 delay: 300, 5431 minLength: 1, 5432 position: { 5433 my: "left top", 5434 at: "left bottom", 5435 collision: "none" 5436 }, 5437 source: null, 5438 5439 // Callbacks 5440 change: null, 5441 close: null, 5442 focus: null, 5443 open: null, 5444 response: null, 5445 search: null, 5446 select: null 5447 }, 5448 5449 requestIndex: 0, 5450 pending: 0, 5451 5452 _create: function () { 5453 // Some browsers only repeat keydown events, not keypress events, 5454 // so we use the suppressKeyPress flag to determine if we've already 5455 // handled the keydown event. #7269 5456 // Unfortunately the code for & in keypress is the same as the up arrow, 5457 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 5458 // events when we know the keydown event was used to modify the 5459 // search term. #7799 5460 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 5461 nodeName = this.element[0].nodeName.toLowerCase(), 5462 isTextarea = nodeName === "textarea", 5463 isInput = nodeName === "input"; 5464 5465 // Textareas are always multi-line 5466 // Inputs are always single-line, even if inside a contentEditable element 5467 // IE also treats inputs as contentEditable 5468 // All other element types are determined by whether or not they're contentEditable 5469 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 5470 5471 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 5472 this.isNewMenu = true; 5473 5474 this._addClass("ui-autocomplete-input"); 5475 this.element.attr("autocomplete", "off"); 5476 5477 this._on(this.element, { 5478 keydown: function (event) { 5479 if (this.element.prop("readOnly")) { 5480 suppressKeyPress = true; 5481 suppressInput = true; 5482 suppressKeyPressRepeat = true; 5483 return; 5484 } 5485 5486 suppressKeyPress = false; 5487 suppressInput = false; 5488 suppressKeyPressRepeat = false; 5489 var keyCode = $.ui.keyCode; 5490 switch (event.keyCode) { 5491 case keyCode.PAGE_UP: 5492 suppressKeyPress = true; 5493 this._move("previousPage", event); 5494 break; 5495 case keyCode.PAGE_DOWN: 5496 suppressKeyPress = true; 5497 this._move("nextPage", event); 5498 break; 5499 case keyCode.UP: 5500 suppressKeyPress = true; 5501 this._keyEvent("previous", event); 5502 break; 5503 case keyCode.DOWN: 5504 suppressKeyPress = true; 5505 this._keyEvent("next", event); 5506 break; 5507 case keyCode.ENTER: 5508 5509 // when menu is open and has focus 5510 if (this.menu.active) { 5511 // #6055 - Opera still allows the keypress to occur 5512 // which causes forms to submit 5513 suppressKeyPress = true; 5514 event.preventDefault(); 5515 this.menu.select(event); 5516 } 5517 break; 5518 case keyCode.TAB: 5519 if (this.menu.active) { 5520 this.menu.select(event); 5521 } 5522 break; 5523 case keyCode.ESCAPE: 5524 if (this.menu.element.is(":visible")) { 5525 if (!this.isMultiLine) { 5526 this._value(this.term); 5527 } 5528 this.close(event); 5529 5530 // Different browsers have different default behavior for escape 5531 // Single press can mean undo or clear 5532 // Double press in IE means clear the whole form 5533 event.preventDefault(); 5534 } 5535 break; 5536 default: 5537 suppressKeyPressRepeat = true; 5538 5539 // search timeout should be triggered before the input value is changed 5540 this._searchTimeout(event); 5541 break; 5542 } 5543 }, 5544 keypress: function (event) { 5545 if (suppressKeyPress) { 5546 suppressKeyPress = false; 5547 if (!this.isMultiLine || this.menu.element.is(":visible")) { 5548 event.preventDefault(); 5549 } 5550 return; 5551 } 5552 if (suppressKeyPressRepeat) { 5553 return; 5554 } 5555 5556 // Replicate some key handlers to allow them to repeat in Firefox and Opera 5557 var keyCode = $.ui.keyCode; 5558 switch (event.keyCode) { 5559 case keyCode.PAGE_UP: 5560 this._move("previousPage", event); 5561 break; 5562 case keyCode.PAGE_DOWN: 5563 this._move("nextPage", event); 5564 break; 5565 case keyCode.UP: 5566 this._keyEvent("previous", event); 5567 break; 5568 case keyCode.DOWN: 5569 this._keyEvent("next", event); 5570 break; 5571 } 5572 }, 5573 input: function (event) { 5574 if (suppressInput) { 5575 suppressInput = false; 5576 event.preventDefault(); 5577 return; 5578 } 5579 this._searchTimeout(event); 5580 }, 5581 focus: function () { 5582 this.selectedItem = null; 5583 this.previous = this._value(); 5584 }, 5585 blur: function (event) { 5586 if (this.cancelBlur) { 5587 delete this.cancelBlur; 5588 return; 5589 } 5590 5591 clearTimeout(this.searching); 5592 this.close(event); 5593 this._change(event); 5594 } 5595 }); 5596 5597 this._initSource(); 5598 this.menu = $("<ul>") 5599 .appendTo(this._appendTo()) 5600 .menu({ 5601 // disable ARIA support, the live region takes care of that 5602 role: null 5603 }) 5604 .hide() 5605 .menu("instance"); 5606 5607 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 5608 this._on(this.menu.element, { 5609 mousedown: function (event) { 5610 // prevent moving focus out of the text field 5611 event.preventDefault(); 5612 5613 // IE doesn't prevent moving focus even with event.preventDefault() 5614 // so we set a flag to know when we should ignore the blur event 5615 this.cancelBlur = true; 5616 this._delay(function () { 5617 delete this.cancelBlur; 5618 5619 // Support: IE 8 only 5620 // Right clicking a menu item or selecting text from the menu items will 5621 // result in focus moving out of the input. However, we've already received 5622 // and ignored the blur event because of the cancelBlur flag set above. So 5623 // we restore focus to ensure that the menu closes properly based on the user's 5624 // next actions. 5625 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 5626 this.element.trigger("focus"); 5627 } 5628 }); 5629 }, 5630 menufocus: function (event, ui) { 5631 var label, item; 5632 5633 // support: Firefox 5634 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 5635 if (this.isNewMenu) { 5636 this.isNewMenu = false; 5637 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 5638 this.menu.blur(); 5639 5640 this.document.one("mousemove", function () { 5641 $(event.target).trigger(event.originalEvent); 5642 }); 5643 5644 return; 5645 } 5646 } 5647 5648 item = ui.item.data("ui-autocomplete-item"); 5649 if (false !== this._trigger("focus", event, { item: item })) { 5650 // use value to match what will end up in the input, if it was a key event 5651 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 5652 this._value(item.value); 5653 } 5654 } 5655 5656 // Announce the value in the liveRegion 5657 label = ui.item.attr("aria-label") || item.value; 5658 if (label && $.trim(label).length) { 5659 this.liveRegion.children().hide(); 5660 $("<div>").text(label).appendTo(this.liveRegion); 5661 } 5662 }, 5663 menuselect: function (event, ui) { 5664 var item = ui.item.data("ui-autocomplete-item"), 5665 previous = this.previous; 5666 5667 // Only trigger when focus was lost (click on menu) 5668 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 5669 this.element.trigger("focus"); 5670 this.previous = previous; 5671 5672 // #6109 - IE triggers two focus events and the second 5673 // is asynchronous, so we need to reset the previous 5674 // term synchronously and asynchronously :-( 5675 this._delay(function () { 5676 this.previous = previous; 5677 this.selectedItem = item; 5678 }); 5679 } 5680 5681 if (false !== this._trigger("select", event, { item: item })) { 5682 this._value(item.value); 5683 } 5684 5685 // reset the term after the select event 5686 // this allows custom select handling to work properly 5687 this.term = this._value(); 5688 5689 this.close(event); 5690 this.selectedItem = item; 5691 } 5692 }); 5693 5694 this.liveRegion = $("<div>", { 5695 role: "status", 5696 "aria-live": "assertive", 5697 "aria-relevant": "additions" 5698 }) 5699 .appendTo(this.document[0].body); 5700 5701 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 5702 5703 // Turning off autocomplete prevents the browser from remembering the 5704 // value when navigating through history, so we re-enable autocomplete 5705 // if the page is unloaded before the widget is destroyed. #7790 5706 this._on(this.window, { 5707 beforeunload: function () { 5708 this.element.removeAttr("autocomplete"); 5709 } 5710 }); 5711 }, 5712 5713 _destroy: function () { 5714 clearTimeout(this.searching); 5715 this.element.removeAttr("autocomplete"); 5716 this.menu.element.remove(); 5717 this.liveRegion.remove(); 5718 }, 5719 5720 _setOption: function (key, value) { 5721 this._super(key, value); 5722 if (key === "source") { 5723 this._initSource(); 5724 } 5725 if (key === "appendTo") { 5726 this.menu.element.appendTo(this._appendTo()); 5727 } 5728 if (key === "disabled" && value && this.xhr) { 5729 this.xhr.abort(); 5730 } 5731 }, 5732 5733 _isEventTargetInWidget: function (event) { 5734 var menuElement = this.menu.element[0]; 5735 5736 return event.target === this.element[0] || 5737 event.target === menuElement || 5738 $.contains(menuElement, event.target); 5739 }, 5740 5741 _closeOnClickOutside: function (event) { 5742 if (!this._isEventTargetInWidget(event)) { 5743 this.close(); 5744 } 5745 }, 5746 5747 _appendTo: function () { 5748 var element = this.options.appendTo; 5749 5750 if (element) { 5751 element = element.jquery || element.nodeType ? 5752 $(element) : 5753 this.document.find(element).eq(0); 5754 } 5755 5756 if (!element || !element[0]) { 5757 element = this.element.closest(".ui-front, dialog"); 5758 } 5759 5760 if (!element.length) { 5761 element = this.document[0].body; 5762 } 5763 5764 return element; 5765 }, 5766 5767 _initSource: function () { 5768 var array, url, 5769 that = this; 5770 if ($.isArray(this.options.source)) { 5771 array = this.options.source; 5772 this.source = function (request, response) { 5773 response($.ui.autocomplete.filter(array, request.term)); 5774 }; 5775 } else if (typeof this.options.source === "string") { 5776 url = this.options.source; 5777 this.source = function (request, response) { 5778 if (that.xhr) { 5779 that.xhr.abort(); 5780 } 5781 that.xhr = $.ajax({ 5782 url: url, 5783 data: request, 5784 dataType: "json", 5785 success: function (data) { 5786 response(data); 5787 }, 5788 error: function () { 5789 response([]); 5790 } 5791 }); 5792 }; 5793 } else { 5794 this.source = this.options.source; 5795 } 5796 }, 5797 5798 _searchTimeout: function (event) { 5799 clearTimeout(this.searching); 5800 this.searching = this._delay(function () { 5801 // Search if the value has changed, or if the user retypes the same value (see #7434) 5802 var equalValues = this.term === this._value(), 5803 menuVisible = this.menu.element.is(":visible"), 5804 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 5805 5806 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 5807 this.selectedItem = null; 5808 this.search(null, event); 5809 } 5810 }, this.options.delay); 5811 }, 5812 5813 search: function (value, event) { 5814 value = value != null ? value : this._value(); 5815 5816 // Always save the actual value, not the one passed as an argument 5817 this.term = this._value(); 5818 5819 if (value.length < this.options.minLength) { 5820 return this.close(event); 5821 } 5822 5823 if (this._trigger("search", event) === false) { 5824 return; 5825 } 5826 5827 return this._search(value); 5828 }, 5829 5830 _search: function (value) { 5831 this.pending++; 5832 this._addClass("ui-autocomplete-loading"); 5833 this.cancelSearch = false; 5834 5835 this.source({ term: value }, this._response()); 5836 }, 5837 5838 _response: function () { 5839 var index = ++this.requestIndex; 5840 5841 return $.proxy(function (content) { 5842 if (index === this.requestIndex) { 5843 this.__response(content); 5844 } 5845 5846 this.pending--; 5847 if (!this.pending) { 5848 this._removeClass("ui-autocomplete-loading"); 5849 } 5850 }, this); 5851 }, 5852 5853 __response: function (content) { 5854 if (content) { 5855 content = this._normalize(content); 5856 } 5857 this._trigger("response", null, { content: content }); 5858 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 5859 this._suggest(content); 5860 this._trigger("open"); 5861 } else { 5862 // use ._close() instead of .close() so we don't cancel future searches 5863 this._close(); 5864 } 5865 }, 5866 5867 close: function (event) { 5868 this.cancelSearch = true; 5869 this._close(event); 5870 }, 5871 5872 _close: function (event) { 5873 // Remove the handler that closes the menu on outside clicks 5874 this._off(this.document, "mousedown"); 5875 5876 if (this.menu.element.is(":visible")) { 5877 this.menu.element.hide(); 5878 this.menu.blur(); 5879 this.isNewMenu = true; 5880 this._trigger("close", event); 5881 } 5882 }, 5883 5884 _change: function (event) { 5885 if (this.previous !== this._value()) { 5886 this._trigger("change", event, { item: this.selectedItem }); 5887 } 5888 }, 5889 5890 _normalize: function (items) { 5891 // assume all items have the right format when the first item is complete 5892 if (items.length && items[0].label && items[0].value) { 5893 return items; 5894 } 5895 return $.map(items, function (item) { 5896 if (typeof item === "string") { 5897 return { 5898 label: item, 5899 value: item 5900 }; 5901 } 5902 return $.extend({}, item, { 5903 label: item.label || item.value, 5904 value: item.value || item.label 5905 }); 5906 }); 5907 }, 5908 5909 _suggest: function (items) { 5910 var ul = this.menu.element.empty(); 5911 this._renderMenu(ul, items); 5912 this.isNewMenu = true; 5913 this.menu.refresh(); 5914 5915 // Size and position menu 5916 ul.show(); 5917 this._resizeMenu(); 5918 ul.position($.extend({ 5919 of: this.element 5920 }, this.options.position)); 5921 5922 if (this.options.autoFocus) { 5923 this.menu.next(); 5924 } 5925 5926 // Listen for interactions outside of the widget (#6642) 5927 this._on(this.document, { 5928 mousedown: "_closeOnClickOutside" 5929 }); 5930 }, 5931 5932 _resizeMenu: function () { 5933 var ul = this.menu.element; 5934 ul.outerWidth(Math.max( 5935 5936 // Firefox wraps long text (possibly a rounding bug) 5937 // so we add 1px to avoid the wrapping (#7513) 5938 ul.width("").outerWidth() + 1, 5939 this.element.outerWidth() 5940 )); 5941 }, 5942 5943 _renderMenu: function (ul, items) { 5944 var that = this; 5945 $.each(items, function (index, item) { 5946 that._renderItemData(ul, item); 5947 }); 5948 }, 5949 5950 _renderItemData: function (ul, item) { 5951 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 5952 }, 5953 5954 _renderItem: function (ul, item) { 5955 return $("<li>") 5956 .append($("<div>").text(item.label)) 5957 .appendTo(ul); 5958 }, 5959 5960 _move: function (direction, event) { 5961 if (!this.menu.element.is(":visible")) { 5962 this.search(null, event); 5963 return; 5964 } 5965 if (this.menu.isFirstItem() && /^previous/.test(direction) || 5966 this.menu.isLastItem() && /^next/.test(direction)) { 5967 if (!this.isMultiLine) { 5968 this._value(this.term); 5969 } 5970 5971 this.menu.blur(); 5972 return; 5973 } 5974 this.menu[direction](event); 5975 }, 5976 5977 widget: function () { 5978 return this.menu.element; 5979 }, 5980 5981 _value: function () { 5982 return this.valueMethod.apply(this.element, arguments); 5983 }, 5984 5985 _keyEvent: function (keyEvent, event) { 5986 if (!this.isMultiLine || this.menu.element.is(":visible")) { 5987 this._move(keyEvent, event); 5988 5989 // Prevents moving cursor to beginning/end of the text field in some browsers 5990 event.preventDefault(); 5991 } 5992 }, 5993 5994 // Support: Chrome <=50 5995 // We should be able to just use this.element.prop( "isContentEditable" ) 5996 // but hidden elements always report false in Chrome. 5997 // https://code.google.com/p/chromium/issues/detail?id=313082 5998 _isContentEditable: function (element) { 5999 if (!element.length) { 6000 return false; 6001 } 6002 6003 var editable = element.prop("contentEditable"); 6004 6005 if (editable === "inherit") { 6006 return this._isContentEditable(element.parent()); 6007 } 6008 6009 return editable === "true"; 6010 } 6011 }); 6012 6013 $.extend($.ui.autocomplete, { 6014 escapeRegex: function (value) { 6015 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 6016 }, 6017 filter: function (array, term) { 6018 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 6019 return $.grep(array, function (value) { 6020 return matcher.test(value.label || value.value || value); 6021 }); 6022 } 6023 }); 6024 6025 // Live region extension, adding a `messages` option 6026 // NOTE: This is an experimental API. We are still investigating 6027 // a full solution for string manipulation and internationalization. 6028 $.widget("ui.autocomplete", $.ui.autocomplete, { 6029 options: { 6030 messages: { 6031 noResults: "No search results.", 6032 results: function (amount) { 6033 return amount + (amount > 1 ? " results are" : " result is") + 6034 " available, use up and down arrow keys to navigate."; 6035 } 6036 } 6037 }, 6038 6039 __response: function (content) { 6040 var message; 6041 this._superApply(arguments); 6042 if (this.options.disabled || this.cancelSearch) { 6043 return; 6044 } 6045 if (content && content.length) { 6046 message = this.options.messages.results(content.length); 6047 } else { 6048 message = this.options.messages.noResults; 6049 } 6050 this.liveRegion.children().hide(); 6051 $("<div>").text(message).appendTo(this.liveRegion); 6052 } 6053 }); 6054 6055 var widgetsAutocomplete = $.ui.autocomplete; 6056 6057 /*! 6058 * jQuery UI Controlgroup 1.12.1 6059 * http://jqueryui.com 6060 * 6061 * Copyright jQuery Foundation and other contributors 6062 * Released under the MIT license. 6063 * http://jquery.org/license 6064 */ 6065 6066 //>>label: Controlgroup 6067 //>>group: Widgets 6068 //>>description: Visually groups form control widgets 6069 //>>docs: http://api.jqueryui.com/controlgroup/ 6070 //>>demos: http://jqueryui.com/controlgroup/ 6071 //>>css.structure: ../../themes/base/core.css 6072 //>>css.structure: ../../themes/base/controlgroup.css 6073 //>>css.theme: ../../themes/base/theme.css 6074 6075 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6076 6077 var widgetsControlgroup = $.widget("ui.controlgroup", { 6078 version: "1.12.1", 6079 defaultElement: "<div>", 6080 options: { 6081 direction: "horizontal", 6082 disabled: null, 6083 onlyVisible: true, 6084 items: { 6085 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6086 "controlgroupLabel": ".ui-controlgroup-label", 6087 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6088 "selectmenu": "select", 6089 "spinner": ".ui-spinner-input" 6090 } 6091 }, 6092 6093 _create: function () { 6094 this._enhance(); 6095 }, 6096 6097 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6098 _enhance: function () { 6099 this.element.attr("role", "toolbar"); 6100 this.refresh(); 6101 }, 6102 6103 _destroy: function () { 6104 this._callChildMethod("destroy"); 6105 this.childWidgets.removeData("ui-controlgroup-data"); 6106 this.element.removeAttr("role"); 6107 if (this.options.items.controlgroupLabel) { 6108 this.element 6109 .find(this.options.items.controlgroupLabel) 6110 .find(".ui-controlgroup-label-contents") 6111 .contents().unwrap(); 6112 } 6113 }, 6114 6115 _initWidgets: function () { 6116 var that = this, 6117 childWidgets = []; 6118 6119 // First we iterate over each of the items options 6120 $.each(this.options.items, function (widget, selector) { 6121 var labels; 6122 var options = {}; 6123 6124 // Make sure the widget has a selector set 6125 if (!selector) { 6126 return; 6127 } 6128 6129 if (widget === "controlgroupLabel") { 6130 labels = that.element.find(selector); 6131 labels.each(function () { 6132 var element = $(this); 6133 6134 if (element.children(".ui-controlgroup-label-contents").length) { 6135 return; 6136 } 6137 element.contents() 6138 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 6139 }); 6140 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 6141 childWidgets = childWidgets.concat(labels.get()); 6142 return; 6143 } 6144 6145 // Make sure the widget actually exists 6146 if (!$.fn[widget]) { 6147 return; 6148 } 6149 6150 // We assume everything is in the middle to start because we can't determine 6151 // first / last elements until all enhancments are done. 6152 if (that["_" + widget + "Options"]) { 6153 options = that["_" + widget + "Options"]("middle"); 6154 } else { 6155 options = { classes: {} }; 6156 } 6157 6158 // Find instances of this widget inside controlgroup and init them 6159 that.element 6160 .find(selector) 6161 .each(function () { 6162 var element = $(this); 6163 var instance = element[widget]("instance"); 6164 6165 // We need to clone the default options for this type of widget to avoid 6166 // polluting the variable options which has a wider scope than a single widget. 6167 var instanceOptions = $.widget.extend({}, options); 6168 6169 // If the button is the child of a spinner ignore it 6170 // TODO: Find a more generic solution 6171 if (widget === "button" && element.parent(".ui-spinner").length) { 6172 return; 6173 } 6174 6175 // Create the widget if it doesn't exist 6176 if (!instance) { 6177 instance = element[widget]()[widget]("instance"); 6178 } 6179 if (instance) { 6180 instanceOptions.classes = 6181 that._resolveClassesValues(instanceOptions.classes, instance); 6182 } 6183 element[widget](instanceOptions); 6184 6185 // Store an instance of the controlgroup to be able to reference 6186 // from the outermost element for changing options and refresh 6187 var widgetElement = element[widget]("widget"); 6188 $.data(widgetElement[0], "ui-controlgroup-data", 6189 instance ? instance : element[widget]("instance")); 6190 6191 childWidgets.push(widgetElement[0]); 6192 }); 6193 }); 6194 6195 this.childWidgets = $($.unique(childWidgets)); 6196 this._addClass(this.childWidgets, "ui-controlgroup-item"); 6197 }, 6198 6199 _callChildMethod: function (method) { 6200 this.childWidgets.each(function () { 6201 var element = $(this), 6202 data = element.data("ui-controlgroup-data"); 6203 if (data && data[method]) { 6204 data[method](); 6205 } 6206 }); 6207 }, 6208 6209 _updateCornerClass: function (element, position) { 6210 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6211 var add = this._buildSimpleOptions(position, "label").classes.label; 6212 6213 this._removeClass(element, null, remove); 6214 this._addClass(element, null, add); 6215 }, 6216 6217 _buildSimpleOptions: function (position, key) { 6218 var direction = this.options.direction === "vertical"; 6219 var result = { 6220 classes: {} 6221 }; 6222 result.classes[key] = { 6223 "middle": "", 6224 "first": "ui-corner-" + (direction ? "top" : "left"), 6225 "last": "ui-corner-" + (direction ? "bottom" : "right"), 6226 "only": "ui-corner-all" 6227 }[position]; 6228 6229 return result; 6230 }, 6231 6232 _spinnerOptions: function (position) { 6233 var options = this._buildSimpleOptions(position, "ui-spinner"); 6234 6235 options.classes["ui-spinner-up"] = ""; 6236 options.classes["ui-spinner-down"] = ""; 6237 6238 return options; 6239 }, 6240 6241 _buttonOptions: function (position) { 6242 return this._buildSimpleOptions(position, "ui-button"); 6243 }, 6244 6245 _checkboxradioOptions: function (position) { 6246 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 6247 }, 6248 6249 _selectmenuOptions: function (position) { 6250 var direction = this.options.direction === "vertical"; 6251 return { 6252 width: direction ? "auto" : false, 6253 classes: { 6254 middle: { 6255 "ui-selectmenu-button-open": "", 6256 "ui-selectmenu-button-closed": "" 6257 }, 6258 first: { 6259 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 6260 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 6261 }, 6262 last: { 6263 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 6264 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 6265 }, 6266 only: { 6267 "ui-selectmenu-button-open": "ui-corner-top", 6268 "ui-selectmenu-button-closed": "ui-corner-all" 6269 } 6270 }[position] 6271 }; 6272 }, 6273 6274 _resolveClassesValues: function (classes, instance) { 6275 var result = {}; 6276 $.each(classes, function (key) { 6277 var current = instance.options.classes[key] || ""; 6278 current = $.trim(current.replace(controlgroupCornerRegex, "")); 6279 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 6280 }); 6281 return result; 6282 }, 6283 6284 _setOption: function (key, value) { 6285 if (key === "direction") { 6286 this._removeClass("ui-controlgroup-" + this.options.direction); 6287 } 6288 6289 this._super(key, value); 6290 if (key === "disabled") { 6291 this._callChildMethod(value ? "disable" : "enable"); 6292 return; 6293 } 6294 6295 this.refresh(); 6296 }, 6297 6298 refresh: function () { 6299 var children, 6300 that = this; 6301 6302 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 6303 6304 if (this.options.direction === "horizontal") { 6305 this._addClass(null, "ui-helper-clearfix"); 6306 } 6307 this._initWidgets(); 6308 6309 children = this.childWidgets; 6310 6311 // We filter here because we need to track all childWidgets not just the visible ones 6312 if (this.options.onlyVisible) { 6313 children = children.filter(":visible"); 6314 } 6315 6316 if (children.length) { 6317 // We do this last because we need to make sure all enhancment is done 6318 // before determining first and last 6319 $.each(["first", "last"], function (index, value) { 6320 var instance = children[value]().data("ui-controlgroup-data"); 6321 6322 if (instance && that["_" + instance.widgetName + "Options"]) { 6323 var options = that["_" + instance.widgetName + "Options"]( 6324 children.length === 1 ? "only" : value 6325 ); 6326 options.classes = that._resolveClassesValues(options.classes, instance); 6327 instance.element[instance.widgetName](options); 6328 } else { 6329 that._updateCornerClass(children[value](), value); 6330 } 6331 }); 6332 6333 // Finally call the refresh method on each of the child widgets. 6334 this._callChildMethod("refresh"); 6335 } 6336 } 6337 }); 6338 6339 /*! 6340 * jQuery UI Checkboxradio 1.12.1 6341 * http://jqueryui.com 6342 * 6343 * Copyright jQuery Foundation and other contributors 6344 * Released under the MIT license. 6345 * http://jquery.org/license 6346 */ 6347 6348 //>>label: Checkboxradio 6349 //>>group: Widgets 6350 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 6351 //>>docs: http://api.jqueryui.com/checkboxradio/ 6352 //>>demos: http://jqueryui.com/checkboxradio/ 6353 //>>css.structure: ../../themes/base/core.css 6354 //>>css.structure: ../../themes/base/button.css 6355 //>>css.structure: ../../themes/base/checkboxradio.css 6356 //>>css.theme: ../../themes/base/theme.css 6357 6358 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 6359 version: "1.12.1", 6360 options: { 6361 disabled: null, 6362 label: null, 6363 icon: true, 6364 classes: { 6365 "ui-checkboxradio-label": "ui-corner-all", 6366 "ui-checkboxradio-icon": "ui-corner-all" 6367 } 6368 }, 6369 6370 _getCreateOptions: function () { 6371 var disabled, labels; 6372 var that = this; 6373 var options = this._super() || {}; 6374 6375 // We read the type here, because it makes more sense to throw a element type error first, 6376 // rather then the error for lack of a label. Often if its the wrong type, it 6377 // won't have a label (e.g. calling on a div, btn, etc) 6378 this._readType(); 6379 6380 labels = this.element.labels(); 6381 6382 // If there are multiple labels, use the last one 6383 this.label = $(labels[labels.length - 1]); 6384 if (!this.label.length) { 6385 $.error("No label found for checkboxradio widget"); 6386 } 6387 6388 this.originalLabel = ""; 6389 6390 // We need to get the label text but this may also need to make sure it does not contain the 6391 // input itself. 6392 this.label.contents().not(this.element[0]).each(function () { 6393 // The label contents could be text, html, or a mix. We concat each element to get a 6394 // string representation of the label, without the input as part of it. 6395 that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML; 6396 }); 6397 6398 // Set the label option if we found label text 6399 if (this.originalLabel) { 6400 options.label = this.originalLabel; 6401 } 6402 6403 disabled = this.element[0].disabled; 6404 if (disabled != null) { 6405 options.disabled = disabled; 6406 } 6407 return options; 6408 }, 6409 6410 _create: function () { 6411 var checked = this.element[0].checked; 6412 6413 this._bindFormResetHandler(); 6414 6415 if (this.options.disabled == null) { 6416 this.options.disabled = this.element[0].disabled; 6417 } 6418 6419 this._setOption("disabled", this.options.disabled); 6420 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 6421 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 6422 6423 if (this.type === "radio") { 6424 this._addClass(this.label, "ui-checkboxradio-radio-label"); 6425 } 6426 6427 if (this.options.label && this.options.label !== this.originalLabel) { 6428 this._updateLabel(); 6429 } else if (this.originalLabel) { 6430 this.options.label = this.originalLabel; 6431 } 6432 6433 this._enhance(); 6434 6435 if (checked) { 6436 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 6437 if (this.icon) { 6438 this._addClass(this.icon, null, "ui-state-hover"); 6439 } 6440 } 6441 6442 this._on({ 6443 change: "_toggleClasses", 6444 focus: function () { 6445 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 6446 }, 6447 blur: function () { 6448 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 6449 } 6450 }); 6451 }, 6452 6453 _readType: function () { 6454 var nodeName = this.element[0].nodeName.toLowerCase(); 6455 this.type = this.element[0].type; 6456 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 6457 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 6458 " and element.type=" + this.type); 6459 } 6460 }, 6461 6462 // Support jQuery Mobile enhanced option 6463 _enhance: function () { 6464 this._updateIcon(this.element[0].checked); 6465 }, 6466 6467 widget: function () { 6468 return this.label; 6469 }, 6470 6471 _getRadioGroup: function () { 6472 var group; 6473 var name = this.element[0].name; 6474 var nameSelector = "input[name='" + $.ui.escapeSelector(name) + "']"; 6475 6476 if (!name) { 6477 return $([]); 6478 } 6479 6480 if (this.form.length) { 6481 group = $(this.form[0].elements).filter(nameSelector); 6482 } else { 6483 // Not inside a form, check all inputs that also are not inside a form 6484 group = $(nameSelector).filter(function () { 6485 return $(this).form().length === 0; 6486 }); 6487 } 6488 6489 return group.not(this.element); 6490 }, 6491 6492 _toggleClasses: function () { 6493 var checked = this.element[0].checked; 6494 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 6495 6496 if (this.options.icon && this.type === "checkbox") { 6497 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 6498 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 6499 } 6500 6501 if (this.type === "radio") { 6502 this._getRadioGroup() 6503 .each(function () { 6504 var instance = $(this).checkboxradio("instance"); 6505 6506 if (instance) { 6507 instance._removeClass(instance.label, 6508 "ui-checkboxradio-checked", "ui-state-active"); 6509 } 6510 }); 6511 } 6512 }, 6513 6514 _destroy: function () { 6515 this._unbindFormResetHandler(); 6516 6517 if (this.icon) { 6518 this.icon.remove(); 6519 this.iconSpace.remove(); 6520 } 6521 }, 6522 6523 _setOption: function (key, value) { 6524 // We don't allow the value to be set to nothing 6525 if (key === "label" && !value) { 6526 return; 6527 } 6528 6529 this._super(key, value); 6530 6531 if (key === "disabled") { 6532 this._toggleClass(this.label, null, "ui-state-disabled", value); 6533 this.element[0].disabled = value; 6534 6535 // Don't refresh when setting disabled 6536 return; 6537 } 6538 this.refresh(); 6539 }, 6540 6541 _updateIcon: function (checked) { 6542 var toAdd = "ui-icon ui-icon-background "; 6543 6544 if (this.options.icon) { 6545 if (!this.icon) { 6546 this.icon = $("<span>"); 6547 this.iconSpace = $("<span> </span>");
vendor: 5,768 bytes, lines 6548-6749
6548 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 6549 } 6550 6551 if (this.type === "checkbox") { 6552 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 6553 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 6554 } else { 6555 toAdd += "ui-icon-blank"; 6556 } 6557 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 6558 if (!checked) { 6559 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 6560 } 6561 this.icon.prependTo(this.label).after(this.iconSpace); 6562 } else if (this.icon !== undefined) { 6563 this.icon.remove(); 6564 this.iconSpace.remove(); 6565 delete this.icon; 6566 } 6567 }, 6568 6569 _updateLabel: function () { 6570 // Remove the contents of the label ( minus the icon, icon space, and input ) 6571 var contents = this.label.contents().not(this.element[0]); 6572 if (this.icon) { 6573 contents = contents.not(this.icon[0]); 6574 } 6575 if (this.iconSpace) { 6576 contents = contents.not(this.iconSpace[0]); 6577 } 6578 contents.remove(); 6579 6580 this.label.append(this.options.label); 6581 }, 6582 6583 refresh: function () { 6584 var checked = this.element[0].checked, 6585 isDisabled = this.element[0].disabled; 6586 6587 this._updateIcon(checked); 6588 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 6589 if (this.options.label !== null) { 6590 this._updateLabel(); 6591 } 6592 6593 if (isDisabled !== this.options.disabled) { 6594 this._setOptions({ "disabled": isDisabled }); 6595 } 6596 } 6597 }]); 6598 6599 var widgetsCheckboxradio = $.ui.checkboxradio; 6600 6601 /*! 6602 * jQuery UI Button 1.12.1 6603 * http://jqueryui.com 6604 * 6605 * Copyright jQuery Foundation and other contributors 6606 * Released under the MIT license. 6607 * http://jquery.org/license 6608 */ 6609 6610 //>>label: Button 6611 //>>group: Widgets 6612 //>>description: Enhances a form with themeable buttons. 6613 //>>docs: http://api.jqueryui.com/button/ 6614 //>>demos: http://jqueryui.com/button/ 6615 //>>css.structure: ../../themes/base/core.css 6616 //>>css.structure: ../../themes/base/button.css 6617 //>>css.theme: ../../themes/base/theme.css 6618 6619 $.widget("ui.button", { 6620 version: "1.12.1", 6621 defaultElement: "<button>", 6622 options: { 6623 classes: { 6624 "ui-button": "ui-corner-all" 6625 }, 6626 disabled: null, 6627 icon: null, 6628 iconPosition: "beginning", 6629 label: null, 6630 showLabel: true 6631 }, 6632 6633 _getCreateOptions: function () { 6634 var disabled, 6635 6636 // This is to support cases like in jQuery Mobile where the base widget does have 6637 // an implementation of _getCreateOptions 6638 options = this._super() || {}; 6639 6640 this.isInput = this.element.is("input"); 6641 6642 disabled = this.element[0].disabled; 6643 if (disabled != null) { 6644 options.disabled = disabled; 6645 } 6646 6647 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 6648 if (this.originalLabel) { 6649 options.label = this.originalLabel; 6650 } 6651 6652 return options; 6653 }, 6654 6655 _create: function () { 6656 if (!this.option.showLabel & !this.options.icon) { 6657 this.options.showLabel = true; 6658 } 6659 6660 // We have to check the option again here even though we did in _getCreateOptions, 6661 // because null may have been passed on init which would override what was set in 6662 // _getCreateOptions 6663 if (this.options.disabled == null) { 6664 this.options.disabled = this.element[0].disabled || false; 6665 } 6666 6667 this.hasTitle = !!this.element.attr("title"); 6668 6669 // Check to see if the label needs to be set or if its already correct 6670 if (this.options.label && this.options.label !== this.originalLabel) { 6671 if (this.isInput) { 6672 this.element.val(this.options.label); 6673 } else { 6674 this.element.html(this.options.label); 6675 } 6676 } 6677 this._addClass("ui-button", "ui-widget"); 6678 this._setOption("disabled", this.options.disabled); 6679 this._enhance(); 6680 6681 if (this.element.is("a")) { 6682 this._on({ 6683 "keyup": function (event) { 6684 if (event.keyCode === $.ui.keyCode.SPACE) { 6685 event.preventDefault(); 6686 6687 // Support: PhantomJS <= 1.9, IE 8 Only 6688 // If a native click is available use it so we actually cause navigation 6689 // otherwise just trigger a click event 6690 if (this.element[0].click) { 6691 this.element[0].click(); 6692 } else { 6693 this.element.trigger("click"); 6694 } 6695 } 6696 } 6697 }); 6698 } 6699 }, 6700 6701 _enhance: function () { 6702 if (!this.element.is("button")) { 6703 this.element.attr("role", "button"); 6704 } 6705 6706 if (this.options.icon) { 6707 this._updateIcon("icon", this.options.icon); 6708 this._updateTooltip(); 6709 } 6710 }, 6711 6712 _updateTooltip: function () { 6713 this.title = this.element.attr("title"); 6714 6715 if (!this.options.showLabel && !this.title) { 6716 this.element.attr("title", this.options.label); 6717 } 6718 }, 6719 6720 _updateIcon: function (option, value) { 6721 var icon = option !== "iconPosition", 6722 position = icon ? this.options.iconPosition : value, 6723 displayBlock = position === "top" || position === "bottom"; 6724 6725 // Create icon 6726 if (!this.icon) { 6727 this.icon = $("<span>"); 6728 6729 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 6730 6731 if (!this.options.showLabel) { 6732 this._addClass("ui-button-icon-only"); 6733 } 6734 } else if (icon) { 6735 // If we are updating the icon remove the old icon class 6736 this._removeClass(this.icon, null, this.options.icon); 6737 } 6738 6739 // If we are updating the icon add the new icon class 6740 if (icon) { 6741 this._addClass(this.icon, null, value); 6742 } 6743 6744 this._attachIcon(position); 6745 6746 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 6747 // the iconSpace if there is one. 6748 if (displayBlock) { 6749 this._addClass(this.icon, null, "ui-widget-icon-block");
vendor: 5,020 bytes, lines 6750-6931
6750 if (this.iconSpace) { 6751 this.iconSpace.remove(); 6752 } 6753 } else { 6754 // Position is beginning or end so remove the ui-widget-icon-block class and add the 6755 // space if it does not exist 6756 if (!this.iconSpace) { 6757 this.iconSpace = $("<span> </span>"); 6758 this._addClass(this.iconSpace, "ui-button-icon-space"); 6759 } 6760 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 6761 this._attachIconSpace(position); 6762 } 6763 }, 6764 6765 _destroy: function () { 6766 this.element.removeAttr("role"); 6767 6768 if (this.icon) { 6769 this.icon.remove(); 6770 } 6771 if (this.iconSpace) { 6772 this.iconSpace.remove(); 6773 } 6774 if (!this.hasTitle) { 6775 this.element.removeAttr("title"); 6776 } 6777 }, 6778 6779 _attachIconSpace: function (iconPosition) { 6780 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 6781 }, 6782 6783 _attachIcon: function (iconPosition) { 6784 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 6785 }, 6786 6787 _setOptions: function (options) { 6788 var newShowLabel = options.showLabel === undefined ? 6789 this.options.showLabel : 6790 options.showLabel, 6791 newIcon = options.icon === undefined ? this.options.icon : options.icon; 6792 6793 if (!newShowLabel && !newIcon) { 6794 options.showLabel = true; 6795 } 6796 this._super(options); 6797 }, 6798 6799 _setOption: function (key, value) { 6800 if (key === "icon") { 6801 if (value) { 6802 this._updateIcon(key, value); 6803 } else if (this.icon) { 6804 this.icon.remove(); 6805 if (this.iconSpace) { 6806 this.iconSpace.remove(); 6807 } 6808 } 6809 } 6810 6811 if (key === "iconPosition") { 6812 this._updateIcon(key, value); 6813 } 6814 6815 // Make sure we can't end up with a button that has neither text nor icon 6816 if (key === "showLabel") { 6817 this._toggleClass("ui-button-icon-only", null, !value); 6818 this._updateTooltip(); 6819 } 6820 6821 if (key === "label") { 6822 if (this.isInput) { 6823 this.element.val(value); 6824 } else { 6825 // If there is an icon, append it, else nothing then append the value 6826 // this avoids removal of the icon when setting label text 6827 this.element.html(value); 6828 if (this.icon) { 6829 this._attachIcon(this.options.iconPosition); 6830 this._attachIconSpace(this.options.iconPosition); 6831 } 6832 } 6833 } 6834 6835 this._super(key, value); 6836 6837 if (key === "disabled") { 6838 this._toggleClass(null, "ui-state-disabled", value); 6839 this.element[0].disabled = value; 6840 if (value) { 6841 this.element.blur(); 6842 } 6843 } 6844 }, 6845 6846 refresh: function () { 6847 // Make sure to only check disabled if its an element that supports this otherwise 6848 // check for the disabled class to determine state 6849 var isDisabled = this.element.is("input, button") ? 6850 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 6851 6852 if (isDisabled !== this.options.disabled) { 6853 this._setOptions({ disabled: isDisabled }); 6854 } 6855 6856 this._updateTooltip(); 6857 } 6858 }); 6859 6860 // DEPRECATED 6861 if ($.uiBackCompat !== false) { 6862 // Text and Icons options 6863 $.widget("ui.button", $.ui.button, { 6864 options: { 6865 text: true, 6866 icons: { 6867 primary: null, 6868 secondary: null 6869 } 6870 }, 6871 6872 _create: function () { 6873 if (this.options.showLabel && !this.options.text) { 6874 this.options.showLabel = this.options.text; 6875 } 6876 if (!this.options.showLabel && this.options.text) { 6877 this.options.text = this.options.showLabel; 6878 } 6879 if (!this.options.icon && (this.options.icons.primary || 6880 this.options.icons.secondary)) { 6881 if (this.options.icons.primary) { 6882 this.options.icon = this.options.icons.primary; 6883 } else { 6884 this.options.icon = this.options.icons.secondary; 6885 this.options.iconPosition = "end"; 6886 } 6887 } else if (this.options.icon) { 6888 this.options.icons.primary = this.options.icon; 6889 } 6890 this._super(); 6891 }, 6892 6893 _setOption: function (key, value) { 6894 if (key === "text") { 6895 this._super("showLabel", value); 6896 return; 6897 } 6898 if (key === "showLabel") { 6899 this.options.text = value; 6900 } 6901 if (key === "icon") { 6902 this.options.icons.primary = value; 6903 } 6904 if (key === "icons") { 6905 if (value.primary) { 6906 this._super("icon", value.primary); 6907 this._super("iconPosition", "beginning"); 6908 } else if (value.secondary) { 6909 this._super("icon", value.secondary); 6910 this._super("iconPosition", "end"); 6911 } 6912 } 6913 this._superApply(arguments); 6914 } 6915 }); 6916 6917 $.fn.button = (function (orig) { 6918 return function () { 6919 if (!this.length || (this.length && this[0].tagName !== "INPUT") || 6920 (this.length && this[0].tagName === "INPUT" && ( 6921 this.attr("type") !== "checkbox" && this.attr("type") !== "radio" 6922 ))) { 6923 return orig.apply(this, arguments); 6924 } 6925 if (!$.ui.checkboxradio) { 6926 $.error("Checkboxradio widget missing"); 6927 } 6928 if (arguments.length === 0) { 6929 return this.checkboxradio({ 6930 "icon": false 6931 });
vendor: 4,350 bytes, lines 6932-7031
6932 } 6933 return this.checkboxradio.apply(this, arguments); 6934 }; 6935 })($.fn.button); 6936 6937 $.fn.buttonset = function () { 6938 if (!$.ui.controlgroup) { 6939 $.error("Controlgroup widget missing"); 6940 } 6941 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 6942 return this.controlgroup.apply(this, 6943 [arguments[0], "items.button", arguments[2]]); 6944 } 6945 if (arguments[0] === "option" && arguments[1] === "items") { 6946 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 6947 } 6948 if (typeof arguments[0] === "object" && arguments[0].items) { 6949 arguments[0].items = { 6950 button: arguments[0].items 6951 }; 6952 } 6953 return this.controlgroup.apply(this, arguments); 6954 }; 6955 } 6956 6957 var widgetsButton = $.ui.button; 6958 6959 // jscs:disable maximumLineLength 6960 /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ 6961 /*! 6962 * jQuery UI Datepicker 1.12.1 6963 * http://jqueryui.com 6964 * 6965 * Copyright jQuery Foundation and other contributors 6966 * Released under the MIT license. 6967 * http://jquery.org/license 6968 */ 6969 6970 //>>label: Datepicker 6971 //>>group: Widgets 6972 //>>description: Displays a calendar from an input or inline for selecting dates. 6973 //>>docs: http://api.jqueryui.com/datepicker/ 6974 //>>demos: http://jqueryui.com/datepicker/ 6975 //>>css.structure: ../../themes/base/core.css 6976 //>>css.structure: ../../themes/base/datepicker.css 6977 //>>css.theme: ../../themes/base/theme.css 6978 6979 $.extend($.ui, { datepicker: { version: "1.12.1" } }); 6980 6981 var datepicker_instActive; 6982 6983 function datepicker_getZindex(elem) { 6984 var position, value; 6985 while (elem.length && elem[0] !== document) { 6986 // Ignore z-index if position is set to a value where z-index is ignored by the browser 6987 // This makes behavior of this function consistent across browsers 6988 // WebKit always returns auto if the element is positioned 6989 position = elem.css("position"); 6990 if (position === "absolute" || position === "relative" || position === "fixed") { 6991 // IE returns 0 when zIndex is not specified 6992 // other browsers return a string 6993 // we ignore the case of nested elements with an explicit value of 0 6994 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 6995 value = parseInt(elem.css("zIndex"), 10); 6996 if (!isNaN(value) && value !== 0) { 6997 return value; 6998 } 6999 } 7000 elem = elem.parent(); 7001 } 7002 7003 return 0; 7004 } 7005 /* Date picker manager. 7006 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7007 Settings for (groups of) date pickers are maintained in an instance object, 7008 allowing multiple different settings on the same page. */ 7009 7010 function Datepicker() { 7011 this._curInst = null; // The current instance in use 7012 this._keyEvent = false; // If the last event was a key event 7013 this._disabledInputs = []; // List of date picker inputs that have been disabled 7014 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7015 this._inDialog = false; // True if showing within a "dialog", false if not 7016 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7017 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7018 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7019 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7020 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7021 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7022 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7023 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7024 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7025 this.regional = []; // Available regional settings, indexed by language code 7026 this.regional[""] = { // Default regional settings 7027 closeText: "Done", // Display text for close link 7028 prevText: "Prev", // Display text for previous month link 7029 nextText: "Next", // Display text for next month link 7030 currentText: "Today", // Display text for current month link 7031 monthNames: ["January", "February", "March", "April", "May", "June",
vendor: 7,188 bytes, lines 7032-7157
7032 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 7033 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 7034 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 7035 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 7036 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 7037 weekHeader: "Wk", // Column header for week of the year 7038 dateFormat: "mm/dd/yy", // See format options on parseDate 7039 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7040 isRTL: false, // True if right-to-left language, false if left-to-right 7041 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7042 yearSuffix: "" // Additional text to append to the year in the month headers 7043 }; 7044 this._defaults = { // Global defaults for all the date picker instances 7045 showOn: "focus", // "focus" for popup on focus, 7046 // "button" for trigger button, or "both" for either 7047 showAnim: "fadeIn", // Name of jQuery animation for popup 7048 showOptions: {}, // Options for enhanced animations 7049 defaultDate: null, // Used when field is blank: actual date, 7050 // +/-number for offset from today, null for today 7051 appendText: "", // Display text following the input box, e.g. showing the format 7052 buttonText: "...", // Text for trigger button 7053 buttonImage: "", // URL for trigger button image 7054 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7055 hideIfNoPrevNext: false, // True to hide next/previous month links 7056 // if not applicable, false to just disable them 7057 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7058 gotoCurrent: false, // True if today link goes back to current selection instead 7059 changeMonth: false, // True if month can be selected directly, false if only prev/next 7060 changeYear: false, // True if year can be selected directly, false if only prev/next 7061 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7062 // either relative to today's year (-nn:+nn), relative to currently displayed year 7063 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7064 showOtherMonths: false, // True to show dates in other months, false to leave blank 7065 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7066 showWeek: false, // True to show week of the year, false to not show it 7067 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7068 // takes a Date and returns the number of the week for it 7069 shortYearCutoff: "+10", // Short year values < this are in the current century, 7070 // > this are in the previous century, 7071 // string value starting with "+" for current year + value 7072 minDate: null, // The earliest selectable date, or null for no limit 7073 maxDate: null, // The latest selectable date, or null for no limit 7074 duration: "fast", // Duration of display/closure 7075 beforeShowDay: null, // Function that takes a date and returns an array with 7076 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7077 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7078 beforeShow: null, // Function that takes an input field and 7079 // returns a set of custom settings for the date picker 7080 onSelect: null, // Define a callback function when a date is selected 7081 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7082 onClose: null, // Define a callback function when the datepicker is closed 7083 numberOfMonths: 1, // Number of months to show at a time 7084 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7085 stepMonths: 1, // Number of months to step back/forward 7086 stepBigMonths: 12, // Number of months to step back/forward for the big links 7087 altField: "", // Selector for an alternate field to store selected dates into 7088 altFormat: "", // The date format to use for the alternate field 7089 constrainInput: true, // The input is constrained by the current date format 7090 showButtonPanel: false, // True to show button panel, false to not show it 7091 autoSize: false, // True to size the input for the date format, false to leave as is 7092 disabled: false // The initial disabled state 7093 }; 7094 $.extend(this._defaults, this.regional[""]); 7095 this.regional.en = $.extend(true, {}, this.regional[""]); 7096 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 7097 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 7098 } 7099 7100 $.extend(Datepicker.prototype, { 7101 /* Class name added to elements to indicate already configured with a date picker. */ 7102 markerClassName: "hasDatepicker", 7103 7104 //Keep track of the maximum number of rows displayed (see #7043) 7105 maxRows: 4, 7106 7107 // TODO rename to "widget" when switching to widget factory 7108 _widgetDatepicker: function () { 7109 return this.dpDiv; 7110 }, 7111 7112 /* Override the default settings for all instances of the date picker. 7113 * @param settings object - the new settings to use as defaults (anonymous object) 7114 * @return the manager object 7115 */ 7116 setDefaults: function (settings) { 7117 datepicker_extendRemove(this._defaults, settings || {}); 7118 return this; 7119 }, 7120 7121 /* Attach the date picker to a jQuery selection. 7122 * @param target element - the target input field or division or span 7123 * @param settings object - the new settings to use for this date picker instance (anonymous) 7124 */ 7125 _attachDatepicker: function (target, settings) { 7126 var nodeName, inline, inst; 7127 nodeName = target.nodeName.toLowerCase(); 7128 inline = (nodeName === "div" || nodeName === "span"); 7129 if (!target.id) { 7130 this.uuid += 1; 7131 target.id = "dp" + this.uuid; 7132 } 7133 inst = this._newInst($(target), inline); 7134 inst.settings = $.extend({}, settings || {}); 7135 if (nodeName === "input") { 7136 this._connectDatepicker(target, inst); 7137 } else if (inline) { 7138 this._inlineDatepicker(target, inst); 7139 } 7140 }, 7141 7142 /* Create a new instance object. */ 7143 _newInst: function (target, inline) { 7144 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 7145 return { 7146 id: id, input: target, // associated target 7147 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 7148 drawMonth: 0, drawYear: 0, // month being drawn 7149 inline: inline, // is datepicker inline or not 7150 dpDiv: (!inline ? this.dpDiv : // presentation div 7151 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 7152 }; 7153 }, 7154 7155 /* Attach the date picker to an input field. */ 7156 _connectDatepicker: function (target, inst) { 7157 var input = $(target);
vendor: 4,235 bytes, lines 7158-7274
7158 inst.append = $([]); 7159 inst.trigger = $([]); 7160 if (input.hasClass(this.markerClassName)) { 7161 return; 7162 } 7163 this._attachments(input, inst); 7164 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 7165 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 7166 this._autoSize(inst); 7167 $.data(target, "datepicker", inst); 7168 7169 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 7170 if (inst.settings.disabled) { 7171 this._disableDatepicker(target); 7172 } 7173 }, 7174 7175 /* Make attachments based on settings. */ 7176 _attachments: function (input, inst) { 7177 var showOn, buttonText, buttonImage, 7178 appendText = this._get(inst, "appendText"), 7179 isRTL = this._get(inst, "isRTL"); 7180 7181 if (inst.append) { 7182 inst.append.remove(); 7183 } 7184 if (appendText) { 7185 inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); 7186 input[isRTL ? "before" : "after"](inst.append); 7187 } 7188 7189 input.off("focus", this._showDatepicker); 7190 7191 if (inst.trigger) { 7192 inst.trigger.remove(); 7193 } 7194 7195 showOn = this._get(inst, "showOn"); 7196 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 7197 input.on("focus", this._showDatepicker); 7198 } 7199 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 7200 buttonText = this._get(inst, "buttonText"); 7201 buttonImage = this._get(inst, "buttonImage"); 7202 inst.trigger = $(this._get(inst, "buttonImageOnly") ? 7203 $("<img/>").addClass(this._triggerClass). 7204 attr({ src: buttonImage, alt: buttonText, title: buttonText }) : 7205 $("<button type='button'></button>").addClass(this._triggerClass). 7206 html(!buttonImage ? buttonText : $("<img/>").attr( 7207 { src: buttonImage, alt: buttonText, title: buttonText }))); 7208 input[isRTL ? "before" : "after"](inst.trigger); 7209 inst.trigger.on("click", function () { 7210 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 7211 $.datepicker._hideDatepicker(); 7212 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 7213 $.datepicker._hideDatepicker(); 7214 $.datepicker._showDatepicker(input[0]); 7215 } else { 7216 $.datepicker._showDatepicker(input[0]); 7217 } 7218 return false; 7219 }); 7220 } 7221 }, 7222 7223 /* Apply the maximum length for the date format. */ 7224 _autoSize: function (inst) { 7225 if (this._get(inst, "autoSize") && !inst.inline) { 7226 var findMax, max, maxI, i, 7227 date = new Date(2009, 12 - 1, 20), // Ensure double digits 7228 dateFormat = this._get(inst, "dateFormat"); 7229 7230 if (dateFormat.match(/[DM]/)) { 7231 findMax = function (names) { 7232 max = 0; 7233 maxI = 0; 7234 for (i = 0; i < names.length; i++) { 7235 if (names[i].length > max) { 7236 max = names[i].length; 7237 maxI = i; 7238 } 7239 } 7240 return maxI; 7241 }; 7242 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 7243 "monthNames" : "monthNamesShort")))); 7244 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 7245 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 7246 } 7247 inst.input.attr("size", this._formatDate(inst, date).length); 7248 } 7249 }, 7250 7251 /* Attach an inline date picker to a div. */ 7252 _inlineDatepicker: function (target, inst) { 7253 var divSpan = $(target); 7254 if (divSpan.hasClass(this.markerClassName)) { 7255 return; 7256 } 7257 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 7258 $.data(target, "datepicker", inst); 7259 this._setDate(inst, this._getDefaultDate(inst), true); 7260 this._updateDatepicker(inst); 7261 this._updateAlternate(inst); 7262 7263 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 7264 if (inst.settings.disabled) { 7265 this._disableDatepicker(target); 7266 } 7267 7268 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 7269 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 7270 inst.dpDiv.css("display", "block"); 7271 }, 7272 7273 /* Pop-up the date picker in a "dialog" box. 7274 * @param input element - ignored
vendor: 2,694 bytes, lines 7275-7339
7275 * @param date string or Date - the initial date to display 7276 * @param onSelect function - the function to call when a date is selected 7277 * @param settings object - update the dialog date picker instance's settings (anonymous object) 7278 * @param pos int[2] - coordinates for the dialog's position within the screen or 7279 * event - with x/y coordinates or 7280 * leave empty for default (screen centre) 7281 * @return the manager object 7282 */ 7283 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 7284 var id, browserWidth, browserHeight, scrollX, scrollY, 7285 inst = this._dialogInst; // internal instance 7286 7287 if (!inst) { 7288 this.uuid += 1; 7289 id = "dp" + this.uuid; 7290 this._dialogInput = $("<input type='text' id='" + id + 7291 "' style='position: absolute; top: -100px; width: 0px;'/>"); 7292 this._dialogInput.on("keydown", this._doKeyDown); 7293 $("body").append(this._dialogInput); 7294 inst = this._dialogInst = this._newInst(this._dialogInput, false); 7295 inst.settings = {}; 7296 $.data(this._dialogInput[0], "datepicker", inst); 7297 } 7298 datepicker_extendRemove(inst.settings, settings || {}); 7299 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 7300 this._dialogInput.val(date); 7301 7302 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 7303 if (!this._pos) { 7304 browserWidth = document.documentElement.clientWidth; 7305 browserHeight = document.documentElement.clientHeight; 7306 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 7307 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 7308 this._pos = // should use actual width/height below 7309 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 7310 } 7311 7312 // Move input on screen for focus, but hidden behind dialog 7313 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 7314 inst.settings.onSelect = onSelect; 7315 this._inDialog = true; 7316 this.dpDiv.addClass(this._dialogClass); 7317 this._showDatepicker(this._dialogInput[0]); 7318 if ($.blockUI) { 7319 $.blockUI(this.dpDiv); 7320 } 7321 $.data(this._dialogInput[0], "datepicker", inst); 7322 return this; 7323 }, 7324 7325 /* Detach a datepicker from its control. 7326 * @param target element - the target input field or division or span 7327 */ 7328 _destroyDatepicker: function (target) { 7329 var nodeName, 7330 $target = $(target), 7331 inst = $.data(target, "datepicker"); 7332 7333 if (!$target.hasClass(this.markerClassName)) { 7334 return; 7335 } 7336 7337 nodeName = target.nodeName.toLowerCase(); 7338 $.removeData(target, "datepicker"); 7339 if (nodeName === "input") {
vendor: 12,005 bytes, lines 7340-7680
7340 inst.append.remove(); 7341 inst.trigger.remove(); 7342 $target.removeClass(this.markerClassName). 7343 off("focus", this._showDatepicker). 7344 off("keydown", this._doKeyDown). 7345 off("keypress", this._doKeyPress). 7346 off("keyup", this._doKeyUp); 7347 } else if (nodeName === "div" || nodeName === "span") { 7348 $target.removeClass(this.markerClassName).empty(); 7349 } 7350 7351 if (datepicker_instActive === inst) { 7352 datepicker_instActive = null; 7353 } 7354 }, 7355 7356 /* Enable the date picker to a jQuery selection. 7357 * @param target element - the target input field or division or span 7358 */ 7359 _enableDatepicker: function (target) { 7360 var nodeName, inline, 7361 $target = $(target), 7362 inst = $.data(target, "datepicker"); 7363 7364 if (!$target.hasClass(this.markerClassName)) { 7365 return; 7366 } 7367 7368 nodeName = target.nodeName.toLowerCase(); 7369 if (nodeName === "input") { 7370 target.disabled = false; 7371 inst.trigger.filter("button"). 7372 each(function () { this.disabled = false; }).end(). 7373 filter("img").css({ opacity: "1.0", cursor: "" }); 7374 } else if (nodeName === "div" || nodeName === "span") { 7375 inline = $target.children("." + this._inlineClass); 7376 inline.children().removeClass("ui-state-disabled"); 7377 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 7378 prop("disabled", false); 7379 } 7380 this._disabledInputs = $.map(this._disabledInputs, 7381 function (value) { return (value === target ? null : value); }); // delete entry 7382 }, 7383 7384 /* Disable the date picker to a jQuery selection. 7385 * @param target element - the target input field or division or span 7386 */ 7387 _disableDatepicker: function (target) { 7388 var nodeName, inline, 7389 $target = $(target), 7390 inst = $.data(target, "datepicker"); 7391 7392 if (!$target.hasClass(this.markerClassName)) { 7393 return; 7394 } 7395 7396 nodeName = target.nodeName.toLowerCase(); 7397 if (nodeName === "input") { 7398 target.disabled = true; 7399 inst.trigger.filter("button"). 7400 each(function () { this.disabled = true; }).end(). 7401 filter("img").css({ opacity: "0.5", cursor: "default" }); 7402 } else if (nodeName === "div" || nodeName === "span") { 7403 inline = $target.children("." + this._inlineClass); 7404 inline.children().addClass("ui-state-disabled"); 7405 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 7406 prop("disabled", true); 7407 } 7408 this._disabledInputs = $.map(this._disabledInputs, 7409 function (value) { return (value === target ? null : value); }); // delete entry 7410 this._disabledInputs[this._disabledInputs.length] = target; 7411 }, 7412 7413 /* Is the first field in a jQuery collection disabled as a datepicker? 7414 * @param target element - the target input field or division or span 7415 * @return boolean - true if disabled, false if enabled 7416 */ 7417 _isDisabledDatepicker: function (target) { 7418 if (!target) { 7419 return false; 7420 } 7421 for (var i = 0; i < this._disabledInputs.length; i++) { 7422 if (this._disabledInputs[i] === target) { 7423 return true; 7424 } 7425 } 7426 return false; 7427 }, 7428 7429 /* Retrieve the instance data for the target control. 7430 * @param target element - the target input field or division or span 7431 * @return object - the associated instance data 7432 * @throws error if a jQuery problem getting data 7433 */ 7434 _getInst: function (target) { 7435 try { 7436 return $.data(target, "datepicker"); 7437 } 7438 catch (err) { 7439 throw "Missing instance data for this datepicker"; 7440 } 7441 }, 7442 7443 /* Update or retrieve the settings for a date picker attached to an input field or division. 7444 * @param target element - the target input field or division or span 7445 * @param name object - the new settings to update or 7446 * string - the name of the setting to change or retrieve, 7447 * when retrieving also "all" for all instance settings or 7448 * "defaults" for all global defaults 7449 * @param value any - the new value for the setting 7450 * (omit if above is an object or to retrieve a value) 7451 */ 7452 _optionDatepicker: function (target, name, value) { 7453 var settings, date, minDate, maxDate, 7454 inst = this._getInst(target); 7455 7456 if (arguments.length === 2 && typeof name === "string") { 7457 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 7458 (inst ? (name === "all" ? $.extend({}, inst.settings) : 7459 this._get(inst, name)) : null)); 7460 } 7461 7462 settings = name || {}; 7463 if (typeof name === "string") { 7464 settings = {}; 7465 settings[name] = value; 7466 } 7467 7468 if (inst) { 7469 if (this._curInst === inst) { 7470 this._hideDatepicker(); 7471 } 7472 7473 date = this._getDateDatepicker(target, true); 7474 minDate = this._getMinMaxDate(inst, "min"); 7475 maxDate = this._getMinMaxDate(inst, "max"); 7476 datepicker_extendRemove(inst.settings, settings); 7477 7478 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 7479 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 7480 inst.settings.minDate = this._formatDate(inst, minDate); 7481 } 7482 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 7483 inst.settings.maxDate = this._formatDate(inst, maxDate); 7484 } 7485 if ("disabled" in settings) { 7486 if (settings.disabled) { 7487 this._disableDatepicker(target); 7488 } else { 7489 this._enableDatepicker(target); 7490 } 7491 } 7492 this._attachments($(target), inst); 7493 this._autoSize(inst); 7494 this._setDate(inst, date); 7495 this._updateAlternate(inst); 7496 this._updateDatepicker(inst); 7497 } 7498 }, 7499 7500 // Change method deprecated 7501 _changeDatepicker: function (target, name, value) { 7502 this._optionDatepicker(target, name, value); 7503 }, 7504 7505 /* Redraw the date picker attached to an input field or division. 7506 * @param target element - the target input field or division or span 7507 */ 7508 _refreshDatepicker: function (target) { 7509 var inst = this._getInst(target); 7510 if (inst) { 7511 this._updateDatepicker(inst); 7512 } 7513 }, 7514 7515 /* Set the dates for a jQuery selection. 7516 * @param target element - the target input field or division or span 7517 * @param date Date - the new date 7518 */ 7519 _setDateDatepicker: function (target, date) { 7520 var inst = this._getInst(target); 7521 if (inst) { 7522 this._setDate(inst, date); 7523 this._updateDatepicker(inst); 7524 this._updateAlternate(inst); 7525 } 7526 }, 7527 7528 /* Get the date(s) for the first entry in a jQuery selection. 7529 * @param target element - the target input field or division or span 7530 * @param noDefault boolean - true if no default date is to be used 7531 * @return Date - the current date 7532 */ 7533 _getDateDatepicker: function (target, noDefault) { 7534 var inst = this._getInst(target); 7535 if (inst && !inst.inline) { 7536 this._setDateFromField(inst, noDefault); 7537 } 7538 return (inst ? this._getDate(inst) : null); 7539 }, 7540 7541 /* Handle keystrokes. */ 7542 _doKeyDown: function (event) { 7543 var onSelect, dateStr, sel, 7544 inst = $.datepicker._getInst(event.target), 7545 handled = true, 7546 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 7547 7548 inst._keyEvent = true; 7549 if ($.datepicker._datepickerShowing) { 7550 switch (event.keyCode) { 7551 case 9: $.datepicker._hideDatepicker(); 7552 handled = false; 7553 break; // hide on tab out 7554 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 7555 $.datepicker._currentClass + ")", inst.dpDiv); 7556 if (sel[0]) { 7557 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 7558 } 7559 7560 onSelect = $.datepicker._get(inst, "onSelect"); 7561 if (onSelect) { 7562 dateStr = $.datepicker._formatDate(inst); 7563 7564 // Trigger custom callback 7565 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 7566 } else { 7567 $.datepicker._hideDatepicker(); 7568 } 7569 7570 return false; // don't submit the form 7571 case 27: $.datepicker._hideDatepicker(); 7572 break; // hide on escape 7573 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7574 -$.datepicker._get(inst, "stepBigMonths") : 7575 -$.datepicker._get(inst, "stepMonths")), "M"); 7576 break; // previous month/year on page up/+ ctrl 7577 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7578 +$.datepicker._get(inst, "stepBigMonths") : 7579 +$.datepicker._get(inst, "stepMonths")), "M"); 7580 break; // next month/year on page down/+ ctrl 7581 case 35: if (event.ctrlKey || event.metaKey) { 7582 $.datepicker._clearDate(event.target); 7583 } 7584 handled = event.ctrlKey || event.metaKey; 7585 break; // clear on ctrl or command +end 7586 case 36: if (event.ctrlKey || event.metaKey) { 7587 $.datepicker._gotoToday(event.target); 7588 } 7589 handled = event.ctrlKey || event.metaKey; 7590 break; // current on ctrl or command +home 7591 case 37: if (event.ctrlKey || event.metaKey) { 7592 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 7593 } 7594 handled = event.ctrlKey || event.metaKey; 7595 7596 // -1 day on ctrl or command +left 7597 if (event.originalEvent.altKey) { 7598 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7599 -$.datepicker._get(inst, "stepBigMonths") : 7600 -$.datepicker._get(inst, "stepMonths")), "M"); 7601 } 7602 7603 // next month/year on alt +left on Mac 7604 break; 7605 case 38: if (event.ctrlKey || event.metaKey) { 7606 $.datepicker._adjustDate(event.target, -7, "D"); 7607 } 7608 handled = event.ctrlKey || event.metaKey; 7609 break; // -1 week on ctrl or command +up 7610 case 39: if (event.ctrlKey || event.metaKey) { 7611 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 7612 } 7613 handled = event.ctrlKey || event.metaKey; 7614 7615 // +1 day on ctrl or command +right 7616 if (event.originalEvent.altKey) { 7617 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 7618 +$.datepicker._get(inst, "stepBigMonths") : 7619 +$.datepicker._get(inst, "stepMonths")), "M"); 7620 } 7621 7622 // next month/year on alt +right 7623 break; 7624 case 40: if (event.ctrlKey || event.metaKey) { 7625 $.datepicker._adjustDate(event.target, +7, "D"); 7626 } 7627 handled = event.ctrlKey || event.metaKey; 7628 break; // +1 week on ctrl or command +down 7629 default: handled = false; 7630 } 7631 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 7632 $.datepicker._showDatepicker(this); 7633 } else { 7634 handled = false; 7635 } 7636 7637 if (handled) { 7638 event.preventDefault(); 7639 event.stopPropagation(); 7640 } 7641 }, 7642 7643 /* Filter entered characters - based on date format. */ 7644 _doKeyPress: function (event) { 7645 var chars, chr, 7646 inst = $.datepicker._getInst(event.target); 7647 7648 if ($.datepicker._get(inst, "constrainInput")) { 7649 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 7650 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 7651 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 7652 } 7653 }, 7654 7655 /* Synchronise manual entry and field/alternate field. */ 7656 _doKeyUp: function (event) { 7657 var date, 7658 inst = $.datepicker._getInst(event.target); 7659 7660 if (inst.input.val() !== inst.lastVal) { 7661 try { 7662 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 7663 (inst.input ? inst.input.val() : null), 7664 $.datepicker._getFormatConfig(inst)); 7665 7666 if (date) { // only if valid 7667 $.datepicker._setDateFromField(inst); 7668 $.datepicker._updateAlternate(inst); 7669 $.datepicker._updateDatepicker(inst); 7670 } 7671 } 7672 catch (err) { 7673 } 7674 } 7675 return true; 7676 }, 7677 7678 /* Pop-up the date picker for a given input field. 7679 * If false returned from beforeShow event handler do not show. 7680 * @param input element - the input field attached to the date picker or
vendor: 4,334 bytes, lines 7681-7803
7681 * event - if triggered by focus 7682 */ 7683 _showDatepicker: function (input) { 7684 input = input.target || input; 7685 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 7686 input = $("input", input.parentNode)[0]; 7687 } 7688 7689 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 7690 return; 7691 } 7692 7693 var inst, beforeShow, beforeShowSettings, isFixed, 7694 offset, showAnim, duration; 7695 7696 inst = $.datepicker._getInst(input); 7697 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 7698 $.datepicker._curInst.dpDiv.stop(true, true); 7699 if (inst && $.datepicker._datepickerShowing) { 7700 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 7701 } 7702 } 7703 7704 beforeShow = $.datepicker._get(inst, "beforeShow"); 7705 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 7706 if (beforeShowSettings === false) { 7707 return; 7708 } 7709 datepicker_extendRemove(inst.settings, beforeShowSettings); 7710 7711 inst.lastVal = null; 7712 $.datepicker._lastInput = input; 7713 $.datepicker._setDateFromField(inst); 7714 7715 if ($.datepicker._inDialog) { // hide cursor 7716 input.value = ""; 7717 } 7718 if (!$.datepicker._pos) { // position below input 7719 $.datepicker._pos = $.datepicker._findPos(input); 7720 $.datepicker._pos[1] += input.offsetHeight; // add the height 7721 } 7722 7723 isFixed = false; 7724 $(input).parents().each(function () { 7725 isFixed |= $(this).css("position") === "fixed"; 7726 return !isFixed; 7727 }); 7728 7729 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 7730 $.datepicker._pos = null; 7731 7732 //to avoid flashes on Firefox 7733 inst.dpDiv.empty(); 7734 7735 // determine sizing offscreen 7736 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 7737 $.datepicker._updateDatepicker(inst); 7738 7739 // fix width for dynamic number of date pickers 7740 // and adjust position before showing 7741 offset = $.datepicker._checkOffset(inst, offset, isFixed); 7742 inst.dpDiv.css({ 7743 position: ($.datepicker._inDialog && $.blockUI ? 7744 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 7745 left: offset.left + "px", top: offset.top + "px" 7746 }); 7747 7748 if (!inst.inline) { 7749 showAnim = $.datepicker._get(inst, "showAnim"); 7750 duration = $.datepicker._get(inst, "duration"); 7751 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 7752 $.datepicker._datepickerShowing = true; 7753 7754 if ($.effects && $.effects.effect[showAnim]) { 7755 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 7756 } else { 7757 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 7758 } 7759 7760 if ($.datepicker._shouldFocusInput(inst)) { 7761 inst.input.trigger("focus"); 7762 } 7763 7764 $.datepicker._curInst = inst; 7765 } 7766 }, 7767 7768 /* Generate the date picker content. */ 7769 _updateDatepicker: function (inst) { 7770 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 7771 datepicker_instActive = inst; // for delegate hover events 7772 inst.dpDiv.empty().append(this._generateHTML(inst)); 7773 this._attachHandlers(inst); 7774 7775 var origyearshtml, 7776 numMonths = this._getNumberOfMonths(inst), 7777 cols = numMonths[1], 7778 width = 17, 7779 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"); 7780 7781 if (activeCell.length > 0) { 7782 datepicker_handleMouseover.apply(activeCell.get(0)); 7783 } 7784 7785 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 7786 if (cols > 1) { 7787 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 7788 } 7789 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 7790 "Class"]("ui-datepicker-multi"); 7791 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 7792 "Class"]("ui-datepicker-rtl"); 7793 7794 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 7795 inst.input.trigger("focus"); 7796 } 7797 7798 // Deffered render of the years select (to avoid flashes on Firefox) 7799 if (inst.yearshtml) { 7800 origyearshtml = inst.yearshtml; 7801 setTimeout(function () { 7802 //assure that inst.yearshtml didn't change. 7803 if (origyearshtml === inst.yearshtml && inst.yearshtml) {
vendor: 5,567 bytes, lines 7804-7960
7804 inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); 7805 } 7806 origyearshtml = inst.yearshtml = null; 7807 }, 0); 7808 } 7809 }, 7810 7811 // #6694 - don't focus the input if it's already focused 7812 // this breaks the change event in IE 7813 // Support: IE and jQuery <1.9 7814 _shouldFocusInput: function (inst) { 7815 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 7816 }, 7817 7818 /* Check positioning to remain on screen. */ 7819 _checkOffset: function (inst, offset, isFixed) { 7820 var dpWidth = inst.dpDiv.outerWidth(), 7821 dpHeight = inst.dpDiv.outerHeight(), 7822 inputWidth = inst.input ? inst.input.outerWidth() : 0, 7823 inputHeight = inst.input ? inst.input.outerHeight() : 0, 7824 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 7825 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 7826 7827 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 7828 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 7829 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 7830 7831 // Now check if datepicker is showing outside window viewport - move to a better place if so. 7832 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 7833 Math.abs(offset.left + dpWidth - viewWidth) : 0); 7834 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 7835 Math.abs(dpHeight + inputHeight) : 0); 7836 7837 return offset; 7838 }, 7839 7840 /* Find an object's position on the screen. */ 7841 _findPos: function (obj) { 7842 var position, 7843 inst = this._getInst(obj), 7844 isRTL = this._get(inst, "isRTL"); 7845 7846 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { 7847 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 7848 } 7849 7850 position = $(obj).offset(); 7851 return [position.left, position.top]; 7852 }, 7853 7854 /* Hide the date picker from view. 7855 * @param input element - the input field attached to the date picker 7856 */ 7857 _hideDatepicker: function (input) { 7858 var showAnim, duration, postProcess, onClose, 7859 inst = this._curInst; 7860 7861 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 7862 return; 7863 } 7864 7865 if (this._datepickerShowing) { 7866 showAnim = this._get(inst, "showAnim"); 7867 duration = this._get(inst, "duration"); 7868 postProcess = function () { 7869 $.datepicker._tidyDialog(inst); 7870 }; 7871 7872 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 7873 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 7874 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 7875 } else { 7876 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 7877 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 7878 } 7879 7880 if (!showAnim) { 7881 postProcess(); 7882 } 7883 this._datepickerShowing = false; 7884 7885 onClose = this._get(inst, "onClose"); 7886 if (onClose) { 7887 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 7888 } 7889 7890 this._lastInput = null; 7891 if (this._inDialog) { 7892 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 7893 if ($.blockUI) { 7894 $.unblockUI(); 7895 $("body").append(this.dpDiv); 7896 } 7897 } 7898 this._inDialog = false; 7899 } 7900 }, 7901 7902 /* Tidy up after a dialog display. */ 7903 _tidyDialog: function (inst) { 7904 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 7905 }, 7906 7907 /* Close date picker if clicked elsewhere. */ 7908 _checkExternalClick: function (event) { 7909 if (!$.datepicker._curInst) { 7910 return; 7911 } 7912 7913 var $target = $(event.target), 7914 inst = $.datepicker._getInst($target[0]); 7915 7916 if ((($target[0].id !== $.datepicker._mainDivId && 7917 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 7918 !$target.hasClass($.datepicker.markerClassName) && 7919 !$target.closest("." + $.datepicker._triggerClass).length && 7920 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 7921 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 7922 $.datepicker._hideDatepicker(); 7923 } 7924 }, 7925 7926 /* Adjust one of the date sub-fields. */ 7927 _adjustDate: function (id, offset, period) { 7928 var target = $(id), 7929 inst = this._getInst(target[0]); 7930 7931 if (this._isDisabledDatepicker(target[0])) { 7932 return; 7933 } 7934 this._adjustInstDate(inst, offset + 7935 (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning 7936 period); 7937 this._updateDatepicker(inst); 7938 }, 7939 7940 /* Action for current link. */ 7941 _gotoToday: function (id) { 7942 var date, 7943 target = $(id), 7944 inst = this._getInst(target[0]); 7945 7946 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 7947 inst.selectedDay = inst.currentDay; 7948 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 7949 inst.drawYear = inst.selectedYear = inst.currentYear; 7950 } else { 7951 date = new Date(); 7952 inst.selectedDay = date.getDate(); 7953 inst.drawMonth = inst.selectedMonth = date.getMonth(); 7954 inst.drawYear = inst.selectedYear = date.getFullYear(); 7955 } 7956 this._notifyChange(inst); 7957 this._adjustDate(target); 7958 }, 7959 7960 /* Action for selecting a new month/year. */
vendor: 4,670 bytes, lines 7961-8092
7961 _selectMonthYear: function (id, select, period) { 7962 var target = $(id), 7963 inst = this._getInst(target[0]); 7964 7965 inst["selected" + (period === "M" ? "Month" : "Year")] = 7966 inst["draw" + (period === "M" ? "Month" : "Year")] = 7967 parseInt(select.options[select.selectedIndex].value, 10); 7968 7969 this._notifyChange(inst); 7970 this._adjustDate(target); 7971 }, 7972 7973 /* Action for selecting a day. */ 7974 _selectDay: function (id, month, year, td) { 7975 var inst, 7976 target = $(id); 7977 7978 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 7979 return; 7980 } 7981 7982 inst = this._getInst(target[0]); 7983 inst.selectedDay = inst.currentDay = $("a", td).html(); 7984 inst.selectedMonth = inst.currentMonth = month; 7985 inst.selectedYear = inst.currentYear = year; 7986 this._selectDate(id, this._formatDate(inst, 7987 inst.currentDay, inst.currentMonth, inst.currentYear)); 7988 }, 7989 7990 /* Erase the input field and hide the date picker. */ 7991 _clearDate: function (id) { 7992 var target = $(id); 7993 this._selectDate(target, ""); 7994 }, 7995 7996 /* Update the input field with the selected date. */ 7997 _selectDate: function (id, dateStr) { 7998 var onSelect, 7999 target = $(id), 8000 inst = this._getInst(target[0]); 8001 8002 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 8003 if (inst.input) { 8004 inst.input.val(dateStr); 8005 } 8006 this._updateAlternate(inst); 8007 8008 onSelect = this._get(inst, "onSelect"); 8009 if (onSelect) { 8010 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 8011 } else if (inst.input) { 8012 inst.input.trigger("change"); // fire the change event 8013 } 8014 8015 if (inst.inline) { 8016 this._updateDatepicker(inst); 8017 } else { 8018 this._hideDatepicker(); 8019 this._lastInput = inst.input[0]; 8020 if (typeof (inst.input[0]) !== "object") { 8021 inst.input.trigger("focus"); // restore focus 8022 } 8023 this._lastInput = null; 8024 } 8025 }, 8026 8027 /* Update any alternate field to synchronise with the main field. */ 8028 _updateAlternate: function (inst) { 8029 var altFormat, date, dateStr, 8030 altField = this._get(inst, "altField"); 8031 8032 if (altField) { // update alternate field too 8033 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 8034 date = this._getDate(inst); 8035 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 8036 $(altField).val(dateStr); 8037 } 8038 }, 8039 8040 /* Set as beforeShowDay function to prevent selection of weekends. 8041 * @param date Date - the date to customise 8042 * @return [boolean, string] - is this date selectable?, what is its CSS class? 8043 */ 8044 noWeekends: function (date) { 8045 var day = date.getDay(); 8046 return [(day > 0 && day < 6), ""]; 8047 }, 8048 8049 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 8050 * @param date Date - the date to get the week for 8051 * @return number - the number of the week within the year that contains this date 8052 */ 8053 iso8601Week: function (date) { 8054 var time, 8055 checkDate = new Date(date.getTime()); 8056 8057 // Find Thursday of this week starting on Monday 8058 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 8059 8060 time = checkDate.getTime(); 8061 checkDate.setMonth(0); // Compare with Jan 1 8062 checkDate.setDate(1); 8063 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 8064 }, 8065 8066 /* Parse a string value into a date object. 8067 * See formatDate below for the possible formats. 8068 * 8069 * @param format string - the expected format of the date 8070 * @param value string - the date in the above format 8071 * @param settings Object - attributes include: 8072 * shortYearCutoff number - the cutoff year for determining the century (optional) 8073 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8074 * dayNames string[7] - names of the days from Sunday (optional) 8075 * monthNamesShort string[12] - abbreviated names of the months (optional) 8076 * monthNames string[12] - names of the months (optional) 8077 * @return Date - the extracted date value or null if value is blank 8078 */ 8079 parseDate: function (format, value, settings) { 8080 if (format == null || value == null) { 8081 throw "Invalid arguments"; 8082 } 8083 8084 value = (typeof value === "object" ? value.toString() : value + ""); 8085 if (value === "") { 8086 return null; 8087 } 8088 8089 var iFormat, dim, extra, 8090 iValue = 0, 8091 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 8092 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 15,172 bytes, lines 8092-8567
8092: 8093 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 8094 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 8095 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 8096 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 8097 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 8098 year = -1, 8099 month = -1, 8100 day = -1, 8101 doy = -1, 8102 literal = false, 8103 date, 8104 8105 // Check whether a format character is doubled 8106 lookAhead = function (match) { 8107 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8108 if (matches) { 8109 iFormat++; 8110 } 8111 return matches; 8112 }, 8113 8114 // Extract a number from the string value 8115 getNumber = function (match) { 8116 var isDoubled = lookAhead(match), 8117 size = (match === "@" ? 14 : (match === "!" ? 20 : 8118 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 8119 minSize = (match === "y" ? size : 1), 8120 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 8121 num = value.substring(iValue).match(digits); 8122 if (!num) { 8123 throw "Missing number at position " + iValue; 8124 } 8125 iValue += num[0].length; 8126 return parseInt(num[0], 10); 8127 }, 8128 8129 // Extract a name from the string value and convert to an index 8130 getName = function (match, shortNames, longNames) { 8131 var index = -1, 8132 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 8133 return [[k, v]]; 8134 }).sort(function (a, b) { 8135 return -(a[1].length - b[1].length); 8136 }); 8137 8138 $.each(names, function (i, pair) { 8139 var name = pair[1]; 8140 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 8141 index = pair[0]; 8142 iValue += name.length; 8143 return false; 8144 } 8145 }); 8146 if (index !== -1) { 8147 return index + 1; 8148 } else { 8149 throw "Unknown name at position " + iValue; 8150 } 8151 }, 8152 8153 // Confirm that a literal character matches the string value 8154 checkLiteral = function () { 8155 if (value.charAt(iValue) !== format.charAt(iFormat)) { 8156 throw "Unexpected literal at position " + iValue; 8157 } 8158 iValue++; 8159 }; 8160 8161 for (iFormat = 0; iFormat < format.length; iFormat++) { 8162 if (literal) { 8163 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8164 literal = false; 8165 } else { 8166 checkLiteral(); 8167 } 8168 } else { 8169 switch (format.charAt(iFormat)) { 8170 case "d": 8171 day = getNumber("d"); 8172 break; 8173 case "D": 8174 getName("D", dayNamesShort, dayNames); 8175 break; 8176 case "o": 8177 doy = getNumber("o"); 8178 break; 8179 case "m": 8180 month = getNumber("m"); 8181 break; 8182 case "M": 8183 month = getName("M", monthNamesShort, monthNames); 8184 break; 8185 case "y": 8186 year = getNumber("y"); 8187 break; 8188 case "@": 8189 date = new Date(getNumber("@")); 8190 year = date.getFullYear(); 8191 month = date.getMonth() + 1; 8192 day = date.getDate(); 8193 break; 8194 case "!": 8195 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 8196 year = date.getFullYear(); 8197 month = date.getMonth() + 1; 8198 day = date.getDate(); 8199 break; 8200 case "'": 8201 if (lookAhead("'")) { 8202 checkLiteral(); 8203 } else { 8204 literal = true; 8205 } 8206 break; 8207 default: 8208 checkLiteral(); 8209 } 8210 } 8211 } 8212 8213 if (iValue < value.length) { 8214 extra = value.substr(iValue); 8215 if (!/^\s+/.test(extra)) { 8216 throw "Extra/unparsed characters found in date: " + extra; 8217 } 8218 } 8219 8220 if (year === -1) { 8221 year = new Date().getFullYear(); 8222 } else if (year < 100) { 8223 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 8224 (year <= shortYearCutoff ? 0 : -100); 8225 } 8226 8227 if (doy > -1) { 8228 month = 1; 8229 day = doy; 8230 do { 8231 dim = this._getDaysInMonth(year, month - 1); 8232 if (day <= dim) { 8233 break; 8234 } 8235 month++; 8236 day -= dim; 8237 } while (true); 8238 } 8239 8240 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 8241 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 8242 throw "Invalid date"; // E.g. 31/02/00 8243 } 8244 return date; 8245 }, 8246 8247 /* Standard date formats. */ 8248 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 8249 COOKIE: "D, dd M yy", 8250 ISO_8601: "yy-mm-dd", 8251 RFC_822: "D, d M y", 8252 RFC_850: "DD, dd-M-y", 8253 RFC_1036: "D, d M y", 8254 RFC_1123: "D, d M yy", 8255 RFC_2822: "D, d M yy", 8256 RSS: "D, d M y", // RFC 822 8257 TICKS: "!", 8258 TIMESTAMP: "@", 8259 W3C: "yy-mm-dd", // ISO 8601 8260 8261 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 8262 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 8263 8264 /* Format a date object into a string value. 8265 * The format can be combinations of the following: 8266 * d - day of month (no leading zero) 8267 * dd - day of month (two digit) 8268 * o - day of year (no leading zeros) 8269 * oo - day of year (three digit) 8270 * D - day name short 8271 * DD - day name long 8272 * m - month of year (no leading zero) 8273 * mm - month of year (two digit) 8274 * M - month name short 8275 * MM - month name long 8276 * y - year (two digit) 8277 * yy - year (four digit) 8278 * @ - Unix timestamp (ms since 01/01/1970) 8279 * ! - Windows ticks (100ns since 01/01/0001) 8280 * "..." - literal text 8281 * '' - single quote 8282 * 8283 * @param format string - the desired format of the date 8284 * @param date Date - the date value to format 8285 * @param settings Object - attributes include: 8286 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8287 * dayNames string[7] - names of the days from Sunday (optional) 8288 * monthNamesShort string[12] - abbreviated names of the months (optional) 8289 * monthNames string[12] - names of the months (optional) 8290 * @return string - the date in the above format 8291 */ 8292 formatDate: function (format, date, settings) { 8293 if (!date) { 8294 return ""; 8295 } 8296 8297 var iFormat, 8298 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 8299 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 8300 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 8301 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 8302 8303 // Check whether a format character is doubled 8304 lookAhead = function (match) { 8305 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8306 if (matches) { 8307 iFormat++; 8308 } 8309 return matches; 8310 }, 8311 8312 // Format a number, with leading zero if necessary 8313 formatNumber = function (match, value, len) { 8314 var num = "" + value; 8315 if (lookAhead(match)) { 8316 while (num.length < len) { 8317 num = "0" + num; 8318 } 8319 } 8320 return num; 8321 }, 8322 8323 // Format a name, short or long as requested 8324 formatName = function (match, value, shortNames, longNames) { 8325 return (lookAhead(match) ? longNames[value] : shortNames[value]); 8326 }, 8327 output = "", 8328 literal = false; 8329 8330 if (date) { 8331 for (iFormat = 0; iFormat < format.length; iFormat++) { 8332 if (literal) { 8333 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8334 literal = false; 8335 } else { 8336 output += format.charAt(iFormat); 8337 } 8338 } else { 8339 switch (format.charAt(iFormat)) { 8340 case "d": 8341 output += formatNumber("d", date.getDate(), 2); 8342 break; 8343 case "D": 8344 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 8345 break; 8346 case "o": 8347 output += formatNumber("o", 8348 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 8349 break; 8350 case "m": 8351 output += formatNumber("m", date.getMonth() + 1, 2); 8352 break; 8353 case "M": 8354 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 8355 break; 8356 case "y": 8357 output += (lookAhead("y") ? date.getFullYear() : 8358 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 8359 break; 8360 case "@": 8361 output += date.getTime(); 8362 break; 8363 case "!": 8364 output += date.getTime() * 10000 + this._ticksTo1970; 8365 break; 8366 case "'": 8367 if (lookAhead("'")) { 8368 output += "'"; 8369 } else { 8370 literal = true; 8371 } 8372 break; 8373 default: 8374 output += format.charAt(iFormat); 8375 } 8376 } 8377 } 8378 } 8379 return output; 8380 }, 8381 8382 /* Extract all possible characters from the date format. */ 8383 _possibleChars: function (format) { 8384 var iFormat, 8385 chars = "", 8386 literal = false, 8387 8388 // Check whether a format character is doubled 8389 lookAhead = function (match) { 8390 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 8391 if (matches) { 8392 iFormat++; 8393 } 8394 return matches; 8395 }; 8396 8397 for (iFormat = 0; iFormat < format.length; iFormat++) { 8398 if (literal) { 8399 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 8400 literal = false; 8401 } else { 8402 chars += format.charAt(iFormat); 8403 } 8404 } else { 8405 switch (format.charAt(iFormat)) { 8406 case "d": case "m": case "y": case "@": 8407 chars += "0123456789"; 8408 break; 8409 case "D": case "M": 8410 return null; // Accept anything 8411 case "'": 8412 if (lookAhead("'")) { 8413 chars += "'"; 8414 } else { 8415 literal = true; 8416 } 8417 break; 8418 default: 8419 chars += format.charAt(iFormat); 8420 } 8421 } 8422 } 8423 return chars; 8424 }, 8425 8426 /* Get a setting value, defaulting if necessary. */ 8427 _get: function (inst, name) { 8428 return inst.settings[name] !== undefined ? 8429 inst.settings[name] : this._defaults[name]; 8430 }, 8431 8432 /* Parse existing date and initialise date picker. */ 8433 _setDateFromField: function (inst, noDefault) { 8434 if (inst.input.val() === inst.lastVal) { 8435 return; 8436 } 8437 8438 var dateFormat = this._get(inst, "dateFormat"), 8439 dates = inst.lastVal = inst.input ? inst.input.val() : null, 8440 defaultDate = this._getDefaultDate(inst), 8441 date = defaultDate, 8442 settings = this._getFormatConfig(inst); 8443 8444 try { 8445 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 8446 } catch (event) { 8447 dates = (noDefault ? "" : dates); 8448 } 8449 inst.selectedDay = date.getDate(); 8450 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8451 inst.drawYear = inst.selectedYear = date.getFullYear(); 8452 inst.currentDay = (dates ? date.getDate() : 0); 8453 inst.currentMonth = (dates ? date.getMonth() : 0); 8454 inst.currentYear = (dates ? date.getFullYear() : 0); 8455 this._adjustInstDate(inst); 8456 }, 8457 8458 /* Retrieve the default date shown on opening. */ 8459 _getDefaultDate: function (inst) { 8460 return this._restrictMinMax(inst, 8461 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 8462 }, 8463 8464 /* A date may be specified as an exact value or a relative one. */ 8465 _determineDate: function (inst, date, defaultDate) { 8466 var offsetNumeric = function (offset) { 8467 var date = new Date(); 8468 date.setDate(date.getDate() + offset); 8469 return date; 8470 }, 8471 offsetString = function (offset) { 8472 try { 8473 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 8474 offset, $.datepicker._getFormatConfig(inst)); 8475 } 8476 catch (e) { 8477 // Ignore 8478 } 8479 8480 var date = (offset.toLowerCase().match(/^c/) ? 8481 $.datepicker._getDate(inst) : null) || new Date(), 8482 year = date.getFullYear(), 8483 month = date.getMonth(), 8484 day = date.getDate(), 8485 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 8486 matches = pattern.exec(offset); 8487 8488 while (matches) { 8489 switch (matches[2] || "d") { 8490 case "d": case "D": 8491 day += parseInt(matches[1], 10); break; 8492 case "w": case "W": 8493 day += parseInt(matches[1], 10) * 7; break; 8494 case "m": case "M": 8495 month += parseInt(matches[1], 10); 8496 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 8497 break; 8498 case "y": case "Y": 8499 year += parseInt(matches[1], 10); 8500 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 8501 break; 8502 } 8503 matches = pattern.exec(offset); 8504 } 8505 return new Date(year, month, day); 8506 }, 8507 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 8508 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 8509 8510 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 8511 if (newDate) { 8512 newDate.setHours(0); 8513 newDate.setMinutes(0); 8514 newDate.setSeconds(0); 8515 newDate.setMilliseconds(0); 8516 } 8517 return this._daylightSavingAdjust(newDate); 8518 }, 8519 8520 /* Handle switch to/from daylight saving. 8521 * Hours may be non-zero on daylight saving cut-over: 8522 * > 12 when midnight changeover, but then cannot generate 8523 * midnight datetime, so jump to 1AM, otherwise reset. 8524 * @param date (Date) the date to check 8525 * @return (Date) the corrected date 8526 */ 8527 _daylightSavingAdjust: function (date) { 8528 if (!date) { 8529 return null; 8530 } 8531 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 8532 return date; 8533 }, 8534 8535 /* Set the date(s) directly. */ 8536 _setDate: function (inst, date, noChange) { 8537 var clear = !date, 8538 origMonth = inst.selectedMonth, 8539 origYear = inst.selectedYear, 8540 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 8541 8542 inst.selectedDay = inst.currentDay = newDate.getDate(); 8543 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 8544 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 8545 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 8546 this._notifyChange(inst); 8547 } 8548 this._adjustInstDate(inst); 8549 if (inst.input) { 8550 inst.input.val(clear ? "" : this._formatDate(inst)); 8551 } 8552 }, 8553 8554 /* Retrieve the date(s) directly. */ 8555 _getDate: function (inst) { 8556 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 8557 this._daylightSavingAdjust(new Date( 8558 inst.currentYear, inst.currentMonth, inst.currentDay))); 8559 return startDate; 8560 }, 8561 8562 /* Attach the onxxx handlers. These are declared statically so 8563 * they work with static code transformers like Caja. 8564 */ 8565 _attachHandlers: function (inst) { 8566 var stepMonths = this._get(inst, "stepMonths"), 8567 id = "#" + inst.id.replace(/\\\\/g, "\\");
vendor: 29,703 bytes, lines 8568-9299
8568 inst.dpDiv.find("[data-handler]").map(function () { 8569 var handler = { 8570 prev: function () { 8571 $.datepicker._adjustDate(id, -stepMonths, "M"); 8572 }, 8573 next: function () { 8574 $.datepicker._adjustDate(id, +stepMonths, "M"); 8575 }, 8576 hide: function () { 8577 $.datepicker._hideDatepicker(); 8578 }, 8579 today: function () { 8580 $.datepicker._gotoToday(id); 8581 }, 8582 selectDay: function () { 8583 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 8584 return false; 8585 }, 8586 selectMonth: function () { 8587 $.datepicker._selectMonthYear(id, this, "M"); 8588 return false; 8589 }, 8590 selectYear: function () { 8591 $.datepicker._selectMonthYear(id, this, "Y"); 8592 return false; 8593 } 8594 }; 8595 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 8596 }); 8597 }, 8598 8599 /* Generate the HTML for the current state of the date picker. */ 8600 _generateHTML: function (inst) { 8601 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 8602 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 8603 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 8604 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 8605 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 8606 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 8607 tempDate = new Date(), 8608 today = this._daylightSavingAdjust( 8609 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 8610 isRTL = this._get(inst, "isRTL"), 8611 showButtonPanel = this._get(inst, "showButtonPanel"), 8612 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 8613 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 8614 numMonths = this._getNumberOfMonths(inst), 8615 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 8616 stepMonths = this._get(inst, "stepMonths"), 8617 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 8618 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 8619 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 8620 minDate = this._getMinMaxDate(inst, "min"), 8621 maxDate = this._getMinMaxDate(inst, "max"), 8622 drawMonth = inst.drawMonth - showCurrentAtPos, 8623 drawYear = inst.drawYear; 8624 8625 if (drawMonth < 0) { 8626 drawMonth += 12; 8627 drawYear--; 8628 } 8629 if (maxDate) { 8630 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 8631 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 8632 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 8633 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 8634 drawMonth--; 8635 if (drawMonth < 0) { 8636 drawMonth = 11; 8637 drawYear--; 8638 } 8639 } 8640 } 8641 inst.drawMonth = drawMonth; 8642 inst.drawYear = drawYear; 8643 8644 prevText = this._get(inst, "prevText"); 8645 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 8646 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 8647 this._getFormatConfig(inst))); 8648 8649 prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 8650 "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + 8651 " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : 8652 (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>")); 8653 8654 nextText = this._get(inst, "nextText"); 8655 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 8656 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 8657 this._getFormatConfig(inst))); 8658 8659 next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? 8660 "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + 8661 " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : 8662 (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>")); 8663 8664 currentText = this._get(inst, "currentText"); 8665 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 8666 currentText = (!navigationAsDateFormat ? currentText : 8667 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 8668 8669 controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + 8670 this._get(inst, "closeText") + "</button>" : ""); 8671 8672 buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + 8673 (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + 8674 ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; 8675 8676 firstDay = parseInt(this._get(inst, "firstDay"), 10); 8677 firstDay = (isNaN(firstDay) ? 0 : firstDay); 8678 8679 showWeek = this._get(inst, "showWeek"); 8680 dayNames = this._get(inst, "dayNames"); 8681 dayNamesMin = this._get(inst, "dayNamesMin"); 8682 monthNames = this._get(inst, "monthNames"); 8683 monthNamesShort = this._get(inst, "monthNamesShort"); 8684 beforeShowDay = this._get(inst, "beforeShowDay"); 8685 showOtherMonths = this._get(inst, "showOtherMonths"); 8686 selectOtherMonths = this._get(inst, "selectOtherMonths"); 8687 defaultDate = this._getDefaultDate(inst); 8688 html = ""; 8689 8690 for (row = 0; row < numMonths[0]; row++) { 8691 group = ""; 8692 this.maxRows = 4; 8693 for (col = 0; col < numMonths[1]; col++) { 8694 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 8695 cornerClass = " ui-corner-all"; 8696 calender = ""; 8697 if (isMultiMonth) { 8698 calender += "<div class='ui-datepicker-group"; 8699 if (numMonths[1] > 1) { 8700 switch (col) { 8701 case 0: calender += " ui-datepicker-group-first"; 8702 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 8703 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 8704 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 8705 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 8706 } 8707 } 8708 calender += "'>"; 8709 } 8710 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 8711 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 8712 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 8713 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 8714 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 8715 "</div><table class='ui-datepicker-calendar'><thead>" + 8716 "<tr>"; 8717 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 8718 for (dow = 0; dow < 7; dow++) { // days of the week 8719 day = (dow + firstDay) % 7; 8720 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 8721 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 8722 } 8723 calender += thead + "</tr></thead><tbody>"; 8724 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 8725 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 8726 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 8727 } 8728 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 8729 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 8730 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 8731 this.maxRows = numRows; 8732 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 8733 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 8734 calender += "<tr>"; 8735 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 8736 this._get(inst, "calculateWeek")(printDate) + "</td>"); 8737 for (dow = 0; dow < 7; dow++) { // create date picker days 8738 daySettings = (beforeShowDay ? 8739 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 8740 otherMonth = (printDate.getMonth() !== drawMonth); 8741 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 8742 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 8743 tbody += "<td class='" + 8744 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 8745 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 8746 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 8747 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 8748 8749 // or defaultDate is current printedDate and defaultDate is selectedDate 8750 " " + this._dayOverClass : "") + // highlight selected day 8751 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 8752 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 8753 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 8754 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 8755 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 8756 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 8757 (otherMonth && !showOtherMonths ? " " : // display for other months 8758 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 8759 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 8760 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 8761 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 8762 "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 8763 printDate.setDate(printDate.getDate() + 1); 8764 printDate = this._daylightSavingAdjust(printDate); 8765 } 8766 calender += tbody + "</tr>"; 8767 } 8768 drawMonth++; 8769 if (drawMonth > 11) { 8770 drawMonth = 0; 8771 drawYear++; 8772 } 8773 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 8774 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 8775 group += calender; 8776 } 8777 html += group; 8778 } 8779 html += buttonPanel; 8780 inst._keyEvent = false; 8781 return html; 8782 }, 8783 8784 /* Generate the month and year header. */ 8785 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 8786 secondary, monthNames, monthNamesShort) { 8787 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 8788 changeMonth = this._get(inst, "changeMonth"), 8789 changeYear = this._get(inst, "changeYear"), 8790 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 8791 html = "<div class='ui-datepicker-title'>", 8792 monthHtml = ""; 8793 8794 // Month selection 8795 if (secondary || !changeMonth) { 8796 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 8797 } else { 8798 inMinYear = (minDate && minDate.getFullYear() === drawYear); 8799 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 8800 monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; 8801 for (month = 0; month < 12; month++) { 8802 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 8803 monthHtml += "<option value='" + month + "'" + 8804 (month === drawMonth ? " selected='selected'" : "") + 8805 ">" + monthNamesShort[month] + "</option>"; 8806 } 8807 } 8808 monthHtml += "</select>"; 8809 } 8810 8811 if (!showMonthAfterYear) { 8812 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 8813 } 8814 8815 // Year selection 8816 if (!inst.yearshtml) { 8817 inst.yearshtml = ""; 8818 if (secondary || !changeYear) { 8819 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 8820 } else { 8821 // determine range of years to display 8822 years = this._get(inst, "yearRange").split(":"); 8823 thisYear = new Date().getFullYear(); 8824 determineYear = function (value) { 8825 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 8826 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 8827 parseInt(value, 10))); 8828 return (isNaN(year) ? thisYear : year); 8829 }; 8830 year = determineYear(years[0]); 8831 endYear = Math.max(year, determineYear(years[1] || "")); 8832 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 8833 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 8834 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; 8835 for (; year <= endYear; year++) { 8836 inst.yearshtml += "<option value='" + year + "'" + 8837 (year === drawYear ? " selected='selected'" : "") + 8838 ">" + year + "</option>"; 8839 } 8840 inst.yearshtml += "</select>"; 8841 8842 html += inst.yearshtml; 8843 inst.yearshtml = null; 8844 } 8845 } 8846 8847 html += this._get(inst, "yearSuffix"); 8848 if (showMonthAfterYear) { 8849 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 8850 } 8851 html += "</div>"; // Close datepicker_header 8852 return html; 8853 }, 8854 8855 /* Adjust one of the date sub-fields. */ 8856 _adjustInstDate: function (inst, offset, period) { 8857 var year = inst.selectedYear + (period === "Y" ? offset : 0), 8858 month = inst.selectedMonth + (period === "M" ? offset : 0), 8859 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 8860 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 8861 8862 inst.selectedDay = date.getDate(); 8863 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8864 inst.drawYear = inst.selectedYear = date.getFullYear(); 8865 if (period === "M" || period === "Y") { 8866 this._notifyChange(inst); 8867 } 8868 }, 8869 8870 /* Ensure a date is within any min/max bounds. */ 8871 _restrictMinMax: function (inst, date) { 8872 var minDate = this._getMinMaxDate(inst, "min"), 8873 maxDate = this._getMinMaxDate(inst, "max"), 8874 newDate = (minDate && date < minDate ? minDate : date); 8875 return (maxDate && newDate > maxDate ? maxDate : newDate); 8876 }, 8877 8878 /* Notify change of month/year. */ 8879 _notifyChange: function (inst) { 8880 var onChange = this._get(inst, "onChangeMonthYear"); 8881 if (onChange) { 8882 onChange.apply((inst.input ? inst.input[0] : null), 8883 [inst.selectedYear, inst.selectedMonth + 1, inst]); 8884 } 8885 }, 8886 8887 /* Determine the number of months to show. */ 8888 _getNumberOfMonths: function (inst) { 8889 var numMonths = this._get(inst, "numberOfMonths"); 8890 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 8891 }, 8892 8893 /* Determine the current maximum date - ensure no time components are set. */ 8894 _getMinMaxDate: function (inst, minMax) { 8895 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 8896 }, 8897 8898 /* Find the number of days in a given month. */ 8899 _getDaysInMonth: function (year, month) { 8900 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 8901 }, 8902 8903 /* Find the day of the week of the first of a month. */ 8904 _getFirstDayOfMonth: function (year, month) { 8905 return new Date(year, month, 1).getDay(); 8906 }, 8907 8908 /* Determines if we should allow a "next/prev" month display change. */ 8909 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 8910 var numMonths = this._getNumberOfMonths(inst), 8911 date = this._daylightSavingAdjust(new Date(curYear, 8912 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 8913 8914 if (offset < 0) { 8915 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 8916 } 8917 return this._isInRange(inst, date); 8918 }, 8919 8920 /* Is the given date in the accepted range? */ 8921 _isInRange: function (inst, date) { 8922 var yearSplit, currentYear, 8923 minDate = this._getMinMaxDate(inst, "min"), 8924 maxDate = this._getMinMaxDate(inst, "max"), 8925 minYear = null, 8926 maxYear = null, 8927 years = this._get(inst, "yearRange"); 8928 if (years) { 8929 yearSplit = years.split(":"); 8930 currentYear = new Date().getFullYear(); 8931 minYear = parseInt(yearSplit[0], 10); 8932 maxYear = parseInt(yearSplit[1], 10); 8933 if (yearSplit[0].match(/[+\-].*/)) { 8934 minYear += currentYear; 8935 } 8936 if (yearSplit[1].match(/[+\-].*/)) { 8937 maxYear += currentYear; 8938 } 8939 } 8940 8941 return ((!minDate || date.getTime() >= minDate.getTime()) && 8942 (!maxDate || date.getTime() <= maxDate.getTime()) && 8943 (!minYear || date.getFullYear() >= minYear) && 8944 (!maxYear || date.getFullYear() <= maxYear)); 8945 }, 8946 8947 /* Provide the configuration settings for formatting/parsing. */ 8948 _getFormatConfig: function (inst) { 8949 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 8950 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 8951 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 8952 return { 8953 shortYearCutoff: shortYearCutoff, 8954 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 8955 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 8956 }; 8957 }, 8958 8959 /* Format the given date for display. */ 8960 _formatDate: function (inst, day, month, year) { 8961 if (!day) { 8962 inst.currentDay = inst.selectedDay; 8963 inst.currentMonth = inst.selectedMonth; 8964 inst.currentYear = inst.selectedYear; 8965 } 8966 var date = (day ? (typeof day === "object" ? day : 8967 this._daylightSavingAdjust(new Date(year, month, day))) : 8968 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 8969 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 8970 } 8971 }); 8972 8973 /* 8974 * Bind hover events for datepicker elements. 8975 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 8976 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 8977 */ 8978 function datepicker_bindHover(dpDiv) { 8979 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 8980 return dpDiv.on("mouseout", selector, function () { 8981 $(this).removeClass("ui-state-hover"); 8982 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 8983 $(this).removeClass("ui-datepicker-prev-hover"); 8984 } 8985 if (this.className.indexOf("ui-datepicker-next") !== -1) { 8986 $(this).removeClass("ui-datepicker-next-hover"); 8987 } 8988 }) 8989 .on("mouseover", selector, datepicker_handleMouseover); 8990 } 8991 8992 function datepicker_handleMouseover() { 8993 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 8994 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 8995 $(this).addClass("ui-state-hover"); 8996 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 8997 $(this).addClass("ui-datepicker-prev-hover"); 8998 } 8999 if (this.className.indexOf("ui-datepicker-next") !== -1) { 9000 $(this).addClass("ui-datepicker-next-hover"); 9001 } 9002 } 9003 } 9004 9005 /* jQuery extend now ignores nulls! */ 9006 function datepicker_extendRemove(target, props) { 9007 $.extend(target, props); 9008 for (var name in props) { 9009 if (props[name] == null) { 9010 target[name] = props[name]; 9011 } 9012 } 9013 return target; 9014 } 9015 9016 /* Invoke the datepicker functionality. 9017 @param options string - a command, optionally followed by additional parameters or 9018 Object - settings for attaching new datepicker functionality 9019 @return jQuery object */ 9020 $.fn.datepicker = function (options) { 9021 /* Verify an empty collection wasn't passed - Fixes #6976 */ 9022 if (!this.length) { 9023 return this; 9024 } 9025 9026 /* Initialise the date picker. */ 9027 if (!$.datepicker.initialized) { 9028 $(document).on("mousedown", $.datepicker._checkExternalClick); 9029 $.datepicker.initialized = true; 9030 } 9031 9032 /* Append datepicker main container to body if not exist. */ 9033 if ($("#" + $.datepicker._mainDivId).length === 0) { 9034 $("body").append($.datepicker.dpDiv); 9035 } 9036 9037 var otherArgs = Array.prototype.slice.call(arguments, 1); 9038 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 9039 return $.datepicker["_" + options + "Datepicker"]. 9040 apply($.datepicker, [this[0]].concat(otherArgs)); 9041 } 9042 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 9043 return $.datepicker["_" + options + "Datepicker"]. 9044 apply($.datepicker, [this[0]].concat(otherArgs)); 9045 } 9046 return this.each(function () { 9047 typeof options === "string" ? 9048 $.datepicker["_" + options + "Datepicker"]. 9049 apply($.datepicker, [this].concat(otherArgs)) : 9050 $.datepicker._attachDatepicker(this, options); 9051 }); 9052 }; 9053 9054 $.datepicker = new Datepicker(); // singleton instance 9055 $.datepicker.initialized = false; 9056 $.datepicker.uuid = new Date().getTime(); 9057 $.datepicker.version = "1.12.1"; 9058 9059 var widgetsDatepicker = $.datepicker; 9060 9061 // This file is deprecated 9062 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 9063 9064 /*! 9065 * jQuery UI Mouse 1.12.1 9066 * http://jqueryui.com 9067 * 9068 * Copyright jQuery Foundation and other contributors 9069 * Released under the MIT license. 9070 * http://jquery.org/license 9071 */ 9072 9073 //>>label: Mouse 9074 //>>group: Widgets 9075 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 9076 //>>docs: http://api.jqueryui.com/mouse/ 9077 9078 var mouseHandled = false; 9079 $(document).on("mouseup", function () { 9080 mouseHandled = false; 9081 }); 9082 9083 var widgetsMouse = $.widget("ui.mouse", { 9084 version: "1.12.1", 9085 options: { 9086 cancel: "input, textarea, button, select, option", 9087 distance: 1, 9088 delay: 0 9089 }, 9090 _mouseInit: function () { 9091 var that = this; 9092 9093 this.element 9094 .on("mousedown." + this.widgetName, function (event) { 9095 return that._mouseDown(event); 9096 }) 9097 .on("click." + this.widgetName, function (event) { 9098 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 9099 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 9100 event.stopImmediatePropagation(); 9101 return false; 9102 } 9103 }); 9104 9105 this.started = false; 9106 }, 9107 9108 // TODO: make sure destroying one instance of mouse doesn't mess with 9109 // other instances of mouse 9110 _mouseDestroy: function () { 9111 this.element.off("." + this.widgetName); 9112 if (this._mouseMoveDelegate) { 9113 this.document 9114 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 9115 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 9116 } 9117 }, 9118 9119 _mouseDown: function (event) { 9120 // don't let more than one widget handle mouseStart 9121 if (mouseHandled) { 9122 return; 9123 } 9124 9125 this._mouseMoved = false; 9126 9127 // We may have missed mouseup (out of window) 9128 (this._mouseStarted && this._mouseUp(event)); 9129 9130 this._mouseDownEvent = event; 9131 9132 var that = this, 9133 btnIsLeft = (event.which === 1), 9134 9135 // event.target.nodeName works around a bug in IE 8 with 9136 // disabled inputs (#7620) 9137 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 9138 $(event.target).closest(this.options.cancel).length : false); 9139 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 9140 return true; 9141 } 9142 9143 this.mouseDelayMet = !this.options.delay; 9144 if (!this.mouseDelayMet) { 9145 this._mouseDelayTimer = setTimeout(function () { 9146 that.mouseDelayMet = true; 9147 }, this.options.delay); 9148 } 9149 9150 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 9151 this._mouseStarted = (this._mouseStart(event) !== false); 9152 if (!this._mouseStarted) { 9153 event.preventDefault(); 9154 return true; 9155 } 9156 } 9157 9158 // Click event may never have fired (Gecko & Opera) 9159 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 9160 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 9161 } 9162 9163 // These delegates are required to keep context 9164 this._mouseMoveDelegate = function (event) { 9165 return that._mouseMove(event); 9166 }; 9167 this._mouseUpDelegate = function (event) { 9168 return that._mouseUp(event); 9169 }; 9170 9171 this.document 9172 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 9173 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 9174 9175 event.preventDefault(); 9176 9177 mouseHandled = true; 9178 return true; 9179 }, 9180 9181 _mouseMove: function (event) { 9182 // Only check for mouseups outside the document if you've moved inside the document 9183 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 9184 // fire a mousemove event if content is placed under the cursor. See #7778 9185 // Support: IE <9 9186 if (this._mouseMoved) { 9187 // IE mouseup check - mouseup happened when mouse was out of window 9188 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 9189 !event.button) { 9190 return this._mouseUp(event); 9191 9192 // Iframe mouseup check - mouseup occurred in another document 9193 } else if (!event.which) { 9194 // Support: Safari <=8 - 9 9195 // Safari sets which to 0 if you press any of the following keys 9196 // during a drag (#14461) 9197 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 9198 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 9199 this.ignoreMissingWhich = true; 9200 } else if (!this.ignoreMissingWhich) { 9201 return this._mouseUp(event); 9202 } 9203 } 9204 } 9205 9206 if (event.which || event.button) { 9207 this._mouseMoved = true; 9208 } 9209 9210 if (this._mouseStarted) { 9211 this._mouseDrag(event); 9212 return event.preventDefault(); 9213 } 9214 9215 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 9216 this._mouseStarted = 9217 (this._mouseStart(this._mouseDownEvent, event) !== false); 9218 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 9219 } 9220 9221 return !this._mouseStarted; 9222 }, 9223 9224 _mouseUp: function (event) { 9225 this.document 9226 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 9227 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 9228 9229 if (this._mouseStarted) { 9230 this._mouseStarted = false; 9231 9232 if (event.target === this._mouseDownEvent.target) { 9233 $.data(event.target, this.widgetName + ".preventClickEvent", true); 9234 } 9235 9236 this._mouseStop(event); 9237 } 9238 9239 if (this._mouseDelayTimer) { 9240 clearTimeout(this._mouseDelayTimer); 9241 delete this._mouseDelayTimer; 9242 } 9243 9244 this.ignoreMissingWhich = false; 9245 mouseHandled = false; 9246 event.preventDefault(); 9247 }, 9248 9249 _mouseDistanceMet: function (event) { 9250 return (Math.max( 9251 Math.abs(this._mouseDownEvent.pageX - event.pageX), 9252 Math.abs(this._mouseDownEvent.pageY - event.pageY) 9253 ) >= this.options.distance 9254 ); 9255 }, 9256 9257 _mouseDelayMet: function ( /* event */) { 9258 return this.mouseDelayMet; 9259 }, 9260 9261 // These are placeholder methods, to be overriden by extending plugin 9262 _mouseStart: function ( /* event */) { }, 9263 _mouseDrag: function ( /* event */) { }, 9264 _mouseStop: function ( /* event */) { }, 9265 _mouseCapture: function ( /* event */) { return true; } 9266 }); 9267 9268 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 9269 var plugin = $.ui.plugin = { 9270 add: function (module, option, set) { 9271 var i, 9272 proto = $.ui[module].prototype; 9273 for (i in set) { 9274 proto.plugins[i] = proto.plugins[i] || []; 9275 proto.plugins[i].push([option, set[i]]); 9276 } 9277 }, 9278 call: function (instance, name, args, allowDisconnected) { 9279 var i, 9280 set = instance.plugins[name]; 9281 9282 if (!set) { 9283 return; 9284 } 9285 9286 if (!allowDisconnected && (!instance.element[0].parentNode || 9287 instance.element[0].parentNode.nodeType === 11)) { 9288 return; 9289 } 9290 9291 for (i = 0; i < set.length; i++) { 9292 if (instance.options[set[i][0]]) { 9293 set[i][1].apply(instance.element, args); 9294 } 9295 } 9296 } 9297 }; 9298 9299 var safeBlur = $.ui.safeBlur = function (element) {
vendor: 4,450 bytes, lines 9300-9473
9300 // Support: IE9 - 10 only 9301 // If the <body> is blurred, IE will switch windows, see #9420 9302 if (element && element.nodeName.toLowerCase() !== "body") { 9303 $(element).trigger("blur"); 9304 } 9305 }; 9306 9307 /*! 9308 * jQuery UI Draggable 1.12.1 9309 * http://jqueryui.com 9310 * 9311 * Copyright jQuery Foundation and other contributors 9312 * Released under the MIT license. 9313 * http://jquery.org/license 9314 */ 9315 9316 //>>label: Draggable 9317 //>>group: Interactions 9318 //>>description: Enables dragging functionality for any element. 9319 //>>docs: http://api.jqueryui.com/draggable/ 9320 //>>demos: http://jqueryui.com/draggable/ 9321 //>>css.structure: ../../themes/base/draggable.css 9322 9323 $.widget("ui.draggable", $.ui.mouse, { 9324 version: "1.12.1", 9325 widgetEventPrefix: "drag", 9326 options: { 9327 addClasses: true, 9328 appendTo: "parent", 9329 axis: false, 9330 connectToSortable: false, 9331 containment: false, 9332 cursor: "auto", 9333 cursorAt: false, 9334 grid: false, 9335 handle: false, 9336 helper: "original", 9337 iframeFix: false, 9338 opacity: false, 9339 refreshPositions: false, 9340 revert: false, 9341 revertDuration: 500, 9342 scope: "default", 9343 scroll: true, 9344 scrollSensitivity: 20, 9345 scrollSpeed: 20, 9346 snap: false, 9347 snapMode: "both", 9348 snapTolerance: 20, 9349 stack: false, 9350 zIndex: false, 9351 9352 // Callbacks 9353 drag: null, 9354 start: null, 9355 stop: null 9356 }, 9357 _create: function () { 9358 if (this.options.helper === "original") { 9359 this._setPositionRelative(); 9360 } 9361 if (this.options.addClasses) { 9362 this._addClass("ui-draggable"); 9363 } 9364 this._setHandleClassName(); 9365 9366 this._mouseInit(); 9367 }, 9368 9369 _setOption: function (key, value) { 9370 this._super(key, value); 9371 if (key === "handle") { 9372 this._removeHandleClassName(); 9373 this._setHandleClassName(); 9374 } 9375 }, 9376 9377 _destroy: function () { 9378 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 9379 this.destroyOnClear = true; 9380 return; 9381 } 9382 this._removeHandleClassName(); 9383 this._mouseDestroy(); 9384 }, 9385 9386 _mouseCapture: function (event) { 9387 var o = this.options; 9388 9389 // Among others, prevent a drag on a resizable-handle 9390 if (this.helper || o.disabled || 9391 $(event.target).closest(".ui-resizable-handle").length > 0) { 9392 return false; 9393 } 9394 9395 //Quit if we're not on a valid handle 9396 this.handle = this._getHandle(event); 9397 if (!this.handle) { 9398 return false; 9399 } 9400 9401 this._blurActiveElement(event); 9402 9403 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 9404 9405 return true; 9406 }, 9407 9408 _blockFrames: function (selector) { 9409 this.iframeBlocks = this.document.find(selector).map(function () { 9410 var iframe = $(this); 9411 9412 return $("<div>") 9413 .css("position", "absolute") 9414 .appendTo(iframe.parent()) 9415 .outerWidth(iframe.outerWidth()) 9416 .outerHeight(iframe.outerHeight()) 9417 .offset(iframe.offset())[0]; 9418 }); 9419 }, 9420 9421 _unblockFrames: function () { 9422 if (this.iframeBlocks) { 9423 this.iframeBlocks.remove(); 9424 delete this.iframeBlocks; 9425 } 9426 }, 9427 9428 _blurActiveElement: function (event) { 9429 var activeElement = $.ui.safeActiveElement(this.document[0]), 9430 target = $(event.target); 9431 9432 // Don't blur if the event occurred on an element that is within 9433 // the currently focused element 9434 // See #10527, #12472 9435 if (target.closest(activeElement).length) { 9436 return; 9437 } 9438 9439 // Blur any element that currently has focus, see #4261 9440 $.ui.safeBlur(activeElement); 9441 }, 9442 9443 _mouseStart: function (event) { 9444 var o = this.options; 9445 9446 //Create and append the visible helper 9447 this.helper = this._createHelper(event); 9448 9449 this._addClass(this.helper, "ui-draggable-dragging"); 9450 9451 //Cache the helper size 9452 this._cacheHelperProportions(); 9453 9454 //If ddmanager is used for droppables, set the global draggable 9455 if ($.ui.ddmanager) { 9456 $.ui.ddmanager.current = this; 9457 } 9458 9459 /* 9460 * - Position generation - 9461 * This block generates everything position related - it's the core of draggables. 9462 */ 9463 9464 //Cache the margins of the original element 9465 this._cacheMargins(); 9466 9467 //Store the helper's css position 9468 this.cssPosition = this.helper.css("position"); 9469 this.scrollParent = this.helper.scrollParent(true); 9470 this.offsetParent = this.helper.offsetParent(); 9471 this.hasFixedAncestor = this.helper.parents().filter(function () { 9472 return $(this).css("position") === "fixed"; 9473 }).length > 0;
vendor: 5,414 bytes, lines 9474-9660
9474 9475 //The element's absolute position on the page minus margins 9476 this.positionAbs = this.element.offset(); 9477 this._refreshOffsets(event); 9478 9479 //Generate the original position 9480 this.originalPosition = this.position = this._generatePosition(event, false); 9481 this.originalPageX = event.pageX; 9482 this.originalPageY = event.pageY; 9483 9484 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 9485 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 9486 9487 //Set a containment if given in the options 9488 this._setContainment(); 9489 9490 //Trigger event + callbacks 9491 if (this._trigger("start", event) === false) { 9492 this._clear(); 9493 return false; 9494 } 9495 9496 //Recache the helper size 9497 this._cacheHelperProportions(); 9498 9499 //Prepare the droppable offsets 9500 if ($.ui.ddmanager && !o.dropBehaviour) { 9501 $.ui.ddmanager.prepareOffsets(this, event); 9502 } 9503 9504 // Execute the drag once - this causes the helper not to be visible before getting its 9505 // correct position 9506 this._mouseDrag(event, true); 9507 9508 // If the ddmanager is used for droppables, inform the manager that dragging has started 9509 // (see #5003) 9510 if ($.ui.ddmanager) { 9511 $.ui.ddmanager.dragStart(this, event); 9512 } 9513 9514 return true; 9515 }, 9516 9517 _refreshOffsets: function (event) { 9518 this.offset = { 9519 top: this.positionAbs.top - this.margins.top, 9520 left: this.positionAbs.left - this.margins.left, 9521 scroll: false, 9522 parent: this._getParentOffset(), 9523 relative: this._getRelativeOffset() 9524 }; 9525 9526 this.offset.click = { 9527 left: event.pageX - this.offset.left, 9528 top: event.pageY - this.offset.top 9529 }; 9530 }, 9531 9532 _mouseDrag: function (event, noPropagation) { 9533 // reset any necessary cached properties (see #5009) 9534 if (this.hasFixedAncestor) { 9535 this.offset.parent = this._getParentOffset(); 9536 } 9537 9538 //Compute the helpers position 9539 this.position = this._generatePosition(event, true); 9540 this.positionAbs = this._convertPositionTo("absolute"); 9541 9542 //Call plugins and callbacks and use the resulting position if something is returned 9543 if (!noPropagation) { 9544 var ui = this._uiHash(); 9545 if (this._trigger("drag", event, ui) === false) { 9546 this._mouseUp(new $.Event("mouseup", event)); 9547 return false; 9548 } 9549 this.position = ui.position; 9550 } 9551 9552 this.helper[0].style.left = this.position.left + "px"; 9553 this.helper[0].style.top = this.position.top + "px"; 9554 9555 if ($.ui.ddmanager) { 9556 $.ui.ddmanager.drag(this, event); 9557 } 9558 9559 return false; 9560 }, 9561 9562 _mouseStop: function (event) { 9563 //If we are using droppables, inform the manager about the drop 9564 var that = this, 9565 dropped = false; 9566 if ($.ui.ddmanager && !this.options.dropBehaviour) { 9567 dropped = $.ui.ddmanager.drop(this, event); 9568 } 9569 9570 //if a drop comes from outside (a sortable) 9571 if (this.dropped) { 9572 dropped = this.dropped; 9573 this.dropped = false; 9574 } 9575 9576 if ((this.options.revert === "invalid" && !dropped) || 9577 (this.options.revert === "valid" && dropped) || 9578 this.options.revert === true || ($.isFunction(this.options.revert) && 9579 this.options.revert.call(this.element, dropped)) 9580 ) { 9581 $(this.helper).animate( 9582 this.originalPosition, 9583 parseInt(this.options.revertDuration, 10), 9584 function () { 9585 if (that._trigger("stop", event) !== false) { 9586 that._clear(); 9587 } 9588 } 9589 ); 9590 } else { 9591 if (this._trigger("stop", event) !== false) { 9592 this._clear(); 9593 } 9594 } 9595 9596 return false; 9597 }, 9598 9599 _mouseUp: function (event) { 9600 this._unblockFrames(); 9601 9602 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 9603 // (see #5003) 9604 if ($.ui.ddmanager) { 9605 $.ui.ddmanager.dragStop(this, event); 9606 } 9607 9608 // Only need to focus if the event occurred on the draggable itself, see #10527 9609 if (this.handleElement.is(event.target)) { 9610 // The interaction is over; whether or not the click resulted in a drag, 9611 // focus the element 9612 this.element.trigger("focus"); 9613 } 9614 9615 return $.ui.mouse.prototype._mouseUp.call(this, event); 9616 }, 9617 9618 cancel: function () { 9619 if (this.helper.is(".ui-draggable-dragging")) { 9620 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 9621 } else { 9622 this._clear(); 9623 } 9624 9625 return this; 9626 }, 9627 9628 _getHandle: function (event) { 9629 return this.options.handle ? 9630 !!$(event.target).closest(this.element.find(this.options.handle)).length : 9631 true; 9632 }, 9633 9634 _setHandleClassName: function () { 9635 this.handleElement = this.options.handle ? 9636 this.element.find(this.options.handle) : this.element; 9637 this._addClass(this.handleElement, "ui-draggable-handle"); 9638 }, 9639 9640 _removeHandleClassName: function () { 9641 this._removeClass(this.handleElement, "ui-draggable-handle"); 9642 }, 9643 9644 _createHelper: function (event) { 9645 var o = this.options, 9646 helperIsFunction = $.isFunction(o.helper), 9647 helper = helperIsFunction ? 9648 $(o.helper.apply(this.element[0], [event])) : 9649 (o.helper === "clone" ? 9650 this.element.clone().removeAttr("id") : 9651 this.element); 9652 9653 if (!helper.parents("body").length) { 9654 helper.appendTo((o.appendTo === "parent" ? 9655 this.element[0].parentNode : 9656 o.appendTo)); 9657 } 9658 9659 // Http://bugs.jqueryui.com/ticket/9446 9660 // a helper function can return the original element
vendor: 22,211 bytes, lines 9661-10338
9661 // which wouldn't have been set to relative in _create 9662 if (helperIsFunction && helper[0] === this.element[0]) { 9663 this._setPositionRelative(); 9664 } 9665 9666 if (helper[0] !== this.element[0] && 9667 !(/(fixed|absolute)/).test(helper.css("position"))) { 9668 helper.css("position", "absolute"); 9669 } 9670 9671 return helper; 9672 }, 9673 9674 _setPositionRelative: function () { 9675 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 9676 this.element[0].style.position = "relative"; 9677 } 9678 }, 9679 9680 _adjustOffsetFromHelper: function (obj) { 9681 if (typeof obj === "string") { 9682 obj = obj.split(" "); 9683 } 9684 if ($.isArray(obj)) { 9685 obj = { left: +obj[0], top: +obj[1] || 0 }; 9686 } 9687 if ("left" in obj) { 9688 this.offset.click.left = obj.left + this.margins.left; 9689 } 9690 if ("right" in obj) { 9691 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 9692 } 9693 if ("top" in obj) { 9694 this.offset.click.top = obj.top + this.margins.top; 9695 } 9696 if ("bottom" in obj) { 9697 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 9698 } 9699 }, 9700 9701 _isRootNode: function (element) { 9702 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 9703 }, 9704 9705 _getParentOffset: function () { 9706 //Get the offsetParent and cache its position 9707 var po = this.offsetParent.offset(), 9708 document = this.document[0]; 9709 9710 // This is a special case where we need to modify a offset calculated on start, since the 9711 // following happened: 9712 // 1. The position of the helper is absolute, so it's position is calculated based on the 9713 // next positioned parent 9714 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 9715 // the document, which means that the scroll is included in the initial calculation of the 9716 // offset of the parent, and never recalculated upon drag 9717 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 9718 $.contains(this.scrollParent[0], this.offsetParent[0])) { 9719 po.left += this.scrollParent.scrollLeft(); 9720 po.top += this.scrollParent.scrollTop(); 9721 } 9722 9723 if (this._isRootNode(this.offsetParent[0])) { 9724 po = { top: 0, left: 0 }; 9725 } 9726 9727 return { 9728 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 9729 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 9730 }; 9731 }, 9732 9733 _getRelativeOffset: function () { 9734 if (this.cssPosition !== "relative") { 9735 return { top: 0, left: 0 }; 9736 } 9737 9738 var p = this.element.position(), 9739 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 9740 9741 return { 9742 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 9743 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 9744 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 9745 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 9746 }; 9747 }, 9748 9749 _cacheMargins: function () { 9750 this.margins = { 9751 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 9752 top: (parseInt(this.element.css("marginTop"), 10) || 0), 9753 right: (parseInt(this.element.css("marginRight"), 10) || 0), 9754 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 9755 }; 9756 }, 9757 9758 _cacheHelperProportions: function () { 9759 this.helperProportions = { 9760 width: this.helper.outerWidth(), 9761 height: this.helper.outerHeight() 9762 }; 9763 }, 9764 9765 _setContainment: function () { 9766 var isUserScrollable, c, ce, 9767 o = this.options, 9768 document = this.document[0]; 9769 9770 this.relativeContainer = null; 9771 9772 if (!o.containment) { 9773 this.containment = null; 9774 return; 9775 } 9776 9777 if (o.containment === "window") { 9778 this.containment = [ 9779 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 9780 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 9781 $(window).scrollLeft() + $(window).width() - 9782 this.helperProportions.width - this.margins.left, 9783 $(window).scrollTop() + 9784 ($(window).height() || document.body.parentNode.scrollHeight) - 9785 this.helperProportions.height - this.margins.top 9786 ]; 9787 return; 9788 } 9789 9790 if (o.containment === "document") { 9791 this.containment = [ 9792 0, 9793 0, 9794 $(document).width() - this.helperProportions.width - this.margins.left, 9795 ($(document).height() || document.body.parentNode.scrollHeight) - 9796 this.helperProportions.height - this.margins.top 9797 ]; 9798 return; 9799 } 9800 9801 if (o.containment.constructor === Array) { 9802 this.containment = o.containment; 9803 return; 9804 } 9805 9806 if (o.containment === "parent") { 9807 o.containment = this.helper[0].parentNode; 9808 } 9809 9810 c = $(o.containment); 9811 ce = c[0]; 9812 9813 if (!ce) { 9814 return; 9815 } 9816 9817 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 9818 9819 this.containment = [ 9820 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 9821 (parseInt(c.css("paddingLeft"), 10) || 0), 9822 (parseInt(c.css("borderTopWidth"), 10) || 0) + 9823 (parseInt(c.css("paddingTop"), 10) || 0), 9824 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 9825 (parseInt(c.css("borderRightWidth"), 10) || 0) - 9826 (parseInt(c.css("paddingRight"), 10) || 0) - 9827 this.helperProportions.width - 9828 this.margins.left - 9829 this.margins.right, 9830 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 9831 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 9832 (parseInt(c.css("paddingBottom"), 10) || 0) - 9833 this.helperProportions.height - 9834 this.margins.top - 9835 this.margins.bottom 9836 ]; 9837 this.relativeContainer = c; 9838 }, 9839 9840 _convertPositionTo: function (d, pos) { 9841 if (!pos) { 9842 pos = this.position; 9843 } 9844 9845 var mod = d === "absolute" ? 1 : -1, 9846 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 9847 9848 return { 9849 top: ( 9850 9851 // The absolute mouse position 9852 pos.top + 9853 9854 // Only for relative positioned nodes: Relative offset from element to offset parent 9855 this.offset.relative.top * mod + 9856 9857 // The offsetParent's offset without borders (offset + border) 9858 this.offset.parent.top * mod - 9859 ((this.cssPosition === "fixed" ? 9860 -this.offset.scroll.top : 9861 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 9862 ), 9863 left: ( 9864 9865 // The absolute mouse position 9866 pos.left + 9867 9868 // Only for relative positioned nodes: Relative offset from element to offset parent 9869 this.offset.relative.left * mod + 9870 9871 // The offsetParent's offset without borders (offset + border) 9872 this.offset.parent.left * mod - 9873 ((this.cssPosition === "fixed" ? 9874 -this.offset.scroll.left : 9875 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 9876 ) 9877 }; 9878 }, 9879 9880 _generatePosition: function (event, constrainPosition) { 9881 var containment, co, top, left, 9882 o = this.options, 9883 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 9884 pageX = event.pageX, 9885 pageY = event.pageY; 9886 9887 // Cache the scroll 9888 if (!scrollIsRootNode || !this.offset.scroll) { 9889 this.offset.scroll = { 9890 top: this.scrollParent.scrollTop(), 9891 left: this.scrollParent.scrollLeft() 9892 }; 9893 } 9894 9895 /* 9896 * - Position constraining - 9897 * Constrain the position to a mix of grid, containment. 9898 */ 9899 9900 // If we are not dragging yet, we won't check for options 9901 if (constrainPosition) { 9902 if (this.containment) { 9903 if (this.relativeContainer) { 9904 co = this.relativeContainer.offset(); 9905 containment = [ 9906 this.containment[0] + co.left, 9907 this.containment[1] + co.top, 9908 this.containment[2] + co.left, 9909 this.containment[3] + co.top 9910 ]; 9911 } else { 9912 containment = this.containment; 9913 } 9914 9915 if (event.pageX - this.offset.click.left < containment[0]) { 9916 pageX = containment[0] + this.offset.click.left; 9917 } 9918 if (event.pageY - this.offset.click.top < containment[1]) { 9919 pageY = containment[1] + this.offset.click.top; 9920 } 9921 if (event.pageX - this.offset.click.left > containment[2]) { 9922 pageX = containment[2] + this.offset.click.left; 9923 } 9924 if (event.pageY - this.offset.click.top > containment[3]) { 9925 pageY = containment[3] + this.offset.click.top; 9926 } 9927 } 9928 9929 if (o.grid) { 9930 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 9931 // argument errors in IE (see ticket #6950) 9932 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 9933 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 9934 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 9935 top - this.offset.click.top > containment[3]) ? 9936 top : 9937 ((top - this.offset.click.top >= containment[1]) ? 9938 top - o.grid[1] : top + o.grid[1])) : top; 9939 9940 left = o.grid[0] ? this.originalPageX + 9941 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 9942 this.originalPageX; 9943 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 9944 left - this.offset.click.left > containment[2]) ? 9945 left : 9946 ((left - this.offset.click.left >= containment[0]) ? 9947 left - o.grid[0] : left + o.grid[0])) : left; 9948 } 9949 9950 if (o.axis === "y") { 9951 pageX = this.originalPageX; 9952 } 9953 9954 if (o.axis === "x") { 9955 pageY = this.originalPageY; 9956 } 9957 } 9958 9959 return { 9960 top: ( 9961 9962 // The absolute mouse position 9963 pageY - 9964 9965 // Click offset (relative to the element) 9966 this.offset.click.top - 9967 9968 // Only for relative positioned nodes: Relative offset from element to offset parent 9969 this.offset.relative.top - 9970 9971 // The offsetParent's offset without borders (offset + border) 9972 this.offset.parent.top + 9973 (this.cssPosition === "fixed" ? 9974 -this.offset.scroll.top : 9975 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 9976 ), 9977 left: ( 9978 9979 // The absolute mouse position 9980 pageX - 9981 9982 // Click offset (relative to the element) 9983 this.offset.click.left - 9984 9985 // Only for relative positioned nodes: Relative offset from element to offset parent 9986 this.offset.relative.left - 9987 9988 // The offsetParent's offset without borders (offset + border) 9989 this.offset.parent.left + 9990 (this.cssPosition === "fixed" ? 9991 -this.offset.scroll.left : 9992 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 9993 ) 9994 }; 9995 }, 9996 9997 _clear: function () { 9998 this._removeClass(this.helper, "ui-draggable-dragging"); 9999 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 10000 this.helper.remove(); 10001 } 10002 this.helper = null; 10003 this.cancelHelperRemoval = false; 10004 if (this.destroyOnClear) { 10005 this.destroy(); 10006 } 10007 }, 10008 10009 // From now on bulk stuff - mainly helpers 10010 10011 _trigger: function (type, event, ui) { 10012 ui = ui || this._uiHash(); 10013 $.ui.plugin.call(this, type, [event, ui, this], true); 10014 10015 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 10016 if (/^(drag|start|stop)/.test(type)) { 10017 this.positionAbs = this._convertPositionTo("absolute"); 10018 ui.offset = this.positionAbs; 10019 } 10020 return $.Widget.prototype._trigger.call(this, type, event, ui); 10021 }, 10022 10023 plugins: {}, 10024 10025 _uiHash: function () { 10026 return { 10027 helper: this.helper, 10028 position: this.position, 10029 originalPosition: this.originalPosition, 10030 offset: this.positionAbs 10031 }; 10032 } 10033 }); 10034 10035 $.ui.plugin.add("draggable", "connectToSortable", { 10036 start: function (event, ui, draggable) { 10037 var uiSortable = $.extend({}, ui, { 10038 item: draggable.element 10039 }); 10040 10041 draggable.sortables = []; 10042 $(draggable.options.connectToSortable).each(function () { 10043 var sortable = $(this).sortable("instance"); 10044 10045 if (sortable && !sortable.options.disabled) { 10046 draggable.sortables.push(sortable); 10047 10048 // RefreshPositions is called at drag start to refresh the containerCache 10049 // which is used in drag. This ensures it's initialized and synchronized 10050 // with any changes that might have happened on the page since initialization. 10051 sortable.refreshPositions(); 10052 sortable._trigger("activate", event, uiSortable); 10053 } 10054 }); 10055 }, 10056 stop: function (event, ui, draggable) { 10057 var uiSortable = $.extend({}, ui, { 10058 item: draggable.element 10059 }); 10060 10061 draggable.cancelHelperRemoval = false; 10062 10063 $.each(draggable.sortables, function () { 10064 var sortable = this; 10065 10066 if (sortable.isOver) { 10067 sortable.isOver = 0; 10068 10069 // Allow this sortable to handle removing the helper 10070 draggable.cancelHelperRemoval = true; 10071 sortable.cancelHelperRemoval = false; 10072 10073 // Use _storedCSS To restore properties in the sortable, 10074 // as this also handles revert (#9675) since the draggable 10075 // may have modified them in unexpected ways (#8809) 10076 sortable._storedCSS = { 10077 position: sortable.placeholder.css("position"), 10078 top: sortable.placeholder.css("top"), 10079 left: sortable.placeholder.css("left") 10080 }; 10081 10082 sortable._mouseStop(event); 10083 10084 // Once drag has ended, the sortable should return to using 10085 // its original helper, not the shared helper from draggable 10086 sortable.options.helper = sortable.options._helper; 10087 } else { 10088 // Prevent this Sortable from removing the helper. 10089 // However, don't set the draggable to remove the helper 10090 // either as another connected Sortable may yet handle the removal. 10091 sortable.cancelHelperRemoval = true; 10092 10093 sortable._trigger("deactivate", event, uiSortable); 10094 } 10095 }); 10096 }, 10097 drag: function (event, ui, draggable) { 10098 $.each(draggable.sortables, function () { 10099 var innermostIntersecting = false, 10100 sortable = this; 10101 10102 // Copy over variables that sortable's _intersectsWith uses 10103 sortable.positionAbs = draggable.positionAbs; 10104 sortable.helperProportions = draggable.helperProportions; 10105 sortable.offset.click = draggable.offset.click; 10106 10107 if (sortable._intersectsWith(sortable.containerCache)) { 10108 innermostIntersecting = true; 10109 10110 $.each(draggable.sortables, function () { 10111 // Copy over variables that sortable's _intersectsWith uses 10112 this.positionAbs = draggable.positionAbs; 10113 this.helperProportions = draggable.helperProportions; 10114 this.offset.click = draggable.offset.click; 10115 10116 if (this !== sortable && 10117 this._intersectsWith(this.containerCache) && 10118 $.contains(sortable.element[0], this.element[0])) { 10119 innermostIntersecting = false; 10120 } 10121 10122 return innermostIntersecting; 10123 }); 10124 } 10125 10126 if (innermostIntersecting) { 10127 // If it intersects, we use a little isOver variable and set it once, 10128 // so that the move-in stuff gets fired only once. 10129 if (!sortable.isOver) { 10130 sortable.isOver = 1; 10131 10132 // Store draggable's parent in case we need to reappend to it later. 10133 draggable._parent = ui.helper.parent(); 10134 10135 sortable.currentItem = ui.helper 10136 .appendTo(sortable.element) 10137 .data("ui-sortable-item", true); 10138 10139 // Store helper option to later restore it 10140 sortable.options._helper = sortable.options.helper; 10141 10142 sortable.options.helper = function () { 10143 return ui.helper[0]; 10144 }; 10145 10146 // Fire the start events of the sortable with our passed browser event, 10147 // and our own helper (so it doesn't create a new one) 10148 event.target = sortable.currentItem[0]; 10149 sortable._mouseCapture(event, true); 10150 sortable._mouseStart(event, true, true); 10151 10152 // Because the browser event is way off the new appended portlet, 10153 // modify necessary variables to reflect the changes 10154 sortable.offset.click.top = draggable.offset.click.top; 10155 sortable.offset.click.left = draggable.offset.click.left; 10156 sortable.offset.parent.left -= draggable.offset.parent.left - 10157 sortable.offset.parent.left; 10158 sortable.offset.parent.top -= draggable.offset.parent.top - 10159 sortable.offset.parent.top; 10160 10161 draggable._trigger("toSortable", event); 10162 10163 // Inform draggable that the helper is in a valid drop zone, 10164 // used solely in the revert option to handle "valid/invalid". 10165 draggable.dropped = sortable.element; 10166 10167 // Need to refreshPositions of all sortables in the case that 10168 // adding to one sortable changes the location of the other sortables (#9675) 10169 $.each(draggable.sortables, function () { 10170 this.refreshPositions(); 10171 }); 10172 10173 // Hack so receive/update callbacks work (mostly) 10174 draggable.currentItem = draggable.element; 10175 sortable.fromOutside = draggable; 10176 } 10177 10178 if (sortable.currentItem) { 10179 sortable._mouseDrag(event); 10180 10181 // Copy the sortable's position because the draggable's can potentially reflect 10182 // a relative position, while sortable is always absolute, which the dragged 10183 // element has now become. (#8809) 10184 ui.position = sortable.position; 10185 } 10186 } else { 10187 // If it doesn't intersect with the sortable, and it intersected before, 10188 // we fake the drag stop of the sortable, but make sure it doesn't remove 10189 // the helper by using cancelHelperRemoval. 10190 if (sortable.isOver) { 10191 sortable.isOver = 0; 10192 sortable.cancelHelperRemoval = true; 10193 10194 // Calling sortable's mouseStop would trigger a revert, 10195 // so revert must be temporarily false until after mouseStop is called. 10196 sortable.options._revert = sortable.options.revert; 10197 sortable.options.revert = false; 10198 10199 sortable._trigger("out", event, sortable._uiHash(sortable)); 10200 sortable._mouseStop(event, true); 10201 10202 // Restore sortable behaviors that were modfied 10203 // when the draggable entered the sortable area (#9481) 10204 sortable.options.revert = sortable.options._revert; 10205 sortable.options.helper = sortable.options._helper; 10206 10207 if (sortable.placeholder) { 10208 sortable.placeholder.remove(); 10209 } 10210 10211 // Restore and recalculate the draggable's offset considering the sortable 10212 // may have modified them in unexpected ways. (#8809, #10669) 10213 ui.helper.appendTo(draggable._parent); 10214 draggable._refreshOffsets(event); 10215 ui.position = draggable._generatePosition(event, true); 10216 10217 draggable._trigger("fromSortable", event); 10218 10219 // Inform draggable that the helper is no longer in a valid drop zone 10220 draggable.dropped = false; 10221 10222 // Need to refreshPositions of all sortables just in case removing 10223 // from one sortable changes the location of other sortables (#9675) 10224 $.each(draggable.sortables, function () { 10225 this.refreshPositions(); 10226 }); 10227 } 10228 } 10229 }); 10230 } 10231 }); 10232 10233 $.ui.plugin.add("draggable", "cursor", { 10234 start: function (event, ui, instance) { 10235 var t = $("body"), 10236 o = instance.options; 10237 10238 if (t.css("cursor")) { 10239 o._cursor = t.css("cursor"); 10240 } 10241 t.css("cursor", o.cursor); 10242 }, 10243 stop: function (event, ui, instance) { 10244 var o = instance.options; 10245 if (o._cursor) { 10246 $("body").css("cursor", o._cursor); 10247 } 10248 } 10249 }); 10250 10251 $.ui.plugin.add("draggable", "opacity", { 10252 start: function (event, ui, instance) { 10253 var t = $(ui.helper), 10254 o = instance.options; 10255 if (t.css("opacity")) { 10256 o._opacity = t.css("opacity"); 10257 } 10258 t.css("opacity", o.opacity); 10259 }, 10260 stop: function (event, ui, instance) { 10261 var o = instance.options; 10262 if (o._opacity) { 10263 $(ui.helper).css("opacity", o._opacity); 10264 } 10265 } 10266 }); 10267 10268 $.ui.plugin.add("draggable", "scroll", { 10269 start: function (event, ui, i) { 10270 if (!i.scrollParentNotHidden) { 10271 i.scrollParentNotHidden = i.helper.scrollParent(false); 10272 } 10273 10274 if (i.scrollParentNotHidden[0] !== i.document[0] && 10275 i.scrollParentNotHidden[0].tagName !== "HTML") { 10276 i.overflowOffset = i.scrollParentNotHidden.offset(); 10277 } 10278 }, 10279 drag: function (event, ui, i) { 10280 var o = i.options, 10281 scrolled = false, 10282 scrollParent = i.scrollParentNotHidden[0], 10283 document = i.document[0]; 10284 10285 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 10286 if (!o.axis || o.axis !== "x") { 10287 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 10288 o.scrollSensitivity) { 10289 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 10290 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 10291 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 10292 } 10293 } 10294 10295 if (!o.axis || o.axis !== "y") { 10296 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 10297 o.scrollSensitivity) { 10298 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 10299 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 10300 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 10301 } 10302 } 10303 } else { 10304 if (!o.axis || o.axis !== "x") { 10305 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 10306 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 10307 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 10308 o.scrollSensitivity) { 10309 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 10310 } 10311 } 10312 10313 if (!o.axis || o.axis !== "y") { 10314 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 10315 scrolled = $(document).scrollLeft( 10316 $(document).scrollLeft() - o.scrollSpeed 10317 ); 10318 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 10319 o.scrollSensitivity) { 10320 scrolled = $(document).scrollLeft( 10321 $(document).scrollLeft() + o.scrollSpeed 10322 ); 10323 } 10324 } 10325 } 10326 10327 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 10328 $.ui.ddmanager.prepareOffsets(i, event); 10329 } 10330 } 10331 }); 10332 10333 $.ui.plugin.add("draggable", "snap", { 10334 start: function (event, ui, i) { 10335 var o = i.options; 10336 10337 i.snapElements = []; 10338
vendor: 4,395 bytes, lines 10339-10500
10339 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 10340 .each(function () { 10341 var $t = $(this), 10342 $o = $t.offset(); 10343 if (this !== i.element[0]) { 10344 i.snapElements.push({ 10345 item: this, 10346 width: $t.outerWidth(), height: $t.outerHeight(), 10347 top: $o.top, left: $o.left 10348 }); 10349 } 10350 }); 10351 }, 10352 drag: function (event, ui, inst) { 10353 var ts, bs, ls, rs, l, r, t, b, i, first, 10354 o = inst.options, 10355 d = o.snapTolerance, 10356 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 10357 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 10358 10359 for (i = inst.snapElements.length - 1; i >= 0; i--) { 10360 l = inst.snapElements[i].left - inst.margins.left; 10361 r = l + inst.snapElements[i].width; 10362 t = inst.snapElements[i].top - inst.margins.top; 10363 b = t + inst.snapElements[i].height; 10364 10365 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 10366 !$.contains(inst.snapElements[i].item.ownerDocument, 10367 inst.snapElements[i].item)) { 10368 if (inst.snapElements[i].snapping) { 10369 (inst.options.snap.release && 10370 inst.options.snap.release.call( 10371 inst.element, 10372 event, 10373 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 10374 )); 10375 } 10376 inst.snapElements[i].snapping = false; 10377 continue; 10378 } 10379 10380 if (o.snapMode !== "inner") { 10381 ts = Math.abs(t - y2) <= d; 10382 bs = Math.abs(b - y1) <= d; 10383 ls = Math.abs(l - x2) <= d; 10384 rs = Math.abs(r - x1) <= d; 10385 if (ts) { 10386 ui.position.top = inst._convertPositionTo("relative", { 10387 top: t - inst.helperProportions.height, 10388 left: 0 10389 }).top; 10390 } 10391 if (bs) { 10392 ui.position.top = inst._convertPositionTo("relative", { 10393 top: b, 10394 left: 0 10395 }).top; 10396 } 10397 if (ls) { 10398 ui.position.left = inst._convertPositionTo("relative", { 10399 top: 0, 10400 left: l - inst.helperProportions.width 10401 }).left; 10402 } 10403 if (rs) { 10404 ui.position.left = inst._convertPositionTo("relative", { 10405 top: 0, 10406 left: r 10407 }).left; 10408 } 10409 } 10410 10411 first = (ts || bs || ls || rs); 10412 10413 if (o.snapMode !== "outer") { 10414 ts = Math.abs(t - y1) <= d; 10415 bs = Math.abs(b - y2) <= d; 10416 ls = Math.abs(l - x1) <= d; 10417 rs = Math.abs(r - x2) <= d; 10418 if (ts) { 10419 ui.position.top = inst._convertPositionTo("relative", { 10420 top: t, 10421 left: 0 10422 }).top; 10423 } 10424 if (bs) { 10425 ui.position.top = inst._convertPositionTo("relative", { 10426 top: b - inst.helperProportions.height, 10427 left: 0 10428 }).top; 10429 } 10430 if (ls) { 10431 ui.position.left = inst._convertPositionTo("relative", { 10432 top: 0, 10433 left: l 10434 }).left; 10435 } 10436 if (rs) { 10437 ui.position.left = inst._convertPositionTo("relative", { 10438 top: 0, 10439 left: r - inst.helperProportions.width 10440 }).left; 10441 } 10442 } 10443 10444 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 10445 (inst.options.snap.snap && 10446 inst.options.snap.snap.call( 10447 inst.element, 10448 event, 10449 $.extend(inst._uiHash(), { 10450 snapItem: inst.snapElements[i].item 10451 }))); 10452 } 10453 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 10454 } 10455 } 10456 }); 10457 10458 $.ui.plugin.add("draggable", "stack", { 10459 start: function (event, ui, instance) { 10460 var min, 10461 o = instance.options, 10462 group = $.makeArray($(o.stack)).sort(function (a, b) { 10463 return (parseInt($(a).css("zIndex"), 10) || 0) - 10464 (parseInt($(b).css("zIndex"), 10) || 0); 10465 }); 10466 10467 if (!group.length) { return; } 10468 10469 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 10470 $(group).each(function (i) { 10471 $(this).css("zIndex", min + i); 10472 }); 10473 this.css("zIndex", (min + group.length)); 10474 } 10475 }); 10476 10477 $.ui.plugin.add("draggable", "zIndex", { 10478 start: function (event, ui, instance) { 10479 var t = $(ui.helper), 10480 o = instance.options; 10481 10482 if (t.css("zIndex")) { 10483 o._zIndex = t.css("zIndex"); 10484 } 10485 t.css("zIndex", o.zIndex); 10486 }, 10487 stop: function (event, ui, instance) { 10488 var o = instance.options; 10489 10490 if (o._zIndex) { 10491 $(ui.helper).css("zIndex", o._zIndex); 10492 } 10493 } 10494 }); 10495 10496 var widgetsDraggable = $.ui.draggable; 10497 10498 /*! 10499 * jQuery UI Resizable 1.12.1 10500 * http://jqueryui.com
vendor: 27,105 bytes, lines 10501-11503
10501 * 10502 * Copyright jQuery Foundation and other contributors 10503 * Released under the MIT license. 10504 * http://jquery.org/license 10505 */ 10506 10507 //>>label: Resizable 10508 //>>group: Interactions 10509 //>>description: Enables resize functionality for any element. 10510 //>>docs: http://api.jqueryui.com/resizable/ 10511 //>>demos: http://jqueryui.com/resizable/ 10512 //>>css.structure: ../../themes/base/core.css 10513 //>>css.structure: ../../themes/base/resizable.css 10514 //>>css.theme: ../../themes/base/theme.css 10515 10516 $.widget("ui.resizable", $.ui.mouse, { 10517 version: "1.12.1", 10518 widgetEventPrefix: "resize", 10519 options: { 10520 alsoResize: false, 10521 animate: false, 10522 animateDuration: "slow", 10523 animateEasing: "swing", 10524 aspectRatio: false, 10525 autoHide: false, 10526 classes: { 10527 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 10528 }, 10529 containment: false, 10530 ghost: false, 10531 grid: false, 10532 handles: "e,s,se", 10533 helper: false, 10534 maxHeight: null, 10535 maxWidth: null, 10536 minHeight: 10, 10537 minWidth: 10, 10538 10539 // See #7960 10540 zIndex: 90, 10541 10542 // Callbacks 10543 resize: null, 10544 start: null, 10545 stop: null 10546 }, 10547 10548 _num: function (value) { 10549 return parseFloat(value) || 0; 10550 }, 10551 10552 _isNumber: function (value) { 10553 return !isNaN(parseFloat(value)); 10554 }, 10555 10556 _hasScroll: function (el, a) { 10557 if ($(el).css("overflow") === "hidden") { 10558 return false; 10559 } 10560 10561 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 10562 has = false; 10563 10564 if (el[scroll] > 0) { 10565 return true; 10566 } 10567 10568 // TODO: determine which cases actually cause this to happen 10569 // if the element doesn't have the scroll set, see if it's possible to 10570 // set the scroll 10571 el[scroll] = 1; 10572 has = (el[scroll] > 0); 10573 el[scroll] = 0; 10574 return has; 10575 }, 10576 10577 _create: function () { 10578 var margins, 10579 o = this.options, 10580 that = this; 10581 this._addClass("ui-resizable"); 10582 10583 $.extend(this, { 10584 _aspectRatio: !!(o.aspectRatio), 10585 aspectRatio: o.aspectRatio, 10586 originalElement: this.element, 10587 _proportionallyResizeElements: [], 10588 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 10589 }); 10590 10591 // Wrap the element if it cannot hold child nodes 10592 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 10593 this.element.wrap( 10594 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ 10595 position: this.element.css("position"), 10596 width: this.element.outerWidth(), 10597 height: this.element.outerHeight(), 10598 top: this.element.css("top"), 10599 left: this.element.css("left") 10600 }) 10601 ); 10602 10603 this.element = this.element.parent().data( 10604 "ui-resizable", this.element.resizable("instance") 10605 ); 10606 10607 this.elementIsWrapper = true; 10608 10609 margins = { 10610 marginTop: this.originalElement.css("marginTop"), 10611 marginRight: this.originalElement.css("marginRight"), 10612 marginBottom: this.originalElement.css("marginBottom"), 10613 marginLeft: this.originalElement.css("marginLeft") 10614 }; 10615 10616 this.element.css(margins); 10617 this.originalElement.css("margin", 0); 10618 10619 // support: Safari 10620 // Prevent Safari textarea resize 10621 this.originalResizeStyle = this.originalElement.css("resize"); 10622 this.originalElement.css("resize", "none"); 10623 10624 this._proportionallyResizeElements.push(this.originalElement.css({ 10625 position: "static", 10626 zoom: 1, 10627 display: "block" 10628 })); 10629 10630 // Support: IE9 10631 // avoid IE jump (hard set the margin) 10632 this.originalElement.css(margins); 10633 10634 this._proportionallyResize(); 10635 } 10636 10637 this._setupHandles(); 10638 10639 if (o.autoHide) { 10640 $(this.element) 10641 .on("mouseenter", function () { 10642 if (o.disabled) { 10643 return; 10644 } 10645 that._removeClass("ui-resizable-autohide"); 10646 that._handles.show(); 10647 }) 10648 .on("mouseleave", function () { 10649 if (o.disabled) { 10650 return; 10651 } 10652 if (!that.resizing) { 10653 that._addClass("ui-resizable-autohide"); 10654 that._handles.hide(); 10655 } 10656 }); 10657 } 10658 10659 this._mouseInit(); 10660 }, 10661 10662 _destroy: function () { 10663 this._mouseDestroy(); 10664 10665 var wrapper, 10666 _destroy = function (exp) { 10667 $(exp) 10668 .removeData("resizable") 10669 .removeData("ui-resizable") 10670 .off(".resizable") 10671 .find(".ui-resizable-handle") 10672 .remove(); 10673 }; 10674 10675 // TODO: Unwrap at same DOM position 10676 if (this.elementIsWrapper) { 10677 _destroy(this.element); 10678 wrapper = this.element; 10679 this.originalElement.css({ 10680 position: wrapper.css("position"), 10681 width: wrapper.outerWidth(), 10682 height: wrapper.outerHeight(), 10683 top: wrapper.css("top"), 10684 left: wrapper.css("left") 10685 }).insertAfter(wrapper); 10686 wrapper.remove(); 10687 } 10688 10689 this.originalElement.css("resize", this.originalResizeStyle); 10690 _destroy(this.originalElement); 10691 10692 return this; 10693 }, 10694 10695 _setOption: function (key, value) { 10696 this._super(key, value); 10697 10698 switch (key) { 10699 case "handles": 10700 this._removeHandles(); 10701 this._setupHandles(); 10702 break; 10703 default: 10704 break; 10705 } 10706 }, 10707 10708 _setupHandles: function () { 10709 var o = this.options, handle, i, n, hname, axis, that = this; 10710 this.handles = o.handles || 10711 (!$(".ui-resizable-handle", this.element).length ? 10712 "e,s,se" : { 10713 n: ".ui-resizable-n", 10714 e: ".ui-resizable-e", 10715 s: ".ui-resizable-s", 10716 w: ".ui-resizable-w", 10717 se: ".ui-resizable-se", 10718 sw: ".ui-resizable-sw", 10719 ne: ".ui-resizable-ne", 10720 nw: ".ui-resizable-nw" 10721 }); 10722 10723 this._handles = $(); 10724 if (this.handles.constructor === String) { 10725 if (this.handles === "all") { 10726 this.handles = "n,e,s,w,se,sw,ne,nw"; 10727 } 10728 10729 n = this.handles.split(","); 10730 this.handles = {}; 10731 10732 for (i = 0; i < n.length; i++) { 10733 handle = $.trim(n[i]); 10734 hname = "ui-resizable-" + handle; 10735 axis = $("<div>"); 10736 this._addClass(axis, "ui-resizable-handle " + hname); 10737 10738 axis.css({ zIndex: o.zIndex }); 10739 10740 this.handles[handle] = ".ui-resizable-" + handle; 10741 this.element.append(axis); 10742 } 10743 } 10744 10745 this._renderAxis = function (target) { 10746 var i, axis, padPos, padWrapper; 10747 10748 target = target || this.element; 10749 10750 for (i in this.handles) { 10751 if (this.handles[i].constructor === String) { 10752 this.handles[i] = this.element.children(this.handles[i]).first().show(); 10753 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 10754 this.handles[i] = $(this.handles[i]); 10755 this._on(this.handles[i], { "mousedown": that._mouseDown }); 10756 } 10757 10758 if (this.elementIsWrapper && 10759 this.originalElement[0] 10760 .nodeName 10761 .match(/^(textarea|input|select|button)$/i)) { 10762 axis = $(this.handles[i], this.element); 10763 10764 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 10765 axis.outerHeight() : 10766 axis.outerWidth(); 10767 10768 padPos = ["padding", 10769 /ne|nw|n/.test(i) ? "Top" : 10770 /se|sw|s/.test(i) ? "Bottom" : 10771 /^e$/.test(i) ? "Right" : "Left"].join(""); 10772 10773 target.css(padPos, padWrapper); 10774 10775 this._proportionallyResize(); 10776 } 10777 10778 this._handles = this._handles.add(this.handles[i]); 10779 } 10780 }; 10781 10782 // TODO: make renderAxis a prototype function 10783 this._renderAxis(this.element); 10784 10785 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 10786 this._handles.disableSelection(); 10787 10788 this._handles.on("mouseover", function () { 10789 if (!that.resizing) { 10790 if (this.className) { 10791 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 10792 } 10793 that.axis = axis && axis[1] ? axis[1] : "se"; 10794 } 10795 }); 10796 10797 if (o.autoHide) { 10798 this._handles.hide(); 10799 this._addClass("ui-resizable-autohide"); 10800 } 10801 }, 10802 10803 _removeHandles: function () { 10804 this._handles.remove(); 10805 }, 10806 10807 _mouseCapture: function (event) { 10808 var i, handle, 10809 capture = false; 10810 10811 for (i in this.handles) { 10812 handle = $(this.handles[i])[0]; 10813 if (handle === event.target || $.contains(handle, event.target)) { 10814 capture = true; 10815 } 10816 } 10817 10818 return !this.options.disabled && capture; 10819 }, 10820 10821 _mouseStart: function (event) { 10822 var curleft, curtop, cursor, 10823 o = this.options, 10824 el = this.element; 10825 10826 this.resizing = true; 10827 10828 this._renderProxy(); 10829 10830 curleft = this._num(this.helper.css("left")); 10831 curtop = this._num(this.helper.css("top")); 10832 10833 if (o.containment) { 10834 curleft += $(o.containment).scrollLeft() || 0; 10835 curtop += $(o.containment).scrollTop() || 0; 10836 } 10837 10838 this.offset = this.helper.offset(); 10839 this.position = { left: curleft, top: curtop }; 10840 10841 this.size = this._helper ? { 10842 width: this.helper.width(), 10843 height: this.helper.height() 10844 } : { 10845 width: el.width(), 10846 height: el.height() 10847 }; 10848 10849 this.originalSize = this._helper ? { 10850 width: el.outerWidth(), 10851 height: el.outerHeight() 10852 } : { 10853 width: el.width(), 10854 height: el.height() 10855 }; 10856 10857 this.sizeDiff = { 10858 width: el.outerWidth() - el.width(), 10859 height: el.outerHeight() - el.height() 10860 }; 10861 10862 this.originalPosition = { left: curleft, top: curtop }; 10863 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 10864 10865 this.aspectRatio = (typeof o.aspectRatio === "number") ? 10866 o.aspectRatio : 10867 ((this.originalSize.width / this.originalSize.height) || 1); 10868 10869 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 10870 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 10871 10872 this._addClass("ui-resizable-resizing"); 10873 this._propagate("start", event); 10874 return true; 10875 }, 10876 10877 _mouseDrag: function (event) { 10878 var data, props, 10879 smp = this.originalMousePosition, 10880 a = this.axis, 10881 dx = (event.pageX - smp.left) || 0, 10882 dy = (event.pageY - smp.top) || 0, 10883 trigger = this._change[a]; 10884 10885 this._updatePrevProperties(); 10886 10887 if (!trigger) { 10888 return false; 10889 } 10890 10891 data = trigger.apply(this, [event, dx, dy]); 10892 10893 this._updateVirtualBoundaries(event.shiftKey); 10894 if (this._aspectRatio || event.shiftKey) { 10895 data = this._updateRatio(data, event); 10896 } 10897 10898 data = this._respectSize(data, event); 10899 10900 this._updateCache(data); 10901 10902 this._propagate("resize", event); 10903 10904 props = this._applyChanges(); 10905 10906 if (!this._helper && this._proportionallyResizeElements.length) { 10907 this._proportionallyResize(); 10908 } 10909 10910 if (!$.isEmptyObject(props)) { 10911 this._updatePrevProperties(); 10912 this._trigger("resize", event, this.ui()); 10913 this._applyChanges(); 10914 } 10915 10916 return false; 10917 }, 10918 10919 _mouseStop: function (event) { 10920 this.resizing = false; 10921 var pr, ista, soffseth, soffsetw, s, left, top, 10922 o = this.options, that = this; 10923 10924 if (this._helper) { 10925 pr = this._proportionallyResizeElements; 10926 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 10927 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 10928 soffsetw = ista ? 0 : that.sizeDiff.width; 10929 10930 s = { 10931 width: (that.helper.width() - soffsetw), 10932 height: (that.helper.height() - soffseth) 10933 }; 10934 left = (parseFloat(that.element.css("left")) + 10935 (that.position.left - that.originalPosition.left)) || null; 10936 top = (parseFloat(that.element.css("top")) + 10937 (that.position.top - that.originalPosition.top)) || null; 10938 10939 if (!o.animate) { 10940 this.element.css($.extend(s, { top: top, left: left })); 10941 } 10942 10943 that.helper.height(that.size.height); 10944 that.helper.width(that.size.width); 10945 10946 if (this._helper && !o.animate) { 10947 this._proportionallyResize(); 10948 } 10949 } 10950 10951 $("body").css("cursor", "auto"); 10952 10953 this._removeClass("ui-resizable-resizing"); 10954 10955 this._propagate("stop", event); 10956 10957 if (this._helper) { 10958 this.helper.remove(); 10959 } 10960 10961 return false; 10962 }, 10963 10964 _updatePrevProperties: function () { 10965 this.prevPosition = { 10966 top: this.position.top, 10967 left: this.position.left 10968 }; 10969 this.prevSize = { 10970 width: this.size.width, 10971 height: this.size.height 10972 }; 10973 }, 10974 10975 _applyChanges: function () { 10976 var props = {}; 10977 10978 if (this.position.top !== this.prevPosition.top) { 10979 props.top = this.position.top + "px"; 10980 } 10981 if (this.position.left !== this.prevPosition.left) { 10982 props.left = this.position.left + "px"; 10983 } 10984 if (this.size.width !== this.prevSize.width) { 10985 props.width = this.size.width + "px"; 10986 } 10987 if (this.size.height !== this.prevSize.height) { 10988 props.height = this.size.height + "px"; 10989 } 10990 10991 this.helper.css(props); 10992 10993 return props; 10994 }, 10995 10996 _updateVirtualBoundaries: function (forceAspectRatio) { 10997 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 10998 o = this.options; 10999 11000 b = { 11001 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 11002 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 11003 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 11004 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 11005 }; 11006 11007 if (this._aspectRatio || forceAspectRatio) { 11008 pMinWidth = b.minHeight * this.aspectRatio; 11009 pMinHeight = b.minWidth / this.aspectRatio; 11010 pMaxWidth = b.maxHeight * this.aspectRatio; 11011 pMaxHeight = b.maxWidth / this.aspectRatio; 11012 11013 if (pMinWidth > b.minWidth) { 11014 b.minWidth = pMinWidth; 11015 } 11016 if (pMinHeight > b.minHeight) { 11017 b.minHeight = pMinHeight; 11018 } 11019 if (pMaxWidth < b.maxWidth) { 11020 b.maxWidth = pMaxWidth; 11021 } 11022 if (pMaxHeight < b.maxHeight) { 11023 b.maxHeight = pMaxHeight; 11024 } 11025 } 11026 this._vBoundaries = b; 11027 }, 11028 11029 _updateCache: function (data) { 11030 this.offset = this.helper.offset(); 11031 if (this._isNumber(data.left)) { 11032 this.position.left = data.left; 11033 } 11034 if (this._isNumber(data.top)) { 11035 this.position.top = data.top; 11036 } 11037 if (this._isNumber(data.height)) { 11038 this.size.height = data.height; 11039 } 11040 if (this._isNumber(data.width)) { 11041 this.size.width = data.width; 11042 } 11043 }, 11044 11045 _updateRatio: function (data) { 11046 var cpos = this.position, 11047 csize = this.size, 11048 a = this.axis; 11049 11050 if (this._isNumber(data.height)) { 11051 data.width = (data.height * this.aspectRatio); 11052 } else if (this._isNumber(data.width)) { 11053 data.height = (data.width / this.aspectRatio); 11054 } 11055 11056 if (a === "sw") { 11057 data.left = cpos.left + (csize.width - data.width); 11058 data.top = null; 11059 } 11060 if (a === "nw") { 11061 data.top = cpos.top + (csize.height - data.height); 11062 data.left = cpos.left + (csize.width - data.width); 11063 } 11064 11065 return data; 11066 }, 11067 11068 _respectSize: function (data) { 11069 var o = this._vBoundaries, 11070 a = this.axis, 11071 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 11072 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 11073 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 11074 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 11075 dw = this.originalPosition.left + this.originalSize.width, 11076 dh = this.originalPosition.top + this.originalSize.height, 11077 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 11078 if (isminw) { 11079 data.width = o.minWidth; 11080 } 11081 if (isminh) { 11082 data.height = o.minHeight; 11083 } 11084 if (ismaxw) { 11085 data.width = o.maxWidth; 11086 } 11087 if (ismaxh) { 11088 data.height = o.maxHeight; 11089 } 11090 11091 if (isminw && cw) { 11092 data.left = dw - o.minWidth; 11093 } 11094 if (ismaxw && cw) { 11095 data.left = dw - o.maxWidth; 11096 } 11097 if (isminh && ch) { 11098 data.top = dh - o.minHeight; 11099 } 11100 if (ismaxh && ch) { 11101 data.top = dh - o.maxHeight; 11102 } 11103 11104 // Fixing jump error on top/left - bug #2330 11105 if (!data.width && !data.height && !data.left && data.top) { 11106 data.top = null; 11107 } else if (!data.width && !data.height && !data.top && data.left) { 11108 data.left = null; 11109 } 11110 11111 return data; 11112 }, 11113 11114 _getPaddingPlusBorderDimensions: function (element) { 11115 var i = 0, 11116 widths = [], 11117 borders = [ 11118 element.css("borderTopWidth"), 11119 element.css("borderRightWidth"), 11120 element.css("borderBottomWidth"), 11121 element.css("borderLeftWidth") 11122 ], 11123 paddings = [ 11124 element.css("paddingTop"), 11125 element.css("paddingRight"), 11126 element.css("paddingBottom"), 11127 element.css("paddingLeft") 11128 ]; 11129 11130 for (; i < 4; i++) { 11131 widths[i] = (parseFloat(borders[i]) || 0); 11132 widths[i] += (parseFloat(paddings[i]) || 0); 11133 } 11134 11135 return { 11136 height: widths[0] + widths[2], 11137 width: widths[1] + widths[3] 11138 }; 11139 }, 11140 11141 _proportionallyResize: function () { 11142 if (!this._proportionallyResizeElements.length) { 11143 return; 11144 } 11145 11146 var prel, 11147 i = 0, 11148 element = this.helper || this.element; 11149 11150 for (; i < this._proportionallyResizeElements.length; i++) { 11151 prel = this._proportionallyResizeElements[i]; 11152 11153 // TODO: Seems like a bug to cache this.outerDimensions 11154 // considering that we are in a loop. 11155 if (!this.outerDimensions) { 11156 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 11157 } 11158 11159 prel.css({ 11160 height: (element.height() - this.outerDimensions.height) || 0, 11161 width: (element.width() - this.outerDimensions.width) || 0 11162 }); 11163 } 11164 }, 11165 11166 _renderProxy: function () { 11167 var el = this.element, o = this.options; 11168 this.elementOffset = el.offset(); 11169 11170 if (this._helper) { 11171 this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); 11172 11173 this._addClass(this.helper, this._helper); 11174 this.helper.css({ 11175 width: this.element.outerWidth(), 11176 height: this.element.outerHeight(), 11177 position: "absolute", 11178 left: this.elementOffset.left + "px", 11179 top: this.elementOffset.top + "px", 11180 zIndex: ++o.zIndex //TODO: Don't modify option 11181 }); 11182 11183 this.helper 11184 .appendTo("body") 11185 .disableSelection(); 11186 } else { 11187 this.helper = this.element; 11188 } 11189 }, 11190 11191 _change: { 11192 e: function (event, dx) { 11193 return { width: this.originalSize.width + dx }; 11194 }, 11195 w: function (event, dx) { 11196 var cs = this.originalSize, sp = this.originalPosition; 11197 return { left: sp.left + dx, width: cs.width - dx }; 11198 }, 11199 n: function (event, dx, dy) { 11200 var cs = this.originalSize, sp = this.originalPosition; 11201 return { top: sp.top + dy, height: cs.height - dy }; 11202 }, 11203 s: function (event, dx, dy) { 11204 return { height: this.originalSize.height + dy }; 11205 }, 11206 se: function (event, dx, dy) { 11207 return $.extend(this._change.s.apply(this, arguments), 11208 this._change.e.apply(this, [event, dx, dy])); 11209 }, 11210 sw: function (event, dx, dy) { 11211 return $.extend(this._change.s.apply(this, arguments), 11212 this._change.w.apply(this, [event, dx, dy])); 11213 }, 11214 ne: function (event, dx, dy) { 11215 return $.extend(this._change.n.apply(this, arguments), 11216 this._change.e.apply(this, [event, dx, dy])); 11217 }, 11218 nw: function (event, dx, dy) { 11219 return $.extend(this._change.n.apply(this, arguments), 11220 this._change.w.apply(this, [event, dx, dy])); 11221 } 11222 }, 11223 11224 _propagate: function (n, event) { 11225 $.ui.plugin.call(this, n, [event, this.ui()]); 11226 (n !== "resize" && this._trigger(n, event, this.ui())); 11227 }, 11228 11229 plugins: {}, 11230 11231 ui: function () { 11232 return { 11233 originalElement: this.originalElement, 11234 element: this.element, 11235 helper: this.helper, 11236 position: this.position, 11237 size: this.size, 11238 originalSize: this.originalSize, 11239 originalPosition: this.originalPosition 11240 }; 11241 } 11242 }); 11243 11244 /* 11245 * Resizable Extensions 11246 */ 11247 11248 $.ui.plugin.add("resizable", "animate", { 11249 stop: function (event) { 11250 var that = $(this).resizable("instance"), 11251 o = that.options, 11252 pr = that._proportionallyResizeElements, 11253 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 11254 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 11255 soffsetw = ista ? 0 : that.sizeDiff.width, 11256 style = { 11257 width: (that.size.width - soffsetw), 11258 height: (that.size.height - soffseth) 11259 }, 11260 left = (parseFloat(that.element.css("left")) + 11261 (that.position.left - that.originalPosition.left)) || null, 11262 top = (parseFloat(that.element.css("top")) + 11263 (that.position.top - that.originalPosition.top)) || null; 11264 11265 that.element.animate( 11266 $.extend(style, top && left ? { top: top, left: left } : {}), { 11267 duration: o.animateDuration, 11268 easing: o.animateEasing, 11269 step: function () { 11270 var data = { 11271 width: parseFloat(that.element.css("width")), 11272 height: parseFloat(that.element.css("height")), 11273 top: parseFloat(that.element.css("top")), 11274 left: parseFloat(that.element.css("left")) 11275 }; 11276 11277 if (pr && pr.length) { 11278 $(pr[0]).css({ width: data.width, height: data.height }); 11279 } 11280 11281 // Propagating resize, and updating values for each animation step 11282 that._updateCache(data); 11283 that._propagate("resize", event); 11284 } 11285 } 11286 ); 11287 } 11288 }); 11289 11290 $.ui.plugin.add("resizable", "containment", { 11291 start: function () { 11292 var element, p, co, ch, cw, width, height, 11293 that = $(this).resizable("instance"), 11294 o = that.options, 11295 el = that.element, 11296 oc = o.containment, 11297 ce = (oc instanceof $) ? 11298 oc.get(0) : 11299 (/parent/.test(oc)) ? el.parent().get(0) : oc; 11300 11301 if (!ce) { 11302 return; 11303 } 11304 11305 that.containerElement = $(ce); 11306 11307 if (/document/.test(oc) || oc === document) { 11308 that.containerOffset = { 11309 left: 0, 11310 top: 0 11311 }; 11312 that.containerPosition = { 11313 left: 0, 11314 top: 0 11315 }; 11316 11317 that.parentData = { 11318 element: $(document), 11319 left: 0, 11320 top: 0, 11321 width: $(document).width(), 11322 height: $(document).height() || document.body.parentNode.scrollHeight 11323 }; 11324 } else { 11325 element = $(ce); 11326 p = []; 11327 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 11328 p[i] = that._num(element.css("padding" + name)); 11329 }); 11330 11331 that.containerOffset = element.offset(); 11332 that.containerPosition = element.position(); 11333 that.containerSize = { 11334 height: (element.innerHeight() - p[3]), 11335 width: (element.innerWidth() - p[1]) 11336 }; 11337 11338 co = that.containerOffset; 11339 ch = that.containerSize.height; 11340 cw = that.containerSize.width; 11341 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 11342 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 11343 11344 that.parentData = { 11345 element: ce, 11346 left: co.left, 11347 top: co.top, 11348 width: width, 11349 height: height 11350 }; 11351 } 11352 }, 11353 11354 resize: function (event) { 11355 var woset, hoset, isParent, isOffsetRelative, 11356 that = $(this).resizable("instance"), 11357 o = that.options, 11358 co = that.containerOffset, 11359 cp = that.position, 11360 pRatio = that._aspectRatio || event.shiftKey, 11361 cop = { 11362 top: 0, 11363 left: 0 11364 }, 11365 ce = that.containerElement, 11366 continueResize = true; 11367 11368 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 11369 cop = co; 11370 } 11371 11372 if (cp.left < (that._helper ? co.left : 0)) { 11373 that.size.width = that.size.width + 11374 (that._helper ? 11375 (that.position.left - co.left) : 11376 (that.position.left - cop.left)); 11377 11378 if (pRatio) { 11379 that.size.height = that.size.width / that.aspectRatio; 11380 continueResize = false; 11381 } 11382 that.position.left = o.helper ? co.left : 0; 11383 } 11384 11385 if (cp.top < (that._helper ? co.top : 0)) { 11386 that.size.height = that.size.height + 11387 (that._helper ? 11388 (that.position.top - co.top) : 11389 that.position.top); 11390 11391 if (pRatio) { 11392 that.size.width = that.size.height * that.aspectRatio; 11393 continueResize = false; 11394 } 11395 that.position.top = that._helper ? co.top : 0; 11396 } 11397 11398 isParent = that.containerElement.get(0) === that.element.parent().get(0); 11399 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 11400 11401 if (isParent && isOffsetRelative) { 11402 that.offset.left = that.parentData.left + that.position.left; 11403 that.offset.top = that.parentData.top + that.position.top; 11404 } else { 11405 that.offset.left = that.element.offset().left; 11406 that.offset.top = that.element.offset().top; 11407 } 11408 11409 woset = Math.abs(that.sizeDiff.width + 11410 (that._helper ? 11411 that.offset.left - cop.left : 11412 (that.offset.left - co.left))); 11413 11414 hoset = Math.abs(that.sizeDiff.height + 11415 (that._helper ? 11416 that.offset.top - cop.top : 11417 (that.offset.top - co.top))); 11418 11419 if (woset + that.size.width >= that.parentData.width) { 11420 that.size.width = that.parentData.width - woset; 11421 if (pRatio) { 11422 that.size.height = that.size.width / that.aspectRatio; 11423 continueResize = false; 11424 } 11425 } 11426 11427 if (hoset + that.size.height >= that.parentData.height) { 11428 that.size.height = that.parentData.height - hoset; 11429 if (pRatio) { 11430 that.size.width = that.size.height * that.aspectRatio; 11431 continueResize = false; 11432 } 11433 } 11434 11435 if (!continueResize) { 11436 that.position.left = that.prevPosition.left; 11437 that.position.top = that.prevPosition.top; 11438 that.size.width = that.prevSize.width; 11439 that.size.height = that.prevSize.height; 11440 } 11441 }, 11442 11443 stop: function () { 11444 var that = $(this).resizable("instance"), 11445 o = that.options, 11446 co = that.containerOffset, 11447 cop = that.containerPosition, 11448 ce = that.containerElement, 11449 helper = $(that.helper), 11450 ho = helper.offset(), 11451 w = helper.outerWidth() - that.sizeDiff.width, 11452 h = helper.outerHeight() - that.sizeDiff.height; 11453 11454 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 11455 $(this).css({ 11456 left: ho.left - cop.left - co.left, 11457 width: w, 11458 height: h 11459 }); 11460 } 11461 11462 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 11463 $(this).css({ 11464 left: ho.left - cop.left - co.left, 11465 width: w, 11466 height: h 11467 }); 11468 } 11469 } 11470 }); 11471 11472 $.ui.plugin.add("resizable", "alsoResize", { 11473 start: function () { 11474 var that = $(this).resizable("instance"), 11475 o = that.options; 11476 11477 $(o.alsoResize).each(function () { 11478 var el = $(this); 11479 el.data("ui-resizable-alsoresize", { 11480 width: parseFloat(el.width()), height: parseFloat(el.height()), 11481 left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) 11482 }); 11483 }); 11484 }, 11485 11486 resize: function (event, ui) { 11487 var that = $(this).resizable("instance"), 11488 o = that.options, 11489 os = that.originalSize, 11490 op = that.originalPosition, 11491 delta = { 11492 height: (that.size.height - os.height) || 0, 11493 width: (that.size.width - os.width) || 0, 11494 top: (that.position.top - op.top) || 0, 11495 left: (that.position.left - op.left) || 0 11496 }; 11497 11498 $(o.alsoResize).each(function () { 11499 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 11500 css = el.parents(ui.originalElement[0]).length ? 11501 ["width", "height"] : 11502 ["width", "height", "top", "left"]; 11503
vendor: 7,124 bytes, lines 11504-11798
11504 $.each(css, function (i, prop) { 11505 var sum = (start[prop] || 0) + (delta[prop] || 0); 11506 if (sum && sum >= 0) { 11507 style[prop] = sum || null; 11508 } 11509 }); 11510 11511 el.css(style); 11512 }); 11513 }, 11514 11515 stop: function () { 11516 $(this).removeData("ui-resizable-alsoresize"); 11517 } 11518 }); 11519 11520 $.ui.plugin.add("resizable", "ghost", { 11521 start: function () { 11522 var that = $(this).resizable("instance"), cs = that.size; 11523 11524 that.ghost = that.originalElement.clone(); 11525 that.ghost.css({ 11526 opacity: 0.25, 11527 display: "block", 11528 position: "relative", 11529 height: cs.height, 11530 width: cs.width, 11531 margin: 0, 11532 left: 0, 11533 top: 0 11534 }); 11535 11536 that._addClass(that.ghost, "ui-resizable-ghost"); 11537 11538 // DEPRECATED 11539 // TODO: remove after 1.12 11540 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 11541 // Ghost option 11542 that.ghost.addClass(this.options.ghost); 11543 } 11544 11545 that.ghost.appendTo(that.helper); 11546 }, 11547 11548 resize: function () { 11549 var that = $(this).resizable("instance"); 11550 if (that.ghost) { 11551 that.ghost.css({ 11552 position: "relative", 11553 height: that.size.height, 11554 width: that.size.width 11555 }); 11556 } 11557 }, 11558 11559 stop: function () { 11560 var that = $(this).resizable("instance"); 11561 if (that.ghost && that.helper) { 11562 that.helper.get(0).removeChild(that.ghost.get(0)); 11563 } 11564 } 11565 }); 11566 11567 $.ui.plugin.add("resizable", "grid", { 11568 resize: function () { 11569 var outerDimensions, 11570 that = $(this).resizable("instance"), 11571 o = that.options, 11572 cs = that.size, 11573 os = that.originalSize, 11574 op = that.originalPosition, 11575 a = that.axis, 11576 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 11577 gridX = (grid[0] || 1), 11578 gridY = (grid[1] || 1), 11579 ox = Math.round((cs.width - os.width) / gridX) * gridX, 11580 oy = Math.round((cs.height - os.height) / gridY) * gridY, 11581 newWidth = os.width + ox, 11582 newHeight = os.height + oy, 11583 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 11584 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 11585 isMinWidth = o.minWidth && (o.minWidth > newWidth), 11586 isMinHeight = o.minHeight && (o.minHeight > newHeight); 11587 11588 o.grid = grid; 11589 11590 if (isMinWidth) { 11591 newWidth += gridX; 11592 } 11593 if (isMinHeight) { 11594 newHeight += gridY; 11595 } 11596 if (isMaxWidth) { 11597 newWidth -= gridX; 11598 } 11599 if (isMaxHeight) { 11600 newHeight -= gridY; 11601 } 11602 11603 if (/^(se|s|e)$/.test(a)) { 11604 that.size.width = newWidth; 11605 that.size.height = newHeight; 11606 } else if (/^(ne)$/.test(a)) { 11607 that.size.width = newWidth; 11608 that.size.height = newHeight; 11609 that.position.top = op.top - oy; 11610 } else if (/^(sw)$/.test(a)) { 11611 that.size.width = newWidth; 11612 that.size.height = newHeight; 11613 that.position.left = op.left - ox; 11614 } else { 11615 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 11616 outerDimensions = that._getPaddingPlusBorderDimensions(this); 11617 } 11618 11619 if (newHeight - gridY > 0) { 11620 that.size.height = newHeight; 11621 that.position.top = op.top - oy; 11622 } else { 11623 newHeight = gridY - outerDimensions.height; 11624 that.size.height = newHeight; 11625 that.position.top = op.top + os.height - newHeight; 11626 } 11627 if (newWidth - gridX > 0) { 11628 that.size.width = newWidth; 11629 that.position.left = op.left - ox; 11630 } else { 11631 newWidth = gridX - outerDimensions.width; 11632 that.size.width = newWidth; 11633 that.position.left = op.left + os.width - newWidth; 11634 } 11635 } 11636 } 11637 }); 11638 11639 var widgetsResizable = $.ui.resizable; 11640 11641 /*! 11642 * jQuery UI Dialog 1.12.1 11643 * http://jqueryui.com 11644 * 11645 * Copyright jQuery Foundation and other contributors 11646 * Released under the MIT license. 11647 * http://jquery.org/license 11648 */ 11649 11650 //>>label: Dialog 11651 //>>group: Widgets 11652 //>>description: Displays customizable dialog windows. 11653 //>>docs: http://api.jqueryui.com/dialog/ 11654 //>>demos: http://jqueryui.com/dialog/ 11655 //>>css.structure: ../../themes/base/core.css 11656 //>>css.structure: ../../themes/base/dialog.css 11657 //>>css.theme: ../../themes/base/theme.css 11658 11659 $.widget("ui.dialog", { 11660 version: "1.12.1", 11661 options: { 11662 appendTo: "body", 11663 autoOpen: true, 11664 buttons: [], 11665 classes: { 11666 "ui-dialog": "ui-corner-all", 11667 "ui-dialog-titlebar": "ui-corner-all" 11668 }, 11669 closeOnEscape: true, 11670 closeText: "Close", 11671 draggable: true, 11672 hide: null, 11673 height: "auto", 11674 maxHeight: null, 11675 maxWidth: null, 11676 minHeight: 150, 11677 minWidth: 150, 11678 modal: false, 11679 position: { 11680 my: "center", 11681 at: "center", 11682 of: window, 11683 collision: "fit", 11684 11685 // Ensure the titlebar is always visible 11686 using: function (pos) { 11687 var topOffset = $(this).css(pos).offset().top; 11688 if (topOffset < 0) { 11689 $(this).css("top", pos.top - topOffset); 11690 } 11691 } 11692 }, 11693 resizable: true, 11694 show: null, 11695 title: null, 11696 width: 300, 11697 11698 // Callbacks 11699 beforeClose: null, 11700 close: null, 11701 drag: null, 11702 dragStart: null, 11703 dragStop: null, 11704 focus: null, 11705 open: null, 11706 resize: null, 11707 resizeStart: null, 11708 resizeStop: null 11709 }, 11710 11711 sizeRelatedOptions: { 11712 buttons: true, 11713 height: true, 11714 maxHeight: true, 11715 maxWidth: true, 11716 minHeight: true, 11717 minWidth: true, 11718 width: true 11719 }, 11720 11721 resizableRelatedOptions: { 11722 maxHeight: true, 11723 maxWidth: true, 11724 minHeight: true, 11725 minWidth: true 11726 }, 11727 11728 _create: function () { 11729 this.originalCss = { 11730 display: this.element[0].style.display, 11731 width: this.element[0].style.width, 11732 minHeight: this.element[0].style.minHeight, 11733 maxHeight: this.element[0].style.maxHeight, 11734 height: this.element[0].style.height 11735 }; 11736 this.originalPosition = { 11737 parent: this.element.parent(), 11738 index: this.element.parent().children().index(this.element) 11739 }; 11740 this.originalTitle = this.element.attr("title"); 11741 if (this.options.title == null && this.originalTitle != null) { 11742 this.options.title = this.originalTitle; 11743 } 11744 11745 // Dialogs can't be disabled 11746 if (this.options.disabled) { 11747 this.options.disabled = false; 11748 } 11749 11750 this._createWrapper(); 11751 11752 this.element 11753 .show() 11754 .removeAttr("title") 11755 .appendTo(this.uiDialog); 11756 11757 this._addClass("ui-dialog-content", "ui-widget-content"); 11758 11759 this._createTitlebar(); 11760 this._createButtonPane(); 11761 11762 if (this.options.draggable && $.fn.draggable) { 11763 this._makeDraggable(); 11764 } 11765 if (this.options.resizable && $.fn.resizable) { 11766 this._makeResizable(); 11767 } 11768 11769 this._isOpen = false; 11770 11771 this._trackFocus(); 11772 }, 11773 11774 _init: function () { 11775 if (this.options.autoOpen) { 11776 this.open(); 11777 } 11778 }, 11779 11780 _appendTo: function () { 11781 var element = this.options.appendTo; 11782 if (element && (element.jquery || element.nodeType)) { 11783 return $(element); 11784 } 11785 return this.document.find(element || "body").eq(0); 11786 }, 11787 11788 _destroy: function () { 11789 var next, 11790 originalPosition = this.originalPosition; 11791 11792 this._untrackInstance(); 11793 this._destroyOverlay(); 11794 11795 this.element 11796 .removeUniqueId() 11797 .css(this.originalCss) 11798
vendor: 9,592 bytes, lines 11799-12134
11799 // Without detaching first, the following becomes really slow 11800 .detach(); 11801 11802 this.uiDialog.remove(); 11803 11804 if (this.originalTitle) { 11805 this.element.attr("title", this.originalTitle); 11806 } 11807 11808 next = originalPosition.parent.children().eq(originalPosition.index); 11809 11810 // Don't try to place the dialog next to itself (#8613) 11811 if (next.length && next[0] !== this.element[0]) { 11812 next.before(this.element); 11813 } else { 11814 originalPosition.parent.append(this.element); 11815 } 11816 }, 11817 11818 widget: function () { 11819 return this.uiDialog; 11820 }, 11821 11822 disable: $.noop, 11823 enable: $.noop, 11824 11825 close: function (event) { 11826 var that = this; 11827 11828 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 11829 return; 11830 } 11831 11832 this._isOpen = false; 11833 this._focusedElement = null; 11834 this._destroyOverlay(); 11835 this._untrackInstance(); 11836 11837 if (!this.opener.filter(":focusable").trigger("focus").length) { 11838 // Hiding a focused element doesn't trigger blur in WebKit 11839 // so in case we have nothing to focus on, explicitly blur the active element 11840 // https://bugs.webkit.org/show_bug.cgi?id=47182 11841 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 11842 } 11843 11844 this._hide(this.uiDialog, this.options.hide, function () { 11845 that._trigger("close", event); 11846 }); 11847 }, 11848 11849 isOpen: function () { 11850 return this._isOpen; 11851 }, 11852 11853 moveToTop: function () { 11854 this._moveToTop(); 11855 }, 11856 11857 _moveToTop: function (event, silent) { 11858 var moved = false, 11859 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 11860 return +$(this).css("z-index"); 11861 }).get(), 11862 zIndexMax = Math.max.apply(null, zIndices); 11863 11864 if (zIndexMax >= +this.uiDialog.css("z-index")) { 11865 this.uiDialog.css("z-index", zIndexMax + 1); 11866 moved = true; 11867 } 11868 11869 if (moved && !silent) { 11870 this._trigger("focus", event); 11871 } 11872 return moved; 11873 }, 11874 11875 open: function () { 11876 var that = this; 11877 if (this._isOpen) { 11878 if (this._moveToTop()) { 11879 this._focusTabbable(); 11880 } 11881 return; 11882 } 11883 11884 this._isOpen = true; 11885 this.opener = $($.ui.safeActiveElement(this.document[0])); 11886 11887 this._size(); 11888 this._position(); 11889 this._createOverlay(); 11890 this._moveToTop(null, true); 11891 11892 // Ensure the overlay is moved to the top with the dialog, but only when 11893 // opening. The overlay shouldn't move after the dialog is open so that 11894 // modeless dialogs opened after the modal dialog stack properly. 11895 if (this.overlay) { 11896 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 11897 } 11898 11899 this._show(this.uiDialog, this.options.show, function () { 11900 that._focusTabbable(); 11901 that._trigger("focus"); 11902 }); 11903 11904 // Track the dialog immediately upon openening in case a focus event 11905 // somehow occurs outside of the dialog before an element inside the 11906 // dialog is focused (#10152) 11907 this._makeFocusTarget(); 11908 11909 this._trigger("open"); 11910 }, 11911 11912 _focusTabbable: function () { 11913 // Set focus to the first match: 11914 // 1. An element that was focused previously 11915 // 2. First element inside the dialog matching [autofocus] 11916 // 3. Tabbable element inside the content element 11917 // 4. Tabbable element inside the buttonpane 11918 // 5. The close button 11919 // 6. The dialog itself 11920 var hasFocus = this._focusedElement; 11921 if (!hasFocus) { 11922 hasFocus = this.element.find("[autofocus]"); 11923 } 11924 if (!hasFocus.length) { 11925 hasFocus = this.element.find(":tabbable"); 11926 } 11927 if (!hasFocus.length) { 11928 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 11929 } 11930 if (!hasFocus.length) { 11931 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 11932 } 11933 if (!hasFocus.length) { 11934 hasFocus = this.uiDialog; 11935 } 11936 hasFocus.eq(0).trigger("focus"); 11937 }, 11938 11939 _keepFocus: function (event) { 11940 function checkFocus() { 11941 var activeElement = $.ui.safeActiveElement(this.document[0]), 11942 isActive = this.uiDialog[0] === activeElement || 11943 $.contains(this.uiDialog[0], activeElement); 11944 if (!isActive) { 11945 this._focusTabbable(); 11946 } 11947 } 11948 event.preventDefault(); 11949 checkFocus.call(this); 11950 11951 // support: IE 11952 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 11953 // so we check again later 11954 this._delay(checkFocus); 11955 }, 11956 11957 _createWrapper: function () { 11958 this.uiDialog = $("<div>") 11959 .hide() 11960 .attr({ 11961 // Setting tabIndex makes the div focusable 11962 tabIndex: -1, 11963 role: "dialog" 11964 }) 11965 .appendTo(this._appendTo()); 11966 11967 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 11968 this._on(this.uiDialog, { 11969 keydown: function (event) { 11970 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 11971 event.keyCode === $.ui.keyCode.ESCAPE) { 11972 event.preventDefault(); 11973 this.close(event); 11974 return; 11975 } 11976 11977 // Prevent tabbing out of dialogs 11978 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 11979 return; 11980 } 11981 var tabbables = this.uiDialog.find(":tabbable"), 11982 first = tabbables.filter(":first"), 11983 last = tabbables.filter(":last"); 11984 11985 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 11986 !event.shiftKey) { 11987 this._delay(function () { 11988 first.trigger("focus"); 11989 }); 11990 event.preventDefault(); 11991 } else if ((event.target === first[0] || 11992 event.target === this.uiDialog[0]) && event.shiftKey) { 11993 this._delay(function () { 11994 last.trigger("focus"); 11995 }); 11996 event.preventDefault(); 11997 } 11998 }, 11999 mousedown: function (event) { 12000 if (this._moveToTop(event)) { 12001 this._focusTabbable(); 12002 } 12003 } 12004 }); 12005 12006 // We assume that any existing aria-describedby attribute means 12007 // that the dialog content is marked up properly 12008 // otherwise we brute force the content as the description 12009 if (!this.element.find("[aria-describedby]").length) { 12010 this.uiDialog.attr({ 12011 "aria-describedby": this.element.uniqueId().attr("id") 12012 }); 12013 } 12014 }, 12015 12016 _createTitlebar: function () { 12017 var uiDialogTitle; 12018 12019 this.uiDialogTitlebar = $("<div>"); 12020 this._addClass(this.uiDialogTitlebar, 12021 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 12022 this._on(this.uiDialogTitlebar, { 12023 mousedown: function (event) { 12024 // Don't prevent click on close button (#8838) 12025 // Focusing a dialog that is partially scrolled out of view 12026 // causes the browser to scroll it into view, preventing the click event 12027 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 12028 // Dialog isn't getting focus when dragging (#8063) 12029 this.uiDialog.trigger("focus"); 12030 } 12031 } 12032 }); 12033 12034 // Support: IE 12035 // Use type="button" to prevent enter keypresses in textboxes from closing the 12036 // dialog in IE (#9312) 12037 this.uiDialogTitlebarClose = $("<button type='button'></button>") 12038 .button({ 12039 label: $("<a>").text(this.options.closeText).html(), 12040 icon: "ui-icon-closethick", 12041 showLabel: false 12042 }) 12043 .appendTo(this.uiDialogTitlebar); 12044 12045 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 12046 this._on(this.uiDialogTitlebarClose, { 12047 click: function (event) { 12048 event.preventDefault(); 12049 this.close(event); 12050 } 12051 }); 12052 12053 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 12054 this._addClass(uiDialogTitle, "ui-dialog-title"); 12055 this._title(uiDialogTitle); 12056 12057 this.uiDialogTitlebar.prependTo(this.uiDialog); 12058 12059 this.uiDialog.attr({ 12060 "aria-labelledby": uiDialogTitle.attr("id") 12061 }); 12062 }, 12063 12064 _title: function (title) { 12065 if (this.options.title) { 12066 title.text(this.options.title); 12067 } else { 12068 title.html(" "); 12069 } 12070 }, 12071 12072 _createButtonPane: function () { 12073 this.uiDialogButtonPane = $("<div>"); 12074 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 12075 "ui-widget-content ui-helper-clearfix"); 12076 12077 this.uiButtonSet = $("<div>") 12078 .appendTo(this.uiDialogButtonPane); 12079 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 12080 12081 this._createButtons(); 12082 }, 12083 12084 _createButtons: function () { 12085 var that = this, 12086 buttons = this.options.buttons; 12087 12088 // If we already have a button pane, remove it 12089 this.uiDialogButtonPane.remove(); 12090 this.uiButtonSet.empty(); 12091 12092 if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) { 12093 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 12094 return; 12095 } 12096 12097 $.each(buttons, function (name, props) { 12098 var click, buttonOptions; 12099 props = $.isFunction(props) ? 12100 { click: props, text: name } : 12101 props; 12102 12103 // Default to a non-submitting button 12104 props = $.extend({ type: "button" }, props); 12105 12106 // Change the context for the click callback to be the main element 12107 click = props.click; 12108 buttonOptions = { 12109 icon: props.icon, 12110 iconPosition: props.iconPosition, 12111 showLabel: props.showLabel, 12112 12113 // Deprecated options 12114 icons: props.icons, 12115 text: props.text 12116 }; 12117 12118 delete props.click; 12119 delete props.icon; 12120 delete props.iconPosition; 12121 delete props.showLabel; 12122 12123 // Deprecated options 12124 delete props.icons; 12125 if (typeof props.text === "boolean") { 12126 delete props.text; 12127 } 12128 12129 $("<button></button>", props) 12130 .button(buttonOptions) 12131 .appendTo(that.uiButtonSet) 12132 .on("click", function () { 12133 click.apply(that.element[0], arguments); 12134 });
vendor: 7,867 bytes, lines 12135-12429
12135 }); 12136 this._addClass(this.uiDialog, "ui-dialog-buttons"); 12137 this.uiDialogButtonPane.appendTo(this.uiDialog); 12138 }, 12139 12140 _makeDraggable: function () { 12141 var that = this, 12142 options = this.options; 12143 12144 function filteredUi(ui) { 12145 return { 12146 position: ui.position, 12147 offset: ui.offset 12148 }; 12149 } 12150 12151 this.uiDialog.draggable({ 12152 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12153 handle: ".ui-dialog-titlebar", 12154 containment: "document", 12155 start: function (event, ui) { 12156 that._addClass($(this), "ui-dialog-dragging"); 12157 that._blockFrames(); 12158 that._trigger("dragStart", event, filteredUi(ui)); 12159 }, 12160 drag: function (event, ui) { 12161 that._trigger("drag", event, filteredUi(ui)); 12162 }, 12163 stop: function (event, ui) { 12164 var left = ui.offset.left - that.document.scrollLeft(), 12165 top = ui.offset.top - that.document.scrollTop(); 12166 12167 options.position = { 12168 my: "left top", 12169 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12170 "top" + (top >= 0 ? "+" : "") + top, 12171 of: that.window 12172 }; 12173 that._removeClass($(this), "ui-dialog-dragging"); 12174 that._unblockFrames(); 12175 that._trigger("dragStop", event, filteredUi(ui)); 12176 } 12177 }); 12178 }, 12179 12180 _makeResizable: function () { 12181 var that = this, 12182 options = this.options, 12183 handles = options.resizable, 12184 12185 // .ui-resizable has position: relative defined in the stylesheet 12186 // but dialogs have to use absolute or fixed positioning 12187 position = this.uiDialog.css("position"), 12188 resizeHandles = typeof handles === "string" ? 12189 handles : 12190 "n,e,s,w,se,sw,ne,nw"; 12191 12192 function filteredUi(ui) { 12193 return { 12194 originalPosition: ui.originalPosition, 12195 originalSize: ui.originalSize, 12196 position: ui.position, 12197 size: ui.size 12198 }; 12199 } 12200 12201 this.uiDialog.resizable({ 12202 cancel: ".ui-dialog-content", 12203 containment: "document", 12204 alsoResize: this.element, 12205 maxWidth: options.maxWidth, 12206 maxHeight: options.maxHeight, 12207 minWidth: options.minWidth, 12208 minHeight: this._minHeight(), 12209 handles: resizeHandles, 12210 start: function (event, ui) { 12211 that._addClass($(this), "ui-dialog-resizing"); 12212 that._blockFrames(); 12213 that._trigger("resizeStart", event, filteredUi(ui)); 12214 }, 12215 resize: function (event, ui) { 12216 that._trigger("resize", event, filteredUi(ui)); 12217 }, 12218 stop: function (event, ui) { 12219 var offset = that.uiDialog.offset(), 12220 left = offset.left - that.document.scrollLeft(), 12221 top = offset.top - that.document.scrollTop(); 12222 12223 options.height = that.uiDialog.height(); 12224 options.width = that.uiDialog.width(); 12225 options.position = { 12226 my: "left top", 12227 at: "left" + (left >= 0 ? "+" : "") + left + " " + 12228 "top" + (top >= 0 ? "+" : "") + top, 12229 of: that.window 12230 }; 12231 that._removeClass($(this), "ui-dialog-resizing"); 12232 that._unblockFrames(); 12233 that._trigger("resizeStop", event, filteredUi(ui)); 12234 } 12235 }) 12236 .css("position", position); 12237 }, 12238 12239 _trackFocus: function () { 12240 this._on(this.widget(), { 12241 focusin: function (event) { 12242 this._makeFocusTarget(); 12243 this._focusedElement = $(event.target); 12244 } 12245 }); 12246 }, 12247 12248 _makeFocusTarget: function () { 12249 this._untrackInstance(); 12250 this._trackingInstances().unshift(this); 12251 }, 12252 12253 _untrackInstance: function () { 12254 var instances = this._trackingInstances(), 12255 exists = $.inArray(this, instances); 12256 if (exists !== -1) { 12257 instances.splice(exists, 1); 12258 } 12259 }, 12260 12261 _trackingInstances: function () { 12262 var instances = this.document.data("ui-dialog-instances"); 12263 if (!instances) { 12264 instances = []; 12265 this.document.data("ui-dialog-instances", instances); 12266 } 12267 return instances; 12268 }, 12269 12270 _minHeight: function () { 12271 var options = this.options; 12272 12273 return options.height === "auto" ? 12274 options.minHeight : 12275 Math.min(options.minHeight, options.height); 12276 }, 12277 12278 _position: function () { 12279 // Need to show the dialog to get the actual offset in the position plugin 12280 var isVisible = this.uiDialog.is(":visible"); 12281 if (!isVisible) { 12282 this.uiDialog.show(); 12283 } 12284 this.uiDialog.position(this.options.position); 12285 if (!isVisible) { 12286 this.uiDialog.hide(); 12287 } 12288 }, 12289 12290 _setOptions: function (options) { 12291 var that = this, 12292 resize = false, 12293 resizableOptions = {}; 12294 12295 $.each(options, function (key, value) { 12296 that._setOption(key, value); 12297 12298 if (key in that.sizeRelatedOptions) { 12299 resize = true; 12300 } 12301 if (key in that.resizableRelatedOptions) { 12302 resizableOptions[key] = value; 12303 } 12304 }); 12305 12306 if (resize) { 12307 this._size(); 12308 this._position(); 12309 } 12310 if (this.uiDialog.is(":data(ui-resizable)")) { 12311 this.uiDialog.resizable("option", resizableOptions); 12312 } 12313 }, 12314 12315 _setOption: function (key, value) { 12316 var isDraggable, isResizable, 12317 uiDialog = this.uiDialog; 12318 12319 if (key === "disabled") { 12320 return; 12321 } 12322 12323 this._super(key, value); 12324 12325 if (key === "appendTo") { 12326 this.uiDialog.appendTo(this._appendTo()); 12327 } 12328 12329 if (key === "buttons") { 12330 this._createButtons(); 12331 } 12332 12333 if (key === "closeText") { 12334 this.uiDialogTitlebarClose.button({ 12335 // Ensure that we always pass a string 12336 label: $("<a>").text("" + this.options.closeText).html() 12337 }); 12338 } 12339 12340 if (key === "draggable") { 12341 isDraggable = uiDialog.is(":data(ui-draggable)"); 12342 if (isDraggable && !value) { 12343 uiDialog.draggable("destroy"); 12344 } 12345 12346 if (!isDraggable && value) { 12347 this._makeDraggable(); 12348 } 12349 } 12350 12351 if (key === "position") { 12352 this._position(); 12353 } 12354 12355 if (key === "resizable") { 12356 // currently resizable, becoming non-resizable 12357 isResizable = uiDialog.is(":data(ui-resizable)"); 12358 if (isResizable && !value) { 12359 uiDialog.resizable("destroy"); 12360 } 12361 12362 // Currently resizable, changing handles 12363 if (isResizable && typeof value === "string") { 12364 uiDialog.resizable("option", "handles", value); 12365 } 12366 12367 // Currently non-resizable, becoming resizable 12368 if (!isResizable && value !== false) { 12369 this._makeResizable(); 12370 } 12371 } 12372 12373 if (key === "title") { 12374 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 12375 } 12376 }, 12377 12378 _size: function () { 12379 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12380 // divs will both have width and height set, so we need to reset them 12381 var nonContentHeight, minContentHeight, maxContentHeight, 12382 options = this.options; 12383 12384 // Reset content sizing 12385 this.element.show().css({ 12386 width: "auto", 12387 minHeight: 0, 12388 maxHeight: "none", 12389 height: 0 12390 }); 12391 12392 if (options.minWidth > options.width) { 12393 options.width = options.minWidth; 12394 } 12395 12396 // Reset wrapper sizing 12397 // determine the height of all the non-content elements 12398 nonContentHeight = this.uiDialog.css({ 12399 height: "auto", 12400 width: options.width 12401 }) 12402 .outerHeight(); 12403 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 12404 maxContentHeight = typeof options.maxHeight === "number" ? 12405 Math.max(0, options.maxHeight - nonContentHeight) : 12406 "none"; 12407 12408 if (options.height === "auto") { 12409 this.element.css({ 12410 minHeight: minContentHeight, 12411 maxHeight: maxContentHeight, 12412 height: "auto" 12413 }); 12414 } else { 12415 this.element.height(Math.max(0, options.height - nonContentHeight)); 12416 } 12417 12418 if (this.uiDialog.is(":data(ui-resizable)")) { 12419 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 12420 } 12421 }, 12422 12423 _blockFrames: function () { 12424 this.iframeBlocks = this.document.find("iframe").map(function () { 12425 var iframe = $(this); 12426 12427 return $("<div>") 12428 .css({ 12429 position: "absolute",
vendor: 15,869 bytes, lines 12430-12996
12430 width: iframe.outerWidth(), 12431 height: iframe.outerHeight() 12432 }) 12433 .appendTo(iframe.parent()) 12434 .offset(iframe.offset())[0]; 12435 }); 12436 }, 12437 12438 _unblockFrames: function () { 12439 if (this.iframeBlocks) { 12440 this.iframeBlocks.remove(); 12441 delete this.iframeBlocks; 12442 } 12443 }, 12444 12445 _allowInteraction: function (event) { 12446 if ($(event.target).closest(".ui-dialog").length) { 12447 return true; 12448 } 12449 12450 // TODO: Remove hack when datepicker implements 12451 // the .ui-front logic (#8989) 12452 return !!$(event.target).closest(".ui-datepicker").length; 12453 }, 12454 12455 _createOverlay: function () { 12456 if (!this.options.modal) { 12457 return; 12458 } 12459 12460 // We use a delay in case the overlay is created from an 12461 // event that we're going to be cancelling (#2804) 12462 var isOpening = true; 12463 this._delay(function () { 12464 isOpening = false; 12465 }); 12466 12467 if (!this.document.data("ui-dialog-overlays")) { 12468 // Prevent use of anchors and inputs 12469 // Using _on() for an event handler shared across many instances is 12470 // safe because the dialogs stack and must be closed in reverse order 12471 this._on(this.document, { 12472 focusin: function (event) { 12473 if (isOpening) { 12474 return; 12475 } 12476 12477 if (!this._allowInteraction(event)) { 12478 event.preventDefault(); 12479 this._trackingInstances()[0]._focusTabbable(); 12480 } 12481 } 12482 }); 12483 } 12484 12485 this.overlay = $("<div>") 12486 .appendTo(this._appendTo()); 12487 12488 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 12489 this._on(this.overlay, { 12490 mousedown: "_keepFocus" 12491 }); 12492 this.document.data("ui-dialog-overlays", 12493 (this.document.data("ui-dialog-overlays") || 0) + 1); 12494 }, 12495 12496 _destroyOverlay: function () { 12497 if (!this.options.modal) { 12498 return; 12499 } 12500 12501 if (this.overlay) { 12502 var overlays = this.document.data("ui-dialog-overlays") - 1; 12503 12504 if (!overlays) { 12505 this._off(this.document, "focusin"); 12506 this.document.removeData("ui-dialog-overlays"); 12507 } else { 12508 this.document.data("ui-dialog-overlays", overlays); 12509 } 12510 12511 this.overlay.remove(); 12512 this.overlay = null; 12513 } 12514 } 12515 }); 12516 12517 // DEPRECATED 12518 // TODO: switch return back to widget declaration at top of file when this is removed 12519 if ($.uiBackCompat !== false) { 12520 // Backcompat for dialogClass option 12521 $.widget("ui.dialog", $.ui.dialog, { 12522 options: { 12523 dialogClass: "" 12524 }, 12525 _createWrapper: function () { 12526 this._super(); 12527 this.uiDialog.addClass(this.options.dialogClass); 12528 }, 12529 _setOption: function (key, value) { 12530 if (key === "dialogClass") { 12531 this.uiDialog 12532 .removeClass(this.options.dialogClass) 12533 .addClass(value); 12534 } 12535 this._superApply(arguments); 12536 } 12537 }); 12538 } 12539 12540 var widgetsDialog = $.ui.dialog; 12541 12542 /*! 12543 * jQuery UI Droppable 1.12.1 12544 * http://jqueryui.com 12545 * 12546 * Copyright jQuery Foundation and other contributors 12547 * Released under the MIT license. 12548 * http://jquery.org/license 12549 */ 12550 12551 //>>label: Droppable 12552 //>>group: Interactions 12553 //>>description: Enables drop targets for draggable elements. 12554 //>>docs: http://api.jqueryui.com/droppable/ 12555 //>>demos: http://jqueryui.com/droppable/ 12556 12557 $.widget("ui.droppable", { 12558 version: "1.12.1", 12559 widgetEventPrefix: "drop", 12560 options: { 12561 accept: "*", 12562 addClasses: true, 12563 greedy: false, 12564 scope: "default", 12565 tolerance: "intersect", 12566 12567 // Callbacks 12568 activate: null, 12569 deactivate: null, 12570 drop: null, 12571 out: null, 12572 over: null 12573 }, 12574 _create: function () { 12575 var proportions, 12576 o = this.options, 12577 accept = o.accept; 12578 12579 this.isover = false; 12580 this.isout = true; 12581 12582 this.accept = $.isFunction(accept) ? accept : function (d) { 12583 return d.is(accept); 12584 }; 12585 12586 this.proportions = function ( /* valueToWrite */) { 12587 if (arguments.length) { 12588 // Store the droppable's proportions 12589 proportions = arguments[0]; 12590 } else { 12591 // Retrieve or derive the droppable's proportions 12592 return proportions ? 12593 proportions : 12594 proportions = { 12595 width: this.element[0].offsetWidth, 12596 height: this.element[0].offsetHeight 12597 }; 12598 } 12599 }; 12600 12601 this._addToManager(o.scope); 12602 12603 o.addClasses && this._addClass("ui-droppable"); 12604 }, 12605 12606 _addToManager: function (scope) { 12607 // Add the reference and positions to the manager 12608 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 12609 $.ui.ddmanager.droppables[scope].push(this); 12610 }, 12611 12612 _splice: function (drop) { 12613 var i = 0; 12614 for (; i < drop.length; i++) { 12615 if (drop[i] === this) { 12616 drop.splice(i, 1); 12617 } 12618 } 12619 }, 12620 12621 _destroy: function () { 12622 var drop = $.ui.ddmanager.droppables[this.options.scope]; 12623 12624 this._splice(drop); 12625 }, 12626 12627 _setOption: function (key, value) { 12628 if (key === "accept") { 12629 this.accept = $.isFunction(value) ? value : function (d) { 12630 return d.is(value); 12631 }; 12632 } else if (key === "scope") { 12633 var drop = $.ui.ddmanager.droppables[this.options.scope]; 12634 12635 this._splice(drop); 12636 this._addToManager(value); 12637 } 12638 12639 this._super(key, value); 12640 }, 12641 12642 _activate: function (event) { 12643 var draggable = $.ui.ddmanager.current; 12644 12645 this._addActiveClass(); 12646 if (draggable) { 12647 this._trigger("activate", event, this.ui(draggable)); 12648 } 12649 }, 12650 12651 _deactivate: function (event) { 12652 var draggable = $.ui.ddmanager.current; 12653 12654 this._removeActiveClass(); 12655 if (draggable) { 12656 this._trigger("deactivate", event, this.ui(draggable)); 12657 } 12658 }, 12659 12660 _over: function (event) { 12661 var draggable = $.ui.ddmanager.current; 12662 12663 // Bail if draggable and droppable are same element 12664 if (!draggable || (draggable.currentItem || 12665 draggable.element)[0] === this.element[0]) { 12666 return; 12667 } 12668 12669 if (this.accept.call(this.element[0], (draggable.currentItem || 12670 draggable.element))) { 12671 this._addHoverClass(); 12672 this._trigger("over", event, this.ui(draggable)); 12673 } 12674 }, 12675 12676 _out: function (event) { 12677 var draggable = $.ui.ddmanager.current; 12678 12679 // Bail if draggable and droppable are same element 12680 if (!draggable || (draggable.currentItem || 12681 draggable.element)[0] === this.element[0]) { 12682 return; 12683 } 12684 12685 if (this.accept.call(this.element[0], (draggable.currentItem || 12686 draggable.element))) { 12687 this._removeHoverClass(); 12688 this._trigger("out", event, this.ui(draggable)); 12689 } 12690 }, 12691 12692 _drop: function (event, custom) { 12693 var draggable = custom || $.ui.ddmanager.current, 12694 childrenIntersection = false; 12695 12696 // Bail if draggable and droppable are same element 12697 if (!draggable || (draggable.currentItem || 12698 draggable.element)[0] === this.element[0]) { 12699 return false; 12700 } 12701 12702 this.element 12703 .find(":data(ui-droppable)") 12704 .not(".ui-draggable-dragging") 12705 .each(function () { 12706 var inst = $(this).droppable("instance"); 12707 if ( 12708 inst.options.greedy && 12709 !inst.options.disabled && 12710 inst.options.scope === draggable.options.scope && 12711 inst.accept.call( 12712 inst.element[0], (draggable.currentItem || draggable.element) 12713 ) && 12714 intersect( 12715 draggable, 12716 $.extend(inst, { offset: inst.element.offset() }), 12717 inst.options.tolerance, event 12718 ) 12719 ) { 12720 childrenIntersection = true; 12721 return false; 12722 } 12723 }); 12724 if (childrenIntersection) { 12725 return false; 12726 } 12727 12728 if (this.accept.call(this.element[0], 12729 (draggable.currentItem || draggable.element))) { 12730 this._removeActiveClass(); 12731 this._removeHoverClass(); 12732 12733 this._trigger("drop", event, this.ui(draggable)); 12734 return this.element; 12735 } 12736 12737 return false; 12738 }, 12739 12740 ui: function (c) { 12741 return { 12742 draggable: (c.currentItem || c.element), 12743 helper: c.helper, 12744 position: c.position, 12745 offset: c.positionAbs 12746 }; 12747 }, 12748 12749 // Extension points just to make backcompat sane and avoid duplicating logic 12750 // TODO: Remove in 1.13 along with call to it below 12751 _addHoverClass: function () { 12752 this._addClass("ui-droppable-hover"); 12753 }, 12754 12755 _removeHoverClass: function () { 12756 this._removeClass("ui-droppable-hover"); 12757 }, 12758 12759 _addActiveClass: function () { 12760 this._addClass("ui-droppable-active"); 12761 }, 12762 12763 _removeActiveClass: function () { 12764 this._removeClass("ui-droppable-active"); 12765 } 12766 }); 12767 12768 var intersect = $.ui.intersect = (function () { 12769 function isOverAxis(x, reference, size) { 12770 return (x >= reference) && (x < (reference + size)); 12771 } 12772 12773 return function (draggable, droppable, toleranceMode, event) { 12774 if (!droppable.offset) { 12775 return false; 12776 } 12777 12778 var x1 = (draggable.positionAbs || 12779 draggable.position.absolute).left + draggable.margins.left, 12780 y1 = (draggable.positionAbs || 12781 draggable.position.absolute).top + draggable.margins.top, 12782 x2 = x1 + draggable.helperProportions.width, 12783 y2 = y1 + draggable.helperProportions.height, 12784 l = droppable.offset.left, 12785 t = droppable.offset.top, 12786 r = l + droppable.proportions().width, 12787 b = t + droppable.proportions().height; 12788 12789 switch (toleranceMode) { 12790 case "fit": 12791 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 12792 case "intersect": 12793 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 12794 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 12795 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 12796 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 12797 case "pointer": 12798 return isOverAxis(event.pageY, t, droppable.proportions().height) && 12799 isOverAxis(event.pageX, l, droppable.proportions().width); 12800 case "touch": 12801 return ( 12802 (y1 >= t && y1 <= b) || // Top edge touching 12803 (y2 >= t && y2 <= b) || // Bottom edge touching 12804 (y1 < t && y2 > b) // Surrounded vertically 12805 ) && ( 12806 (x1 >= l && x1 <= r) || // Left edge touching 12807 (x2 >= l && x2 <= r) || // Right edge touching 12808 (x1 < l && x2 > r) // Surrounded horizontally 12809 ); 12810 default: 12811 return false; 12812 } 12813 }; 12814 })(); 12815 12816 /* 12817 This manager tracks offsets of draggables and droppables 12818 */ 12819 $.ui.ddmanager = { 12820 current: null, 12821 droppables: { "default": [] }, 12822 prepareOffsets: function (t, event) { 12823 var i, j, 12824 m = $.ui.ddmanager.droppables[t.options.scope] || [], 12825 type = event ? event.type : null, // workaround for #2317 12826 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 12827 12828 droppablesLoop: for (i = 0; i < m.length; i++) { 12829 // No disabled and non-accepted 12830 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 12831 (t.currentItem || t.element)))) { 12832 continue; 12833 } 12834 12835 // Filter out elements in the current dragged item 12836 for (j = 0; j < list.length; j++) { 12837 if (list[j] === m[i].element[0]) { 12838 m[i].proportions().height = 0; 12839 continue droppablesLoop; 12840 } 12841 } 12842 12843 m[i].visible = m[i].element.css("display") !== "none"; 12844 if (!m[i].visible) { 12845 continue; 12846 } 12847 12848 // Activate the droppable if used directly from draggables 12849 if (type === "mousedown") { 12850 m[i]._activate.call(m[i], event); 12851 } 12852 12853 m[i].offset = m[i].element.offset(); 12854 m[i].proportions({ 12855 width: m[i].element[0].offsetWidth, 12856 height: m[i].element[0].offsetHeight 12857 }); 12858 } 12859 }, 12860 drop: function (draggable, event) { 12861 var dropped = false; 12862 12863 // Create a copy of the droppables in case the list changes during the drop (#9116) 12864 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 12865 if (!this.options) { 12866 return; 12867 } 12868 if (!this.options.disabled && this.visible && 12869 intersect(draggable, this, this.options.tolerance, event)) { 12870 dropped = this._drop.call(this, event) || dropped; 12871 } 12872 12873 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 12874 (draggable.currentItem || draggable.element))) { 12875 this.isout = true; 12876 this.isover = false; 12877 this._deactivate.call(this, event); 12878 } 12879 }); 12880 return dropped; 12881 }, 12882 dragStart: function (draggable, event) { 12883 // Listen for scrolling so that if the dragging causes scrolling the position of the 12884 // droppables can be recalculated (see #5003) 12885 draggable.element.parentsUntil("body").on("scroll.droppable", function () { 12886 if (!draggable.options.refreshPositions) { 12887 $.ui.ddmanager.prepareOffsets(draggable, event); 12888 } 12889 }); 12890 }, 12891 drag: function (draggable, event) { 12892 // If you have a highly dynamic page, you might try this option. It renders positions 12893 // every time you move the mouse. 12894 if (draggable.options.refreshPositions) { 12895 $.ui.ddmanager.prepareOffsets(draggable, event); 12896 } 12897 12898 // Run through all droppables and check their positions based on specific tolerance options 12899 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 12900 if (this.options.disabled || this.greedyChild || !this.visible) { 12901 return; 12902 } 12903 12904 var parentInstance, scope, parent, 12905 intersects = intersect(draggable, this, this.options.tolerance, event), 12906 c = !intersects && this.isover ? 12907 "isout" : 12908 (intersects && !this.isover ? "isover" : null); 12909 if (!c) { 12910 return; 12911 } 12912 12913 if (this.options.greedy) { 12914 // find droppable parents with same scope 12915 scope = this.options.scope; 12916 parent = this.element.parents(":data(ui-droppable)").filter(function () { 12917 return $(this).droppable("instance").options.scope === scope; 12918 }); 12919 12920 if (parent.length) { 12921 parentInstance = $(parent[0]).droppable("instance"); 12922 parentInstance.greedyChild = (c === "isover"); 12923 } 12924 } 12925 12926 // We just moved into a greedy child 12927 if (parentInstance && c === "isover") { 12928 parentInstance.isover = false; 12929 parentInstance.isout = true; 12930 parentInstance._out.call(parentInstance, event); 12931 } 12932 12933 this[c] = true; 12934 this[c === "isout" ? "isover" : "isout"] = false; 12935 this[c === "isover" ? "_over" : "_out"].call(this, event); 12936 12937 // We just moved out of a greedy child 12938 if (parentInstance && c === "isout") { 12939 parentInstance.isout = false; 12940 parentInstance.isover = true; 12941 parentInstance._over.call(parentInstance, event); 12942 } 12943 }); 12944 }, 12945 dragStop: function (draggable, event) { 12946 draggable.element.parentsUntil("body").off("scroll.droppable"); 12947 12948 // Call prepareOffsets one final time since IE does not fire return scroll events when 12949 // overflow was caused by drag (see #5003) 12950 if (!draggable.options.refreshPositions) { 12951 $.ui.ddmanager.prepareOffsets(draggable, event); 12952 } 12953 } 12954 }; 12955 12956 // DEPRECATED 12957 // TODO: switch return back to widget declaration at top of file when this is removed 12958 if ($.uiBackCompat !== false) { 12959 // Backcompat for activeClass and hoverClass options 12960 $.widget("ui.droppable", $.ui.droppable, { 12961 options: { 12962 hoverClass: false, 12963 activeClass: false 12964 }, 12965 _addActiveClass: function () { 12966 this._super(); 12967 if (this.options.activeClass) { 12968 this.element.addClass(this.options.activeClass); 12969 } 12970 }, 12971 _removeActiveClass: function () { 12972 this._super(); 12973 if (this.options.activeClass) { 12974 this.element.removeClass(this.options.activeClass); 12975 } 12976 }, 12977 _addHoverClass: function () { 12978 this._super(); 12979 if (this.options.hoverClass) { 12980 this.element.addClass(this.options.hoverClass); 12981 } 12982 }, 12983 _removeHoverClass: function () { 12984 this._super(); 12985 if (this.options.hoverClass) { 12986 this.element.removeClass(this.options.hoverClass); 12987 } 12988 } 12989 }); 12990 } 12991 12992 var widgetsDroppable = $.ui.droppable; 12993 12994 /*! 12995 * jQuery UI Progressbar 1.12.1 12996 * http://jqueryui.com
vendor: 16,128 bytes, lines 12997-13581
12997 * 12998 * Copyright jQuery Foundation and other contributors 12999 * Released under the MIT license. 13000 * http://jquery.org/license 13001 */ 13002 13003 //>>label: Progressbar 13004 //>>group: Widgets 13005 // jscs:disable maximumLineLength 13006 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 13007 // jscs:enable maximumLineLength 13008 //>>docs: http://api.jqueryui.com/progressbar/ 13009 //>>demos: http://jqueryui.com/progressbar/ 13010 //>>css.structure: ../../themes/base/core.css 13011 //>>css.structure: ../../themes/base/progressbar.css 13012 //>>css.theme: ../../themes/base/theme.css 13013 13014 var widgetsProgressbar = $.widget("ui.progressbar", { 13015 version: "1.12.1", 13016 options: { 13017 classes: { 13018 "ui-progressbar": "ui-corner-all", 13019 "ui-progressbar-value": "ui-corner-left", 13020 "ui-progressbar-complete": "ui-corner-right" 13021 }, 13022 max: 100, 13023 value: 0, 13024 13025 change: null, 13026 complete: null 13027 }, 13028 13029 min: 0, 13030 13031 _create: function () { 13032 // Constrain initial value 13033 this.oldValue = this.options.value = this._constrainedValue(); 13034 13035 this.element.attr({ 13036 // Only set static values; aria-valuenow and aria-valuemax are 13037 // set inside _refreshValue() 13038 role: "progressbar", 13039 "aria-valuemin": this.min 13040 }); 13041 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 13042 13043 this.valueDiv = $("<div>").appendTo(this.element); 13044 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 13045 this._refreshValue(); 13046 }, 13047 13048 _destroy: function () { 13049 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 13050 13051 this.valueDiv.remove(); 13052 }, 13053 13054 value: function (newValue) { 13055 if (newValue === undefined) { 13056 return this.options.value; 13057 } 13058 13059 this.options.value = this._constrainedValue(newValue); 13060 this._refreshValue(); 13061 }, 13062 13063 _constrainedValue: function (newValue) { 13064 if (newValue === undefined) { 13065 newValue = this.options.value; 13066 } 13067 13068 this.indeterminate = newValue === false; 13069 13070 // Sanitize value 13071 if (typeof newValue !== "number") { 13072 newValue = 0; 13073 } 13074 13075 return this.indeterminate ? false : 13076 Math.min(this.options.max, Math.max(this.min, newValue)); 13077 }, 13078 13079 _setOptions: function (options) { 13080 // Ensure "value" option is set after other values (like max) 13081 var value = options.value; 13082 delete options.value; 13083 13084 this._super(options); 13085 13086 this.options.value = this._constrainedValue(value); 13087 this._refreshValue(); 13088 }, 13089 13090 _setOption: function (key, value) { 13091 if (key === "max") { 13092 // Don't allow a max less than min 13093 value = Math.max(this.min, value); 13094 } 13095 this._super(key, value); 13096 }, 13097 13098 _setOptionDisabled: function (value) { 13099 this._super(value); 13100 13101 this.element.attr("aria-disabled", value); 13102 this._toggleClass(null, "ui-state-disabled", !!value); 13103 }, 13104 13105 _percentage: function () { 13106 return this.indeterminate ? 13107 100 : 13108 100 * (this.options.value - this.min) / (this.options.max - this.min); 13109 }, 13110 13111 _refreshValue: function () { 13112 var value = this.options.value, 13113 percentage = this._percentage(); 13114 13115 this.valueDiv 13116 .toggle(this.indeterminate || value > this.min) 13117 .width(percentage.toFixed(0) + "%"); 13118 13119 this 13120 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 13121 value === this.options.max) 13122 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 13123 13124 if (this.indeterminate) { 13125 this.element.removeAttr("aria-valuenow"); 13126 if (!this.overlayDiv) { 13127 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 13128 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 13129 } 13130 } else { 13131 this.element.attr({ 13132 "aria-valuemax": this.options.max, 13133 "aria-valuenow": value 13134 }); 13135 if (this.overlayDiv) { 13136 this.overlayDiv.remove(); 13137 this.overlayDiv = null; 13138 } 13139 } 13140 13141 if (this.oldValue !== value) { 13142 this.oldValue = value; 13143 this._trigger("change"); 13144 } 13145 if (value === this.options.max) { 13146 this._trigger("complete"); 13147 } 13148 } 13149 }); 13150 13151 /*! 13152 * jQuery UI Selectable 1.12.1 13153 * http://jqueryui.com 13154 * 13155 * Copyright jQuery Foundation and other contributors 13156 * Released under the MIT license. 13157 * http://jquery.org/license 13158 */ 13159 13160 //>>label: Selectable 13161 //>>group: Interactions 13162 //>>description: Allows groups of elements to be selected with the mouse. 13163 //>>docs: http://api.jqueryui.com/selectable/ 13164 //>>demos: http://jqueryui.com/selectable/ 13165 //>>css.structure: ../../themes/base/selectable.css 13166 13167 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 13168 version: "1.12.1", 13169 options: { 13170 appendTo: "body", 13171 autoRefresh: true, 13172 distance: 0, 13173 filter: "*", 13174 tolerance: "touch", 13175 13176 // Callbacks 13177 selected: null, 13178 selecting: null, 13179 start: null, 13180 stop: null, 13181 unselected: null, 13182 unselecting: null 13183 }, 13184 _create: function () { 13185 var that = this; 13186 13187 this._addClass("ui-selectable"); 13188 13189 this.dragged = false; 13190 13191 // Cache selectee children based on filter 13192 this.refresh = function () { 13193 that.elementPos = $(that.element[0]).offset(); 13194 that.selectees = $(that.options.filter, that.element[0]); 13195 that._addClass(that.selectees, "ui-selectee"); 13196 that.selectees.each(function () { 13197 var $this = $(this), 13198 selecteeOffset = $this.offset(), 13199 pos = { 13200 left: selecteeOffset.left - that.elementPos.left, 13201 top: selecteeOffset.top - that.elementPos.top 13202 }; 13203 $.data(this, "selectable-item", { 13204 element: this, 13205 $element: $this, 13206 left: pos.left, 13207 top: pos.top, 13208 right: pos.left + $this.outerWidth(), 13209 bottom: pos.top + $this.outerHeight(), 13210 startselected: false, 13211 selected: $this.hasClass("ui-selected"), 13212 selecting: $this.hasClass("ui-selecting"), 13213 unselecting: $this.hasClass("ui-unselecting") 13214 }); 13215 }); 13216 }; 13217 this.refresh(); 13218 13219 this._mouseInit(); 13220 13221 this.helper = $("<div>"); 13222 this._addClass(this.helper, "ui-selectable-helper"); 13223 }, 13224 13225 _destroy: function () { 13226 this.selectees.removeData("selectable-item"); 13227 this._mouseDestroy(); 13228 }, 13229 13230 _mouseStart: function (event) { 13231 var that = this, 13232 options = this.options; 13233 13234 this.opos = [event.pageX, event.pageY]; 13235 this.elementPos = $(this.element[0]).offset(); 13236 13237 if (this.options.disabled) { 13238 return; 13239 } 13240 13241 this.selectees = $(options.filter, this.element[0]); 13242 13243 this._trigger("start", event); 13244 13245 $(options.appendTo).append(this.helper); 13246 13247 // position helper (lasso) 13248 this.helper.css({ 13249 "left": event.pageX, 13250 "top": event.pageY, 13251 "width": 0, 13252 "height": 0 13253 }); 13254 13255 if (options.autoRefresh) { 13256 this.refresh(); 13257 } 13258 13259 this.selectees.filter(".ui-selected").each(function () { 13260 var selectee = $.data(this, "selectable-item"); 13261 selectee.startselected = true; 13262 if (!event.metaKey && !event.ctrlKey) { 13263 that._removeClass(selectee.$element, "ui-selected"); 13264 selectee.selected = false; 13265 that._addClass(selectee.$element, "ui-unselecting"); 13266 selectee.unselecting = true; 13267 13268 // selectable UNSELECTING callback 13269 that._trigger("unselecting", event, { 13270 unselecting: selectee.element 13271 }); 13272 } 13273 }); 13274 13275 $(event.target).parents().addBack().each(function () { 13276 var doSelect, 13277 selectee = $.data(this, "selectable-item"); 13278 if (selectee) { 13279 doSelect = (!event.metaKey && !event.ctrlKey) || 13280 !selectee.$element.hasClass("ui-selected"); 13281 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 13282 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 13283 selectee.unselecting = !doSelect; 13284 selectee.selecting = doSelect; 13285 selectee.selected = doSelect; 13286 13287 // selectable (UN)SELECTING callback 13288 if (doSelect) { 13289 that._trigger("selecting", event, { 13290 selecting: selectee.element 13291 }); 13292 } else { 13293 that._trigger("unselecting", event, { 13294 unselecting: selectee.element 13295 }); 13296 } 13297 return false; 13298 } 13299 }); 13300 }, 13301 13302 _mouseDrag: function (event) { 13303 this.dragged = true; 13304 13305 if (this.options.disabled) { 13306 return; 13307 } 13308 13309 var tmp, 13310 that = this, 13311 options = this.options, 13312 x1 = this.opos[0], 13313 y1 = this.opos[1], 13314 x2 = event.pageX, 13315 y2 = event.pageY; 13316 13317 if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } 13318 if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } 13319 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 13320 13321 this.selectees.each(function () { 13322 var selectee = $.data(this, "selectable-item"), 13323 hit = false, 13324 offset = {}; 13325 13326 //prevent helper from being selected if appendTo: selectable 13327 if (!selectee || selectee.element === that.element[0]) { 13328 return; 13329 } 13330 13331 offset.left = selectee.left + that.elementPos.left; 13332 offset.right = selectee.right + that.elementPos.left; 13333 offset.top = selectee.top + that.elementPos.top; 13334 offset.bottom = selectee.bottom + that.elementPos.top; 13335 13336 if (options.tolerance === "touch") { 13337 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 13338 offset.bottom < y1)); 13339 } else if (options.tolerance === "fit") { 13340 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 13341 offset.bottom < y2); 13342 } 13343 13344 if (hit) { 13345 // SELECT 13346 if (selectee.selected) { 13347 that._removeClass(selectee.$element, "ui-selected"); 13348 selectee.selected = false; 13349 } 13350 if (selectee.unselecting) { 13351 that._removeClass(selectee.$element, "ui-unselecting"); 13352 selectee.unselecting = false; 13353 } 13354 if (!selectee.selecting) { 13355 that._addClass(selectee.$element, "ui-selecting"); 13356 selectee.selecting = true; 13357 13358 // selectable SELECTING callback 13359 that._trigger("selecting", event, { 13360 selecting: selectee.element 13361 }); 13362 } 13363 } else { 13364 // UNSELECT 13365 if (selectee.selecting) { 13366 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 13367 that._removeClass(selectee.$element, "ui-selecting"); 13368 selectee.selecting = false; 13369 that._addClass(selectee.$element, "ui-selected"); 13370 selectee.selected = true; 13371 } else { 13372 that._removeClass(selectee.$element, "ui-selecting"); 13373 selectee.selecting = false; 13374 if (selectee.startselected) { 13375 that._addClass(selectee.$element, "ui-unselecting"); 13376 selectee.unselecting = true; 13377 } 13378 13379 // selectable UNSELECTING callback 13380 that._trigger("unselecting", event, { 13381 unselecting: selectee.element 13382 }); 13383 } 13384 } 13385 if (selectee.selected) { 13386 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 13387 that._removeClass(selectee.$element, "ui-selected"); 13388 selectee.selected = false; 13389 13390 that._addClass(selectee.$element, "ui-unselecting"); 13391 selectee.unselecting = true; 13392 13393 // selectable UNSELECTING callback 13394 that._trigger("unselecting", event, { 13395 unselecting: selectee.element 13396 }); 13397 } 13398 } 13399 } 13400 }); 13401 13402 return false; 13403 }, 13404 13405 _mouseStop: function (event) { 13406 var that = this; 13407 13408 this.dragged = false; 13409 13410 $(".ui-unselecting", this.element[0]).each(function () { 13411 var selectee = $.data(this, "selectable-item"); 13412 that._removeClass(selectee.$element, "ui-unselecting"); 13413 selectee.unselecting = false; 13414 selectee.startselected = false; 13415 that._trigger("unselected", event, { 13416 unselected: selectee.element 13417 }); 13418 }); 13419 $(".ui-selecting", this.element[0]).each(function () { 13420 var selectee = $.data(this, "selectable-item"); 13421 that._removeClass(selectee.$element, "ui-selecting") 13422 ._addClass(selectee.$element, "ui-selected"); 13423 selectee.selecting = false; 13424 selectee.selected = true; 13425 selectee.startselected = true; 13426 that._trigger("selected", event, { 13427 selected: selectee.element 13428 }); 13429 }); 13430 this._trigger("stop", event); 13431 13432 this.helper.remove(); 13433 13434 return false; 13435 } 13436 }); 13437 13438 /*! 13439 * jQuery UI Selectmenu 1.12.1 13440 * http://jqueryui.com 13441 * 13442 * Copyright jQuery Foundation and other contributors 13443 * Released under the MIT license. 13444 * http://jquery.org/license 13445 */ 13446 13447 //>>label: Selectmenu 13448 //>>group: Widgets 13449 // jscs:disable maximumLineLength 13450 //>>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. 13451 // jscs:enable maximumLineLength 13452 //>>docs: http://api.jqueryui.com/selectmenu/ 13453 //>>demos: http://jqueryui.com/selectmenu/ 13454 //>>css.structure: ../../themes/base/core.css 13455 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 13456 //>>css.theme: ../../themes/base/theme.css 13457 13458 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 13459 version: "1.12.1", 13460 defaultElement: "<select>", 13461 options: { 13462 appendTo: null, 13463 classes: { 13464 "ui-selectmenu-button-open": "ui-corner-top", 13465 "ui-selectmenu-button-closed": "ui-corner-all" 13466 }, 13467 disabled: null, 13468 icons: { 13469 button: "ui-icon-triangle-1-s" 13470 }, 13471 position: { 13472 my: "left top", 13473 at: "left bottom", 13474 collision: "none" 13475 }, 13476 width: false, 13477 13478 // Callbacks 13479 change: null, 13480 close: null, 13481 focus: null, 13482 open: null, 13483 select: null 13484 }, 13485 13486 _create: function () { 13487 var selectmenuId = this.element.uniqueId().attr("id"); 13488 this.ids = { 13489 element: selectmenuId, 13490 button: selectmenuId + "-button", 13491 menu: selectmenuId + "-menu" 13492 }; 13493 13494 this._drawButton(); 13495 this._drawMenu(); 13496 this._bindFormResetHandler(); 13497 13498 this._rendered = false; 13499 this.menuItems = $(); 13500 }, 13501 13502 _drawButton: function () { 13503 var icon, 13504 that = this, 13505 item = this._parseOption( 13506 this.element.find("option:selected"), 13507 this.element[0].selectedIndex 13508 ); 13509 13510 // Associate existing label with the new button 13511 this.labels = this.element.labels().attr("for", this.ids.button); 13512 this._on(this.labels, { 13513 click: function (event) { 13514 this.button.focus(); 13515 event.preventDefault(); 13516 } 13517 }); 13518 13519 // Hide original select element 13520 this.element.hide(); 13521 13522 // Create button 13523 this.button = $("<span>", { 13524 tabindex: this.options.disabled ? -1 : 0, 13525 id: this.ids.button, 13526 role: "combobox", 13527 "aria-expanded": "false", 13528 "aria-autocomplete": "list", 13529 "aria-owns": this.ids.menu, 13530 "aria-haspopup": "true", 13531 title: this.element.attr("title") 13532 }) 13533 .insertAfter(this.element); 13534 13535 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 13536 "ui-button ui-widget"); 13537 13538 icon = $("<span>").appendTo(this.button); 13539 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 13540 this.buttonItem = this._renderButtonItem(item) 13541 .appendTo(this.button); 13542 13543 if (this.options.width !== false) { 13544 this._resizeButton(); 13545 } 13546 13547 this._on(this.button, this._buttonEvents); 13548 this.button.one("focusin", function () { 13549 // Delay rendering the menu items until the button receives focus. 13550 // The menu may have already been rendered via a programmatic open. 13551 if (!that._rendered) { 13552 that._refreshMenu(); 13553 } 13554 }); 13555 }, 13556 13557 _drawMenu: function () { 13558 var that = this; 13559 13560 // Create menu 13561 this.menu = $("<ul>", { 13562 "aria-hidden": "true", 13563 "aria-labelledby": this.ids.button, 13564 id: this.ids.menu 13565 }); 13566 13567 // Wrap menu 13568 this.menuWrap = $("<div>").append(this.menu); 13569 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 13570 this.menuWrap.appendTo(this._appendTo()); 13571 13572 // Initialize menu widget 13573 this.menuInstance = this.menu 13574 .menu({ 13575 classes: { 13576 "ui-menu": "ui-corner-bottom" 13577 }, 13578 role: "listbox", 13579 select: function (event, ui) { 13580 event.preventDefault(); 13581
vendor: 11,593 bytes, lines 13582-14050
13582 // Support: IE8 13583 // If the item was selected via a click, the text selection 13584 // will be destroyed in IE 13585 that._setSelection(); 13586 13587 that._select(ui.item.data("ui-selectmenu-item"), event); 13588 }, 13589 focus: function (event, ui) { 13590 var item = ui.item.data("ui-selectmenu-item"); 13591 13592 // Prevent inital focus from firing and check if its a newly focused item 13593 if (that.focusIndex != null && item.index !== that.focusIndex) { 13594 that._trigger("focus", event, { item: item }); 13595 if (!that.isOpen) { 13596 that._select(item, event); 13597 } 13598 } 13599 that.focusIndex = item.index; 13600 13601 that.button.attr("aria-activedescendant", 13602 that.menuItems.eq(item.index).attr("id")); 13603 } 13604 }) 13605 .menu("instance"); 13606 13607 // Don't close the menu on mouseleave 13608 this.menuInstance._off(this.menu, "mouseleave"); 13609 13610 // Cancel the menu's collapseAll on document click 13611 this.menuInstance._closeOnDocumentClick = function () { 13612 return false; 13613 }; 13614 13615 // Selects often contain empty items, but never contain dividers 13616 this.menuInstance._isDivider = function () { 13617 return false; 13618 }; 13619 }, 13620 13621 refresh: function () { 13622 this._refreshMenu(); 13623 this.buttonItem.replaceWith( 13624 this.buttonItem = this._renderButtonItem( 13625 13626 // Fall back to an empty object in case there are no options 13627 this._getSelectedItem().data("ui-selectmenu-item") || {} 13628 ) 13629 ); 13630 if (this.options.width === null) { 13631 this._resizeButton(); 13632 } 13633 }, 13634 13635 _refreshMenu: function () { 13636 var item, 13637 options = this.element.find("option"); 13638 13639 this.menu.empty(); 13640 13641 this._parseOptions(options); 13642 this._renderMenu(this.menu, this.items); 13643 13644 this.menuInstance.refresh(); 13645 this.menuItems = this.menu.find("li") 13646 .not(".ui-selectmenu-optgroup") 13647 .find(".ui-menu-item-wrapper"); 13648 13649 this._rendered = true; 13650 13651 if (!options.length) { 13652 return; 13653 } 13654 13655 item = this._getSelectedItem(); 13656 13657 // Update the menu to have the correct item focused 13658 this.menuInstance.focus(null, item); 13659 this._setAria(item.data("ui-selectmenu-item")); 13660 13661 // Set disabled state 13662 this._setOption("disabled", this.element.prop("disabled")); 13663 }, 13664 13665 open: function (event) { 13666 if (this.options.disabled) { 13667 return; 13668 } 13669 13670 // If this is the first time the menu is being opened, render the items 13671 if (!this._rendered) { 13672 this._refreshMenu(); 13673 } else { 13674 // Menu clears focus on close, reset focus to selected item 13675 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 13676 this.menuInstance.focus(null, this._getSelectedItem()); 13677 } 13678 13679 // If there are no options, don't open the menu 13680 if (!this.menuItems.length) { 13681 return; 13682 } 13683 13684 this.isOpen = true; 13685 this._toggleAttr(); 13686 this._resizeMenu(); 13687 this._position(); 13688 13689 this._on(this.document, this._documentClick); 13690 13691 this._trigger("open", event); 13692 }, 13693 13694 _position: function () { 13695 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 13696 }, 13697 13698 close: function (event) { 13699 if (!this.isOpen) { 13700 return; 13701 } 13702 13703 this.isOpen = false; 13704 this._toggleAttr(); 13705 13706 this.range = null; 13707 this._off(this.document); 13708 13709 this._trigger("close", event); 13710 }, 13711 13712 widget: function () { 13713 return this.button; 13714 }, 13715 13716 menuWidget: function () { 13717 return this.menu; 13718 }, 13719 13720 _renderButtonItem: function (item) { 13721 var buttonItem = $("<span>"); 13722 13723 this._setText(buttonItem, item.label); 13724 this._addClass(buttonItem, "ui-selectmenu-text"); 13725 13726 return buttonItem; 13727 }, 13728 13729 _renderMenu: function (ul, items) { 13730 var that = this, 13731 currentOptgroup = ""; 13732 13733 $.each(items, function (index, item) { 13734 var li; 13735 13736 if (item.optgroup !== currentOptgroup) { 13737 li = $("<li>", { 13738 text: item.optgroup 13739 }); 13740 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13741 (item.element.parent("optgroup").prop("disabled") ? 13742 " ui-state-disabled" : 13743 "")); 13744 13745 li.appendTo(ul); 13746 13747 currentOptgroup = item.optgroup; 13748 } 13749 13750 that._renderItemData(ul, item); 13751 }); 13752 }, 13753 13754 _renderItemData: function (ul, item) { 13755 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 13756 }, 13757 13758 _renderItem: function (ul, item) { 13759 var li = $("<li>"), 13760 wrapper = $("<div>", { 13761 title: item.element.attr("title") 13762 }); 13763 13764 if (item.disabled) { 13765 this._addClass(li, null, "ui-state-disabled"); 13766 } 13767 this._setText(wrapper, item.label); 13768 13769 return li.append(wrapper).appendTo(ul); 13770 }, 13771 13772 _setText: function (element, value) { 13773 if (value) { 13774 element.text(value); 13775 } else { 13776 element.html(" "); 13777 } 13778 }, 13779 13780 _move: function (direction, event) { 13781 var item, next, 13782 filter = ".ui-menu-item"; 13783 13784 if (this.isOpen) { 13785 item = this.menuItems.eq(this.focusIndex).parent("li"); 13786 } else { 13787 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13788 filter += ":not(.ui-state-disabled)"; 13789 } 13790 13791 if (direction === "first" || direction === "last") { 13792 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 13793 } else { 13794 next = item[direction + "All"](filter).eq(0); 13795 } 13796 13797 if (next.length) { 13798 this.menuInstance.focus(event, next); 13799 } 13800 }, 13801 13802 _getSelectedItem: function () { 13803 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 13804 }, 13805 13806 _toggle: function (event) { 13807 this[this.isOpen ? "close" : "open"](event); 13808 }, 13809 13810 _setSelection: function () { 13811 var selection; 13812 13813 if (!this.range) { 13814 return; 13815 } 13816 13817 if (window.getSelection) { 13818 selection = window.getSelection(); 13819 selection.removeAllRanges(); 13820 selection.addRange(this.range); 13821 13822 // Support: IE8 13823 } else { 13824 this.range.select(); 13825 } 13826 13827 // Support: IE 13828 // Setting the text selection kills the button focus in IE, but 13829 // restoring the focus doesn't kill the selection. 13830 this.button.focus(); 13831 }, 13832 13833 _documentClick: { 13834 mousedown: function (event) { 13835 if (!this.isOpen) { 13836 return; 13837 } 13838 13839 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 13840 $.ui.escapeSelector(this.ids.button)).length) { 13841 this.close(event); 13842 } 13843 } 13844 }, 13845 13846 _buttonEvents: { 13847 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13848 mousedown: function () { 13849 var selection; 13850 13851 if (window.getSelection) { 13852 selection = window.getSelection(); 13853 if (selection.rangeCount) { 13854 this.range = selection.getRangeAt(0); 13855 } 13856 13857 // Support: IE8 13858 } else { 13859 this.range = document.selection.createRange(); 13860 } 13861 }, 13862 13863 click: function (event) { 13864 this._setSelection(); 13865 this._toggle(event); 13866 }, 13867 13868 keydown: function (event) { 13869 var preventDefault = true; 13870 switch (event.keyCode) { 13871 case $.ui.keyCode.TAB: 13872 case $.ui.keyCode.ESCAPE: 13873 this.close(event); 13874 preventDefault = false; 13875 break; 13876 case $.ui.keyCode.ENTER: 13877 if (this.isOpen) { 13878 this._selectFocusedItem(event); 13879 } 13880 break; 13881 case $.ui.keyCode.UP: 13882 if (event.altKey) { 13883 this._toggle(event); 13884 } else { 13885 this._move("prev", event); 13886 } 13887 break; 13888 case $.ui.keyCode.DOWN: 13889 if (event.altKey) { 13890 this._toggle(event); 13891 } else { 13892 this._move("next", event); 13893 } 13894 break; 13895 case $.ui.keyCode.SPACE: 13896 if (this.isOpen) { 13897 this._selectFocusedItem(event); 13898 } else { 13899 this._toggle(event); 13900 } 13901 break; 13902 case $.ui.keyCode.LEFT: 13903 this._move("prev", event); 13904 break; 13905 case $.ui.keyCode.RIGHT: 13906 this._move("next", event); 13907 break; 13908 case $.ui.keyCode.HOME: 13909 case $.ui.keyCode.PAGE_UP: 13910 this._move("first", event); 13911 break; 13912 case $.ui.keyCode.END: 13913 case $.ui.keyCode.PAGE_DOWN: 13914 this._move("last", event); 13915 break; 13916 default: 13917 this.menu.trigger(event); 13918 preventDefault = false; 13919 } 13920 13921 if (preventDefault) { 13922 event.preventDefault(); 13923 } 13924 } 13925 }, 13926 13927 _selectFocusedItem: function (event) { 13928 var item = this.menuItems.eq(this.focusIndex).parent("li"); 13929 if (!item.hasClass("ui-state-disabled")) { 13930 this._select(item.data("ui-selectmenu-item"), event); 13931 } 13932 }, 13933 13934 _select: function (item, event) { 13935 var oldIndex = this.element[0].selectedIndex; 13936 13937 // Change native select element 13938 this.element[0].selectedIndex = item.index; 13939 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 13940 this._setAria(item); 13941 this._trigger("select", event, { item: item }); 13942 13943 if (item.index !== oldIndex) { 13944 this._trigger("change", event, { item: item }); 13945 } 13946 13947 this.close(event); 13948 }, 13949 13950 _setAria: function (item) { 13951 var id = this.menuItems.eq(item.index).attr("id"); 13952 13953 this.button.attr({ 13954 "aria-labelledby": id, 13955 "aria-activedescendant": id 13956 }); 13957 this.menu.attr("aria-activedescendant", id); 13958 }, 13959 13960 _setOption: function (key, value) { 13961 if (key === "icons") { 13962 var icon = this.button.find("span.ui-icon"); 13963 this._removeClass(icon, null, this.options.icons.button) 13964 ._addClass(icon, null, value.button); 13965 } 13966 13967 this._super(key, value); 13968 13969 if (key === "appendTo") { 13970 this.menuWrap.appendTo(this._appendTo()); 13971 } 13972 13973 if (key === "width") { 13974 this._resizeButton(); 13975 } 13976 }, 13977 13978 _setOptionDisabled: function (value) { 13979 this._super(value); 13980 13981 this.menuInstance.option("disabled", value); 13982 this.button.attr("aria-disabled", value); 13983 this._toggleClass(this.button, null, "ui-state-disabled", value); 13984 13985 this.element.prop("disabled", value); 13986 if (value) { 13987 this.button.attr("tabindex", -1); 13988 this.close(); 13989 } else { 13990 this.button.attr("tabindex", 0); 13991 } 13992 }, 13993 13994 _appendTo: function () { 13995 var element = this.options.appendTo; 13996 13997 if (element) { 13998 element = element.jquery || element.nodeType ? 13999 $(element) : 14000 this.document.find(element).eq(0); 14001 } 14002 14003 if (!element || !element[0]) { 14004 element = this.element.closest(".ui-front, dialog"); 14005 } 14006 14007 if (!element.length) { 14008 element = this.document[0].body; 14009 } 14010 14011 return element; 14012 }, 14013 14014 _toggleAttr: function () { 14015 this.button.attr("aria-expanded", this.isOpen); 14016 14017 // We can't use two _toggleClass() calls here, because we need to make sure 14018 // we always remove classes first and add them second, otherwise if both classes have the 14019 // same theme class, it will be removed after we add it. 14020 this._removeClass(this.button, "ui-selectmenu-button-" + 14021 (this.isOpen ? "closed" : "open")) 14022 ._addClass(this.button, "ui-selectmenu-button-" + 14023 (this.isOpen ? "open" : "closed")) 14024 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 14025 14026 this.menu.attr("aria-hidden", !this.isOpen); 14027 }, 14028 14029 _resizeButton: function () { 14030 var width = this.options.width; 14031 14032 // For `width: false`, just remove inline style and stop 14033 if (width === false) { 14034 this.button.css("width", ""); 14035 return; 14036 } 14037 14038 // For `width: null`, match the width of the original element 14039 if (width === null) { 14040 width = this.element.show().outerWidth(); 14041 this.element.hide(); 14042 } 14043 14044 this.button.outerWidth(width); 14045 }, 14046 14047 _resizeMenu: function () { 14048 this.menu.outerWidth(Math.max( 14049 this.button.outerWidth(), 14050
vendor: 4,115 bytes, lines 14051-14211
14051 // Support: IE10 14052 // IE10 wraps long text (possibly a rounding bug) 14053 // so we add 1px to avoid the wrapping 14054 this.menu.width("").outerWidth() + 1 14055 )); 14056 }, 14057 14058 _getCreateOptions: function () { 14059 var options = this._super(); 14060 14061 options.disabled = this.element.prop("disabled"); 14062 14063 return options; 14064 }, 14065 14066 _parseOptions: function (options) { 14067 var that = this, 14068 data = []; 14069 options.each(function (index, item) { 14070 data.push(that._parseOption($(item), index)); 14071 }); 14072 this.items = data; 14073 }, 14074 14075 _parseOption: function (option, index) { 14076 var optgroup = option.parent("optgroup"); 14077 14078 return { 14079 element: option, 14080 index: index, 14081 value: option.val(), 14082 label: option.text(), 14083 optgroup: optgroup.attr("label") || "", 14084 disabled: optgroup.prop("disabled") || option.prop("disabled") 14085 }; 14086 }, 14087 14088 _destroy: function () { 14089 this._unbindFormResetHandler(); 14090 this.menuWrap.remove(); 14091 this.button.remove(); 14092 this.element.show(); 14093 this.element.removeUniqueId(); 14094 this.labels.attr("for", this.ids.element); 14095 } 14096 }]); 14097 14098 /*! 14099 * jQuery UI Slider 1.12.1 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: Slider 14108 //>>group: Widgets 14109 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 14110 //>>docs: http://api.jqueryui.com/slider/ 14111 //>>demos: http://jqueryui.com/slider/ 14112 //>>css.structure: ../../themes/base/core.css 14113 //>>css.structure: ../../themes/base/slider.css 14114 //>>css.theme: ../../themes/base/theme.css 14115 14116 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 14117 version: "1.12.1", 14118 widgetEventPrefix: "slide", 14119 14120 options: { 14121 animate: false, 14122 classes: { 14123 "ui-slider": "ui-corner-all", 14124 "ui-slider-handle": "ui-corner-all", 14125 14126 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 14127 // element, but worked best visually with a variety of themes 14128 "ui-slider-range": "ui-corner-all ui-widget-header" 14129 }, 14130 distance: 0, 14131 max: 100, 14132 min: 0, 14133 orientation: "horizontal", 14134 range: false, 14135 step: 1, 14136 value: 0, 14137 values: null, 14138 14139 // Callbacks 14140 change: null, 14141 slide: null, 14142 start: null, 14143 stop: null 14144 }, 14145 14146 // Number of pages in a slider 14147 // (how many times can you page up/down to go through the whole range) 14148 numPages: 5, 14149 14150 _create: function () { 14151 this._keySliding = false; 14152 this._mouseSliding = false; 14153 this._animateOff = true; 14154 this._handleIndex = null; 14155 this._detectOrientation(); 14156 this._mouseInit(); 14157 this._calculateNewMax(); 14158 14159 this._addClass("ui-slider ui-slider-" + this.orientation, 14160 "ui-widget ui-widget-content"); 14161 14162 this._refresh(); 14163 14164 this._animateOff = false; 14165 }, 14166 14167 _refresh: function () { 14168 this._createRange(); 14169 this._createHandles(); 14170 this._setupEvents(); 14171 this._refreshValue(); 14172 }, 14173 14174 _createHandles: function () { 14175 var i, handleCount, 14176 options = this.options, 14177 existingHandles = this.element.find(".ui-slider-handle"), 14178 handle = "<span tabindex='0'></span>", 14179 handles = []; 14180 14181 handleCount = (options.values && options.values.length) || 1; 14182 14183 if (existingHandles.length > handleCount) { 14184 existingHandles.slice(handleCount).remove(); 14185 existingHandles = existingHandles.slice(0, handleCount); 14186 } 14187 14188 for (i = existingHandles.length; i < handleCount; i++) { 14189 handles.push(handle); 14190 } 14191 14192 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 14193 14194 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 14195 14196 this.handle = this.handles.eq(0); 14197 14198 this.handles.each(function (i) { 14199 $(this) 14200 .data("ui-slider-handle-index", i) 14201 .attr("tabIndex", 0); 14202 }); 14203 }, 14204 14205 _createRange: function () { 14206 var options = this.options; 14207 14208 if (options.range) { 14209 if (options.range === true) { 14210 if (!options.values) { 14211 options.values = [this._valueMin(), this._valueMin()];
vendor: 18,795 bytes, lines 14212-14901
14212 } else if (options.values.length && options.values.length !== 2) { 14213 options.values = [options.values[0], options.values[0]]; 14214 } else if ($.isArray(options.values)) { 14215 options.values = options.values.slice(0); 14216 } 14217 } 14218 14219 if (!this.range || !this.range.length) { 14220 this.range = $("<div>") 14221 .appendTo(this.element); 14222 14223 this._addClass(this.range, "ui-slider-range"); 14224 } else { 14225 this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"); 14226 14227 // Handle range switching from true to min/max 14228 this.range.css({ 14229 "left": "", 14230 "bottom": "" 14231 }); 14232 } 14233 if (options.range === "min" || options.range === "max") { 14234 this._addClass(this.range, "ui-slider-range-" + options.range); 14235 } 14236 } else { 14237 if (this.range) { 14238 this.range.remove(); 14239 } 14240 this.range = null; 14241 } 14242 }, 14243 14244 _setupEvents: function () { 14245 this._off(this.handles); 14246 this._on(this.handles, this._handleEvents); 14247 this._hoverable(this.handles); 14248 this._focusable(this.handles); 14249 }, 14250 14251 _destroy: function () { 14252 this.handles.remove(); 14253 if (this.range) { 14254 this.range.remove(); 14255 } 14256 14257 this._mouseDestroy(); 14258 }, 14259 14260 _mouseCapture: function (event) { 14261 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 14262 that = this, 14263 o = this.options; 14264 14265 if (o.disabled) { 14266 return false; 14267 } 14268 14269 this.elementSize = { 14270 width: this.element.outerWidth(), 14271 height: this.element.outerHeight() 14272 }; 14273 this.elementOffset = this.element.offset(); 14274 14275 position = { x: event.pageX, y: event.pageY }; 14276 normValue = this._normValueFromMouse(position); 14277 distance = this._valueMax() - this._valueMin() + 1; 14278 this.handles.each(function (i) { 14279 var thisDistance = Math.abs(normValue - that.values(i)); 14280 if ((distance > thisDistance) || 14281 (distance === thisDistance && 14282 (i === that._lastChangedValue || that.values(i) === o.min))) { 14283 distance = thisDistance; 14284 closestHandle = $(this); 14285 index = i; 14286 } 14287 }); 14288 14289 allowed = this._start(event, index); 14290 if (allowed === false) { 14291 return false; 14292 } 14293 this._mouseSliding = true; 14294 14295 this._handleIndex = index; 14296 14297 this._addClass(closestHandle, null, "ui-state-active"); 14298 closestHandle.trigger("focus"); 14299 14300 offset = closestHandle.offset(); 14301 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 14302 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 14303 left: event.pageX - offset.left - (closestHandle.width() / 2), 14304 top: event.pageY - offset.top - 14305 (closestHandle.height() / 2) - 14306 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 14307 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 14308 (parseInt(closestHandle.css("marginTop"), 10) || 0) 14309 }; 14310 14311 if (!this.handles.hasClass("ui-state-hover")) { 14312 this._slide(event, index, normValue); 14313 } 14314 this._animateOff = true; 14315 return true; 14316 }, 14317 14318 _mouseStart: function () { 14319 return true; 14320 }, 14321 14322 _mouseDrag: function (event) { 14323 var position = { x: event.pageX, y: event.pageY }, 14324 normValue = this._normValueFromMouse(position); 14325 14326 this._slide(event, this._handleIndex, normValue); 14327 14328 return false; 14329 }, 14330 14331 _mouseStop: function (event) { 14332 this._removeClass(this.handles, null, "ui-state-active"); 14333 this._mouseSliding = false; 14334 14335 this._stop(event, this._handleIndex); 14336 this._change(event, this._handleIndex); 14337 14338 this._handleIndex = null; 14339 this._clickOffset = null; 14340 this._animateOff = false; 14341 14342 return false; 14343 }, 14344 14345 _detectOrientation: function () { 14346 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 14347 }, 14348 14349 _normValueFromMouse: function (position) { 14350 var pixelTotal, 14351 pixelMouse, 14352 percentMouse, 14353 valueTotal, 14354 valueMouse; 14355 14356 if (this.orientation === "horizontal") { 14357 pixelTotal = this.elementSize.width; 14358 pixelMouse = position.x - this.elementOffset.left - 14359 (this._clickOffset ? this._clickOffset.left : 0); 14360 } else { 14361 pixelTotal = this.elementSize.height; 14362 pixelMouse = position.y - this.elementOffset.top - 14363 (this._clickOffset ? this._clickOffset.top : 0); 14364 } 14365 14366 percentMouse = (pixelMouse / pixelTotal); 14367 if (percentMouse > 1) { 14368 percentMouse = 1; 14369 } 14370 if (percentMouse < 0) { 14371 percentMouse = 0; 14372 } 14373 if (this.orientation === "vertical") { 14374 percentMouse = 1 - percentMouse; 14375 } 14376 14377 valueTotal = this._valueMax() - this._valueMin(); 14378 valueMouse = this._valueMin() + percentMouse * valueTotal; 14379 14380 return this._trimAlignValue(valueMouse); 14381 }, 14382 14383 _uiHash: function (index, value, values) { 14384 var uiHash = { 14385 handle: this.handles[index], 14386 handleIndex: index, 14387 value: value !== undefined ? value : this.value() 14388 }; 14389 14390 if (this._hasMultipleValues()) { 14391 uiHash.value = value !== undefined ? value : this.values(index); 14392 uiHash.values = values || this.values(); 14393 } 14394 14395 return uiHash; 14396 }, 14397 14398 _hasMultipleValues: function () { 14399 return this.options.values && this.options.values.length; 14400 }, 14401 14402 _start: function (event, index) { 14403 return this._trigger("start", event, this._uiHash(index)); 14404 }, 14405 14406 _slide: function (event, index, newVal) { 14407 var allowed, otherVal, 14408 currentValue = this.value(), 14409 newValues = this.values(); 14410 14411 if (this._hasMultipleValues()) { 14412 otherVal = this.values(index ? 0 : 1); 14413 currentValue = this.values(index); 14414 14415 if (this.options.values.length === 2 && this.options.range === true) { 14416 newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal); 14417 } 14418 14419 newValues[index] = newVal; 14420 } 14421 14422 if (newVal === currentValue) { 14423 return; 14424 } 14425 14426 allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); 14427 14428 // A slide can be canceled by returning false from the slide callback 14429 if (allowed === false) { 14430 return; 14431 } 14432 14433 if (this._hasMultipleValues()) { 14434 this.values(index, newVal); 14435 } else { 14436 this.value(newVal); 14437 } 14438 }, 14439 14440 _stop: function (event, index) { 14441 this._trigger("stop", event, this._uiHash(index)); 14442 }, 14443 14444 _change: function (event, index) { 14445 if (!this._keySliding && !this._mouseSliding) { 14446 //store the last changed value index for reference when handles overlap 14447 this._lastChangedValue = index; 14448 this._trigger("change", event, this._uiHash(index)); 14449 } 14450 }, 14451 14452 value: function (newValue) { 14453 if (arguments.length) { 14454 this.options.value = this._trimAlignValue(newValue); 14455 this._refreshValue(); 14456 this._change(null, 0); 14457 return; 14458 } 14459 14460 return this._value(); 14461 }, 14462 14463 values: function (index, newValue) { 14464 var vals, 14465 newValues, 14466 i; 14467 14468 if (arguments.length > 1) { 14469 this.options.values[index] = this._trimAlignValue(newValue); 14470 this._refreshValue(); 14471 this._change(null, index); 14472 return; 14473 } 14474 14475 if (arguments.length) { 14476 if ($.isArray(arguments[0])) { 14477 vals = this.options.values; 14478 newValues = arguments[0]; 14479 for (i = 0; i < vals.length; i += 1) { 14480 vals[i] = this._trimAlignValue(newValues[i]); 14481 this._change(null, i); 14482 } 14483 this._refreshValue(); 14484 } else { 14485 if (this._hasMultipleValues()) { 14486 return this._values(index); 14487 } else { 14488 return this.value(); 14489 } 14490 } 14491 } else { 14492 return this._values(); 14493 } 14494 }, 14495 14496 _setOption: function (key, value) { 14497 var i, 14498 valsLength = 0; 14499 14500 if (key === "range" && this.options.range === true) { 14501 if (value === "min") { 14502 this.options.value = this._values(0); 14503 this.options.values = null; 14504 } else if (value === "max") { 14505 this.options.value = this._values(this.options.values.length - 1); 14506 this.options.values = null; 14507 } 14508 } 14509 14510 if ($.isArray(this.options.values)) { 14511 valsLength = this.options.values.length; 14512 } 14513 14514 this._super(key, value); 14515 14516 switch (key) { 14517 case "orientation": 14518 this._detectOrientation(); 14519 this._removeClass("ui-slider-horizontal ui-slider-vertical") 14520 ._addClass("ui-slider-" + this.orientation); 14521 this._refreshValue(); 14522 if (this.options.range) { 14523 this._refreshRange(value); 14524 } 14525 14526 // Reset positioning from previous orientation 14527 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 14528 break; 14529 case "value": 14530 this._animateOff = true; 14531 this._refreshValue(); 14532 this._change(null, 0); 14533 this._animateOff = false; 14534 break; 14535 case "values": 14536 this._animateOff = true; 14537 this._refreshValue(); 14538 14539 // Start from the last handle to prevent unreachable handles (#9046) 14540 for (i = valsLength - 1; i >= 0; i--) { 14541 this._change(null, i); 14542 } 14543 this._animateOff = false; 14544 break; 14545 case "step": 14546 case "min": 14547 case "max": 14548 this._animateOff = true; 14549 this._calculateNewMax(); 14550 this._refreshValue(); 14551 this._animateOff = false; 14552 break; 14553 case "range": 14554 this._animateOff = true; 14555 this._refresh(); 14556 this._animateOff = false; 14557 break; 14558 } 14559 }, 14560 14561 _setOptionDisabled: function (value) { 14562 this._super(value); 14563 14564 this._toggleClass(null, "ui-state-disabled", !!value); 14565 }, 14566 14567 //internal value getter 14568 // _value() returns value trimmed by min and max, aligned by step 14569 _value: function () { 14570 var val = this.options.value; 14571 val = this._trimAlignValue(val); 14572 14573 return val; 14574 }, 14575 14576 //internal values getter 14577 // _values() returns array of values trimmed by min and max, aligned by step 14578 // _values( index ) returns single value trimmed by min and max, aligned by step 14579 _values: function (index) { 14580 var val, 14581 vals, 14582 i; 14583 14584 if (arguments.length) { 14585 val = this.options.values[index]; 14586 val = this._trimAlignValue(val); 14587 14588 return val; 14589 } else if (this._hasMultipleValues()) { 14590 // .slice() creates a copy of the array 14591 // this copy gets trimmed by min and max and then returned 14592 vals = this.options.values.slice(); 14593 for (i = 0; i < vals.length; i += 1) { 14594 vals[i] = this._trimAlignValue(vals[i]); 14595 } 14596 14597 return vals; 14598 } else { 14599 return []; 14600 } 14601 }, 14602 14603 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 14604 _trimAlignValue: function (val) { 14605 if (val <= this._valueMin()) { 14606 return this._valueMin(); 14607 } 14608 if (val >= this._valueMax()) { 14609 return this._valueMax(); 14610 } 14611 var step = (this.options.step > 0) ? this.options.step : 1, 14612 valModStep = (val - this._valueMin()) % step, 14613 alignValue = val - valModStep; 14614 14615 if (Math.abs(valModStep) * 2 >= step) { 14616 alignValue += (valModStep > 0) ? step : (-step); 14617 } 14618 14619 // Since JavaScript has problems with large floats, round 14620 // the final value to 5 digits after the decimal point (see #4124) 14621 return parseFloat(alignValue.toFixed(5)); 14622 }, 14623 14624 _calculateNewMax: function () { 14625 var max = this.options.max, 14626 min = this._valueMin(), 14627 step = this.options.step, 14628 aboveMin = Math.round((max - min) / step) * step; 14629 max = aboveMin + min; 14630 if (max > this.options.max) { 14631 //If max is not divisible by step, rounding off may increase its value 14632 max -= step; 14633 } 14634 this.max = parseFloat(max.toFixed(this._precision())); 14635 }, 14636 14637 _precision: function () { 14638 var precision = this._precisionOf(this.options.step); 14639 if (this.options.min !== null) { 14640 precision = Math.max(precision, this._precisionOf(this.options.min)); 14641 } 14642 return precision; 14643 }, 14644 14645 _precisionOf: function (num) { 14646 var str = num.toString(), 14647 decimal = str.indexOf("."); 14648 return decimal === -1 ? 0 : str.length - decimal - 1; 14649 }, 14650 14651 _valueMin: function () { 14652 return this.options.min; 14653 }, 14654 14655 _valueMax: function () { 14656 return this.max; 14657 }, 14658 14659 _refreshRange: function (orientation) { 14660 if (orientation === "vertical") { 14661 this.range.css({ "width": "", "left": "" }); 14662 } 14663 if (orientation === "horizontal") { 14664 this.range.css({ "height": "", "bottom": "" }); 14665 } 14666 }, 14667 14668 _refreshValue: function () { 14669 var lastValPercent, valPercent, value, valueMin, valueMax, 14670 oRange = this.options.range, 14671 o = this.options, 14672 that = this, 14673 animate = (!this._animateOff) ? o.animate : false, 14674 _set = {}; 14675 14676 if (this._hasMultipleValues()) { 14677 this.handles.each(function (i) { 14678 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - 14679 that._valueMin()) * 100; 14680 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14681 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14682 if (that.options.range === true) { 14683 if (that.orientation === "horizontal") { 14684 if (i === 0) { 14685 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14686 left: valPercent + "%" 14687 }, o.animate); 14688 } 14689 if (i === 1) { 14690 that.range[animate ? "animate" : "css"]({ 14691 width: (valPercent - lastValPercent) + "%" 14692 }, { 14693 queue: false, 14694 duration: o.animate 14695 }); 14696 } 14697 } else { 14698 if (i === 0) { 14699 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 14700 bottom: (valPercent) + "%" 14701 }, o.animate); 14702 } 14703 if (i === 1) { 14704 that.range[animate ? "animate" : "css"]({ 14705 height: (valPercent - lastValPercent) + "%" 14706 }, { 14707 queue: false, 14708 duration: o.animate 14709 }); 14710 } 14711 } 14712 } 14713 lastValPercent = valPercent; 14714 }); 14715 } else { 14716 value = this.value(); 14717 valueMin = this._valueMin(); 14718 valueMax = this._valueMax(); 14719 valPercent = (valueMax !== valueMin) ? 14720 (value - valueMin) / (valueMax - valueMin) * 100 : 14721 0; 14722 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 14723 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 14724 14725 if (oRange === "min" && this.orientation === "horizontal") { 14726 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14727 width: valPercent + "%" 14728 }, o.animate); 14729 } 14730 if (oRange === "max" && this.orientation === "horizontal") { 14731 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14732 width: (100 - valPercent) + "%" 14733 }, o.animate); 14734 } 14735 if (oRange === "min" && this.orientation === "vertical") { 14736 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14737 height: valPercent + "%" 14738 }, o.animate); 14739 } 14740 if (oRange === "max" && this.orientation === "vertical") { 14741 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 14742 height: (100 - valPercent) + "%" 14743 }, o.animate); 14744 } 14745 } 14746 }, 14747 14748 _handleEvents: { 14749 keydown: function (event) { 14750 var allowed, curVal, newVal, step, 14751 index = $(event.target).data("ui-slider-handle-index"); 14752 14753 switch (event.keyCode) { 14754 case $.ui.keyCode.HOME: 14755 case $.ui.keyCode.END: 14756 case $.ui.keyCode.PAGE_UP: 14757 case $.ui.keyCode.PAGE_DOWN: 14758 case $.ui.keyCode.UP: 14759 case $.ui.keyCode.RIGHT: 14760 case $.ui.keyCode.DOWN: 14761 case $.ui.keyCode.LEFT: 14762 event.preventDefault(); 14763 if (!this._keySliding) { 14764 this._keySliding = true; 14765 this._addClass($(event.target), null, "ui-state-active"); 14766 allowed = this._start(event, index); 14767 if (allowed === false) { 14768 return; 14769 } 14770 } 14771 break; 14772 } 14773 14774 step = this.options.step; 14775 if (this._hasMultipleValues()) { 14776 curVal = newVal = this.values(index); 14777 } else { 14778 curVal = newVal = this.value(); 14779 } 14780 14781 switch (event.keyCode) { 14782 case $.ui.keyCode.HOME: 14783 newVal = this._valueMin(); 14784 break; 14785 case $.ui.keyCode.END: 14786 newVal = this._valueMax(); 14787 break; 14788 case $.ui.keyCode.PAGE_UP: 14789 newVal = this._trimAlignValue( 14790 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 14791 ); 14792 break; 14793 case $.ui.keyCode.PAGE_DOWN: 14794 newVal = this._trimAlignValue( 14795 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 14796 break; 14797 case $.ui.keyCode.UP: 14798 case $.ui.keyCode.RIGHT: 14799 if (curVal === this._valueMax()) { 14800 return; 14801 } 14802 newVal = this._trimAlignValue(curVal + step); 14803 break; 14804 case $.ui.keyCode.DOWN: 14805 case $.ui.keyCode.LEFT: 14806 if (curVal === this._valueMin()) { 14807 return; 14808 } 14809 newVal = this._trimAlignValue(curVal - step); 14810 break; 14811 } 14812 14813 this._slide(event, index, newVal); 14814 }, 14815 keyup: function (event) { 14816 var index = $(event.target).data("ui-slider-handle-index"); 14817 14818 if (this._keySliding) { 14819 this._keySliding = false; 14820 this._stop(event, index); 14821 this._change(event, index); 14822 this._removeClass($(event.target), null, "ui-state-active"); 14823 } 14824 } 14825 } 14826 }); 14827 14828 /*! 14829 * jQuery UI Sortable 1.12.1 14830 * http://jqueryui.com 14831 * 14832 * Copyright jQuery Foundation and other contributors 14833 * Released under the MIT license. 14834 * http://jquery.org/license 14835 */ 14836 14837 //>>label: Sortable 14838 //>>group: Interactions 14839 //>>description: Enables items in a list to be sorted using the mouse. 14840 //>>docs: http://api.jqueryui.com/sortable/ 14841 //>>demos: http://jqueryui.com/sortable/ 14842 //>>css.structure: ../../themes/base/sortable.css 14843 14844 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 14845 version: "1.12.1", 14846 widgetEventPrefix: "sort", 14847 ready: false, 14848 options: { 14849 appendTo: "parent", 14850 axis: false, 14851 connectWith: false, 14852 containment: false, 14853 cursor: "auto", 14854 cursorAt: false, 14855 dropOnEmpty: true, 14856 forcePlaceholderSize: false, 14857 forceHelperSize: false, 14858 grid: false, 14859 handle: false, 14860 helper: "original", 14861 items: "> *", 14862 opacity: false, 14863 placeholder: false, 14864 revert: false, 14865 scroll: true, 14866 scrollSensitivity: 20, 14867 scrollSpeed: 20, 14868 scope: "default", 14869 tolerance: "intersect", 14870 zIndex: 1000, 14871 14872 // Callbacks 14873 activate: null, 14874 beforeStop: null, 14875 change: null, 14876 deactivate: null, 14877 out: null, 14878 over: null, 14879 receive: null, 14880 remove: null, 14881 sort: null, 14882 start: null, 14883 stop: null, 14884 update: null 14885 }, 14886 14887 _isOverAxis: function (x, reference, size) { 14888 return (x >= reference) && (x < (reference + size)); 14889 }, 14890 14891 _isFloating: function (item) { 14892 return (/left|right/).test(item.css("float")) || 14893 (/inline|table-cell/).test(item.css("display")); 14894 }, 14895 14896 _create: function () { 14897 this.containerCache = {}; 14898 this._addClass("ui-sortable"); 14899 14900 //Get the items 14901 this.refresh();
vendor: 9,680 bytes, lines 14902-15220
14902 14903 //Let's determine the parent's offset 14904 this.offset = this.element.offset(); 14905 14906 //Initialize mouse events for interaction 14907 this._mouseInit(); 14908 14909 this._setHandleClassName(); 14910 14911 //We're ready to go 14912 this.ready = true; 14913 }, 14914 14915 _setOption: function (key, value) { 14916 this._super(key, value); 14917 14918 if (key === "handle") { 14919 this._setHandleClassName(); 14920 } 14921 }, 14922 14923 _setHandleClassName: function () { 14924 var that = this; 14925 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 14926 $.each(this.items, function () { 14927 that._addClass( 14928 this.instance.options.handle ? 14929 this.item.find(this.instance.options.handle) : 14930 this.item, 14931 "ui-sortable-handle" 14932 ); 14933 }); 14934 }, 14935 14936 _destroy: function () { 14937 this._mouseDestroy(); 14938 14939 for (var i = this.items.length - 1; i >= 0; i--) { 14940 this.items[i].item.removeData(this.widgetName + "-item"); 14941 } 14942 14943 return this; 14944 }, 14945 14946 _mouseCapture: function (event, overrideHandle) { 14947 var currentItem = null, 14948 validHandle = false, 14949 that = this; 14950 14951 if (this.reverting) { 14952 return false; 14953 } 14954 14955 if (this.options.disabled || this.options.type === "static") { 14956 return false; 14957 } 14958 14959 //We have to refresh the items data once first 14960 this._refreshItems(event); 14961 14962 //Find out if the clicked node (or one of its parents) is a actual item in this.items 14963 $(event.target).parents().each(function () { 14964 if ($.data(this, that.widgetName + "-item") === that) { 14965 currentItem = $(this); 14966 return false; 14967 } 14968 }); 14969 if ($.data(event.target, that.widgetName + "-item") === that) { 14970 currentItem = $(event.target); 14971 } 14972 14973 if (!currentItem) { 14974 return false; 14975 } 14976 if (this.options.handle && !overrideHandle) { 14977 $(this.options.handle, currentItem).find("*").addBack().each(function () { 14978 if (this === event.target) { 14979 validHandle = true; 14980 } 14981 }); 14982 if (!validHandle) { 14983 return false; 14984 } 14985 } 14986 14987 this.currentItem = currentItem; 14988 this._removeCurrentsFromItems(); 14989 return true; 14990 }, 14991 14992 _mouseStart: function (event, overrideHandle, noActivation) { 14993 var i, body, 14994 o = this.options; 14995 14996 this.currentContainer = this; 14997 14998 //We only need to call refreshPositions, because the refreshItems call has been moved to 14999 // mouseCapture 15000 this.refreshPositions(); 15001 15002 //Create and append the visible helper 15003 this.helper = this._createHelper(event); 15004 15005 //Cache the helper size 15006 this._cacheHelperProportions(); 15007 15008 /* 15009 * - Position generation - 15010 * This block generates everything position related - it's the core of draggables. 15011 */ 15012 15013 //Cache the margins of the original element 15014 this._cacheMargins(); 15015 15016 //Get the next scrolling parent 15017 this.scrollParent = this.helper.scrollParent(); 15018 15019 //The element's absolute position on the page minus margins 15020 this.offset = this.currentItem.offset(); 15021 this.offset = { 15022 top: this.offset.top - this.margins.top, 15023 left: this.offset.left - this.margins.left 15024 }; 15025 15026 $.extend(this.offset, { 15027 click: { //Where the click happened, relative to the element 15028 left: event.pageX - this.offset.left, 15029 top: event.pageY - this.offset.top 15030 }, 15031 parent: this._getParentOffset(), 15032 15033 // This is a relative to absolute position minus the actual position calculation - 15034 // only used for relative positioned helper 15035 relative: this._getRelativeOffset() 15036 }); 15037 15038 // Only after we got the offset, we can change the helper's position to absolute 15039 // TODO: Still need to figure out a way to make relative sorting possible 15040 this.helper.css("position", "absolute"); 15041 this.cssPosition = this.helper.css("position"); 15042 15043 //Generate the original position 15044 this.originalPosition = this._generatePosition(event); 15045 this.originalPageX = event.pageX; 15046 this.originalPageY = event.pageY; 15047 15048 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 15049 (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 15050 15051 //Cache the former DOM position 15052 this.domPosition = { 15053 prev: this.currentItem.prev()[0], 15054 parent: this.currentItem.parent()[0] 15055 }; 15056 15057 // If the helper is not the original, hide the original so it's not playing any role during 15058 // the drag, won't cause anything bad this way 15059 if (this.helper[0] !== this.currentItem[0]) { 15060 this.currentItem.hide(); 15061 } 15062 15063 //Create the placeholder 15064 this._createPlaceholder(); 15065 15066 //Set a containment if given in the options 15067 if (o.containment) { 15068 this._setContainment(); 15069 } 15070 15071 if (o.cursor && o.cursor !== "auto") { // cursor option 15072 body = this.document.find("body"); 15073 15074 // Support: IE 15075 this.storedCursor = body.css("cursor"); 15076 body.css("cursor", o.cursor); 15077 15078 this.storedStylesheet = 15079 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 15080 } 15081 15082 if (o.opacity) { // opacity option 15083 if (this.helper.css("opacity")) { 15084 this._storedOpacity = this.helper.css("opacity"); 15085 } 15086 this.helper.css("opacity", o.opacity); 15087 } 15088 15089 if (o.zIndex) { // zIndex option 15090 if (this.helper.css("zIndex")) { 15091 this._storedZIndex = this.helper.css("zIndex"); 15092 } 15093 this.helper.css("zIndex", o.zIndex); 15094 } 15095 15096 //Prepare scrolling 15097 if (this.scrollParent[0] !== this.document[0] && 15098 this.scrollParent[0].tagName !== "HTML") { 15099 this.overflowOffset = this.scrollParent.offset(); 15100 } 15101 15102 //Call callbacks 15103 this._trigger("start", event, this._uiHash()); 15104 15105 //Recache the helper size 15106 if (!this._preserveHelperProportions) { 15107 this._cacheHelperProportions(); 15108 } 15109 15110 //Post "activate" events to possible containers 15111 if (!noActivation) { 15112 for (i = this.containers.length - 1; i >= 0; i--) { 15113 this.containers[i]._trigger("activate", event, this._uiHash(this)); 15114 } 15115 } 15116 15117 //Prepare possible droppables 15118 if ($.ui.ddmanager) { 15119 $.ui.ddmanager.current = this; 15120 } 15121 15122 if ($.ui.ddmanager && !o.dropBehaviour) { 15123 $.ui.ddmanager.prepareOffsets(this, event); 15124 } 15125 15126 this.dragging = true; 15127 15128 this._addClass(this.helper, "ui-sortable-helper"); 15129 15130 // Execute the drag once - this causes the helper not to be visiblebefore getting its 15131 // correct position 15132 this._mouseDrag(event); 15133 return true; 15134 }, 15135 15136 _mouseDrag: function (event) { 15137 var i, item, itemElement, intersection, 15138 o = this.options, 15139 scrolled = false; 15140 15141 //Compute the helpers position 15142 this.position = this._generatePosition(event); 15143 this.positionAbs = this._convertPositionTo("absolute"); 15144 15145 if (!this.lastPositionAbs) { 15146 this.lastPositionAbs = this.positionAbs; 15147 } 15148 15149 //Do scrolling 15150 if (this.options.scroll) { 15151 if (this.scrollParent[0] !== this.document[0] && 15152 this.scrollParent[0].tagName !== "HTML") { 15153 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 15154 event.pageY < o.scrollSensitivity) { 15155 this.scrollParent[0].scrollTop = 15156 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 15157 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 15158 this.scrollParent[0].scrollTop = 15159 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 15160 } 15161 15162 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 15163 event.pageX < o.scrollSensitivity) { 15164 this.scrollParent[0].scrollLeft = scrolled = 15165 this.scrollParent[0].scrollLeft + o.scrollSpeed; 15166 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 15167 this.scrollParent[0].scrollLeft = scrolled = 15168 this.scrollParent[0].scrollLeft - o.scrollSpeed; 15169 } 15170 } else { 15171 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 15172 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 15173 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 15174 o.scrollSensitivity) { 15175 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 15176 } 15177 15178 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 15179 scrolled = this.document.scrollLeft( 15180 this.document.scrollLeft() - o.scrollSpeed 15181 ); 15182 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 15183 o.scrollSensitivity) { 15184 scrolled = this.document.scrollLeft( 15185 this.document.scrollLeft() + o.scrollSpeed 15186 ); 15187 } 15188 } 15189 15190 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 15191 $.ui.ddmanager.prepareOffsets(this, event); 15192 } 15193 } 15194 15195 //Regenerate the absolute position used for position checks 15196 this.positionAbs = this._convertPositionTo("absolute"); 15197 15198 //Set the helper position 15199 if (!this.options.axis || this.options.axis !== "y") { 15200 this.helper[0].style.left = this.position.left + "px"; 15201 } 15202 if (!this.options.axis || this.options.axis !== "x") { 15203 this.helper[0].style.top = this.position.top + "px"; 15204 } 15205 15206 //Rearrange 15207 for (i = this.items.length - 1; i >= 0; i--) { 15208 //Cache variables and intersection, continue if no intersection 15209 item = this.items[i]; 15210 itemElement = item.item[0]; 15211 intersection = this._intersectsWithPointer(item); 15212 if (!intersection) { 15213 continue; 15214 } 15215 15216 // Only put the placeholder inside the current Container, skip all 15217 // items from other containers. This works because when moving 15218 // an item from one container to another the 15219 // currentContainer is switched before the placeholder is moved. 15220 //
vendor: 4,588 bytes, lines 15221-15388
15221 // Without this, moving items in "sub-sortables" can cause 15222 // the placeholder to jitter between the outer and inner container. 15223 if (item.instance !== this.currentContainer) { 15224 continue; 15225 } 15226 15227 // Cannot intersect with itself 15228 // no useless actions that have been done before 15229 // no action if the item moved is the parent of the item checked 15230 if (itemElement !== this.currentItem[0] && 15231 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && 15232 !$.contains(this.placeholder[0], itemElement) && 15233 (this.options.type === "semi-dynamic" ? 15234 !$.contains(this.element[0], itemElement) : 15235 true 15236 ) 15237 ) { 15238 this.direction = intersection === 1 ? "down" : "up"; 15239 15240 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { 15241 this._rearrange(event, item); 15242 } else { 15243 break; 15244 } 15245 15246 this._trigger("change", event, this._uiHash()); 15247 break; 15248 } 15249 } 15250 15251 //Post events to containers 15252 this._contactContainers(event); 15253 15254 //Interconnect with droppables 15255 if ($.ui.ddmanager) { 15256 $.ui.ddmanager.drag(this, event); 15257 } 15258 15259 //Call callbacks 15260 this._trigger("sort", event, this._uiHash()); 15261 15262 this.lastPositionAbs = this.positionAbs; 15263 return false; 15264 }, 15265 15266 _mouseStop: function (event, noPropagation) { 15267 if (!event) { 15268 return; 15269 } 15270 15271 //If we are using droppables, inform the manager about the drop 15272 if ($.ui.ddmanager && !this.options.dropBehaviour) { 15273 $.ui.ddmanager.drop(this, event); 15274 } 15275 15276 if (this.options.revert) { 15277 var that = this, 15278 cur = this.placeholder.offset(), 15279 axis = this.options.axis, 15280 animation = {}; 15281 15282 if (!axis || axis === "x") { 15283 animation.left = cur.left - this.offset.parent.left - this.margins.left + 15284 (this.offsetParent[0] === this.document[0].body ? 15285 0 : 15286 this.offsetParent[0].scrollLeft 15287 ); 15288 } 15289 if (!axis || axis === "y") { 15290 animation.top = cur.top - this.offset.parent.top - this.margins.top + 15291 (this.offsetParent[0] === this.document[0].body ? 15292 0 : 15293 this.offsetParent[0].scrollTop 15294 ); 15295 } 15296 this.reverting = true; 15297 $(this.helper).animate( 15298 animation, 15299 parseInt(this.options.revert, 10) || 500, 15300 function () { 15301 that._clear(event); 15302 } 15303 ); 15304 } else { 15305 this._clear(event, noPropagation); 15306 } 15307 15308 return false; 15309 }, 15310 15311 cancel: function () { 15312 if (this.dragging) { 15313 this._mouseUp(new $.Event("mouseup", { target: null })); 15314 15315 if (this.options.helper === "original") { 15316 this.currentItem.css(this._storedCSS); 15317 this._removeClass(this.currentItem, "ui-sortable-helper"); 15318 } else { 15319 this.currentItem.show(); 15320 } 15321 15322 //Post deactivating events to containers 15323 for (var i = this.containers.length - 1; i >= 0; i--) { 15324 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 15325 if (this.containers[i].containerCache.over) { 15326 this.containers[i]._trigger("out", null, this._uiHash(this)); 15327 this.containers[i].containerCache.over = 0; 15328 } 15329 } 15330 } 15331 15332 if (this.placeholder) { 15333 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 15334 // it unbinds ALL events from the original node! 15335 if (this.placeholder[0].parentNode) { 15336 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 15337 } 15338 if (this.options.helper !== "original" && this.helper && 15339 this.helper[0].parentNode) { 15340 this.helper.remove(); 15341 } 15342 15343 $.extend(this, { 15344 helper: null, 15345 dragging: false, 15346 reverting: false, 15347 _noFinalSort: null 15348 }); 15349 15350 if (this.domPosition.prev) { 15351 $(this.domPosition.prev).after(this.currentItem); 15352 } else { 15353 $(this.domPosition.parent).prepend(this.currentItem); 15354 } 15355 } 15356 15357 return this; 15358 }, 15359 15360 serialize: function (o) { 15361 var items = this._getItemsAsjQuery(o && o.connected), 15362 str = []; 15363 o = o || {}; 15364 15365 $(items).each(function () { 15366 var res = ($(o.item || this).attr(o.attribute || "id") || "") 15367 .match(o.expression || (/(.+)[\-=_](.+)/)); 15368 if (res) { 15369 str.push( 15370 (o.key || res[1] + "[]") + 15371 "=" + (o.key && o.expression ? res[1] : res[2])); 15372 } 15373 }); 15374 15375 if (!str.length && o.key) { 15376 str.push(o.key + "="); 15377 } 15378 15379 return str.join("&"); 15380 }, 15381 15382 toArray: function (o) { 15383 var items = this._getItemsAsjQuery(o && o.connected), 15384 ret = []; 15385 15386 o = o || {}; 15387 15388 items.each(function () {
vendor: 6,727 bytes, lines 15389-15585
15389 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 15390 }); 15391 return ret; 15392 }, 15393 15394 /* Be careful with the following core functions */ 15395 _intersectsWith: function (item) { 15396 var x1 = this.positionAbs.left, 15397 x2 = x1 + this.helperProportions.width, 15398 y1 = this.positionAbs.top, 15399 y2 = y1 + this.helperProportions.height, 15400 l = item.left, 15401 r = l + item.width, 15402 t = item.top, 15403 b = t + item.height, 15404 dyClick = this.offset.click.top, 15405 dxClick = this.offset.click.left, 15406 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 15407 (y1 + dyClick) < b), 15408 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 15409 (x1 + dxClick) < r), 15410 isOverElement = isOverElementHeight && isOverElementWidth; 15411 15412 if (this.options.tolerance === "pointer" || 15413 this.options.forcePointerForContainers || 15414 (this.options.tolerance !== "pointer" && 15415 this.helperProportions[this.floating ? "width" : "height"] > 15416 item[this.floating ? "width" : "height"]) 15417 ) { 15418 return isOverElement; 15419 } else { 15420 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 15421 x2 - (this.helperProportions.width / 2) < r && // Left Half 15422 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 15423 y2 - (this.helperProportions.height / 2) < b); // Top Half 15424 } 15425 }, 15426 15427 _intersectsWithPointer: function (item) { 15428 var verticalDirection, horizontalDirection, 15429 isOverElementHeight = (this.options.axis === "x") || 15430 this._isOverAxis( 15431 this.positionAbs.top + this.offset.click.top, item.top, item.height), 15432 isOverElementWidth = (this.options.axis === "y") || 15433 this._isOverAxis( 15434 this.positionAbs.left + this.offset.click.left, item.left, item.width), 15435 isOverElement = isOverElementHeight && isOverElementWidth; 15436 15437 if (!isOverElement) { 15438 return false; 15439 } 15440 15441 verticalDirection = this._getDragVerticalDirection(); 15442 horizontalDirection = this._getDragHorizontalDirection(); 15443 15444 return this.floating ? 15445 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) 15446 : (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 15447 }, 15448 15449 _intersectsWithSides: function (item) { 15450 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 15451 this.offset.click.top, item.top + (item.height / 2), item.height), 15452 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 15453 this.offset.click.left, item.left + (item.width / 2), item.width), 15454 verticalDirection = this._getDragVerticalDirection(), 15455 horizontalDirection = this._getDragHorizontalDirection(); 15456 15457 if (this.floating && horizontalDirection) { 15458 return ((horizontalDirection === "right" && isOverRightHalf) || 15459 (horizontalDirection === "left" && !isOverRightHalf)); 15460 } else { 15461 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 15462 (verticalDirection === "up" && !isOverBottomHalf)); 15463 } 15464 }, 15465 15466 _getDragVerticalDirection: function () { 15467 var delta = this.positionAbs.top - this.lastPositionAbs.top; 15468 return delta !== 0 && (delta > 0 ? "down" : "up"); 15469 }, 15470 15471 _getDragHorizontalDirection: function () { 15472 var delta = this.positionAbs.left - this.lastPositionAbs.left; 15473 return delta !== 0 && (delta > 0 ? "right" : "left"); 15474 }, 15475 15476 refresh: function (event) { 15477 this._refreshItems(event); 15478 this._setHandleClassName(); 15479 this.refreshPositions(); 15480 return this; 15481 }, 15482 15483 _connectWith: function () { 15484 var options = this.options; 15485 return options.connectWith.constructor === String ? 15486 [options.connectWith] : 15487 options.connectWith; 15488 }, 15489 15490 _getItemsAsjQuery: function (connected) { 15491 var i, j, cur, inst, 15492 items = [], 15493 queries = [], 15494 connectWith = this._connectWith(); 15495 15496 if (connectWith && connected) { 15497 for (i = connectWith.length - 1; i >= 0; i--) { 15498 cur = $(connectWith[i], this.document[0]); 15499 for (j = cur.length - 1; j >= 0; j--) { 15500 inst = $.data(cur[j], this.widgetFullName); 15501 if (inst && inst !== this && !inst.options.disabled) { 15502 queries.push([$.isFunction(inst.options.items) ? 15503 inst.options.items.call(inst.element) : 15504 $(inst.options.items, inst.element) 15505 .not(".ui-sortable-helper") 15506 .not(".ui-sortable-placeholder"), inst]); 15507 } 15508 } 15509 } 15510 } 15511 15512 queries.push([$.isFunction(this.options.items) ? 15513 this.options.items 15514 .call(this.element, null, { options: this.options, item: this.currentItem }) : 15515 $(this.options.items, this.element) 15516 .not(".ui-sortable-helper") 15517 .not(".ui-sortable-placeholder"), this]); 15518 15519 function addItems() { 15520 items.push(this); 15521 } 15522 for (i = queries.length - 1; i >= 0; i--) { 15523 queries[i][0].each(addItems); 15524 } 15525 15526 return $(items); 15527 }, 15528 15529 _removeCurrentsFromItems: function () { 15530 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 15531 15532 this.items = $.grep(this.items, function (item) { 15533 for (var j = 0; j < list.length; j++) { 15534 if (list[j] === item.item[0]) { 15535 return false; 15536 } 15537 } 15538 return true; 15539 }); 15540 }, 15541 15542 _refreshItems: function (event) { 15543 this.items = []; 15544 this.containers = [this]; 15545 15546 var i, j, cur, inst, targetData, _queries, item, queriesLength, 15547 items = this.items, 15548 queries = [[$.isFunction(this.options.items) ? 15549 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 15550 $(this.options.items, this.element), this]], 15551 connectWith = this._connectWith(); 15552 15553 //Shouldn't be run the first time through due to massive slow-down 15554 if (connectWith && this.ready) { 15555 for (i = connectWith.length - 1; i >= 0; i--) { 15556 cur = $(connectWith[i], this.document[0]); 15557 for (j = cur.length - 1; j >= 0; j--) { 15558 inst = $.data(cur[j], this.widgetFullName); 15559 if (inst && inst !== this && !inst.options.disabled) { 15560 queries.push([$.isFunction(inst.options.items) ? 15561 inst.options.items 15562 .call(inst.element[0], event, { item: this.currentItem }) : 15563 $(inst.options.items, inst.element), inst]); 15564 this.containers.push(inst); 15565 } 15566 } 15567 } 15568 } 15569 15570 for (i = queries.length - 1; i >= 0; i--) { 15571 targetData = queries[i][1]; 15572 _queries = queries[i][0]; 15573 15574 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 15575 item = $(_queries[j]); 15576 15577 // Data for target checking (mouse manager) 15578 item.data(this.widgetName + "-item", targetData); 15579 15580 items.push({ 15581 item: item, 15582 instance: targetData, 15583 width: 0, height: 0, 15584 left: 0, top: 0 15585 });
vendor: 1,192 bytes, lines 15586-15627
15586 } 15587 } 15588 }, 15589 15590 refreshPositions: function (fast) { 15591 // Determine whether items are being displayed horizontally 15592 this.floating = this.items.length ? 15593 this.options.axis === "x" || this._isFloating(this.items[0].item) : 15594 false; 15595 15596 //This has to be redone because due to the item being moved out/into the offsetParent, 15597 // the offsetParent's position will change 15598 if (this.offsetParent && this.helper) { 15599 this.offset.parent = this._getParentOffset(); 15600 } 15601 15602 var i, item, t, p; 15603 15604 for (i = this.items.length - 1; i >= 0; i--) { 15605 item = this.items[i]; 15606 15607 //We ignore calculating positions of all connected containers when we're not over them 15608 if (item.instance !== this.currentContainer && this.currentContainer && 15609 item.item[0] !== this.currentItem[0]) { 15610 continue; 15611 } 15612 15613 t = this.options.toleranceElement ? 15614 $(this.options.toleranceElement, item.item) : 15615 item.item; 15616 15617 if (!fast) { 15618 item.width = t.outerWidth(); 15619 item.height = t.outerHeight(); 15620 } 15621 15622 p = t.offset(); 15623 item.left = p.left; 15624 item.top = p.top; 15625 } 15626 15627 if (this.options.custom && this.options.custom.refreshContainers
vendor: 13,950 bytes, lines 15627-16023
15627) { 15628 this.options.custom.refreshContainers.call(this); 15629 } else { 15630 for (i = this.containers.length - 1; i >= 0; i--) { 15631 p = this.containers[i].element.offset(); 15632 this.containers[i].containerCache.left = p.left; 15633 this.containers[i].containerCache.top = p.top; 15634 this.containers[i].containerCache.width = 15635 this.containers[i].element.outerWidth(); 15636 this.containers[i].containerCache.height = 15637 this.containers[i].element.outerHeight(); 15638 } 15639 } 15640 15641 return this; 15642 }, 15643 15644 _createPlaceholder: function (that) { 15645 that = that || this; 15646 var className, 15647 o = that.options; 15648 15649 if (!o.placeholder || o.placeholder.constructor === String) { 15650 className = o.placeholder; 15651 o.placeholder = { 15652 element: function () { 15653 var nodeName = that.currentItem[0].nodeName.toLowerCase(), 15654 element = $("<" + nodeName + ">", that.document[0]); 15655 15656 that._addClass(element, "ui-sortable-placeholder", 15657 className || that.currentItem[0].className) 15658 ._removeClass(element, "ui-sortable-helper"); 15659 15660 if (nodeName === "tbody") { 15661 that._createTrPlaceholder( 15662 that.currentItem.find("tr").eq(0), 15663 $("<tr>", that.document[0]).appendTo(element) 15664 ); 15665 } else if (nodeName === "tr") { 15666 that._createTrPlaceholder(that.currentItem, element); 15667 } else if (nodeName === "img") { 15668 element.attr("src", that.currentItem.attr("src")); 15669 } 15670 15671 if (!className) { 15672 element.css("visibility", "hidden"); 15673 } 15674 15675 return element; 15676 }, 15677 update: function (container, p) { 15678 // 1. If a className is set as 'placeholder option, we don't force sizes - 15679 // the class is responsible for that 15680 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 15681 // class name is specified 15682 if (className && !o.forcePlaceholderSize) { 15683 return; 15684 } 15685 15686 //If the element doesn't have a actual height by itself (without styles coming 15687 // from a stylesheet), it receives the inline height from the dragged item 15688 if (!p.height()) { 15689 p.height( 15690 that.currentItem.innerHeight() - 15691 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 15692 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 15693 } 15694 if (!p.width()) { 15695 p.width( 15696 that.currentItem.innerWidth() - 15697 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 15698 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 15699 } 15700 } 15701 }; 15702 } 15703 15704 //Create the placeholder 15705 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 15706 15707 //Append it after the actual current item 15708 that.currentItem.after(that.placeholder); 15709 15710 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 15711 o.placeholder.update(that, that.placeholder); 15712 }, 15713 15714 _createTrPlaceholder: function (sourceTr, targetTr) { 15715 var that = this; 15716 15717 sourceTr.children().each(function () { 15718 $("<td> </td>", that.document[0]) 15719 .attr("colspan", $(this).attr("colspan") || 1) 15720 .appendTo(targetTr); 15721 }); 15722 }, 15723 15724 _contactContainers: function (event) { 15725 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 15726 floating, axis, 15727 innermostContainer = null, 15728 innermostIndex = null; 15729 15730 // Get innermost container that intersects with item 15731 for (i = this.containers.length - 1; i >= 0; i--) { 15732 // Never consider a container that's located within the item itself 15733 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 15734 continue; 15735 } 15736 15737 if (this._intersectsWith(this.containers[i].containerCache)) { 15738 // If we've already found a container and it's more "inner" than this, then continue 15739 if (innermostContainer && 15740 $.contains( 15741 this.containers[i].element[0], 15742 innermostContainer.element[0])) { 15743 continue; 15744 } 15745 15746 innermostContainer = this.containers[i]; 15747 innermostIndex = i; 15748 } else { 15749 // container doesn't intersect. trigger "out" event if necessary 15750 if (this.containers[i].containerCache.over) { 15751 this.containers[i]._trigger("out", event, this._uiHash(this)); 15752 this.containers[i].containerCache.over = 0; 15753 } 15754 } 15755 } 15756 15757 // If no intersecting containers found, return 15758 if (!innermostContainer) { 15759 return; 15760 } 15761 15762 // Move the item into the container if it's not there already 15763 if (this.containers.length === 1) { 15764 if (!this.containers[innermostIndex].containerCache.over) { 15765 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 15766 this.containers[innermostIndex].containerCache.over = 1; 15767 } 15768 } else { 15769 // When entering a new container, we will find the item with the least distance and 15770 // append our item near it 15771 dist = 10000; 15772 itemWithLeastDistance = null; 15773 floating = innermostContainer.floating || this._isFloating(this.currentItem); 15774 posProperty = floating ? "left" : "top"; 15775 sizeProperty = floating ? "width" : "height"; 15776 axis = floating ? "pageX" : "pageY"; 15777 15778 for (j = this.items.length - 1; j >= 0; j--) { 15779 if (!$.contains( 15780 this.containers[innermostIndex].element[0], this.items[j].item[0]) 15781 ) { 15782 continue; 15783 } 15784 if (this.items[j].item[0] === this.currentItem[0]) { 15785 continue; 15786 } 15787 15788 cur = this.items[j].item.offset()[posProperty]; 15789 nearBottom = false; 15790 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 15791 nearBottom = true; 15792 } 15793 15794 if (Math.abs(event[axis] - cur) < dist) { 15795 dist = Math.abs(event[axis] - cur); 15796 itemWithLeastDistance = this.items[j]; 15797 this.direction = nearBottom ? "up" : "down"; 15798 } 15799 } 15800 15801 //Check if dropOnEmpty is enabled 15802 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 15803 return; 15804 } 15805 15806 if (this.currentContainer === this.containers[innermostIndex]) { 15807 if (!this.currentContainer.containerCache.over) { 15808 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 15809 this.currentContainer.containerCache.over = 1; 15810 } 15811 return; 15812 } 15813 15814 itemWithLeastDistance ? 15815 this._rearrange(event, itemWithLeastDistance, null, true) : 15816 this._rearrange(event, null, this.containers[innermostIndex].element, true); 15817 this._trigger("change", event, this._uiHash()); 15818 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 15819 this.currentContainer = this.containers[innermostIndex]; 15820 15821 //Update the placeholder 15822 this.options.placeholder.update(this.currentContainer, this.placeholder); 15823 15824 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 15825 this.containers[innermostIndex].containerCache.over = 1; 15826 } 15827 }, 15828 15829 _createHelper: function (event) { 15830 var o = this.options, 15831 helper = $.isFunction(o.helper) ? 15832 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 15833 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 15834 15835 //Add the helper to the DOM if that didn't happen already 15836 if (!helper.parents("body").length) { 15837 $(o.appendTo !== "parent" ? 15838 o.appendTo : 15839 this.currentItem[0].parentNode)[0].appendChild(helper[0]); 15840 } 15841 15842 if (helper[0] === this.currentItem[0]) { 15843 this._storedCSS = { 15844 width: this.currentItem[0].style.width, 15845 height: this.currentItem[0].style.height, 15846 position: this.currentItem.css("position"), 15847 top: this.currentItem.css("top"), 15848 left: this.currentItem.css("left") 15849 }; 15850 } 15851 15852 if (!helper[0].style.width || o.forceHelperSize) { 15853 helper.width(this.currentItem.width()); 15854 } 15855 if (!helper[0].style.height || o.forceHelperSize) { 15856 helper.height(this.currentItem.height()); 15857 } 15858 15859 return helper; 15860 }, 15861 15862 _adjustOffsetFromHelper: function (obj) { 15863 if (typeof obj === "string") { 15864 obj = obj.split(" "); 15865 } 15866 if ($.isArray(obj)) { 15867 obj = { left: +obj[0], top: +obj[1] || 0 }; 15868 } 15869 if ("left" in obj) { 15870 this.offset.click.left = obj.left + this.margins.left; 15871 } 15872 if ("right" in obj) { 15873 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 15874 } 15875 if ("top" in obj) { 15876 this.offset.click.top = obj.top + this.margins.top; 15877 } 15878 if ("bottom" in obj) { 15879 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 15880 } 15881 }, 15882 15883 _getParentOffset: function () { 15884 //Get the offsetParent and cache its position 15885 this.offsetParent = this.helper.offsetParent(); 15886 var po = this.offsetParent.offset(); 15887 15888 // This is a special case where we need to modify a offset calculated on start, since the 15889 // following happened: 15890 // 1. The position of the helper is absolute, so it's position is calculated based on the 15891 // next positioned parent 15892 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 15893 // the document, which means that the scroll is included in the initial calculation of the 15894 // offset of the parent, and never recalculated upon drag 15895 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 15896 $.contains(this.scrollParent[0], this.offsetParent[0])) { 15897 po.left += this.scrollParent.scrollLeft(); 15898 po.top += this.scrollParent.scrollTop(); 15899 } 15900 15901 // This needs to be actually done for all browsers, since pageX/pageY includes this 15902 // information with an ugly IE fix 15903 if (this.offsetParent[0] === this.document[0].body || 15904 (this.offsetParent[0].tagName && 15905 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 15906 po = { top: 0, left: 0 }; 15907 } 15908 15909 return { 15910 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 15911 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 15912 }; 15913 }, 15914 15915 _getRelativeOffset: function () { 15916 if (this.cssPosition === "relative") { 15917 var p = this.currentItem.position(); 15918 return { 15919 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 15920 this.scrollParent.scrollTop(), 15921 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 15922 this.scrollParent.scrollLeft() 15923 }; 15924 } else { 15925 return { top: 0, left: 0 }; 15926 } 15927 }, 15928 15929 _cacheMargins: function () { 15930 this.margins = { 15931 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 15932 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 15933 }; 15934 }, 15935 15936 _cacheHelperProportions: function () { 15937 this.helperProportions = { 15938 width: this.helper.outerWidth(), 15939 height: this.helper.outerHeight() 15940 }; 15941 }, 15942 15943 _setContainment: function () { 15944 var ce, co, over, 15945 o = this.options; 15946 if (o.containment === "parent") { 15947 o.containment = this.helper[0].parentNode; 15948 } 15949 if (o.containment === "document" || o.containment === "window") { 15950 this.containment = [ 15951 0 - this.offset.relative.left - this.offset.parent.left, 15952 0 - this.offset.relative.top - this.offset.parent.top, 15953 o.containment === "document" ? 15954 this.document.width() : 15955 this.window.width() - this.helperProportions.width - this.margins.left, 15956 (o.containment === "document" ? 15957 (this.document.height() || document.body.parentNode.scrollHeight) : 15958 this.window.height() || this.document[0].body.parentNode.scrollHeight 15959 ) - this.helperProportions.height - this.margins.top 15960 ]; 15961 } 15962 15963 if (!(/^(document|window|parent)$/).test(o.containment)) { 15964 ce = $(o.containment)[0]; 15965 co = $(o.containment).offset(); 15966 over = ($(ce).css("overflow") !== "hidden"); 15967 15968 this.containment = [ 15969 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 15970 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 15971 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 15972 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 15973 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 15974 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 15975 (parseInt($(ce).css("paddingRight"), 10) || 0) - 15976 this.helperProportions.width - this.margins.left, 15977 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 15978 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 15979 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 15980 this.helperProportions.height - this.margins.top 15981 ]; 15982 } 15983 }, 15984 15985 _convertPositionTo: function (d, pos) { 15986 if (!pos) { 15987 pos = this.position; 15988 } 15989 var mod = d === "absolute" ? 1 : -1, 15990 scroll = this.cssPosition === "absolute" && 15991 !(this.scrollParent[0] !== this.document[0] && 15992 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 15993 this.offsetParent : 15994 this.scrollParent, 15995 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 15996 15997 return { 15998 top: ( 15999 16000 // The absolute mouse position 16001 pos.top + 16002 16003 // Only for relative positioned nodes: Relative offset from element to offset parent 16004 this.offset.relative.top * mod + 16005 16006 // The offsetParent's offset without borders (offset + border) 16007 this.offset.parent.top * mod - 16008 ((this.cssPosition === "fixed" ? 16009 -this.scrollParent.scrollTop() : 16010 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 16011 ), 16012 left: ( 16013 16014 // The absolute mouse position 16015 pos.left + 16016 16017 // Only for relative positioned nodes: Relative offset from element to offset parent 16018 this.offset.relative.left * mod + 16019 16020 // The offsetParent's offset without borders (offset + border) 16021 this.offset.parent.left * mod - 16022 ((this.cssPosition === "fixed" ? 16023 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,541 bytes, lines 16024-16148
16024 scroll.scrollLeft()) * mod) 16025 ) 16026 }; 16027 }, 16028 16029 _generatePosition: function (event) { 16030 var top, left, 16031 o = this.options, 16032 pageX = event.pageX, 16033 pageY = event.pageY, 16034 scroll = this.cssPosition === "absolute" && 16035 !(this.scrollParent[0] !== this.document[0] && 16036 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 16037 this.offsetParent : 16038 this.scrollParent, 16039 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 16040 16041 // This is another very weird special case that only happens for relative elements: 16042 // 1. If the css position is relative 16043 // 2. and the scroll parent is the document or similar to the offset parent 16044 // we have to refresh the relative offset during the scroll so there are no jumps 16045 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 16046 this.scrollParent[0] !== this.offsetParent[0])) { 16047 this.offset.relative = this._getRelativeOffset(); 16048 } 16049 16050 /* 16051 * - Position constraining - 16052 * Constrain the position to a mix of grid, containment. 16053 */ 16054 16055 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 16056 if (this.containment) { 16057 if (event.pageX - this.offset.click.left < this.containment[0]) { 16058 pageX = this.containment[0] + this.offset.click.left; 16059 } 16060 if (event.pageY - this.offset.click.top < this.containment[1]) { 16061 pageY = this.containment[1] + this.offset.click.top; 16062 } 16063 if (event.pageX - this.offset.click.left > this.containment[2]) { 16064 pageX = this.containment[2] + this.offset.click.left; 16065 } 16066 if (event.pageY - this.offset.click.top > this.containment[3]) { 16067 pageY = this.containment[3] + this.offset.click.top; 16068 } 16069 } 16070 16071 if (o.grid) { 16072 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 16073 o.grid[1]) * o.grid[1]; 16074 pageY = this.containment ? 16075 ((top - this.offset.click.top >= this.containment[1] && 16076 top - this.offset.click.top <= this.containment[3]) ? 16077 top : 16078 ((top - this.offset.click.top >= this.containment[1]) ? 16079 top - o.grid[1] : top + o.grid[1])) : 16080 top; 16081 16082 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 16083 o.grid[0]) * o.grid[0]; 16084 pageX = this.containment ? 16085 ((left - this.offset.click.left >= this.containment[0] && 16086 left - this.offset.click.left <= this.containment[2]) ? 16087 left : 16088 ((left - this.offset.click.left >= this.containment[0]) ? 16089 left - o.grid[0] : left + o.grid[0])) : 16090 left; 16091 } 16092 } 16093 16094 return { 16095 top: ( 16096 16097 // The absolute mouse position 16098 pageY - 16099 16100 // Click offset (relative to the element) 16101 this.offset.click.top - 16102 16103 // Only for relative positioned nodes: Relative offset from element to offset parent 16104 this.offset.relative.top - 16105 16106 // The offsetParent's offset without borders (offset + border) 16107 this.offset.parent.top + 16108 ((this.cssPosition === "fixed" ? 16109 -this.scrollParent.scrollTop() : 16110 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 16111 ), 16112 left: ( 16113 16114 // The absolute mouse position 16115 pageX - 16116 16117 // Click offset (relative to the element) 16118 this.offset.click.left - 16119 16120 // Only for relative positioned nodes: Relative offset from element to offset parent 16121 this.offset.relative.left - 16122 16123 // The offsetParent's offset without borders (offset + border) 16124 this.offset.parent.left + 16125 ((this.cssPosition === "fixed" ? 16126 -this.scrollParent.scrollLeft() : 16127 scrollIsRootNode ? 0 : scroll.scrollLeft())) 16128 ) 16129 }; 16130 }, 16131 16132 _rearrange: function (event, i, a, hardRefresh) { 16133 a ? a[0].appendChild(this.placeholder[0]) : 16134 i.item[0].parentNode.insertBefore(this.placeholder[0], 16135 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 16136 16137 //Various things done here to improve the performance: 16138 // 1. we create a setTimeout, that calls refreshPositions 16139 // 2. on the instance, we have a counter variable, that get's higher after every append 16140 // 3. on the local scope, we copy the counter variable, and check in the timeout, 16141 // if it's still the same 16142 // 4. this lets only the last addition to the timeout stack through 16143 this.counter = this.counter ? ++this.counter : 1; 16144 var counter = this.counter; 16145 16146 this._delay(function () { 16147 if (counter === this.counter) { 16148 //Precompute after each DOM insertion, NOT on mousemove
vendor: 8,965 bytes, lines 16149-16452
16149 this.refreshPositions(!hardRefresh); 16150 } 16151 }); 16152 }, 16153 16154 _clear: function (event, noPropagation) { 16155 this.reverting = false; 16156 16157 // We delay all events that have to be triggered to after the point where the placeholder 16158 // has been removed and everything else normalized again 16159 var i, 16160 delayedTriggers = []; 16161 16162 // We first have to update the dom position of the actual currentItem 16163 // Note: don't do it if the current item is already removed (by a user), or it gets 16164 // reappended (see #4088) 16165 if (!this._noFinalSort && this.currentItem.parent().length) { 16166 this.placeholder.before(this.currentItem); 16167 } 16168 this._noFinalSort = null; 16169 16170 if (this.helper[0] === this.currentItem[0]) { 16171 for (i in this._storedCSS) { 16172 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 16173 this._storedCSS[i] = ""; 16174 } 16175 } 16176 this.currentItem.css(this._storedCSS); 16177 this._removeClass(this.currentItem, "ui-sortable-helper"); 16178 } else { 16179 this.currentItem.show(); 16180 } 16181 16182 if (this.fromOutside && !noPropagation) { 16183 delayedTriggers.push(function (event) { 16184 this._trigger("receive", event, this._uiHash(this.fromOutside)); 16185 }); 16186 } 16187 if ((this.fromOutside || 16188 this.domPosition.prev !== 16189 this.currentItem.prev().not(".ui-sortable-helper")[0] || 16190 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 16191 // Trigger update callback if the DOM position has changed 16192 delayedTriggers.push(function (event) { 16193 this._trigger("update", event, this._uiHash()); 16194 }); 16195 } 16196 16197 // Check if the items Container has Changed and trigger appropriate 16198 // events. 16199 if (this !== this.currentContainer) { 16200 if (!noPropagation) { 16201 delayedTriggers.push(function (event) { 16202 this._trigger("remove", event, this._uiHash()); 16203 }); 16204 delayedTriggers.push((function (c) { 16205 return function (event) { 16206 c._trigger("receive", event, this._uiHash(this)); 16207 }; 16208 }).call(this, this.currentContainer)); 16209 delayedTriggers.push((function (c) { 16210 return function (event) { 16211 c._trigger("update", event, this._uiHash(this)); 16212 }; 16213 }).call(this, this.currentContainer)); 16214 } 16215 } 16216 16217 //Post events to containers 16218 function delayEvent(type, instance, container) { 16219 return function (event) { 16220 container._trigger(type, event, instance._uiHash(instance)); 16221 }; 16222 } 16223 for (i = this.containers.length - 1; i >= 0; i--) { 16224 if (!noPropagation) { 16225 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 16226 } 16227 if (this.containers[i].containerCache.over) { 16228 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 16229 this.containers[i].containerCache.over = 0; 16230 } 16231 } 16232 16233 //Do what was originally in plugins 16234 if (this.storedCursor) { 16235 this.document.find("body").css("cursor", this.storedCursor); 16236 this.storedStylesheet.remove(); 16237 } 16238 if (this._storedOpacity) { 16239 this.helper.css("opacity", this._storedOpacity); 16240 } 16241 if (this._storedZIndex) { 16242 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 16243 } 16244 16245 this.dragging = false; 16246 16247 if (!noPropagation) { 16248 this._trigger("beforeStop", event, this._uiHash()); 16249 } 16250 16251 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16252 // it unbinds ALL events from the original node! 16253 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 16254 16255 if (!this.cancelHelperRemoval) { 16256 if (this.helper[0] !== this.currentItem[0]) { 16257 this.helper.remove(); 16258 } 16259 this.helper = null; 16260 } 16261 16262 if (!noPropagation) { 16263 for (i = 0; i < delayedTriggers.length; i++) { 16264 // Trigger all delayed events 16265 delayedTriggers[i].call(this, event); 16266 } 16267 this._trigger("stop", event, this._uiHash()); 16268 } 16269 16270 this.fromOutside = false; 16271 return !this.cancelHelperRemoval; 16272 }, 16273 16274 _trigger: function () { 16275 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 16276 this.cancel(); 16277 } 16278 }, 16279 16280 _uiHash: function (_inst) { 16281 var inst = _inst || this; 16282 return { 16283 helper: inst.helper, 16284 placeholder: inst.placeholder || $([]), 16285 position: inst.position, 16286 originalPosition: inst.originalPosition, 16287 offset: inst.positionAbs, 16288 item: inst.currentItem, 16289 sender: _inst ? _inst.element : null 16290 }; 16291 } 16292 }); 16293 16294 /*! 16295 * jQuery UI Spinner 1.12.1 16296 * http://jqueryui.com 16297 * 16298 * Copyright jQuery Foundation and other contributors 16299 * Released under the MIT license. 16300 * http://jquery.org/license 16301 */ 16302 16303 //>>label: Spinner 16304 //>>group: Widgets 16305 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 16306 //>>docs: http://api.jqueryui.com/spinner/ 16307 //>>demos: http://jqueryui.com/spinner/ 16308 //>>css.structure: ../../themes/base/core.css 16309 //>>css.structure: ../../themes/base/spinner.css 16310 //>>css.theme: ../../themes/base/theme.css 16311 16312 function spinnerModifer(fn) { 16313 return function () { 16314 var previous = this.element.val(); 16315 fn.apply(this, arguments); 16316 this._refresh(); 16317 if (previous !== this.element.val()) { 16318 this._trigger("change"); 16319 } 16320 }; 16321 } 16322 16323 $.widget("ui.spinner", { 16324 version: "1.12.1", 16325 defaultElement: "<input>", 16326 widgetEventPrefix: "spin", 16327 options: { 16328 classes: { 16329 "ui-spinner": "ui-corner-all", 16330 "ui-spinner-down": "ui-corner-br", 16331 "ui-spinner-up": "ui-corner-tr" 16332 }, 16333 culture: null, 16334 icons: { 16335 down: "ui-icon-triangle-1-s", 16336 up: "ui-icon-triangle-1-n" 16337 }, 16338 incremental: true, 16339 max: null, 16340 min: null, 16341 numberFormat: null, 16342 page: 10, 16343 step: 1, 16344 16345 change: null, 16346 spin: null, 16347 start: null, 16348 stop: null 16349 }, 16350 16351 _create: function () { 16352 // handle string values that need to be parsed 16353 this._setOption("max", this.options.max); 16354 this._setOption("min", this.options.min); 16355 this._setOption("step", this.options.step); 16356 16357 // Only format if there is a value, prevents the field from being marked 16358 // as invalid in Firefox, see #9573. 16359 if (this.value() !== "") { 16360 // Format the value, but don't constrain. 16361 this._value(this.element.val(), true); 16362 } 16363 16364 this._draw(); 16365 this._on(this._events); 16366 this._refresh(); 16367 16368 // Turning off autocomplete prevents the browser from remembering the 16369 // value when navigating through history, so we re-enable autocomplete 16370 // if the page is unloaded before the widget is destroyed. #7790 16371 this._on(this.window, { 16372 beforeunload: function () { 16373 this.element.removeAttr("autocomplete"); 16374 } 16375 }); 16376 }, 16377 16378 _getCreateOptions: function () { 16379 var options = this._super(); 16380 var element = this.element; 16381 16382 $.each(["min", "max", "step"], function (i, option) { 16383 var value = element.attr(option); 16384 if (value != null && value.length) { 16385 options[option] = value; 16386 } 16387 }); 16388 16389 return options; 16390 }, 16391 16392 _events: { 16393 keydown: function (event) { 16394 if (this._start(event) && this._keydown(event)) { 16395 event.preventDefault(); 16396 } 16397 }, 16398 keyup: "_stop", 16399 focus: function () { 16400 this.previous = this.element.val(); 16401 }, 16402 blur: function (event) { 16403 if (this.cancelBlur) { 16404 delete this.cancelBlur; 16405 return; 16406 } 16407 16408 this._stop(); 16409 this._refresh(); 16410 if (this.previous !== this.element.val()) { 16411 this._trigger("change", event); 16412 } 16413 }, 16414 mousewheel: function (event, delta) { 16415 if (!delta) { 16416 return; 16417 } 16418 if (!this.spinning && !this._start(event)) { 16419 return false; 16420 } 16421 16422 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 16423 clearTimeout(this.mousewheelTimer); 16424 this.mousewheelTimer = this._delay(function () { 16425 if (this.spinning) { 16426 this._stop(event); 16427 } 16428 }, 100); 16429 event.preventDefault(); 16430 }, 16431 "mousedown .ui-spinner-button": function (event) { 16432 var previous; 16433 16434 // We never want the buttons to have focus; whenever the user is 16435 // interacting with the spinner, the focus should be on the input. 16436 // If the input is focused then this.previous is properly set from 16437 // when the input first received focus. If the input is not focused 16438 // then we need to set this.previous based on the value before spinning. 16439 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 16440 this.previous : this.element.val(); 16441 function checkFocus() { 16442 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 16443 if (!isActive) { 16444 this.element.trigger("focus"); 16445 this.previous = previous; 16446 16447 // support: IE 16448 // IE sets focus asynchronously, so we need to check if focus 16449 // moved off of the input because the user clicked on the button. 16450 this._delay(function () { 16451 this.previous = previous; 16452 });
vendor: 6,126 bytes, lines 16453-16686
16453 } 16454 } 16455 16456 // Ensure focus is on (or stays on) the text field 16457 event.preventDefault(); 16458 checkFocus.call(this); 16459 16460 // Support: IE 16461 // IE doesn't prevent moving focus even with event.preventDefault() 16462 // so we set a flag to know when we should ignore the blur event 16463 // and check (again) if focus moved off of the input. 16464 this.cancelBlur = true; 16465 this._delay(function () { 16466 delete this.cancelBlur; 16467 checkFocus.call(this); 16468 }); 16469 16470 if (this._start(event) === false) { 16471 return; 16472 } 16473 16474 this._repeat(null, $(event.currentTarget) 16475 .hasClass("ui-spinner-up") ? 1 : -1, event); 16476 }, 16477 "mouseup .ui-spinner-button": "_stop", 16478 "mouseenter .ui-spinner-button": function (event) { 16479 // button will add ui-state-active if mouse was down while mouseleave and kept down 16480 if (!$(event.currentTarget).hasClass("ui-state-active")) { 16481 return; 16482 } 16483 16484 if (this._start(event) === false) { 16485 return false; 16486 } 16487 this._repeat(null, $(event.currentTarget) 16488 .hasClass("ui-spinner-up") ? 1 : -1, event); 16489 }, 16490 16491 // TODO: do we really want to consider this a stop? 16492 // shouldn't we just stop the repeater and wait until mouseup before 16493 // we trigger the stop event? 16494 "mouseleave .ui-spinner-button": "_stop" 16495 }, 16496 16497 // Support mobile enhanced option and make backcompat more sane 16498 _enhance: function () { 16499 this.uiSpinner = this.element 16500 .attr("autocomplete", "off") 16501 .wrap("<span>") 16502 .parent() 16503 16504 // Add buttons 16505 .append( 16506 "<a></a><a></a>" 16507 ); 16508 }, 16509 16510 _draw: function () { 16511 this._enhance(); 16512 16513 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 16514 this._addClass("ui-spinner-input"); 16515 16516 this.element.attr("role", "spinbutton"); 16517 16518 // Button bindings 16519 this.buttons = this.uiSpinner.children("a") 16520 .attr("tabIndex", -1) 16521 .attr("aria-hidden", true) 16522 .button({ 16523 classes: { 16524 "ui-button": "" 16525 } 16526 }); 16527 16528 // TODO: Right now button does not support classes this is already updated in button PR 16529 this._removeClass(this.buttons, "ui-corner-all"); 16530 16531 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 16532 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 16533 this.buttons.first().button({ 16534 "icon": this.options.icons.up, 16535 "showLabel": false 16536 }); 16537 this.buttons.last().button({ 16538 "icon": this.options.icons.down, 16539 "showLabel": false 16540 }); 16541 16542 // IE 6 doesn't understand height: 50% for the buttons 16543 // unless the wrapper has an explicit height 16544 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 16545 this.uiSpinner.height() > 0) { 16546 this.uiSpinner.height(this.uiSpinner.height()); 16547 } 16548 }, 16549 16550 _keydown: function (event) { 16551 var options = this.options, 16552 keyCode = $.ui.keyCode; 16553 16554 switch (event.keyCode) { 16555 case keyCode.UP: 16556 this._repeat(null, 1, event); 16557 return true; 16558 case keyCode.DOWN: 16559 this._repeat(null, -1, event); 16560 return true; 16561 case keyCode.PAGE_UP: 16562 this._repeat(null, options.page, event); 16563 return true; 16564 case keyCode.PAGE_DOWN: 16565 this._repeat(null, -options.page, event); 16566 return true; 16567 } 16568 16569 return false; 16570 }, 16571 16572 _start: function (event) { 16573 if (!this.spinning && this._trigger("start", event) === false) { 16574 return false; 16575 } 16576 16577 if (!this.counter) { 16578 this.counter = 1; 16579 } 16580 this.spinning = true; 16581 return true; 16582 }, 16583 16584 _repeat: function (i, steps, event) { 16585 i = i || 500; 16586 16587 clearTimeout(this.timer); 16588 this.timer = this._delay(function () { 16589 this._repeat(40, steps, event); 16590 }, i); 16591 16592 this._spin(steps * this.options.step, event); 16593 }, 16594 16595 _spin: function (step, event) { 16596 var value = this.value() || 0; 16597 16598 if (!this.counter) { 16599 this.counter = 1; 16600 } 16601 16602 value = this._adjustValue(value + step * this._increment(this.counter)); 16603 16604 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 16605 this._value(value); 16606 this.counter++; 16607 } 16608 }, 16609 16610 _increment: function (i) { 16611 var incremental = this.options.incremental; 16612 16613 if (incremental) { 16614 return $.isFunction(incremental) ? 16615 incremental(i) : 16616 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 16617 } 16618 16619 return 1; 16620 }, 16621 16622 _precision: function () { 16623 var precision = this._precisionOf(this.options.step); 16624 if (this.options.min !== null) { 16625 precision = Math.max(precision, this._precisionOf(this.options.min)); 16626 } 16627 return precision; 16628 }, 16629 16630 _precisionOf: function (num) { 16631 var str = num.toString(), 16632 decimal = str.indexOf("."); 16633 return decimal === -1 ? 0 : str.length - decimal - 1; 16634 }, 16635 16636 _adjustValue: function (value) { 16637 var base, aboveMin, 16638 options = this.options; 16639 16640 // Make sure we're at a valid step 16641 // - find out where we are relative to the base (min or 0) 16642 base = options.min !== null ? options.min : 0; 16643 aboveMin = value - base; 16644 16645 // - round to the nearest step 16646 aboveMin = Math.round(aboveMin / options.step) * options.step; 16647 16648 // - rounding is based on 0, so adjust back to our base 16649 value = base + aboveMin; 16650 16651 // Fix precision from bad JS floating point math 16652 value = parseFloat(value.toFixed(this._precision())); 16653 16654 // Clamp the value 16655 if (options.max !== null && value > options.max) { 16656 return options.max; 16657 } 16658 if (options.min !== null && value < options.min) { 16659 return options.min; 16660 } 16661 16662 return value; 16663 }, 16664 16665 _stop: function (event) { 16666 if (!this.spinning) { 16667 return; 16668 } 16669 16670 clearTimeout(this.timer); 16671 clearTimeout(this.mousewheelTimer); 16672 this.counter = 0; 16673 this.spinning = false; 16674 this._trigger("stop", event); 16675 }, 16676 16677 _setOption: function (key, value) { 16678 var prevValue, first, last; 16679 16680 if (key === "culture" || key === "numberFormat") { 16681 prevValue = this._parse(this.element.val()); 16682 this.options[key] = value; 16683 this.element.val(this._format(prevValue)); 16684 return; 16685 } 16686
vendor: 11,754 bytes, lines 16687-17134
16687 if (key === "max" || key === "min" || key === "step") { 16688 if (typeof value === "string") { 16689 value = this._parse(value); 16690 } 16691 } 16692 if (key === "icons") { 16693 first = this.buttons.first().find(".ui-icon"); 16694 this._removeClass(first, null, this.options.icons.up); 16695 this._addClass(first, null, value.up); 16696 last = this.buttons.last().find(".ui-icon"); 16697 this._removeClass(last, null, this.options.icons.down); 16698 this._addClass(last, null, value.down); 16699 } 16700 16701 this._super(key, value); 16702 }, 16703 16704 _setOptionDisabled: function (value) { 16705 this._super(value); 16706 16707 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 16708 this.element.prop("disabled", !!value); 16709 this.buttons.button(value ? "disable" : "enable"); 16710 }, 16711 16712 _setOptions: spinnerModifer(function (options) { 16713 this._super(options); 16714 }), 16715 16716 _parse: function (val) { 16717 if (typeof val === "string" && val !== "") { 16718 val = window.Globalize && this.options.numberFormat ? 16719 Globalize.parseFloat(val, 10, this.options.culture) : +val; 16720 } 16721 return val === "" || isNaN(val) ? null : val; 16722 }, 16723 16724 _format: function (value) { 16725 if (value === "") { 16726 return ""; 16727 } 16728 return window.Globalize && this.options.numberFormat ? 16729 Globalize.format(value, this.options.numberFormat, this.options.culture) : 16730 value; 16731 }, 16732 16733 _refresh: function () { 16734 this.element.attr({ 16735 "aria-valuemin": this.options.min, 16736 "aria-valuemax": this.options.max, 16737 16738 // TODO: what should we do with values that can't be parsed? 16739 "aria-valuenow": this._parse(this.element.val()) 16740 }); 16741 }, 16742 16743 isValid: function () { 16744 var value = this.value(); 16745 16746 // Null is invalid 16747 if (value === null) { 16748 return false; 16749 } 16750 16751 // If value gets adjusted, it's invalid 16752 return value === this._adjustValue(value); 16753 }, 16754 16755 // Update the value without triggering change 16756 _value: function (value, allowAny) { 16757 var parsed; 16758 if (value !== "") { 16759 parsed = this._parse(value); 16760 if (parsed !== null) { 16761 if (!allowAny) { 16762 parsed = this._adjustValue(parsed); 16763 } 16764 value = this._format(parsed); 16765 } 16766 } 16767 this.element.val(value); 16768 this._refresh(); 16769 }, 16770 16771 _destroy: function () { 16772 this.element 16773 .prop("disabled", false) 16774 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 16775 16776 this.uiSpinner.replaceWith(this.element); 16777 }, 16778 16779 stepUp: spinnerModifer(function (steps) { 16780 this._stepUp(steps); 16781 }), 16782 _stepUp: function (steps) { 16783 if (this._start()) { 16784 this._spin((steps || 1) * this.options.step); 16785 this._stop(); 16786 } 16787 }, 16788 16789 stepDown: spinnerModifer(function (steps) { 16790 this._stepDown(steps); 16791 }), 16792 _stepDown: function (steps) { 16793 if (this._start()) { 16794 this._spin((steps || 1) * -this.options.step); 16795 this._stop(); 16796 } 16797 }, 16798 16799 pageUp: spinnerModifer(function (pages) { 16800 this._stepUp((pages || 1) * this.options.page); 16801 }), 16802 16803 pageDown: spinnerModifer(function (pages) { 16804 this._stepDown((pages || 1) * this.options.page); 16805 }), 16806 16807 value: function (newVal) { 16808 if (!arguments.length) { 16809 return this._parse(this.element.val()); 16810 } 16811 spinnerModifer(this._value).call(this, newVal); 16812 }, 16813 16814 widget: function () { 16815 return this.uiSpinner; 16816 } 16817 }); 16818 16819 // DEPRECATED 16820 // TODO: switch return back to widget declaration at top of file when this is removed 16821 if ($.uiBackCompat !== false) { 16822 // Backcompat for spinner html extension points 16823 $.widget("ui.spinner", $.ui.spinner, { 16824 _enhance: function () { 16825 this.uiSpinner = this.element 16826 .attr("autocomplete", "off") 16827 .wrap(this._uiSpinnerHtml()) 16828 .parent() 16829 16830 // Add buttons 16831 .append(this._buttonHtml()); 16832 }, 16833 _uiSpinnerHtml: function () { 16834 return "<span>"; 16835 }, 16836 16837 _buttonHtml: function () { 16838 return "<a></a><a></a>"; 16839 } 16840 }); 16841 } 16842 16843 var widgetsSpinner = $.ui.spinner; 16844 16845 /*! 16846 * jQuery UI Tabs 1.12.1 16847 * http://jqueryui.com 16848 * 16849 * Copyright jQuery Foundation and other contributors 16850 * Released under the MIT license. 16851 * http://jquery.org/license 16852 */ 16853 16854 //>>label: Tabs 16855 //>>group: Widgets 16856 //>>description: Transforms a set of container elements into a tab structure. 16857 //>>docs: http://api.jqueryui.com/tabs/ 16858 //>>demos: http://jqueryui.com/tabs/ 16859 //>>css.structure: ../../themes/base/core.css 16860 //>>css.structure: ../../themes/base/tabs.css 16861 //>>css.theme: ../../themes/base/theme.css 16862 16863 $.widget("ui.tabs", { 16864 version: "1.12.1", 16865 delay: 300, 16866 options: { 16867 active: null, 16868 classes: { 16869 "ui-tabs": "ui-corner-all", 16870 "ui-tabs-nav": "ui-corner-all", 16871 "ui-tabs-panel": "ui-corner-bottom", 16872 "ui-tabs-tab": "ui-corner-top" 16873 }, 16874 collapsible: false, 16875 event: "click", 16876 heightStyle: "content", 16877 hide: null, 16878 show: null, 16879 16880 // Callbacks 16881 activate: null, 16882 beforeActivate: null, 16883 beforeLoad: null, 16884 load: null 16885 }, 16886 16887 _isLocal: (function () { 16888 var rhash = /#.*$/; 16889 16890 return function (anchor) { 16891 var anchorUrl, locationUrl; 16892 16893 anchorUrl = anchor.href.replace(rhash, ""); 16894 locationUrl = location.href.replace(rhash, ""); 16895 16896 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 16897 try { 16898 anchorUrl = decodeURIComponent(anchorUrl); 16899 } catch (error) { } 16900 try { 16901 locationUrl = decodeURIComponent(locationUrl); 16902 } catch (error) { } 16903 16904 return anchor.hash.length > 1 && anchorUrl === locationUrl; 16905 }; 16906 })(), 16907 16908 _create: function () { 16909 var that = this, 16910 options = this.options; 16911 16912 this.running = false; 16913 16914 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 16915 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 16916 16917 this._processTabs(); 16918 options.active = this._initialActive(); 16919 16920 // Take disabling tabs via class attribute from HTML 16921 // into account and update option properly. 16922 if ($.isArray(options.disabled)) { 16923 options.disabled = $.unique(options.disabled.concat( 16924 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 16925 return that.tabs.index(li); 16926 }) 16927 )).sort(); 16928 } 16929 16930 // Check for length avoids error when initializing empty list 16931 if (this.options.active !== false && this.anchors.length) { 16932 this.active = this._findActive(options.active); 16933 } else { 16934 this.active = $(); 16935 } 16936 16937 this._refresh(); 16938 16939 if (this.active.length) { 16940 this.load(options.active); 16941 } 16942 }, 16943 16944 _initialActive: function () { 16945 var active = this.options.active, 16946 collapsible = this.options.collapsible, 16947 locationHash = location.hash.substring(1); 16948 16949 if (active === null) { 16950 // check the fragment identifier in the URL 16951 if (locationHash) { 16952 this.tabs.each(function (i, tab) { 16953 if ($(tab).attr("aria-controls") === locationHash) { 16954 active = i; 16955 return false; 16956 } 16957 }); 16958 } 16959 16960 // Check for a tab marked active via a class 16961 if (active === null) { 16962 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 16963 } 16964 16965 // No active tab, set to false 16966 if (active === null || active === -1) { 16967 active = this.tabs.length ? 0 : false; 16968 } 16969 } 16970 16971 // Handle numbers: negative, out of range 16972 if (active !== false) { 16973 active = this.tabs.index(this.tabs.eq(active)); 16974 if (active === -1) { 16975 active = collapsible ? false : 0; 16976 } 16977 } 16978 16979 // Don't allow collapsible: false and active: false 16980 if (!collapsible && active === false && this.anchors.length) { 16981 active = 0; 16982 } 16983 16984 return active; 16985 }, 16986 16987 _getCreateEventData: function () { 16988 return { 16989 tab: this.active, 16990 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 16991 }; 16992 }, 16993 16994 _tabKeydown: function (event) { 16995 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 16996 selectedIndex = this.tabs.index(focusedTab), 16997 goingForward = true; 16998 16999 if (this._handlePageNav(event)) { 17000 return; 17001 } 17002 17003 switch (event.keyCode) { 17004 case $.ui.keyCode.RIGHT: 17005 case $.ui.keyCode.DOWN: 17006 selectedIndex++; 17007 break; 17008 case $.ui.keyCode.UP: 17009 case $.ui.keyCode.LEFT: 17010 goingForward = false; 17011 selectedIndex--; 17012 break; 17013 case $.ui.keyCode.END: 17014 selectedIndex = this.anchors.length - 1; 17015 break; 17016 case $.ui.keyCode.HOME: 17017 selectedIndex = 0; 17018 break; 17019 case $.ui.keyCode.SPACE: 17020 17021 // Activate only, no collapsing 17022 event.preventDefault(); 17023 clearTimeout(this.activating); 17024 this._activate(selectedIndex); 17025 return; 17026 case $.ui.keyCode.ENTER: 17027 17028 // Toggle (cancel delayed activation, allow collapsing) 17029 event.preventDefault(); 17030 clearTimeout(this.activating); 17031 17032 // Determine if we should collapse or activate 17033 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 17034 return; 17035 default: 17036 return; 17037 } 17038 17039 // Focus the appropriate tab, based on which key was pressed 17040 event.preventDefault(); 17041 clearTimeout(this.activating); 17042 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 17043 17044 // Navigating with control/command key will prevent automatic activation 17045 if (!event.ctrlKey && !event.metaKey) { 17046 // Update aria-selected immediately so that AT think the tab is already selected. 17047 // Otherwise AT may confuse the user by stating that they need to activate the tab, 17048 // but the tab will already be activated by the time the announcement finishes. 17049 focusedTab.attr("aria-selected", "false"); 17050 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 17051 17052 this.activating = this._delay(function () { 17053 this.option("active", selectedIndex); 17054 }, this.delay); 17055 } 17056 }, 17057 17058 _panelKeydown: function (event) { 17059 if (this._handlePageNav(event)) { 17060 return; 17061 } 17062 17063 // Ctrl+up moves focus to the current tab 17064 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 17065 event.preventDefault(); 17066 this.active.trigger("focus"); 17067 } 17068 }, 17069 17070 // Alt+page up/down moves focus to the previous/next tab (and activates) 17071 _handlePageNav: function (event) { 17072 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 17073 this._activate(this._focusNextTab(this.options.active - 1, false)); 17074 return true; 17075 } 17076 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 17077 this._activate(this._focusNextTab(this.options.active + 1, true)); 17078 return true; 17079 } 17080 }, 17081 17082 _findNextTab: function (index, goingForward) { 17083 var lastTabIndex = this.tabs.length - 1; 17084 17085 function constrain() { 17086 if (index > lastTabIndex) { 17087 index = 0; 17088 } 17089 if (index < 0) { 17090 index = lastTabIndex; 17091 } 17092 return index; 17093 } 17094 17095 while ($.inArray(constrain(), this.options.disabled) !== -1) { 17096 index = goingForward ? index + 1 : index - 1; 17097 } 17098 17099 return index; 17100 }, 17101 17102 _focusNextTab: function (index, goingForward) { 17103 index = this._findNextTab(index, goingForward); 17104 this.tabs.eq(index).trigger("focus"); 17105 return index; 17106 }, 17107 17108 _setOption: function (key, value) { 17109 if (key === "active") { 17110 // _activate() will handle invalid values and update this.options 17111 this._activate(value); 17112 return; 17113 } 17114 17115 this._super(key, value); 17116 17117 if (key === "collapsible") { 17118 this._toggleClass("ui-tabs-collapsible", null, value); 17119 17120 // Setting collapsible: false while collapsed; open first panel 17121 if (!value && this.options.active === false) { 17122 this._activate(0); 17123 } 17124 } 17125 17126 if (key === "event") { 17127 this._setupEvents(value); 17128 } 17129 17130 if (key === "heightStyle") { 17131 this._setupHeightStyle(value); 17132 } 17133 }, 17134
vendor: 4,579 bytes, lines 17135-17288
17135 _sanitizeSelector: function (hash) { 17136 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 17137 }, 17138 17139 refresh: function () { 17140 var options = this.options, 17141 lis = this.tablist.children(":has(a[href])"); 17142 17143 // Get disabled tabs from class attribute from HTML 17144 // this will get converted to a boolean if needed in _refresh() 17145 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 17146 return lis.index(tab); 17147 }); 17148 17149 this._processTabs(); 17150 17151 // Was collapsed or no tabs 17152 if (options.active === false || !this.anchors.length) { 17153 options.active = false; 17154 this.active = $(); 17155 17156 // was active, but active tab is gone 17157 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 17158 // all remaining tabs are disabled 17159 if (this.tabs.length === options.disabled.length) { 17160 options.active = false; 17161 this.active = $(); 17162 17163 // activate previous tab 17164 } else { 17165 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 17166 } 17167 17168 // was active, active tab still exists 17169 } else { 17170 // make sure active index is correct 17171 options.active = this.tabs.index(this.active); 17172 } 17173 17174 this._refresh(); 17175 }, 17176 17177 _refresh: function () { 17178 this._setOptionDisabled(this.options.disabled); 17179 this._setupEvents(this.options.event); 17180 this._setupHeightStyle(this.options.heightStyle); 17181 17182 this.tabs.not(this.active).attr({ 17183 "aria-selected": "false", 17184 "aria-expanded": "false", 17185 tabIndex: -1 17186 }); 17187 this.panels.not(this._getPanelForTab(this.active)) 17188 .hide() 17189 .attr({ 17190 "aria-hidden": "true" 17191 }); 17192 17193 // Make sure one tab is in the tab order 17194 if (!this.active.length) { 17195 this.tabs.eq(0).attr("tabIndex", 0); 17196 } else { 17197 this.active 17198 .attr({ 17199 "aria-selected": "true", 17200 "aria-expanded": "true", 17201 tabIndex: 0 17202 }); 17203 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 17204 this._getPanelForTab(this.active) 17205 .show() 17206 .attr({ 17207 "aria-hidden": "false" 17208 }); 17209 } 17210 }, 17211 17212 _processTabs: function () { 17213 var that = this, 17214 prevTabs = this.tabs, 17215 prevAnchors = this.anchors, 17216 prevPanels = this.panels; 17217 17218 this.tablist = this._getList().attr("role", "tablist"); 17219 this._addClass(this.tablist, "ui-tabs-nav", 17220 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 17221 17222 // Prevent users from focusing disabled tabs via click 17223 this.tablist 17224 .on("mousedown" + this.eventNamespace, "> li", function (event) { 17225 if ($(this).is(".ui-state-disabled")) { 17226 event.preventDefault(); 17227 } 17228 }) 17229 17230 // Support: IE <9 17231 // Preventing the default action in mousedown doesn't prevent IE 17232 // from focusing the element, so if the anchor gets focused, blur. 17233 // We don't have to worry about focusing the previously focused 17234 // element since clicking on a non-focusable element should focus 17235 // the body anyway. 17236 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 17237 if ($(this).closest("li").is(".ui-state-disabled")) { 17238 this.blur(); 17239 } 17240 }); 17241 17242 this.tabs = this.tablist.find("> li:has(a[href])") 17243 .attr({ 17244 role: "tab", 17245 tabIndex: -1 17246 }); 17247 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 17248 17249 this.anchors = this.tabs.map(function () { 17250 return $("a", this)[0]; 17251 }) 17252 .attr({ 17253 role: "presentation", 17254 tabIndex: -1 17255 }); 17256 this._addClass(this.anchors, "ui-tabs-anchor"); 17257 17258 this.panels = $(); 17259 17260 this.anchors.each(function (i, anchor) { 17261 var selector, panel, panelId, 17262 anchorId = $(anchor).uniqueId().attr("id"), 17263 tab = $(anchor).closest("li"), 17264 originalAriaControls = tab.attr("aria-controls"); 17265 17266 // Inline tab 17267 if (that._isLocal(anchor)) { 17268 selector = anchor.hash; 17269 panelId = selector.substring(1); 17270 panel = that.element.find(that._sanitizeSelector(selector)); 17271 17272 // remote tab 17273 } else { 17274 // If the tab doesn't already have aria-controls, 17275 // generate an id by using a throw-away element 17276 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 17277 selector = "#" + panelId; 17278 panel = that.element.find(selector); 17279 if (!panel.length) { 17280 panel = that._createPanel(panelId); 17281 panel.insertAfter(that.panels[i - 1] || that.tablist); 17282 } 17283 panel.attr("aria-live", "polite"); 17284 } 17285 17286 if (panel.length) { 17287 that.panels = that.panels.add(panel); 17288 }
vendor: 5,958 bytes, lines 17289-17504
17289 if (originalAriaControls) { 17290 tab.data("ui-tabs-aria-controls", originalAriaControls); 17291 } 17292 tab.attr({ 17293 "aria-controls": panelId, 17294 "aria-labelledby": anchorId 17295 }); 17296 panel.attr("aria-labelledby", anchorId); 17297 }); 17298 17299 this.panels.attr("role", "tabpanel"); 17300 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 17301 17302 // Avoid memory leaks (#10056) 17303 if (prevTabs) { 17304 this._off(prevTabs.not(this.tabs)); 17305 this._off(prevAnchors.not(this.anchors)); 17306 this._off(prevPanels.not(this.panels)); 17307 } 17308 }, 17309 17310 // Allow overriding how to find the list for rare usage scenarios (#7715) 17311 _getList: function () { 17312 return this.tablist || this.element.find("ol, ul").eq(0); 17313 }, 17314 17315 _createPanel: function (id) { 17316 return $("<div>") 17317 .attr("id", id) 17318 .data("ui-tabs-destroy", true); 17319 }, 17320 17321 _setOptionDisabled: function (disabled) { 17322 var currentItem, li, i; 17323 17324 if ($.isArray(disabled)) { 17325 if (!disabled.length) { 17326 disabled = false; 17327 } else if (disabled.length === this.anchors.length) { 17328 disabled = true; 17329 } 17330 } 17331 17332 // Disable tabs 17333 for (i = 0; (li = this.tabs[i]); i++) { 17334 currentItem = $(li); 17335 if (disabled === true || $.inArray(i, disabled) !== -1) { 17336 currentItem.attr("aria-disabled", "true"); 17337 this._addClass(currentItem, null, "ui-state-disabled"); 17338 } else { 17339 currentItem.removeAttr("aria-disabled"); 17340 this._removeClass(currentItem, null, "ui-state-disabled"); 17341 } 17342 } 17343 17344 this.options.disabled = disabled; 17345 17346 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 17347 disabled === true); 17348 }, 17349 17350 _setupEvents: function (event) { 17351 var events = {}; 17352 if (event) { 17353 $.each(event.split(" "), function (index, eventName) { 17354 events[eventName] = "_eventHandler"; 17355 }); 17356 } 17357 17358 this._off(this.anchors.add(this.tabs).add(this.panels)); 17359 17360 // Always prevent the default action, even when disabled 17361 this._on(true, this.anchors, { 17362 click: function (event) { 17363 event.preventDefault(); 17364 } 17365 }); 17366 this._on(this.anchors, events); 17367 this._on(this.tabs, { keydown: "_tabKeydown" }); 17368 this._on(this.panels, { keydown: "_panelKeydown" }); 17369 17370 this._focusable(this.tabs); 17371 this._hoverable(this.tabs); 17372 }, 17373 17374 _setupHeightStyle: function (heightStyle) { 17375 var maxHeight, 17376 parent = this.element.parent(); 17377 17378 if (heightStyle === "fill") { 17379 maxHeight = parent.height(); 17380 maxHeight -= this.element.outerHeight() - this.element.height(); 17381 17382 this.element.siblings(":visible").each(function () { 17383 var elem = $(this), 17384 position = elem.css("position"); 17385 17386 if (position === "absolute" || position === "fixed") { 17387 return; 17388 } 17389 maxHeight -= elem.outerHeight(true); 17390 }); 17391 17392 this.element.children().not(this.panels).each(function () { 17393 maxHeight -= $(this).outerHeight(true); 17394 }); 17395 17396 this.panels.each(function () { 17397 $(this).height(Math.max(0, maxHeight - 17398 $(this).innerHeight() + $(this).height())); 17399 }) 17400 .css("overflow", "auto"); 17401 } else if (heightStyle === "auto") { 17402 maxHeight = 0; 17403 this.panels.each(function () { 17404 maxHeight = Math.max(maxHeight, $(this).height("").height()); 17405 }).height(maxHeight); 17406 } 17407 }, 17408 17409 _eventHandler: function (event) { 17410 var options = this.options, 17411 active = this.active, 17412 anchor = $(event.currentTarget), 17413 tab = anchor.closest("li"), 17414 clickedIsActive = tab[0] === active[0], 17415 collapsing = clickedIsActive && options.collapsible, 17416 toShow = collapsing ? $() : this._getPanelForTab(tab), 17417 toHide = !active.length ? $() : this._getPanelForTab(active), 17418 eventData = { 17419 oldTab: active, 17420 oldPanel: toHide, 17421 newTab: collapsing ? $() : tab, 17422 newPanel: toShow 17423 }; 17424 17425 event.preventDefault(); 17426 17427 if (tab.hasClass("ui-state-disabled") || 17428 17429 // tab is already loading 17430 tab.hasClass("ui-tabs-loading") || 17431 17432 // can't switch durning an animation 17433 this.running || 17434 17435 // click on active header, but not collapsible 17436 (clickedIsActive && !options.collapsible) || 17437 17438 // allow canceling activation 17439 (this._trigger("beforeActivate", event, eventData) === false)) { 17440 return; 17441 } 17442 17443 options.active = collapsing ? false : this.tabs.index(tab); 17444 17445 this.active = clickedIsActive ? $() : tab; 17446 if (this.xhr) { 17447 this.xhr.abort(); 17448 } 17449 17450 if (!toHide.length && !toShow.length) { 17451 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 17452 } 17453 17454 if (toShow.length) { 17455 this.load(this.tabs.index(tab), event); 17456 } 17457 this._toggle(event, eventData); 17458 }, 17459 17460 // Handles show/hide for selecting tabs 17461 _toggle: function (event, eventData) { 17462 var that = this, 17463 toShow = eventData.newPanel, 17464 toHide = eventData.oldPanel; 17465 17466 this.running = true; 17467 17468 function complete() { 17469 that.running = false; 17470 that._trigger("activate", event, eventData); 17471 } 17472 17473 function show() { 17474 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 17475 17476 if (toShow.length && that.options.show) { 17477 that._show(toShow, that.options.show, complete); 17478 } else { 17479 toShow.show(); 17480 complete(); 17481 } 17482 } 17483 17484 // Start out by hiding, then showing, then completing 17485 if (toHide.length && this.options.hide) { 17486 this._hide(toHide, this.options.hide, function () { 17487 that._removeClass(eventData.oldTab.closest("li"), 17488 "ui-tabs-active", "ui-state-active"); 17489 show(); 17490 }); 17491 } else { 17492 this._removeClass(eventData.oldTab.closest("li"), 17493 "ui-tabs-active", "ui-state-active"); 17494 toHide.hide(); 17495 show(); 17496 } 17497 17498 toHide.attr("aria-hidden", "true"); 17499 eventData.oldTab.attr({ 17500 "aria-selected": "false", 17501 "aria-expanded": "false" 17502 }); 17503 17504 // If we're switching tabs, remove the old tab from the tab order.
vendor: 13,679 bytes, lines 17505-18003
17505 // If we're opening from collapsed state, remove the previous tab from the tab order. 17506 // If we're collapsing, then keep the collapsing tab in the tab order. 17507 if (toShow.length && toHide.length) { 17508 eventData.oldTab.attr("tabIndex", -1); 17509 } else if (toShow.length) { 17510 this.tabs.filter(function () { 17511 return $(this).attr("tabIndex") === 0; 17512 }) 17513 .attr("tabIndex", -1); 17514 } 17515 17516 toShow.attr("aria-hidden", "false"); 17517 eventData.newTab.attr({ 17518 "aria-selected": "true", 17519 "aria-expanded": "true", 17520 tabIndex: 0 17521 }); 17522 }, 17523 17524 _activate: function (index) { 17525 var anchor, 17526 active = this._findActive(index); 17527 17528 // Trying to activate the already active panel 17529 if (active[0] === this.active[0]) { 17530 return; 17531 } 17532 17533 // Trying to collapse, simulate a click on the current active header 17534 if (!active.length) { 17535 active = this.active; 17536 } 17537 17538 anchor = active.find(".ui-tabs-anchor")[0]; 17539 this._eventHandler({ 17540 target: anchor, 17541 currentTarget: anchor, 17542 preventDefault: $.noop 17543 }); 17544 }, 17545 17546 _findActive: function (index) { 17547 return index === false ? $() : this.tabs.eq(index); 17548 }, 17549 17550 _getIndex: function (index) { 17551 // meta-function to give users option to provide a href string instead of a numerical index. 17552 if (typeof index === "string") { 17553 index = this.anchors.index(this.anchors.filter("[href$='" + 17554 $.ui.escapeSelector(index) + "']")); 17555 } 17556 17557 return index; 17558 }, 17559 17560 _destroy: function () { 17561 if (this.xhr) { 17562 this.xhr.abort(); 17563 } 17564 17565 this.tablist 17566 .removeAttr("role") 17567 .off(this.eventNamespace); 17568 17569 this.anchors 17570 .removeAttr("role tabIndex") 17571 .removeUniqueId(); 17572 17573 this.tabs.add(this.panels).each(function () { 17574 if ($.data(this, "ui-tabs-destroy")) { 17575 $(this).remove(); 17576 } else { 17577 $(this).removeAttr("role tabIndex " + 17578 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 17579 } 17580 }); 17581 17582 this.tabs.each(function () { 17583 var li = $(this), 17584 prev = li.data("ui-tabs-aria-controls"); 17585 if (prev) { 17586 li 17587 .attr("aria-controls", prev) 17588 .removeData("ui-tabs-aria-controls"); 17589 } else { 17590 li.removeAttr("aria-controls"); 17591 } 17592 }); 17593 17594 this.panels.show(); 17595 17596 if (this.options.heightStyle !== "content") { 17597 this.panels.css("height", ""); 17598 } 17599 }, 17600 17601 enable: function (index) { 17602 var disabled = this.options.disabled; 17603 if (disabled === false) { 17604 return; 17605 } 17606 17607 if (index === undefined) { 17608 disabled = false; 17609 } else { 17610 index = this._getIndex(index); 17611 if ($.isArray(disabled)) { 17612 disabled = $.map(disabled, function (num) { 17613 return num !== index ? num : null; 17614 }); 17615 } else { 17616 disabled = $.map(this.tabs, function (li, num) { 17617 return num !== index ? num : null; 17618 }); 17619 } 17620 } 17621 this._setOptionDisabled(disabled); 17622 }, 17623 17624 disable: function (index) { 17625 var disabled = this.options.disabled; 17626 if (disabled === true) { 17627 return; 17628 } 17629 17630 if (index === undefined) { 17631 disabled = true; 17632 } else { 17633 index = this._getIndex(index); 17634 if ($.inArray(index, disabled) !== -1) { 17635 return; 17636 } 17637 if ($.isArray(disabled)) { 17638 disabled = $.merge([index], disabled).sort(); 17639 } else { 17640 disabled = [index]; 17641 } 17642 } 17643 this._setOptionDisabled(disabled); 17644 }, 17645 17646 load: function (index, event) { 17647 index = this._getIndex(index); 17648 var that = this, 17649 tab = this.tabs.eq(index), 17650 anchor = tab.find(".ui-tabs-anchor"), 17651 panel = this._getPanelForTab(tab), 17652 eventData = { 17653 tab: tab, 17654 panel: panel 17655 }, 17656 complete = function (jqXHR, status) { 17657 if (status === "abort") { 17658 that.panels.stop(false, true); 17659 } 17660 17661 that._removeClass(tab, "ui-tabs-loading"); 17662 panel.removeAttr("aria-busy"); 17663 17664 if (jqXHR === that.xhr) { 17665 delete that.xhr; 17666 } 17667 }; 17668 17669 // Not remote 17670 if (this._isLocal(anchor[0])) { 17671 return; 17672 } 17673 17674 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 17675 17676 // Support: jQuery <1.8 17677 // jQuery <1.8 returns false if the request is canceled in beforeSend, 17678 // but as of 1.8, $.ajax() always returns a jqXHR object. 17679 if (this.xhr && this.xhr.statusText !== "canceled") { 17680 this._addClass(tab, "ui-tabs-loading"); 17681 panel.attr("aria-busy", "true"); 17682 17683 this.xhr 17684 .done(function (response, status, jqXHR) { 17685 // support: jQuery <1.8 17686 // http://bugs.jquery.com/ticket/11778 17687 setTimeout(function () { 17688 panel.html(response); 17689 that._trigger("load", event, eventData); 17690 17691 complete(jqXHR, status); 17692 }, 1); 17693 }) 17694 .fail(function (jqXHR, status) { 17695 // support: jQuery <1.8 17696 // http://bugs.jquery.com/ticket/11778 17697 setTimeout(function () { 17698 complete(jqXHR, status); 17699 }, 1); 17700 }); 17701 } 17702 }, 17703 17704 _ajaxSettings: function (anchor, event, eventData) { 17705 var that = this; 17706 return { 17707 // Support: IE <11 only 17708 // Strip any hash that exists to prevent errors with the Ajax request 17709 url: anchor.attr("href").replace(/#.*$/, ""), 17710 beforeSend: function (jqXHR, settings) { 17711 return that._trigger("beforeLoad", event, 17712 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 17713 } 17714 }; 17715 }, 17716 17717 _getPanelForTab: function (tab) { 17718 var id = $(tab).attr("aria-controls"); 17719 return this.element.find(this._sanitizeSelector("#" + id)); 17720 } 17721 }); 17722 17723 // DEPRECATED 17724 // TODO: Switch return back to widget declaration at top of file when this is removed 17725 if ($.uiBackCompat !== false) { 17726 // Backcompat for ui-tab class (now ui-tabs-tab) 17727 $.widget("ui.tabs", $.ui.tabs, { 17728 _processTabs: function () { 17729 this._superApply(arguments); 17730 this._addClass(this.tabs, "ui-tab"); 17731 } 17732 }); 17733 } 17734 17735 var widgetsTabs = $.ui.tabs; 17736 17737 /*! 17738 * jQuery UI Tooltip 1.12.1 17739 * http://jqueryui.com 17740 * 17741 * Copyright jQuery Foundation and other contributors 17742 * Released under the MIT license. 17743 * http://jquery.org/license 17744 */ 17745 17746 //>>label: Tooltip 17747 //>>group: Widgets 17748 //>>description: Shows additional information for any element on hover or focus. 17749 //>>docs: http://api.jqueryui.com/tooltip/ 17750 //>>demos: http://jqueryui.com/tooltip/ 17751 //>>css.structure: ../../themes/base/core.css 17752 //>>css.structure: ../../themes/base/tooltip.css 17753 //>>css.theme: ../../themes/base/theme.css 17754 17755 $.widget("ui.tooltip", { 17756 version: "1.12.1", 17757 options: { 17758 classes: { 17759 "ui-tooltip": "ui-corner-all ui-widget-shadow" 17760 }, 17761 content: function () { 17762 // support: IE<9, Opera in jQuery <1.7 17763 // .text() can't accept undefined, so coerce to a string 17764 var title = $(this).attr("title") || ""; 17765 17766 // Escape title, since we're going from an attribute to raw HTML 17767 return $("<a>").text(title).html(); 17768 }, 17769 hide: true, 17770 17771 // Disabled elements have inconsistent behavior across browsers (#8661) 17772 items: "[title]:not([disabled])", 17773 position: { 17774 my: "left top+15", 17775 at: "left bottom", 17776 collision: "flipfit flip" 17777 }, 17778 show: true, 17779 track: false, 17780 17781 // Callbacks 17782 close: null, 17783 open: null 17784 }, 17785 17786 _addDescribedBy: function (elem, id) { 17787 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 17788 describedby.push(id); 17789 elem 17790 .data("ui-tooltip-id", id) 17791 .attr("aria-describedby", $.trim(describedby.join(" "))); 17792 }, 17793 17794 _removeDescribedBy: function (elem) { 17795 var id = elem.data("ui-tooltip-id"), 17796 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 17797 index = $.inArray(id, describedby); 17798 17799 if (index !== -1) { 17800 describedby.splice(index, 1); 17801 } 17802 17803 elem.removeData("ui-tooltip-id"); 17804 describedby = $.trim(describedby.join(" ")); 17805 if (describedby) { 17806 elem.attr("aria-describedby", describedby); 17807 } else { 17808 elem.removeAttr("aria-describedby"); 17809 } 17810 }, 17811 17812 _create: function () { 17813 this._on({ 17814 mouseover: "open", 17815 focusin: "open" 17816 }); 17817 17818 // IDs of generated tooltips, needed for destroy 17819 this.tooltips = {}; 17820 17821 // IDs of parent tooltips where we removed the title attribute 17822 this.parents = {}; 17823 17824 // Append the aria-live region so tooltips announce correctly 17825 this.liveRegion = $("<div>") 17826 .attr({ 17827 role: "log", 17828 "aria-live": "assertive", 17829 "aria-relevant": "additions" 17830 }) 17831 .appendTo(this.document[0].body); 17832 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 17833 17834 this.disabledTitles = $([]); 17835 }, 17836 17837 _setOption: function (key, value) { 17838 var that = this; 17839 17840 this._super(key, value); 17841 17842 if (key === "content") { 17843 $.each(this.tooltips, function (id, tooltipData) { 17844 that._updateContent(tooltipData.element); 17845 }); 17846 } 17847 }, 17848 17849 _setOptionDisabled: function (value) { 17850 this[value ? "_disable" : "_enable"](); 17851 }, 17852 17853 _disable: function () { 17854 var that = this; 17855 17856 // Close open tooltips 17857 $.each(this.tooltips, function (id, tooltipData) { 17858 var event = $.Event("blur"); 17859 event.target = event.currentTarget = tooltipData.element[0]; 17860 that.close(event, true); 17861 }); 17862 17863 // Remove title attributes to prevent native tooltips 17864 this.disabledTitles = this.disabledTitles.add( 17865 this.element.find(this.options.items).addBack() 17866 .filter(function () { 17867 var element = $(this); 17868 if (element.is("[title]")) { 17869 return element 17870 .data("ui-tooltip-title", element.attr("title")) 17871 .removeAttr("title"); 17872 } 17873 }) 17874 ); 17875 }, 17876 17877 _enable: function () { 17878 // restore title attributes 17879 this.disabledTitles.each(function () { 17880 var element = $(this); 17881 if (element.data("ui-tooltip-title")) { 17882 element.attr("title", element.data("ui-tooltip-title")); 17883 } 17884 }); 17885 this.disabledTitles = $([]); 17886 }, 17887 17888 open: function (event) { 17889 var that = this, 17890 target = $(event ? event.target : this.element) 17891 17892 // we need closest here due to mouseover bubbling, 17893 // but always pointing at the same event target 17894 .closest(this.options.items); 17895 17896 // No element to show a tooltip for or the tooltip is already open 17897 if (!target.length || target.data("ui-tooltip-id")) { 17898 return; 17899 } 17900 17901 if (target.attr("title")) { 17902 target.data("ui-tooltip-title", target.attr("title")); 17903 } 17904 17905 target.data("ui-tooltip-open", true); 17906 17907 // Kill parent tooltips, custom or native, for hover 17908 if (event && event.type === "mouseover") { 17909 target.parents().each(function () { 17910 var parent = $(this), 17911 blurEvent; 17912 if (parent.data("ui-tooltip-open")) { 17913 blurEvent = $.Event("blur"); 17914 blurEvent.target = blurEvent.currentTarget = this; 17915 that.close(blurEvent, true); 17916 } 17917 if (parent.attr("title")) { 17918 parent.uniqueId(); 17919 that.parents[this.id] = { 17920 element: this, 17921 title: parent.attr("title") 17922 }; 17923 parent.attr("title", ""); 17924 } 17925 }); 17926 } 17927 17928 this._registerCloseHandlers(event, target); 17929 this._updateContent(target, event); 17930 }, 17931 17932 _updateContent: function (target, event) { 17933 var content, 17934 contentOption = this.options.content, 17935 that = this, 17936 eventType = event ? event.type : null; 17937 17938 if (typeof contentOption === "string" || contentOption.nodeType || 17939 contentOption.jquery) { 17940 return this._open(event, target, contentOption); 17941 } 17942 17943 content = contentOption.call(target[0], function (response) { 17944 // IE may instantly serve a cached response for ajax requests 17945 // delay this call to _open so the other call to _open runs first 17946 that._delay(function () { 17947 // Ignore async response if tooltip was closed already 17948 if (!target.data("ui-tooltip-open")) { 17949 return; 17950 } 17951 17952 // JQuery creates a special event for focusin when it doesn't 17953 // exist natively. To improve performance, the native event 17954 // object is reused and the type is changed. Therefore, we can't 17955 // rely on the type being correct after the event finished 17956 // bubbling, so we set it back to the previous value. (#8740) 17957 if (event) { 17958 event.type = eventType; 17959 } 17960 this._open(event, target, response); 17961 }); 17962 }); 17963 if (content) { 17964 this._open(event, target, content); 17965 } 17966 }, 17967 17968 _open: function (event, target, content) { 17969 var tooltipData, tooltip, delayedShow, a11yContent, 17970 positionOption = $.extend({}, this.options.position); 17971 17972 if (!content) { 17973 return; 17974 } 17975 17976 // Content can be updated multiple times. If the tooltip already 17977 // exists, then just update the content and bail. 17978 tooltipData = this._find(target); 17979 if (tooltipData) { 17980 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 17981 return; 17982 } 17983 17984 // If we have a title, clear it to prevent the native tooltip 17985 // we have to check first to avoid defining a title if none exists 17986 // (we don't want to cause an element to start matching [title]) 17987 // 17988 // We use removeAttr only for key events, to allow IE to export the correct 17989 // accessible attributes. For mouse events, set to empty string to avoid 17990 // native tooltip showing up (happens only when removing inside mouseover). 17991 if (target.is("[title]")) { 17992 if (event && event.type === "mouseover") { 17993 target.attr("title", ""); 17994 } else { 17995 target.removeAttr("title"); 17996 } 17997 } 17998 17999 tooltipData = this._tooltip(target); 18000 tooltip = tooltipData.tooltip; 18001 this._addDescribedBy(target, tooltip.attr("id")); 18002 tooltip.find(".ui-tooltip-content").html(content); 18003
vendor: 6,757 bytes, lines 18004-18228
18004 // Support: Voiceover on OS X, JAWS on IE <= 9 18005 // JAWS announces deletions even when aria-relevant="additions" 18006 // Voiceover will sometimes re-read the entire log region's contents from the beginning 18007 this.liveRegion.children().hide(); 18008 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 18009 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 18010 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 18011 a11yContent.appendTo(this.liveRegion); 18012 18013 function position(event) { 18014 positionOption.of = event; 18015 if (tooltip.is(":hidden")) { 18016 return; 18017 } 18018 tooltip.position(positionOption); 18019 } 18020 if (this.options.track && event && /^mouse/.test(event.type)) { 18021 this._on(this.document, { 18022 mousemove: position 18023 }); 18024 18025 // trigger once to override element-relative positioning 18026 position(event); 18027 } else { 18028 tooltip.position($.extend({ 18029 of: target 18030 }, this.options.position)); 18031 } 18032 18033 tooltip.hide(); 18034 18035 this._show(tooltip, this.options.show); 18036 18037 // Handle tracking tooltips that are shown with a delay (#8644). As soon 18038 // as the tooltip is visible, position the tooltip using the most recent 18039 // event. 18040 // Adds the check to add the timers only when both delay and track options are set (#14682) 18041 if (this.options.track && this.options.show && this.options.show.delay) { 18042 delayedShow = this.delayedShow = setInterval(function () { 18043 if (tooltip.is(":visible")) { 18044 position(positionOption.of); 18045 clearInterval(delayedShow); 18046 } 18047 }, $.fx.interval); 18048 } 18049 18050 this._trigger("open", event, { tooltip: tooltip }); 18051 }, 18052 18053 _registerCloseHandlers: function (event, target) { 18054 var events = { 18055 keyup: function (event) { 18056 if (event.keyCode === $.ui.keyCode.ESCAPE) { 18057 var fakeEvent = $.Event(event); 18058 fakeEvent.currentTarget = target[0]; 18059 this.close(fakeEvent, true); 18060 } 18061 } 18062 }; 18063 18064 // Only bind remove handler for delegated targets. Non-delegated 18065 // tooltips will handle this in destroy. 18066 if (target[0] !== this.element[0]) { 18067 events.remove = function () { 18068 this._removeTooltip(this._find(target).tooltip); 18069 }; 18070 } 18071 18072 if (!event || event.type === "mouseover") { 18073 events.mouseleave = "close"; 18074 } 18075 if (!event || event.type === "focusin") { 18076 events.focusout = "close"; 18077 } 18078 this._on(true, target, events); 18079 }, 18080 18081 close: function (event) { 18082 var tooltip, 18083 that = this, 18084 target = $(event ? event.currentTarget : this.element), 18085 tooltipData = this._find(target); 18086 18087 // The tooltip may already be closed 18088 if (!tooltipData) { 18089 // We set ui-tooltip-open immediately upon open (in open()), but only set the 18090 // additional data once there's actually content to show (in _open()). So even if the 18091 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 18092 // the period between open() and _open(). 18093 target.removeData("ui-tooltip-open"); 18094 return; 18095 } 18096 18097 tooltip = tooltipData.tooltip; 18098 18099 // Disabling closes the tooltip, so we need to track when we're closing 18100 // to avoid an infinite loop in case the tooltip becomes disabled on close 18101 if (tooltipData.closing) { 18102 return; 18103 } 18104 18105 // Clear the interval for delayed tracking tooltips 18106 clearInterval(this.delayedShow); 18107 18108 // Only set title if we had one before (see comment in _open()) 18109 // If the title attribute has changed since open(), don't restore 18110 if (target.data("ui-tooltip-title") && !target.attr("title")) { 18111 target.attr("title", target.data("ui-tooltip-title")); 18112 } 18113 18114 this._removeDescribedBy(target); 18115 18116 tooltipData.hiding = true; 18117 tooltip.stop(true); 18118 this._hide(tooltip, this.options.hide, function () { 18119 that._removeTooltip($(this)); 18120 }); 18121 18122 target.removeData("ui-tooltip-open"); 18123 this._off(target, "mouseleave focusout keyup"); 18124 18125 // Remove 'remove' binding only on delegated targets 18126 if (target[0] !== this.element[0]) { 18127 this._off(target, "remove"); 18128 } 18129 this._off(this.document, "mousemove"); 18130 18131 if (event && event.type === "mouseleave") { 18132 $.each(this.parents, function (id, parent) { 18133 $(parent.element).attr("title", parent.title); 18134 delete that.parents[id]; 18135 }); 18136 } 18137 18138 tooltipData.closing = true; 18139 this._trigger("close", event, { tooltip: tooltip }); 18140 if (!tooltipData.hiding) { 18141 tooltipData.closing = false; 18142 } 18143 }, 18144 18145 _tooltip: function (element) { 18146 var tooltip = $("<div>").attr("role", "tooltip"), 18147 content = $("<div>").appendTo(tooltip), 18148 id = tooltip.uniqueId().attr("id"); 18149 18150 this._addClass(content, "ui-tooltip-content"); 18151 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 18152 18153 tooltip.appendTo(this._appendTo(element)); 18154 18155 return this.tooltips[id] = { 18156 element: element, 18157 tooltip: tooltip 18158 }; 18159 }, 18160 18161 _find: function (target) { 18162 var id = target.data("ui-tooltip-id"); 18163 return id ? this.tooltips[id] : null; 18164 }, 18165 18166 _removeTooltip: function (tooltip) { 18167 tooltip.remove(); 18168 delete this.tooltips[tooltip.attr("id")]; 18169 }, 18170 18171 _appendTo: function (target) { 18172 var element = target.closest(".ui-front, dialog"); 18173 18174 if (!element.length) { 18175 element = this.document[0].body; 18176 } 18177 18178 return element; 18179 }, 18180 18181 _destroy: function () { 18182 var that = this; 18183 18184 // Close open tooltips 18185 $.each(this.tooltips, function (id, tooltipData) { 18186 // Delegate to close method to handle common cleanup 18187 var event = $.Event("blur"), 18188 element = tooltipData.element; 18189 event.target = event.currentTarget = element[0]; 18190 that.close(event, true); 18191 18192 // Remove immediately; destroying an open tooltip doesn't use the 18193 // hide animation 18194 $("#" + id).remove(); 18195 18196 // Restore the title 18197 if (element.data("ui-tooltip-title")) { 18198 // If the title attribute has changed since open(), don't restore 18199 if (!element.attr("title")) { 18200 element.attr("title", element.data("ui-tooltip-title")); 18201 } 18202 element.removeData("ui-tooltip-title"); 18203 } 18204 }); 18205 this.liveRegion.remove(); 18206 } 18207 }); 18208 18209 // DEPRECATED 18210 // TODO: Switch return back to widget declaration at top of file when this is removed 18211 if ($.uiBackCompat !== false) { 18212 // Backcompat for tooltipClass option 18213 $.widget("ui.tooltip", $.ui.tooltip, { 18214 options: { 18215 tooltipClass: null 18216 }, 18217 _tooltip: function () { 18218 var tooltipData = this._superApply(arguments); 18219 if (this.options.tooltipClass) { 18220 tooltipData.tooltip.addClass(this.options.tooltipClass); 18221 } 18222 return tooltipData; 18223 } 18224 }); 18225 } 18226 18227 var widgetsTooltip = $.ui.tooltip; 18228}));
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.